forked from bioclipse/bioclipse.core
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a BIRT plugin for Bioclipse that initializes WebViewer in backg…
…round on startup.
- Loading branch information
Showing
8 changed files
with
265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> | ||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>net.bioclipse.birt</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.ManifestBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.pde.SchemaBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.pde.PluginNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Manifest-Version: 1.0 | ||
Bundle-ManifestVersion: 2 | ||
Bundle-Name: Bioclipse Birt | ||
Bundle-SymbolicName: net.bioclipse.birt;singleton:=true | ||
Bundle-Version: 0.1.1 | ||
Bundle-Activator: net.bioclipse.birt.Activator | ||
Bundle-Vendor: The Bioclipse Team | ||
Require-Bundle: org.eclipse.ui, | ||
org.eclipse.core.runtime, | ||
org.eclipse.birt.report.viewer;bundle-version="2.3.2", | ||
org.eclipse.ui.browser;bundle-version="3.2.201", | ||
org.eclipse.ui.editors;bundle-version="3.4.0", | ||
org.eclipse.ui.ide;bundle-version="3.4.2", | ||
org.eclipse.core.resources;bundle-version="3.4.2", | ||
org.eclipse.birt.report.engine;bundle-version="2.3.2" | ||
Bundle-RequiredExecutionEnvironment: J2SE-1.5 | ||
Bundle-ActivationPolicy: lazy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
source.. = src/ | ||
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
plugin.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<?eclipse version="3.4"?> | ||
<plugin> | ||
|
||
<extension point="org.eclipse.ui.startup"> | ||
<startup class="net.bioclipse.birt.Startup"/> | ||
</extension> | ||
|
||
</plugin> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<report xmlns="http://www.eclipse.org/birt/2005/design" version="3.2.17" id="1"> | ||
<property name="units">in</property> | ||
<property name="iconFile">/templates/blank_report.gif</property> | ||
<property name="bidiLayoutOrientation">ltr</property> | ||
<styles> | ||
<style name="crosstab" id="4"> | ||
<property name="borderBottomColor">#CCCCCC</property> | ||
<property name="borderBottomStyle">solid</property> | ||
<property name="borderBottomWidth">1pt</property> | ||
<property name="borderLeftColor">#CCCCCC</property> | ||
<property name="borderLeftStyle">solid</property> | ||
<property name="borderLeftWidth">1pt</property> | ||
<property name="borderRightColor">#CCCCCC</property> | ||
<property name="borderRightStyle">solid</property> | ||
<property name="borderRightWidth">1pt</property> | ||
<property name="borderTopColor">#CCCCCC</property> | ||
<property name="borderTopStyle">solid</property> | ||
<property name="borderTopWidth">1pt</property> | ||
</style> | ||
<style name="crosstab-cell" id="5"> | ||
<property name="borderBottomColor">#CCCCCC</property> | ||
<property name="borderBottomStyle">solid</property> | ||
<property name="borderBottomWidth">1pt</property> | ||
<property name="borderLeftColor">#CCCCCC</property> | ||
<property name="borderLeftStyle">solid</property> | ||
<property name="borderLeftWidth">1pt</property> | ||
<property name="borderRightColor">#CCCCCC</property> | ||
<property name="borderRightStyle">solid</property> | ||
<property name="borderRightWidth">1pt</property> | ||
<property name="borderTopColor">#CCCCCC</property> | ||
<property name="borderTopStyle">solid</property> | ||
<property name="borderTopWidth">1pt</property> | ||
</style> | ||
</styles> | ||
<page-setup> | ||
<simple-master-page name="Simple MasterPage" id="2"> | ||
<page-footer> | ||
<text id="3"> | ||
<property name="contentType">html</property> | ||
<text-property name="content"><![CDATA[<value-of>new Date()</value-of>]]></text-property> | ||
</text> | ||
</page-footer> | ||
</simple-master-page> | ||
</page-setup> | ||
</report> |
50 changes: 50 additions & 0 deletions
50
plugins/net.bioclipse.birt/src/net/bioclipse/birt/Activator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package net.bioclipse.birt; | ||
|
||
import org.eclipse.ui.plugin.AbstractUIPlugin; | ||
import org.osgi.framework.BundleContext; | ||
|
||
/** | ||
* The activator class controls the plug-in life cycle | ||
*/ | ||
public class Activator extends AbstractUIPlugin { | ||
|
||
// The plug-in ID | ||
public static final String PLUGIN_ID = "net.bioclipse.birt"; | ||
|
||
// The shared instance | ||
private static Activator plugin; | ||
|
||
/** | ||
* The constructor | ||
*/ | ||
public Activator() { | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) | ||
*/ | ||
public void start(BundleContext context) throws Exception { | ||
super.start(context); | ||
plugin = this; | ||
} | ||
|
||
/* | ||
* (non-Javadoc) | ||
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) | ||
*/ | ||
public void stop(BundleContext context) throws Exception { | ||
plugin = null; | ||
super.stop(context); | ||
} | ||
|
||
/** | ||
* Returns the shared instance | ||
* | ||
* @return the shared instance | ||
*/ | ||
public static Activator getDefault() { | ||
return plugin; | ||
} | ||
|
||
} |
103 changes: 103 additions & 0 deletions
103
plugins/net.bioclipse.birt/src/net/bioclipse/birt/Startup.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2009 Ola Spjuth. | ||
* All rights reserved. This program and the accompanying materials | ||
* are made available under the terms of the Eclipse Public License v1.0 | ||
* which accompanies this distribution, and is available at | ||
* http://www.eclipse.org/legal/epl-v10.html | ||
* | ||
* Contributors: | ||
* Ola Spjuth - initial API and implementation | ||
******************************************************************************/ | ||
package net.bioclipse.birt; | ||
import java.io.ByteArrayOutputStream; | ||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.util.HashMap; | ||
|
||
import org.eclipse.birt.report.viewer.utilities.WebViewer; | ||
import org.eclipse.core.runtime.FileLocator; | ||
import org.eclipse.core.runtime.IProgressMonitor; | ||
import org.eclipse.core.runtime.IStatus; | ||
import org.eclipse.core.runtime.Path; | ||
import org.eclipse.core.runtime.Status; | ||
import org.eclipse.core.runtime.jobs.Job; | ||
import org.eclipse.swt.SWT; | ||
import org.eclipse.swt.browser.Browser; | ||
import org.eclipse.swt.widgets.Display; | ||
import org.eclipse.swt.widgets.Shell; | ||
import org.eclipse.ui.IStartup; | ||
import org.osgi.framework.Bundle; | ||
|
||
/** | ||
* | ||
* @author ola | ||
* | ||
*/ | ||
public class Startup implements IStartup { | ||
|
||
Browser browser; | ||
|
||
public void earlyStartup() { | ||
|
||
Display.getDefault().syncExec( new Runnable(){ | ||
|
||
public void run() { | ||
final Shell shell = new Shell(Display.getDefault()); | ||
browser=new Browser(shell, SWT.NONE); | ||
}} ); | ||
|
||
|
||
|
||
|
||
//Start up a background job for starting BIRT | ||
Job loadBirtJob=new Job("Starting BIRT engine"){ | ||
|
||
@Override | ||
protected IStatus run( IProgressMonitor monitor ) { | ||
|
||
monitor.beginTask( "Initializing BIRT ", 3 ); | ||
monitor.worked( 1 ); | ||
|
||
WebViewer.startup(); | ||
|
||
Bundle bundle = org.eclipse.core.runtime.Platform.getBundle( | ||
Activator.PLUGIN_ID); | ||
URL url = FileLocator.find(bundle, | ||
new Path("/reports/empty.rptdesign"), | ||
null); | ||
final String rpt; | ||
try { | ||
rpt = FileLocator.toFileURL(url).getPath(); | ||
|
||
//Do new viewer | ||
// ViewerPlugin.getDefault( ).getPluginPreferences( ).setValue("APPCONTEXT_EXTENSION_KEY", "MyAppContext"); | ||
|
||
final HashMap myparms = new HashMap(); | ||
myparms.put("SERVLET_NAME_KEY", "frameset"); | ||
myparms.put("FORMAT_KEY", "html"); | ||
|
||
monitor.worked( 1 ); | ||
|
||
Display.getDefault().syncExec( new Runnable(){ | ||
|
||
public void run() { | ||
WebViewer.display(rpt, browser, myparms); | ||
}} ); | ||
|
||
|
||
} catch ( IOException e ) { | ||
e.printStackTrace(); | ||
} | ||
|
||
monitor.done(); | ||
return Status.OK_STATUS; | ||
} | ||
|
||
}; | ||
loadBirtJob.setUser( false ); | ||
loadBirtJob.schedule(); | ||
|
||
|
||
} | ||
|
||
} |