MoDisco/Components/EclipsePlugin/Documentation/0.9

From Eclipsepedia

Jump to: navigation, search
MoDisco
Website
Download
Community
Mailing ListForums
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse SourceProject Set File

Contents

Eclipse plug-in metamodel

This metamodel is composed of a single EclipsePlugin class which defines references to the root model elements of the artifacts of the plug-in.

Eclipseplugin metamodel.PNG

  • bundle: refers to an instance of Bundle (from Manifest metamodel) which describes the content of the MANIFEST.MF file.
  • javaModel: refers to an instance of Model (from Java metamodel) which describes the Java source code of the plug-in.
  • pluginXml: refers to an instance of Root (from the XML metamodel) which describes the root of the plugin.xml file.
  • project: refers to an instance of Root (from the XML metamodel) which describes the root of the .project file.
  • classPathRoot: refers to an instance of Root (from the XML metamodel) which describes the root of the .classpath file.
  • pluginProperties: refers to an instance of CompilationUnit (from the Code package of Kdm metamodel) which describes the root of the plugin.properties file.
  • bundleProperties: refers to an instance of CompilationUnit (from the Code package of Kdm metamodel) which describes the root of the bundle.properties file.
  • buildProperties: refers to an instance of CompilationUnit (from the Code package of Kdm metamodel) which describes the root of the build.properties file.
  • inventoryProject: refers to an instance of Project(from the Source package of Kdm metamodel) which describes organization of folders and files within the plug-in project.

Manifest metamodel

This metamodel describes the content of a MANIFEST.MF file.

It is composed of four metaclasses:

Manifest metamodel.PNG

Eclipse plug-in discoverer

The discoverer of the model of an Eclipse plug-in creates an instance of EclipsePlugin, then creates the related models, and finally creates the relations from the EclipsePlugin instance to the root of each related model.

To create the related models, this discoverer calls these discoverers:

  • The Java discoverer: creates the Java model from a Java project.
  • The Xml discoverer: creates a XML model from an XML file (used for .project, .classpath and plugin.xml files).
  • The KDM Source discoverer: creates a KDM model (using source package) to describe the organization of a project
  • The Properties discoverer: creates a KDM model (using the code package) from a properties file.
  • The Manifest discoverer: creates a Manifest model from the MANIFEST.MF file.

The Manifest discoverer

This discoverer is provided by the org.eclipse.modisco.eclipseplugin.discoverer plugin.

It can be launched from the workbench by selecting a MANIFEST.MF file:

Manifest discoverer.PNG

Or programmatically by using the discoverElement API of the ManifestModelDiscoverer class:

public Resource executeManifestDiscoverer(final IResource source) {
     Discoverer discoverer=new ManifestModelDiscoverer();
     Resource resource = null;
     if (discoverer.isApplicableTo(source)) {
          Map<DiscoveryParameter, Object> discoveryParameters = 
               new HashMap<DiscoveryParameter, Object>();
          discoverer.discoverElement(source, discoveryParameters);
          resource = (Resource) discoveryParameters.get(
               ManifestModelDiscoverer.PARAMETER_TARGET_RESOURCE);
     }
     return resource;
}

The Properties discoverer

This discoverer is provided by the org.eclipse.modisco.eclipseplugin.discoverer plugin.

It can be launched from the workbench by selecting a MANIFEST.MF file: