Skip to main content
Jump to: navigation, search

Difference between revisions of "MoDisco/Components/DiscoverersManager/Documentation/0.8"

(Launch configuration framework)
(Discoverer extension point)
Line 12: Line 12:
 
* '''class''' - Required - A class that implements the Discoverer interface to be managed and used by Discovery manager. When a corresponding element has been selected (filter provided by informations in extension part), a model can usually be retrieved by calling method "discoverElement", and it returns an EMF Resource.  
 
* '''class''' - Required - A class that implements the Discoverer interface to be managed and used by Discovery manager. When a corresponding element has been selected (filter provided by informations in extension part), a model can usually be retrieved by calling method "discoverElement", and it returns an EMF Resource.  
 
* '''path''' - Optional- To allow sub-menu path into root menu provided by Discovery Manager. For example, if your path is "j2se5/filters", the provided menu will be : <root menu> -> java -> filters -> Your Discoverer name
 
* '''path''' - Optional- To allow sub-menu path into root menu provided by Discovery Manager. For example, if your path is "j2se5/filters", the provided menu will be : <root menu> -> java -> filters -> Your Discoverer name
 +
* '''icon''' - Optional- To provide a specific icon for your discoverer. Used mainly in contextual menu to highlight your discoverer.
  
 
=== Discoverers registry ===
 
=== Discoverers registry ===

Revision as of 05:14, 17 March 2010

DEPRECATED use Template:MoDiscoTabs and Template:MoDiscoTab as explain here : Wiki Template for MoDisco

Features

Discoverer extension point

A discoverer must have a name and provide an implementation of the Discoverer interface to be managed by DiscoveryManager. For each discoverer, a new entry in the MoDisco menu will be added. However, each discoverer should provide a resource filter to adapt the menu depending on a single selected element.

Description of information in the contract of the discoverer extension point :

  • name - Required - information to identify a discoverer in the registry; it must be unique. This name will also be used to populate menu.
  • class - Required - A class that implements the Discoverer interface to be managed and used by Discovery manager. When a corresponding element has been selected (filter provided by informations in extension part), a model can usually be retrieved by calling method "discoverElement", and it returns an EMF Resource.
  • path - Optional- To allow sub-menu path into root menu provided by Discovery Manager. For example, if your path is "j2se5/filters", the provided menu will be : <root menu> -> java -> filters -> Your Discoverer name
  • icon - Optional- To provide a specific icon for your discoverer. Used mainly in contextual menu to highlight your discoverer.

Discoverers registry

The registry of discoverers references all discoverer extensions installed in the current Eclipse platform. The DiscoveryManager provides an access to this registry. There are two methods : one to retrieve all the discoverers and one to retrieve only one discoverer using its name to identify it.

 /**
  * Accessor to all discoverers registered in DiscoveryManager
  * through extensions.
  * 
  * @return the list of discoverers available in registry
  */
 public static List<? extends Discoverer> getDiscoverers()
 
 /**
  * Accessor to one discoverer registered in DiscoveryManager
  * through extensions.
  * 
  * @param discovererName name of a discoverer
  * @return the discoverer with specified name,
  *  or null if there is no discoverer registered with specified name.
  */
 public static Discoverer getDiscoverer(String discovererName)

Dynamic contextual menu

The contextual menu will be completed dynamically when a discoverer is able to manage the selected resource. For example, when a java project is selected (instance of IJavaProject):

Example with J2se5 discoverer

Launch configuration framework

The launch configuration framework provides a new type of launch configuration (named MoDisco Discoverers) accessible through the “Run Configurations …” menu.

Presentation of discoverer type

And here is an example of a discovery configuration.

Discovery configuration example

As you could see in launch configuration screenshot, you are able to configure the parameters of your discoverer. However, we provide only few editors for basic types. To be able to improve editing capabilities, we provide a specific extension point to map an editor with a type (for example, a file browser for "IFile" type).

Install

Sources

You will find a version of this plug-in in the SVN repository.

Connection parameters to the SVN repository: MoDisco/SVN.

Here are deployment instructions :

  • Import the project in your workspace using a SVN client.
  • Use the "export" menu to export this project as a plug-in (Deployable plug-ins and fragments) in your Eclipse installation. Don't forget to choose the "Package plug-ins as individual jar archives" option.
  • Re-start your Eclipse to take this plug-in into account.

Runtime

You could download it or use the update manager. See more ...

User manual

First step: in your plug-in properties (plugin.xml or META-INF/MANIFEST.MF), add a dependency to plug-in “org.eclipse.gmt.modisco.infra.discoverymanager”.

Dependency to plug-in DiscoveryManager

Second step: create a class in your plug-in that implements the Discoverer interface provided by the DiscoveryManager plug-in. See the javadoc of this interface for details of methods.

Creation of class which implements Discoverer

Third step: in your plug-in properties (plugin.xml or META-INF/MANIFEST.MF), create a “discoverers” extension.

Creation of discoverers extension

Fourth step: in discoverers extension, a discoverer declaration has been created automatically. You will have to fill element details to validate discoverer declaration.

Fill discoverer details


Congratulations, your first discoverer has been successfully defined.

If you want to add several discoverers in your plug-in, first you will have to add a discoverer in your “discoverers” extension.

Add another discoverer declaration in your extension

Then, you will have to fill element details to obtain a second valid discoverer.

Several discoverer declarations in your extension

Back to the top