public OpenInBrowserAction( BootDashModel model, MultiSelection<BootDashElement> selection, UserInteractions ui) { super(selection, ui); this.model = model; this.setText("Open Web Browser"); this.setToolTipText("Open a Web Browser on the default URL"); this.setImageDescriptor(BootDashActivator.getImageDescriptor("icons/open_browser.gif")); this.setDisabledImageDescriptor( BootDashActivator.getImageDescriptor("icons/open_browser_disabled.gif")); if (model != null) { model.addElementStateListener( listener = new ElementStateListener() { public void stateChanged(BootDashElement e) { Display.getDefault() .asyncExec( new Runnable() { public void run() { updateEnablement(); } }); } }); } }
@Override public void dispose() { if (listener == null) { model.removeElementStateListener(listener); listener = null; } super.dispose(); }
private boolean isApplicable(BootDashModel section) { if (section != null) { PropertyStoreApi props = section.getRunTarget().getType().getPersistentProperties(); // Not all target types provide persistent properties yet. This feature only works on // those target types that do. return props != null; } return false; }
protected void removed(LiveExpression<Set<BootDashModel>> exp, BootDashModel e) { e.getElements().removeListener(ELEMENTS_SET_LISTENER); e.removeModelStateListener(MODEL_STATE_LISTENER); }