Home » Modeling » GMF (Graphical Modeling Framework) » Cannot initialize foo_diagram with Diagram Partitioning - diagramLink not created
Cannot initialize foo_diagram with Diagram Partitioning - diagramLink not created [message #207216] |
Mon, 29 September 2008 02:54  |
Eclipse User |
|
|
|
Hi,
I have been trying to use the "initialise foo_diagram" functionality
when you right click a model.foo, in order to render the model
programatically.
However I have noticed that, with GMF 2.0.2, this generated diagram
cannot handle Diagram Partitioning.
In particular, if I have a model like so:
- A
- B
If I double-click the B node, it will open up in model.foo_diagram#1. If
I go back to the original diagram, and double click it again, it will
open it up again in model.foo_diagram#2. I have tried saving or not
saving the model on each view but still get this problem.
Looking into the foo_diagram, it looks like there is no
"notation:HintedDiagramLinkStyle.diagramLink" being added to the
generated views. If I understand correctly, when opening a new node
editor for the first time, it will add the
"notation:HintedDiagramLinkStyle.diagramLink" to the diagram file; but
it looks like when the diagram file is initialized automatically, it is
not added.
Is there a GMF solution to this? Is this a known issue?
Thanks,
Jevon
|
|
| |
Re: Cannot initialize foo_diagram with Diagram Partitioning - diagramLink not created [message #207362 is a reply to message #207237] |
Mon, 29 September 2008 18:19   |
Eclipse User |
|
|
|
Hi Alex,
>> Looking into the foo_diagram, it looks like there is no
>> "notation:HintedDiagramLinkStyle.diagramLink" being added to the
>> generated views. If I understand correctly, when opening a new node
> In current version of GMF HintedDiagramLinkStyle will be added to the
> corresponding node just on creation via ???ViewFactory.createStyles().
> So, if you have different code generated looks like you have to concider
> updating to latest GMF release.
I had a look at the generated ???ViewFactory, and the
HintedDiagramLinkStyle is already in there:
/**
* @generated
*/
protected List createStyles(View view) {
List styles = new ArrayList();
styles.add(NotationFactory.eINSTANCE.createShapeStyle());
{
HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE
.createHintedDiagramLinkStyle();
diagramFacet.setHint("Foo_Sub"); // $NON-NLS-1$
styles.add(diagramFacet);
}
return styles;
}
Is there something different in GMF 2.1?
The problem is not that opening a new node in the editor adds the
HintedDiagramLinkStyle, but I think that when _initializing_ the diagram
using the right-click menu, it is not added to the foo_diagram, and the
different diagrams are not linked together with a
HintedDiagramLinkStyle, so the editor just continually opens up multiple
new diagrams for the same node when it is double-clicked.
Thanks,
Jevon
|
|
|
Re: Cannot initialize foo_diagram with Diagram Partitioning - diagramLink not created [message #207385 is a reply to message #207362] |
Mon, 29 September 2008 20:59  |
Eclipse User |
|
|
|
I think I have solved the problem. This issue came about as I am using
an OpenDiagramEditPolicy on an Edge, not a Node - turns out that the
custom code I was adding to achieve this (until bug 244386 is resolved)
wasn't complete. In particular, my EdgeViewFactory did not have the
following code, which was present in a NodeViewFactory:
protected void decorateView(View containerView, View view,
IAdaptable semanticAdapter, String semanticHint, int index,
boolean persisted) {
...
if (!CompositeWireEditPart.MODEL_ID.equals(IamlVisualIDRegistry
.getModelID(containerView))) {
EAnnotation shortcutAnnotation = EcoreFactory.eINSTANCE
.createEAnnotation();
shortcutAnnotation.setSource("Shortcut"); //$NON-NLS-1$
shortcutAnnotation.getDetails().put(
"modelID", CompositeWireEditPart.MODEL_ID); //$NON-NLS-1$
view.getEAnnotations().add(shortcutAnnotation);
}
...
}
So it wasn't that the link wasn't being added in initialize diagram; but
that opening the node wasn't adding the link back.
Cheers!
Jevon
Jevon Wright wrote:
> Hi Alex,
>
>>> Looking into the foo_diagram, it looks like there is no
>>> "notation:HintedDiagramLinkStyle.diagramLink" being added to the
>>> generated views. If I understand correctly, when opening a new node
>> In current version of GMF HintedDiagramLinkStyle will be added to the
>> corresponding node just on creation via ???ViewFactory.createStyles().
>> So, if you have different code generated looks like you have to
>> concider updating to latest GMF release.
>
> I had a look at the generated ???ViewFactory, and the
> HintedDiagramLinkStyle is already in there:
>
> /**
> * @generated
> */
> protected List createStyles(View view) {
> List styles = new ArrayList();
> styles.add(NotationFactory.eINSTANCE.createShapeStyle());
> {
> HintedDiagramLinkStyle diagramFacet = NotationFactory.eINSTANCE
> .createHintedDiagramLinkStyle();
> diagramFacet.setHint("Foo_Sub"); // $NON-NLS-1$
> styles.add(diagramFacet);
> }
> return styles;
> }
>
> Is there something different in GMF 2.1?
>
> The problem is not that opening a new node in the editor adds the
> HintedDiagramLinkStyle, but I think that when _initializing_ the diagram
> using the right-click menu, it is not added to the foo_diagram, and the
> different diagrams are not linked together with a
> HintedDiagramLinkStyle, so the editor just continually opens up multiple
> new diagrams for the same node when it is double-clicked.
>
> Thanks,
>
> Jevon
|
|
|
Goto Forum:
Current Time: Sat May 10 15:51:53 EDT 2025
Powered by FUDForum. Page generated in 0.02613 seconds
|