Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarin Wright2006-01-30 19:26:09 +0000
committerDarin Wright2006-01-30 19:26:09 +0000
commit0730b007578620f94ede7da71d979aedc1fc8aae (patch)
tree9c304707d29615e109b04a4d531f14247da1374a
parent4062c3da5085c862fd841192e5ad416ecc7b6ed6 (diff)
downloadeclipse.platform.debug-0730b007578620f94ede7da71d979aedc1fc8aae.tar.gz
eclipse.platform.debug-0730b007578620f94ede7da71d979aedc1fc8aae.tar.xz
eclipse.platform.debug-0730b007578620f94ede7da71d979aedc1fc8aae.zip
Bug 124040 - debug/inspect popups require ITextViewer
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java31
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java9
2 files changed, 12 insertions, 28 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
index 830399af1..6690199aa 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/DebugPopup.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,9 +18,6 @@ import org.eclipse.core.commands.IHandler;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.PopupDialog;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
@@ -49,7 +46,7 @@ import org.eclipse.ui.handlers.IHandlerService;
*/
public abstract class DebugPopup extends PopupDialog {
- private ITextViewer fViewer;
+ private Point fAnchor;
private IHandlerActivation fActivation;
@@ -58,11 +55,11 @@ public abstract class DebugPopup extends PopupDialog {
/**
* Constructs a new popup dialog of type <code>PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE</code>
* @param parent The parent shell
- * @param viewer The text viewer on which the popup is to be installed
+ * @param anchor point at which to anchor the popup dialog in Display coordinate space
*/
- public DebugPopup(Shell parent, ITextViewer viewer) {
+ public DebugPopup(Shell parent, Point anchor) {
super(parent, PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE, true, true, false, true, null, null);
- fViewer = viewer;
+ fAnchor = anchor;
}
/**
@@ -112,26 +109,14 @@ public abstract class DebugPopup extends PopupDialog {
* @return the initial location of the shell
*/
protected Point getInitialLocation(Point initialSize) {
- StyledText textWidget = fViewer.getTextWidget();
- Point docRange = textWidget.getSelectionRange();
- int midOffset = docRange.x + (docRange.y / 2);
- Point point = textWidget.getLocationAtOffset(midOffset);
- point = textWidget.toDisplay(point);
-
- GC gc = new GC(textWidget);
- gc.setFont(textWidget.getFont());
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
- point.y += height;
-
- Rectangle monitor = textWidget.getMonitor().getClientArea();
+ 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 - height);
+ point.y = Math.max(0, point.y - initialSize.y);
}
-
return point;
}
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
index 2966bc018..5b59add3b 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/InspectPopupDialog.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
+ * Copyright (c) 2005, 2006 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -33,7 +33,6 @@ import org.eclipse.debug.internal.ui.views.variables.IndexedVariablePartition;
import org.eclipse.debug.internal.ui.views.variables.VariablesView;
import org.eclipse.debug.internal.ui.views.variables.VariablesViewer;
import org.eclipse.jface.bindings.TriggerSequence;
-import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
@@ -96,13 +95,13 @@ public class InspectPopupDialog extends DebugPopup {
* Creates a new inspect popup.
*
* @param shell The parent shell
- * @param viewer The viewer on which the popup will be installed
+ * @param anchor point at which to anchor the popup in Display coordinates
* @param commandId The command id to be used for persistance of
* the dialog (possibly <code>null</code>)
* @param expression The expression being inspected
*/
- public InspectPopupDialog(Shell shell, ITextViewer viewer, String commandId, IExpression expression) {
- super(shell, viewer);
+ public InspectPopupDialog(Shell shell, Point anchor, String commandId, IExpression expression) {
+ super(shell, anchor);
fCommandId = commandId;
fExpression = expression;
}

Back to the top