Extensibility architecture

The foundation of the UML Modeler extensibility is called the modeling platform. The modeling platform consists of a set of services that enable the management of UML 2.1 models and it is based on a UML 2.1 metamodel that the Eclipse MDT UML2 component provides. Because the metamodel is an Eclipse Modeling Framework (EMF) based implementation of the UML 2.1 specification, the objects that represent user models are UML2 objects.

The UML Modeler API consists of a single static utility class, and of several other classes and interfaces that are accessible from the UMLModeler class. The implementation of these other classes and interfaces spans several plug-ins in the product. These plug-ins are re-exported from the plug-in that exposes the UMLModeler class, which is part of the package named com.ibm.xtools.modeler.ui. To use the UML Modeler extensibility, API clients must add only a single plug-in dependency to the com.ibm.xtools.modeler.ui package.

UML Modeler API

The UML Modeler application programming interface (API) represents the UML Modeler primary package that exposes the entry point for the UML Modeler API. The package com.ibm.xtools.modeler.ui contains the UMLModeler class that exposes life-cycle operations for models and profiles, and provides access to the modeling platform.

For example, in most cases, the UMLModeler.openModel method returns a UML2 object Package (org.eclipse.uml2.uml, interface Package) in most cases. Similar to all UML2 objects, Package indirectly extends the EModelElement (org.eclipse.emf.ecore, interface EModelElement) EMF object.

The following modeling platform services are also available for EMF based models:
  • Services that perform basic queries on indexed EMF models through the interface IIndexSearchManager from the com.ibm.xtools.emf.index.search package
  • Services that allow participation in the model version upgrade and signature writing process through the interface IRMPResource from the com.ibm.xtools.emf.core.resource package
  • Services that perform queries on EMF models through the interface IQueryHelper from the com.ibm.xtools.modeler.ui package
  • Services that perform Object Constraints Language (OCL) queries on EMF models through the interface IOclQueryHelper from the com.ibm.xtools.modeler.ui package

For diagramming, the UML Modeler API uses the runtime environment of the Eclipse Graphical Modeling Framework (GMF) project. For example, the createDiagram (com.ibm.xtools.uml.ui.diagram, interface IUMLDiagramHelper) method returns a GMF Diagram (org.eclipse.gmf.runtime.notation, interface Diagram). This object contains View (org.eclipse.gmf.runtime.notation) objects through its getChildren() method. Each view can be associated with a semantic element. For UML model diagrams, these semantic elements are UML2 elements and are accessible from the View.getElement() method.

The modeling platform exposes interfaces to help manage notation-based diagrams:
  • A user interface helper for using UML2 elements through the interface IUMLUIHelper from the com.ibm.xtools.uml.ui package
  • A helper for using UML 2.0 notation-based diagrams through the interface IUMLDiagramHelper from the com.ibm.xtools.uml.ui.diagram package
  • UML 2.1-specific extensions to the GMF notation metamodel through the com.ibm.xtools.umlnotation package

The UML Modeler component supports UML model content in packages that are not models. Any assumption that the root element is a model is not valid. Models cannot be nested in packages. The assumption that a model has no owner is valid, although you should not make this assumption. The UML Modeler API manages the manifestations of this assumption.

For components that use UML Modeler resources, the following common patterns occur:

References to the Model metaclass and the related API:

Action Filters in plugin.xml file:
  • @isModel: In most cases, replace this filter with the new @isModelRoot filter, which matches any package that has no owner and it is not a profile.
  • @isModelOrProfile: In most cases, replaced this filter the new @isRootPackage filter, which matches any package that has no owner.
  • @isPackage: Use this filter when you assume that an element whose metaclass is exactly package has an owner.
  • @hasContainer and @hasNoContainer: These filters represent that simple packages can be unowned.
  • umlType and umlStrictType: These filters test for the "Model" value.

Miscellaneous:

  • Java manifest constants for the Model element type and any specializations: com.ibm.xtools.uml.type.UMLElementTypes.MODEL ( com.ibm.xtools.uml.core.internal.util.UMLType.MODEL is deprecated)
  • OCL expressions that can occur in profile constraints or XML
  • Offers access to the following:
  • Model metaclass that uses methods such as Model.allInstances(), oclIsKindOf(Model), oclIsTypeof(Model), oclAsType(Model).
  • UML-defined operations that use methods such as Element::getModel().
  • UML Model Templates and Libraries for a template or library that should be a Package instead of a Model.
  • UML Profiles for stereotypes that extending the Model metaclass which might need to extend Package, instead.
  • XPath expressions with an initial /Model step for JET templates, BIRT reports, XSLT stylesheets, and more.
  • "com.ibm.xtools.uml.model" for the ID of the Model element type (GMF Element Types), and that also looks for any specializations of this element type that a component might define.

com.ibm.xtools.modeler.ui.UMLModeler class

The package com.ibm.xtools.modeler.ui.UMLModeler contains the UMLModeler class. The UMLModeler class is a utility class that exposes model and profile lifecycle operations, and that provides access to the modeling platform. The UMLModeler class contains the methods saveModelResourceAs(Element model, String file) and saveProfileAs(Profile profile, String file).

The method saveModelResourceAs(Element model, String file) saves the model that a root model element specifies to the location the file specifies. The method saveProfileAs(Profile profile, String file) saves the profile specified by profile to the location specified by file.

Note: Some information, such as links to Eclipse documentation or to developer guides, is available only from the help topics that are installed with the product.

Feedback