/** * Return a parent context for this part. * * @param element * the part to start searching from * @return the parent's closest context, or global context if none in the * hierarchy */ protected IEclipseContext getContextForParent(MUIElement element) { return modelService.getContainingContext(element); }
/** * Return a parent context for this part. * * @param element * the part to start searching from * @return the parent's closest context, or global context if none in the * hierarchy */ protected IEclipseContext getContextForParent(MUIElement element) { return modelService.getContainingContext(element); }
/** * Return a parent context for this part. * * @param element * the part to start searching from * @return the parent's closest context, or global context if none in the * hierarchy */ protected IEclipseContext getContextForParent(MUIElement element) { return modelService.getContainingContext(element); }
private IEclipseContext getContextForParent(MUIElement element) { return this.modelService.getContainingContext(element); }
private IEclipseContext getContext(MUIElement parent) { if (parent instanceof MContext) { return ((MContext) parent).getContext(); } return this.modelService.getContainingContext(parent); }
/** * Get the context for the parent using * {@link EModelService#getContainingContext(MUIElement)} * * @param element * the element * @return the context */ @Nullable protected IEclipseContext getContextForParent(@NonNull MUIElement element) { return this.modelService.getContainingContext(element); }
private void showMenu(final Menu menu, final MMenu menuModel, MenuManager menuManager) { final IEclipseContext evalContext; if (menuModel instanceof MContext) { evalContext = ((MContext) menuModel).getContext(); } else { evalContext = modelService.getContainingContext(menuModel); } MenuManagerRendererFilter.updateElementVisibility(menuModel, renderer, menuManager, evalContext, 2, true); }
private void showMenu(final Menu menu, final MMenu menuModel, MenuManager menuManager) { final IEclipseContext evalContext; if (menuModel instanceof MContext) { evalContext = ((MContext) menuModel).getContext(); } else { evalContext = modelService.getContainingContext(menuModel); } MenuManagerRendererFilter.updateElementVisibility(menuModel, renderer, menuManager, evalContext, 2, true); }
public void run() { MMenuElement[] ml = menuModel.getChildren().toArray( new MMenuElement[menuModel.getChildren().size()]); for (int i = 0; i < ml.length; i++) { MMenuElement currentMenuElement = ml[i]; if (currentMenuElement instanceof MDynamicMenuContribution) { Object contribution = ((MDynamicMenuContribution) currentMenuElement) .getObject(); IEclipseContext dynamicMenuContext = EclipseContextFactory .create(); @SuppressWarnings("unchecked") ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) currentMenuElement .getTransientData() .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); dynamicMenuContext.set(List.class, mel); IEclipseContext parentContext = modelService .getContainingContext(currentMenuElement); ContextInjectionFactory.invoke(contribution, AboutToHide.class, parentContext, dynamicMenuContext, null); } } } });
IEclipseContext parentContext = modelService.getContainingContext(currentMenuElement); ContextInjectionFactory.invoke(contribution, AboutToHide.class, parentContext, dynamicMenuContext, null);
IEclipseContext context = modelService.getContainingContext(part); if( context != null ) { EPartService partService = context.get(EPartService.class);
@Override protected Control createControl(Composite parent) { IEclipseContext localContext = EclipseContextFactory.create(); final Composite newComposite = new Composite(parent, SWT.NONE); newComposite.setLayout(new FillLayout()); localContext.set(Composite.class.getName(), newComposite); localContext.set(MToolControl.class.getName(), model); final IEclipseContext parentContext = modelService .getContainingContext(model); if (model.getObject() == null) { final Object tcImpl = contribFactory.create( model.getContributionURI(), parentContext, localContext); model.setObject(tcImpl); newComposite.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { ContextInjectionFactory.uninject(tcImpl, parentContext); model.setObject(null); } }); } model.setWidget(newComposite); newComposite.setData(AbstractPartRenderer.OWNING_ME, model); newComposite.setData(this); return newComposite; }
@Override protected Control createControl(Composite parent) { IEclipseContext localContext = EclipseContextFactory.create(); final Composite newComposite = new Composite(parent, SWT.NONE); newComposite.setLayout(new FillLayout()); localContext.set(Composite.class, newComposite); localContext.set(MToolControl.class, model); final IEclipseContext parentContext = modelService.getContainingContext(model); if (model.getObject() == null) { final Object tcImpl = contribFactory.create(model.getContributionURI(), parentContext, localContext); model.setObject(tcImpl); newComposite.addDisposeListener(e -> { ContextInjectionFactory.uninject(tcImpl, parentContext); model.setObject(null); }); } model.setWidget(newComposite); newComposite.setData(AbstractPartRenderer.OWNING_ME, model); newComposite.setData(this); return newComposite; }
IEclipseContext context = modelService.getContainingContext(toolControl); IEclipseContext child = context.createChild(ProgressRegion.class.getName()); child.set(MToolControl.class, toolControl);
Void handleMinMaxCallback( WMinMaxState state, @NonNull MUIElement changedElement ) { IEclipseContext context; if( changedElement instanceof MContext ) { context = ((MContext)changedElement).getContext(); } else { context = this.modelService.getContainingContext(changedElement); } // Looks like the part has already been unrendered // what should we do when that happens? if( context == null ) { return null; } MaximizationService maximizationService = context.get(MaximizationService.class); if( state == WMinMaxState.TOGGLE ) { if( maximizationService.isMaximized(changedElement) ) { maximizationService.restore(); } else { maximizationService.maximize(changedElement); } } else if( state == WMinMaxState.MAXIMIZE ) { if( ! maximizationService.isMaximized(changedElement) ) { maximizationService.maximize(changedElement); } } else { if( maximizationService.isMaximized(changedElement) ) { maximizationService.restore(); } } return null; }
/** * @param parent * @param toolControl */ private void createStatusLine(Composite parent, MToolControl toolControl) { IEclipseContext context = modelService.getContainingContext(toolControl); WorkbenchWindow wbw = (WorkbenchWindow) context.get(IWorkbenchWindow.class); // wbw may be null if workspace is started with no open perspectives. if (wbw == null) { // Create one assuming there's no defined perspective Workbench wb = (Workbench) PlatformUI.getWorkbench(); wb.createWorkbenchWindow(wb.getDefaultPageInput(), null, modelService.getTopLevelWindowFor(toolControl), false); wbw = (WorkbenchWindow) context.get(IWorkbenchWindow.class); } if (wbw != null) { Workbench wb = (Workbench) PlatformUI.getWorkbench(); wb.createWorkbenchWindow(wb.getDefaultPageInput(), null, modelService.getTopLevelWindowFor(toolControl), false); wbw = (WorkbenchWindow) context.get(IWorkbenchWindow.class); manager = wbw.getStatusLineManager(); manager.createControl(parent); } } }
IEclipseContext context = ((MContext) tmp).getContext(); if (context != null) { IEclipseContext newParentContext = this.modelService.getContainingContext(tmp); if (newParentContext != null && context.getParent() != newParentContext) { Util.setParentContext(context, newParentContext);
public void reactivatePart(MUIElement dragElement) { IEclipseContext context = dndManager.getModelService().getContainingContext(dragElement); if (context == null) { return;
.getContainingContext(element)); newItem.setControl(dragCtrl);
evalContext = ((MContext) mMenu).getContext(); } else { evalContext = modelService.getContainingContext(mMenu);