private SideValue getLocation() { MElementContainer<?> parent = trimControl.getParent(); while (parent != null) { if (parent instanceof MTrimBar) { return ((MTrimBar) parent).getSide(); } parent = parent.getParent(); } return SideValue.BOTTOM; }
/** * the side the receiver is placed on */ private SideValue getLocation() { if (toolControl == null) { // if we don't have a ToolControl, assume bottom return SideValue.BOTTOM; } MElementContainer<?> parent = toolControl.getParent(); while (parent != null) { if (parent instanceof MTrimBar) { return ((MTrimBar) parent).getSide(); } parent = parent.getParent(); } return SideValue.BOTTOM; }
/** * Remove all traces of any launch bars found in the model. Required on startup as the * {@linkplain IntroLaunchBar} instances may not be have been rendered yet and so are * disconnected from the {@link IntroPlugin}'s state. * * @param workbench * the workbench to process */ public static void destroyAll(IWorkbench workbench) { EModelService modelService = workbench.getService(EModelService.class); MApplication application = workbench.getService(MApplication.class); List<MToolControl> candidates = modelService.findElements(application, MToolControl.class, EModelService.IN_TRIM, toolControl -> LAUNCHBAR_ID.equals(toolControl.getElementId()) && BUNDLECLASS_URI.equals(((MToolControl) toolControl).getContributionURI())); for (MToolControl trimControl : candidates) { if (trimControl.getParent() != null) { trimControl.getParent().getChildren().remove(trimControl); } } }
quickAccessElementId, model); if (quickAccessElement != null) { moveControl(quickAccessElement.getParent(), quickAccessElement);
private int getFixedSides() { MUIElement tcParent = toolControl.getParent(); if (!(tcParent instanceof MTrimBar)) { return 0; } MTrimBar bar = (MTrimBar) tcParent; Composite trimComp = (Composite) bar.getWidget(); Rectangle trimBounds = trimComp.getBounds(); Point trimCenter = new Point(trimBounds.width / 2, trimBounds.height / 2); // adjusted to // (0,0) Control trimCtrl = (Control) toolControl.getWidget(); Rectangle ctrlBounds = trimCtrl.getBounds(); Point ctrlCenter = new Point(ctrlBounds.x + (ctrlBounds.width / 2), ctrlBounds.y + (ctrlBounds.height / 2)); if (bar.getSide() == SideValue.LEFT) { int verticalValue = ctrlCenter.y < trimCenter.y ? SWT.TOP : SWT.BOTTOM; return SWT.LEFT | verticalValue; } else if (bar.getSide() == SideValue.RIGHT) { int verticalValue = ctrlCenter.y < trimCenter.y ? SWT.TOP : SWT.BOTTOM; return SWT.RIGHT | verticalValue; } else if (bar.getSide() == SideValue.TOP) { int horizontalValue = ctrlCenter.x < trimCenter.x ? SWT.LEFT : SWT.RIGHT; return SWT.TOP | horizontalValue; } else if (bar.getSide() == SideValue.BOTTOM) { int horizontalValue = ctrlCenter.x < trimCenter.x ? SWT.LEFT : SWT.RIGHT; return SWT.BOTTOM | horizontalValue; } return SWT.BOTTOM | SWT.RIGHT; }
toolControl.getParent().getChildren().remove(toolControl);
private void createTrim(MUIElement element, MPerspective perspective) { if (!(window instanceof MTrimmedWindow)) { return; } String trimStr = perspective.getPersistedState().get("trims"); //$NON-NLS-1$ MTrimmedWindow win = (MTrimmedWindow) window; // Is there already a TrimControl there ? String trimId = element.getElementId() + getMinimizedElementSuffix(perspective); MToolControl trimStack = (MToolControl) modelService.find(trimId, window); if (trimStack == null) { trimStack = MenuFactoryImpl.eINSTANCE.createToolControl(); trimStack.setElementId(trimId); trimStack.setContributionURI(TrimStack.CONTRIBUTION_URI); trimStack.getTags().add("TrimStack"); //$NON-NLS-1$ // Check if we have a cached location MTrimBar bar = getBarForElement(element, win, trimStr); int index = getIndex(element, trimStr); if (index == -1 || index >= bar.getChildren().size()) bar.getChildren().add(trimStack); else bar.getChildren().add(index, trimStack); bar.setVisible(true); } else { // get the parent trim bar, see bug 320756 MUIElement parent = trimStack.getParent(); parent.setVisible(true); trimStack.setToBeRendered(true); } }
protected IIntroPart closeLaunchBar(boolean restore) { IntroPlugin.getDefault().setLaunchBar(null); // if we've already been removed, this won't hurt us if (trimControl.getParent() != null) { trimControl.getParent().getChildren().remove(trimControl); } IIntroPart intro = null; if (restore) { IWorkbenchWindow window = getWorkbenchWindow(); intro = PlatformUI.getWorkbench().getIntroManager().showIntro(window, false); CustomizableIntroPart cpart = (CustomizableIntroPart) intro; Rectangle startBounds = Geometry.toDisplay(getControl().getParent(), getControl().getBounds()); Rectangle endBounds = Geometry.toDisplay(cpart.getControl().getParent(), cpart.getControl() .getBounds()); AnimationEngine.createTweakedAnimation(window.getShell(), 400, startBounds, endBounds); } dispose(); return intro; }
MToolControl toolControl = (MToolControl) element; if (((Object) toolControl.getParent()) instanceof MToolBar) { IRendererFactory factory = context.get(IRendererFactory.class); AbstractPartRenderer renderer = factory.getRenderer( toolControl.getParent(), parent); if (renderer instanceof ToolBarManagerRenderer) { return null;
MToolControl toolControl = (MToolControl) element; if (((Object) toolControl.getParent()) instanceof MToolBar) { IRendererFactory factory = context.get(IRendererFactory.class); AbstractPartRenderer renderer = factory.getRenderer( toolControl.getParent(), parent); if (renderer instanceof ToolBarManagerRenderer) { return null;
MUIElement parent = trimStack.getParent(); parent.setVisible(true); if (parent.getWidget() == null) {
MUIElement parent = trimStack.getParent(); parent.setVisible(true); if (parent.getWidget() == null) {
MUIElement meParent = me.getParent(); int orientation = SWT.HORIZONTAL; if (meParent instanceof MTrimBar) {
@PostConstruct void createWidget(Composite parent, MToolControl toolControl) { perspSwitcherToolControl = toolControl; MUIElement meParent = perspSwitcherToolControl.getParent(); int orientation = SWT.HORIZONTAL; if (meParent instanceof MTrimBar) { perspSwitcherToolbar = new ToolBar(comp, SWT.FLAT | SWT.WRAP | SWT.RIGHT + orientation); comp.addPaintListener(e -> paint(e)); toolParent = ((Control) toolControl.getParent().getWidget());
MUIElement parent = toolControl.getParent(); while (!(parent instanceof MTrimBar) && parent != null) { parent = parent.getParent();
MUIElement meParent = me.getParent(); int orientation = SWT.HORIZONTAL; if (meParent instanceof MTrimBar) {