Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor(Is it possible to copy the existing Class Diagram plugin project, modify it and deploy it additionally as own Diagram Editor)
Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor [message #1020610] Mon, 18 March 2013 15:03 Go to next message
Jan Winter is currently offline Jan WinterFriend
Messages: 1
Registered: March 2013
Junior Member
Hello!

I want to create a new Papyrus Diagram Editor and integrate it into Papyrus.

The existing Class Diagram Editor from org.eclipse.papyrus.uml.diagram.clazz does exactly what I need, I only have to do some modifications in one or two classes of this plugin.

What I done so far:
- I copied the org.eclipse.papyrus.uml.diagram.clazz plugin project and rename it into
org.eclipse.papyrus.uml.diagram.myeditor (also the subpackages are changed from clazz to myeditor)

- I changed every occurrence of the the word "clazz" into "myeditor" in the plugin.xml

- The plugin ID is changed to org.eclipse.papyrus.uml.diagram.myeditor

- I also changed the labels for the menu entries with the plugin.xml
for example in:

<menuContribution locationURI="menu:org.eclipse.papyrus.ui.menu">
	<menu id="org.eclipse.papyrus.uml.diagram.ui.menu.diagrams"
		label="Diagrams">
		<command commandId="org.eclipse.papyrus.uml.diagram.myeditor.CreateClassDiagramCommand"
			icon="icons/obj16/Diagram_Class.gif"
			label="Create a new MyEditor Diagram"
			style="push"
			tooltip="Create a new MyEditor Diagram">
			<visibleWhen>
				<reference definitionId="org.eclipse.papyrus.uml.diagram.common.IsPapyrusActiveWithUMLModel"/>
			</visibleWhen>
		</command>
	</menu>
	</menuContribution>


If I start a Runtime Eclipse Application from my plugin I see the Entry "MyEditor Diagram" in the list of available Editors but when I choose it, it still executes code from the original org.eclipse.papyrus.uml.diagram.clazz plugin

I checked this by putting a system.out.println command in the initializeGraphicalViewer() method of the class UMLDiagramEditor in my plugin and in the original org.eclipse.papyrus.uml.diagram.clazz plugin. The method initializeGraphicalViewer() from the original org.eclipse.papyrus.uml.diagram.clazz plugin is called.


Thanks in advance.

Best regards
Jan
Re: Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor [message #1021092 is a reply to message #1020610] Tue, 19 March 2013 14:08 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Jan,

You also need to update the ModelID and all textual occurrences of this constant:

org.eclipse.papyrus.uml.diagram.clazz.edit.parts.ModelEditPart.MODEL_ID
PapyrusUMLClassDiagram

That's not a clean way to reuse a Diagram, but currently, overriding a diagram is not officially supported in Papyrus.


Camille


Camille Letavernier
Re: Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor [message #1403429 is a reply to message #1021092] Wed, 23 July 2014 15:38 Go to previous messageGo to next message
Sofía Pérez is currently offline Sofía PérezFriend
Messages: 8
Registered: July 2014
Junior Member
Hello!
I'm trying to migrate a Papyrus plugin developed using Papyrus 0.7 and eclipse helios so it can work on Papyrus 1.0 and eclipse luna. Since Papyrus changed a lot, what I'm trying to do is make the changes I've done before to the new Papyrus source code. The changes I did were the ones mentioned by Jan and also the ones Camille suggested. The plugin has its own common component that creates the category for SoaML so that every diagram created has the SoaML profile set by default.
The problem is that when I install the plugins, I can see the SoaML option in the wizard where I have to select the diagram language, but when I select SoaML and click Next I don't see any diagram to choose.
I've compared both versions and I don't know what else I have to change in order to see the diagram kinds.
Can you help me with this issue?

Thank you!
Sofía
  • Attachment: wizard1.png
    (Size: 38.21KB, Downloaded 243 times)
  • Attachment: wizard2.png
    (Size: 36.00KB, Downloaded 257 times)
Re: Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor [message #1404747 is a reply to message #1403429] Tue, 05 August 2014 13:08 Go to previous messageGo to next message
Sofía Pérez is currently offline Sofía PérezFriend
Messages: 8
Registered: July 2014
Junior Member
So I figured this out by myself. I had to add the .configuration file to the common project with every diagram associated with SoaML.
The problem now is that Papyrus toolbar as well as the contextual menus don't show the corresponding SoaML menus, they show the creation options of UML diagrams.

You can find the soaml.configuration file attached.

Please, I really need your help, this project is very important because it's the final project of my Engineering degree.

Thank you!
Re: Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor [message #1404754 is a reply to message #1404747] Tue, 05 August 2014 13:56 Go to previous messageGo to next message
Camille Letavernier is currently offline Camille LetavernierFriend
Messages: 952
Registered: February 2011
Senior Member
Hi Sofia,

The *.configuration file is a viewpoint definition. Only one view point can be active at the same time in Papyrus.

You can change the current viewpoint in the preferences:

Window > Preferences > Papyrus > Viewpoints Configuration

Regards,
Camille


Camille Letavernier
Re: Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor [message #1404760 is a reply to message #1404754] Tue, 05 August 2014 14:28 Go to previous messageGo to next message
Sofía Pérez is currently offline Sofía PérezFriend
Messages: 8
Registered: July 2014
Junior Member
Hi Camille! Thank you so much for your reply!
I did what you suggested but when I select my configuration file embedded in the plugin, the New Diagram contextual menu is disabled. Besides, I would like to have both SoaML and UML diagrams available for creation. Is there a way, perhaps without using viewpoints, to do what I need?

My project consists of a Papyrus SoaML plugin, which has its own common component that creates the category for SoaML, so that every diagram created has the SoaML profile set by default. This plugin needs to offer several diagram kinds to create.
On the other hand, I have to implement a Papyrus QoS plugin that needs to interact with SoaML models.

I hope I did a good job explaining the requirements. I really appreciate your help!

Thank you,
Sofía
Re: Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor [message #1408186 is a reply to message #1404760] Thu, 14 August 2014 12:55 Go to previous messageGo to next message
Sofía Pérez is currently offline Sofía PérezFriend
Messages: 8
Registered: July 2014
Junior Member
I've been reading the Viewpoints in Papyrus documentation over and over and I'm pretty sure I'm doing everything as it says but my menus are still missing.

There's a part that says:
"It is possible to deploy custom viewpoints configuration through an Eclipse plugin and its contribution to an extension point. The identifier of the extension point to use is org.eclipse.papyrus.infra.viewpoints.policy.custom and is defined in the org.eclipse.papyrus.infra.viewpoints.policy plugin. Each extension can contribute a viewpoints configuration and give it a priority (0 is lowest). The setting of the contributed configuration is achieved by giving the path to the configuration file. The path can be relative to the contributing plugin's root, or be an absolute URI in the form of platform:/plugin/<pluginID>/<path>. If no contribution is made and this option is selected, the builtin configuration named Any number of diagrams per model element will be used as a fallback."

So, I have my *.configuration file and I added to my plugin.xml the following:
<extension point="org.eclipse.papyrus.infra.viewpoints.policy.custom">
<contribution file="viewpoints/soaml.configuration"
original="platform:/plugin/org.eclipse.papyrus.infra.viewpoints.policy/builtin/default.configuration">

</contribution>
</extension>

I'm comparing with the RobotML plugin and I can't find the difference with my project, but RobotML shows its menus and my project doesn't Sad

What am I missing?

Thank you again!
Sofía
Re: Own Diagram Editor based on existing org.eclipse.papyrus.uml.diagram.clazz Editor [message #1409635 is a reply to message #1408186] Mon, 18 August 2014 15:29 Go to previous message
Sofía Pérez is currently offline Sofía PérezFriend
Messages: 8
Registered: July 2014
Junior Member
We added the following menuContribution and changed some things and now the SoaML menus are showing:

<menuContribution locationURI="popup:org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram
<command commandId="org.eclipse.papyrus.soaml.diagram.interfacesdef.CreateClassDiagramCommand"
icon="icons/obj16/ServicesInterfacesClass30.png"
label="Create a new Interfaces Definition Diagram"
style="push"
tooltip="Create a new Interfaces Definition Diagram">
<visibleWhen>
<with variable="activeEditorId">
<equals value="org.eclipse.papyrus.infra.core.papyrusEditor">
</equals>
</with>
</visibleWhen>
</command>
</menuContribution>

The problem now is that when we click on one of the options we get the following exception:
java.lang.UnsupportedOperationException at org.eclipse.papyrus.infra.gmfdiag.common.AbstractPapyrusGmfCreateDiagramCommandHandler.execute(AbstractPapyrusGmfCreateDiagramCommandHandler.java:393)

I've taken a look at the AbstractPapyrusGmfCreateDiagramCommandHandler class and the execute method has this comment:

// This method should not be called, use the execute(ExecutionEvent, ViewPrototype, String) method.

But there's no such method with those parameters.

Thank you,
Sofía
Previous Topic:XText editor embedded in Properties View
Next Topic:Using Papyrus SysML table, possible to show stereotype?
Goto Forum:
  


Current Time: Thu Mar 28 14:07:06 GMT 2024

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

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

Back to the top