@Override public void addListener(final IStateListener listener) { if (state == null) { addListenerObject(listener); } else { state.addListener(listener); } }
/** * <p> * Adds a state to this handler. This will add this handler as a listener to * the state, and then fire a handleStateChange so that the handler can * respond to the incoming state. * </p> * <p> * Clients may extend this method, but they should call this super method * first before doing anything else. * </p> * * @param stateId * The identifier indicating the type of state being added; must * not be <code>null</code>. * @param state * The state to add; must not be <code>null</code>. */ @Override public void addState(final String stateId, final State state) { if (state == null) { throw new NullPointerException("Cannot add a null state"); //$NON-NLS-1$ } if (states == null) { states = new HashMap<>(3); } states.put(stateId, state); state.addListener(this); handleStateChange(state, null); }
/** * <p> * Adds a state to this handler. This will add this handler as a listener to * the state, and then fire a handleStateChange so that the handler can * respond to the incoming state. * </p> * <p> * Clients may extend this method, but they should call this super method * first before doing anything else. * </p> * * @param stateId * The identifier indicating the type of state being added; must * not be <code>null</code>. * @param state * The state to add; must not be <code>null</code>. */ @Override public void addState(final String stateId, final State state) { if (state == null) { throw new NullPointerException("Cannot add a null state"); //$NON-NLS-1$ } if (states == null) { states = new HashMap<>(3); } states.put(stateId, state); state.addListener(this); handleStateChange(state, null); }
/** * <p> * Adds a state to this handler. This will add this handler as a listener to * the state, and then fire a handleStateChange so that the handler can * respond to the incoming state. * </p> * <p> * Clients may extend this method, but they should call this super method * first before doing anything else. * </p> * * @param stateId * The identifier indicating the type of state being added; must * not be <code>null</code>. * @param state * The state to add; must not be <code>null</code>. */ @Override public void addState(final String stateId, final State state) { if (state == null) { throw new NullPointerException("Cannot add a null state"); //$NON-NLS-1$ } if (states == null) { states = new HashMap<>(3); } states.put(stateId, state); state.addListener(this); handleStateChange(state, null); }
/** * Constructs a repositories view label provider */ public RepositoriesViewLabelProvider() { ICommandService srv = (ICommandService) PlatformUI.getWorkbench() .getService(ICommandService.class); verboseBranchModeState = srv.getCommand(ToggleBranchCommitCommand.ID) .getState(ToggleBranchCommitCommand.TOGGLE_STATE); verboseBranchModeState.addListener(this); try { this.verboseBranchMode = ((Boolean) verboseBranchModeState .getValue()).booleanValue(); } catch (Exception e) { Activator.logError(e.getMessage(), e); } }
/** * Constructs this instance */ public RepositoriesViewContentProvider() { ICommandService srv = (ICommandService) PlatformUI.getWorkbench() .getService(ICommandService.class); commandState = srv.getCommand( ToggleBranchHierarchyCommand.ID) .getState(ToggleBranchHierarchyCommand.TOGGLE_STATE); commandState.addListener(this); try { this.branchHierarchyMode = ((Boolean) commandState.getValue()) .booleanValue(); } catch (Exception e) { Activator.handleError(e.getMessage(), e, false); } }
state.addListener((IStateListener) element);
styleState.addListener(stateListener); } else if (toggleState != null) { toggleState.addListener(stateListener); } else if (radioState != null) { radioState.addListener(stateListener);
styleState.addListener(stateListener); } else if (toggleState != null) { toggleState.addListener(stateListener); } else if (radioState != null) { radioState.addListener(stateListener);