public void remove(String name) { if (isSetLocally(name)) { Object oldValue = localValues.remove(name); Set<Scheduled> scheduled = new LinkedHashSet<Scheduled>(); invalidate(name, ContextChangeEvent.REMOVED, oldValue, scheduled); processScheduled(scheduled); } }
public void setParent(IEclipseContext parent) { EclipseContext parentContext = (EclipseContext) localValues.get(PARENT); if (parent == parentContext) return; // no-op if (parentContext != null) parentContext.removeChild(this); Set<Scheduled> scheduled = new LinkedHashSet<Scheduled>(); handleReparent((EclipseContext) parent, scheduled); localValues.put(PARENT, parent); if (parent != null) ((EclipseContext) parent).addChild(this); processScheduled(scheduled); return; }
public void set(String name, Object value) { if (PARENT.equals(name)) { setParent((IEclipseContext) value); return; } boolean containsKey = localValues.containsKey(name); Object oldValue = localValues.put(name, value); if (!containsKey || value != oldValue) { Set<Scheduled> scheduled = new LinkedHashSet<Scheduled>(); invalidate(name, ContextChangeEvent.ADDED, oldValue, scheduled); processScheduled(scheduled); } }
/* * (non-Javadoc) * * @see org.eclipse.e4.core.services.context.IEclipseContext#dispose() */ public void dispose() { // dispose of child contexts first for (EclipseContext childContext : getChildren()) { childContext.dispose(); } ContextChangeEvent event = new ContextChangeEvent(this, ContextChangeEvent.DISPOSE, null, null, null); Set<Scheduled> scheduled = new LinkedHashSet<Scheduled>(); Set<Computation> allComputations = getListeners(); listeners.clear(); allComputations.addAll(activeRATs); activeRATs.clear(); for (Computation computation : allComputations) { computation.handleInvalid(event, scheduled); } processScheduled(scheduled); synchronized (notifyOnDisposal) { for (IContextDisposalListener listener : notifyOnDisposal) { listener.disposed(this); } } localValueComputations.clear(); // if this was the parent's active child, deactivate it EclipseContext parent = getParent(); if (parent != null) { if (this == parent.getActiveChild()) parent.set(ACTIVE_CHILD, null); } localValues.clear(); if (parent != null) parent.removeChild(this); if (debugAddOn != null) debugAddOn.notify(this, IEclipseContextDebugger.EventType.DISPOSED, null); }
public void modify(String name, Object value) { Set<Scheduled> scheduled = new LinkedHashSet<Scheduled>(); if (!internalModify(name, value, scheduled)) set(name, value); processScheduled(scheduled); }