@Override public Object removeVariable(String name) { Object obj = eclipseContext.getLocal(name); eclipseContext.remove(name); return obj; }
private void deferActivateContext(String id) { LinkedList<String> locals = (LinkedList<String>) eclipseContext .getLocal(DEFERED_ACTIVATES); if (locals == null) { locals = new LinkedList<String>(); eclipseContext.set(DEFERED_ACTIVATES, locals); } locals.add(id); }
private void deferDeactivateContext(String id) { LinkedList<String> locals = (LinkedList<String>) eclipseContext .getLocal(DEFERED_DEACTIVATES); if (locals == null) { locals = new LinkedList<String>(); eclipseContext.set(DEFERED_DEACTIVATES, locals); } locals.add(id); }
private void deferDeactivateContext(String id) { @SuppressWarnings("unchecked") LinkedList<String> locals = (LinkedList<String>) eclipseContext.getLocal(DEFERED_DEACTIVATES); if (locals == null) { locals = new LinkedList<>(); eclipseContext.set(DEFERED_DEACTIVATES, locals); } locals.add(id); }
private void deferActivateContext(String id) { @SuppressWarnings("unchecked") LinkedList<String> locals = (LinkedList<String>) eclipseContext.getLocal(DEFERED_ACTIVATES); if (locals == null) { locals = new LinkedList<String>(); eclipseContext.set(DEFERED_ACTIVATES, locals); } locals.add(id); }
private void deferActivateContext(String id) { @SuppressWarnings("unchecked") LinkedList<String> locals = (LinkedList<String>) eclipseContext.getLocal(DEFERED_ACTIVATES); if (locals == null) { locals = new LinkedList<String>(); eclipseContext.set(DEFERED_ACTIVATES, locals); } locals.add(id); }
private void deferDeactivateContext(String id) { @SuppressWarnings("unchecked") LinkedList<String> locals = (LinkedList<String>) eclipseContext.getLocal(DEFERED_DEACTIVATES); if (locals == null) { locals = new LinkedList<>(); eclipseContext.set(DEFERED_DEACTIVATES, locals); } locals.add(id); }
@Override public Object compute(IEclipseContext context, String contextKey) { EventBroker broker = context.getLocal(EventBroker.class); if (broker == null) { broker = ContextInjectionFactory.make(EventBroker.class, context); context.set(EventBroker.class, broker); } return broker; } }
@Override public Object compute(IEclipseContext context, String contextKey) { EventBroker broker = context.getLocal(EventBroker.class); if (broker == null) { broker = ContextInjectionFactory.make(EventBroker.class, context); context.set(EventBroker.class, broker); } return broker; } }
@Override public Object compute(IEclipseContext context, String contextKey) { EventBroker broker = context.getLocal(EventBroker.class); if (broker == null) { broker = ContextInjectionFactory.make(EventBroker.class, context); context.set(EventBroker.class, broker); } return broker; } }
static void removeHandlerActivation(HandlerActivation eActivation) { @SuppressWarnings("unchecked") List<HandlerActivation> handlerActivations = (List<HandlerActivation>) eActivation.context .getLocal(LEGACY_H_ID + eActivation.getCommandId()); if (handlerActivations == null) { handlerActivations = new ArrayList<>(); } else { handlerActivations = new ArrayList<>(handlerActivations); } handlerActivations.remove(eActivation); // setting this so that we trigger invalidations eActivation.context.set(LEGACY_H_ID + eActivation.getCommandId(), handlerActivations); }
static void addHandlerActivation(HandlerActivation eActivation) { @SuppressWarnings("unchecked") List<HandlerActivation> handlerActivations = (List<HandlerActivation>) eActivation.context .getLocal(LEGACY_H_ID + eActivation.getCommandId()); if (handlerActivations == null) { handlerActivations = new ArrayList<>(); } else { if (handlerActivations.contains(eActivation)) { return; } handlerActivations = new ArrayList<>(handlerActivations); } handlerActivations.add(eActivation); // setting this so that we trigger invalidations eActivation.context.set(LEGACY_H_ID + eActivation.getCommandId(), handlerActivations); }
@Override public void deactivateContext(String id) { if (deferUpdates) { deferDeactivateContext(id); return; } LinkedList<?> locals = (LinkedList<?>) eclipseContext.getLocal(LOCAL_CONTEXTS); if (locals != null && locals.remove(id)) { boolean contained = locals.contains(id); if (!contained) { // copy the set so the change is propagated eclipseContext.set(LOCAL_CONTEXTS, locals.clone()); } } }
public void deactivateContext(String id) { if (deferUpdates) { deferDeactivateContext(id); return; } LinkedList<String> locals = (LinkedList<String>) eclipseContext .getLocal(LOCAL_CONTEXTS); if (locals != null && locals.remove(id)) { boolean contained = locals.contains(id); if (!contained) { // copy the set so the change is propagated eclipseContext.set(LOCAL_CONTEXTS, locals.clone()); } } }
@Override public void deactivateContext(String id) { if (deferUpdates) { deferDeactivateContext(id); return; } LinkedList<?> locals = (LinkedList<?>) eclipseContext.getLocal(LOCAL_CONTEXTS); if (locals != null && locals.remove(id)) { boolean contained = locals.contains(id); if (!contained) { // copy the set so the change is propagated eclipseContext.set(LOCAL_CONTEXTS, locals.clone()); } } }
public void activateContext(String id) { if (deferUpdates) { deferActivateContext(id); return; } LinkedList<String> locals = (LinkedList<String>) eclipseContext .getLocal(LOCAL_CONTEXTS); if (locals == null) { locals = new LinkedList<String>(); locals.add(id); eclipseContext.set(LOCAL_CONTEXTS, locals); } else { boolean contained = locals.contains(id); if (locals.add(id) && !contained) { // copy the set so the change is propagated eclipseContext.set(LOCAL_CONTEXTS, locals.clone()); } } }
@Override public void activateContext(String id) { if (deferUpdates) { deferActivateContext(id); return; } @SuppressWarnings("unchecked") LinkedList<String> locals = (LinkedList<String>) eclipseContext.getLocal(LOCAL_CONTEXTS); if (locals == null) { locals = new LinkedList<String>(); locals.add(id); eclipseContext.set(LOCAL_CONTEXTS, locals); } else { boolean contained = locals.contains(id); if (locals.add(id) && !contained) { // copy the set so the change is propagated eclipseContext.set(LOCAL_CONTEXTS, locals.clone()); } } }
@Override public Object compute(IEclipseContext context, String contextKey) { Object defaultVariable = context.getLocal(DEFAULT_VAR); if (defaultVariable != null && defaultVariable != IEvaluationContext.UNDEFINED_VARIABLE) { return defaultVariable; } defaultVariable = context.getActive(IServiceConstants.ACTIVE_SELECTION); if (defaultVariable instanceof IStructuredSelection) { final IStructuredSelection selection = (IStructuredSelection) defaultVariable; return selection.toList(); } else if ((defaultVariable instanceof ISelection) && (!((ISelection) defaultVariable).isEmpty())) { return Collections.singleton(defaultVariable); } return null; } };
void handleDocumentModified(Event<SourceFileChange> event) { String uri = event.getData().input.getURI(); modelService.findElements(application, MPart.class, EModelService.ANYWHERE, (e) -> { if( e instanceof MPart) { return ((MPart) e).getContext() != null && uri.equals(((MPart) e).getContext().getLocal(Constants.DOCUMENT_URL)); } return false; }).forEach((e) -> { ((MPart)e).setDirty(true); }); }
void handleDocumentSaved(Event<SourceFileInput> event) { Input<?> input = event.getData(); String tmpUri = ((URIProvider)input).getURI(); String uri = tmpUri; modelService.findElements(application, MPart.class, EModelService.ANYWHERE, (e) -> { if( e instanceof MPart) { return ((MPart) e).getContext() != null && uri.equals(((MPart) e).getContext().getLocal(Constants.DOCUMENT_URL)); } return false; }).forEach((e) -> { ((MPart)e).setDirty(false); }); }