Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

doubts related to plugin development for eclipse

Very new to eclipse plugin development. I have converted jar project into eclipse plugin. But I really dont know, how to make use of it. Some basic doubts,

  1. How to call a method available in plugin in our program??
  2. Should every exposed method should be public, in order to use it in our program??

My idea is something like a plugin to sum two numbers. And user installs the plugin and call add(x,y) method in this plugin. Just like calling a method from an included jar.

There are many tutorials explaining how to create a plugin, but i didn't found how to use the same.

like image 575
Valath Avatar asked Apr 25 '26 16:04

Valath


1 Answers

What you are describing is a plain OSGi bundle, with no Eclipse-specific features. In terms of the New Plug-in wizard, yours "doesn't contribute to the UI". Technically, it means that it doesn't need plugin.xml.

The way your outside code perceives the bundle is just as if it was a regular jar: you can access its classes, instantiate them, and call their methods. Or you can call static methods, just like you are used to.

The additional layer provided by OSGi means you can identify which Java packages your bundle exports to its users. Therefore a class which is public, but doesn't reside in an exported package, is not accessible to other bundles (this applies only to the strict mode, however; otherwise you only get an Access Restriction warning).

like image 77
Marko Topolnik Avatar answered Apr 27 '26 07:04

Marko Topolnik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!