Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Opening diagrams when double-clicking Labels within Top Level Nodes (OpenDiagramEditPolicies)
Opening diagrams when double-clicking Labels within Top Level Nodes (OpenDiagramEditPolicies) [message #228936] Wed, 06 May 2009 04:43 Go to next message
Jevon  is currently offline Jevon Friend
Messages: 164
Registered: July 2009
Senior Member
Hi,

I wanted to allow a Label (within a Top Level Node) to have an
OpenDiagramEditPolicy in order to open up a new editor (diagram
partitioning). Adding it to the .gmfgen manually wasn't a problem, and
the relevant OpenDiagramEditPolicy is created and connected as expected.

However, when the Label is connected, sometimes getTargetEditPart() will
return the Label that was double-clicked, and not the ShapeNodeEditPart
representing the original node. It seems the Label does not have the
Style information in order to open up the correct diagram:

View view = (View) targetEditPart.getModel(); // returns a Node
Style link =
view.getStyle(NotationPackage.eINSTANCE.getHintedDiagramLink Style()); //
returns null

Following
http://dev.eclipse.org/newslists/news.eclipse.modeling.gmf/m sg08170.html
I added this to the OpenDiagramEditPolicy, and all works fine now:

@Override
public EditPart getTargetEditPart(Request request) {
if (understandsRequest(request)) {
if (getHost() instanceof ShapeNodeEditPart) {
return getHost();
}
return getHost().getParent(); // expect Node
}
return super.getTargetEditPart(request);
}

My question is: is this expected behaviour? i.e. Is it expected that the
Label does not have the Style information for the Top Level Node above?

If not, should I add this as a bug?

Cheers
Jevon
Re: Opening diagrams when double-clicking Labels within Top Level Nodes(OpenDiagramEditPolicies) [message #229533 is a reply to message #228936] Tue, 12 May 2009 11:56 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Jevon,

I think GMF does not support linking a label with sub-diagrams for now (LabelMapping
is not a subclass of MappingEntry having "relatedDiagrams" reference).
If you think it is necessary to link LabelMapping with a sub-diagram then
please file a request for it.

-----------------
Alex Shatalin
Previous Topic:Creating collections with at least one item
Next Topic:Animation in editor
Goto Forum:
  


Current Time: Thu Apr 25 11:50:40 GMT 2024

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

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

Back to the top