Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Hide/Unhide a node(Hide/Unhide a node)
Hide/Unhide a node [message #630259] Fri, 01 October 2010 06:43 Go to next message
Eclipse UserFriend
Hi All,

I am working on a GMF based RCP tool.

Now i have to hide a node and its child node when i double click on that node(can be triggered in any event)

I have installed a new edit policy as

installEditPolicy(EditPolicyRoles.OPEN_ROLE,
createOpenEditPolicy());

and inside the createOpenEditPolicy(), i have done the following,


private OpenEditPolicy createOpenEditPolicy() {
OpenEditPolicy policy = new OpenEditPolicy() {

@Override
protected Command getOpenCommand(Request request) {
IGraphicalEditPart ige = (IGraphicalEditPart) this
.getTargetEditPart(request);

View selectedView = ige.getPrimaryView();
selectedView.setVisible(false);

return null;
}
};
return policy;
}


But the node is hidden only if i refresh the diagram by adding a new node.

Kindly suggest where i went wrong, and let me know how to automatically refresh the diagram.

Regards,
Jeno J



Re: Hide/Unhide a node [message #630467 is a reply to message #630259] Sat, 02 October 2010 20:29 Go to previous messageGo to next message
Eclipse UserFriend
try casting (IGraphicalEditPart) this
.getTargetEditPart(request) to the specif editpart of your domain and after try:

editPart.getPrimaryShape().repaint();

If it not works, maybe you have a property in your figure that allows to set the visibility too.

Regards,

Fernando
Re: Hide/Unhide a node [message #630555 is a reply to message #630467] Mon, 04 October 2010 02:07 Go to previous messageGo to next message
Eclipse UserFriend
I just casted to the specific editpart and its working fine.

Thanks a lot for your help.

Regards,
Jeno J.
Re: Hide/Unhide a node [message #630587 is a reply to message #630555] Mon, 04 October 2010 05:48 Go to previous message
Eclipse UserFriend
Now the node is hidden, but the changes are not getting persisted in the diagram file.

It will be helpful if the changes are stored in a file so that we can restore the changes while closing and opening the diagram again.

Regards,
Jeno J
Previous Topic:To change the icon for the diagram file
Next Topic:gmf as rcp : the common navigator introduces bugs
Goto Forum:
  


Current Time: Thu Jul 17 10:31:49 EDT 2025

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

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

Back to the top