Opening diagrams when double-clicking Labels within Top Level Nodes (OpenDiagramEditPolicies) [message #228936] |
Wed, 06 May 2009 00:43  |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03834 seconds