1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| import org.eclipse.birt.report.viewer.utilities.WebViewer;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.browser.Browser;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
public class PreviewBirtActiontest implements IWorkbenchWindowActionDelegate {
//static Logger logger = Logger.getLogger(PreviewBirtAction.class.getName());
private IWorkbenchWindow window;
private String reportName;
private Browser browser;
/**
* The constructor.
*/
public PreviewBirtActiontest() {
}
public void setReportName(String report)
{
reportName = report;
}
public void setBrowser(Browser brw)
{
browser = brw;
}
public void run(IAction action) {
try {
System.setProperty( "RUN_UNDER_ECLIPSE", "true" );
WebViewer.display(reportName , WebViewer.HTML, browser, "run");
//WebViewer.display("C:/IANA/2005/Birt/RCP/testBirt/testSampleDB.rptdesign", WebViewer.HTML,false);
} catch (Exception e) {
//logger.error(e);
e.printStackTrace();
}
}
public void run() {
try {
//option 3 display in SWT Browser using /frameset mapping.
WebViewer.display(reportName, WebViewer.HTML, browser, "frameset");
//option 4 display in SWT Browser using /run mapping.
//WebViewer.display(reportName, WebViewer.HTML, browser, "run");
} catch (Exception e) {
//logger.error(e);
e.printStackTrace();
}
}
/**
* Selection in the workbench has been changed. We
* can change the state of the 'real' action here
* if we want, but this can only happen after
* the delegate has been created.
* @see IWorkbenchWindowActionDelegate#selectionChanged
*/
public void selectionChanged(IAction action, ISelection selection) {
}
/**
* We can use this method to dispose of any system
* resources we previously allocated.
* @see IWorkbenchWindowActionDelegate#dispose
*/
public void dispose() {
}
/**
* We will cache window object in order to
* be able to provide parent shell for the message dialog.
* @see IWorkbenchWindowActionDelegate#init
*/
public void init(IWorkbenchWindow window) {
this.window = window;
}
} |
Partager