Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Register the diagram as selection provider
Register the diagram as selection provider [message #690212] Wed, 29 June 2011 07:33 Go to next message
Luca Gherardi is currently offline Luca GherardiFriend
Messages: 62
Registered: November 2010
Member
Hi all,

I build my own graphical editor and I defined a specific view and a command.
I added the command as a button in the view and I am able to enable this button only if one element in the view is selected.
For doing that I registered the view as a selection provider:

getSite().setSelectionProvider(viewer);


What I'd like to do now is register also the diagram as a selection provider, in such a way that I can enable the button only if one specific editPart (wihch correspond to a specific element in the model) is selected in the diagram.

How can I register the editor as a selection provider? Rolling Eyes

Regards,
Luca
Re: Register the diagram as selection provider [message #692999 is a reply to message #690212] Tue, 05 July 2011 15:44 Go to previous message
Giovanni De Sossi is currently offline Giovanni De SossiFriend
Messages: 161
Registered: October 2009
Location: Rome, Italy
Senior Member

Hi Luca,

the diagram is already registered as selection provider; in every place of your code you can retrieve the active selection with the following code:

IStructuredSelection sel = (IStructuredSelection)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();


HTH, bye

Giovanni
Previous Topic:Embed an XText-like Text editor in a GMF diagram
Next Topic:Remove menu for creating child nodes in the parent node
Goto Forum:
  


Current Time: Fri Mar 05 05:06:51 GMT 2021

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

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

Back to the top