Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » gmf editor selection change events
gmf editor selection change events [message #658719] Wed, 09 March 2011 15:37 Go to next message
m kranz is currently offline m kranz
Messages: 69
Registered: January 2010
Member
hello

i am looking for a way to get selection changed events from a gmf editor. is there a way to add a SelectionChangedListener to a gmf editor?
or is there another way to get selection events from a gmf editor?

thanks in advance

mkranz
Re: gmf editor selection change events [message #658752 is a reply to message #658719] Wed, 09 March 2011 16:00 Go to previous message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 919
Registered: July 2009
Senior Member
On 09-03-11 16:37, mkranz wrote:
> hello
>
> i am looking for a way to get selection changed events from a gmf
> editor. is there a way to add a SelectionChangedListener to a gmf editor?
> or is there another way to get selection events from a gmf editor?
>
> thanks in advance
>
> mkranz


in your xxxDiagramEditor do the following:


/**
* Hook into the synchronizer, we want to know what is going on with
* selections, so we can modify the diagram model.
*
*/
private SelectionSynchronizer synchronizer;

@Override
protected SelectionSynchronizer getSelectionSynchronizer() {
if (synchronizer == null)
synchronizer = new CustomSelectionSynchronizer();
return synchronizer;
}

/**
* A custom synchronizer, which by parameter can either sync. viewers, or
* replace the Graphical viewer input.
*
* @author dzonekl
*
*/
class CustomSelectionSynchronizer extends SelectionSynchronizer {

@Override
public void addViewer(EditPartViewer viewer) {
super.addViewer(viewer);
}

@Override
public void selectionChanged(SelectionChangedEvent event) {
// We turn off the default synchronization.
// super.selectionChanged(event);

### PRrocess the selection here.


}
}
Previous Topic:How to create a "log-file"?
Next Topic:Custom Editpart events: Resize of Parent vs. Movement of child
Goto Forum:
  


Current Time: Sat Sep 20 05:59:50 GMT 2014

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

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