@Override public void deactivate() { if (isActive()) { doDeActivate(); ActionsInput input = getWidgetModel().getActionsInput(); for (AbstractWidgetAction a : input.getActionsList()) { a.dispose(); } super.deactivate(); // remove listener from all properties. for (String id : getWidgetModel().getAllPropertyIDs()) { getWidgetModel() .getProperty(id) .removeAllPropertyChangeListeners(); // removePropertyChangeListener(propertyListenerMap.get(id)); } if (executionMode == ExecutionMode.RUN_MODE) { // remove script listeners before stopping PV. for (ScriptData scriptData : scriptDataList) { ScriptService.getInstance().unRegisterScript(scriptData); } if (hasStartedPVs) { // this is just a guard statement // if the widget was deactivated before it became fully active (and connected its pv), // we should not attempt to stop those pvs; this can happen with linking container for (Object pv : pvMap.values().toArray()) { ((IPV) pv).stop(); } } } propertyListenerMap.clear(); // propertyListenerMap = null; SingleSourceHelper.rapDeactivateBaseEditPart(this); } }
/** * Run a widget action which is attached to the widget. * * @param index the index of the action in the actions list. */ public void executeAction(int index) { AbstractWidgetAction action; try { action = getWidgetModel().getActionsInput().getActionsList().get(index); if (action != null) action.run(); else throw new IndexOutOfBoundsException(); } catch (IndexOutOfBoundsException e) { ConsoleService.getInstance() .writeError( NLS.bind( "No action at index {0} is configured for {1}", index, getWidgetModel().getName())); } }