@Override public void activateHandler(String commandId, Object handler) { String handlerId = H_ID + commandId; context.set(handlerId, handler); }
@PostConstruct public void init(IEclipseContext context) { this.context = context; this.context.set(SHARED_ELEMENTS_STORE, new HashMap<MUIElement, Set<MPlaceholder>>()); }
/** * Creates and returns a new empty context. * @return A new empty context. */ static public IEclipseContext create(String name) { IEclipseContext result = create(); result.set(EclipseContext.DEBUG_STRING, name); return result; }
private static void populateModelInterfaces(MApplicationElement element, IEclipseContext context, Class<?>[] interfaces) { for (Class<?> intf : interfaces) { context.set(intf.getName(), element); populateModelInterfaces(element, context, intf.getInterfaces()); } } }
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 static void populateModelInterfaces(MContext contextModel, IEclipseContext context, Class<?>[] interfaces) { for (Class<?> intf : interfaces) { context.set(intf.getName(), contextModel); populateModelInterfaces(contextModel, context, intf.getInterfaces()); } } }
@Override public PerspectiveBuilder createPerspectiveBuilder(PerspectiveReader perspReader) { IEclipseContext childContext = context.createChild(); childContext.set(PerspectiveReader.class, perspReader); return ContextInjectionFactory.make(PerspectiveBuilder.class, childContext); }
@PostConstruct public void init(IEclipseContext context) { ContextManager contextManager = context.get(ContextManager.class); ContextSet.setComparator(new ContextSet.CComp(contextManager)); context.set(BindingTableManager.class, ContextInjectionFactory.make(BindingTableManager.class, context)); context.set(EBindingService.class.getName(), new BindingServiceCreationFunction()); } }
@SuppressWarnings("static-method") @PostConstruct void init(IEclipseContext context) { ContextManager contextManager = context.get(ContextManager.class); ContextSet.setComparator(new ContextSet.CComp(contextManager)); context.set(BindingTableManager.class, ContextInjectionFactory.make(BindingTableManager.class, context)); context.set(EBindingService.class.getName(), new BindingServiceCreationFunction()); } }
public void widgetSelected(SelectionEvent e) { lclContext.set(MItem.class.getName(), item); ContextInjectionFactory.invoke(contrib.getObject(), Execute.class, lclContext); lclContext.remove(MItem.class.getName()); }
@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) { if (service == null) { IEclipseContext root = getRootContext(context); manager = new CommandManager(); root.set(CommandManager.class.getName(), manager); service = ContextInjectionFactory.make(CommandServiceImpl.class, root); } return service; }
private void handleContextSet(Event event) { Object element = event.getProperty(UIEvents.EventTags.ELEMENT); MPart part = getModel(); if (element == part) { IEclipseContext context = part.getContext(); if (context != null) { context.set(getClass().getName(), this); unsubscribe(); } } }
public void updateShowInSources(MPart part) { IWorkbenchPart workbenchPart = getWorkbenchPart(part); ShowInContext context = getContext(workbenchPart); if (context != null) { window.getContext().set(ISources.SHOW_IN_INPUT, context.getInput()); window.getContext().set(ISources.SHOW_IN_SELECTION, context.getSelection()); } }
public void showPopup(final Event event, final Menu menu, final MPopupMenu menuModel) { // System.err.println("showPopup: " + menuModel + "\n\t" + menu); // we need some context foolery here final IEclipseContext popupContext = menuModel.getContext(); final IEclipseContext parentContext = popupContext.getParent(); final IEclipseContext originalChild = parentContext.getActiveChild(); popupContext.activate(); popupContext.set(TMP_ORIGINAL_CONTEXT, originalChild); }
@Override public void changeApplicationLocale(Locale locale) { // the TranslationService.LOCALE context parameter is specified as String // so we put the String representation of the given Locale to the context this.application.getContext().set(TranslationService.LOCALE, locale); // update model updateLocalization(this.application.getChildren()); // fire event broker.post(LOCALE_CHANGE, locale); }
@Override public void stop() { if (this.app != null) { this.app.getContext().set("__efx_engine_shutdown", Boolean.TRUE); //$NON-NLS-1$ for (MWindow w : this.app.getChildren()) { ElementRenderer<MUIElement, Object> r = getRenderer(w); if (r != null) { removeGui(w); } } } }
private void showPopup(final Menu menu, final MPopupMenu menuModel, MenuManager menuManager) { // System.err.println("showPopup: " + menuModel + "\n\t" + menu); // we need some context foolery here final IEclipseContext popupContext = menuModel.getContext(); final IEclipseContext parentContext = popupContext.getParent(); final IEclipseContext originalChild = parentContext.getActiveChild(); popupContext.activate(); popupContext.set(MenuManagerRendererFilter.TMP_ORIGINAL_CONTEXT, originalChild); }
void handlePartDirty(Event<MApplicationElement> event) { Object element = event.getData(); // TODO remove once we run on Neon See https://bugs.eclipse.org/bugs/show_bug.cgi?id=480934 if( element == null ) { element = event.getProperties().get(EventTags.ELEMENT); } if( element instanceof MContext ) { ((MContext) element).getContext().set(Constants.EDITOR_DIRTY_FLAG_KEY, event.getProperties().get(EventTags.NEW_VALUE)); broker.publish(TOPIC_REQUEST_ENABLEMENT_UPDATE_STRING, UIEvents.ALL_ELEMENT_ID,true); } }