Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » InstanceSpecification element on Composite diagram
icon4.gif  InstanceSpecification element on Composite diagram [message #1408232] Thu, 14 August 2014 14:59 Go to next message
Sofía Pérez is currently offline Sofía PérezFriend
Messages: 8
Registered: July 2014
Junior Member
Hi!
I need to add an InstanceSpecification element to a palette in a plugin based on the Composite plugin.

This is how I added it to the palette:

<aspectTool description="Create an element with the QoSValue stereotype" iconpath="platform:/plugin/org.eclipse.uml2.uml.edit/icons/full/obj16/InstanceSpecification.gif" id="soamlqospl.tool.instancespecification_1408021993017" name="QoSValue" refToolId="soamlqospl.tool.instancespecification">
<postAction id="org.eclipse.papyrus.applystereotypeactionprovider">
<stereotypesToApply>
<stereotype stereotypeName="SoaMLQoS::QoSValue"/>
</stereotypesToApply>
</postAction>
</aspectTool>

Then I added the element to the UMLPaletteFactory class like this:

private final static String SOAMLQOS_PL_TOOL_INSTANCESPECIFICATION = "soamlqospl.tool.instancespecification";//$NON-NLS-1$

And I modified the method createTool and added this method:

private Tool createInstanceSpecification11CreationTool() {
List<IElementType> types = new ArrayList<IElementType>(2);
types.add(UMLElementTypes.InstanceSpecification_2001);
types.add(UMLElementTypes.InstanceSpecification_3020);
Tool tool = new AspectUnspecifiedTypeCreationTool(types);
return tool;
}

The elements InstanceSpecification_2001 and InstanceSpecification_3020 didn't exist in the UMLElementTypes class so I had to add them.

Finally, I also modified the plugin.xml adding the entry for InstanceSpecification under the .paletteDefinition extension.

With the above changes I'm getting a NullPointerException at org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest.getDefaultLabel(CreateElementRequest.java:417)

The questions are:
1- Is it even possible to add an InstanceSpecification element to a palette in a Composite-based diagram?
2- If so, am I doing the right changes?
3- What else should I do?

Thank you so much,
Sofía
Re: InstanceSpecification element on Composite diagram [message #1409508 is a reply to message #1408232] Mon, 18 August 2014 09:33 Go to previous message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 678
Registered: February 2011
Senior Member
Hi Sofia,

If the diagram doesn't natively support the InstanceSpecification element, then modifying the palette will not be sufficient.

From Papyrus, we'd need to update the *.gmfgen model and regenerate the editor. However, you can't do that from an external plug-in, which means that all the modifications which can be generated would need to be done manually.

However, if you're willing to modify the Composite Diagram plug-in directly, then you should use only the *.gmfgen model, then regenerate the diagram. This is not really recommended however, as any modification to the real Papyrus Composite Diagram plug-in would most likely break your changes.

This is not really an extension we support in Papyrus (Although GMF allows that, so that's "feasible")

Regards,
Camille


Camille Letavernier
Papyrus developer
Previous Topic:Change node type on an activity diagram
Next Topic:Own DeleteFromDiagramCommandHandler
Goto Forum:
  


Current Time: Mon Jul 06 22:32:26 GMT 2015

Powered by FUDForum. Page generated in 0.01660 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software