Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 06:54 Go to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
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 - diagramLinknot created [message #207237 is a reply to message #207216] Mon, 29 September 2008 10:27 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jevon,

> 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.

-----------------
Alex Shatalin
Re: Cannot initialize foo_diagram with Diagram Partitioning - diagramLink not created [message #207362 is a reply to message #207237] Mon, 29 September 2008 22:19 Go to previous messageGo to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
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] Tue, 30 September 2008 00:59 Go to previous message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
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
Previous Topic:Multiple EditPartProviders for Diagram Partitioning
Next Topic:issue with use of Properties provider
Goto Forum:
  


Current Time: Tue Apr 23 07:18:43 GMT 2024

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

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

Back to the top