Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java')
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java239
1 files changed, 121 insertions, 118 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
index 93fac0a2c..d183c0ff5 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java
@@ -4,7 +4,7 @@
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
* IBM Corporation - clean-up
@@ -31,15 +31,15 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
/**
- * Tests to verify that the viewer property retrieves and processes the
- * model deltas generated by the test model.
+ * Tests to verify that the viewer property retrieves and processes the
+ * model deltas generated by the test model.
*/
abstract public class DeltaTests extends TestCase implements ITestModelUpdatesListenerConstants {
Display fDisplay;
Shell fShell;
ITreeModelViewer fViewer;
TestModelUpdatesListener fListener;
-
+
public DeltaTests(String name) {
super(name);
}
@@ -47,29 +47,31 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
/**
* @throws java.lang.Exception
*/
- protected void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
fDisplay = PlatformUI.getWorkbench().getDisplay();
fShell = new Shell(fDisplay);
fShell.setMaximized(true);
-
+
fShell.setLayout(new FillLayout());
fViewer = createViewer(fDisplay, fShell);
-
+
fListener = new TestModelUpdatesListener(fViewer, false, false);
fShell.open ();
}
abstract protected IInternalTreeModelViewer createViewer(Display display, Shell shell);
-
+
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
fListener.dispose();
fViewer.getPresentationContext().dispose();
-
+
// Close the shell and exit.
fShell.close();
while (!fShell.isDisposed()) {
@@ -79,22 +81,23 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
- protected void runTest() throws Throwable {
+ @Override
+ protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
-
+
public void testUpdateLabel() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -104,13 +107,13 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
// Update the model
TestElement element = model.getRootElement().getChildren()[0];
TreePath elementPath = new TreePath(new Object[] { element });
ModelDelta delta = model.appendElementLabel(elementPath, "-modified"); //$NON-NLS-1$
-
- fListener.reset(elementPath, element, -1, true, false);
+
+ fListener.reset(elementPath, element, -1, true, false);
model.postDelta(delta);
while (!fListener.isFinished(LABEL_COMPLETE | MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -122,12 +125,12 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
public void testRefreshStruct() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -137,7 +140,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
// Update the model
TestElement element = model.getRootElement().getChildren()[0];
TreePath elementPath = new TreePath(new Object[] { element });
@@ -147,8 +150,8 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
new TestElement(model, "1.3 - new", new TestElement[0]), //$NON-NLS-1$
};
ModelDelta delta = model.setElementChildren(elementPath, newChildren);
-
- fListener.reset(elementPath, element, -1, true, false);
+
+ fListener.reset(elementPath, element, -1, true, false);
model.postDelta(delta);
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
@@ -160,12 +163,12 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
public void testRefreshStruct2() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleMultiLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -202,10 +205,10 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}),
})
});
-
+
TestElement element = model.getRootElement();
fListener.reset(TreePath.EMPTY, element, -1, false, false);
-
+
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -217,20 +220,20 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
public void testRefreshCoalesceStruct() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
// Create a single level model and add a single child to each element.
TestModel model = TestModel.simpleSingleLevel();
- TestElement[] rootChildren = model.getRootElement().getChildren();
+ TestElement[] rootChildren = model.getRootElement().getChildren();
for (int i = 0; i < rootChildren.length; i++) {
model.setElementChildren(
- new TreePath(new Object[] { rootChildren[i]} ),
+ new TreePath(new Object[] { rootChildren[i]} ),
new TestElement[] { new TestElement(model, i + ".1", new TestElement[0]) }); //$NON-NLS-1$
}
-
+
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -240,7 +243,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
@@ -248,36 +251,36 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
Thread.sleep(0);
}
}
-
+
model.validateData(fViewer, TreePath.EMPTY);
assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
}
-
-
+
+
public void testInsert() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
-
+
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
// Update the model
TestElement element = new TestElement(model, "7", new TestElement[0]); //$NON-NLS-1$
TreePath elementPath = new TreePath(new Object[] { element });
ModelDelta delta = model.insertElementChild(TreePath.EMPTY, 6, element);
-
+
// Insert causes the update of element's data, label and children.
// TODO: update of element's data after insert seems redundant
// but it's probably not a big inefficiency
@@ -295,14 +298,14 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
model.validateData(fViewer, TreePath.EMPTY);
}
-
+
/**
* This test checks that insert and select delta flags are processed in correct order:
* insert then select.
*/
public void testInsertAndSelect() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
@@ -311,15 +314,15 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
-
+
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
- model.validateData(fViewer, TreePath.EMPTY);
-
+
+ model.validateData(fViewer, TreePath.EMPTY);
+
// Update the model
// Insert two new elements at once
TestElement element0 = new TestElement(model, "00", new TestElement[] {}); //$NON-NLS-1$
@@ -328,7 +331,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
TreePath elementPath1 = new TreePath(new Object[] { element1 });
ModelDelta rootDelta = model.insertElementChild(TreePath.EMPTY, 0, element0);
rootDelta = model.insertElementChild(rootDelta, TreePath.EMPTY, 1, element1);
-
+
// Set the select flag on the first added node.
ModelDelta delta0 = rootDelta.getChildDelta(element0);
delta0.setFlags(delta0.getFlags() | IModelDelta.SELECT);
@@ -338,7 +341,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.addHasChildrenUpdate(elementPath1);
fListener.addLabelUpdate(elementPath0);
fListener.addLabelUpdate(elementPath1);
-
+
// TODO: list full set of expected updates.
fListener.setFailOnRedundantUpdates(false);
@@ -348,34 +351,34 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
Thread.sleep(0);
}
}
-
+
model.validateData(fViewer, TreePath.EMPTY);
}
/**
* This test checks that insert and remove deltas are processed in correct order:
- * remove deltas are processed first then insert deltas.
+ * remove deltas are processed first then insert deltas.
*/
public void testInsertAndRemove() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
fViewer.setInput(model.getRootElement());
-
+
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
- model.validateData(fViewer, TreePath.EMPTY);
-
+
+ model.validateData(fViewer, TreePath.EMPTY);
+
// Update the model
// Remove one element then insert a new one
IModelDelta removeDelta = model.removeElementChild(TreePath.EMPTY, 3).getChildDeltas()[0];
-
+
// Insert new elements at once
TestElement element = new TestElement(model, "00", new TestElement[] {}); //$NON-NLS-1$
TreePath elementPath = new TreePath(new Object[] { element });
@@ -385,12 +388,12 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
ModelDelta combinedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE, 0, model.getRootElement().getChildren().length);
combinedDelta.addNode(insertDelta.getElement(), insertDelta.getIndex(), insertDelta.getFlags(), insertDelta.getChildCount());
combinedDelta.addNode(removeDelta.getElement(), removeDelta.getIndex(), removeDelta.getFlags(), removeDelta.getChildCount());
-
+
// Set the select flag on the first added node.
fListener.reset();
fListener.addHasChildrenUpdate(elementPath);
fListener.addLabelUpdate(elementPath);
-
+
// TODO: list full set of expected updates.
fListener.setFailOnRedundantUpdates(false);
@@ -400,19 +403,19 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
Thread.sleep(0);
}
}
-
+
model.validateData(fViewer, TreePath.EMPTY);
}
-
+
public void testAddElement() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -422,14 +425,14 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
// Update the model
TestElement element = new TestElement(model, "7", new TestElement[0]); //$NON-NLS-1$
TreePath elementPath = new TreePath(new Object[] { element });
ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, 6, element);
-
+
// Add causes the update of parent child count and element's children.
- fListener.reset(elementPath, element, -1, true, false);
+ fListener.reset(elementPath, element, -1, true, false);
fListener.addChildreUpdate(TreePath.EMPTY, 6);
// TODO: redundant updates on add!
fListener.setFailOnRedundantUpdates(false);
@@ -442,17 +445,17 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.validateData(fViewer, TreePath.EMPTY);
}
- // This test currently fails. When (if) bug 311442 gets address we should re-enable it.
+ // This test currently fails. When (if) bug 311442 gets address we should re-enable it.
public void _x_testAddUnexpandedElement() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleMultiLevel();
// Turn off auto-expansion
fViewer.setAutoExpandLevel(0);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -468,7 +471,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.addElementChild(parentPath, rootDelta, 1, new TestElement(model, "1.2", new TestElement[0])); //$NON-NLS-1$
model.addElementChild(parentPath, rootDelta, 2, new TestElement(model, "1.3", new TestElement[0])); //$NON-NLS-1$
model.addElementChild(parentPath, rootDelta, 3, new TestElement(model, "1.4", new TestElement[0])); //$NON-NLS-1$
-
+
// Add causes the update of parent child count and element's children.
fListener.reset();
fListener.setFailOnRedundantUpdates(false);
@@ -487,14 +490,14 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.getElementDelta(rootDelta, model.findElement("1.2"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("1.3"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("1.4"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
-
+
model.postDelta(rootDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
((IInternalTreeModelViewer)fViewer).expandToLevel(parentPath, 1);
@@ -509,14 +512,14 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
public void _x_testRefreshUnexpandedElementsChildren() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleMultiLevel();
// Turn off auto-expansion
fViewer.setAutoExpandLevel(0);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -539,7 +542,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Collapse back element "2"
((IInternalTreeModelViewer)fViewer).setExpandedState(parentPath, false);
-
+
// Update the children of element "2".
fListener.reset();
fListener.addUpdates((IInternalTreeModelViewer)fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
@@ -547,7 +550,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.getElementDelta(rootDelta, model.findElement("2.1"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("2.2"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
model.getElementDelta(rootDelta, model.findElement("2.3"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
-
+
model.postDelta(rootDelta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -568,15 +571,15 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
model.validateData(fViewer, parentPath, true);
}
-
+
public void testRemove() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -586,13 +589,13 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
// Update the model
ModelDelta delta = model.removeElementChild(TreePath.EMPTY, 5);
-
+
// Remove delta should generate no new updates, but we still need to wait for the event to
// be processed.
- fListener.reset();
+ fListener.reset();
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -601,10 +604,10 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
model.validateData(fViewer, TreePath.EMPTY);
}
-
+
public void testExpandAndSelect() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
-
+
// Create the listener
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
@@ -619,8 +622,8 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Create the delta
fListener.reset();
- // TODO Investigate: there seem to be unnecessary updates being issued
- // by the viewer. These include the updates that are commented out:
+ // TODO Investigate: there seem to be unnecessary updates being issued
+ // by the viewer. These include the updates that are commented out:
// For now disable checking for extra updates.
fListener.setFailOnRedundantUpdates(false);
TestElement element = model.getRootElement();
@@ -637,7 +640,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
TreePath path_root_3_3 = path_root_3.createChildPath(element.getChildren()[2]);
fListener.addHasChildrenUpdate(path_root_3_3);
fListener.addLabelUpdate(path_root_3_3);
- //TODO unnecessary update: fListener.addChildreUpdate(path1, 1);
+ //TODO unnecessary update: fListener.addChildreUpdate(path1, 1);
fListener.addChildreUpdate(path_root_3, 2);
element = element.getChildren()[1];
TreePath path_root_3_2 = path_root_3.createChildPath(element);
@@ -651,7 +654,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.addLabelUpdate(path_root_3_2_3);
// TODO unnecessary update: fListener.addChildreCountUpdate(path2);
fListener.addChildreUpdate(path_root_3_2, 0);
- // TODO unnecessary update: fListener.addChildreUpdate(path2, 1);
+ // TODO unnecessary update: fListener.addChildreUpdate(path2, 1);
fListener.addChildreUpdate(path_root_3_2, 2);
element = element.getChildren()[1];
TreePath path_root_3_2_2 = path_root_3_2.createChildPath(element);
@@ -660,12 +663,12 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.addHasChildrenUpdate(path_root_3_2_2);
// Validate the expansion state BEFORE posting the delta.
-
- IInternalTreeModelViewer contentProviderViewer = (IInternalTreeModelViewer)fViewer;
+
+ IInternalTreeModelViewer contentProviderViewer = (IInternalTreeModelViewer)fViewer;
assertFalse(contentProviderViewer.getExpandedState(path_root_3));
assertFalse(contentProviderViewer.getExpandedState(path_root_3_2));
assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
-
+
model.postDelta(deltaRoot);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -678,11 +681,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
assertTrue(contentProviderViewer.getExpandedState(path_root_3));
assertTrue(contentProviderViewer.getExpandedState(path_root_3_2));
assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
-
+
// Verify selection
ISelection selection = fViewer.getSelection();
if (selection instanceof ITreeSelection) {
- List selectionPathsList = Arrays.asList( ((ITreeSelection)selection).getPaths() );
+ List<TreePath> selectionPathsList = Arrays.asList(((ITreeSelection) selection).getPaths());
assertTrue(selectionPathsList.contains(path_root_3_2_2));
} else {
fail("Not a tree selection"); //$NON-NLS-1$
@@ -694,7 +697,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
*/
public void testExpandAndSelect_simple() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
-
+
// Create the listener
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
@@ -709,8 +712,8 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Create the delta
fListener.reset();
- // TODO Investigate: there seem to be unnecessary updates being issued
- // by the viewer. These include the updates that are commented out:
+ // TODO Investigate: there seem to be unnecessary updates being issued
+ // by the viewer. These include the updates that are commented out:
// For now disable checking for extra updates.
fListener.setFailOnRedundantUpdates(false);
TestElement element = model.getRootElement();
@@ -722,10 +725,10 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
delta.addNode(element, 2, IModelDelta.SELECT | IModelDelta.EXPAND, element.fChildren.length);
// Validate the expansion state BEFORE posting the delta.
-
- IInternalTreeModelViewer contentProviderViewer = (IInternalTreeModelViewer)fViewer;
+
+ IInternalTreeModelViewer contentProviderViewer = (IInternalTreeModelViewer)fViewer;
assertFalse(contentProviderViewer.getExpandedState(path_root_3));
-
+
model.postDelta(deltaRoot);
while (true) {
if (fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
@@ -741,11 +744,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Validate the expansion state AFTER posting the delta.
assertTrue(contentProviderViewer.getExpandedState(path_root_3));
-
+
// Verify selection
ISelection selection = fViewer.getSelection();
if (selection instanceof ITreeSelection) {
- List selectionPathsList = Arrays.asList( ((ITreeSelection)selection).getPaths() );
+ List<TreePath> selectionPathsList = Arrays.asList(((ITreeSelection) selection).getPaths());
assertTrue(selectionPathsList.contains(path_root_3));
} else {
fail("Not a tree selection"); //$NON-NLS-1$
@@ -754,12 +757,12 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
public void testCompositeModelRefreshStruct() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.compositeMultiLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- // TODO: redundant updates on install deltas
+ // TODO: redundant updates on install deltas
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
@@ -782,8 +785,8 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
};
ModelDelta delta = m4.setElementChildren(m4_2_1Path, newChildren);
-
- fListener.reset(m4_2_1Path, m4_2_1, -1, true, false);
+
+ fListener.reset(m4_2_1Path, m4_2_1, -1, true, false);
model.postDelta(delta);
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
@@ -798,7 +801,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fViewer.setAutoExpandLevel(-1);
// Create the listener
- // TODO: redundant updates on install deltas
+ // TODO: redundant updates on install deltas
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
@@ -809,32 +812,32 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
model.validateData(fViewer, TreePath.EMPTY, true);
-
+
TreePath m3_1Path = model.findElement("m3.1"); //$NON-NLS-1$
TestElement m3_1 = model.getElement(m3_1Path);
TestModel m3 = m3_1.getModel();
TestElement m3_1_new = new TestElement(m3, "m3.1-new", new TestElement[0]); //$NON-NLS-1$
TreePath m3_1_newPath = m3_1Path.createChildPath(m3_1_new);
ModelDelta delta = m3.addElementChild(m3_1Path, null, 0, m3_1_new);
-
- fListener.reset(m3_1_newPath, m3_1_new, -1, true, false);
+
+ fListener.reset(m3_1_newPath, m3_1_new, -1, true, false);
fListener.addChildreUpdate(m3_1Path, 0);
fListener.setFailOnRedundantUpdates(false);
-
+
m3.postDelta(delta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
model.validateData(fViewer, TreePath.EMPTY);
}
-
+
public void testBug292322() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
- fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -844,13 +847,13 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
}
}
model.validateData(fViewer, TreePath.EMPTY, true);
-
+
// Update the model: remove one child of an un-expanded element, then
// make sure that the number of children is correct.
TreePath parentPath = model.findElement("2"); //$NON-NLS-1$
TestElement parentElement = model.getElement(parentPath);
ModelDelta delta = model.removeElementChild(parentPath, 0);
-
+
// Update the viewer
fListener.reset(parentPath, parentElement, 0, false, false);
//fListener.addChildreCountUpdate(parentPath);
@@ -864,10 +867,10 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Validate the viewer data.
model.validateData(fViewer, TreePath.EMPTY, true);
- // Update the model: remove the remaining children and make sure that
+ // Update the model: remove the remaining children and make sure that
// the element children are updated to false.
model.removeElementChild(parentPath, 0);
-
+
// Update the viewer
fListener.reset(parentPath, parentElement, 0, false, false);
model.postDelta(delta);
@@ -880,10 +883,10 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Validate the viewer data.
model.validateData(fViewer, TreePath.EMPTY, true);
- // Update the model: remove the remaining children and make sure that
+ // Update the model: remove the remaining children and make sure that
// the element children are updated to false.
model.removeElementChild(parentPath, 0);
-
+
// Update the viewer
fListener.reset(parentPath, parentElement, 0, false, false);
model.postDelta(delta);

Back to the top