Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Selected Node - Which function is called?
Selected Node - Which function is called? [message #661099] Wed, 23 March 2011 03:46 Go to next message
akoeck is currently offline akoeck
Messages: 62
Registered: December 2010
Member
Hello, I want to get the Model from my selected Figure. And pass it to another view. Therefore I need to know what function is called when I select an element in my editor.

Thanks in advance.
Re: Selected Node - Which function is called? [message #661830 is a reply to message #661099] Mon, 28 March 2011 03:41 Go to previous messageGo to next message
akoeck is currently offline akoeck
Messages: 62
Registered: December 2010
Member
No one can help me?

How do I get a selected node? I mean is there somewhere a method that is called, or do I have to write my own. If so how?
Re: Selected Node - Which function is called? [message #661846 is a reply to message #661830] Mon, 28 March 2011 04:52 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

I use the following in xxxDiagramEditor:

/**
* @generated
*/
private ISelectionListener selectionListener = new ISelectionListener() {
  @Override
  public void selectionChanged(IWorkbenchPart part, ISelection selection) {
    //place your code here
  }
};

/**
* @generated
*/
@Override
protected void startListening() {
  super.startListening();

  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().addPostSelectionListener(selectionListener);
}

/**
* @generated
*/
@Override
protected void stopListening() {
  super.stopListening();

  PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().removePostSelectionListener(selectionListener);
}



You can extend the xpt/editor/Editor.xpt template for this.

You can also use the SelectionSynchronizer. Take a look at recent posts there is a description on how to do this.

Ralph
Re: Selected Node - Which function is called? [message #662093 is a reply to message #661846] Tue, 29 March 2011 05:15 Go to previous messageGo to next message
akoeck is currently offline akoeck
Messages: 62
Registered: December 2010
Member
Thanks for your reply. I think with the SelectionSynchronizer you mean the post from Christophe in this thread http://www.eclipse.org/forums/index.php?t=msg&th=206243& amp;start=0&S=fca9b969585b41cb27c5e1bdcf940f80 ?
Re: Selected Node - Which function is called? [message #662199 is a reply to message #662093] Tue, 29 March 2011 13:06 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

this is what I meant.

Ralph
Previous Topic:How to change the diagram's model at runtime?
Next Topic:Connection issue
Goto Forum:
  


Current Time: Thu Jul 24 04:28:33 EDT 2014

Powered by FUDForum. Page generated in 0.03049 seconds