Eclipse4/RCP/Modeled UI/Modifying the Model

From Eclipsepedia

< Eclipse4‎ | RCP‎ | Modeled UI
Revision as of 13:52, 11 April 2011 by Remysuen.ca.ibm.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The Eclipse 4 application model is backed by interfaces exposing simple POJO methods. Please see below for some sample code.

// change the label of a menu item
menuItem.setLabel("New Name");
 
// mark a part as being dirty
part.setDirty(true);
 
// get a list of child windows
List<MWindow> childWindows = mainWindow.getWindows();

Reparenting an Element

When a drag-and-drop operation has been performed, one part may be moved from one stack to another stack. This can be executed with the code below.

List<MStackElement> children = otherStack.getChildren();
children.add(draggedPart);

Changing the Visibility

If you would like to hide an element from the interface, you can change an MUIElement's visible attribute.

stack.setVisible(false);