Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDani Megert2007-11-23 08:52:12 +0000
committerDani Megert2007-11-23 08:52:12 +0000
commit1d2a30e183fb3afb0e773d9e62529affc6c191b1 (patch)
tree8104d17023e0a6be953d75ba5bbebf2e17b5a6b8 /org.eclipse.jface.text.tests/src/org
parent02b764e72a73297ae6985d266109327449e5e8ce (diff)
downloadeclipse.platform.text-1d2a30e183fb3afb0e773d9e62529affc6c191b1.tar.gz
eclipse.platform.text-1d2a30e183fb3afb0e773d9e62529affc6c191b1.tar.xz
eclipse.platform.text-1d2a30e183fb3afb0e773d9e62529affc6c191b1.zip
Fixed leak.
Diffstat (limited to 'org.eclipse.jface.text.tests/src/org')
-rw-r--r--org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java24
1 files changed, 13 insertions, 11 deletions
diff --git a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
index 398a859b75f..6e11d0a23ca 100644
--- a/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
+++ b/org.eclipse.jface.text.tests/src/org/eclipse/jface/text/tests/TextViewerUndoManagerTest.java
@@ -61,48 +61,47 @@ public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
//--- DocumentUndoManager only ---
public void internalTestTransferNonTextOp(final boolean isUndoable) throws Exception {
+ Object context= new Object();
+ DocumentUndoManager tempUndoManager= new DocumentUndoManager(new Document());
+ tempUndoManager.connect(context);
+
IUndoableOperation operation= new AbstractOperation("") {
-
public boolean canUndo() {
return isUndoable;
}
-
public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
return Status.OK_STATUS;
}
-
public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
return Status.OK_STATUS;
}
-
public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
return Status.OK_STATUS;
}
};
-
- DocumentUndoManager tempUndoManager= new DocumentUndoManager(new Document());
-
- tempUndoManager.connect(new Object());
operation.addContext(tempUndoManager.getUndoContext());
OperationHistoryFactory.getOperationHistory().add(operation);
assertEquals(isUndoable, tempUndoManager.undoable());
final DocumentUndoManager undoManager= new DocumentUndoManager(new Document());
+ Object newContext= new Object();
+ undoManager.connect(newContext);
undoManager.addDocumentUndoListener(new IDocumentUndoListener() {
-
public void documentUndoNotification(DocumentUndoEvent event) {
fail();
}
});
- undoManager.connect(new Object());
undoManager.transferUndoHistory(tempUndoManager);
+ tempUndoManager.disconnect(context);
assertEquals(isUndoable, undoManager.undoable());
undoManager.undo();
assertEquals(false, undoManager.undoable());
+
+ undoManager.disconnect(newContext);
}
public void testTransferNonUndoableNonTextOp() throws Exception {
@@ -116,7 +115,8 @@ public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
public void testCanUndo() throws Exception {
IDocument doc= new Document();
final DocumentUndoManager undoManager= new DocumentUndoManager(doc);
- undoManager.connect(new Object());
+ Object context= new Object();
+ undoManager.connect(context);
undoManager.addDocumentUndoListener(new IDocumentUndoListener() {
@@ -133,6 +133,8 @@ public class TextViewerUndoManagerTest extends AbstractUndoManagerTest {
assertEquals(true, undoManager.undoable());
undoManager.undo();
assertEquals(false, undoManager.undoable());
+
+ undoManager.disconnect(context);
}
}

Back to the top