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 "Papyrus/Papyrus Developer Guide/Type Creation"

Line 4: Line 4:
 
By default, it exists a creation service for UML. Dedicated creation service for profiles can be easily added.
 
By default, it exists a creation service for UML. Dedicated creation service for profiles can be easily added.
  
Gmf concepts:
+
 
 +
== Gmf concepts ==
 +
 
 
The service creation is based on the framework of GMF, see http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r5m0/index.jsp?topic=/com.ibm.xtools.modeler.doc.isv/prog-guide/creating-types.html
 
The service creation is based on the framework of GMF, see http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r5m0/index.jsp?topic=/com.ibm.xtools.modeler.doc.isv/prog-guide/creating-types.html
  
Line 18: Line 20:
 
• An advice in charge to initialize name of element is also added. For more details, the plugin.xml and the code can be seen in the plugin or.eclipse.papyrus.uml.service.creation http://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.papyrus/branches/0.7.X/plugins/uml/org.eclipse.papyrus.uml.service.creation.
 
• An advice in charge to initialize name of element is also added. For more details, the plugin.xml and the code can be seen in the plugin or.eclipse.papyrus.uml.service.creation http://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.papyrus/branches/0.7.X/plugins/uml/org.eclipse.papyrus.uml.service.creation.
  
Papyrus adding:
+
 
 +
== Papyrus adding ==
 +
 
 
By this mechanism, several clientContext can be found. In order to distinguish, ClientContext used for papyrus and other, a specific matcher has to be associated to this context. This matcher has to implement IPapyrusContextMatcher.
 
By this mechanism, several clientContext can be found. In order to distinguish, ClientContext used for papyrus and other, a specific matcher has to be associated to this context. This matcher has to implement IPapyrusContextMatcher.
 
An useful class PapyrusClientContextManager does the find all context that has a matcher with the type IPapyrusContextMatcher.
 
An useful class PapyrusClientContextManager does the find all context that has a matcher with the type IPapyrusContextMatcher.
Line 24: Line 28:
 
   
 
   
  
Concept of filters
+
 
 +
== Concept of filters ==
 +
 
 
Thanks to this we can create all elements from all IClientContext in papyrus. Creation Menus of model explorer can be displayed if the command can be executed. This is the same function in the property view.
 
Thanks to this we can create all elements from all IClientContext in papyrus. Creation Menus of model explorer can be displayed if the command can be executed. This is the same function in the property view.
  

Revision as of 09:46, 25 August 2010

The goal of this page is to explain the architecture and how to add an element in the service creation.

For example, this service provides menu in the model explorer, or element that can be created in the property view. By default, it exists a creation service for UML. Dedicated creation service for profiles can be easily added.


Gmf concepts

The service creation is based on the framework of GMF, see http://publib.boulder.ibm.com/infocenter/rsmhelp/v7r5m0/index.jsp?topic=/com.ibm.xtools.modeler.doc.isv/prog-guide/creating-types.html

->picture

The pattern has bee applied to obtain a creation service for UML.

• The Enumeration UMLElementTypes contains all possible UML type that can be managed. • A DefaultUMLHelper it is associated, it provides set of commands in order to create them.

• In order to construct menu in the model explorer by using extension point ui.menus (http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse.platform.doc.isv/guide/workbench_cmd_menus.htm), a set of handler is added. This set of handler has in charge to call a create command for an element.

• An advice in charge to initialize name of element is also added. For more details, the plugin.xml and the code can be seen in the plugin or.eclipse.papyrus.uml.service.creation http://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.papyrus/branches/0.7.X/plugins/uml/org.eclipse.papyrus.uml.service.creation.


Papyrus adding

By this mechanism, several clientContext can be found. In order to distinguish, ClientContext used for papyrus and other, a specific matcher has to be associated to this context. This matcher has to implement IPapyrusContextMatcher. An useful class PapyrusClientContextManager does the find all context that has a matcher with the type IPapyrusContextMatcher. This class can be used as an entry point to access to all types that can be created by papyrus. (used in the property view)


Concept of filters

Thanks to this we can create all elements from all IClientContext in papyrus. Creation Menus of model explorer can be displayed if the command can be executed. This is the same function in the property view.

In order to customize papyrus, filters on possible command are needed. An abstract class provides the mechanism of filter see PapyrusEditHelperFilter. By implementing the method valideRequest you can restrict the menu creation

The example http://dev.eclipse.org/svnroot/modeling/org.eclipse.mdt.papyrus/branches/0.7.X/tests/org.eclipse.papyrus.restrictedservicecreation provides an example to reduce the creation menu.

This example allows only creation of package or class in a package and properties into a class. This plugin contains a filter in which the method validate request has been implemented.

Back to the top