Package org.eclipse.e4.core.contexts

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


    MPart part = getPart(e);
    if( ! part.isCloseable() ) {
      return false;
    }
   
    IEclipseContext partContext = part.getContext();
    IEclipseContext parentContext = getContextForParent(part);
    // a part may not have a context if it hasn't been rendered
    IEclipseContext context = partContext == null ? parentContext : partContext;
    // Allow closes to be 'canceled'
    EPartService partService = (EPartService) context
        .get(EPartService.class.getName());
    if (partService.savePart(part, true)) {
      partService.hidePart(part);
      return true;
    }
View Full Code Here


     
      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

    return uiModification.get(element) == Boolean.TRUE;
  }
 
  @Override
  public final W createWidget(final M element) {
    final IEclipseContext context = setupRenderingContext(element);
   
    W widget =  ContextInjectionFactory.make(getWidgetClass(element), context);
    widget.setPropertyChangeHandler(new WPropertyChangeHandler<W>() {

      @Override
View Full Code Here

  private void initDefaultEventListeners(IEventBroker broker) {
    registerEventListener(broker, UIEvents.ApplicationElement.TOPIC_PERSISTEDSTATE);
  }
 
  public final IEclipseContext setupRenderingContext(M element) {
    IEclipseContext context = (IEclipseContext) element.getTransientData().get(RENDERING_CONTEXT_KEY);
    if( context == null ) {
      context = _context.createChild("Element RenderingContext");
      element.getTransientData().put(RENDERING_CONTEXT_KEY, context);
      context.set(CONTEXT_DOM_ELEMENT, element);
      initRenderingContext(element, context);
     
      try {
        contextModification.put(element,Boolean.TRUE);
        EObject eo;
View Full Code Here

        try {
          contextModification.put(e,Boolean.TRUE);
         
          if( changedObj instanceof MUIElement ) {
            if( e.getRenderer() == BaseRenderer.this ) {
              IEclipseContext ctx = (IEclipseContext) e.getTransientData().get(RENDERING_CONTEXT_KEY);
              if( ctx != null ) {
                if( attributeName.equals(UIEvents.ApplicationElement.PERSISTEDSTATE) && newValue instanceof Entry  ) {
                  @SuppressWarnings("unchecked")
                  Entry<String,String> entry = (Entry<String, String>) newValue;
                  ctx.set(attributeName+"_"+entry.getKey(), entry.getValue());
                } else {
                  ctx.set(attributeName, newValue);
                  if( e instanceof MUILabel ) {
                    MUILabel l = (MUILabel) e;
                    if( event.getProperty(UIEvents.EventTags.ATTNAME).equals(UIEvents.UILabel.LABEL) ) {
                      ctx.set(ATTRIBUTE_localizedLabel, l.getLocalizedLabel())
                    } else if( event.getProperty(UIEvents.EventTags.ATTNAME).equals(UIEvents.UILabel.TOOLTIP) ) {
                      ctx.set(ATTRIBUTE_localizedTooltip, l.getLocalizedTooltip())
                    }                 
                  } 
                }
              }
            }
View Full Code Here

      if( element.getWidget() instanceof WWidget<?> ) {
        ((WWidget<?>)element.getWidget()).setWidgetState(WidgetState.DISPOSED);
      }
      unbindWidget(element, (W) element.getWidget());
     
      IEclipseContext ctx = (IEclipseContext) element.getTransientData().get(RENDERING_CONTEXT_KEY);
      ctx.dispose();
      element.getTransientData().remove(RENDERING_CONTEXT_KEY);
     
    }
  }
View Full Code Here

    }
    return getContextForParent(part);
  }

  protected void activate(MPart element, boolean requiresFocus) {
    IEclipseContext curContext = getModelContext(element);
    if (curContext != null) {
      EPartService ps = (EPartService) curContext.get(EPartService.class
          .getName());
      if (ps != null)
        ps.activate(element, requiresFocus);
    }
  }
View Full Code Here

 
  @Override
  protected void initWidget(final MMenuItem element, WMenuItem<N> widget) {
    super.initWidget(element, widget);
   
    final IEclipseContext modelContext = getModelContext(element);
    widget.setOnActionCallback(new Runnable() {
     
      @Override
      public void run() {
        executeAction(element,modelContext.getActiveLeaf());
      }
    });
  }
View Full Code Here

    sync.asyncExec(new Runnable() {
     
      @Override
      public void run() {
        try {
          IEclipseContext context = getModelContext(menuElement);
          if( context != null && (widget.getWidgetState() == WidgetState.CREATED || widget.getWidgetState() == WidgetState.IN_SETUP ) ) {
            widget.setHandled(canExecute(menuElement, context))
          }
        } catch(Throwable t) {
          //TODO Log it
View Full Code Here

    }
   
    widget.setContent(refWidget);
   
    if( ref instanceof MContext ) {
      IEclipseContext context = ((MContext) ref).getContext();
      IEclipseContext newParentContext = getModelContext(element);
      if (context.getParent() != newParentContext) {
        context.setParent(newParentContext);
      }
    }
  }
View Full Code Here

TOP

Related Classes of org.eclipse.e4.core.contexts.IEclipseContext

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.