/** * @return 'true' iff the minimized stack should overlay the current presentation, 'false' means * to temporarily restore the stack into the current presentation. */ private boolean useOverlays() { if (toolControl == null) { return true; } String useOverlays = toolControl.getPersistedState().get(USE_OVERLAYS_KEY); if (useOverlays == null) { useOverlays = "true"; //$NON-NLS-1$ } return Boolean.parseBoolean(useOverlays); }
@Override public void mouseUp(MouseEvent e) { composite.setCapture(false); // Persist the current size Point size = composite.getSize(); toolControl.getPersistedState() .put(TrimStack.STATE_XSIZE, Integer.toString(size.x)); toolControl.getPersistedState() .put(TrimStack.STATE_YSIZE, Integer.toString(size.y)); trackState = NOT_SIZING; }
public void mouseUp(MouseEvent e) { composite.setCapture(false); // Persist the current size Point size = composite.getSize(); toolControl.getPersistedState() .put(TrimStack.STATE_XSIZE, Integer.toString(size.x)); toolControl.getPersistedState() .put(TrimStack.STATE_YSIZE, Integer.toString(size.y)); trackState = NOT_SIZING; }
private void setHostSize() { if (hostPane == null || hostPane.isDisposed()) return; int xSize = 600; String xSizeStr = toolControl.getPersistedState().get(STATE_XSIZE); if (xSizeStr != null) xSize = Integer.parseInt(xSizeStr); int ySize = 400; String ySizeStr = toolControl.getPersistedState().get(STATE_YSIZE); if (ySizeStr != null) ySize = Integer.parseInt(ySizeStr); hostPane.setSize(xSize, ySize); }
private void setHostSize() { if (hostPane == null || hostPane.isDisposed()) { return; } int xSize = 600; String xSizeStr = toolControl.getPersistedState().get(STATE_XSIZE); if (xSizeStr != null) { xSize = Integer.parseInt(xSizeStr); } int ySize = 400; String ySizeStr = toolControl.getPersistedState().get(STATE_YSIZE); if (ySizeStr != null) { ySize = Integer.parseInt(ySizeStr); } hostPane.setSize(xSize, ySize); }
@PostConstruct void init(Composite parent, MToolControl trimControl) { simple = true; this.trimControl = trimControl; this.lastPageId = trimControl.getPersistedState().get(LAST_PAGE_ID); // Handle situation where intro information is not available from the // the application's IEclipseContext if (element == null || theme == null) { String configId = trimControl.getPersistedState().get(INTRO_CONFIG_ID); IntroModelRoot modelRoot = IntroPlugin.getDefault().getExtensionPointManager().getModel(configId); element = modelRoot.getPresentation().getLaunchBarElement(); theme = modelRoot.getTheme(); } createControl(parent); storeLocation(); // since we may have been dragged elsewhere }
/** * Creates a restore menu item that removes the minimized tag from the {@link #minimizedElement} */ private void createUseOverlaysMenu() { MenuItem useOverlaysItem = new MenuItem(trimStackMenu, SWT.CHECK); useOverlaysItem.setText(Messages.TrimStack_Show_In_Original_Location); useOverlaysItem.setSelection(!useOverlays()); useOverlaysItem.addListener(SWT.Selection, event -> { if (toolControl != null) { toolControl.getPersistedState().put(USE_OVERLAYS_KEY, Boolean.toString(!useOverlays())); } }); }
/** * Install the Intro Launch Bar into the provided window. * * @param window * the window to host the launch bar * @param modelRoot * the current intro configuration, with pages * @param element * the launch bar configuration * @return the launch bar instance */ public static IntroLaunchBar create(IWorkbenchWindow window, IntroModelRoot modelRoot, IntroLaunchBarElement element) { EModelService modelService = window.getService(EModelService.class); MTrimmedWindow trimmedWindow = window.getService(MTrimmedWindow.class); MToolControl trimControl = modelService.createModelElement(MToolControl.class); trimControl.setElementId(LAUNCHBAR_ID); trimControl.setContributionURI(BUNDLECLASS_URI); // Must record sufficient information so as to be able to obtain the // launch configuration on workspace restart trimControl.getPersistedState().put(INTRO_CONFIG_ID, modelRoot.getId()); trimControl.getPersistedState().put(LAST_PAGE_ID, modelRoot.getCurrentPageId()); trimControl.getTags().add(IPresentationEngine.DRAGGABLE); MTrimBar bar = modelService.getTrim(trimmedWindow, determineLocation(element)); bar.getChildren().add(trimControl); // should now be rendered return (IntroLaunchBar) trimControl.getObject(); }