@Override public Object getDefaultVariable() { final Object sel; if (defaultVariableConverter != null) { sel = defaultVariableConverter.compute(eclipseContext, null); } else { sel = eclipseContext.getActive(ORG_ECLIPSE_UI_SELECTION); } return sel == null ? Collections.EMPTY_LIST : sel; }
@Override public void postProcess(MUIElement element) { if (element instanceof MToolBar) { MToolBar toolbarModel = (MToolBar) element; if (toolbarModel.getTransientData().containsKey(POST_PROCESSING_FUNCTION)) { Object obj = toolbarModel.getTransientData().get(POST_PROCESSING_FUNCTION); if (obj instanceof IContextFunction) { IContextFunction func = (IContextFunction) obj; final IEclipseContext ctx = getContext(toolbarModel); toolbarModel.getTransientData().put(POST_PROCESSING_DISPOSE, func.compute(ctx, null)); } } } }
if( cl.getName().equals(r.getProperty(SERVICE_CONTEXT_KEY)) ) { Named qualifier = descriptor.getQualifier(Named.class); return context.getService(r).compute(cp.getContext(), qualifier == null ? cl.getName() : qualifier.value());
public Object get() { if (cachedValue != NotAValue) return cachedValue; if (this.computing) throw new RuntimeException("Cycle while computing value" + this.toString()); //$NON-NLS-1$ originatingContext.pushComputation(this); computing = true; try { cachedValue = function.compute(originatingContext, name); } finally { computing = false; originatingContext.popComputation(this); } return cachedValue; }
@Override public void postProcess(MUIElement element) { if (element instanceof MToolBar) { MToolBar toolbarModel = (MToolBar) element; if (toolbarModel.getTransientData().containsKey( POST_PROCESSING_FUNCTION)) { Object obj = toolbarModel.getTransientData().get( POST_PROCESSING_FUNCTION); if (obj instanceof IContextFunction) { IContextFunction func = (IContextFunction) obj; final IEclipseContext ctx = getContext(toolbarModel); toolbarModel.getTransientData().put( POST_PROCESSING_DISPOSE, func.compute(ctx, null)); } } } }
/** * @return */ private List<MMenuElement> mergeFactoryIntoModel() { Object obj = menuContribution.getTransientData().get(FACTORY); if (!(obj instanceof IContextFunction)) { return Collections.EMPTY_LIST; } IEclipseContext staticContext = getStaticContext(); staticContext.remove(List.class); factoryDispose = (Runnable) ((IContextFunction) obj) .compute(staticContext, null); return staticContext.get(List.class); }
/** * @return */ private List<MToolBarElement> mergeFactoryIntoModel() { Object obj = toolbarContribution.getTransientData().get(FACTORY); if (!(obj instanceof IContextFunction)) { return Collections.EMPTY_LIST; } IEclipseContext staticContext = getStaticContext(); staticContext.remove(List.class); factoryDispose = (Runnable) ((IContextFunction) obj).compute( staticContext, null); return staticContext.get(List.class); }
/** * @return */ private List<MMenuElement> mergeFactoryIntoModel() { Object obj = menuContribution.getTransientData().get(FACTORY); if (!(obj instanceof IContextFunction)) { return Collections.EMPTY_LIST; } IEclipseContext staticContext = getStaticContext(); staticContext.remove(List.class); factoryDispose = (Runnable) ((IContextFunction) obj).compute( staticContext, null); return staticContext.get(List.class); }
/** * @return */ private List<MToolBarElement> mergeFactoryIntoModel() { Object obj = toolbarContribution.getTransientData().get(FACTORY); if (!(obj instanceof IContextFunction)) { return Collections.EMPTY_LIST; } IEclipseContext staticContext = getStaticContext(); staticContext.remove(List.class); factoryDispose = (Runnable) ((IContextFunction) obj) .compute(staticContext, null); return staticContext.get(List.class); }
private void hookCheckListener() { if (model.getType() != ItemType.CHECK) { return; } Object obj = model.getTransientData().get(ItemType.CHECK.toString()); if (obj instanceof IContextFunction) { IEclipseContext context = getContext(model); IEclipseContext staticContext = getStaticContext(null); staticContext.set(MPart.class, context.get(MPart.class)); staticContext.set(WW_SUPPORT, context.get(WW_SUPPORT)); IContextFunction func = (IContextFunction) obj; obj = func.compute(staticContext, null); if (obj != null) { model.getTransientData().put(DISPOSABLE_CHECK, obj); } } }
private void hookCheckListener() { if (getModel().getType() != ItemType.CHECK) { return; } Object obj = getModel().getTransientData().get(ItemType.CHECK.toString()); if (obj instanceof IContextFunction) { IEclipseContext context = getContext(getModel()); IEclipseContext staticContext = getStaticContext(null); staticContext.set(MPart.class, context.get(MPart.class)); staticContext.set(WW_SUPPORT, context.get(WW_SUPPORT)); IContextFunction func = (IContextFunction) obj; obj = func.compute(staticContext, null); if (obj != null) { getModel().getTransientData().put(DISPOSABLE, obj); } } }
/** * @param parentManager * @param itemModel */ void processRenderedItem(MenuManager parentManager, MRenderedMenuItem itemModel) { IContributionItem ici = getContribution(itemModel); if (ici != null) { return; } Object obj = itemModel.getContributionItem(); if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(itemModel); ici = (IContributionItem) ((IContextFunction) obj).compute( lclContext, null); itemModel.setContributionItem(ici); } else if (obj instanceof IContributionItem) { ici = (IContributionItem) obj; } else { // TODO potentially log the state, we've got something we're not // happy with return; } ici.setVisible(itemModel.isVisible()); addToManager(parentManager, itemModel, ici); linkModelToContribution(itemModel, ici); }
/** * @param parentManager * @param itemModel */ void processRenderedItem(MenuManager parentManager, MMenuItem itemModel) { IContributionItem ici = getContribution(itemModel); if (ici != null) { return; } itemModel.setRenderer(this); Object obj = RenderedElementUtil.getContributionManager(itemModel); if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(itemModel); ici = (IContributionItem) ((IContextFunction) obj).compute(lclContext, null); RenderedElementUtil.setContributionManager(itemModel, ici); } else if (obj instanceof IContributionItem) { ici = (IContributionItem) obj; } else { // TODO potentially log the state, we've got something we're not // happy with return; } ici.setVisible(itemModel.isVisible()); addToManager(parentManager, itemModel, ici); linkModelToContribution(itemModel, ici); }
} else { toolbar.getTransientData().put(ToolBarManagerRenderer.POST_PROCESSING_DISPOSE, func.compute(partContext, null));
if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(mmenu); obj = ((IContextFunction) obj).compute(lclContext, null); ((MRenderedMenu) mmenu).setContributionManager(obj);
if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(mmenu); obj = ((IContextFunction) obj).compute(lclContext, null); ((MRenderedMenu) mmenu).setContributionManager(obj);
if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(mmenu); obj = ((IContextFunction) obj).compute(lclContext, null); ((MRenderedMenu) mmenu).setContributionManager(obj);
if (obj instanceof IContextFunction) { final IEclipseContext lclContext = getContext(mmenu); obj = ((IContextFunction) obj).compute(lclContext, null); RenderedElementUtil.setContributionManager(mmenu, obj);