/** * <p> * Notifies this manager that the context manager has changed. This method * is intended for internal use only. * </p> * <p> * This method completes in <code>O(1)</code>. * </p> */ @Override public final void contextManagerChanged( final ContextManagerEvent contextManagerEvent) { if (contextManagerEvent.isActiveContextsChanged()) { // clearSolution(); recomputeBindings(); } }
/** * Set the manager to cache context id changes. * * @param cache * <code>true</code> to turn caching on, <code>false</code> * to turn caching off and send an event if necessary. * @since 3.3 */ private void setEventCaching(boolean cache) { if (caching == cache) { return; } caching = cache; boolean fireChange = activeContextsChange; Set<String> holdOldIds = (oldIds == null ? Collections.EMPTY_SET : oldIds); if (caching) { oldIds = new HashSet<>(activeContextIds); } else { oldIds = null; } activeContextsChange = false; if (!caching && fireChange) { fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, holdOldIds)); } } }
@Override public void contextManagerChanged( org.eclipse.core.commands.contexts.ContextManagerEvent contextManagerEvent) { final String contextId = contextManagerEvent.getContextId(); final boolean definedContextsChanged; final Set previouslyDefinedContextIds; if (contextId == null) { definedContextsChanged = false; previouslyDefinedContextIds = null; } else { definedContextsChanged = true; previouslyDefinedContextIds = new HashSet(); previouslyDefinedContextIds.addAll(contextManager .getDefinedContextIds()); if (contextManagerEvent.isContextDefined()) { previouslyDefinedContextIds.remove(contextId); } else { previouslyDefinedContextIds.add(contextId); } } fireContextManagerChanged(new ContextManagerEvent(this, definedContextsChanged, contextManagerEvent .isActiveContextsChanged(), previouslyDefinedContextIds, contextManagerEvent .getPreviouslyActiveContextIds())); }
@Override public void contextManagerChanged(ContextManagerEvent event) { if (event.isActiveContextsChanged()) { Set<?> oldContexts = event.getPreviouslyActiveContextIds(); Set<?> newContexts = event.getContextManager().getActiveContextIds(); if (oldContexts.contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET) != newContexts.contains(IDebugUIConstants.DEBUG_TOOLBAR_ACTION_SET)) { updateCheckedDebugToolBarAction(); } } }
/** * Returns a set of contexts disabled in the given event, possibly empty. * * @param event the event * @return disabled context id's */ private Set<String> getDisabledContexts(ContextManagerEvent event) { Set<String> prev = new HashSet<String>(event.getPreviouslyActiveContextIds()); Set<String> activeContextIds = event.getContextManager().getActiveContextIds(); if (activeContextIds != null) { prev.removeAll(activeContextIds); } return prev; }
@Override public final void contextManagerChanged(final ContextManagerEvent event) { final String contextId = context.getId(); final boolean enabledChanged; if (event.isActiveContextsChanged()) { final Set previousContexts = event.getPreviouslyActiveContextIds(); final Set currentContexts = contextManager.getActiveContextIds(); if ((previousContexts != null) && (previousContexts.contains(contextId)) && ((currentContexts == null) || (currentContexts .contains(contextId)))) { enabledChanged = true; } else if ((currentContexts != null) && (currentContexts.contains(contextId)) && ((previousContexts == null) || (previousContexts .contains(contextId)))) { enabledChanged = true; } else { enabledChanged = false; } } else { enabledChanged = false; } wrappedListener .contextChanged(new org.eclipse.ui.contexts.ContextEvent( context, false, enabledChanged, false, false)); }
@Override public void runWithException() { contextManager.addContextManagerListener(contextManagerEvent -> { if (contextManagerEvent.isContextChanged()) { String id = contextManagerEvent.getContextId(); if (id != null) { defineBindingTable(id); } } }); EContextService ecs = e4Context.get(EContextService.class); ecs.activateContext(IContextService.CONTEXT_ID_DIALOG_AND_WINDOW); } });
/** * <p> * Notifies this manager that the context manager has changed. This method * is intended for internal use only. * </p> * <p> * This method completes in <code>O(1)</code>. * </p> */ public final void contextManagerChanged( final ContextManagerEvent contextManagerEvent) { if (contextManagerEvent.isActiveContextsChanged()) { // clearSolution(); recomputeBindings(); } }
/** * Set the manager to cache context id changes. * * @param cache * <code>true</code> to turn caching on, <code>false</code> * to turn caching off and send an event if necessary. * @since 3.3 */ private void setEventCaching(boolean cache) { if (caching == cache) { return; } caching = cache; boolean fireChange = activeContextsChange; Set<String> holdOldIds = (oldIds == null ? Collections.EMPTY_SET : oldIds); if (caching) { oldIds = new HashSet<>(activeContextIds); } else { oldIds = null; } activeContextsChange = false; if (!caching && fireChange) { fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, holdOldIds)); } } }
/** * <p> * Notifies this manager that the context manager has changed. This method * is intended for internal use only. * </p> * <p> * This method completes in <code>O(1)</code>. * </p> */ @Override public void contextManagerChanged( final ContextManagerEvent contextManagerEvent) { if (contextManagerEvent.isActiveContextsChanged()) { // clearSolution(); recomputeBindings(); } }
/** * Set the manager to cache context id changes. * * @param cache * <code>true</code> to turn caching on, <code>false</code> * to turn caching off and send an event if necessary. * @since 3.3 */ private void setEventCaching(boolean cache) { if (caching == cache) { return; } caching = cache; boolean fireChange = activeContextsChange; Set<String> holdOldIds = (oldIds == null ? Collections.EMPTY_SET : oldIds); if (caching) { oldIds = new HashSet<>(activeContextIds); } else { oldIds = null; } activeContextsChange = false; if (!caching && fireChange) { fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, holdOldIds)); } } }
@Override public void contextManagerChanged(final ContextManagerEvent event) { fireCommandManagerChanged(new CommandManagerEvent(this, event .isActiveContextsChanged(), false, false, false, false, false, false, null, null, null)); }
/** * Activates a context in this context manager. * * @param contextId * The identifier of the context to activate; must not be * <code>null</code>. */ public final void addActiveContext(final String contextId) { if (activeContextIds.contains(contextId)) { return; } activeContextsChange = true; if (caching) { activeContextIds.add(contextId); } else { final Set<String> previouslyActiveContextIds = new HashSet<>(activeContextIds); activeContextIds.add(contextId); fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, previouslyActiveContextIds)); } if (DEBUG) { Tracing.printTrace("CONTEXTS", activeContextIds.toString()); //$NON-NLS-1$ } }
@Override public void contextManagerChanged(final ContextManagerEvent event) { if (event.isActiveContextsChanged()) { final Map currentState = getCurrentState(); if (DEBUG) { logDebuggingInfo("Contexts changed to " //$NON-NLS-1$ + currentState.get(ISources.ACTIVE_CONTEXT_NAME)); } fireSourceChanged(ISources.ACTIVE_CONTEXT, currentState); } }
/** * Activates a context in this context manager. * * @param contextId * The identifier of the context to activate; must not be * <code>null</code>. */ public final void addActiveContext(final String contextId) { if (activeContextIds.contains(contextId)) { return; } activeContextsChange = true; if (caching) { activeContextIds.add(contextId); } else { final Set<String> previouslyActiveContextIds = new HashSet<>(activeContextIds); activeContextIds.add(contextId); fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, previouslyActiveContextIds)); } if (DEBUG) { Tracing.printTrace("CONTEXTS", activeContextIds.toString()); //$NON-NLS-1$ } }
@Override public void contextManagerChanged(ContextManagerEvent event) { if (event.isActiveContextsChanged() && getActivePerspective() != null) { Set<String> disabledContexts = getDisabledContexts(event); if (!disabledContexts.isEmpty()) { for (String contextId : disabledContexts) { if (isViewContext(contextId)) { if (isActivated(contextId)) { deactivate(contextId, getActivePerspective()); } } } } // Ensure that the views are activated for the new contexts if needed. contextActivated(DebugUITools.getDebugContextManager().getContextService(fWindow).getActiveContext()); } }
/** * Activates a context in this context manager. * * @param contextId * The identifier of the context to activate; must not be * <code>null</code>. */ public final void addActiveContext(final String contextId) { if (activeContextIds.contains(contextId)) { return; } activeContextsChange = true; if (caching) { activeContextIds.add(contextId); } else { final Set<String> previouslyActiveContextIds = new HashSet<>(activeContextIds); activeContextIds.add(contextId); fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, previouslyActiveContextIds)); } if (DEBUG) { Tracing.printTrace("CONTEXTS", activeContextIds.toString()); //$NON-NLS-1$ } }
/** * Deactivates a context in this context manager. * * @param contextId * The identifier of the context to deactivate; must not be * <code>null</code>. */ public final void removeActiveContext(final String contextId) { if (!activeContextIds.contains(contextId)) { return; } activeContextsChange = true; if (caching) { activeContextIds.remove(contextId); } else { final Set<String> previouslyActiveContextIds = new HashSet<>(activeContextIds); activeContextIds.remove(contextId); fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, previouslyActiveContextIds)); } if (DEBUG) { Tracing.printTrace("CONTEXTS", activeContextIds.toString()); //$NON-NLS-1$ } }
/** * Deactivates a context in this context manager. * * @param contextId * The identifier of the context to deactivate; must not be * <code>null</code>. */ public final void removeActiveContext(final String contextId) { if (!activeContextIds.contains(contextId)) { return; } activeContextsChange = true; if (caching) { activeContextIds.remove(contextId); } else { final Set<String> previouslyActiveContextIds = new HashSet<>(activeContextIds); activeContextIds.remove(contextId); fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, previouslyActiveContextIds)); } if (DEBUG) { Tracing.printTrace("CONTEXTS", activeContextIds.toString()); //$NON-NLS-1$ } }
/** * Deactivates a context in this context manager. * * @param contextId * The identifier of the context to deactivate; must not be * <code>null</code>. */ public final void removeActiveContext(final String contextId) { if (!activeContextIds.contains(contextId)) { return; } activeContextsChange = true; if (caching) { activeContextIds.remove(contextId); } else { final Set<String> previouslyActiveContextIds = new HashSet<>(activeContextIds); activeContextIds.remove(contextId); fireContextManagerChanged(new ContextManagerEvent(this, null, false, true, previouslyActiveContextIds)); } if (DEBUG) { Tracing.printTrace("CONTEXTS", activeContextIds.toString()); //$NON-NLS-1$ } }