@Override protected List<Control> getBackgroundColorExclusions() { List<Control> list = super.getBackgroundColorExclusions(); list.add(fSashForm); return list; }
@Override protected Point getInitialSize() { Point initialSize = super.getInitialSize(); initialSize.x = Math.max(initialSize.x, MIN_WIDTH); initialSize.y = Math.max(initialSize.y, MIN_HEIGHT); return initialSize; }
@Override public int open() { IWorkbench workbench = PlatformUI.getWorkbench(); String commandId = getCommandId(); if (commandId != null) { IHandler fCloseHandler = new AbstractHandler() { @Override public Object execute(ExecutionEvent event) throws ExecutionException { persist(); close(); return null; } }; fHandlerService = workbench.getAdapter(IHandlerService.class); fActivation = fHandlerService.activateHandler(commandId, fCloseHandler); } String infoText = getInfoText(); if (infoText != null) { setInfoText(infoText); } return super.open(); }
/** * Returns the text to be shown in the popups's information area. * May return <code>null</code>. * <p> * By default, if this dialog has a persistence command associated with it, * the text displayed is of the form "Press {key-sequence} to {action}". The * action text is specified by the method <code>getActionText()</code>. * </p> * @return The text to be shown in the popup's information area or <code>null</code> */ protected String getInfoText() { if (getCommandId() != null && getActionText() != null) { IWorkbench workbench = PlatformUI.getWorkbench(); IBindingService bindingService = workbench.getAdapter(IBindingService.class); String formattedBinding = bindingService.getBestActiveBindingFormattedFor(getCommandId()); String infoText = null; if (formattedBinding != null) { infoText = MessageFormat.format(DebugUIViewsMessages.InspectPopupDialog_1, new Object[] { formattedBinding, getActionText() }); } return infoText; } return null; }
private void showPopup(StyledText textWidget) { DebugPopup displayPopup = new DisplayPopup(getShell(), textWidget); displayPopup.open(); }
/** * Returns the initial location to use for the shell based upon the * current selection in the viewer. Bottom is preferred to top, and * right is preferred to left, therefore if possible the popup will * be located below and to the right of the selection. * * @param initialSize * the initial size of the shell, as returned by * <code>getInitialSize</code>. * @return the initial location of the shell */ @Override protected Point getInitialLocation(Point initialSize) { if (fAnchor == null) { return super.getInitialLocation(initialSize); } Point point = fAnchor; Rectangle monitor = getShell().getMonitor().getClientArea(); if (monitor.width < point.x + initialSize.x) { point.x = Math.max(0, point.x - initialSize.x); } if (monitor.height < point.y + initialSize.y) { point.y = Math.max(0, point.y - initialSize.y); } return point; }
@Override public boolean close() { if (!wasPersisted()) { fExpression.dispose(); } fDetailPane.dispose(); fContext.dispose(); return super.close(); }
@Override protected void saveDialogBounds(Shell shell) { super.saveDialogBounds(shell); if (fSashForm != null && !fSashForm.isDisposed()){ int[] weights = fSashForm.getWeights(); if (weights.length == 2){ String weightString = weights[0] + ":" + weights[1]; //$NON-NLS-1$ IEclipsePreferences node = InstanceScope.INSTANCE.getNode(DebugUIPlugin.getUniqueIdentifier()); if(node != null) { node.put(PREF_INSPECT_POPUP_SASH_WEIGHTS, weightString); try { node.flush(); } catch (BackingStoreException e) { DebugUIPlugin.log(e); } } } } }
@Override protected void persist() { super.persist(); DebugPlugin.getDefault().getExpressionManager().addExpression(fExpression); fExpression = null; IWorkbenchPage page = DebugUIPlugin.getActiveWorkbenchWindow().getActivePage(); IViewPart part = page.findView(IDebugUIConstants.ID_EXPRESSION_VIEW); if (part == null) { try { page.showView(IDebugUIConstants.ID_EXPRESSION_VIEW); } catch (PartInitException e) { } } else { page.bringToTop(part); } }
protected void showPopup(StyledText textWidget) { DebugPopup displayPopup = new InspectPopupDialog(getShell(), getPopupAnchor(textWidget), ACTION_DEFININITION_ID, expression); displayPopup.open(); }