Variation of Drill-Down Feature [message #1198476] |
Wed, 20 November 2013 05:41  |
Eclipse User |
|
|
|
Hi everyone,
I am using Graphiti now for about a month and it works great.
What I would like to realize at the moment is the following:
I would like to have an object that can be inserted in the diagram - that`s fine.
This object should have a custom drill-down feature, which makes it possible to open an associated diagram when the feature is called. The diagram should be created and linked with the PictogramElement when it is inserted in the diagram.
What I have done so far:
- I have got a create feature, which instanciates a BO
- an add feature, which specifies a rectangle, text and so on. At the end of the add feature I create a new diagram and link it with my BO:
final Diagram diagram = Graphiti.getCreateService().createDiagram(DiagramTypeProvider.DIAGRAM_TYPE_ID, filename, true);
addedClass.eResource().getContents().add(diagram);
link(diagram, addedClass);
link(containerShape, addedClass);
- The drill-down works with the implementation of the AbstractDrillDownFeature. I just changed the getDiagram()-method of my drill-down implementation:
protected Collection<Diagram> getDiagrams() {
Resource resource = getDiagram().eResource();
// does resource contain a diagram as root object?
final EList<EObject> contents = resource.getContents();
List<Diagram> diagramCollection = new ArrayList<Diagram>();
for (final EObject object : contents) {
if (object instanceof Diagram) {
diagramCollection.add((Diagram) object);
}
}
return diagramCollection;
}
My problem is the following: As long as I did not save the diagram which contains the newly created PictogramElement (the BO of this is linked to another diagram) at least once, I can not use the Drill-Down feature. Graphiti then opens a new diagram tab, but there is only the string "No Diagram found for URI 'platform:/resource/Graphiti_Bsp/src/diagrams/newDiagram.diagram#/3" displayed.
I debugged the project. The canExecute-method returns true (otherwise no tab would be opened), so the newly created diagram is "found".
No exception is thrown while the canExecute/ execute methods are executed.
So now my question: Do you have an idea, why I have to save the diagram first before I can display it? What may I have to change such that I can open the linked diagram, even if the diagram was not saved before?
If you need more information to be able to answer my question, please just tell me 
Thank you very much for your help!
|
|
|
|
|
|
|
|
|
|
|
Re: Variation of Drill-Down Feature [message #1237116 is a reply to message #1198476] |
Tue, 28 January 2014 17:43  |
Eclipse User |
|
|
|
Micheal,
the problem was, that the notification came from a contained object and not the container object which is linked as the business object. Therefore the DomainModelChangeListener didn't recognize it as a changed business object.
Best,
Albert
|
|
|
Powered by
FUDForum. Page generated in 0.08894 seconds