Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jwt-dev] Creating an editor sheet, need current model element

Hi Eric

Back from halidays - & nice to see other people have been keeping working, that's indeed a good solution ;)

Regards,
Marc


Le 27/05/2011 21:59, Eric Phetteplace a écrit :
Reading the Javadocs for WEEditor was all I needed.

I added this in my class:

editor.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
System.out.println("selectionChanged: " + editor.getSelectionProvider().getSelection());
}
});

I see all the model elements that are being selected.

On the initial load of the class, I simply use:

editor.getSelectionProvider().getSelection())

to get the current selection.

On Fri, May 27, 2011 at 3:15 PM, Eric Phetteplace <eric.phetteplace@xxxxxxxxx> wrote:
Hello,

I'm adding my own editor sheet, which will be a more elaborate form than the property tab can be.

One of the examples (ExampleSheet2) populates the form with info from the core Package element.  

if (editor.getModel() instanceof org.eclipse.jwt.meta.model.core.NamedElement) {
if (((org.eclipse.jwt.meta.model.core.Package) editor.getModel()).getName() != null)
nameField.setText(((org.eclipse.jwt.meta.model.core.Package) editor.getModel()).getName());
}

I want to get the currently selected ActivityNode model element instead.  How do I grab that?

Thanks,

Eric

_______________________________________________ jwt-dev mailing list jwt-dev@xxxxxxxxxxx https://dev.eclipse.org/mailman/listinfo/jwt-dev


Back to the top