/** * 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; }
public InjectedFinder(Context context, Class<? extends ServerResource> targetClass) { super(context, targetClass); serviceContext = EclipseContextFactory.getServiceContext(Activator .getContext()); }
/** * Returns a context that can be used to lookup OSGi services. A client must never dispose the * provided context, because it may be shared by multiple callers. * * @param bundleContext * The bundle context to use for service lookup * @return A context containing all OSGi services */ public static IEclipseContext getServiceContext(BundleContext bundleContext) { synchronized (serviceContexts) { IEclipseContext result = serviceContexts.get(bundleContext); if (result == null) { result = createServiceContext(bundleContext); serviceContexts.put(bundleContext, result); } return result; } }
private IEclipseContext createContext(final Event trigger) { final IEclipseContext staticContext = EclipseContextFactory.create("keys-staticContext"); //$NON-NLS-1$ staticContext.set(Event.class, trigger); return staticContext; }
/** * @return a context that can be used to lookup OSGi services */ public static IEclipseContext getServiceContext() { return EclipseContextFactory.getServiceContext(Activator.getDefault().getContext()); }
@Override public boolean canExecute(ParameterizedCommand command) { final IEclipseContext staticContext = EclipseContextFactory.create(TMP_STATIC_CONTEXT); try { return canExecute(command, staticContext); } finally { staticContext.dispose(); } }
Class<?> cl = b.loadClass(this.applicationClass); IEclipseContext eContext = EclipseContextFactory .getServiceContext(context); ContextInjectionFactory.setDefault(eContext); eContext.set(IApplicationContext.class, applicationContext);
@Override public Object executeHandler(ParameterizedCommand command) { final IEclipseContext staticContext = EclipseContextFactory.create(TMP_STATIC_CONTEXT); try { return executeHandler(command, staticContext); } finally { staticContext.dispose(); } }
private IEclipseContext getStaticContext(Event event) { if (infoContext == null) { infoContext = EclipseContextFactory.create(DCI_STATIC_CONTEXT); ContributionsAnalyzer.populateModelInterfaces(model, infoContext, model.getClass().getInterfaces()); } if (event == null) { infoContext.remove(Event.class); } else { infoContext.set(Event.class, event); } return infoContext; }
private IEclipseContext getStaticContext(Event event) { if (infoContext == null) { infoContext = EclipseContextFactory.create(HCI_STATIC_CONTEXT); ContributionsAnalyzer.populateModelInterfaces(model, infoContext, model.getClass().getInterfaces()); } if (event == null) { infoContext.remove(Event.class); } else { infoContext.set(Event.class, event); } return infoContext; }
public O createInstance(Type iType, Class<?> owner) { Optional<TypeTypeProviderService<O>> providerOp = this.providerList.stream().filter( p -> p.test(iType)).findFirst(); if( ! providerOp.isPresent() ) { return (O)null; } Class<O> type = (Class<O>) providerOp.get().getType(iType); IEclipseContext staticContext = EclipseContextFactory.create("static"); //$NON-NLS-1$ try { staticContext.set(TypeTypeProviderService.DI_KEY, owner); return ContextInjectionFactory.make(type, this.context, staticContext); } finally { staticContext.dispose(); } } }
private IEclipseContext getStaticContext() { if (infoContext == null) { IEclipseContext parentContext = renderer.getContext(toolbarModel); if (parentContext != null) { infoContext = parentContext.createChild(STATIC_CONTEXT); } else { infoContext = EclipseContextFactory.create(STATIC_CONTEXT); } ContributionsAnalyzer.populateModelInterfaces(toolbarModel, infoContext, toolbarModel.getClass().getInterfaces()); infoContext.set(ToolBarManagerRenderer.class, renderer); } return infoContext; }
private IEclipseContext getStaticContext() { if (infoContext == null) { IEclipseContext parentContext = renderer.getContext(menuModel); if (parentContext != null) { infoContext = parentContext.createChild(STATIC_CONTEXT); } else { infoContext = EclipseContextFactory.create(STATIC_CONTEXT); } ContributionsAnalyzer.populateModelInterfaces(menuModel, infoContext, menuModel.getClass().getInterfaces()); infoContext.set(MenuManagerRenderer.class, renderer); } return infoContext; }
private IEclipseContext getStaticContext() { if (infoContext == null) { IEclipseContext parentContext = renderer.getContext(menuModel); if (parentContext != null) { infoContext = parentContext.createChild(STATIC_CONTEXT); } else { infoContext = EclipseContextFactory.create(STATIC_CONTEXT); } ContributionsAnalyzer.populateModelInterfaces(menuModel, infoContext, menuModel.getClass().getInterfaces()); infoContext.set(MenuManagerRenderer.class, renderer); } return infoContext; }
private IEclipseContext getStaticContext() { if (infoContext == null) { IEclipseContext parentContext = renderer.getContext(toolbarModel); if (parentContext != null) { infoContext = parentContext.createChild(STATIC_CONTEXT); } else { infoContext = EclipseContextFactory.create(STATIC_CONTEXT); } ContributionsAnalyzer.populateModelInterfaces(toolbarModel, infoContext, toolbarModel.getClass().getInterfaces()); infoContext.set(ToolBarManagerRenderer.class, renderer); } return infoContext; }
private IEclipseContext getStaticContext(Event event) { if (infoContext == null) { infoContext = EclipseContextFactory.create(HCI_STATIC_CONTEXT); ContributionsAnalyzer.populateModelInterfaces(getModel(), infoContext, getModel().getClass().getInterfaces()); } if (event == null) { infoContext.remove(Event.class); } else { infoContext.set(Event.class, event); } return infoContext; }
private IEclipseContext getStaticContext(Event event) { if (infoContext == null) { infoContext = EclipseContextFactory.create(DCI_STATIC_CONTEXT); ContributionsAnalyzer.populateModelInterfaces(getModel(), infoContext, getModel().getClass().getInterfaces()); } if (event == null) { infoContext.remove(Event.class); } else { infoContext.set(Event.class, event); } return infoContext; }
public void widgetSelected(SelectionEvent e) { if (e.detail != SWT.ARROW) { EHandlerService service = (EHandlerService) lclContext .get(EHandlerService.class.getName()); ParameterizedCommand cmd = item.getWbCommand(); if (cmd == null) { cmd = generateParameterizedCommand(item, lclContext); } if (cmd == null) { Activator.trace(Policy.DEBUG_MENUS, "Failed to execute: " + item.getCommand(), //$NON-NLS-1$ null); return; } final IEclipseContext staticContext = EclipseContextFactory .create(TIR_STATIC_CONTEXT); ContributionsAnalyzer.populateModelInterfaces(item, staticContext, item.getClass().getInterfaces()); service.executeHandler(cmd, staticContext); } }
public void handleEvent(Event e) { EHandlerService service = (EHandlerService) lclContext .get(EHandlerService.class.getName()); ParameterizedCommand cmd = item.getWbCommand(); if (cmd == null) { return; } final IEclipseContext staticContext = EclipseContextFactory .create(HMI_STATIC_CONTEXT); if (e != null) { staticContext.set(Event.class, e); } ContributionsAnalyzer.populateModelInterfaces(item, staticContext, item.getClass().getInterfaces()); try { service.executeHandler(cmd, staticContext); } finally { staticContext.dispose(); } } });
/** * Create a local handler * * @param parent * the parent context * @param activeLeaf * the active leaf * @param name * the name of the context * @return a new context */ public static IEclipseContext createLocalHandlerContext(@NonNull IEclipseContext parent, @NonNull IEclipseContext activeLeaf, @NonNull String name) { IEclipseContext rv = EclipseContextFactory.create(name); // IEclipseContext rv = parent.createChild(name); rv.set("efx_handler_context", activeLeaf); //$NON-NLS-1$ return rv; }