-
Notifications
You must be signed in to change notification settings - Fork 16
Plugin Development
##Structure
The plugins are developed using E4 Eclipse RCP platform. The source code is contained in three or four packages based on the functionalities within the src directory. An example of the structure is given below.
- edu.usc.cssl.nlputils.plugins.weightedCount.handlers - contains menu item handler
- edu.usc.cssl.nlputils.plugins.weightedCount.parts - contains the GUI code
- edu.usc.cssl.nlputils.plugins.weightedCount.process - contains the core algorithm
The contributions of the plugin to the main application should be configured in the e4xmi file.
##Menu Contribution
If your plugin has to create a new menu in the main menu bar, a child menu should be created under menu:org.eclipse.ui.main.menu. For example, edu.usc.cssl.nlputils.application.menu.wordcount
If your plugin has to create a handled menu item under one of the available menus, add a handled menu item in the e4xmi file and contribute it to one of the menus. A list of the current menus are given below.
Crawl - edu.usc.cssl.nlputils.application.menu.crawlers
Preprocess - edu.usc.cssl.nlputils.application.menu.preprocessors
Word Count - edu.usc.cssl.nlputils.application.menu.wordcount
Classify - edu.usc.cssl.nlputils.application.menu.classifiers
Topic Model - edu.usc.cssl.nlputils.application.menu.topic
Clustering - edu.usc.cssl.nlputils.application.menu.clustering
Plugins - edu.usc.cssl.nlputils.application.menu.plugins
The GUI of your plugin should be implemented as a part and it should be added to the part stack of the main application having the ID org.eclipse.e4.ide.partstack . The visibility of the part should not be set and it should be made visible using the handler of the menu item.
Import the package edu.usc.cssl.nlputils.utilities and call the function Log.append(context, message) to print the message on the console. The context object can be obtained through dependency injection.
For accessing the global preprocessing settings, import edu.usc.cssl.nlputils.plugins.preprocessorService.services.PreprocessorService. Options can be set with setOptions(shell) function and preprocessing can be performed using doPreprocessing(outputDirectory) function.
There are two ways to add your plugin to the main application. You can add it to the main application's dependencies. This is a very easy way to include the plugin in the application while testing. The drawback is that other users will not be able to use your plugin. For sharing the plugin with the community, you have to export the plugin and install it in the application using the Plugins > Add Plugin menu option.