@Override public void fillMenu( final IBNAView view, List<IThing> things, final ICoordinate location, IMenuManager m) { IThing editThing = null; if (Iterables.size(BNAUtils.getSelectedThings(view.getBNAWorld().getBNAModel())) <= 1) { MAIN: for (IThing thing : things) { for (IThing assemblyPartThing : Assemblies.getRelatedParts(view.getBNAWorld().getBNAModel(), thing)) { if (assemblyPartThing instanceof IHasMutableText && UserEditableUtils.isEditableForAnyQualities( assemblyPartThing, IHasMutableText.USER_MAY_EDIT_TEXT, IHasToolTip.USER_MAY_EDIT_TOOL_TIP)) { editThing = assemblyPartThing; break MAIN; } } } } final IThing finalThing = editThing; if (finalThing != null) { m.add( new Action("Edit Description...") { @Override public void run() { initEdit(finalThing); } }); } }
@Override public void keyReleased(IBNAView view, KeyEvent e) { if (SWT.F2 == e.keyCode) { IThing editThing = null; if (Iterables.size(BNAUtils.getSelectedThings(view.getBNAWorld().getBNAModel())) == 1) { MAIN: for (IThing thing : BNAUtils.getSelectedThings(view.getBNAWorld().getBNAModel())) { for (IThing assemblyPartThing : Assemblies.getRelatedParts(view.getBNAWorld().getBNAModel(), thing)) { if (UserEditableUtils.isEditableForAnyQualities( assemblyPartThing, IHasMutableText.USER_MAY_EDIT_TEXT, IHasToolTip.USER_MAY_EDIT_TOOL_TIP)) { editThing = assemblyPartThing; break MAIN; } } } } if (editThing != null) { initEdit(editThing); } } }