Issues opening the correct diagram [message #1245129] |
Thu, 13 February 2014 10:36 |
Dominik Schwindling Messages: 3 Registered: July 2013 Location: Germany |
Junior Member |
|
|
Hello,
I am working at a DrillDown which operates by doubleclicking on an pictogramElement inside the first diagram. Then a new diagram is generated and linked to the BusinessObject related to the first pictogramElement. Now I want to open a new editor based on this diagram.
A new editor opens, but I cannot access the expected diagram, instead there is a new one with the same name and diagramTypeId.
Here is the code inside my DrillDown method for creating a new editor:
//Operating inside the first diagram
final String diagramTypeId = ...;
//the business element which is supposed to be linked to the newly opened diagram
final Behavior root = (Behavior)getBusinessObjectForPictogramElement(context.getInnerPictogramElement());
final String diagramName = root.getName();
final Diagram diagram = Graphiti.getPeCreateService().createDiagram(diagramTypeId, diagramName, true);
URI uri = root.eResource().getURI();
uri = uri.trimFragment();
uri = uri.trimFileExtension();
uri = uri.trimSegments(1);
uri = uri.appendSegment(root.getName());
uri = uri.appendFileExtension("diagram");
FileService.createEmfFileForDiagram(uri, diagram);
DiagramEditorInput editorInput = new DiagramEditorInput(uri,BehaviorDiagramTypeProvider.DIAGRAMTYPE_PROVIDER_ID);
//associates the new diagram with the business element the user clicked on
link(diagram, root);
try {
IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
activePage.openEditor(editorInput, DiagramEditor.DIAGRAM_EDITOR_ID);
} catch (PartInitException e) {
System.out.println("Fehler beim Öffnen des neuen Behavior Diagrams");
}
In the next steps I try to access the new diagram with getDiagram() with an unexpected effect. I find theSameRoot to be null since the Link object is not accessible and getBusinessObjectForPictogramElement() returns nothing.
//Operating inside the second diagram (opened from the first one)
Behavior theSameRoot = (Behavior) getBusinessObjectForPictogramElement(getDiagram());
I am thankful for some advice,
Dominik
[Updated on: Thu, 13 February 2014 13:17] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03046 seconds