Page 1 of 1

Update framework from site on eclipse oxygen

Posted: Wed Nov 16, 2016 3:38 am
by odovao
Hi,

We have an eclipse RCP IDE with oxygen plugin installed and we also have an update site for the IDE plugins. Now we need to be able to update a custom framework from site.

Is it possible to update custom oxygen frameworks from the same update site (extending)? or we need an oxygen update site? if so will that work on a eclipse oxygen plugin? Please advice on the best way to do that.

We are using oxygen author 17

Many thanks,

Oscar

Re: Update framework from site on eclipse oxygen

Posted: Thu Nov 17, 2016 4:58 pm
by alex_jitianu
Hi Oscar,

You probably already have your own Eclipse plugin that uses the extension points provided by our oXygen XML Eclipse plug-in. if that's the case, then your plugin can set an additional frameworks location using our API:

Code: Select all

 PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty(
"additional.frameworks.directories",
new String[] {"absolute.file.path.to.frameworks.dir"});
A good place to call this would be an IStartup Eclipse extension because that gets called very early (in v17 this API needs to be called before Oxygen loads the frameworks). In Oxygen version 18.0 you can call this API anytime and we will reload the frameworks automatically. In version 18 there is also an EclipseWorkspaceAccessPluginExtension extension which is a good place to call this API.

So whenever your plugin gets updated it will also receive the latest Oxygen frameworks and, on startup, it will make Oxygen use them using our API. Please let me know if this solution applies in your case.

Best regards,
Alex

Re: Update framework from site on eclipse oxygen

Posted: Wed Nov 23, 2016 7:03 pm
by odovao
Hi Alex,


Thank you for your answer.

We can certainly use the additional framework locations feature, however if my updated plugin comes as a dependency (jar file) from the update site server, how can I point oxygen framework locations to that plugin?

Ideally we would like to extend the frameworks in a similar way as we extend document types, by extensions. Possible?

Please advice,

Thanks,
Oscar

Re: Update framework from site on eclipse oxygen

Posted: Thu Nov 24, 2016 12:49 pm
by alex_jitianu
Hi Oscar,
Ideally we would like to extend the frameworks in a similar way as we extend document types, by extensions. Possible?
Well, both a framework and a document type refer to the same thing. We kind of use both terms to refer to the configuration associated with a specific XML vocabulary.
how can I point oxygen framework locations to that plugin?
What I'm thinking is that your plugin has these document type extensions bundle in it. For example:

Code: Select all

D:\eclipse\plugins\com.myplugin.editor_17.1.0.v2015111718\frameworks\my_framework_directory
What your plugin must to is set D:\eclipse\plugins\com.myplugin.editor_17.1.0.v2015111718\frameworks as an additional frameworks location. Once it does that Oxygen will automatically load the document types from that location. When your plugin gets updates it will bring new versions for the frameworks too and, again, they will be loaded automatically.

So the question that remains to be answered is how does your plugin set the previous mentioned directory as an additional frameworks location? Well, your plugin could implement the IStartup extension point. On the earlyStartup() you can use our API like this:

Code: Select all



Bundle bundle = Platform.getBundle("my_plugin_id");
Path path = new Path("frameworks");
URL eclipseSpecificURL = FileLocator.find(bundle, path, null);
try {
URL genericURL = FileLocator.resolve(eclipseSpecificURL);
String absolutePath = new File(genericURL.getPath()).getAbsolutePath();

// Oxygen API
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty(
"additional.frameworks.directories",
new String[] {absolutePath});

} catch (IOException e) {
e.printStackTrace();
}
Please let me know is there are still unclear aspects.

Best regards,
Alex