Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2004-02-27 11:13:29 +0000
committerDani Megert2004-02-27 11:13:29 +0000
commit877994f5334244de5ae18abec6191412960b9b6d (patch)
tree149e7d631901041784050cc006c5304a19385a2b /org.eclipse.jface.text
parentdf211002ea8bd242ae1a2afe3b1f15bfc8e42077 (diff)
downloadeclipse.platform.text-877994f5334244de5ae18abec6191412960b9b6d.tar.gz
eclipse.platform.text-877994f5334244de5ae18abec6191412960b9b6d.tar.xz
eclipse.platform.text-877994f5334244de5ae18abec6191412960b9b6d.zip
Remember content assist size
Diffstat (limited to 'org.eclipse.jface.text')
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java16
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java10
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java16
3 files changed, 39 insertions, 3 deletions
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
index 30b190bc7ae..640191fa2a8 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/DefaultInformationControl.java
@@ -39,7 +39,7 @@ import org.eclipse.swt.widgets.Shell;
*
* @since 2.0
*/
-public class DefaultInformationControl implements IInformationControl, IInformationControlExtension, DisposeListener {
+public class DefaultInformationControl implements IInformationControl, IInformationControlExtension, IInformationControlExtension3, DisposeListener {
/**
* An information presenter determines the style presentation
@@ -319,6 +319,20 @@ public class DefaultInformationControl implements IInformationControl, IInformat
public Point computeSizeHint() {
return fShell.computeSize(SWT.DEFAULT, SWT.DEFAULT);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ public Rectangle computeTrim() {
+ return fShell.computeTrim(0, 0, 0, 0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Rectangle getBounds() {
+ return fShell.getBounds();
+ }
/*
* @see IInformationControl#addDisposeListener(DisposeListener)
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java
index 4297f727203..ae1a076f2ff 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/IInformationControlExtension3.java
@@ -38,4 +38,14 @@ public interface IInformationControlExtension3 {
* @return the receiver's bounding rectangle
*/
Rectangle getBounds();
+
+ /**
+ * Computes the trim for this control.
+ * x and y denote the upper left corner of the trimming relative
+ * to this control's location i.e. this will most likely be
+ * negative values. Width and height represent the border sizes.
+ *
+ * @return the receivers trim
+ */
+ Rectangle computeTrim();
}
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java
index 30d1ae18795..d7f01186add 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/contentassist/AdditionalInfoController.java
@@ -24,6 +24,7 @@ import org.eclipse.jface.text.AbstractInformationControlManager;
import org.eclipse.jface.text.Assert;
import org.eclipse.jface.text.IInformationControl;
import org.eclipse.jface.text.IInformationControlCreator;
+import org.eclipse.jface.text.IInformationControlExtension3;
@@ -62,7 +63,7 @@ class AdditionalInfoController extends AbstractInformationControlManager impleme
private boolean fIsReset= false;
/** Object to synchronize display thread and table selection changes */
private Object fMutex= new Object();
- /** Object to synchronize initial display of additonal info */
+ /** Object to synchronize initial display of additional info */
private Object fStartSignal;
/** The table selection listener */
private SelectionListener fSelectionListener= new TableSelectionListener();
@@ -214,7 +215,7 @@ class AdditionalInfoController extends AbstractInformationControlManager impleme
setCustomInformationControlCreator(null);
// compute subject area
- setMargins(4, -1);
+ setMargins(4, -2);
Rectangle area= fProposalTable.getBounds();
area.x= 0; // subject area is the whole subject control
area.y= 0;
@@ -230,6 +231,17 @@ class AdditionalInfoController extends AbstractInformationControlManager impleme
protected Point computeSizeConstraints(Control subjectControl, IInformationControl informationControl) {
Point sizeConstraint= super.computeSizeConstraints(subjectControl, informationControl);
Point size= subjectControl.getSize();
+
+ Rectangle otherTrim= subjectControl.getShell().computeTrim(0, 0, 0, 0);
+ size.x += otherTrim.width;
+ size.y += otherTrim.height;
+
+ if (informationControl instanceof IInformationControlExtension3) {
+ Rectangle thisTrim= ((IInformationControlExtension3)informationControl).computeTrim();
+ size.x -= thisTrim.width;
+ size.y -= thisTrim.height;
+ }
+
if (sizeConstraint.x < size.x)
sizeConstraint.x= size.x;
if (sizeConstraint.y < size.y)

Back to the top