[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[equinox-dev] Installing into Region

Hi,

we got a problem using equinox regions.

Our usecase:
We run an Eclipse IDE based on eclipse e4. There is a project called vaaclipse that also uses the e4 kernel and added Vaadin renderer to it. And we need to show up a "Preview View" for the vaaclipse application in the IDE.


The problem:
Installing Vaaclipse into the IDE is not a good idea, since it will confuse the IDE by Extensions, OSGi-Services,...


Our approach:
1) Starting up the IDE
2) Creating a new Region called "Vaaclipse"
2a) If a Region was available, we remove it first
2b) Reading all bundles from a specified target folder
2c) Installing the bundles from the target folder into the region
3) Setting startlevels,... and starting the application

For us it seems to be possible, since the "rootRegion" and the "Vaaclipse" region are completely decoupled (the have no connection)


But if we do so, stop the IDE and start the IDE again, all the bundles originally available in Eclipse have gone. Only the "system bundle" is left. The installed "target folder bundles" related with Region "Vaaclipse" are still there.


Here a short idea about our first prototype approach:
    public void start(BundleContext bc) throws Exception {
        Activator.context = bc;

        try {
            ServiceReference<RegionDigraph> ref = bc
                    .getServiceReference(RegionDigraph.class);
            digraph = bc.getService(ref);

            vaaclipseRegion = digraph.getRegion("vaaclipse");
            if (vaaclipseRegion != null) {
                digraph.removeRegion(vaaclipseRegion);
            }
            vaaclipseRegion = digraph.createRegion("vaaclipse");

File folder = new File("/Users/florianpirchner/Work/temp/tp");
for (File tpBundle : FileUtils.listFilesAndDirs(folder, FileFilterUtils.trueFileFilter(), FileFilterUtils.falseFileFilter())) {
if(tpBundle.isDirectory()) {
continue;
}
Bundle newB = vaaclipseRegion.installBundle("file:" + tpBundle
.getAbsolutePath());
vaaclipseRegion.addBundle(newB);
}
} catch (BundleException e) {
e.printStackTrace();
}
}



Thanks a lot for any help! Best