public void lifeCycleStateChanged(LifeCycleTransition transition) { if (!disposed) { LifeCycleState actualCurrentState = lastTransition.getCurrentState(); if (!transition.getCurrentState().equals(actualCurrentState)) { LifeCycleState expectedCurrentState = transition.getPreviousState(); synchronized (parent) { if (!expectedCurrentState.equals(actualCurrentState)) { int expectedIndex = LifeCycleState.STATES.indexOf(expectedCurrentState); int actualIndex = LifeCycleState.STATES.indexOf(actualCurrentState); int increment = actualIndex < expectedIndex ? 1 : -1; do { int nextIndex = actualIndex + increment; LifeCycleTransition nextTransition = new LifeCycleTransition( (LifeCycleState) LifeCycleState.STATES.get(actualIndex), (LifeCycleState) LifeCycleState.STATES.get(nextIndex)); notifyLastTransition(nextTransition); actualIndex = nextIndex; } while (actualIndex != expectedIndex); } notifyLastTransition(transition); lastTransition = transition; } } } }
public synchronized void lifeCycleStateChanged(LifeCycleTransition transition) { if (!disposed) { LifeCycleState state = transition.getCurrentState(); if (transition.equals(LifeCycleTransition.LOADED_DORMANT)) { disposed = true; disposeLifeCycleClient(); if (getParent() != null) swapProxy(); // getParent().refreshChildren(); } else if (state.equals(LifeCycleState.ABSENT)) { refreshVisual(); } else if (transition.equals(LifeCycleTransition.DORMANT_LOADED)) { if (getParent() != null) getParent().refreshChildren(); } else { updateVisual(); } } }
/** * Called when the meem is bound. * * @param boundMeem */ synchronized void bind(Meem boundMeem) { synchronized (this.parent) { if (this.parent.meem == null || boundMeem == null || !this.parent.meem.equals(boundMeem) || compareRemote(boundMeem)) { if (this.parent.meem != null) { lifeCycleClientImpl.dispose(); lifeCycleClientImpl = null; LifeCycleState currentState = lastTransition.getCurrentState(); if (!currentState.equals(LifeCycleState.ABSENT)) { if (!currentState.equals(LifeCycleState.DORMANT)) { if (!currentState.equals(LifeCycleState.LOADED)) { if (!currentState.equals(LifeCycleState.PENDING)) { notifyLastTransition(LifeCycleTransition.READY_PENDING); } notifyLastTransition(LifeCycleTransition.PENDING_LOADED); } notifyLastTransition(LifeCycleTransition.LOADED_DORMANT); } notifyLastTransition(LifeCycleTransition.DORMANT_ABSENT); lastTransition = LifeCycleTransition.DORMANT_ABSENT; } } this.parent.meem = boundMeem; if (boundMeem != null) { lifeCycleClientImpl = new LifeCycleClientImpl(this.parent); } } } }
/* (non-Javadoc) * @see org.eclipse.gef.commands.Command#canUndo() */ public boolean canUndo() { return !state.equals(LifeCycleState.ABSENT); }