Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "MoDisco/Components/EclipsePlugin/Documentation/0.9"

(Eclipse plug-in discoverer)
(Eclipse plug-in discoverer)
Line 27: Line 27:
 
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.
 
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 three other discoverers:
+
To create the related models, this discoverer calls these discoverers:
 
* The [[MoDisco/Components/Java/Documentation/0.9#Java_Discoverer|Java discoverer]]: creates the Java model from a Java project.
 
* The [[MoDisco/Components/Java/Documentation/0.9#Java_Discoverer|Java discoverer]]: creates the Java model from a Java project.
 
* The [[MoDisco/Components/XML/Documentation/0.9#XML_DiscovererXML|Xml discoverer]]: creates a XML model from an XML file (used for .project, .classpath and plugin.xml files).
 
* The [[MoDisco/Components/XML/Documentation/0.9#XML_DiscovererXML|Xml discoverer]]: creates a XML model from an XML file (used for .project, .classpath and plugin.xml files).
* The [[MoDisco/Components/KDM/Documentation/0.9#KDM_Source_Discoverer|KDM Source discoverer]: creates a KDM model (using source package) to describe the organization of a project
+
* The [[MoDisco/Components/KDM/Documentation/0.9#KDM_Source_Discoverer|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 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: creates a Manifest model from the MANIFEST.MF file.
 +
 
 +
=== The Manifest discoverer ===
 +
This discoverer can be launched from the workbench by selecting a MANIFEST.MF file:
 +
 
 +
[[Image: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;
 +
}

Revision as of 09:43, 10 November 2010

MoDisco
Website
Download
Community
Mailing ListForums
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse SourceProject Set File

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 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;
}

Back to the top