Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse RCP: How to access internal classes of plugins?

I want to use the default XML editor (org.eclipse.wst.xml.ui) of Eclipse in an RCP application. I need to read the DOM of the xml file currently open. The plugin doesn't offer any extension point, so I'm trying to access the internal classes. I am aware that the I should not access the internal classes, but I don't have another option.

My approach is to create a fragment and an extension point to be able to read data from the plugin. I'm trying not to recompile the plugin, that's why I thought that a fragment was necessary. I just want to load it and extract the data at runtime.

So, my question is: is there another way to access the classes of a plugin? if yes, how? Any tutorial, doc page or useful link for any of the methods is welcome.

like image 270
Andrei B. Avatar asked Sep 03 '09 03:09

Andrei B.


People also ask

What is Eclipse RCP application?

Eclipse RCP (Rich Client Platform) applications, use the Eclipse framework to create feature-rich stand-alone desktop applications. An Eclipse application consists of individual software components, called plug-ins. As Eclipse is build as an extensible framework, plug-ins can use and extend other plug-ins.

What is Eclipse plugin development?

The Eclipse PDE™ (Plug-in Development Environment) provides tools to create, develop, test, debug, build and deploy Eclipse plug-ins, fragments, features, update sites and RCP products.

What is a plugin in IDE?

A plug-in, like an object, is an encapsulation of behavior and/or data that interacts with other plug-ins to form a running program.


1 Answers

Since nobody answered my question and I found the answer after long searches, I will post the answer for others to use if they bump into this problem.

To access a plugin at runtime you must create and extension point and an extension attached to it into the plugin that you are trying to access.

Adding classes to a plugin using a fragment is not recommended if you want to access those classes from outside of the plugin.

So, the best solution for this is to get the plugin source from the CVS Repository and make the modifications directly into the source of the plugin. Add extension points, extensions and the code for functionality.

Tutorials:

  • Getting the plugin from the CVS Repository:
    http://www.eclipse.org/webtools/community/tutorials/DevelopingWTP/DevelopingWTP.html

  • Creating extensions and extension points and accessing them:
    http://www.vogella.de/articles/EclipseExtensionPoint/article.html
    http://www.eclipsezone.com/eclipse/forums/t97608.rhtml

like image 190
Andrei B. Avatar answered Sep 21 '22 10:09

Andrei B.