Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 10:43 Go to next message
Jeno Jeyakumar Nathaniel is currently offline Jeno Jeyakumar NathanielFriend
Messages: 18
Registered: April 2010
Junior Member
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] Sun, 03 October 2010 00:29 Go to previous messageGo to next message
Fernando Herrera is currently offline Fernando HerreraFriend
Messages: 49
Registered: January 2010
Member
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 06:07 Go to previous messageGo to next message
Jeno Jeyakumar Nathaniel is currently offline Jeno Jeyakumar NathanielFriend
Messages: 18
Registered: April 2010
Junior Member
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 09:48 Go to previous message
Jeno Jeyakumar Nathaniel is currently offline Jeno Jeyakumar NathanielFriend
Messages: 18
Registered: April 2010
Junior Member
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: Fri Apr 26 02:51:33 GMT 2024

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

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

Back to the top