/** * Saves the current enable/disable state of the given control and its * descendents in the returned object; the controls are all disabled. * * @param w * the control * @return an object capturing the enable/disable state */ public static ControlEnableState disable(Control w) { return new ControlEnableState(w); }
/** * Creates a new object and saves in it the current enable/disable state of * the given control and its descendents except for the given list of * exception cases; the controls that are saved are also disabled. * * @param w * the control * @param exceptions * the list of controls to not disable (element type: * <code>Control</code>), or <code>null</code> if none */ protected ControlEnableState(Control w, List<Control> exceptions) { super(); states = new ArrayList<>(); this.exceptions = exceptions; readStateForAndDisable(w); }
private HashMap saveUIState(boolean keepCancelEnabled) { HashMap savedState= new HashMap(10); saveEnableStateAndSet(fCancelButton, savedState, keepCancelEnabled); for (Iterator actionButtons = fActionButtons.iterator(); actionButtons.hasNext(); ) { Button button = (Button) actionButtons.next(); saveEnableStateAndSet(button, savedState, false); } savedState.put("tabForm", ControlEnableState.disable(fContents)); //$NON-NLS-1$ return savedState; }
private void restoreUIState(HashMap state) { restoreEnableState(fCancelButton, state); for (Iterator actionButtons = fActionButtons.iterator(); actionButtons.hasNext(); ) { Button button = (Button) actionButtons.next(); restoreEnableState(button, state); } ControlEnableState pageState= (ControlEnableState)state.get("tabForm"); //$NON-NLS-1$ pageState.restore(); }
private HashMap<Object, Object> saveUIState(boolean keepCancelEnabled) { HashMap<Object, Object> savedState= new HashMap<>(10); saveEnableStateAndSet(fCancelButton, savedState, keepCancelEnabled); for (Button button : fActionButtons) { saveEnableStateAndSet(button, savedState, false); } savedState.put("tabForm", ControlEnableState.disable(fContents)); //$NON-NLS-1$ return savedState; }
private void restoreUIState(HashMap<Object, Object> state) { restoreEnableState(fCancelButton, state); for (Button button : fActionButtons) { restoreEnableState(button, state); } ControlEnableState pageState= (ControlEnableState)state.get("tabForm"); //$NON-NLS-1$ pageState.restore(); }
/** * {@inheritDoc} */ public void initialize(final IScopeContext context, IAdaptable element) { boolean enabled= isEnabled(context); fEnableField.setSelection(enabled); if (fConfigControl != null && !enabled) { fConfigControlEnabledState= ControlEnableState.disable(fConfigControl); } fEnableField.setDialogFieldListener(new IDialogFieldListener() { public void dialogFieldChanged(DialogField field) { enableConfigControl(fEnableField.isSelected()); } }); fContext= context; }
/** * Restores the enabled/disabled state of the wizard dialog's buttons and * the tree of controls for the currently showing page. * * @param state * a map containing the saved state as returned by * <code>saveUIState</code> * @see #saveUIState */ private void restoreUIState(Map state) { restoreEnableState(backButton, state, "back"); //$NON-NLS-1$ restoreEnableState(nextButton, state, "next"); //$NON-NLS-1$ restoreEnableState(finishButton, state, "finish"); //$NON-NLS-1$ restoreEnableState(cancelButton, state, "cancel"); //$NON-NLS-1$ restoreEnableState(helpButton, state, "help"); //$NON-NLS-1$ Object pageValue = state.get("page"); //$NON-NLS-1$ if (pageValue != null) { ((ControlEnableState) pageValue).restore(); } }
/** * Saves the current enable/disable state of the given control and its * descendents in the returned object; the controls are all disabled. * * @param w * the control * @return an object capturing the enable/disable state */ public static ControlEnableState disable(Control w) { return new ControlEnableState(w); }
/** * Creates a new object and saves in it the current enable/disable state of * the given control and its descendents except for the given list of * exception cases; the controls that are saved are also disabled. * * @param w * the control * @param exceptions * the list of controls to not disable (element type: * <code>Control</code>), or <code>null</code> if none */ protected ControlEnableState(Control w, List exceptions) { super(); states = new ArrayList(); this.exceptions = exceptions; readStateForAndDisable(w); }
/** * Captures and returns the enabled/disabled state of the wizard dialog's * buttons and the tree of controls for the currently showing page. All * these controls are disabled in the process, with the possible exception * of the Cancel button. * * @param keepCancelEnabled * <code>true</code> if the Cancel button should remain * enabled, and <code>false</code> if it should be disabled * @return a map containing the saved state suitable for restoring later * with <code>restoreUIState</code> * @see #restoreUIState */ private Map<String, Object> saveUIState(boolean keepCancelEnabled) { Map<String, Object> savedState = new HashMap<>(10); saveEnableStateAndSet(backButton, savedState, "back", false); //$NON-NLS-1$ saveEnableStateAndSet(nextButton, savedState, "next", false); //$NON-NLS-1$ saveEnableStateAndSet(finishButton, savedState, "finish", false); //$NON-NLS-1$ saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled); //$NON-NLS-1$ saveEnableStateAndSet(helpButton, savedState, "help", false); //$NON-NLS-1$ if (currentPage != null) { savedState .put( "page", ControlEnableState.disable(currentPage.getControl())); //$NON-NLS-1$ } return savedState; }
/** * Restores the enabled/disabled state of the wizard dialog's buttons and * the tree of controls for the currently showing page. * * @param saveState * a map containing the saved state as returned by * <code>saveUIState</code> * @see #saveUIState */ private void restoreUIState(Map<String, Object> saveState) { restoreEnableState(backButton, saveState, "back"); //$NON-NLS-1$ restoreEnableState(nextButton, saveState, "next"); //$NON-NLS-1$ restoreEnableState(finishButton, saveState, "finish"); //$NON-NLS-1$ restoreEnableState(cancelButton, saveState, "cancel"); //$NON-NLS-1$ restoreEnableState(helpButton, saveState, "help"); //$NON-NLS-1$ Object pageValue = saveState.get("page"); //$NON-NLS-1$ if (pageValue != null) { ((ControlEnableState) pageValue).restore(); } }
/** * Saves the current enable/disable state of the given control and its * descendents in the returned object; the controls are all disabled. * * @param w * the control * @return an object capturing the enable/disable state */ public static ControlEnableState disable(Control w) { return new ControlEnableState(w); }
/** * Creates a new object and saves in it the current enable/disable state of * the given control and its descendents except for the given list of * exception cases; the controls that are saved are also disabled. * * @param w * the control * @param exceptions * the list of controls to not disable (element type: * <code>Control</code>), or <code>null</code> if none */ protected ControlEnableState(Control w, List<Control> exceptions) { super(); states = new ArrayList<>(); this.exceptions = exceptions; readStateForAndDisable(w); }
/** * Captures and returns the enabled/disabled state of the wizard dialog's * buttons and the tree of controls for the currently showing page. All * these controls are disabled in the process, with the possible exception * of the Cancel button. * * @param keepCancelEnabled * <code>true</code> if the Cancel button should remain * enabled, and <code>false</code> if it should be disabled * @return a map containing the saved state suitable for restoring later * with <code>restoreUIState</code> * @see #restoreUIState */ private Map<String, Object> saveUIState(boolean keepCancelEnabled) { Map<String, Object> savedState = new HashMap<>(10); saveEnableStateAndSet(backButton, savedState, "back", false); //$NON-NLS-1$ saveEnableStateAndSet(nextButton, savedState, "next", false); //$NON-NLS-1$ saveEnableStateAndSet(finishButton, savedState, "finish", false); //$NON-NLS-1$ saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled); //$NON-NLS-1$ saveEnableStateAndSet(helpButton, savedState, "help", false); //$NON-NLS-1$ if (currentPage != null) { savedState.put("page", ControlEnableState.disable(currentPage.getControl())); //$NON-NLS-1$ } return savedState; }
/** * Restores the enabled/disabled state of the wizard dialog's buttons and * the tree of controls for the currently showing page. * * @param saveState * a map containing the saved state as returned by * <code>saveUIState</code> * @see #saveUIState */ private void restoreUIState(Map<String, Object> saveState) { restoreEnableState(backButton, saveState, "back"); //$NON-NLS-1$ restoreEnableState(nextButton, saveState, "next"); //$NON-NLS-1$ restoreEnableState(finishButton, saveState, "finish"); //$NON-NLS-1$ restoreEnableState(cancelButton, saveState, "cancel"); //$NON-NLS-1$ restoreEnableState(helpButton, saveState, "help"); //$NON-NLS-1$ Object pageValue = saveState.get("page"); //$NON-NLS-1$ if (pageValue != null) { ((ControlEnableState) pageValue).restore(); } }