Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rennie2013-07-31 16:44:16 +0000
committerMike Rennie2013-07-31 16:44:16 +0000
commitd975f27f12707ae6598994c5e3c6bd5e271d46c4 (patch)
treec7d1b2b1a202e19c0c2ccaaff959f4dd25286f0d /org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer
parent4fcde1ffaf34791bd406d47ce72d17e2801432a3 (diff)
downloadeclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.gz
eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.tar.xz
eclipse.platform.debug-d975f27f12707ae6598994c5e3c6bd5e271d46c4.zip
Bug 352626 - Move platform debug to Java 1.6 BREE
Diffstat (limited to 'org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer')
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java9
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java99
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java20
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java164
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java239
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTests.java18
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java1
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java6
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerFilterTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java6
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPopupTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java12
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java9
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java12
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java76
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java87
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java305
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java255
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java404
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java37
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreePathWrapper.java9
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java254
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerFilterTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java6
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java6
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPopupTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java3
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VisibleVirtualItemValidator.java6
38 files changed, 1161 insertions, 924 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java
index 9cc09fec0..8ac3e964d 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java
@@ -45,7 +45,8 @@ abstract public class CheckTests extends TestCase {
/**
* @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);
@@ -63,7 +64,8 @@ abstract public class CheckTests extends TestCase {
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
fListener.dispose();
fViewer.getPresentationContext().dispose();
@@ -76,7 +78,8 @@ abstract public class CheckTests extends TestCase {
}
}
- protected void runTest() throws Throwable {
+ @Override
+ protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java
index 9c85204e0..db5a43710 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java
@@ -45,129 +45,184 @@ public class ChildrenUpdateTests extends TestCase {
/* (non-Javadoc)
* @see org.eclipse.debug.internal.ui.viewers.model.ModelContentProvider#getViewer()
*/
+ @Override
protected IInternalTreeModelViewer getViewer() {
return new IInternalTreeModelViewer(){
+ @Override
public void setSelection(ISelection selection) {}
+ @Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {}
+ @Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {}
+ @Override
public void updateViewer(IModelDelta delta) {}
+ @Override
public void setSelection(ISelection selection, boolean reveal, boolean force) {}
+ @Override
public void clearSelectionQuiet() {}
+ @Override
public boolean trySelection(ISelection selection, boolean reveal, boolean force) { return true; }
+ @Override
public void setInput(Object object) {}
+ @Override
public void setAutoExpandLevel(int level) {}
+ @Override
public boolean saveElementState(TreePath path, ModelDelta delta, int flags) { return true; }
+ @Override
public void removeStateUpdateListener(IStateUpdateListener listener) {}
+ @Override
public void removeViewerUpdateListener(IViewerUpdateListener listener) {}
+ @Override
public void removeModelChangedListener(IModelChangedListener listener) {}
+ @Override
public void removeLabelUpdateListener(ILabelUpdateListener listener) {}
- public void addViewerUpdateListener(IViewerUpdateListener listener) {}
- public void addStateUpdateListener(IStateUpdateListener listener) {}
- public void addModelChangedListener(IModelChangedListener listener) {}
- public void addLabelUpdateListener(ILabelUpdateListener listener) {}
- public void update(Object element) {}
- public void setHasChildren(Object elementOrTreePath, boolean hasChildren) {}
- public void setExpandedState(Object elementOrTreePath, boolean expanded) {}
- public void setChildCount(Object elementOrTreePath, int count) {}
- public void reveal(TreePath path, int index) {}
- public void replace(Object parentOrTreePath, int index, Object element) {}
- public void remove(Object parentOrTreePath, int index) {}
- public void remove(Object elementOrTreePath) {}
- public void refresh() {}
- public void refresh(Object element) {}
+ @Override
+ public void addViewerUpdateListener(IViewerUpdateListener listener) {}
+ @Override
+ public void addStateUpdateListener(IStateUpdateListener listener) {}
+ @Override
+ public void addModelChangedListener(IModelChangedListener listener) {}
+ @Override
+ public void addLabelUpdateListener(ILabelUpdateListener listener) {}
+ @Override
+ public void update(Object element) {}
+ @Override
+ public void setHasChildren(Object elementOrTreePath, boolean hasChildren) {}
+ @Override
+ public void setExpandedState(Object elementOrTreePath, boolean expanded) {}
+ @Override
+ public void setChildCount(Object elementOrTreePath, int count) {}
+ @Override
+ public void reveal(TreePath path, int index) {}
+ @Override
+ public void replace(Object parentOrTreePath, int index, Object element) {}
+ @Override
+ public void remove(Object parentOrTreePath, int index) {}
+ @Override
+ public void remove(Object elementOrTreePath) {}
+ @Override
+ public void refresh() {}
+ @Override
+ public void refresh(Object element) {}
+ @Override
public ISelection getSelection() {
return null;
}
+ @Override
public IPresentationContext getPresentationContext() {
return null;
}
+ @Override
public Object getInput() {
return null;
}
+ @Override
public ViewerLabel getElementLabel(TreePath path, String columnId) {
return null;
}
+ @Override
public Display getDisplay() {
return DebugUIPlugin.getStandardDisplay();
}
+ @Override
public int getAutoExpandLevel() {
return 0;
}
+ @Override
public boolean overrideSelection(ISelection current, ISelection candidate) {
return false;
}
+ @Override
public void insert(Object parentOrTreePath, Object element, int position) {
}
+ @Override
public TreePath getTopElementPath() {
return null;
}
+ @Override
public ViewerFilter[] getFilters() {
return null;
}
+ @Override
public void addFilter(ViewerFilter filter) {}
+ @Override
public void setFilters(ViewerFilter[] filters) {}
+ @Override
public boolean getExpandedState(Object elementOrTreePath) {
return false;
}
+ @Override
public Object getChildElement(TreePath path, int index) {
return null;
}
- public boolean getHasChildren(Object elementOrTreePath) {
+ @Override
+ public boolean getHasChildren(Object elementOrTreePath) {
return false;
}
+ @Override
public int getChildCount(TreePath path) {
return 0;
}
+ @Override
public int findElementIndex(TreePath parentPath, Object element) {
return 0;
}
+ @Override
public void expandToLevel(Object elementOrTreePath, int level) {
}
+ @Override
public void autoExpand(TreePath elementPath) {
}
- public boolean getElementChildrenRealized(TreePath parentPath) {
+ @Override
+ public boolean getElementChildrenRealized(TreePath parentPath) {
return false;
}
- public boolean getElementChecked(TreePath path) {
+ @Override
+ public boolean getElementChecked(TreePath path) {
return false;
}
- public boolean getElementGrayed(TreePath path) {
+ @Override
+ public boolean getElementGrayed(TreePath path) {
return false;
}
- public void setElementChecked(TreePath path, boolean checked, boolean grayed) {
+ @Override
+ public void setElementChecked(TreePath path, boolean checked, boolean grayed) {
}
- public TreePath[] getElementPaths(Object element) {
+ @Override
+ public TreePath[] getElementPaths(Object element) {
return null;
}
- public void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images,
+ @Override
+ public void setElementData(TreePath path, int numColumns, String[] labels, ImageDescriptor[] images,
FontData[] fontDatas, RGB[] foregrounds, RGB[] backgrounds) {
}
- public String[] getVisibleColumns() {
+ @Override
+ public String[] getVisibleColumns() {
return null;
}
};
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java
index b8f406e75..62f7593e1 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java
@@ -52,6 +52,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
/**
* @throws java.lang.Exception
*/
+ @Override
protected void setUp() throws Exception {
createViewer();
}
@@ -59,6 +60,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
/**
* @throws java.lang.Exception
*/
+ @Override
protected void tearDown() throws Exception {
destroyViewer();
}
@@ -70,11 +72,13 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
fShell.setLayout(new FillLayout());
fViewer = new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
fViewer.getTree().addControlListener(new ControlListener() {
- public void controlResized(ControlEvent e) {
+ @Override
+ public void controlResized(ControlEvent e) {
fResized = true;
}
- public void controlMoved(ControlEvent e) {
+ @Override
+ public void controlMoved(ControlEvent e) {
}
});
fListener = new TestModelUpdatesListener(fViewer, false, false);
@@ -118,14 +122,17 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
this.columnIds = columnIds;
}
+ @Override
public void init(IPresentationContext context) {
fContext = context;
}
+ @Override
public void dispose() {
fContext = null;
}
+ @Override
public ImageDescriptor getImageDescriptor(String id) {
return null;
}
@@ -134,14 +141,17 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
return fContext;
}
+ @Override
public String[] getAvailableColumns() {
return columnIds;
}
+ @Override
public String[] getInitialColumns() {
return columnIds;
}
+ @Override
public String getHeader(String id) {
if (Arrays.asList(columnIds).indexOf(id) != -1) {
return id;
@@ -149,10 +159,12 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
return null;
}
+ @Override
public String getId() {
return "MyColumnPresentationID"; //$NON-NLS-1$
}
+ @Override
public boolean isOptional() {
return true;
}
@@ -171,6 +183,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
Arrays.fill(repliedWidths, -2);
}
+ @Override
public int getInitialColumnWidth(String id, int treeWidgetWidth,
String[] visibleColumnIds) {
for (int i = 0; i < columnIds.length; i++) {
@@ -194,6 +207,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
return -1;
}
+ @Override
public String getId() {
return "MyColumnPresentation2ID"; //$NON-NLS-1$
}
@@ -206,6 +220,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
colPresenation = cp1;
}
+ @Override
public IColumnPresentation createColumnPresentation(
IPresentationContext context, Object element) {
if (colPresenation != null) {
@@ -214,6 +229,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
return null;
}
+ @Override
public String getColumnPresentationId(IPresentationContext context,
Object element) {
if (colPresenation != null) {
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java
index d2dff371a..387879a47 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.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
@@ -25,6 +25,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IChildrenUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ITreeModelViewer;
+import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ModelDelta;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.layout.FillLayout;
@@ -33,18 +34,18 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
/**
- * Tests that verify that the viewer property retrieves all the content
+ * Tests that verify that the viewer property retrieves all the content
* from the model.
- *
+ *
* @since 3.6
*/
abstract public class ContentTests extends TestCase implements ITestModelUpdatesListenerConstants {
-
+
Display fDisplay;
Shell fShell;
ITreeModelViewer fViewer;
TestModelUpdatesListener fListener;
-
+
public ContentTests(String name) {
super(name);
}
@@ -52,28 +53,30 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
/**
* @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, true, true);
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()) {
@@ -83,50 +86,51 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
}
}
- 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 testSimpleSingleLevel() throws InterruptedException {
// Create the model with test data
TestModel model = TestModel.simpleSingleLevel();
// Make sure that all elements are expanded
fViewer.setAutoExpandLevel(-1);
-
+
// Create the agent which forces the tree to populate
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
// Create the listener which determines when the view is finished updating.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
-
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
+
// Set the viewer input (and trigger updates).
fViewer.setInput(model.getRootElement());
-
+
// Wait for the updates to complete.
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
model.validateData(fViewer, TreePath.EMPTY);
-
+
assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
}
public void testSimpleMultiLevel() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleMultiLevel();
fViewer.setAutoExpandLevel(-1);
-
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
-
+
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
+
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished()) {
@@ -136,22 +140,23 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 3) );
}
-
+
/**
- * Modified test model that optionally captures (i.e. doesn't compete)
- * udpates after filling in their data.
+ * Modified test model that optionally captures (i.e. doesn't compete)
+ * udpates after filling in their data.
*/
class TestModelWithCapturedUpdates extends TestModel {
-
+
boolean fCaptureLabelUpdates = false;
boolean fCaptureChildrenUpdates = false;
-
- List fCapturedUpdates = Collections.synchronizedList(new ArrayList());
-
- public void update(IChildrenUpdate[] updates) {
+
+ List<IViewerUpdate> fCapturedUpdates = Collections.synchronizedList(new ArrayList<IViewerUpdate>());
+
+ @Override
+ public void update(IChildrenUpdate[] updates) {
for (int i = 0; i < updates.length; i++) {
TestElement element = (TestElement)updates[i].getElement();
int endOffset = updates[i].getOffset() + updates[i].getLength();
@@ -167,13 +172,14 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
}
}
}
-
- public void update(ILabelUpdate[] updates) {
+
+ @Override
+ public void update(ILabelUpdate[] updates) {
for (int i = 0; i < updates.length; i++) {
TestElement element = (TestElement)updates[i].getElement();
updates[i].setLabel(element.getLabel(), 0);
- if (updates[i] instanceof ICheckUpdate &&
- Boolean.TRUE.equals(updates[i].getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
+ if (updates[i] instanceof ICheckUpdate &&
+ Boolean.TRUE.equals(updates[i].getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
{
((ICheckUpdate)updates[i]).setChecked(element.getChecked(), element.getGrayed());
}
@@ -182,19 +188,19 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
} else {
updates[i].done();
}
- }
- }
+ }
+ }
}
-
+
/**
- * Test to make sure that label provider cancels stale updates and doesn't
+ * Test to make sure that label provider cancels stale updates and doesn't
* use data from stale updates to populate the viewer.<br>
* See bug 210027
*/
public void testLabelUpdatesCompletedOutOfSequence1() throws InterruptedException {
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureLabelUpdates = true;
-
+
model.setRoot(new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2", new TestElement[0]), //$NON-NLS-1$
@@ -208,28 +214,28 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
Thread.sleep(0);
}
}
- List firstUpdates = model.fCapturedUpdates;
- model.fCapturedUpdates = new ArrayList(2);
-
-// // Change the model and run another update set.
+ List<IViewerUpdate> firstUpdates = model.fCapturedUpdates;
+ model.fCapturedUpdates = new ArrayList<IViewerUpdate>(2);
+
+// // Change the model and run another update set.
model.getElement(model.findElement("1")).setLabelAppendix(" - changed"); //$NON-NLS-1$ //$NON-NLS-2$
model.getElement(model.findElement("2")).setLabelAppendix(" - changed"); //$NON-NLS-1$ //$NON-NLS-2$
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
// Complete the second set of children updates
for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
((ILabelUpdate)model.fCapturedUpdates.get(i)).done();
}
-
+
// Then complete the first set.
for (int i = 0; i < firstUpdates.size(); i++) {
- ILabelUpdate capturedUpdate = (ILabelUpdate)firstUpdates.get(i);
+ ILabelUpdate capturedUpdate = (ILabelUpdate)firstUpdates.get(i);
assertTrue(capturedUpdate.isCanceled());
capturedUpdate.done();
}
@@ -239,23 +245,23 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
Thread.sleep(0);
}
}
-
+
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
}
/**
- * Test to make sure that label provider cancels stale updates and doesn't
+ * Test to make sure that label provider cancels stale updates and doesn't
* use data from stale updates to populate the viewer.<br>
- * This version of the test changes the elements in the view, and not just
- * the elements' labels. In this case, the view should still cancel stale
- * updates.<br>
+ * This version of the test changes the elements in the view, and not just
+ * the elements' labels. In this case, the view should still cancel stale
+ * updates.<br>
* See bug 210027
*/
public void testLabelUpdatesCompletedOutOfSequence2() throws InterruptedException {
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureLabelUpdates = true;
-
+
model.setRoot(new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2", new TestElement[0]), //$NON-NLS-1$
@@ -269,30 +275,30 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
Thread.sleep(0);
}
}
- List firstUpdates = model.fCapturedUpdates;
- model.fCapturedUpdates = new ArrayList(2);
-
- // Change the model and run another update set.
+ List<IViewerUpdate> firstUpdates = model.fCapturedUpdates;
+ model.fCapturedUpdates = new ArrayList<IViewerUpdate>(2);
+
+ // Change the model and run another update set.
model.setElementChildren(TreePath.EMPTY, new TestElement[] {
new TestElement(model, "1-new", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2-new", new TestElement[0]), //$NON-NLS-1$
});
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
// Complete the second set of children updates
for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
((ILabelUpdate)model.fCapturedUpdates.get(i)).done();
}
-
+
// Then complete the first set.
for (int i = 0; i < firstUpdates.size(); i++) {
- ILabelUpdate capturedUpdate = (ILabelUpdate)firstUpdates.get(i);
+ ILabelUpdate capturedUpdate = (ILabelUpdate)firstUpdates.get(i);
assertTrue(capturedUpdate.isCanceled());
capturedUpdate.done();
}
@@ -302,24 +308,24 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
Thread.sleep(0);
}
}
-
+
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
}
/**
- * Test to make sure that content provider cancels stale updates and doesn't
+ * Test to make sure that content provider cancels stale updates and doesn't
* use data from stale updates to populate the viewer.<br>
- * Note: this test is disabled because currently the viewer will not issue
+ * Note: this test is disabled because currently the viewer will not issue
* a new update for an until the previous update is completed. This is even
- * if the previous update is canceled. If this behavior is changed at some
+ * if the previous update is canceled. If this behavior is changed at some
* point, then this test should be re-enabled.<br>
* See bug 210027
*/
public void _x_testChildrenUpdatesCompletedOutOfSequence() throws InterruptedException {
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureChildrenUpdates = true;
-
+
model.setRoot(new TestElement(model, "root", new TestElement[] { //$NON-NLS-1$
new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2", new TestElement[0]), //$NON-NLS-1$
@@ -333,27 +339,27 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
Thread.sleep(0);
}
}
- IChildrenUpdate[] firstUpdates = (IChildrenUpdate[])model.fCapturedUpdates.toArray(new IChildrenUpdate[0]);
+ IChildrenUpdate[] firstUpdates = model.fCapturedUpdates.toArray(new IChildrenUpdate[0]);
model.fCapturedUpdates.clear();
-
- // Change the model and run another update set.
+
+ // Change the model and run another update set.
model.setElementChildren(TreePath.EMPTY, new TestElement[] {
new TestElement(model, "1-new", new TestElement[0]), //$NON-NLS-1$
new TestElement(model, "2-new", new TestElement[0]), //$NON-NLS-1$
});
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!areCapturedChildrenUpdatesComplete(model.fCapturedUpdates, model.getRootElement().fChildren.length)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
// Complete the second set of children updates
for (int i = 0; i < model.fCapturedUpdates.size(); i++) {
((IChildrenUpdate)model.fCapturedUpdates.get(i)).done();
}
-
+
// Then complete the first set.
for (int i = 0; i < firstUpdates.length; i++) {
firstUpdates[i].done();
@@ -364,17 +370,17 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
Thread.sleep(0);
}
}
-
+
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
}
-
- private boolean areCapturedChildrenUpdatesComplete(List capturedUpdates, int childCount) {
- List expectedChildren = new ArrayList();
+
+ private boolean areCapturedChildrenUpdatesComplete(List<IViewerUpdate> capturedUpdates, int childCount) {
+ List<Integer> expectedChildren = new ArrayList<Integer>();
for (int i = 0; i < childCount; i++) {
expectedChildren.add(new Integer(i));
}
- IChildrenUpdate[] updates = (IChildrenUpdate[])capturedUpdates.toArray(new IChildrenUpdate[0]);
+ IChildrenUpdate[] updates = capturedUpdates.toArray(new IChildrenUpdate[0]);
for (int i = 0; i < updates.length; i++) {
for (int j = 0; j < updates[i].getLength(); j++) {
expectedChildren.remove( new Integer(updates[i].getOffset() + j) );
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);
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTests.java
index 52308e2d1..9cd850cd2 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTests.java
@@ -52,7 +52,8 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
/**
* @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);
@@ -70,7 +71,8 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
fListener.dispose();
fViewer.getPresentationContext().dispose();
@@ -83,7 +85,8 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
}
}
- protected void runTest() throws Throwable {
+ @Override
+ protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
@@ -104,7 +107,8 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
}
- public boolean select(Viewer viewer, Object parentElement, Object element) {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof TestElement) {
TestElement te = (TestElement)element;
return !fPattern.matcher(te.getLabel()).find();
@@ -122,7 +126,8 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
fParentElement = parentElement;
}
- public boolean isApplicable(ITreeModelViewer viewer, Object parentElement) {
+ @Override
+ public boolean isApplicable(ITreeModelViewer viewer, Object parentElement) {
if (fParentElement != null) {
return fParentElement.equals(parentElement);
}
@@ -130,7 +135,8 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
return true;
}
- public boolean select(Viewer viewer, Object parentElement, Object element) {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof TestElement) {
TestElement te = (TestElement)element;
return !fPattern.matcher(te.getLabel()).find();
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java
index afe51e13c..07f1151c3 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java
@@ -45,6 +45,7 @@ public class FilterTransformTests extends TestCase {
* and elements 0, 2, 3, 6, 7 are filtered. Elements
* 1, 4, 5 are visible.
*/
+ @Override
protected void setUp() throws Exception {
super.setUp();
transform = new FilterTransform();
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java
index b2f3db69a..79472fb34 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java
@@ -27,7 +27,8 @@ public class JFaceViewerCheckTests extends CheckTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.CHECK, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java
index 68e860470..fcd8dfe66 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java
@@ -27,7 +27,8 @@ public class JFaceViewerContentTests extends ContentTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java
index 8853315a0..d606f6097 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java
@@ -27,13 +27,15 @@ public class JFaceViewerDeltaTests extends DeltaTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
/**
* TODO: remove this method when bug 292322 gets fixed in TreeViewer
*/
- public void testBug292322() {
+ @Override
+ public void testBug292322() {
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerFilterTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerFilterTests.java
index 654d97b9f..ac9a7c598 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerFilterTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerFilterTests.java
@@ -27,7 +27,8 @@ public class JFaceViewerFilterTests extends FilterTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java
index b511a32d3..9347e274e 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java
@@ -26,7 +26,8 @@ public class JFaceViewerLazyTests extends LazyTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java
index e046751c9..180f88398 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java
@@ -26,11 +26,13 @@ public class JFaceViewerPerformanceTests extends PerformanceTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
- protected int getTestModelDepth() {
+ @Override
+ protected int getTestModelDepth() {
return 5;
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPopupTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPopupTests.java
index 8c4b923a6..df2732a0c 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPopupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPopupTests.java
@@ -27,7 +27,8 @@ public class JFaceViewerPopupTests extends PopupTests {
super(name);
}
- protected ITreeModelViewer createViewer(Display display, Shell shell, int style) {
+ @Override
+ protected ITreeModelViewer createViewer(Display display, Shell shell, int style) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | style, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java
index 94009bb2c..dd63dcc6a 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java
@@ -27,7 +27,8 @@ public class JFaceViewerSelectionTests extends SelectionTests {
super(name);
}
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected ITreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java
index a20055571..c07316b9e 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java
@@ -27,7 +27,8 @@ public class JFaceViewerStateTests extends StateTests {
super(name);
}
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected ITreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
index b51a4247b..6e7911115 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java
@@ -47,7 +47,8 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
/**
* @throws java.lang.Exception
*/
- protected void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
fDisplay = PlatformUI.getWorkbench().getDisplay();
fShell = new Shell(fDisplay);
fShell.setSize(300, 80);
@@ -63,7 +64,8 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
fListener.dispose();
fViewer.getPresentationContext().dispose();
@@ -76,7 +78,8 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
}
}
- protected void runTest() throws Throwable {
+ @Override
+ protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
@@ -514,7 +517,8 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
ModelDelta revealDelta = model.makeElementDelta(pathToBeRevealed, IModelDelta.REVEAL);
revealDelta.accept(new IModelDeltaVisitor() {
- public boolean visit(IModelDelta delta, int depth) {
+ @Override
+ public boolean visit(IModelDelta delta, int depth) {
((ModelDelta)delta).setFlags(delta.getFlags() | IModelDelta.EXPAND);
return true;
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java
index 4ebd01ad7..518eeadd7 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java
@@ -27,7 +27,8 @@ public class JFaceViewerUpdateTests extends UpdateTests {
super(name);
}
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected ITreeModelViewer createViewer(Display display, Shell shell) {
return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java
index 7dacab8ef..920345ebd 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java
@@ -46,7 +46,8 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
/**
* @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);
@@ -63,7 +64,8 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
fListener.dispose();
fViewer.getPresentationContext().dispose();
@@ -76,7 +78,8 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
}
}
- protected void runTest() throws Throwable {
+ @Override
+ protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java
index 0caaf4593..6c1b0416c 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java
@@ -46,7 +46,8 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
/**
* @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);
@@ -65,7 +66,8 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
fListener.dispose();
fViewer.getPresentationContext().dispose();
@@ -78,7 +80,8 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
}
}
- protected void runTest() throws Throwable {
+ @Override
+ protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
@@ -375,7 +378,8 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
fViewer.addFilter(new ViewerFilter() {
- public boolean select(Viewer viewer, Object parentElement, Object element) {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof TestElement) {
String id = ((TestElement)element).getID();
if (id.startsWith("model.")) { //$NON-NLS-1$
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java
index d99c149ae..37487c566 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.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
@@ -35,8 +35,8 @@ import org.eclipse.ui.PlatformUI;
/**
* Tests to verify that the viewer property updates when created
- * with the SWT.POPUP style.
- *
+ * with the SWT.POPUP style.
+ *
* @since 3.6
*/
abstract public class PopupTests extends TestCase implements ITestModelUpdatesListenerConstants {
@@ -44,7 +44,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
Shell fShell;
ITreeModelViewer fViewer;
TestModelUpdatesListener fListener;
-
+
public PopupTests(String name) {
super(name);
}
@@ -52,14 +52,15 @@ abstract public class PopupTests 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, SWT.POP_UP);
-
+
fListener = new TestModelUpdatesListener(fViewer, false, false);
fShell.open ();
@@ -68,17 +69,18 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
protected IInternalTreeModelViewer getCTargetViewer() {
return (IInternalTreeModelViewer)fViewer;
}
-
+
abstract protected ITreeModelViewer createViewer(Display display, Shell shell, int style);
-
+
/**
* @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()) {
@@ -89,16 +91,16 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
}
/**
- * This test verifies that content updates are still being performed.
+ * This test verifies that content updates are still being performed.
*/
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());
@@ -108,7 +110,7 @@ abstract public class PopupTests 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 });
@@ -118,8 +120,8 @@ abstract public class PopupTests 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 ()) {
@@ -134,7 +136,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
*/
public void testExpandAndSelect() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
-
+
// Create the listener
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, false);
@@ -149,8 +151,8 @@ abstract public class PopupTests 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();
@@ -162,10 +164,10 @@ abstract public class PopupTests 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)) {
@@ -185,28 +187,28 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Validate the expansion state AFTER posting the delta.
assertFalse(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());
assertFalse(selectionPathsList.contains(path_root_3));
} else {
fail("Not a tree selection"); //$NON-NLS-1$
}
}
-
-
+
+
public void testPreserveExpandedOnSubTreeContent() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
// Expand all
fViewer.setAutoExpandLevel(-1);
-
- // Create the listener,
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+
+ // Create the listener,
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -219,14 +221,14 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Turn off auto-expansion
fViewer.setAutoExpandLevel(0);
-
+
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("3.3.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
// Update the model
model.addElementChild(model.findElement("3"), null, 0, new TestElement(model, "3.0 - new", new TestElement[0])); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// Create the delta for element "3" with content update.
TreePath elementPath = model.findElement("3"); //$NON-NLS-1$
ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -236,7 +238,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
fListener.addUpdates(getCTargetViewer(), elementPath, model.getElement(elementPath), -1, ALL_UPDATES_COMPLETE);
-
+
// Post the sub-tree update
model.postDelta(rootDelta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
@@ -257,14 +259,14 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
}
private boolean areTreeSelectionsEqual(ITreeSelection sel1, ITreeSelection sel2) {
- Set sel1Set = new HashSet();
+ Set<TreePath> sel1Set = new HashSet<TreePath>();
sel1Set.addAll( Arrays.asList(sel1.getPaths()) );
-
- Set sel2Set = new HashSet();
+
+ Set<TreePath> sel2Set = new HashSet<TreePath>();
sel2Set.addAll( Arrays.asList(sel2.getPaths()) );
-
+
return sel1Set.equals(sel2Set);
}
-
+
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java
index 8f51de89c..625edb48a 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.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 - bug fixing
@@ -31,7 +31,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
-/**
+/**
* Tests to verify that the viewer properly handles selection changes.
*/
abstract public class SelectionTests extends TestCase implements ITestModelUpdatesListenerConstants {
@@ -39,7 +39,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
Shell fShell;
ITreeModelViewer fViewer;
TestModelUpdatesListener fListener;
-
+
public SelectionTests(String name) {
super(name);
}
@@ -47,28 +47,30 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
/**
* @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 ITreeModelViewer 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,9 +81,10 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
}
private static class SelectionListener implements ISelectionChangedListener {
- private final List fEvents = new ArrayList(1);
-
- public void selectionChanged(SelectionChangedEvent event) {
+ private final List<SelectionChangedEvent> fEvents = new ArrayList<SelectionChangedEvent>(1);
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
fEvents.add(event);
}
}
@@ -89,7 +92,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
private TestModel makeMultiLevelModel() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
fViewer.setAutoExpandLevel(-1);
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
@@ -99,17 +102,17 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
model.validateData(fViewer, TreePath.EMPTY);
return model;
}
-
+
/**
* In this test:
* - set selection to an element deep in the model
* - verify that selection chagned listener is called
- * - verify that the selection is in the viewer is correct
+ * - verify that the selection is in the viewer is correct
*/
public void testSimpleSetSelection() throws InterruptedException {
// Create the model and populate the view.
TestModel model = makeMultiLevelModel();
-
+
// Create a selection object to the deepest part of the tree.
SelectionListener listener = new SelectionListener();
fViewer.addSelectionChangedListener(listener);
@@ -120,7 +123,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
assertTrue(listener.fEvents.size() == 1);
// Check that the new selection is what was requested.
- ISelection viewerSelection = fViewer.getSelection();
+ ISelection viewerSelection = fViewer.getSelection();
assertEquals(selection, viewerSelection);
}
@@ -132,27 +135,31 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
public void testSelectionPolicy() throws InterruptedException {
// Create the model and populate the view.
final TestModel model = makeMultiLevelModel();
-
+
// Set the selection and verify it.
TreeSelection selection_3_3_3 = new TreeSelection(model.findElement("3.3.3")); //$NON-NLS-1$
fViewer.setSelection(selection_3_3_3, true, false);
assertEquals(selection_3_3_3, fViewer.getSelection());
model.setSelectionPolicy(new IModelSelectionPolicy() {
-
- public ISelection replaceInvalidSelection(ISelection invalidSelection, ISelection newSelection) {
+
+ @Override
+ public ISelection replaceInvalidSelection(ISelection invalidSelection, ISelection newSelection) {
return null;
}
-
- public boolean overrides(ISelection existing, ISelection candidate, IPresentationContext context) {
+
+ @Override
+ public boolean overrides(ISelection existing, ISelection candidate, IPresentationContext context) {
return false;
}
-
- public boolean isSticky(ISelection selection, IPresentationContext context) {
+
+ @Override
+ public boolean isSticky(ISelection selection, IPresentationContext context) {
return true;
}
-
- public boolean contains(ISelection selection, IPresentationContext context) {
+
+ @Override
+ public boolean contains(ISelection selection, IPresentationContext context) {
return true;
}
});
@@ -165,8 +172,8 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// Now attempt to *force* selection and verify that new selection was set.
fViewer.setSelection(selection_3_3_1, true, true);
assertEquals(selection_3_3_1, fViewer.getSelection());
-
- // Create the an update delta to attempt to change selection back to
+
+ // Create the an update delta to attempt to change selection back to
// 3.3.3 and verify that selection did not get overriden.
TreePath path_3_3_3 = model.findElement("3.3.3"); //$NON-NLS-1$
ModelDelta baseDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -192,11 +199,11 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
assertEquals(selection_3_3_3, fViewer.getSelection());
}
-
+
/**
* In this test:
- * - set a seleciton to an element
- * - then remove that element
+ * - set a seleciton to an element
+ * - then remove that element
* - update the view with remove delta
* -> The selection should be re-set to empty.
*/
@@ -205,7 +212,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// Create the model and populate the view.
TestModel model = makeMultiLevelModel();
-
+
// Create a selection object to the deepest part of the tree.
TreePath elementPath = model.findElement("3.3.3"); //$NON-NLS-1$
TreeSelection selection = new TreeSelection(elementPath);
@@ -225,7 +232,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// Reset the listener and update the viewer. With a remove
// delta only wait for the delta to be processed.
- fListener.reset();
+ fListener.reset();
model.postDelta(delta);
while (!fListener.isFinished(ITestModelUpdatesListenerConstants.MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -237,15 +244,15 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
//assertTrue(listener.fEvents.size() == 1);
// Check that the new selection is empty
- ISelection viewerSelection = fViewer.getSelection();
+ ISelection viewerSelection = fViewer.getSelection();
assertTrue(viewerSelection.isEmpty());
}
-
+
/**
* In this test:
- * - set a selection to an element
- * - then remove that element
+ * - set a selection to an element
+ * - then remove that element
* - then refresh the view.
* -> The selection should be re-set to empty.
*/
@@ -254,7 +261,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// Create the model and populate the view.
TestModel model = makeMultiLevelModel();
-
+
// Create a selection object to the deepest part of the tree.
TreePath elementPath = model.findElement("3.3.3"); //$NON-NLS-1$
TreeSelection selection = new TreeSelection(elementPath);
@@ -273,8 +280,8 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
fViewer.addSelectionChangedListener(listener);
// Reset the listener to ignore redundant updates. When elements are removed
- // the viewer may still request updates for those elements.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ // the viewer may still request updates for those elements.
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Refresh the viewer
model.postDelta( new ModelDelta(model.getRootElement(), IModelDelta.CONTENT) );
@@ -289,7 +296,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
//assertTrue(listener.fEvents.size() == 1);
// Check that the new selection is empty
- ISelection viewerSelection = fViewer.getSelection();
+ ISelection viewerSelection = fViewer.getSelection();
assertTrue(viewerSelection.isEmpty());
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
index ee5206699..fffc38b7f 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.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
@@ -32,9 +32,9 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
/**
- * Tests to verify that the viewer can save and restore correctly the expansion
+ * Tests to verify that the viewer can save and restore correctly the expansion
* state of elements.
- *
+ *
* @since 3.6
*/
abstract public class StateTests extends TestCase implements ITestModelUpdatesListenerConstants {
@@ -42,7 +42,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
Shell fShell;
ITreeModelViewer fViewer;
TestModelUpdatesListener fListener;
-
+
public StateTests(String name) {
super(name);
}
@@ -50,7 +50,8 @@ abstract public class StateTests 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);
@@ -58,21 +59,22 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fShell.setLayout(new FillLayout());
fViewer = createViewer(fDisplay, fShell);
-
+
fListener = new TestModelUpdatesListener(fViewer, false, false);
fShell.open ();
}
abstract protected ITreeModelViewer createViewer(Display display, Shell shell);
-
+
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception, InterruptedException {
+ @Override
+ protected void tearDown() throws Exception, InterruptedException {
fListener.dispose();
fViewer.getPresentationContext().dispose();
-
+
// Close the shell and exit.
fShell.close();
while (!fShell.isDisposed()) {
@@ -82,23 +84,24 @@ abstract public class StateTests 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$
}
}
-
+
protected IInternalTreeModelViewer getInternalViewer() {
return (IInternalTreeModelViewer)fViewer;
}
-
+
public void testUpdateViewer() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
-
+
TestModel model = TestModel.simpleMultiLevel();
-
+
// Create the listener
fListener.reset();
fListener.addChildreUpdate(TreePath.EMPTY, 0);
@@ -114,7 +117,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
}
model.validateData(fViewer, TreePath.EMPTY, true);
- // Create the update delta
+ // Create the update delta
TestElement element = model.getRootElement();
TreePath path0 = TreePath.EMPTY;
ModelDelta delta = new ModelDelta(model.getRootElement(), -1, IModelDelta.EXPAND, element.getChildren().length);
@@ -128,7 +131,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
element = element.getChildren()[1];
TreePath path3 = path2.createChildPath(element);
delta = delta.addNode(element, 1, IModelDelta.SELECT);
-
+
fListener.reset(false, false);
fListener.addChildreUpdate(path0, 2);
@@ -144,7 +147,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addChildreUpdate(path2, 1);
fListener.addHasChildrenUpdate(path3);
fListener.addLabelUpdate(path3);
-
+
fViewer.updateViewer(updateDelta);
while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_UPDATES)) {
if (!fDisplay.readAndDispatch ()) {
@@ -155,7 +158,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Extract the new state from viewer
ModelDelta savedDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(path0, savedDelta, IModelDelta.EXPAND | IModelDelta.SELECT);
-
+
if (!deltaMatches(updateDelta, savedDelta) ) {
fail("Expected:\n" + updateDelta.toString() + "\nGot:\n" + savedDelta); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -166,9 +169,9 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
requested.getFlags() == received.getFlags() &&
( requested.getChildCount() == -1 || requested.getChildCount() == received.getChildCount() )&&
( requested.getIndex() == -1 || requested.getIndex() == received.getIndex()) &&
- ((requested.getReplacementElement() != null && requested.getReplacementElement().equals(received.getReplacementElement())) ||
- (requested.getReplacementElement() == null && received.getReplacementElement() == null)) &&
- requested.getChildDeltas().length == received.getChildDeltas().length)
+ ((requested.getReplacementElement() != null && requested.getReplacementElement().equals(received.getReplacementElement())) ||
+ (requested.getReplacementElement() == null && received.getReplacementElement() == null)) &&
+ requested.getChildDeltas().length == received.getChildDeltas().length)
{
for (int i = 0; i < requested.getChildDeltas().length; i++) {
ModelDelta requestedChildDelta = (ModelDelta)requested.getChildDeltas()[i];
@@ -184,7 +187,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
/**
* Creates a model in the pattern of:
- *
+ *
* root
* 1
* 1.1
@@ -202,36 +205,36 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
*/
static TestModel alternatingSubsreesModel(int size) {
TestModel model = new TestModel();
-
+
TestElement[] elements = new TestElement[size];
for (int i = 0; i < size; i++) {
String text = Integer.toString(i + 1);
- elements[i] =
- new TestElement(model, text, new TestElement[] {
+ elements[i] =
+ new TestElement(model, text, new TestElement[] {
new TestElement(model, text + ".1", new TestElement[] { //$NON-NLS-1$
new TestElement(model, text + ".1.1", new TestElement[0]) //$NON-NLS-1$
})
- });
+ });
}
model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
-
+
return model;
}
static boolean areTreeSelectionsEqual(ITreeSelection sel1, ITreeSelection sel2) {
- Set sel1Set = new HashSet();
+ Set<TreePath> sel1Set = new HashSet<TreePath>();
sel1Set.addAll( Arrays.asList(sel1.getPaths()) );
-
- Set sel2Set = new HashSet();
+
+ Set<TreePath> sel2Set = new HashSet<TreePath>();
sel2Set.addAll( Arrays.asList(sel2.getPaths()) );
-
+
return sel1Set.equals(sel2Set);
}
-
+
static void expandAlternateElements(TestModelUpdatesListener listener, TestModel model, boolean waitForAllUpdates) throws InterruptedException {
- listener.reset();
+ listener.reset();
listener.setFailOnRedundantUpdates(false);
-
+
TestElement rootElement = model.getRootElement();
TestElement[] children = rootElement.getChildren();
ModelDelta rootDelta = new ModelDelta(rootElement, IModelDelta.NO_CHANGE);
@@ -241,7 +244,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
if (i % 2 == 1) {
continue;
}
-
+
// Expand the element and the first child of each sub-element
TestElement element = children[i];
ModelDelta delta = expandDelta;
@@ -249,7 +252,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
while (element.getChildren().length != 0) {
TreePath elementPath = model.findElement(element.getLabel());
listener.addUpdates(
- elementPath, element, 1,
+ elementPath, element, 1,
CHILD_COUNT_UPDATES | (waitForAllUpdates ? CHILDREN_UPDATES : 0) );
delta = delta.addNode(element, index, IModelDelta.EXPAND, element.getChildren().length);
element = element.getChildren()[0];
@@ -264,15 +267,15 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
}
}
}
-
+
public void testPreserveExpandedOnRemove() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
- 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());
@@ -284,23 +287,23 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(fListener, model, true);
-
+
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
// Update the model
ModelDelta delta = model.removeElementChild(TreePath.EMPTY, 0);
-
+
// Remove delta should not generate any new updates
- fListener.reset();
+ fListener.reset();
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
@@ -318,9 +321,9 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
TestModel model = alternatingSubsreesModel(6);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
- 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());
@@ -332,18 +335,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(fListener, model, true);
-
+
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
-
+
// Update the model
ModelDelta delta = model.insertElementChild(TreePath.EMPTY, 0, new TestElement(model, "0 - new", new TestElement[0])); //$NON-NLS-1$
-
+
// Insert delta should generate updates only for the new element
TreePath path = model.findElement("0 - new"); //$NON-NLS-1$
// Note: redundant label updates on insert.
- fListener.reset(path, (TestElement)path.getLastSegment(), 0, false, false);
+ fListener.reset(path, (TestElement)path.getLastSegment(), 0, false, false);
fListener.addChildreUpdate(TreePath.EMPTY, 0);
model.postDelta(delta);
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE)) {
@@ -351,7 +354,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
Thread.sleep(0);
}
}
-
+
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true); //$NON-NLS-1$
@@ -371,9 +374,9 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
TestModel model = alternatingSubsreesModel(6);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
- 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());
@@ -385,7 +388,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(fListener, model, true);
-
+
// Set a selection in view
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(
@@ -395,16 +398,16 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Update the model
model.removeElementChild(TreePath.EMPTY, 0);
-
+
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
-
- // Create the delta which has nodes with CONTENT flag set at multiple levels.
+
+ // Create the delta which has nodes with CONTENT flag set at multiple levels.
ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
ModelDelta elementDelta = model.getElementDelta(rootDelta, model.findElement("3.1.1"), true); //$NON-NLS-1$
elementDelta.setFlags(IModelDelta.CONTENT);
-
+
// Post the multi-content update delta
model.postDelta(rootDelta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
@@ -423,8 +426,8 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
-
- // Note: in past it was observed sub-optimal coalescing in this test due
+
+ // Note: in past it was observed sub-optimal coalescing in this test due
// to scattered update requests from viewer.
assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 5) );
}
@@ -436,9 +439,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Expand all
fViewer.setAutoExpandLevel(-1);
-
- // Create the listener,
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
+
+ // Create the listener,
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -451,14 +454,14 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Turn off auto-expansion
fViewer.setAutoExpandLevel(0);
-
+
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("3.3.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
// Update the model
model.addElementChild(model.findElement("3"), null, 0, new TestElement(model, "3.0 - new", new TestElement[0])); //$NON-NLS-1$ //$NON-NLS-2$
-
+
// Create the delta for element "3" with content update.
TreePath elementPath = model.findElement("3"); //$NON-NLS-1$
ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -468,7 +471,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
fListener.addUpdates(getInternalViewer(), elementPath, model.getElement(elementPath), -1, ALL_UPDATES_COMPLETE);
-
+
// Post the sub-tree update
model.postDelta(rootDelta);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
@@ -493,9 +496,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
TestModel model = alternatingSubsreesModel(6);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
- 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());
@@ -507,7 +510,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(fListener, model, true);
-
+
// Set a selection in view
// TreeSelection originalSelection = new TreeSelection(
// new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") });
@@ -515,15 +518,15 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
fViewer.setSelection(originalSelection);
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
- // Run this test ten times as we've seen intermittent failures related
+ // Run this test ten times as we've seen intermittent failures related
// to timing in it.
for (int i = 0; i < 10; i++) {
// Update the model
model.removeElementChild(TreePath.EMPTY, 0);
-
+
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
- fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -541,13 +544,13 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
-
+
// Update the model again
model.addElementChild(TreePath.EMPTY, null, 0, new TestElement(model, "1", new TestElement[0])); //$NON-NLS-1$
-
+
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
- fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
+ fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -573,7 +576,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
TestModel model = alternatingSubsreesModel(100);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
fListener.reset();
@@ -589,7 +592,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
expandAlternateElements(fListener, model, false);
-
+
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
@@ -597,7 +600,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Update the model
model.removeElementChild(TreePath.EMPTY, 0);
-
+
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
@@ -616,10 +619,10 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
-
+
// Update the model again
model.addElementChild(TreePath.EMPTY, null, 0, new TestElement(model, "1", new TestElement[0])); //$NON-NLS-1$
-
+
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
@@ -639,9 +642,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
-
+
/**
- * This test verifies that if the model selects a new element
+ * This test verifies that if the model selects a new element
* following a content refresh, the state restore logic will
* not override the selection requested by the model.
*/
@@ -651,9 +654,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Expand all
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());
@@ -669,7 +672,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Reset the listener (ignore redundant updates)
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
-
+
// Refresh content.
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
@@ -690,7 +693,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
Thread.sleep(0);
}
}
-
+
// Wait for all the updates to complete (note: we're not resetting the listener.
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
@@ -709,9 +712,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Expand all
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());
@@ -724,10 +727,10 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Turn off auto-expand
fViewer.setAutoExpandLevel(0);
-
+
// Reset the listener (ignore redundant updates)
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
-
+
// Refresh content.
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
@@ -739,8 +742,8 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Update the viewer to collapse an element
ModelDelta collapseDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.COLLAPSE); //$NON-NLS-1$
-
- // Remove updates for the collapsed element from listener, because they
+
+ // Remove updates for the collapsed element from listener, because they
// will never happen if the element remains collapsed.
fListener.resetModelChanged();
fListener.removeLabelUpdate(model.findElement("3.1.1")); //$NON-NLS-1$
@@ -761,7 +764,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
Thread.sleep(0);
}
}
-
+
// Wait for all the updates to complete (note: we're not resetting the listener.
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
@@ -779,9 +782,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
TestModel model = TestModel.simpleMultiLevel();
// Note: Do not auto-expand!
-
+
// 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());
@@ -794,7 +797,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Reset the listener (ignore redundant updates)
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
-
+
// Refresh content.
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
@@ -806,7 +809,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Update the viewer to expand an element
ModelDelta expandDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.EXPAND); //$NON-NLS-1$
-
+
// Wait for the second model delta to process
fListener.resetModelChanged();
model.postDelta(expandDelta);
@@ -815,7 +818,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
Thread.sleep(0);
}
}
-
+
// Wait for all the updates to complete (note: we're not resetting the listener.
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
@@ -828,15 +831,15 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
}
-
+
public void testSaveAndRestore1() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(6);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
- 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());
@@ -852,7 +855,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Set a selection in view
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("5.1"), model.findElement("5.1.1"), model.findElement("6.1.1") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
// Extract the original state from viewer
ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
@@ -866,9 +869,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
Thread.sleep(0);
}
}
-
+
// Set the viewer input back to the model. When view updates are complete
- // the viewer
+ // the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
// TODO: add state updates somehow?
@@ -887,16 +890,16 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
}
}
-
+
public void testSaveAndRestore2() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
// expand all elements
fViewer.setAutoExpandLevel(-1);
-
+
// Create the listener, only check the first level
- 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());
@@ -910,7 +913,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Set a selection in view
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("3.2"), model.findElement("3.2.1"), model.findElement("2") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fViewer.setSelection(new TreeSelection(model.findElement("3.2.3"))); //$NON-NLS-1$
-
+
// Turn off the auto-expand now since we want to text the auto-expand logic
fViewer.setAutoExpandLevel(-1);
@@ -930,7 +933,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
// Set the viewer input back to the model. When view updates are complete
- // the viewer
+ // the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
// TODO: add state updates somehow?
@@ -955,9 +958,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
TestModel model = alternatingSubsreesModel(6);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
- 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());
@@ -973,15 +976,15 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Set a selection in view
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("5.1"), model.findElement("5.1.1"), model.findElement("6.1.1") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
// Extract the original state from viewer
ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
// Do not reset to null, just reset input to the same object.
-
+
// Set the viewer input back to the model. When view updates are complete
- // the viewer
+ // the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
fViewer.setInput(model.getRootElement());
@@ -1005,9 +1008,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
TestModel model = alternatingSubsreesModel(6);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
- 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());
@@ -1023,20 +1026,20 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Set a selection in view
fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("5.1"), model.findElement("5.1.1"), model.findElement("6.1.1") })); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-
+
// Extract the original state from viewer
ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(TreePath.EMPTY, originalState, IModelDelta.EXPAND | IModelDelta.SELECT);
- // Create a copy of the input object and set it to model.
+ // Create a copy of the input object and set it to model.
TestElement newRoot = new TestElement(model, model.getRootElement().getID(), model.getRootElement().getChildren());
model.setRoot(newRoot);
-
+
// Set the viewer input back to the model. When view updates are complete
- // the viewer
+ // the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
-
+
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
@@ -1053,13 +1056,13 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
-
+
public void testSaveAndRestoreLarge() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(100);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
fListener.reset();
@@ -1072,7 +1075,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
expandAlternateElements(fListener, model, false);
-
+
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
@@ -1094,7 +1097,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
// Set the viewer input back to the model. When view updates are complete
- // the viewer
+ // the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset();
fViewer.setInput(model.getRootElement());
@@ -1118,16 +1121,16 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
/**
- * This test saves state of a large tree. Then the tree is modified
+ * This test saves state of a large tree. Then the tree is modified
* to contain much fewer elements. The restore logic should discard the
- * rest of the saved state delta once all the elements are visible.
+ * rest of the saved state delta once all the elements are visible.
*/
public void testSaveAndRestorePartialStateLarge() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = alternatingSubsreesModel(100);
// NOTE: WE ARE NOT EXPANDING ANY CHILDREN
-
+
// Create the listener, only check the first level
fListener.reset();
@@ -1140,7 +1143,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
expandAlternateElements(fListener, model, false);
-
+
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
@@ -1161,19 +1164,19 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
-
+
TestElement[] elements = model.getRootElement().getChildren();
TestElement[] newElements = new TestElement[10];
System.arraycopy(elements, 0, newElements, 0, newElements.length);
model.setElementChildren(TreePath.EMPTY, newElements);
-
+
// Set the viewer input back to the model. When view updates are complete
- // the viewer
+ // the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset();
fViewer.setInput(model.getRootElement());
-
- // MONITOR FOR THE STATE RESTORE TO COMPLETE
+
+ // MONITOR FOR THE STATE RESTORE TO COMPLETE
while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE| STATE_RESTORE_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
@@ -1192,16 +1195,16 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
-
+
public void testPreserveCollapseAndSelectDeltaAfterSaveAndRestore() throws InterruptedException {
//TreeModelViewerAutopopulateAgent autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
TestModel model = TestModel.simpleMultiLevel();
// Expand all
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());
@@ -1216,7 +1219,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Turn off auto-expand
fViewer.setAutoExpandLevel(0);
-
+
// Set the viewer input to null. This will trigger the view to save the viewer state.
fListener.reset(false, false);
fViewer.setInput(null);
@@ -1225,9 +1228,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
Thread.sleep(0);
}
}
-
+
// Set the viewer input back to the model. When view updates are complete
- // the viewer
+ // the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
fViewer.setInput(model.getRootElement());
@@ -1237,14 +1240,14 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
fListener.addUpdates(null, path, (TestElement)path.getLastSegment(), 0, STATE_UPDATES);
// Wait till we restore state of elements we want to collapse and select
- // Bug 372619 - Need to wait until proxy installed delta is processed before
+ // Bug 372619 - Need to wait until proxy installed delta is processed before
// posting the next delta.
while (!fListener.isFinished(STATE_RESTORE_STARTED | STATE_UPDATES | CHILDREN_UPDATES | MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
// Post first collapse delta
fListener.resetModelChanged();
model.postDelta(model.makeElementDelta(model.findElement("2"), IModelDelta.COLLAPSE)); //$NON-NLS-1$
@@ -1295,9 +1298,9 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
// Expand all
fViewer.setAutoExpandLevel(-1);
-
+
// Create the listener.
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -1307,10 +1310,10 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
model.validateData(fViewer, TreePath.EMPTY, true);
-
+
// a new similar model
TestModel copyModel = TestModel.simpleMultiLevel();
-
+
// Trigger save - restore sequence.
fListener.reset();
fListener.expectRestoreAfterSaveComplete();
@@ -1321,7 +1324,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
}
}
assertTrue("RESTORE started before SAVE to complete", fListener.isFinished(STATE_SAVE_COMPLETE)); //$NON-NLS-1$
- }
+ }
/**
* This test tries to restore a viewer state while input == null.
@@ -1332,7 +1335,7 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -1345,19 +1348,19 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
ModelDelta expandedState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(TreePath.EMPTY, expandedState, IModelDelta.EXPAND);
-
+
// Refresh the viewer so that updates are generated.
fListener.reset();
fListener.addChildreCountUpdate(TreePath.EMPTY);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
fViewer.setInput(null);
fViewer.updateViewer(expandedState);
@@ -1366,6 +1369,6 @@ new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findEle
Thread.sleep(0);
}
}
-
+
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java
index fd46141f7..47e03d33c 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.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 - bug fixing
@@ -45,14 +45,14 @@ import org.eclipse.swt.widgets.Display;
import org.junit.Assert;
/**
- * Test model for the use in unit tests. This test model contains a set of
- * elements in a tree structure. It contains utility methods for modifying the
+ * Test model for the use in unit tests. This test model contains a set of
+ * elements in a tree structure. It contains utility methods for modifying the
* model and for verifying that the viewer content matches the model.
- *
+ *
* @since 3.6
*/
public class TestModel implements IElementContentProvider, IElementLabelProvider, IModelProxyFactory2 , IElementMementoProvider, IModelSelectionPolicyFactory {
-
+
public static class TestElement extends PlatformObject {
private final TestModel fModel;
private final String fID;
@@ -61,7 +61,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
boolean fExpanded;
boolean fChecked;
boolean fGrayed;
-
+
public TestElement(TestModel model, String text, TestElement[] children) {
this (model, text, false, false, children);
}
@@ -73,42 +73,43 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
fChecked = checked;
fGrayed = grayed;
}
-
+
public TestModel getModel() {
return fModel;
}
-
- public Object getAdapter(Class adapter) {
+
+ @Override
+ public Object getAdapter(Class adapter) {
if (adapter.isInstance(fModel)) {
return fModel;
}
return null;
}
-
+
public String getID() {
return fID;
}
-
+
public void setLabelAppendix(String appendix) {
fLabelAppendix = appendix;
}
-
+
public String getLabel() {
return fID + fLabelAppendix;
}
-
+
public TestElement[] getChildren() {
return fChildren;
}
-
+
public boolean isExpanded() {
return fExpanded;
}
-
+
public boolean getGrayed() {
return fGrayed;
}
-
+
public boolean getChecked() {
return fChecked;
}
@@ -117,32 +118,36 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
fChecked = checked;
fGrayed = grayed;
}
-
- public boolean equals(Object obj) {
+
+ @Override
+ public boolean equals(Object obj) {
return obj instanceof TestElement && fID.equals(((TestElement)obj).fID);
}
-
- public int hashCode() {
+
+ @Override
+ public int hashCode() {
return fID.hashCode();
}
-
- public String toString() {
+
+ @Override
+ public String toString() {
return getLabel();
}
-
+
public int indexOf(TestElement child) {
return Arrays.asList(fChildren).indexOf(child);
}
}
private class ModelProxy extends AbstractModelProxy {
- public void installed(Viewer viewer) {
+ @Override
+ public void installed(Viewer viewer) {
super.installed(viewer);
ModelDelta rootDelta = TestModel.this.getBaseDelta(new ModelDelta(fInput, IModelDelta.NO_CHANGE));
installSubModelProxies(fRootPath, rootDelta);
fireModelChanged(rootDelta);
}
-
+
private void installSubModelProxies(TreePath path, ModelDelta delta) {
TestElement element = getElement(path);
if (element.fModel != TestModel.this) {
@@ -150,7 +155,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
delta.setFlags(delta.getFlags() | IModelDelta.INSTALL);
} else {
TestElement[] children = element.getChildren();
-
+
for (int i = 0; i < children.length; i++) {
installSubModelProxies(path.createChildPath(children[i]), delta.addNode(children[i], IModelDelta.NO_CHANGE));
}
@@ -165,25 +170,26 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
private IModelSelectionPolicy fModelSelectionPolicy;
private boolean fQueueingUpdates = false;
private boolean fDelayUpdates = false;
- private List fQueuedUpdates = new LinkedList();
-
+ private List<IViewerUpdate> fQueuedUpdates = new LinkedList<IViewerUpdate>();
+
/**
- * Constructor private. Use static factory methods instead.
+ * Constructor private. Use static factory methods instead.
*/
public TestModel() {}
-
+
public TestElement getRootElement() {
return fRoot;
}
-
+
public void setSelectionPolicy(IModelSelectionPolicy modelSelectionPolicy) {
fModelSelectionPolicy = modelSelectionPolicy;
}
-
- public IModelSelectionPolicy createModelSelectionPolicyAdapter(Object element, IPresentationContext context) {
+
+ @Override
+ public IModelSelectionPolicy createModelSelectionPolicyAdapter(Object element, IPresentationContext context) {
return fModelSelectionPolicy;
}
-
+
public ModelDelta getBaseDelta(ModelDelta rootDelta) {
ModelDelta delta = rootDelta;
for (int i = 0; i < fRootPath.getSegmentCount(); i++) {
@@ -200,9 +206,9 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
public int getModelDepth() {
return getDepth(getRootElement(), 0);
}
-
+
private int getDepth(TestElement element, int atDepth) {
- TestElement[] children = element.getChildren();
+ TestElement[] children = element.getChildren();
if (children.length == 0) {
return atDepth;
}
@@ -213,7 +219,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
return depth;
}
-
+
public void setQeueueingUpdate(boolean queueingUpdates) {
fQueueingUpdates = queueingUpdates;
if (!fQueueingUpdates) {
@@ -225,18 +231,18 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
fDelayUpdates = delayUpdates;
}
- public List getQueuedUpdates() {
+ public List<IViewerUpdate> getQueuedUpdates() {
return fQueuedUpdates;
}
-
+
public void processQueuedUpdates() {
- List updates = new ArrayList(fQueuedUpdates);
+ List<IViewerUpdate> updates = new ArrayList<IViewerUpdate>(fQueuedUpdates);
fQueuedUpdates.clear();
for (int i = 0; i < updates.size(); i++) {
- processUpdate((IViewerUpdate)updates.get(i));
+ processUpdate(updates.get(i));
}
}
-
+
public void processUpdate(IViewerUpdate update) {
if (update instanceof IHasChildrenUpdate) {
doHasChildrenUpdate((IHasChildrenUpdate)update);
@@ -256,24 +262,26 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
private void processUpdates(IViewerUpdate[] updates) {
for (int i = 0; i < updates.length; i++) {
processUpdate(updates[i]);
- }
+ }
}
-
+
private void doUpdate(final IViewerUpdate[] updates) {
if (fQueueingUpdates) {
fQueuedUpdates.addAll(Arrays.asList(updates));
} else if (fDelayUpdates) {
Display.getDefault().asyncExec(new Runnable() {
- public void run() {
+ @Override
+ public void run() {
processUpdates(updates);
}
});
} else {
processUpdates(updates);
- }
+ }
}
-
- public void update(IHasChildrenUpdate[] updates) {
+
+ @Override
+ public void update(IHasChildrenUpdate[] updates) {
doUpdate(updates);
}
@@ -282,9 +290,10 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
update.setHasChilren(element.getChildren().length > 0);
update.done();
}
-
-
- public void update(IChildrenCountUpdate[] updates) {
+
+
+ @Override
+ public void update(IChildrenCountUpdate[] updates) {
doUpdate(updates);
}
@@ -293,8 +302,9 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
update.setChildCount(element.getChildren().length);
update.done();
}
-
- public void update(IChildrenUpdate[] updates) {
+
+ @Override
+ public void update(IChildrenUpdate[] updates) {
doUpdate(updates);
}
@@ -308,25 +318,27 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
update.done();
}
-
- public void update(ILabelUpdate[] updates) {
+
+ @Override
+ public void update(ILabelUpdate[] updates) {
doUpdate(updates);
}
private void doLabelUpdate(ILabelUpdate update) {
TestElement element = (TestElement)update.getElement();
update.setLabel(element.getLabel(), 0);
- if (update instanceof ICheckUpdate &&
- Boolean.TRUE.equals(update.getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
+ if (update instanceof ICheckUpdate &&
+ Boolean.TRUE.equals(update.getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)))
{
((ICheckUpdate)update).setChecked(element.getChecked(), element.getGrayed());
}
update.done();
}
-
+
public final static String ELEMENT_MEMENTO_ID = "id"; //$NON-NLS-1$
-
- public void compareElements(final IElementCompareRequest[] updates) {
+
+ @Override
+ public void compareElements(final IElementCompareRequest[] updates) {
doUpdate(updates);
}
@@ -336,17 +348,18 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
update.setEqual( elementID.equals(mementoID) );
update.done();
}
-
- public void encodeElements(IElementMementoRequest[] updates) {
+
+ @Override
+ public void encodeElements(IElementMementoRequest[] updates) {
doUpdate(updates);
}
-
+
private void doEncodeElements(IElementMementoRequest update) {
String elementID = ((TestElement)update.getElement()).getID();
update.getMemento().putString(ELEMENT_MEMENTO_ID, elementID);
- update.done();
+ update.done();
}
-
+
/**
* @param context the context
* @param viewerInput the input
@@ -354,22 +367,23 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
* @param checked the checked state
*/
public void elementChecked(IPresentationContext context, Object viewerInput, TreePath path, boolean checked) {
- TestElement element = getElement(path);
+ TestElement element = getElement(path);
Assert.assertFalse(element.getGrayed());
element.setChecked(checked, false);
}
-
- public IModelProxy createTreeModelProxy(Object input, TreePath path, IPresentationContext context) {
+
+ @Override
+ public IModelProxy createTreeModelProxy(Object input, TreePath path, IPresentationContext context) {
fModelProxy = new ModelProxy();
fInput = input;
fRootPath = path;
return fModelProxy;
}
-
+
public IModelProxy getModelProxy() {
return fModelProxy;
}
-
+
public TestElement getElement(TreePath path) {
if (path.getSegmentCount() == 0) {
return getRootElement();
@@ -381,7 +395,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
public void setAllExpanded() {
doSetExpanded(fRoot);
}
-
+
private void doSetExpanded(TestElement element) {
element.fExpanded = true;
for (int i = 0; i < element.fChildren.length; i++) {
@@ -392,7 +406,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
public void setAllAppendix(String appendix) {
doSetAllAppendix(fRoot, appendix);
}
-
+
private void doSetAllAppendix(TestElement element, String appendix) {
element.setLabelAppendix(appendix);
for (int i = 0; i < element.fChildren.length; i++) {
@@ -403,11 +417,11 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
public void validateData(ITreeModelViewer viewer, TreePath path) {
validateData(viewer, path, false);
}
-
+
public void validateData(ITreeModelViewer _viewer, TreePath path, boolean expandedElementsOnly) {
validateData(_viewer, path, expandedElementsOnly, TestModelUpdatesListener.EMPTY_FILTER_ARRAY);
}
-
+
public void validateData(ITreeModelViewer _viewer, TreePath path, boolean expandedElementsOnly, ViewerFilter[] filters) {
IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)_viewer;
TestElement element = getElement(path);
@@ -415,7 +429,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
Assert.assertTrue(element.getChecked() == viewer.getElementChecked(path));
Assert.assertTrue(element.getGrayed() == viewer.getElementGrayed(path));
}
-
+
if (!expandedElementsOnly || path.getSegmentCount() == 0 || viewer.getExpandedState(path) ) {
TestElement[] children = element.getChildren();
@@ -428,7 +442,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
validateData(viewer, path.createChildPath(children[i]), expandedElementsOnly, filters);
viewerIndex++;
}
- Assert.assertEquals(viewerIndex, viewer.getChildCount(path));
+ Assert.assertEquals(viewerIndex, viewer.getChildCount(path));
} else if (!viewer.getExpandedState(path)) {
// If element not expanded, verify the plus sign.
Assert.assertTrue(viewer.getHasChildren(path) == element.getChildren().length > 0);
@@ -438,20 +452,20 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
public void setRoot(TestElement root) {
fRoot = root;
}
-
+
public void postDelta(IModelDelta delta) {
fModelProxy.fireModelChanged(delta);
}
-
+
/** Create or retrieve delta for given path
* @param combine if then new deltas for the given path are created. If false existing ones are reused.
*/
public ModelDelta getElementDelta(ModelDelta baseDelta, TreePath path, boolean combine) {
TestElement element = getRootElement();
ModelDelta delta = baseDelta;
-
+
for (int i = 0; i < path.getSegmentCount(); i++) {
- TestElement[] children = element.getChildren();
+ TestElement[] children = element.getChildren();
delta.setChildCount(children.length);
Object segment = path.getSegment(i);
int j;
@@ -474,9 +488,9 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
}
return delta;
-
+
}
-
+
private TreePath getRelativePath(TreePath path) {
Object[] segments = new Object[path.getSegmentCount() - fRootPath.getSegmentCount()];
for (int i = fRootPath.getSegmentCount(), _i = 0; i < path.getSegmentCount(); i++, _i++) {
@@ -484,7 +498,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
return new TreePath(segments);
}
-
+
public ModelDelta appendElementLabel(TreePath path, String labelAppendix) {
org.junit.Assert.assertTrue(path.startsWith(fRootPath, null));
ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
@@ -520,31 +534,31 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
// Find the parent element and generate the delta node for it.
TestElement element = getElement(relativePath);
ModelDelta delta = getElementDelta(baseDelta, relativePath, false);
-
+
// Set the new children array
element.fChildren = children;
-
- // Add the delta flag and update the child count in the parent delta.
+
+ // Add the delta flag and update the child count in the parent delta.
delta.setFlags(delta.getFlags() | IModelDelta.CONTENT);
delta.setChildCount(children.length);
-
+
return rootDelta;
}
-
+
public ModelDelta replaceElementChild(TreePath parentPath, int index, TestElement child) {
ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
ModelDelta baseDelta = getBaseDelta(rootDelta);
TreePath relativePath = getRelativePath(parentPath);
-
+
TestElement element = getElement(relativePath);
ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
- TestElement oldChild = element.fChildren[index];
+ TestElement oldChild = element.fChildren[index];
element.fChildren[index] = child;
delta.addNode(oldChild, child, IModelDelta.REPLACED);
// TODO: set replacement index!?!
-
+
return rootDelta;
- }
+ }
public ModelDelta addElementChild(TreePath parentPath, ModelDelta rootDelta, int index, TestElement newChild) {
if (rootDelta == null) {
@@ -559,17 +573,17 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
// Add the new element
element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
-
+
// Add the delta flag and update the child count in the parent delta.
delta.setChildCount(element.getChildren().length);
delta.addNode(newChild, index, IModelDelta.ADDED);
-
+
return rootDelta;
- }
+ }
public ModelDelta insertElementChild(TreePath parentPath, int index, TestElement newChild) {
return insertElementChild(null, parentPath, index, newChild);
- }
+ }
public ModelDelta insertElementChild(ModelDelta rootDelta, TreePath parentPath, int index, TestElement newChild) {
if (rootDelta == null) {
@@ -581,19 +595,19 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
// Find the parent element and generate the delta node for it.
TestElement element = getElement(relativePath);
ModelDelta delta= getElementDelta(baseDelta, relativePath, false);
-
+
// Add the new element
element.fChildren = doInsertElementInArray(element.fChildren, index, newChild);
-
+
// Add the delta flag and update the child count in the parent delta.
delta.setChildCount(element.getChildren().length);
delta.addNode(newChild, index, IModelDelta.INSERTED);
-
+
return rootDelta;
- }
-
+ }
+
private TestElement[] doInsertElementInArray(TestElement[] children, int index, TestElement newChild) {
- // Create the new children array add the element to it and set it to
+ // Create the new children array add the element to it and set it to
// the parent.
TestElement[] newChildren = new TestElement[children.length + 1];
System.arraycopy(children, 0, newChildren, 0, index);
@@ -601,7 +615,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
System.arraycopy(children, index, newChildren, index + 1, children.length - index);
return newChildren;
}
-
+
public ModelDelta removeElementChild(TreePath parentPath, int index) {
ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
ModelDelta baseDelta = getBaseDelta(rootDelta);
@@ -609,7 +623,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
// Find the parent element and generate the delta node for it.
TestElement element = getElement(parentPath);
ModelDelta delta= getElementDelta(baseDelta, parentPath, false);
-
+
// Create a new child array with the element removed
TestElement[] children = element.getChildren();
TestElement childToRemove = children[index];
@@ -621,9 +635,9 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
// Add the delta flag and update the child count in the parent delta.
delta.setChildCount(element.getChildren().length);
delta.addNode(childToRemove, index, IModelDelta.REMOVED);
-
+
return rootDelta;
- }
+ }
public ModelDelta makeElementDelta(TreePath path, int flags) {
ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
@@ -631,10 +645,10 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
// Find the element and generate the delta node for it.
ModelDelta delta= getElementDelta(baseDelta, path, false);
-
+
delta.setFlags(flags);
return rootDelta;
- }
+ }
public TreePath findElement(String label) {
return findElement(TreePath.EMPTY, label);
@@ -656,14 +670,15 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
return null;
}
-
- public String toString() {
+
+ @Override
+ public String toString() {
return getElementString(fRoot, ""); //$NON-NLS-1$
}
-
+
public String getElementString(TestElement element, String indent) {
StringBuffer builder = new StringBuffer();
- builder.append(indent);
+ builder.append(indent);
builder.append(element.toString());
builder.append('\n');
TestElement[] children = element.getChildren();
@@ -672,7 +687,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
return builder.toString();
}
-
+
public static TestModel simpleSingleLevel() {
TestModel model = new TestModel();
model.setRoot( new TestElement(model, "root", makeSingleLevelModelElements(model, 6, ""))); //$NON-NLS-1$ //$NON-NLS-2$
@@ -686,8 +701,8 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
elements[i - 1] = new TestElement(model, name, new TestElement[0]);
}
return elements;
- }
-
+ }
+
public static TestElement[] makeMultiLevelElements(TestModel model, int depth, String prefix) {
TestElement[] elements = new TestElement[depth];
for (int i = 0; i < depth; i++) {
@@ -695,10 +710,12 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
elements[i] = new TestElement(model, name, makeMultiLevelElements(model, i, name + ".")); //$NON-NLS-1$
}
return elements;
- }
+ }
public static TestElement[] makeMultiLevelElements2(TestModel model, int[] levelCounts, String prefix) {
- if (levelCounts.length == 0) return new TestElement[0];
+ if (levelCounts.length == 0) {
+ return new TestElement[0];
+ }
int count = levelCounts[0];
int[] oldLevelCounts = levelCounts;
levelCounts = new int[levelCounts.length - 1];
@@ -709,7 +726,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
elements[i] = new TestElement(model, name, makeMultiLevelElements2(model, levelCounts, name + ".")); //$NON-NLS-1$
}
return elements;
- }
+ }
public static TestModel simpleMultiLevel() {
TestModel model = new TestModel();
@@ -740,7 +757,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}) );
return model;
}
-
+
public static TestModel compositeMultiLevel() {
TestModel m2 = new TestModel();
m2.setRoot( new TestElement(m2, "m2.root", new TestElement[] { //$NON-NLS-1$
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
index fe151710b..88ae8610a 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.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
* Dorin Ciuca - Top index fix (Bug 324100)
@@ -43,42 +43,42 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.ViewerFilter;
import org.junit.Assert;
-public class TestModelUpdatesListener
+public class TestModelUpdatesListener
implements IViewerUpdateListener, ILabelUpdateListener, IModelChangedListener, ITestModelUpdatesListenerConstants,
- IStateUpdateListener, IJobChangeListener
+ IStateUpdateListener, IJobChangeListener
{
- public static final ViewerFilter[] EMPTY_FILTER_ARRAY = new ViewerFilter[0];
-
+ public static final ViewerFilter[] EMPTY_FILTER_ARRAY = new ViewerFilter[0];
+
private final ITreeModelViewer fViewer;
-
+
private IStatus fJobError;
-
+
private boolean fFailOnRedundantUpdates;
private boolean fFailOnRedundantLabelUpdates;
- private Set fRedundantUpdates = new HashSet();
- private Set fRedundantLabelUpdates = new HashSet();
- private Set fRedundantHasChildrenUpdateExceptions = new HashSet();
- private Set fRedundantChildCountUpdateExceptions = new HashSet();
- private Set fRedundantChildrenUpdateExceptions = new HashSet();
- private Set fRedundantLabelUpdateExceptions = new HashSet();
-
+ private Set<IViewerUpdate> fRedundantUpdates = new HashSet<IViewerUpdate>();
+ private Set<ILabelUpdate> fRedundantLabelUpdates = new HashSet<ILabelUpdate>();
+ private Set<TreePath> fRedundantHasChildrenUpdateExceptions = new HashSet<TreePath>();
+ private Set<TreePath> fRedundantChildCountUpdateExceptions = new HashSet<TreePath>();
+ private Set<TreePath> fRedundantChildrenUpdateExceptions = new HashSet<TreePath>();
+ private Set<TreePath> fRedundantLabelUpdateExceptions = new HashSet<TreePath>();
+
private boolean fFailOnMultipleModelUpdateSequences;
private boolean fFailOnMultipleLabelUpdateSequences;
-
- private Set fHasChildrenUpdatesScheduled = new HashSet();
- private Set fHasChildrenUpdatesRunning = new HashSet();
- private Set fHasChildrenUpdatesCompleted = new HashSet();
- private Map fChildrenUpdatesScheduled = new HashMap();
- private Set fChildrenUpdatesRunning = new HashSet();
- private Set fChildrenUpdatesCompleted = new HashSet();
- private Set fChildCountUpdatesScheduled = new HashSet();
- private Set fChildCountUpdatesRunning = new HashSet();
- private Set fChildCountUpdatesCompleted = new HashSet();
- private Set fLabelUpdates = new HashSet();
- private Set fLabelUpdatesRunning = new HashSet();
- private Set fLabelUpdatesCompleted = new HashSet();
- private Set fProxyModels = new HashSet();
- private Set fStateUpdates = new HashSet();
+
+ private Set<TreePath> fHasChildrenUpdatesScheduled = new HashSet<TreePath>();
+ private Set<IViewerUpdate> fHasChildrenUpdatesRunning = new HashSet<IViewerUpdate>();
+ private Set<IViewerUpdate> fHasChildrenUpdatesCompleted = new HashSet<IViewerUpdate>();
+ private Map<TreePath, Set<Integer>> fChildrenUpdatesScheduled = new HashMap<TreePath, Set<Integer>>();
+ private Set<IViewerUpdate> fChildrenUpdatesRunning = new HashSet<IViewerUpdate>();
+ private Set<IViewerUpdate> fChildrenUpdatesCompleted = new HashSet<IViewerUpdate>();
+ private Set<TreePath> fChildCountUpdatesScheduled = new HashSet<TreePath>();
+ private Set<IViewerUpdate> fChildCountUpdatesRunning = new HashSet<IViewerUpdate>();
+ private Set<IViewerUpdate> fChildCountUpdatesCompleted = new HashSet<IViewerUpdate>();
+ private Set<TreePath> fLabelUpdates = new HashSet<TreePath>();
+ private Set<ILabelUpdate> fLabelUpdatesRunning = new HashSet<ILabelUpdate>();
+ private Set<ILabelUpdate> fLabelUpdatesCompleted = new HashSet<ILabelUpdate>();
+ private Set<TestModel> fProxyModels = new HashSet<TestModel>();
+ private Set<TreePath> fStateUpdates = new HashSet<TreePath>();
private int fViewerUpdatesStarted = 0;
private int fViewerUpdatesComplete = 0;
private int fViewerUpdatesStartedAtReset;
@@ -100,8 +100,8 @@ public class TestModelUpdatesListener
private boolean fExpectRestoreAfterSaveComplete;
private RuntimeException fFailExpectation;
-
-
+
+
public TestModelUpdatesListener(ITreeModelViewer viewer, boolean failOnRedundantUpdates, boolean failOnMultipleModelUpdateSequences) {
this(viewer);
setFailOnRedundantUpdates(failOnRedundantUpdates);
@@ -124,19 +124,33 @@ public class TestModelUpdatesListener
fViewer.removeStateUpdateListener(this);
fViewer.removeViewerUpdateListener(this);
}
-
- public void aboutToRun(IJobChangeEvent event) {}
- public void awake(IJobChangeEvent event) {}
- public void running(IJobChangeEvent event) {}
- public void scheduled(IJobChangeEvent event) {}
- public void sleeping(IJobChangeEvent event) {}
- public void done(IJobChangeEvent event) {
- IStatus result = event.getJob().getResult();
+
+ @Override
+ public void aboutToRun(IJobChangeEvent event) {}
+
+ @Override
+ public void awake(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void running(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void scheduled(IJobChangeEvent event) {
+ }
+
+ @Override
+ public void sleeping(IJobChangeEvent event) {
+ }
+ @Override
+ public void done(IJobChangeEvent event) {
+ IStatus result = event.getJob().getResult();
if (result != null && result.getSeverity() == IStatus.ERROR) {
- fJobError = result;
+ fJobError = result;
}
}
-
+
public void setFailOnRedundantUpdates(boolean failOnRedundantUpdates) {
fFailOnRedundantUpdates = failOnRedundantUpdates;
}
@@ -152,19 +166,19 @@ public class TestModelUpdatesListener
public void setFailOnMultipleLabelUpdateSequences(boolean failOnMultipleLabelUpdateSequences) {
fFailOnMultipleLabelUpdateSequences = failOnMultipleLabelUpdateSequences;
}
-
+
public void expectRestoreAfterSaveComplete() {
fExpectRestoreAfterSaveComplete = true;
}
/**
- * Sets the the maximum amount of time (in milliseconds) that the update listener
- * is going to wait. If set to -1, the listener will wait indefinitely.
+ * Sets the the maximum amount of time (in milliseconds) that the update listener
+ * is going to wait. If set to -1, the listener will wait indefinitely.
*/
public void setTimeoutInterval(int milis) {
fTimeoutInterval = milis;
}
-
+
public void reset(TreePath path, TestElement element, int levels, boolean failOnRedundantUpdates, boolean failOnMultipleUpdateSequences) {
reset(path, element, EMPTY_FILTER_ARRAY, levels, failOnRedundantUpdates, failOnMultipleUpdateSequences);
}
@@ -220,11 +234,11 @@ public class TestModelUpdatesListener
fTimeoutTime = System.currentTimeMillis() + fTimeoutInterval;
resetModelChanged();
}
-
+
public void resetModelChanged() {
fModelChangedComplete = false;
}
-
+
public void addHasChildrenUpdate(TreePath path) {
fHasChildrenUpdatesScheduled.add(path);
}
@@ -242,16 +256,16 @@ public class TestModelUpdatesListener
}
public void addChildreUpdate(TreePath path, int index) {
- Set childrenIndexes = (Set)fChildrenUpdatesScheduled.get(path);
+ Set<Integer> childrenIndexes = fChildrenUpdatesScheduled.get(path);
if (childrenIndexes == null) {
- childrenIndexes = new TreeSet();
+ childrenIndexes = new TreeSet<Integer>();
fChildrenUpdatesScheduled.put(path, childrenIndexes);
}
childrenIndexes.add(new Integer(index));
}
public void removeChildrenUpdate(TreePath path, int index) {
- Set childrenIndexes = (Set)fChildrenUpdatesScheduled.get(path);
+ Set<?> childrenIndexes = fChildrenUpdatesScheduled.get(path);
if (childrenIndexes != null) {
childrenIndexes.remove(new Integer(index));
if (childrenIndexes.isEmpty()) {
@@ -271,7 +285,7 @@ public class TestModelUpdatesListener
public void addUpdates(TreePath path, TestElement element, int levels) {
addUpdates(null, path, element, EMPTY_FILTER_ARRAY, levels, ALL_UPDATES_COMPLETE );
}
-
+
public void addUpdates(TreePath path, TestElement element, ViewerFilter[] filters, int levels) {
addUpdates(null, path, element, filters, levels, ALL_UPDATES_COMPLETE );
}
@@ -279,7 +293,7 @@ public class TestModelUpdatesListener
public void addStateUpdates(IInternalTreeModelViewer viewer, TreePath path, TestElement element) {
addUpdates(viewer, path, element, -1, STATE_UPDATES);
}
-
+
public void addStateUpdates(IInternalTreeModelViewer viewer, IModelDelta pendingDelta, int deltaFlags) {
TreePath treePath = getViewerTreePath(pendingDelta);
if ( !TreePath.EMPTY.equals(treePath) && (pendingDelta.getFlags() & deltaFlags) != 0 ) {
@@ -288,9 +302,9 @@ public class TestModelUpdatesListener
IModelDelta[] childDeltas = pendingDelta.getChildDeltas();
for (int i = 0; i < childDeltas.length; i++) {
addStateUpdates(viewer, childDeltas[i], deltaFlags);
- }
+ }
}
-
+
public void addRedundantExceptionHasChildren(TreePath path) {
fRedundantHasChildrenUpdateExceptions.add(path);
}
@@ -306,43 +320,43 @@ public class TestModelUpdatesListener
public void addRedundantExceptionLabel(TreePath path) {
fRedundantLabelUpdateExceptions.add(path);
}
-
+
public boolean checkCoalesced(TreePath path, int offset, int length) {
- for (Iterator itr = fChildrenUpdatesCompleted.iterator(); itr.hasNext();) {
+ for (Iterator<IViewerUpdate> itr = fChildrenUpdatesCompleted.iterator(); itr.hasNext();) {
IChildrenUpdate update = (IChildrenUpdate)itr.next();
if (path.equals( update.getElementPath() ) &&
offset == update.getOffset() &&
- length == update.getLength())
+ length == update.getLength())
{
return true;
}
}
return false;
}
-
-
- public Set getHasChildrenUpdatesCompleted() {
+
+
+ public Set<IViewerUpdate> getHasChildrenUpdatesCompleted() {
return fHasChildrenUpdatesCompleted;
}
-
- public Set getChildCountUpdatesCompleted() {
+
+ public Set<IViewerUpdate> getChildCountUpdatesCompleted() {
return fChildCountUpdatesCompleted;
}
-
- public Set getChildrenUpdatesCompleted() {
+
+ public Set<IViewerUpdate> getChildrenUpdatesCompleted() {
return fChildrenUpdatesCompleted;
}
-
+
/**
* Returns a tree path for the node, *not* including the root element.
- *
+ *
* @param node
* model delta
* @return corresponding tree path
*/
private TreePath getViewerTreePath(IModelDelta node) {
- ArrayList list = new ArrayList();
+ ArrayList<Object> list = new ArrayList<Object>();
IModelDelta parentDelta = node.getParentDelta();
while (parentDelta != null) {
list.add(0, node.getElement());
@@ -359,7 +373,7 @@ public class TestModelUpdatesListener
public void addUpdates(IInternalTreeModelViewer viewer, TreePath path, TestElement element, int levels, int flags) {
addUpdates(viewer, path, element, EMPTY_FILTER_ARRAY, levels, flags);
}
-
+
public static boolean isFiltered(Object element, ViewerFilter[] filters) {
for (int i = 0; i < filters.length; i++) {
if (!filters[i].select(null, null, element)) {
@@ -368,12 +382,12 @@ public class TestModelUpdatesListener
}
return false;
}
-
+
public void addUpdates(IInternalTreeModelViewer viewer, TreePath path, TestElement element, ViewerFilter[] filters, int levels, int flags) {
if (isFiltered(path.getLastSegment(), filters)) {
return;
}
-
+
if (!path.equals(TreePath.EMPTY)) {
if ((flags & LABEL_UPDATES) != 0) {
fLabelUpdates.add(path);
@@ -381,7 +395,7 @@ public class TestModelUpdatesListener
if ((flags & HAS_CHILDREN_UPDATES) != 0) {
fHasChildrenUpdatesScheduled.add(path);
}
-
+
if ((flags & STATE_UPDATES) != 0) {
fStateUpdates.add(path);
}
@@ -394,7 +408,7 @@ public class TestModelUpdatesListener
fChildCountUpdatesScheduled.add(path);
}
if ((flags & CHILDREN_UPDATES) != 0) {
- Set childrenIndexes = new HashSet();
+ Set<Integer> childrenIndexes = new HashSet<Integer>();
for (int i = 0; i < children.length; i++) {
if (!isFiltered(children[i], filters)) {
childrenIndexes.add(new Integer(i));
@@ -407,7 +421,7 @@ public class TestModelUpdatesListener
addUpdates(viewer, path.createChildPath(children[i]), children[i], filters, levels, flags);
}
}
-
+
}
}
@@ -421,24 +435,24 @@ public class TestModelUpdatesListener
addProxies(children[i]);
}
}
-
+
public boolean isFinished() {
return isFinished(ALL_UPDATES_COMPLETE);
}
-
+
public boolean isTimedOut() {
return fTimeoutInterval > 0 && fTimeoutTime < System.currentTimeMillis();
}
-
+
public boolean isFinished(int flags) {
if (isTimedOut()) {
throw new RuntimeException("Timed Out: " + toString(flags)); //$NON-NLS-1$
}
-
+
if (fFailExpectation != null) {
throw fFailExpectation;
}
-
+
if (fJobError != null) {
throw new RuntimeException("Job Error: " + fJobError); //$NON-NLS-1$
}
@@ -448,7 +462,7 @@ public class TestModelUpdatesListener
}
if (fFailOnRedundantLabelUpdates && !fRedundantLabelUpdates.isEmpty()) {
Assert.fail("Redundant Label Updates: " + fRedundantLabelUpdates.toString()); //$NON-NLS-1$
- }
+ }
if (fFailOnMultipleLabelUpdateSequences && fLabelUpdatesComplete > (fLabelUpdatesCompleteAtReset + 1)) {
Assert.fail("Multiple label update sequences detected"); //$NON-NLS-1$
}
@@ -458,57 +472,91 @@ public class TestModelUpdatesListener
if ( (flags & LABEL_SEQUENCE_COMPLETE) != 0) {
if (fLabelUpdatesComplete == fLabelUpdatesCompleteAtReset ||
- fLabelUpdatesComplete != fLabelUpdatesStarted) return false;
+ fLabelUpdatesComplete != fLabelUpdatesStarted) {
+ return false;
+ }
}
if ( (flags & LABEL_SEQUENCE_STARTED) != 0) {
- if (fLabelUpdatesStarted == fLabelUpdatesStartedAtReset) return false;
+ if (fLabelUpdatesStarted == fLabelUpdatesStartedAtReset) {
+ return false;
+ }
}
if ( (flags & LABEL_UPDATES) != 0) {
- if (!fLabelUpdates.isEmpty()) return false;
+ if (!fLabelUpdates.isEmpty()) {
+ return false;
+ }
}
if ( (flags & CONTENT_SEQUENCE_STARTED) != 0) {
- if (fViewerUpdatesStarted == fViewerUpdatesStartedAtReset) return false;
+ if (fViewerUpdatesStarted == fViewerUpdatesStartedAtReset) {
+ return false;
+ }
}
if ( (flags & CONTENT_SEQUENCE_COMPLETE) != 0) {
- if (fViewerUpdatesComplete == fViewerUpdatesCompleteAtReset ||
- fViewerUpdatesStarted != fViewerUpdatesComplete) return false;
+ if (fViewerUpdatesComplete == fViewerUpdatesCompleteAtReset ||
+ fViewerUpdatesStarted != fViewerUpdatesComplete) {
+ return false;
+ }
}
if ( (flags & HAS_CHILDREN_UPDATES_STARTED) != 0) {
- if (fHasChildrenUpdatesRunning.isEmpty() && fHasChildrenUpdatesCompleted.isEmpty()) return false;
+ if (fHasChildrenUpdatesRunning.isEmpty() && fHasChildrenUpdatesCompleted.isEmpty()) {
+ return false;
+ }
}
if ( (flags & HAS_CHILDREN_UPDATES) != 0) {
- if (!fHasChildrenUpdatesScheduled.isEmpty()) return false;
+ if (!fHasChildrenUpdatesScheduled.isEmpty()) {
+ return false;
+ }
}
if ( (flags & CHILD_COUNT_UPDATES_STARTED) != 0) {
- if (fChildCountUpdatesRunning.isEmpty() && fChildCountUpdatesCompleted.isEmpty()) return false;
+ if (fChildCountUpdatesRunning.isEmpty() && fChildCountUpdatesCompleted.isEmpty()) {
+ return false;
+ }
}
if ( (flags & CHILD_COUNT_UPDATES) != 0) {
- if (!fChildCountUpdatesScheduled.isEmpty()) return false;
+ if (!fChildCountUpdatesScheduled.isEmpty()) {
+ return false;
+ }
}
if ( (flags & CHILDREN_UPDATES_STARTED) != 0) {
// Some children updates have already been started or completed.
- if (fChildrenUpdatesRunning.isEmpty() && fChildrenUpdatesCompleted.isEmpty()) return false;
+ if (fChildrenUpdatesRunning.isEmpty() && fChildrenUpdatesCompleted.isEmpty()) {
+ return false;
+ }
}
if ( (flags & CHILDREN_UPDATES_RUNNING) != 0) {
- if (!isFinishedChildrenRunning()) return false;
+ if (!isFinishedChildrenRunning()) {
+ return false;
+ }
}
if ( (flags & CHILDREN_UPDATES) != 0) {
- if (!fChildrenUpdatesScheduled.isEmpty()) return false;
+ if (!fChildrenUpdatesScheduled.isEmpty()) {
+ return false;
+ }
}
if ( (flags & MODEL_CHANGED_COMPLETE) != 0) {
- if (!fModelChangedComplete) return false;
+ if (!fModelChangedComplete) {
+ return false;
+ }
}
if ( (flags & STATE_SAVE_COMPLETE) != 0) {
- if (!fStateSaveComplete) return false;
+ if (!fStateSaveComplete) {
+ return false;
+ }
}
if ( (flags & STATE_SAVE_STARTED) != 0) {
- if (!fStateSaveStarted) return false;
+ if (!fStateSaveStarted) {
+ return false;
+ }
}
if ( (flags & STATE_RESTORE_COMPLETE) != 0) {
- if (!fStateRestoreComplete) return false;
+ if (!fStateRestoreComplete) {
+ return false;
+ }
}
if ( (flags & STATE_RESTORE_STARTED) != 0) {
- if (!fStateRestoreStarted) return false;
+ if (!fStateRestoreStarted) {
+ return false;
+ }
}
if ( (flags & STATE_UPDATES) != 0) {
if (!fStateUpdates.isEmpty()) {
@@ -516,7 +564,9 @@ public class TestModelUpdatesListener
}
}
if ( (flags & MODEL_PROXIES_INSTALLED) != 0) {
- if (fProxyModels.size() != 0) return false;
+ if (fProxyModels.size() != 0) {
+ return false;
+ }
}
if ( (flags & VIEWER_UPDATES_RUNNING) != 0) {
if (fViewerUpdatesCounter != 0) {
@@ -528,43 +578,48 @@ public class TestModelUpdatesListener
return false;
}
}
-
+
return true;
}
/**
- * Returns true if all children updates that were scheduled are either currently
+ * Returns true if all children updates that were scheduled are either currently
* running or have already completed.
- *
+ *
* @see CHILDREN_UPDATES_RUNNING
* @return
*/
private boolean isFinishedChildrenRunning() {
// All children updates that have been scheduled are either running or completed.
int scheduledCount = 0;
- for (Iterator itr = fChildrenUpdatesScheduled.values().iterator(); itr.hasNext();) {
- scheduledCount += ((Set)itr.next()).size();
+ for (Iterator<Set<Integer>> itr = fChildrenUpdatesScheduled.values().iterator(); itr.hasNext();) {
+ scheduledCount += ((Set<?>) itr.next()).size();
}
-
+
int runningCount = 0;
- for (Iterator itr = fChildrenUpdatesRunning.iterator(); itr.hasNext();) {
+ for (Iterator<IViewerUpdate> itr = fChildrenUpdatesRunning.iterator(); itr.hasNext();) {
IChildrenUpdate update = ((IChildrenUpdate)itr.next());
- Set set = (Set)fChildrenUpdatesScheduled.get( update.getElementPath() );
+ Set<?> set = fChildrenUpdatesScheduled.get(update.getElementPath());
for (int i = update.getOffset(); set != null && i < update.getOffset() + update.getLength(); i++) {
- if (set.contains(new Integer(i))) runningCount++;
+ if (set.contains(new Integer(i))) {
+ runningCount++;
+ }
}
}
- for (Iterator itr = fChildrenUpdatesCompleted.iterator(); itr.hasNext();) {
+ for (Iterator<IViewerUpdate> itr = fChildrenUpdatesCompleted.iterator(); itr.hasNext();) {
IChildrenUpdate update = ((IChildrenUpdate)itr.next());
- Set set = (Set)fChildrenUpdatesScheduled.get( update.getElementPath() );
+ Set<?> set = fChildrenUpdatesScheduled.get(update.getElementPath());
for (int i = update.getOffset(); set != null && i < update.getOffset() + update.getLength(); i++) {
- if (set.contains(new Integer(i))) runningCount++;
+ if (set.contains(new Integer(i))) {
+ runningCount++;
+ }
}
}
return scheduledCount == runningCount;
}
-
- public void updateStarted(IViewerUpdate update) {
+
+ @Override
+ public void updateStarted(IViewerUpdate update) {
synchronized (this) {
fViewerUpdatesCounter++;
if (update instanceof IHasChildrenUpdate) {
@@ -573,11 +628,12 @@ public class TestModelUpdatesListener
fChildCountUpdatesRunning.add(update);
} else if (update instanceof IChildrenUpdate) {
fChildrenUpdatesRunning.add(update);
- }
+ }
}
}
-
- public void updateComplete(IViewerUpdate update) {
+
+ @Override
+ public void updateComplete(IViewerUpdate update) {
synchronized (this) {
fViewerUpdatesCounter--;
}
@@ -586,30 +642,30 @@ public class TestModelUpdatesListener
TreePath updatePath = update.getElementPath();
if (update instanceof IHasChildrenUpdate) {
fHasChildrenUpdatesRunning.remove(update);
- fHasChildrenUpdatesCompleted.add(update);
+ fHasChildrenUpdatesCompleted.add(update);
if (!fHasChildrenUpdatesScheduled.remove(updatePath) &&
- fFailOnRedundantUpdates &&
- fRedundantHasChildrenUpdateExceptions.contains(updatePath))
+ fFailOnRedundantUpdates &&
+ fRedundantHasChildrenUpdateExceptions.contains(updatePath))
{
fRedundantUpdates.add(update);
}
} if (update instanceof IChildrenCountUpdate) {
fChildCountUpdatesRunning.remove(update);
- fChildCountUpdatesCompleted.add(update);
+ fChildCountUpdatesCompleted.add(update);
if (!fChildCountUpdatesScheduled.remove(updatePath) &&
fFailOnRedundantUpdates &&
- !fRedundantChildCountUpdateExceptions.contains(updatePath))
+ !fRedundantChildCountUpdateExceptions.contains(updatePath))
{
fRedundantUpdates.add(update);
}
} else if (update instanceof IChildrenUpdate) {
fChildrenUpdatesRunning.remove(update);
- fChildrenUpdatesCompleted.add(update);
-
+ fChildrenUpdatesCompleted.add(update);
+
int start = ((IChildrenUpdate)update).getOffset();
int end = start + ((IChildrenUpdate)update).getLength();
-
- Set childrenIndexes = (Set)fChildrenUpdatesScheduled.get(updatePath);
+
+ Set<?> childrenIndexes = fChildrenUpdatesScheduled.get(updatePath);
if (childrenIndexes != null) {
for (int i = start; i < end; i++) {
childrenIndexes.remove(new Integer(i));
@@ -620,97 +676,110 @@ public class TestModelUpdatesListener
} else if (fFailOnRedundantUpdates && fRedundantChildrenUpdateExceptions.contains(updatePath)) {
fRedundantUpdates.add(update);
}
- }
+ }
}
}
-
- public void viewerUpdatesBegin() {
+
+ @Override
+ public void viewerUpdatesBegin() {
if (fViewerUpdatesStarted > fViewerUpdatesComplete) {
fFailExpectation = new RuntimeException("Unmatched updatesStarted/updateCompleted notifications observed."); //$NON-NLS-1$
}
fViewerUpdatesStarted++;
}
-
- public void viewerUpdatesComplete() {
+
+ @Override
+ public void viewerUpdatesComplete() {
if (fViewerUpdatesStarted <= fViewerUpdatesComplete) {
fFailExpectation = new RuntimeException("Unmatched updatesStarted/updateCompleted notifications observed."); //$NON-NLS-1$
}
fViewerUpdatesComplete++;
}
- public void labelUpdateComplete(ILabelUpdate update) {
+ @Override
+ public void labelUpdateComplete(ILabelUpdate update) {
fLabelUpdatesRunning.remove(update);
fLabelUpdatesCompleted.add(update);
fLabelUpdatesCounter--;
- if (!fLabelUpdates.remove(update.getElementPath()) &&
- fFailOnRedundantLabelUpdates &&
- !fRedundantLabelUpdateExceptions.contains(update.getElementPath()))
+ if (!fLabelUpdates.remove(update.getElementPath()) &&
+ fFailOnRedundantLabelUpdates &&
+ !fRedundantLabelUpdateExceptions.contains(update.getElementPath()))
{
fRedundantLabelUpdates.add(update);
Assert.fail("Redundant update: " + update); //$NON-NLS-1$
}
}
- public void labelUpdateStarted(ILabelUpdate update) {
+ @Override
+ public void labelUpdateStarted(ILabelUpdate update) {
fLabelUpdatesRunning.add(update);
fLabelUpdatesCounter++;
}
- public void labelUpdatesBegin() {
+ @Override
+ public void labelUpdatesBegin() {
if (fLabelUpdatesStarted > fLabelUpdatesComplete) {
fFailExpectation = new RuntimeException("Unmatched labelUpdatesStarted/labelUpdateCompleted notifications observed."); //$NON-NLS-1$
}
fLabelUpdatesStarted++;
}
- public void labelUpdatesComplete() {
+ @Override
+ public void labelUpdatesComplete() {
if (fLabelUpdatesStarted <= fLabelUpdatesComplete) {
fFailExpectation = new RuntimeException("Unmatched labelUpdatesStarted/labelUpdateCompleted notifications observed."); //$NON-NLS-1$
}
fLabelUpdatesComplete++;
}
-
- public void modelChanged(IModelDelta delta, IModelProxy proxy) {
+
+ @Override
+ public void modelChanged(IModelDelta delta, IModelProxy proxy) {
fModelChangedComplete = true;
- for (Iterator itr = fProxyModels.iterator(); itr.hasNext();) {
- TestModel model = (TestModel)itr.next();
+ for (Iterator<TestModel> itr = fProxyModels.iterator(); itr.hasNext();) {
+ TestModel model = itr.next();
if (model.getModelProxy() == proxy) {
itr.remove();
break;
}
}
}
-
- public void stateRestoreUpdatesBegin(Object input) {
+
+ @Override
+ public void stateRestoreUpdatesBegin(Object input) {
if (fExpectRestoreAfterSaveComplete && !fStateSaveComplete) {
fFailExpectation = new RuntimeException("RESTORE should begin after SAVE completed!"); //$NON-NLS-1$
}
fStateRestoreStarted = true;
}
-
- public void stateRestoreUpdatesComplete(Object input) {
+
+ @Override
+ public void stateRestoreUpdatesComplete(Object input) {
Assert.assertFalse("RESTORE STATE already complete!", fStateRestoreComplete); //$NON-NLS-1$
fStateRestoreComplete = true;
}
-
- public void stateSaveUpdatesBegin(Object input) {
+
+ @Override
+ public void stateSaveUpdatesBegin(Object input) {
fStateSaveStarted = true;
}
- public void stateSaveUpdatesComplete(Object input) {
+ @Override
+ public void stateSaveUpdatesComplete(Object input) {
fStateSaveComplete = true;
}
-
- public void stateUpdateComplete(Object input, IViewerUpdate update) {
+
+ @Override
+ public void stateUpdateComplete(Object input, IViewerUpdate update) {
if ( !(update instanceof ElementCompareRequest) || ((ElementCompareRequest)update).isEqual()) {
fStateUpdates.remove(update.getElementPath());
- }
+ }
}
-
- public void stateUpdateStarted(Object input, IViewerUpdate update) {
+
+ @Override
+ public void stateUpdateStarted(Object input, IViewerUpdate update) {
}
-
+
private String toString(int flags) {
StringBuffer buf = new StringBuffer("Viewer Update Listener"); //$NON-NLS-1$
@@ -725,7 +794,7 @@ public class TestModelUpdatesListener
}
}
}
-
+
if (fFailOnRedundantUpdates) {
buf.append("\n\t"); //$NON-NLS-1$
buf.append("fRedundantUpdates = " + fRedundantUpdates); //$NON-NLS-1$
@@ -832,34 +901,34 @@ public class TestModelUpdatesListener
return buf.toString();
}
- private String toString(Set set) {
+ private String toString(Set<TreePath> set) {
if (set.isEmpty()) {
return "(EMPTY)"; //$NON-NLS-1$
}
StringBuffer buf = new StringBuffer();
- for (Iterator itr = set.iterator(); itr.hasNext(); ) {
+ for (Iterator<TreePath> itr = set.iterator(); itr.hasNext();) {
buf.append("\n\t\t"); //$NON-NLS-1$
- buf.append(toString((TreePath)itr.next()));
+ buf.append(toString(itr.next()));
}
return buf.toString();
}
-
- private String toString(Map map) {
+
+ private String toString(Map<TreePath, Set<Integer>> map) {
if (map.isEmpty()) {
return "(EMPTY)"; //$NON-NLS-1$
}
StringBuffer buf = new StringBuffer();
- for (Iterator itr = map.keySet().iterator(); itr.hasNext(); ) {
+ for (Iterator<TreePath> itr = map.keySet().iterator(); itr.hasNext();) {
buf.append("\n\t\t"); //$NON-NLS-1$
- TreePath path = (TreePath)itr.next();
+ TreePath path = itr.next();
buf.append(toString(path));
- Set updates = (Set)map.get(path);
+ Set<?> updates = map.get(path);
buf.append(" = "); //$NON-NLS-1$
buf.append(updates.toString());
}
return buf.toString();
}
-
+
private String toString(TreePath path) {
if (path.getSegmentCount() == 0) {
return "/"; //$NON-NLS-1$
@@ -871,12 +940,13 @@ public class TestModelUpdatesListener
}
return buf.toString();
}
-
- public String toString() {
+
+ @Override
+ public String toString() {
return toString(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE | STATE_SAVE_COMPLETE | STATE_RESTORE_COMPLETE | ALL_VIEWER_UPDATES_STARTED | LABEL_SEQUENCE_STARTED | STATE_UPDATES);
}
-
-
+
+
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java
index 5d70a64c4..af897a4fd 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreeModelViewerAutopopulateAgent.java
@@ -1,12 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2009, 2010 Wind River Systems and others.
+ * Copyright (c) 2009, 2013 Wind River Systems 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
* http://www.eclipse.org/legal/epl-v10.html
- *
+ *
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -24,28 +25,29 @@ import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swt.widgets.Widget;
/**
- *
+ *
*/
public class TreeModelViewerAutopopulateAgent implements IViewerUpdateListener {
private TreeModelViewer fViewer;
-
-
+
+
public TreeModelViewerAutopopulateAgent(TreeModelViewer viewer) {
fViewer = viewer;
fViewer.addViewerUpdateListener(this);
}
-
+
public void dispose() {
fViewer.removeViewerUpdateListener(this);
fViewer = null;
}
-
- public void updateComplete(IViewerUpdate update) {
+
+ @Override
+ public void updateComplete(IViewerUpdate update) {
if (update instanceof IChildrenCountUpdate) {
TreePath path = update.getElementPath();
- ILazyTreePathContentProvider contentProvider = (ILazyTreePathContentProvider) fViewer.getContentProvider();
-
+ ILazyTreePathContentProvider contentProvider = (ILazyTreePathContentProvider) fViewer.getContentProvider();
+
Widget[] items = fViewer.testFindItems(update.getElement());
for (int i = 0; i < items.length; i++) {
if ( path.equals(getTreePath(items[i])) ) {
@@ -58,25 +60,28 @@ public class TreeModelViewerAutopopulateAgent implements IViewerUpdateListener {
}
}
- public void updateStarted(IViewerUpdate update) {
+ @Override
+ public void updateStarted(IViewerUpdate update) {
// TODO Auto-generated method stub
}
- public void viewerUpdatesBegin() {
+ @Override
+ public void viewerUpdatesBegin() {
// TODO Auto-generated method stub
}
- public void viewerUpdatesComplete() {
+ @Override
+ public void viewerUpdatesComplete() {
// TODO Auto-generated method stub
}
-
+
private TreePath getTreePath(Widget w) {
if (w instanceof TreeItem) {
TreeItem item = (TreeItem)w;
- LinkedList segments = new LinkedList();
+ LinkedList<Object> segments = new LinkedList<Object>();
while (item != null) {
Object segment = item.getData();
Assert.isNotNull(segment);
@@ -95,5 +100,5 @@ public class TreeModelViewerAutopopulateAgent implements IViewerUpdateListener {
return ((TreeItem)w).getItemCount();
}
return 0;
- }
+ }
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreePathWrapper.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreePathWrapper.java
index bac73a857..06bc29911 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreePathWrapper.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreePathWrapper.java
@@ -27,16 +27,19 @@ public class TreePathWrapper {
fPath = path;
}
- public int hashCode() {
+ @Override
+ public int hashCode() {
return fPath.hashCode();
}
- public boolean equals(Object obj) {
+ @Override
+ public boolean equals(Object obj) {
return obj instanceof TreePathWrapper &&
fPath.equals( ((TreePathWrapper)obj).fPath );
}
- public String toString() {
+ @Override
+ public String toString() {
if (fPath.getSegmentCount() == 0) {
return "TreePath:EMPTY"; //$NON-NLS-1$
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
index 2af970dc6..bf9682368 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.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 - bug fixing
@@ -35,9 +35,9 @@ import org.eclipse.ui.PlatformUI;
import org.junit.Assert;
/**
- * Tests to verify that the viewer property updates following changes in the
- * model, following simple content update deltas from the model.
- *
+ * Tests to verify that the viewer property updates following changes in the
+ * model, following simple content update deltas from the model.
+ *
* @since 3.6
*/
abstract public class UpdateTests extends TestCase implements ITestModelUpdatesListenerConstants {
@@ -45,7 +45,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
Shell fShell;
ITreeModelViewer fViewer;
TestModelUpdatesListener fListener;
-
+
public UpdateTests(String name) {
super(name);
}
@@ -53,28 +53,30 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
/**
* @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 ITreeModelViewer 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()) {
@@ -84,14 +86,15 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
}
- 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$
}
}
-
+
/**
* This test:
* - creates a simple model
@@ -103,7 +106,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
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());
@@ -113,7 +116,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
// Update the model
TestElement root = model.getRootElement();
TreePath rootPath = new TreePath(new Object[] {});
@@ -123,13 +126,13 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
new TestElement(model, "3", new TestElement[0]), //$NON-NLS-1$
};
model.setElementChildren(rootPath, newElements);
-
+
// Reset the listener to NOT fail on redundant updates.
- // When elements are remvoed from the model and the model is
- // refreshed the viewer will issue an IChildrenUpdate for the
+ // When elements are remvoed from the model and the model is
+ // refreshed the viewer will issue an IChildrenUpdate for the
// missing elements as an optimization.
fListener.reset(rootPath, root, -1, false, false);
-
+
model.postDelta(new ModelDelta(root, IModelDelta.CONTENT));
while (!fListener.isFinished()) {
if (!fDisplay.readAndDispatch ()) {
@@ -140,7 +143,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
/**
- * This test:
+ * This test:
* - creates a simple model
* - sets a list of children to one of the elements
* - refreshes the viewer
@@ -150,7 +153,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
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());
@@ -160,7 +163,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
// Update the model
TestElement element = model.getRootElement().getChildren()[0];
TreePath elementPath = new TreePath(new Object[] { element });
@@ -171,12 +174,12 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
};
model.setElementChildren(elementPath, newChildren);
- // Reset the viewer to ignore redundant updates. The '1' element
- // will be updated for "hasChildren" before it is expanded, which is
+ // Reset the viewer to ignore redundant updates. The '1' element
+ // will be updated for "hasChildren" before it is expanded, which is
// expected.
TreePath rootPath = TreePath.EMPTY;
TestElement rootElement = model.getRootElement();
- fListener.reset(rootPath, rootElement, -1, false, false);
+ fListener.reset(rootPath, rootElement, -1, false, false);
// Refresh the viewer
model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
@@ -188,10 +191,10 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
model.validateData(fViewer, TreePath.EMPTY);
}
-
+
private void removeElement(TestModel model, int index, boolean validate) throws InterruptedException {
ModelDelta delta = model.removeElementChild(TreePath.EMPTY, index);
-
+
// Remove delta should generate no new updates, but we still need to wait for the event to
// be processed.
fListener.reset();
@@ -203,25 +206,25 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
if (validate) {
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
}
}
-
+
private void addElement(TestModel model, String label, int position, boolean validate) throws InterruptedException {
ModelDelta delta = model.addElementChild(TreePath.EMPTY, null, position, new TestElement(model, label, new TestElement[0]));
-
+
// Remove delta should generate no new updates, but we still need to wait for the event to
// be processed.
fListener.reset();
model.postDelta(delta);
-
+
if (validate) {
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
} else {
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -233,19 +236,19 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
private void insertElement(TestModel model, String label, int position, boolean validate) throws InterruptedException {
ModelDelta delta = model.insertElementChild(TreePath.EMPTY, position, new TestElement(model, label, new TestElement[0]));
-
+
// Remove delta should generate no new updates, but we still need to wait for the event to
// be processed.
fListener.reset();
model.postDelta(delta);
-
+
if (validate) {
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
} else {
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -262,7 +265,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -272,7 +275,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
// Update the model
removeElement(model, 2, true);
addElement(model, "3-new", 3, true); //$NON-NLS-1$
@@ -285,8 +288,8 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
/**
- * This test verifies that when the viewer processes a delta that causes viewer
- * updates it initiates the model update sequence before it finishes processing
+ * This test verifies that when the viewer processes a delta that causes viewer
+ * updates it initiates the model update sequence before it finishes processing
* the delta.
*/
public void testNotifyUpdatesTartedOnModelChanged() throws InterruptedException {
@@ -294,7 +297,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -308,30 +311,30 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Refresh the viewer so that updates are generated.
fListener.reset();
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
Assert.assertTrue( fListener.isFinished(CONTENT_SEQUENCE_STARTED) );
}
/**
- * This test case attempts to create a race condition between processing
- * of the content updates and processing of add/remove model deltas.
+ * This test case attempts to create a race condition between processing
+ * of the content updates and processing of add/remove model deltas.
* <br>
- * See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
+ * See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
*/
public void testContentPlusAddRemoveUpdateRaceConditionsElement() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -342,12 +345,12 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
model.validateData(fViewer, TreePath.EMPTY);
- // Create a listener to listen only to a children count update for the root.
+ // Create a listener to listen only to a children count update for the root.
TestModelUpdatesListener childrenCountUpdateListener = new TestModelUpdatesListener(fViewer, false, false);
-
+
for (int i = 0; i < 10; i++) {
String pass = "pass #" + i; //$NON-NLS-1$
-
+
// Request a content update for view
childrenCountUpdateListener.reset();
childrenCountUpdateListener.addChildreCountUpdate(TreePath.EMPTY);
@@ -358,7 +361,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
Thread.sleep(0);
}
}
-
+
removeElement(model, 5, false);
removeElement(model, 4, false);
removeElement(model, 3, false);
@@ -366,46 +369,46 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
removeElement(model, 1, false);
removeElement(model, 0, false);
- // Wait until the children count update is completed using the count from
+ // Wait until the children count update is completed using the count from
// before elements were removed.
while (!childrenCountUpdateListener.isFinished(CHILD_COUNT_UPDATES)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
insertElement(model, "1 - " + pass, 0, false); //$NON-NLS-1$
insertElement(model, "2 - " + pass, 1, false); //$NON-NLS-1$
insertElement(model, "3 - " + pass, 2, false); //$NON-NLS-1$
insertElement(model, "4 - " + pass, 3, false); //$NON-NLS-1$
insertElement(model, "5 - " + pass, 4, false); //$NON-NLS-1$
insertElement(model, "6 - " + pass, 5, false); //$NON-NLS-1$
-
+
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
}
-
+
childrenCountUpdateListener.dispose();
}
/**
- * This test case attempts to create a race condition between processing
- * of the content updates and processing of add/remove model deltas.
+ * This test case attempts to create a race condition between processing
+ * of the content updates and processing of add/remove model deltas.
* <br>
- * See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
+ * See <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=304066">bug 304066</a>
*/
public void testInsertAtInvalidIndex() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -421,7 +424,8 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
ModelDelta delta = model.insertElementChild(TreePath.EMPTY, insertIndex, new TestElement(model, "last - invalid index", new TestElement[0])); //$NON-NLS-1$
// Change insert index to out of range
delta.accept(new IModelDeltaVisitor() {
-
+
+ @Override
public boolean visit(IModelDelta visitorDelta, int depth) {
if ((visitorDelta.getFlags() & IModelDelta.INSERTED) != 0) {
((ModelDelta)visitorDelta).setIndex(insertIndex + 1);
@@ -430,20 +434,20 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
return true;
}
});
-
+
// Remove delta should generate no new updates, but we still need to wait for the event to
// be processed.
fListener.reset();
model.postDelta(delta);
-
+
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
- model.validateData(fViewer, TreePath.EMPTY);
+ model.validateData(fViewer, TreePath.EMPTY);
}
-
+
/**
* This test forces the viewer to reschedule pending content updates
* due to a remove event from the model.
@@ -454,7 +458,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -471,14 +475,14 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fListener.reset();
fListener.addUpdates(TreePath.EMPTY, model.getRootElement(), 1, CHILD_COUNT_UPDATES);
model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES | CHILDREN_UPDATES_STARTED)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
// Update the model
removeElement(model, 0, true);
addElement(model, "1", 0, true); //$NON-NLS-1$
@@ -497,7 +501,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -508,32 +512,32 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
model.setQeueueingUpdate(true);
-
+
for (int i = 0; i < 5; i++) {
// Refresh the viewer so that updates are generated.
fListener.reset();
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES_STARTED)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
}
-
+
model.setQeueueingUpdate(false);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
}
-
+
/**
* This test forces the viewer to cancel updates then process them at once.
* <p>
@@ -546,7 +550,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -557,29 +561,29 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
model.setQeueueingUpdate(true);
-
+
for (int i = 0; i < 5; i++) {
// Refresh the viewer so that updates are generated.
fListener.reset();
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES_STARTED)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
}
-
- List updates = new ArrayList(model.getQueuedUpdates());
+
+ ArrayList<IViewerUpdate> updates = new ArrayList<IViewerUpdate>(model.getQueuedUpdates());
model.getQueuedUpdates().clear();
for (int i = updates.size() - 1; i >= 0; i--) {
- model.processUpdate((IViewerUpdate)updates.get(i));
+ model.processUpdate(updates.get(i));
}
-
+
model.setQeueueingUpdate(false);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -587,7 +591,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
}
}
-
+
/**
* This test forces the viewer to cancel updates then process them at once.
* <p>
@@ -600,7 +604,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -611,14 +615,14 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
model.setQeueueingUpdate(true);
-
+
for (int i = 0; i < 5; i++) {
// Refresh the viewer so that updates are generated.
fListener.reset();
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES_STARTED)) {
completeQueuedUpdatesOfType(model, IChildrenCountUpdate.class);
@@ -628,16 +632,16 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
}
}
-
+
model.setQeueueingUpdate(false);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
}
-
+
/**
* This test forces the viewer to cancel updates then process them at once.
* <p>
@@ -650,7 +654,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -661,14 +665,14 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
model.validateData(fViewer, TreePath.EMPTY);
-
+
model.setQeueueingUpdate(true);
-
+
for (int i = 0; i < 5; i++) {
// Refresh the viewer so that updates are generated.
fListener.reset();
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES_STARTED)) {
completeQueuedUpdatesOfType(model, IChildrenCountUpdate.class);
@@ -677,15 +681,15 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
Thread.sleep(0);
}
}
-
+
}
-
- List updates = new ArrayList(model.getQueuedUpdates());
+
+ ArrayList<IViewerUpdate> updates = new ArrayList<IViewerUpdate>(model.getQueuedUpdates());
model.getQueuedUpdates().clear();
for (int i = updates.size() - 1; i >= 0; i--) {
- model.processUpdate((IViewerUpdate)updates.get(i));
+ model.processUpdate(updates.get(i));
}
-
+
model.setQeueueingUpdate(false);
while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -693,9 +697,9 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
}
}
-
+
/**
- * This test removes an element while there are updates running on its
+ * This test removes an element while there are updates running on its
* sub-tree. With a precise timing this operation caused Bug 373790.
* <p>
* See Bug 373790 - Debug view stays busy after Resume
@@ -707,7 +711,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -724,7 +728,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fListener.addUpdates(path, model.getElement(path), 1, CHILD_COUNT_UPDATES);
fListener.addChildreUpdate(path, 0);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed and child updates for "2" to get started.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES | CHILDREN_UPDATES_RUNNING)) {
if (!fDisplay.readAndDispatch ()) {
@@ -734,7 +738,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Remove element "2"
removeElement(model, 1, true);
-
+
// Wait for all updates to finish.
while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
if (!fDisplay.readAndDispatch ()) {
@@ -755,7 +759,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -767,19 +771,19 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
model.validateData(fViewer, TreePath.EMPTY);
model.setQeueueingUpdate(false);
-
+
// Refresh the viewer so that updates are generated.
fListener.reset();
fListener.addChildreCountUpdate(TreePath.EMPTY);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
TestModel model2 = new TestModel();
model2.setRoot(new TestElement(model2, "root", new TestElement[0])); //$NON-NLS-1$
fViewer.setInput(model2.getRootElement());
@@ -789,7 +793,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
Thread.sleep(0);
}
}
-
+
}
/**
@@ -804,7 +808,7 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fViewer.setAutoExpandLevel(-1);
// Create the listener
- fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
+ fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
@@ -816,19 +820,19 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
model.validateData(fViewer, TreePath.EMPTY);
model.setQeueueingUpdate(false);
-
+
// Refresh the viewer so that updates are generated.
fListener.reset();
fListener.addChildreCountUpdate(TreePath.EMPTY);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
-
+
// Wait for the delta to be processed.
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES)) {
if (!fDisplay.readAndDispatch ()) {
Thread.sleep(0);
}
}
-
+
fViewer.setInput(null);
while (!fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING)) {
@@ -836,24 +840,24 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
Thread.sleep(0);
}
}
-
+
}
-
- private void completeQueuedUpdatesOfType(TestModel model, Class updateClass) {
- List updatesToComplete = new LinkedList();
-
- for (Iterator itr = model.getQueuedUpdates().iterator(); itr.hasNext();) {
- IViewerUpdate update = (IViewerUpdate)itr.next();
+
+ private void completeQueuedUpdatesOfType(TestModel model, Class<?> updateClass) {
+ List<IViewerUpdate> updatesToComplete = new LinkedList<IViewerUpdate>();
+
+ for (Iterator<IViewerUpdate> itr = model.getQueuedUpdates().iterator(); itr.hasNext();) {
+ IViewerUpdate update = itr.next();
if (updateClass.isInstance(update)) {
updatesToComplete.add(update);
itr.remove();
}
- }
+ }
if (updatesToComplete != null) {
- for (Iterator itr = updatesToComplete.iterator(); itr.hasNext();) {
- model.processUpdate((IViewerUpdate)itr.next());
+ for (Iterator<IViewerUpdate> itr = updatesToComplete.iterator(); itr.hasNext();) {
+ model.processUpdate(itr.next());
}
}
}
-
+
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java
index 6f06e6346..9cf942bc6 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java
@@ -26,7 +26,8 @@ public class VirtualViewerContentTests extends ContentTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java
index a2ab1a21b..f7dd72850 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java
@@ -26,7 +26,8 @@ public class VirtualViewerDeltaTests extends DeltaTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerFilterTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerFilterTests.java
index fd584069a..9814cb5d6 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerFilterTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerFilterTests.java
@@ -27,7 +27,8 @@ public class VirtualViewerFilterTests extends FilterTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"), new VisibleVirtualItemValidator(0, 100)); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
index 94c370675..4139b5c4c 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java
@@ -42,7 +42,8 @@ public class VirtualViewerLazyModeTests extends TestCase {
/**
* @throws java.lang.Exception
*/
- protected void setUp() throws Exception {
+ @Override
+ protected void setUp() throws Exception {
fDisplay = PlatformUI.getWorkbench().getDisplay();
fShell = new Shell(fDisplay/*, SWT.ON_TOP | SWT.SHELL_TRIM*/);
fShell.setMaximized(true);
@@ -67,7 +68,8 @@ public class VirtualViewerLazyModeTests extends TestCase {
/**
* @throws java.lang.Exception
*/
- protected void tearDown() throws Exception {
+ @Override
+ protected void tearDown() throws Exception {
fListener.dispose();
fViewer.getPresentationContext().dispose();
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java
index e21fd505b..8c08a904e 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java
@@ -27,11 +27,13 @@ public class VirtualViewerPerformanceTests extends PerformanceTests {
super(name);
}
- protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"), fVirtualItemValidator); //$NON-NLS-1$
}
- protected int getTestModelDepth() {
+ @Override
+ protected int getTestModelDepth() {
return 7;
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPopupTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPopupTests.java
index 4c2dcda52..1d127be36 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPopupTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPopupTests.java
@@ -26,7 +26,8 @@ public class VirtualViewerPopupTests extends PopupTests {
super(name);
}
- protected ITreeModelViewer createViewer(Display display, Shell shell, int style) {
+ @Override
+ protected ITreeModelViewer createViewer(Display display, Shell shell, int style) {
return new VirtualTreeModelViewer(fDisplay, style, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java
index a0df1576f..5a7dd44dd 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java
@@ -26,7 +26,8 @@ public class VirtualViewerSelectionTests extends SelectionTests {
super(name);
}
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected ITreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java
index b441ca685..46cdd3ad8 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java
@@ -26,7 +26,8 @@ public class VirtualViewerStateTests extends StateTests {
super(name);
}
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected ITreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java
index d1ce76967..6fc572a21 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java
@@ -26,7 +26,8 @@ public class VirtualViewerUpdateTests extends UpdateTests {
super(name);
}
- protected ITreeModelViewer createViewer(Display display, Shell shell) {
+ @Override
+ protected ITreeModelViewer createViewer(Display display, Shell shell) {
return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VisibleVirtualItemValidator.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VisibleVirtualItemValidator.java
index aa8c4c51b..bcb6e8659 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VisibleVirtualItemValidator.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VisibleVirtualItemValidator.java
@@ -40,7 +40,8 @@ public class VisibleVirtualItemValidator implements IVirtualItemValidator {
return fEnd - fStart;
}
- public boolean isItemVisible(VirtualItem item) {
+ @Override
+ public boolean isItemVisible(VirtualItem item) {
int position = 0;
while (item.getParent() != null) {
position += item.getIndex().intValue();
@@ -49,7 +50,8 @@ public class VisibleVirtualItemValidator implements IVirtualItemValidator {
return position >= fStart && position < fEnd || isSelected(item);
}
- public void showItem(VirtualItem item) {
+ @Override
+ public void showItem(VirtualItem item) {
int length = fEnd - fStart;
fStart = calcPosition(item);
fEnd = fStart + length;

Back to the top