if (selection != null && selection instanceof IStructuredSelection) {
Object obj = ((IStructuredSelection) selection).getFirstElement();
// If we had a selection lets open the editor
if (obj != null) {
//ShapeModel geometry = (ShapeModel) obj;
NodeModel model = (NodeModel) obj;
ShapeGrammarInput input = new ShapeGrammarInput(model);
try {
// get Editor ID (it can be specific for different geometry)
String editorID = model.getEditorId();
// open editor
ShapeEditor editor = (ShapeEditor) page.openEditor(input, editorID == null ? ShapeEditor.ID : editorID);
// hook event listener on editor
model.addPropertyChangeListener(editor);
// open properties
page.showView(IPageLayout.ID_PROP_SHEET);
} catch (PartInitException e) {
Debugger.getInstance().addMessage(e.getStackTrace());