Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorteicher2004-03-19 15:46:58 +0000
committerteicher2004-03-19 15:46:58 +0000
commit2aa0eb88dfd2fb3abe58df38cb0a3e7477127727 (patch)
tree6f1066a7b8ce7e654d72a90c3980296d293448e4 /org.eclipse.text
parentd9e424634740ba866e76afef2575e9eb096267e9 (diff)
downloadeclipse.platform.text-2aa0eb88dfd2fb3abe58df38cb0a3e7477127727.tar.gz
eclipse.platform.text-2aa0eb88dfd2fb3abe58df38cb0a3e7477127727.tar.xz
eclipse.platform.text-2aa0eb88dfd2fb3abe58df38cb0a3e7477127727.zip
bug 55326: Hot-edit boxes for local rename not cleaned up after typing outside the box
- when exiting linked mode, make sure that the positions are updated to a document change if there is one being executed. Otherwise, the AnnotationPainter gets the drawing offsets wrong
Diffstat (limited to 'org.eclipse.text')
-rw-r--r--org.eclipse.text/src/org/eclipse/jface/text/link/LinkedEnvironment.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedEnvironment.java b/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedEnvironment.java
index af4505b6745..f26f48de512 100644
--- a/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedEnvironment.java
+++ b/org.eclipse.text/src/org/eclipse/jface/text/link/LinkedEnvironment.java
@@ -141,6 +141,9 @@ public class LinkedEnvironment {
*/
private class DocumentListener implements IDocumentListener {
+ private DocumentEvent fLastEvent;
+ private boolean fExit= false;
+
/**
* Checks whether <code>event</code> occurs within any of the positions
* managed by this environment. If not, the linked mode is left.
@@ -151,6 +154,9 @@ public class LinkedEnvironment {
// don't react on changes executed by the parent environment
if (fParentEnvironment != null && fParentEnvironment.isChanging())
return;
+
+ fExit= false;
+ fLastEvent= event;
for (Iterator it= fGroups.iterator(); it.hasNext(); ) {
LinkedPositionGroup group= (LinkedPositionGroup) it.next();
@@ -161,11 +167,12 @@ public class LinkedEnvironment {
}
// the event describes a change that lies outside of any managed
- // position -> exit mode.
+ // position -> signal to exit
+ // don't exit here already, since we want to make sure that the positions
+ // are updated to the document event.
// TODO we might not always want to exit, e.g. we want to stay
// linked if code completion has inserted import statements
- LinkedEnvironment.this.exit(ILinkedListener.EXTERNAL_MODIFICATION);
-
+ fExit= true;
}
/**
@@ -178,6 +185,9 @@ public class LinkedEnvironment {
if (fParentEnvironment != null && fParentEnvironment.isChanging())
return;
+ if (event.equals(fLastEvent) && fExit)
+ LinkedEnvironment.this.exit(ILinkedListener.EXTERNAL_MODIFICATION);
+
for (Iterator it= fGroups.iterator(); it.hasNext(); ) {
LinkedPositionGroup group= (LinkedPositionGroup) it.next();

Back to the top