Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » How to embed Papyrus UML class diagram within another GEF editor?
How to embed Papyrus UML class diagram within another GEF editor? [message #630598] Mon, 04 October 2010 11:04 Go to next message
Gunnar Schulze is currently offline Gunnar SchulzeFriend
Messages: 3
Registered: July 2009
Junior Member
Hi,

I am currently writing a plugin that needs to embed UML diagrams (from possibly different modeling tools) within a GEF editor. I already downloaded the source code of Papyrus in order to figure out how load the diagram *.di file and create the respective edit part. Since I am not using the GMF framework for my editor, I have no clue what is needed and what not Sad The embedded diagram does not need any editing functionality at all, it should just display the diagram in a configurable size and update the view if some external editor modifies the UML model or the DI resource.

Any ideas?

Thanks in advance,
Gunnar
Re: How to embed Papyrus UML class diagram within another GEF editor? [message #630619 is a reply to message #630598] Mon, 04 October 2010 12:07 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 341
Registered: July 2009
Location: Paris Saclay, France
Senior Member
It seems complex because some figures, edit part inherits from gmf libraries.
Have you tried to install the gmf runtime.

Patrick
Re: How to embed Papyrus UML class diagram within another GEF editor? [message #630683 is a reply to message #630619] Mon, 04 October 2010 14:55 Go to previous messageGo to next message
Gunnar Schulze is currently offline Gunnar SchulzeFriend
Messages: 3
Registered: July 2009
Junior Member
Basically, dependencies on GMF are not a problem at all. I want to provide some sort of connector which connects diagrams of different modeling tools with my application. At the moment, I am trying to load the DI file using the following code:

try
{
	ResourceSet set = new  ResourceSet();
	Resource resource = set.createResource(URI
		.createPlatformResourceURI(diagramFile.getFullPath()
							.toString(), false));

	if (!resource.isLoaded())
	{
		resource.load(new HashMap(GMFResourceFactory
			.getDefaultLoadOptions()));
	}

	Iterator rootContents = resource.getContents().iterator();
	while(rootContents.hasNext())
	{
		EObject rootElement = (EObject)rootContents.next();
		if(rootElement instanceof Diagram)
			this.diagram =  (Diagram)rootElement;
	}

	System.out.println(diagram.getName());
}
catch (IOException e)
{
	e.printStackTrace();
}


The problem is that the contents of the resource are instances of SashWindowsMngr, rather than Diagram. Am I missing something?
Re: How to embed Papyrus UML class diagram within another GEF editor? [message #630841 is a reply to message #630683] Tue, 05 October 2010 09:11 Go to previous messageGo to next message
Patrick Tessier is currently offline Patrick TessierFriend
Messages: 341
Registered: July 2009
Location: Paris Saclay, France
Senior Member
Hi,
In Papyrus, we can display several diagram in the same editor.
To do that, we have design a model that references diagrams , this is the SashModel
org.eclipse.papyrus.sasheditor.di\model\di.ecore
In this model, we can know where is put the diagram which dimension, etc... I understand that the di file can confuse developers.

The diagram can be found in the notation file.

A di file looks like that:
<?xml version="1.0" encoding="ASCII"?>
<di:SashWindowsMngr xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.eclipse.org/papyrus/0.7.0/sashdi" xmi:id="_JfTw8spTEd-Ly98anaGDeg">
  <pageList xmi:id="_JfTw88pTEd-Ly98anaGDeg">
    <availablePage xmi:id="_Jfc64cpTEd-Ly98anaGDeg">
      <emfPageIdentifier href="model.notation#_JfTw8MpTEd-Ly98anaGDeg"/>
    </availablePage>
    <availablePage xmi:id="_A8rPVMpYEd-1LOFEodgUOQ">
      <emfPageIdentifier href="model.notation#_A8iFUcpYEd-1LOFEodgUOQ"/>
    </availablePage>
    <availablePage xmi:id="_RYCsycyNEd-t0sqdTA50oA"/>
  </pageList>
  <sashModel xmi:id="_JfTw9MpTEd-Ly98anaGDeg" currentSelection="_Jfc64MpTEd-Ly98anaGDeg">
    <windows xmi:id="_JfTw9cpTEd-Ly98anaGDeg">
      <children xsi:type="di:TabFolder" xmi:id="_Jfc64MpTEd-Ly98anaGDeg">
        <children xmi:id="_Jfc64spTEd-Ly98anaGDeg">
          <emfPageIdentifier href="model.notation#_JfTw8MpTEd-Ly98anaGDeg"/>
        </children>
        <children xmi:id="_UW00UMvYEd-OpLwFnxoZew">
          <emfPageIdentifier href="model.notation#_A8iFUcpYEd-1LOFEodgUOQ"/>
        </children>
      </children>
    </windows>
  </sashModel>
</di:SashWindowsMngr>


You can see that emfPage indentifier refences real diagram of the notation file

Patrick
Re: How to embed Papyrus UML class diagram within another GEF editor? [message #631811 is a reply to message #630841] Fri, 08 October 2010 20:56 Go to previous message
Gunnar Schulze is currently offline Gunnar SchulzeFriend
Messages: 3
Registered: July 2009
Junior Member
Thank you, that worked!

The only thing that annoys me is that somehow all layout information is lost, including placement of diagram elements and their sizes. However, if i use the CopyToImageUtil of GMF, the resulting image contains the correct diagram.
Previous Topic:horizontal line in UML use case
Next Topic:Confused about MDT Papyrus, Topcased and UML2
Goto Forum:
  


Current Time: Thu Apr 25 20:15:50 GMT 2024

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

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

Back to the top