Package org.eclipse.e4.core.services.contributions

Examples of org.eclipse.e4.core.services.contributions.IContributionFactory


  }

  @Override
  public ServerResource create(Class<? extends ServerResource> clazz, Request request, Response response)
  {
    IEclipseContext childContext = serviceContext.createChild("ResourceContext");
    diLock.lock(); // The lock is required because ContextInjectionFactory.make() is not thread safe

    try
    {
      InjectedResource serverResource = (InjectedResource) ContextInjectionFactory.make(clazz, childContext);
View Full Code Here


      IEventBroker eventBroker,
      ThemeManager themeManager) {
    if( factoryUrl == null ) {
      factoryUrl = defaultFactoryUrl;
    }
    IContributionFactory contribFactory = context.get(IContributionFactory.class);
    this.factory = (RendererFactory) contribFactory.create(factoryUrl, context);
    this.modelService = modelService;
   
    ifcontext.get(EBindingService.class.getName()) != null ) {
      KeyBindingDispatcher dispatcher = ContextInjectionFactory.make(KeyBindingDispatcher.class, context);
      context.set(KeyBindingDispatcher.class, dispatcher);
View Full Code Here

    if (!appContext.containsKey("org.eclipse.e4.ui.workbench.modeling.EModelService")) {
      throw new IllegalStateException("Core services not available. Please make sure that a declarative service implementation (such as the bundle 'org.eclipse.equinox.ds') is available!");
    }

    // Get the factory to create DI instances with
    IContributionFactory factory = (IContributionFactory) appContext.get(IContributionFactory.class.getName());

    // Install the life-cycle manager for this session if there's one
    // defined
    String lifeCycleURI = getArgValue(E4Workbench.LIFE_CYCLE_URI_ARG, applicationContext, false);
    if (lifeCycleURI != null) {
      lcManager = factory.create(lifeCycleURI, appContext);
      if (lcManager != null) {
        // Let the manager manipulate the appContext if desired
        Boolean rv = (Boolean) ContextInjectionFactory.invoke(lcManager, PostContextCreate.class, appContext, Boolean.TRUE);
        if( rv != null && ! rv.booleanValue() ) {
          return null;
        }
      }
    }
    // Create the app model and its context
    MApplication appModel = loadApplicationModel(applicationContext, appContext);
    appModel.setContext(appContext);

    // Set the app's context after adding itself
    appContext.set(MApplication.class.getName(), appModel);

    // let the life cycle manager add to the model
    if (lcManager != null) {
      ContextInjectionFactory.invoke(lcManager, ProcessAdditions.class, appContext, null);
      ContextInjectionFactory.invoke(lcManager, ProcessRemovals.class, appContext, null);
    }

    // Create the addons
    IEclipseContext addonStaticContext = EclipseContextFactory.create();
    for (MAddon addon : appModel.getAddons()) {
      addonStaticContext.set(MAddon.class, addon);
      Object obj = factory.create(addon.getContributionURI(), appContext, addonStaticContext);
      addon.setObject(obj);
    }

    // Parse out parameters from both the command line and/or the product
    // definition (if any) and put them in the context
View Full Code Here

    if (resourceHandler == null) {
      resourceHandler = "bundleclass://org.eclipse.e4.ui.workbench/" + ResourceHandler.class.getName();
    }

    IContributionFactory factory = eclipseContext.get(IContributionFactory.class);

    handler = (IModelResourceHandler) factory.create(resourceHandler, eclipseContext);

    Resource resource = handler.loadMostRecentModel();
    theApp = (MApplication) resource.getContents().get(0);

    return theApp;
View Full Code Here

      if( contribution.getContributionURI() == null ) {
        logger.error("No contribution uri defined");
        return null;
      }
     
      IContributionFactory cf = (IContributionFactory) context.get(IContributionFactory.class.getName());
      rv = cf.create(contribution.getContributionURI(), context);
      contribution.setObject(rv);
    }
    return rv;
  }
View Full Code Here

    do {
      element.getContext().set(cl.getName(), widget.getWidget());
      cl = cl.getSuperclass();
    } while( ! cl.getName().equals("java.lang.Object") );
   
    IContributionFactory contributionFactory = (IContributionFactory) element.getContext().get(IContributionFactory.class
        .getName());
    Object newPart = contributionFactory.create(element.getContributionURI(), element.getContext());
    element.setObject(newPart);
   
  }
View Full Code Here

  @Execute
  public void onExecute() {
    eventBroker.subscribe(IThemeEngine.Events.THEME_CHANGED,
        new EventHandler() {
          public void handleEvent(Event event) {
            ITheme currentTheme = (ITheme) event
                .getProperty(IThemeEngine.Events.THEME);
            // if (!prefDarker.getBoolean(
            // THEME_DARKER_PREF_THEMEENABLED, false))
            if (currentTheme.getId().equals(THEME_DARKER_ID)) {
              setupPreferences();
              isLastThemeDarker = true;
              DarkerWeavingHook.enableWeaving();
              hookDarkerCore();
            } else if (isLastThemeDarker) {
View Full Code Here

    try {
      URL url = SettingsDialog.class.getResource(name);
      Map<String, Object> options = new HashMap<String, Object>();
      options.put(IXWTLoader.CLASS_PROPERTY, this);
      options.put(IXWTLoader.CONTAINER_PROPERTY, this);
      XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
      XWT.loadWithOptions(url, options);
    } catch (Throwable e) {
      throw new Error("Unable to load " + name, e);
    }
View Full Code Here

    try {
      URL url = AudioSettingsTab.class.getResource(name);
      Map<String, Object> options = new HashMap<String, Object>();
      options.put(IXWTLoader.CLASS_PROPERTY, this);
      options.put(IXWTLoader.CONTAINER_PROPERTY, this);
      XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
      XWT.loadWithOptions(url, options);
    } catch (Throwable e) {
      throw new Error("Unable to load " + name, e);
    }
View Full Code Here

    try {
      URL url = Application.class.getResource(name);
      Map<String, Object> options = new HashMap<String, Object>();
      options.put(IXWTLoader.CLASS_PROPERTY, this);
      options.put(IXWTLoader.CONTAINER_PROPERTY, this);
      XWT.setLoadingContext(new DefaultLoadingContext(this.getClass().getClassLoader()));
      XWT.loadWithOptions(url, options);
    } catch (Throwable e) {
      throw new Error("Unable to load " + name, e);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.e4.core.services.contributions.IContributionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.