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

Reading the Javadocs for WEEditor was all I needed.

I added this in my class:

editor.getSelectionProvider().addSelectionChangedListener(new ISelectionChangedListener() {
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:


to get the current selection.

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

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?



Back to the top