Examples of IEclipseContext


Examples of org.eclipse.e4.core.contexts.IEclipseContext

        thePart.setIconURI(null);
        thePart.setIconURI(imageURI);
      }
      getPresentationEngine().removeGui(refElement);
    } else {
      IEclipseContext curContext = modelService.getContainingContext(element);
      MPlaceholder currentRef = refElement.getCurSharedRef();
      IEclipseContext newParentContext = modelService
          .getContainingContext(currentRef);
      List<MContext> allContexts = modelService.findElements(
          refElement, null, MContext.class, null);
      for (MContext ctxtElement : allContexts) {
        IEclipseContext theContext = ctxtElement.getContext();
        // this may be null if it hasn't been rendered yet
        if (theContext != null
            && theContext.getParent() == curContext) {
          // about to reparent the context, if we're the
          // active child of the current parent, deactivate
          // ourselves first
          if (curContext.getActiveChild() == theContext) {
            theContext.deactivate();
          }
          theContext.setParent(newParentContext);
        }
      }
    }
   
    super.destroyWidget(element);
View Full Code Here

Examples of org.eclipse.e4.core.contexts.IEclipseContext

      element.setSelectedElement(element.getChildren().get(0));
    }
  }

  private WStackItem<I, IC> createStackItem(WPerspectiveStack<N, I, IC> stack, final MPerspective e, AbstractRenderer<MPerspective, ?> renderer) {
    IEclipseContext context = renderer.setupRenderingContext(e);
    WStackItem<I, IC> item = ContextInjectionFactory.make(stack.getStackItemClass(), context);
    item.setDomElement(e);
    item.setInitCallback(new WCallback<WStackItem<I, IC>, IC>() {

      @SuppressWarnings("unchecked")
View Full Code Here

Examples of org.eclipse.e4.core.contexts.IEclipseContext

      element = ref;
    }

    if (element instanceof MContext) {
      IEclipseContext context = ((MContext) element).getContext();
      if (context != null) {
        IEclipseContext newParentContext = modelService.getContainingContext(element);
        if (context.getParent() != newParentContext) {
          context.setParent(newParentContext);
        }
      }
    }
View Full Code Here

Examples of org.eclipse.e4.core.contexts.IEclipseContext

      Object object = getContributionObject(context, contribution);
      if( object == null ) {
        return false;
      }
     
      IEclipseContext runContext = context.createChild("DI-ToolItem");
      try {
        ContributionsAnalyzer.populateModelInterfaces(item, runContext, item.getClass().getInterfaces());
        runContext.set(MItem.class.getName(), item);
        return Boolean.TRUE.equals(ContextInjectionFactory.invoke(object, CanExecute.class, context.getActiveLeaf(), runContext, Boolean.TRUE));
      } finally {
        runContext.dispose();
      }
    } else if( item instanceof MHandledItem ) {
      MHandledItem handledItem = (MHandledItem) item;
      EHandlerService service = (EHandlerService) context.get(EHandlerService.class.getName());
      if( service == null ) {
        return false;
      }
     
      ParameterizedCommand cmd = handledItem.getWbCommand();
      if (cmd == null) {
        cmd = generateParameterizedCommand(handledItem, context);
        handledItem.setWbCommand(cmd);
      }
      if (cmd == null) {
        return false;
      }
     
      final IEclipseContext runContext = context.createChild("HI-ToolItem");
      try {
        ContributionsAnalyzer.populateModelInterfaces(item,runContext, item.getClass().getInterfaces());
        return service.canExecute(cmd, runContext);
      } finally {
        runContext.dispose();       
      }
    }
   
    return false;
  }
View Full Code Here

Examples of org.eclipse.e4.core.contexts.IEclipseContext

      Object object = getContributionObject(context, contribution);
      if( object == null ) {
        return;
      }
     
      IEclipseContext runContext = context.createChild("DI-ToolItem");
      try {
        ContributionsAnalyzer.populateModelInterfaces(item, runContext, item.getClass().getInterfaces());
        runContext.set(MItem.class.getName(), item);
        ContextInjectionFactory.invoke(object,Execute.class, context.getActiveLeaf(), runContext);
      } finally {
        runContext.dispose()
      }
    } else if( item instanceof MHandledItem ) {
      MHandledItem handledItem = (MHandledItem) item;
      EHandlerService service = (EHandlerService) context.get(EHandlerService.class.getName());
      ParameterizedCommand cmd = handledItem.getWbCommand();
      if (cmd == null) {
        cmd = generateParameterizedCommand(handledItem, context);
        handledItem.setWbCommand(cmd);
      }
      if (cmd == null) {
        logger.error("Failed to execute: " + handledItem.getCommand());
        return;
      }
      final IEclipseContext runContext = context.createChild("HI-ToolItem");
      try {
        ContributionsAnalyzer.populateModelInterfaces(item,runContext, item.getClass().getInterfaces());
        service.executeHandler(cmd, runContext);
      } finally {
        runContext.dispose();       
      }
    }
  }
View Full Code Here

Examples of org.eclipse.e4.core.contexts.IEclipseContext

    if (me instanceof MBindings) {
      MContext contextModel = (MContext) me;
      MBindings container = (MBindings) me;
      List<MBindingContext> bindingContexts = container
          .getBindingContexts();
      IEclipseContext context = contextModel.getContext();
      if (context != null && !bindingContexts.isEmpty()) {
        EContextService cs = context.get(EContextService.class);
        for (MBindingContext element : bindingContexts) {
          cs.activateContext(element.getElementId());
        }
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.