Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Rennie2013-07-16 16:57:17 +0000
committerMike Rennie2013-07-16 16:57:17 +0000
commit44c60018da2e1e14ec6b2d0b0f2b01a71df104fc (patch)
tree45b05cd32d2c68aec0046b2204d81a0d40e5645a /org.eclipse.debug.tests/src/org
parent2123eb384fbb6bfe61a03e40ffe6836b2daf4696 (diff)
downloadeclipse.platform.debug-44c60018da2e1e14ec6b2d0b0f2b01a71df104fc.tar.gz
eclipse.platform.debug-44c60018da2e1e14ec6b2d0b0f2b01a71df104fc.tar.xz
eclipse.platform.debug-44c60018da2e1e14ec6b2d0b0f2b01a71df104fc.zip
Bug 413095 - Clean up deprecation and code warnings
Diffstat (limited to 'org.eclipse.debug.tests/src/org')
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java20
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java104
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java18
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java6
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java400
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchFavoriteTests.java36
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchManagerTests.java70
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java50
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java72
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/CheckTests.java36
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ChildrenUpdateTests.java28
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ColumnPresentationTests.java59
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/ContentTests.java94
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/DeltaTests.java357
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTests.java166
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/FilterTransformTests.java56
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerCheckTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerContentTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerDeltaTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerFilterTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerLazyTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPerformanceTests.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerPopupTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerSelectionTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerStateTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerTopIndexTests.java194
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerUpdateTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/LazyTests.java75
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PerformanceTests.java143
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PopupTests.java63
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java24
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/SelectionTests.java61
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/StateTests.java634
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModel.java356
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TestModelUpdatesListener.java158
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/TreePathWrapper.java10
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/UpdateTests.java300
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerContentTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerDeltaTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerFilterTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerLazyModeTests.java11
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPerformanceTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerPopupTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerSelectionTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerStateTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/VirtualViewerUpdateTests.java5
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java4
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java152
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java102
-rw-r--r--org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java10
52 files changed, 2407 insertions, 1558 deletions
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java
index ddf76214e..dfb9a9783 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/AcceleratorSubstitutionTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation 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
@@ -34,26 +34,26 @@ public class AcceleratorSubstitutionTests extends TestCase {
* tests a string with "..."
*/
public void testWithEllipses() {
- assertEquals("incorrect DBCS accelerator substitution",
- "Open Run Dialog(&R)...",
- DebugUIPlugin.adjustDBCSAccelerator("Open Run(&R) Dialog..."));
+ assertEquals("incorrect DBCS accelerator substitution", //$NON-NLS-1$
+ "Open Run Dialog(&R)...", //$NON-NLS-1$
+ DebugUIPlugin.adjustDBCSAccelerator("Open Run(&R) Dialog...")); //$NON-NLS-1$
}
/**
* tests a string without "..."
*/
public void testWithoutEllipses() {
- assertEquals("incorrect DBCS accelerator substitution",
- "Open Run Dialog(&R)",
- DebugUIPlugin.adjustDBCSAccelerator("Open Run(&R) Dialog"));
+ assertEquals("incorrect DBCS accelerator substitution", //$NON-NLS-1$
+ "Open Run Dialog(&R)", //$NON-NLS-1$
+ DebugUIPlugin.adjustDBCSAccelerator("Open Run(&R) Dialog")); //$NON-NLS-1$
}
/**
* tests a string that should not change (no DBCS style accelerator).
*/
public void testWithoutDBCSAcclerator() {
- assertEquals("incorrect DBCS accelerator substitution",
- "Open &Run Dialog...",
- DebugUIPlugin.adjustDBCSAccelerator("Open &Run Dialog..."));
+ assertEquals("incorrect DBCS accelerator substitution", //$NON-NLS-1$
+ "Open &Run Dialog...", //$NON-NLS-1$
+ DebugUIPlugin.adjustDBCSAccelerator("Open &Run Dialog...")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java
index b42235869..3330c2872 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/ArgumentParsingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2012 IBM Corporation and others.
+ * Copyright (c) 2012, 2013 IBM Corporation 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
@@ -45,7 +45,7 @@ public class ArgumentParsingTests extends TestCase {
}
private void execute1Arg(String cmdLine, String argParsed, String rendered) throws Exception {
- execute("a " + cmdLine + " b", new String[] { "a", argParsed, "b" }, "a " + rendered + " b");
+ execute("a " + cmdLine + " b", new String[] { "a", argParsed, "b" }, "a " + rendered + " b"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
}
private static void execute(String commandLine, String[] expectedArgs) throws Exception {
@@ -54,18 +54,18 @@ public class ArgumentParsingTests extends TestCase {
private static void execute(String commandLine, String[] expectedArgs, String expectedRendered) throws Exception {
String[] arguments = DebugPlugin.parseArguments(commandLine);
- assertEquals("unexpected parseArguments result;",
+ assertEquals("unexpected parseArguments result;", //$NON-NLS-1$
Arrays.asList(expectedArgs).toString(),
Arrays.asList(arguments).toString());
runCommandLine(commandLine, arguments);
String rendered = DebugPlugin.renderArguments(arguments, null);
- assertEquals("unexpected renderArguments result;", expectedRendered, rendered);
+ assertEquals("unexpected renderArguments result;", expectedRendered, rendered); //$NON-NLS-1$
if (!commandLine.equals(rendered)) {
String[] arguments2 = DebugPlugin.parseArguments(rendered);
- assertEquals("parsing rendered command line doesn't yield original arguments;",
+ assertEquals("parsing rendered command line doesn't yield original arguments;", //$NON-NLS-1$
Arrays.asList(expectedArgs).toString(),
Arrays.asList(arguments2).toString());
}
@@ -74,7 +74,7 @@ public class ArgumentParsingTests extends TestCase {
private static void runCommandLine(String commandLine, String[] arguments) throws IOException,
URISyntaxException, CoreException {
- URL classPathUrl = FileLocator.find(TestsPlugin.getDefault().getBundle(), new Path("bin/"), null);
+ URL classPathUrl = FileLocator.find(TestsPlugin.getDefault().getBundle(), new Path("bin/"), null); //$NON-NLS-1$
if (classPathUrl == null) { // not running from the workspace, but from the built bundle
classPathUrl = FileLocator.find(TestsPlugin.getDefault().getBundle(), Path.ROOT, null);
}
@@ -82,22 +82,22 @@ public class ArgumentParsingTests extends TestCase {
File classPathFile = URIUtil.toFile(URIUtil.toURI(classPathUrl));
String[] execArgs= new String[arguments.length + 4];
- execArgs[0]= new Path(System.getProperty("java.home")).append("bin/java").toOSString();
- execArgs[1]= "-cp";
+ execArgs[0] = new Path(System.getProperty("java.home")).append("bin/java").toOSString(); //$NON-NLS-1$ //$NON-NLS-2$
+ execArgs[1] = "-cp"; //$NON-NLS-1$
execArgs[2]= classPathFile.getAbsolutePath();
execArgs[3]= ArgumentsPrinter.class.getName();
System.arraycopy(arguments, 0, execArgs, 4, arguments.length);
ArrayList resultArgs = runCommandLine(execArgs);
- assertEquals("unexpected exec result;",
+ assertEquals("unexpected exec result;", //$NON-NLS-1$
Arrays.asList(arguments).toString(),
resultArgs.toString());
if (! Platform.getOS().equals(Constants.OS_WIN32)) {
- execArgs = new String[] { "sh", "-c", execArgs[0] + " " + execArgs[1] + " " + execArgs[2] + " " + execArgs[3] + " " + commandLine };
+ execArgs = new String[] { "sh", "-c", execArgs[0] + " " + execArgs[1] + " " + execArgs[2] + " " + execArgs[3] + " " + commandLine }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
resultArgs = runCommandLine(execArgs);
- assertEquals("unexpected sh exec result;",
+ assertEquals("unexpected sh exec result;", //$NON-NLS-1$
Arrays.asList(arguments).toString(),
resultArgs.toString());
}
@@ -132,8 +132,9 @@ public class ArgumentParsingTests extends TestCase {
private static boolean needsQuoting(String s) {
int len = s.length();
- if (len == 0) // empty string has to be quoted
+ if (len == 0) {
return true;
+ }
for (int i = 0; i < len; i++) {
switch (s.charAt(i)) {
case ' ': case '\t': case '\\': case '"':
@@ -144,8 +145,9 @@ public class ArgumentParsingTests extends TestCase {
}
private static String winQuote(String s) {
- if (! needsQuoting(s))
+ if (! needsQuoting(s)) {
return s;
+ }
s = s.replaceAll("([\\\\]*)\"", "$1$1\\\\\""); //$NON-NLS-1$ //$NON-NLS-2$
s = s.replaceAll("([\\\\]*)\\z", "$1$1"); //$NON-NLS-1$ //$NON-NLS-2$
return "\"" + s + "\""; //$NON-NLS-1$ //$NON-NLS-2$
@@ -154,140 +156,142 @@ public class ArgumentParsingTests extends TestCase {
// -- tests:
public void testEmpty() throws Exception {
- execute("", new String[0]);
+ execute("", new String[0]); //$NON-NLS-1$
}
public void test1arg() throws Exception {
- execute("a", new String[] { "a" });
+ execute("a", new String[] { "a" }); //$NON-NLS-1$ //$NON-NLS-2$
}
public void test2arg() throws Exception {
- execute("a b", new String[] { "a", "b" });
+ execute("a b", new String[] { "a", "b" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void test100arg() throws Exception {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < 100; i++)
- buf.append("a ");
+ {
+ buf.append("a "); //$NON-NLS-1$
+ }
String[] args = new String[100];
- Arrays.fill(args, "a");
+ Arrays.fill(args, "a"); //$NON-NLS-1$
execute(buf.toString(), args, buf.toString().trim());
}
public void testEscape() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute1Arg("\\1");
+ execute1Arg("\\1"); //$NON-NLS-1$
} else {
- execute1Arg("\\1", "1", "1");
+ execute1Arg("\\1", "1", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
public void testEscapeDoubleQuote1() throws Exception {
- execute1Arg("\\\"", "\"", "\\\"");
+ execute1Arg("\\\"", "\"", "\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testEscapeDoubleQuote2() throws Exception {
- execute1Arg("arg=\\\"bla\\\"", "arg=\"bla\"", "arg=\\\"bla\\\"");
+ execute1Arg("arg=\\\"bla\\\"", "arg=\"bla\"", "arg=\\\"bla\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testDoubleQuoted1() throws Exception {
- execute1Arg("\"1 2\"", "1 2");
+ execute1Arg("\"1 2\"", "1 2"); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testDoubleQuoted2() throws Exception {
- execute1Arg("\"1\"", "1", "1");
+ execute1Arg("\"1\"", "1", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testDoubleQuoted3() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
// execute1Arg("\"\"", "", "\"\""); // would be correct, but ProcessImpl is buggy on Windows JDKs
- execute1Arg("\"\"");
+ execute1Arg("\"\""); //$NON-NLS-1$
} else {
- execute1Arg("\"\"", "", "\"\"");
+ execute1Arg("\"\"", "", "\"\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
public void testDoubleQuoted4() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute1Arg("\"\"\"\"", "\"", "\\\"");
+ execute1Arg("\"\"\"\"", "\"", "\\\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
- execute1Arg("\"\"\"\"", "", "\"\"");
+ execute1Arg("\"\"\"\"", "", "\"\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
public void testDoubleQuoted5() throws Exception {
- execute1Arg("ab\"cd\"ef\"gh\"", "abcdefgh", "abcdefgh");
+ execute1Arg("ab\"cd\"ef\"gh\"", "abcdefgh", "abcdefgh"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
public void testDoubleQuotedWithSpace1() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute1Arg("\"\"\"1\"\" 2\"", "\"1\" 2", "\"\\\"1\\\" 2\"");
+ execute1Arg("\"\"\"1\"\" 2\"", "\"1\" 2", "\"\\\"1\\\" 2\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
- execute1Arg("\"\"\"1\"\" 2\"", "1 2", "\"1 2\"");
+ execute1Arg("\"\"\"1\"\" 2\"", "1 2", "\"1 2\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
public void testDoubleQuotedWithSpace2() throws Exception {
- execute1Arg("\"\\\"1\\\" 2\"", "\"1\" 2");
+ execute1Arg("\"\\\"1\\\" 2\"", "\"1\" 2"); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSingleQuoted1() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute("'1 2'", new String[] { "'1", "2'" });
+ execute("'1 2'", new String[] { "'1", "2'" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
- execute("'1 2'", new String[] { "1 2" }, "\"1 2\"");
+ execute("'1 2'", new String[] { "1 2" }, "\"1 2\""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
public void testSingleQuoted2() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute1Arg("'1'", "'1'", "'1'");
+ execute1Arg("'1'", "'1'", "'1'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} else {
- execute1Arg("'1'", "1", "1");
+ execute1Arg("'1'", "1", "1"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
}
public void testWindows1() throws Exception {
- execute("\"a b c\" d e", new String[] { "a b c", "d", "e" });
+ execute("\"a b c\" d e", new String[] { "a b c", "d", "e" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
public void testWindows2() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute("\"ab\\\"c\" \"\\\\\" d", new String[] { "ab\"c", "\\", "d" }, "ab\\\"c \\ d");
+ execute("\"ab\\\"c\" \"\\\\\" d", new String[] { "ab\"c", "\\", "d" }, "ab\\\"c \\ d"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
- execute("\"ab\\\"c\" \"\\\\\" d", new String[] { "ab\"c", "\\", "d" }, "ab\\\"c \\\\ d");
+ execute("\"ab\\\"c\" \"\\\\\" d", new String[] { "ab\"c", "\\", "d" }, "ab\\\"c \\\\ d"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
}
public void testWindows3() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute("a\\\\\\b d\"e f\"g h", new String[] { "a\\\\\\b", "de fg", "h" }, "a\\\\\\b \"de fg\" h");
+ execute("a\\\\\\b d\"e f\"g h", new String[] { "a\\\\\\b", "de fg", "h" }, "a\\\\\\b \"de fg\" h"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
- execute("a\\\\\\b d\"e f\"g h", new String[] { "a\\b", "de fg", "h" }, "a\\\\b \"de fg\" h");
+ execute("a\\\\\\b d\"e f\"g h", new String[] { "a\\b", "de fg", "h" }, "a\\\\b \"de fg\" h"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
}
public void testWindows4() throws Exception {
- execute("a\\\\\\\"b c d", new String[] { "a\\\"b", "c", "d" });
+ execute("a\\\\\\\"b c d", new String[] { "a\\\"b", "c", "d" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
}
public void testWindows5() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute("a\\\\\\\\\"b c\" d e", new String[] { "a\\\\b c", "d", "e" }, "\"a\\\\b c\" d e");
+ execute("a\\\\\\\\\"b c\" d e", new String[] { "a\\\\b c", "d", "e" }, "\"a\\\\b c\" d e"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
} else {
- execute("a\\\\\\\\\"b c\" d e", new String[] { "a\\\\b c", "d", "e" }, "\"a\\\\\\\\b c\" d e");
+ execute("a\\\\\\\\\"b c\" d e", new String[] { "a\\\\b c", "d", "e" }, "\"a\\\\\\\\b c\" d e"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
}
}
public void testAllInOne() throws Exception {
if (Platform.getOS().equals(Constants.OS_WIN32)) {
- execute("1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 \"ab\"cd 7 ef\"gh\" 8 i\"\"j 9 \"x\\\"y\\\\\" 10 z\\\\z 11 \"two-quotes:\"\"\"\"\" 12 \"g\"\"h\" 13 \"\"\"a\"\" b\"",
- new String[] { "1", "\"\"", "2", " ", "3", "\"", "4", "a b", "5", "\"bla\"", "6", "abcd", "7", "efgh", "8", "ij", "9", "x\"y\\", "10", "z\\\\z", "11", "two-quotes:\"\"", "12", "g\"h", "13", "\"a\" b" },
- "1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 abcd 7 efgh 8 ij 9 x\\\"y\\ 10 z\\\\z 11 two-quotes:\\\"\\\" 12 g\\\"h 13 \"\\\"a\\\" b\"");
+ execute("1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 \"ab\"cd 7 ef\"gh\" 8 i\"\"j 9 \"x\\\"y\\\\\" 10 z\\\\z 11 \"two-quotes:\"\"\"\"\" 12 \"g\"\"h\" 13 \"\"\"a\"\" b\"", //$NON-NLS-1$
+ new String[] { "1", "\"\"", "2", " ", "3", "\"", "4", "a b", "5", "\"bla\"", "6", "abcd", "7", "efgh", "8", "ij", "9", "x\"y\\", "10", "z\\\\z", "11", "two-quotes:\"\"", "12", "g\"h", "13", "\"a\" b" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$ //$NON-NLS-22$ //$NON-NLS-23$ //$NON-NLS-24$ //$NON-NLS-25$ //$NON-NLS-26$
+ "1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 abcd 7 efgh 8 ij 9 x\\\"y\\ 10 z\\\\z 11 two-quotes:\\\"\\\" 12 g\\\"h 13 \"\\\"a\\\" b\""); //$NON-NLS-1$
} else {
- execute("1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 \"ab\"cd 7 ef\"gh\" 8 i\"\"j 9 \"x\\\"y\\\\\" 10 z\\\\z 11 \"two-quotes:\"\"\"\"\" 12 \"g\"\"h\" 13 \"\"\"a\"\" b\"",
- new String[] { "1", "", "2", " ", "3", "\"", "4", "a b", "5", "\"bla\"", "6", "abcd", "7", "efgh", "8", "ij", "9", "x\"y\\", "10", "z\\z", "11", "two-quotes:", "12", "gh", "13", "a b" },
- "1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 abcd 7 efgh 8 ij 9 x\\\"y\\\\ 10 z\\\\z 11 two-quotes: 12 gh 13 \"a b\"");
+ execute("1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 \"ab\"cd 7 ef\"gh\" 8 i\"\"j 9 \"x\\\"y\\\\\" 10 z\\\\z 11 \"two-quotes:\"\"\"\"\" 12 \"g\"\"h\" 13 \"\"\"a\"\" b\"", //$NON-NLS-1$
+ new String[] { "1", "", "2", " ", "3", "\"", "4", "a b", "5", "\"bla\"", "6", "abcd", "7", "efgh", "8", "ij", "9", "x\"y\\", "10", "z\\z", "11", "two-quotes:", "12", "gh", "13", "a b" }, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$ //$NON-NLS-14$ //$NON-NLS-15$ //$NON-NLS-16$ //$NON-NLS-17$ //$NON-NLS-18$ //$NON-NLS-19$ //$NON-NLS-20$ //$NON-NLS-21$ //$NON-NLS-22$ //$NON-NLS-23$ //$NON-NLS-24$ //$NON-NLS-25$ //$NON-NLS-26$
+ "1 \"\" 2 \" \" 3 \\\" 4 \"a b\" 5 \\\"bla\\\" 6 abcd 7 efgh 8 ij 9 x\\\"y\\\\ 10 z\\\\z 11 two-quotes: 12 gh 13 \"a b\""); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java
index dfcab8ff6..283c461fc 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileStore.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2013 IBM Corporation 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
@@ -52,7 +52,7 @@ public class DebugFileStore extends FileStore {
}
- private URI uri;
+ private final URI uri;
public DebugFileStore(URI id) {
uri = id;
@@ -118,7 +118,7 @@ public class DebugFileStore extends FileStore {
if (path.segmentCount() > 0) {
return path.lastSegment();
}
- return "";
+ return ""; //$NON-NLS-1$
}
/**
@@ -152,8 +152,8 @@ public class DebugFileStore extends FileStore {
if (contents != null) {
return new ByteArrayInputStream(contents);
}
- throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests",
- "File does not exist: " + toURI()));
+ throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests", //$NON-NLS-1$
+ "File does not exist: " + toURI())); //$NON-NLS-1$
}
/* (non-Javadoc)
@@ -170,8 +170,8 @@ public class DebugFileStore extends FileStore {
IFileInfo info = fetchInfo();
if (info.exists()) {
if (!info.isDirectory()) {
- throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests",
- "mkdir failed - file already exists with name: " + toURI()));
+ throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests", //$NON-NLS-1$
+ "mkdir failed - file already exists with name: " + toURI())); //$NON-NLS-1$
}
} else {
IFileStore parent = getParent();
@@ -179,8 +179,8 @@ public class DebugFileStore extends FileStore {
DebugFileSystem.getDefault().setContents(toURI(), DebugFileSystem.DIRECTORY_BYTES);
} else {
if ((options & EFS.SHALLOW) > 0) {
- throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests",
- "mkdir failed - parent does not exist: " + toURI()));
+ throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.jdt.debug.tests", //$NON-NLS-1$
+ "mkdir failed - parent does not exist: " + toURI())); //$NON-NLS-1$
} else {
parent.mkdir(EFS.NONE, null);
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java
index d0a7183e4..7ec08bf71 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/DebugFileSystem.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * Copyright (c) 2008, 2013 IBM Corporation 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
@@ -34,7 +34,7 @@ public class DebugFileSystem extends FileSystem {
/**
* Keys URIs to file stores for existing files
*/
- private Map files = new HashMap();
+ private final Map files = new HashMap();
/**
* Constructs the singleton
@@ -43,7 +43,7 @@ public class DebugFileSystem extends FileSystem {
system = this;
// create root of the file system
try {
- setContents(new URI("debug", Path.ROOT.toString(), null), DIRECTORY_BYTES);
+ setContents(new URI("debug", Path.ROOT.toString(), null), DIRECTORY_BYTES); //$NON-NLS-1$
} catch (URISyntaxException e) {}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
index 02f70c4a3..167667c3e 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchConfigurationTests.java
@@ -66,7 +66,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
/**
* Identifier of test launch configuration type extension
*/
- public static final String ID_TEST_LAUNCH_TYPE = "org.eclipse.debug.tests.launch.type";
+ public static final String ID_TEST_LAUNCH_TYPE = "org.eclipse.debug.tests.launch.type"; //$NON-NLS-1$
/**
* The from/to handles during rename operations
@@ -93,9 +93,9 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
class Listener implements ILaunchConfigurationListener {
- private List addedList = new ArrayList();
- private List removedList = new ArrayList();
- private List changedList = new ArrayList();
+ private final List addedList = new ArrayList();
+ private final List removedList = new ArrayList();
+ private final List changedList = new ArrayList();
/* (non-Javadoc)
* @see org.eclipse.debug.core.ILaunchConfigurationListener#launchConfigurationAdded(org.eclipse.debug.core.ILaunchConfiguration)
@@ -141,12 +141,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
public static char[] getInputStreamAsCharArray(InputStream stream) throws IOException {
Charset charset = null;
try {
- charset = Charset.forName("UTF-8");
+ charset = Charset.forName("UTF-8"); //$NON-NLS-1$
} catch (IllegalCharsetNameException e) {
- System.err.println("Illegal charset name : " + "UTF-8"); //$NON-NLS-1$
+ System.err.println("Illegal charset name : " + "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
return null;
} catch(UnsupportedCharsetException e) {
- System.err.println("Unsupported charset : " + "UTF-8"); //$NON-NLS-1$
+ System.err.println("Unsupported charset : " + "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
return null;
}
CharsetDecoder charsetDecoder = charset.newDecoder();
@@ -222,7 +222,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @return
*/
protected IProject getProject() throws CoreException {
- return TestsPlugin.createProject("LaunchConfigurationTests");
+ return TestsPlugin.createProject("LaunchConfigurationTests"); //$NON-NLS-1$
}
/**
@@ -253,7 +253,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
protected ILaunchConfigurationWorkingCopy newEmptyConfiguration(IContainer container, String name) throws CoreException {
ILaunchConfigurationType type = getLaunchManager().getLaunchConfigurationType(ID_TEST_LAUNCH_TYPE);
ILaunchConfigurationWorkingCopy wc = type.newInstance(container, name);
- assertEquals("Should have no attributes", 0, wc.getAttributes().size());
+ assertEquals("Should have no attributes", 0, wc.getAttributes().size()); //$NON-NLS-1$
return wc;
}
@@ -309,7 +309,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
// retrieve attributes
- assertEquals("Wrong name", handle.getName(), "localName"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertEquals("Wrong name", handle.getName(), "localName"); //$NON-NLS-1$ //$NON-NLS-2$
// cleanup
handle.delete();
@@ -325,7 +325,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
// retrieve attributes
- assertEquals("Wrong name", handle.getName(), "sharedName"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ assertEquals("Wrong name", handle.getName(), "sharedName"); //$NON-NLS-1$ //$NON-NLS-2$
// cleanup
handle.delete();
@@ -960,12 +960,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws URISyntaxException
*/
public void testCreateDeleteEFS() throws CoreException, URISyntaxException {
- IFileSystem fileSystem = EFS.getFileSystem("debug");
- assertNotNull("Missing debug EFS", fileSystem);
+ IFileSystem fileSystem = EFS.getFileSystem("debug"); //$NON-NLS-1$
+ assertNotNull("Missing debug EFS", fileSystem); //$NON-NLS-1$
// create folder in EFS
- IFolder folder = getProject().getFolder("efs");
- folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null);
+ IFolder folder = getProject().getFolder("efs"); //$NON-NLS-1$
+ folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null); //$NON-NLS-1$
// create configuration
ILaunchConfigurationWorkingCopy wc = newConfiguration(folder, "efsConfig"); //$NON-NLS-1$
@@ -994,12 +994,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws URISyntaxException
*/
public void testCreateDeleteEFSLink() throws CoreException, URISyntaxException {
- IFileSystem fileSystem = EFS.getFileSystem("debug");
- assertNotNull("Missing debug EFS", fileSystem);
+ IFileSystem fileSystem = EFS.getFileSystem("debug"); //$NON-NLS-1$
+ assertNotNull("Missing debug EFS", fileSystem); //$NON-NLS-1$
// create folder in EFS
- IFolder folder = getProject().getFolder("efs2");
- folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null);
+ IFolder folder = getProject().getFolder("efs2"); //$NON-NLS-1$
+ folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null); //$NON-NLS-1$
// create configuration
ILaunchConfigurationWorkingCopy wc = newConfiguration(folder, "efsConfig"); //$NON-NLS-1$
@@ -1025,19 +1025,19 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*/
public void testEFSProjectRename() throws Exception {
// create test project
- IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("RenameEFS");
+ IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject("RenameEFS"); //$NON-NLS-1$
if (pro.exists()) {
pro.delete(true, true, null);
}
// create project
- IProject project = TestsPlugin.createProject("RenameEFS");
+ IProject project = TestsPlugin.createProject("RenameEFS"); //$NON-NLS-1$
- IFileSystem fileSystem = EFS.getFileSystem("debug");
- assertNotNull("Missing debug EFS", fileSystem);
+ IFileSystem fileSystem = EFS.getFileSystem("debug"); //$NON-NLS-1$
+ assertNotNull("Missing debug EFS", fileSystem); //$NON-NLS-1$
// create folder in EFS
- IFolder folder = project.getFolder("efs2");
- folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null);
+ IFolder folder = project.getFolder("efs2"); //$NON-NLS-1$
+ folder.createLink(new URI("debug", Path.ROOT.toString(), null), 0, null); //$NON-NLS-1$
// create configuration
ILaunchConfigurationWorkingCopy wc = newConfiguration(folder, "efsConfig"); //$NON-NLS-1$
@@ -1052,19 +1052,19 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
// rename project
IProjectDescription description = project.getDescription();
- description.setName("SFEemaneR"); // reverse name
+ description.setName("SFEemaneR"); // reverse name //$NON-NLS-1$
project.move(description, IResource.SHALLOW, null);
// original configuration should no longer exist - handle out of date
assertTrue("Configuration should not exist", !handle.exists()); //$NON-NLS-1$
// get the new handle
- project = ResourcesPlugin.getWorkspace().getRoot().getProject("SFEemaneR");
- assertTrue("Project should exist", project.exists());
- IFile file = project.getFile(new Path("efs2/efsConfig.launch"));
- assertTrue("launch config file should exist", file.exists());
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject("SFEemaneR"); //$NON-NLS-1$
+ assertTrue("Project should exist", project.exists()); //$NON-NLS-1$
+ IFile file = project.getFile(new Path("efs2/efsConfig.launch")); //$NON-NLS-1$
+ assertTrue("launch config file should exist", file.exists()); //$NON-NLS-1$
handle = getLaunchManager().getLaunchConfiguration(file);
- assertTrue("launch config should exist", handle.exists());
+ assertTrue("launch config should exist", handle.exists()); //$NON-NLS-1$
// retrieve attributes
assertTrue("String1 should be String1", handle.getAttribute("String1", "Missing").equals("String1")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
@@ -1073,7 +1073,7 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
assertTrue("Boolean2 should be false", !handle.getAttribute("Boolean2", true)); //$NON-NLS-1$ //$NON-NLS-2$
// validate shared location
- assertEquals("Shared location should be updated", file, handle.getFile());
+ assertEquals("Shared location should be updated", file, handle.getFile()); //$NON-NLS-1$
// cleanup
project.delete(IResource.NONE, null);
@@ -1092,8 +1092,8 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
ILaunchConfiguration handle = wc.doSave();
assertTrue("Configuration should exist", handle.exists()); //$NON-NLS-1$
- File dir = TestsPlugin.getDefault().getFileInPlugin(new Path("test-import"));
- assertTrue("Import directory does not exist", dir.exists());
+ File dir = TestsPlugin.getDefault().getFileInPlugin(new Path("test-import")); //$NON-NLS-1$
+ assertTrue("Import directory does not exist", dir.exists()); //$NON-NLS-1$
LaunchManager manager = (LaunchManager) getLaunchManager();
Listener listener = new Listener();
@@ -1112,28 +1112,28 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
// should be one removed
List removed = listener.getRemoved();
- assertEquals("Should be one removed config", 1, removed.size());
- assertTrue("Import4 should be removed", removed.contains(handle));
+ assertEquals("Should be one removed config", 1, removed.size()); //$NON-NLS-1$
+ assertTrue("Import4 should be removed", removed.contains(handle)); //$NON-NLS-1$
// should be 5 added
List added = listener.getAdded();
- assertEquals("Should be 5 added configs", 5, added.size());
+ assertEquals("Should be 5 added configs", 5, added.size()); //$NON-NLS-1$
Set names = new HashSet();
Iterator iterator = added.iterator();
while (iterator.hasNext()) {
ILaunchConfiguration lc = (ILaunchConfiguration) iterator.next();
names.add(lc.getName());
}
- assertTrue("Missing Name", names.contains("Import1"));
- assertTrue("Missing Name", names.contains("Import2"));
- assertTrue("Missing Name", names.contains("Import3"));
- assertTrue("Missing Name", names.contains("Import4"));
- assertTrue("Missing Name", names.contains("Import5"));
+ assertTrue("Missing Name", names.contains("Import1")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing Name", names.contains("Import2")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing Name", names.contains("Import3")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing Name", names.contains("Import4")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing Name", names.contains("Import5")); //$NON-NLS-1$ //$NON-NLS-2$
// should be one changed
List changed = listener.getChanged();
- assertEquals("Should be 1 changed config", 1, changed.size());
- assertEquals("Wrong changed config", "Import4", ((ILaunchConfiguration)changed.get(0)).getName());
+ assertEquals("Should be 1 changed config", 1, changed.size()); //$NON-NLS-1$
+ assertEquals("Wrong changed config", "Import4", ((ILaunchConfiguration) changed.get(0)).getName()); //$NON-NLS-1$ //$NON-NLS-2$
} finally {
manager.removeLaunchConfigurationListener(listener);
}
@@ -1146,20 +1146,20 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testWorkingCopyGetLocation() throws CoreException {
- ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-get-location");
+ ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-get-location"); //$NON-NLS-1$
IPath location = workingCopy.getLocation();
- assertEquals("Wrong path for local working copy", LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.append("test-get-location.launch"), location);
+ assertEquals("Wrong path for local working copy", LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.append("test-get-location.launch"), location); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* Tests that the framework adds time stamps to launch objects.
*/
public void testLaunchTimeStamp() throws CoreException {
- ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-time-stamp");
+ ILaunchConfigurationWorkingCopy workingCopy = newConfiguration(null, "test-time-stamp"); //$NON-NLS-1$
ILaunch launch = workingCopy.launch(ILaunchManager.DEBUG_MODE, null);
try {
String stamp = launch.getAttribute(DebugPlugin.ATTR_LAUNCH_TIMESTAMP);
- assertNotNull("missing time stamp", stamp);
+ assertNotNull("missing time stamp", stamp); //$NON-NLS-1$
Long.parseLong(stamp); // should be a long - will throw NumberFormatException if not
} finally {
if (launch != null) {
@@ -1174,74 +1174,74 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testMapAttributePersistence() throws CoreException, IOException {
- ILaunchConfigurationWorkingCopy c1 = newEmptyConfiguration(getProject(), "testMapAttributes1");
+ ILaunchConfigurationWorkingCopy c1 = newEmptyConfiguration(getProject(), "testMapAttributes1"); //$NON-NLS-1$
HashMap map = new HashMap();
- map.put("Z", "z-value");
- map.put("Y", "y-value");
- map.put("X", "x-value");
- map.put("W", "w-value");
- map.put("V", "v-value");
- map.put("U", "u-value");
- map.put("T", "t-value");
- map.put("S", "s-value");
- map.put("R", "r-value");
- map.put("Q", "q-value");
- map.put("P", "p-value");
- map.put("O", "o-value");
- map.put("N", "n-value");
- map.put("M", "m-value");
- map.put("L", "l-value");
- map.put("K", "k-value");
- map.put("J", "j-value");
- map.put("I", "i-value");
- map.put("H", "h-value");
- map.put("G", "g-value");
- map.put("F", "f-value");
- map.put("E", "e-value");
- map.put("D", "d-value");
- map.put("C", "c-value");
- map.put("B", "b-value");
- map.put("A", "a-value");
- c1.setAttribute("Map-Attribute", map);
+ map.put("Z", "z-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("Y", "y-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("X", "x-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("W", "w-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("V", "v-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("U", "u-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("T", "t-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("S", "s-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("R", "r-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("Q", "q-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("P", "p-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("O", "o-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("N", "n-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("M", "m-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("L", "l-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("K", "k-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("J", "j-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("I", "i-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("H", "h-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("G", "g-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("F", "f-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("E", "e-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("D", "d-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("C", "c-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("B", "b-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("A", "a-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ c1.setAttribute("Map-Attribute", map); //$NON-NLS-1$
c1.doSave();
- ILaunchConfigurationWorkingCopy c2 = newEmptyConfiguration(getProject(), "testMapAttributes2");
+ ILaunchConfigurationWorkingCopy c2 = newEmptyConfiguration(getProject(), "testMapAttributes2"); //$NON-NLS-1$
map = new HashMap();
- map.put("A", "a-value");
- map.put("Z", "z-value");
- map.put("B", "b-value");
- map.put("Y", "y-value");
- map.put("C", "c-value");
- map.put("X", "x-value");
- map.put("D", "d-value");
- map.put("W", "w-value");
- map.put("E", "e-value");
- map.put("V", "v-value");
- map.put("F", "f-value");
- map.put("U", "u-value");
- map.put("G", "g-value");
- map.put("T", "t-value");
- map.put("H", "h-value");
- map.put("S", "s-value");
- map.put("I", "i-value");
- map.put("R", "r-value");
- map.put("J", "j-value");
- map.put("Q", "q-value");
- map.put("K", "k-value");
- map.put("P", "p-value");
- map.put("L", "l-value");
- map.put("M", "m-value");
- map.put("O", "o-value");
- map.put("N", "n-value");
- c2.setAttribute("Map-Attribute", map);
+ map.put("A", "a-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("Z", "z-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("B", "b-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("Y", "y-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("C", "c-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("X", "x-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("D", "d-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("W", "w-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("E", "e-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("V", "v-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("F", "f-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("U", "u-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("G", "g-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("T", "t-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("H", "h-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("S", "s-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("I", "i-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("R", "r-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("J", "j-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("Q", "q-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("K", "k-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("P", "p-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("L", "l-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("M", "m-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("O", "o-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ map.put("N", "n-value"); //$NON-NLS-1$ //$NON-NLS-2$
+ c2.setAttribute("Map-Attribute", map); //$NON-NLS-1$
c2.doSave();
// file contents should be the same
char[] chars1 = getInputStreamAsCharArray(c1.getFile().getContents());
char[] chars2 = getInputStreamAsCharArray(c2.getFile().getContents());
- assertEquals("Should be the same characters", chars1.length, chars2.length);
+ assertEquals("Should be the same characters", chars1.length, chars2.length); //$NON-NLS-1$
for (int i = 0; i < chars2.length; i++) {
- assertEquals("Should be the same character", chars1[i], chars2[i]);
+ assertEquals("Should be the same character", chars1[i], chars2[i]); //$NON-NLS-1$
}
}
@@ -1252,74 +1252,74 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws CoreException
*/
public void testSetAttributePersistence() throws CoreException, IOException {
- ILaunchConfigurationWorkingCopy c1 = newEmptyConfiguration(getProject(), "testSetAttributes1");
+ ILaunchConfigurationWorkingCopy c1 = newEmptyConfiguration(getProject(), "testSetAttributes1"); //$NON-NLS-1$
Set set = new HashSet();
- set.add("z-value");
- set.add("y-value");
- set.add("x-value");
- set.add("w-value");
- set.add("v-value");
- set.add("u-value");
- set.add("t-value");
- set.add("s-value");
- set.add("r-value");
- set.add("q-value");
- set.add("p-value");
- set.add("o-value");
- set.add("n-value");
- set.add("m-value");
- set.add("l-value");
- set.add("k-value");
- set.add("j-value");
- set.add("i-value");
- set.add("h-value");
- set.add("g-value");
- set.add("f-value");
- set.add("e-value");
- set.add("d-value");
- set.add("c-value");
- set.add("b-value");
- set.add("a-value");
- c1.setAttribute("Set-Attribute", set);
+ set.add("z-value"); //$NON-NLS-1$
+ set.add("y-value"); //$NON-NLS-1$
+ set.add("x-value"); //$NON-NLS-1$
+ set.add("w-value"); //$NON-NLS-1$
+ set.add("v-value"); //$NON-NLS-1$
+ set.add("u-value"); //$NON-NLS-1$
+ set.add("t-value"); //$NON-NLS-1$
+ set.add("s-value"); //$NON-NLS-1$
+ set.add("r-value"); //$NON-NLS-1$
+ set.add("q-value"); //$NON-NLS-1$
+ set.add("p-value"); //$NON-NLS-1$
+ set.add("o-value"); //$NON-NLS-1$
+ set.add("n-value"); //$NON-NLS-1$
+ set.add("m-value"); //$NON-NLS-1$
+ set.add("l-value"); //$NON-NLS-1$
+ set.add("k-value"); //$NON-NLS-1$
+ set.add("j-value"); //$NON-NLS-1$
+ set.add("i-value"); //$NON-NLS-1$
+ set.add("h-value"); //$NON-NLS-1$
+ set.add("g-value"); //$NON-NLS-1$
+ set.add("f-value"); //$NON-NLS-1$
+ set.add("e-value"); //$NON-NLS-1$
+ set.add("d-value"); //$NON-NLS-1$
+ set.add("c-value"); //$NON-NLS-1$
+ set.add("b-value"); //$NON-NLS-1$
+ set.add("a-value"); //$NON-NLS-1$
+ c1.setAttribute("Set-Attribute", set); //$NON-NLS-1$
c1.doSave();
- ILaunchConfigurationWorkingCopy c2 = newEmptyConfiguration(getProject(), "testSetAttributes2");
+ ILaunchConfigurationWorkingCopy c2 = newEmptyConfiguration(getProject(), "testSetAttributes2"); //$NON-NLS-1$
set = new HashSet();
- set.add("a-value");
- set.add("z-value");
- set.add("b-value");
- set.add("y-value");
- set.add("c-value");
- set.add("x-value");
- set.add("d-value");
- set.add("w-value");
- set.add("e-value");
- set.add("v-value");
- set.add("f-value");
- set.add("u-value");
- set.add("g-value");
- set.add("t-value");
- set.add("h-value");
- set.add("s-value");
- set.add("i-value");
- set.add("r-value");
- set.add("j-value");
- set.add("q-value");
- set.add("k-value");
- set.add("p-value");
- set.add("l-value");
- set.add("m-value");
- set.add("o-value");
- set.add("n-value");
- c2.setAttribute("Set-Attribute", set);
+ set.add("a-value"); //$NON-NLS-1$
+ set.add("z-value"); //$NON-NLS-1$
+ set.add("b-value"); //$NON-NLS-1$
+ set.add("y-value"); //$NON-NLS-1$
+ set.add("c-value"); //$NON-NLS-1$
+ set.add("x-value"); //$NON-NLS-1$
+ set.add("d-value"); //$NON-NLS-1$
+ set.add("w-value"); //$NON-NLS-1$
+ set.add("e-value"); //$NON-NLS-1$
+ set.add("v-value"); //$NON-NLS-1$
+ set.add("f-value"); //$NON-NLS-1$
+ set.add("u-value"); //$NON-NLS-1$
+ set.add("g-value"); //$NON-NLS-1$
+ set.add("t-value"); //$NON-NLS-1$
+ set.add("h-value"); //$NON-NLS-1$
+ set.add("s-value"); //$NON-NLS-1$
+ set.add("i-value"); //$NON-NLS-1$
+ set.add("r-value"); //$NON-NLS-1$
+ set.add("j-value"); //$NON-NLS-1$
+ set.add("q-value"); //$NON-NLS-1$
+ set.add("k-value"); //$NON-NLS-1$
+ set.add("p-value"); //$NON-NLS-1$
+ set.add("l-value"); //$NON-NLS-1$
+ set.add("m-value"); //$NON-NLS-1$
+ set.add("o-value"); //$NON-NLS-1$
+ set.add("n-value"); //$NON-NLS-1$
+ c2.setAttribute("Set-Attribute", set); //$NON-NLS-1$
c2.doSave();
// file contents should be the same
char[] chars1 = getInputStreamAsCharArray(c1.getFile().getContents());
char[] chars2 = getInputStreamAsCharArray(c2.getFile().getContents());
- assertEquals("Should be the same characters", chars1.length, chars2.length);
+ assertEquals("Should be the same characters", chars1.length, chars2.length); //$NON-NLS-1$
for (int i = 0; i < chars2.length; i++) {
- assertEquals("Should be the same character", chars1[i], chars2[i]);
+ assertEquals("Should be the same character", chars1[i], chars2[i]); //$NON-NLS-1$
}
}
@@ -1332,12 +1332,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*/
public void testIllegalFileSepCharName() {
try {
- newConfiguration(null, new Path("some").append("nested").append("config").toOSString());
+ newConfiguration(null, new Path("some").append("nested").append("config").toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} catch (CoreException e) {
// i.e. expected code path
return;
}
- assertTrue("Should be an illegal argument - cannot nest local configurations", false);
+ assertTrue("Should be an illegal argument - cannot nest local configurations", false); //$NON-NLS-1$
}
/**
@@ -1349,9 +1349,9 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*/
public void testLegalFileSepCharName() {
try {
- newConfiguration(getProject(), new Path("some").append("nested").append("config").toOSString());
+ newConfiguration(getProject(), new Path("some").append("nested").append("config").toOSString()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
} catch (CoreException e) {
- assertTrue("Should *not* be an illegal argument - can nest shared cofigurations", false);
+ assertTrue("Should *not* be an illegal argument - can nest shared cofigurations", false); //$NON-NLS-1$
}
}
@@ -1362,12 +1362,12 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*/
public void testIllegalCharName() {
try {
- newConfiguration(getProject(), "<config>");
+ newConfiguration(getProject(), "<config>"); //$NON-NLS-1$
} catch (CoreException e) {
// expected code path
return;
}
- assertTrue("Should be an illegal argument - illegal character used in name", false);
+ assertTrue("Should be an illegal argument - illegal character used in name", false); //$NON-NLS-1$
}
/**
@@ -1377,20 +1377,20 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
*/
public void testRenameAndMoveShared() throws CoreException {
IProject project = getProject();
- IFolder f1 = project.getFolder("f1");
- IFolder f2 = project.getFolder("f2");
+ IFolder f1 = project.getFolder("f1"); //$NON-NLS-1$
+ IFolder f2 = project.getFolder("f2"); //$NON-NLS-1$
f1.create(false, true, null);
f2.create(false, true, null);
- ILaunchConfigurationWorkingCopy wc = newConfiguration(f1, "start-here");
+ ILaunchConfigurationWorkingCopy wc = newConfiguration(f1, "start-here"); //$NON-NLS-1$
ILaunchConfiguration orig = wc.doSave();
wc = orig.getWorkingCopy();
wc.setContainer(f2);
- wc.rename("end-here");
+ wc.rename("end-here"); //$NON-NLS-1$
ILaunchConfiguration next = wc.doSave();
- assertFalse("Original should not exist", orig.exists());
- assertTrue("Renamed and moved config should exist", next.exists());
+ assertFalse("Original should not exist", orig.exists()); //$NON-NLS-1$
+ assertTrue("Renamed and moved config should exist", next.exists()); //$NON-NLS-1$
}
@@ -1401,9 +1401,9 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
*/
public void testGetTypeImageFromURI() throws Exception {
- ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type1");
- assertNotNull("The image descriptior type.image.1 must exist", descriptor);
- assertNotSame("The image descriptor is not type.image.1", ImageDescriptor.getMissingImageDescriptor(), descriptor);
+ ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type1"); //$NON-NLS-1$
+ assertNotNull("The image descriptior type.image.1 must exist", descriptor); //$NON-NLS-1$
+ assertNotSame("The image descriptor is not type.image.1", ImageDescriptor.getMissingImageDescriptor(), descriptor); //$NON-NLS-1$
}
/**
@@ -1411,9 +1411,9 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @throws Exception
*/
public void testGetTyeImage() throws Exception {
- ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type");
- assertNotNull("The image descriptior type.image.2 must exist", descriptor);
- assertNotSame("The image descriptor is not type.image.2", ImageDescriptor.getMissingImageDescriptor(), descriptor);
+ ImageDescriptor descriptor = DebugUITools.getImageDescriptor("org.eclipse.debug.tests.launch.type"); //$NON-NLS-1$
+ assertNotNull("The image descriptior type.image.2 must exist", descriptor); //$NON-NLS-1$
+ assertNotSame("The image descriptor is not type.image.2", ImageDescriptor.getMissingImageDescriptor(), descriptor); //$NON-NLS-1$
}
/**
@@ -1424,14 +1424,14 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @since 3.9.0
*/
public void testGetProjectMappedResource1() throws Exception {
- ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping");
+ ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping"); //$NON-NLS-1$
try {
ILaunchConfigurationWorkingCopy wc = lc.getWorkingCopy();
- assertNotNull("Should have a working copy of the testig launch configuration", wc);
- setResourceMappings(wc, new ResourceItem[] {new ResourceItem("test.project", new Integer(IResource.PROJECT))});
+ assertNotNull("Should have a working copy of the testig launch configuration", wc); //$NON-NLS-1$
+ setResourceMappings(wc, new ResourceItem[] { new ResourceItem("test.project", new Integer(IResource.PROJECT)) }); //$NON-NLS-1$
IResource[] res = wc.getMappedResources();
- assertNotNull("There should be mapped resources", res);
- assertTrue("There should be one project", res.length == 1);
+ assertNotNull("There should be mapped resources", res); //$NON-NLS-1$
+ assertTrue("There should be one project", res.length == 1); //$NON-NLS-1$
}
finally {
lc.delete();
@@ -1446,13 +1446,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @since 3.9.0
*/
public void testGetProjectMappedResource2() throws Exception {
- ILaunchConfiguration lc = newConfiguration(null,"test.project.resource.mapping");
+ ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping"); //$NON-NLS-1$
try {
ILaunchConfigurationWorkingCopy wc = lc.getWorkingCopy();
- assertNotNull("Should have a working copy of the testig launch configuration", wc);
- setResourceMappings(wc, new ResourceItem[] {new ResourceItem("test/project", new Integer(IResource.PROJECT))});
+ assertNotNull("Should have a working copy of the testig launch configuration", wc); //$NON-NLS-1$
+ setResourceMappings(wc, new ResourceItem[] { new ResourceItem("test/project", new Integer(IResource.PROJECT)) }); //$NON-NLS-1$
IResource[] res = wc.getMappedResources();
- assertNull("There should be no mapped resources", res);
+ assertNull("There should be no mapped resources", res); //$NON-NLS-1$
}
finally {
lc.delete();
@@ -1467,17 +1467,17 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @since 3.9.0
*/
public void testGetProjectMappedResource3() throws Exception {
- ILaunchConfiguration lc = newConfiguration(null,"test.project.resource.mapping");
+ ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping"); //$NON-NLS-1$
try {
ILaunchConfigurationWorkingCopy wc = lc.getWorkingCopy();
- assertNotNull("Should have a working copy of the testig launch configuration", wc);
- setResourceMappings(wc, new ResourceItem[] {new ResourceItem("test\\project", new Integer(IResource.PROJECT))});
+ assertNotNull("Should have a working copy of the testig launch configuration", wc); //$NON-NLS-1$
+ setResourceMappings(wc, new ResourceItem[] { new ResourceItem("test\\project", new Integer(IResource.PROJECT)) }); //$NON-NLS-1$
IResource[] res = wc.getMappedResources();
if(Platform.OS_WIN32.equals(Platform.getOS())) {
- assertNull("There should be no mapped resources", res);
+ assertNull("There should be no mapped resources", res); //$NON-NLS-1$
}
else {
- assertNotNull("There should be mapped resources", res);
+ assertNotNull("There should be mapped resources", res); //$NON-NLS-1$
}
}
finally {
@@ -1493,13 +1493,13 @@ public class LaunchConfigurationTests extends AbstractLaunchTest implements ILau
* @since 3.9.0
*/
public void testGetProjectMappedResource4() throws Exception {
- ILaunchConfiguration lc = newConfiguration(null,"test.project.resource.mapping");
+ ILaunchConfiguration lc = newConfiguration(null, "test.project.resource.mapping"); //$NON-NLS-1$
try {
ILaunchConfigurationWorkingCopy wc = lc.getWorkingCopy();
- assertNotNull("Should have a working copy of the testig launch configuration", wc);
- setResourceMappings(wc, new ResourceItem[] {new ResourceItem("/project", new Integer(IResource.PROJECT))});
+ assertNotNull("Should have a working copy of the testig launch configuration", wc); //$NON-NLS-1$
+ setResourceMappings(wc, new ResourceItem[] { new ResourceItem("/project", new Integer(IResource.PROJECT)) }); //$NON-NLS-1$
IResource[] res = wc.getMappedResources();
- assertNotNull("There should be mapped resources", res);
+ assertNotNull("There should be mapped resources", res); //$NON-NLS-1$
}
finally {
lc.delete();
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchFavoriteTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchFavoriteTests.java
index 1e5a7827e..485e8dec4 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchFavoriteTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchFavoriteTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2013 IBM Corporation 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
@@ -154,9 +154,9 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
*/
private boolean containsFavorite(LaunchHistory history, ILaunchConfiguration configuration, int size) {
ILaunchConfiguration[] favorites = history.getFavorites();
- assertNotNull("No favorites", favorites);
+ assertNotNull("No favorites", favorites); //$NON-NLS-1$
if (size != -1) {
- assertEquals("Favorites wrong size", size, favorites.length);
+ assertEquals("Favorites wrong size", size, favorites.length); //$NON-NLS-1$
}
for (int i = 0; i < favorites.length; i++) {
if (configuration.equals(favorites[i])) {
@@ -175,8 +175,8 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
ILaunchConfigurationWorkingCopy wc = addFavorite(getLaunchConfiguration(), IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
addFavorite(wc, IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
ILaunchConfiguration saved = wc.doSave();
- assertTrue("Missing from debug favorites", containsFavorite(getDebugLaunchHistory(), saved, 1));
- assertTrue("Missing from run favorites", containsFavorite(getRunLaunchHistory(), saved, 1));
+ assertTrue("Missing from debug favorites", containsFavorite(getDebugLaunchHistory(), saved, 1)); //$NON-NLS-1$
+ assertTrue("Missing from run favorites", containsFavorite(getRunLaunchHistory(), saved, 1)); //$NON-NLS-1$
}
/**
@@ -189,8 +189,8 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
ILaunchConfigurationWorkingCopy wc = removeFavorite(getLaunchConfiguration(), IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
removeFavorite(wc, IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
ILaunchConfiguration saved = wc.doSave();
- assertFalse("Should not be a debug favorite", containsFavorite(getDebugLaunchHistory(), saved, 0));
- assertFalse("Should not be a run favorite", containsFavorite(getRunLaunchHistory(), saved, 0));
+ assertFalse("Should not be a debug favorite", containsFavorite(getDebugLaunchHistory(), saved, 0)); //$NON-NLS-1$
+ assertFalse("Should not be a run favorite", containsFavorite(getRunLaunchHistory(), saved, 0)); //$NON-NLS-1$
}
/**
@@ -202,8 +202,8 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
testBecomeFavorite(); // create a favorite in two histories
ILaunchConfiguration configuration = getLaunchConfiguration();
configuration.delete();
- assertFalse("Should not be a debug favorite", containsFavorite(getDebugLaunchHistory(), configuration, 0));
- assertFalse("Should not be a run favorite", containsFavorite(getRunLaunchHistory(), configuration, 0));
+ assertFalse("Should not be a debug favorite", containsFavorite(getDebugLaunchHistory(), configuration, 0)); //$NON-NLS-1$
+ assertFalse("Should not be a run favorite", containsFavorite(getRunLaunchHistory(), configuration, 0)); //$NON-NLS-1$
}
/**
@@ -215,10 +215,10 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
testBecomeFavorite();
ILaunchConfiguration original = getLaunchConfiguration();
ILaunchConfigurationWorkingCopy copy = original.getWorkingCopy();
- copy.rename("rename"+original.getName());
+ copy.rename("rename" + original.getName()); //$NON-NLS-1$
ILaunchConfiguration saved = copy.doSave();
- assertTrue("Missing from debug favorites", containsFavorite(getDebugLaunchHistory(), saved, 1));
- assertTrue("Missing from run favorites", containsFavorite(getRunLaunchHistory(), saved, 1));
+ assertTrue("Missing from debug favorites", containsFavorite(getDebugLaunchHistory(), saved, 1)); //$NON-NLS-1$
+ assertTrue("Missing from run favorites", containsFavorite(getRunLaunchHistory(), saved, 1)); //$NON-NLS-1$
saved.delete();
}
@@ -230,12 +230,12 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
public void testRenameBecomeFavorite() throws CoreException {
ILaunchConfiguration original = getLaunchConfiguration();
ILaunchConfigurationWorkingCopy copy = original.getWorkingCopy();
- copy.rename("rename"+original.getName());
+ copy.rename("rename" + original.getName()); //$NON-NLS-1$
addFavorite(copy, IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
addFavorite(copy, IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
ILaunchConfiguration saved = copy.doSave();
- assertTrue("Missing from debug favorites", containsFavorite(getDebugLaunchHistory(), saved, 1));
- assertTrue("Missing from run favorites", containsFavorite(getRunLaunchHistory(), saved, 1));
+ assertTrue("Missing from debug favorites", containsFavorite(getDebugLaunchHistory(), saved, 1)); //$NON-NLS-1$
+ assertTrue("Missing from run favorites", containsFavorite(getRunLaunchHistory(), saved, 1)); //$NON-NLS-1$
saved.delete();
}
@@ -248,12 +248,12 @@ public class LaunchFavoriteTests extends AbstractLaunchTest {
testBecomeFavorite();
ILaunchConfiguration original = getLaunchConfiguration();
ILaunchConfigurationWorkingCopy copy = original.getWorkingCopy();
- copy.rename("rename"+original.getName());
+ copy.rename("rename" + original.getName()); //$NON-NLS-1$
removeFavorite(copy, IDebugUIConstants.ID_DEBUG_LAUNCH_GROUP);
removeFavorite(copy, IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
ILaunchConfiguration saved = copy.doSave();
- assertFalse("Should not be a debug favorite", containsFavorite(getDebugLaunchHistory(), saved, 0));
- assertFalse("Should not be a run favorite", containsFavorite(getRunLaunchHistory(), saved, 0));
+ assertFalse("Should not be a debug favorite", containsFavorite(getDebugLaunchHistory(), saved, 0)); //$NON-NLS-1$
+ assertFalse("Should not be a run favorite", containsFavorite(getRunLaunchHistory(), saved, 0)); //$NON-NLS-1$
saved.delete();
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchManagerTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchManagerTests.java
index ab5922203..e841160b3 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/LaunchManagerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 IBM Corporation and others.
+ * Copyright (c) 2009, 2013 IBM Corporation 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
@@ -34,9 +34,9 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* Tests generating a valid launch configuration name
*/
public void testGenereateConfigName() {
- String configname = "launch_configuration";
+ String configname = "launch_configuration"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertTrue("the name nust be '"+configname+"'", name.equals(configname));
+ assertTrue("the name nust be '" + configname + "'", name.equals(configname)); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -44,18 +44,18 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* the deprecated method
*/
public void testGenereateConfigNameBadChar() {
- String configname = "config:name";
+ String configname = "config:name"; //$NON-NLS-1$
String name = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(configname);
- assertEquals("config name should be '"+configname+"'", configname, name);
+ assertEquals("config name should be '" + configname + "'", configname, name); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
* Tests that a valid name is accepted as is.
*/
public void testGenerateValidName() {
- String configname = "thisisavalidname";
+ String configname = "thisisavalidname"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("Should be the same as the seed", configname, name);
+ assertEquals("Should be the same as the seed", configname, name); //$NON-NLS-1$
}
/**
@@ -64,9 +64,9 @@ public class LaunchManagerTests extends AbstractLaunchTest {
*/
public void testGenerateConfigNameReservedName() {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
- String configname = "aux";
+ String configname = "aux"; //$NON-NLS-1$
String name = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(configname);
- assertEquals("config name should be 'aux'", configname, name);
+ assertEquals("config name should be 'aux'", configname, name); //$NON-NLS-1$
}
}
@@ -74,9 +74,9 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* Tests generating a configuration name that contains an invalid character
*/
public void testGenerateBadConfigName() {
- String configname = "config:name";
+ String configname = "config:name"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'config_name'", "config_name", name);
+ assertEquals("config name should be 'config_name'", "config_name", name); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -85,9 +85,9 @@ public class LaunchManagerTests extends AbstractLaunchTest {
*/
public void testGenerateConflictingName() {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
- String configname = "aux";
+ String configname = "aux"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'launch_configuration'", "launch_configuration", name);
+ assertEquals("config name should be 'launch_configuration'", "launch_configuration", name); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -96,13 +96,13 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* is another config with the replaced name already
*/
public void testGenerateBadCharConflict() throws Exception {
- String configname = "config:name";
+ String configname = "config:name"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'config_name'", "config_name", name);
+ assertEquals("config name should be 'config_name'", "config_name", name); //$NON-NLS-1$ //$NON-NLS-2$
getLaunchConfiguration(name);
name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'config_name (1)'", "config_name (1)", name);
- ILaunchConfiguration config = getLaunchConfiguration("config_name");
+ assertEquals("config name should be 'config_name (1)'", "config_name (1)", name); //$NON-NLS-1$ //$NON-NLS-2$
+ ILaunchConfiguration config = getLaunchConfiguration("config_name"); //$NON-NLS-1$
config.delete();
}
@@ -113,13 +113,13 @@ public class LaunchManagerTests extends AbstractLaunchTest {
*/
public void testGenerateBadNameConflict() throws Exception {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
- String configname = "com2";
+ String configname = "com2"; //$NON-NLS-1$
String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'launch_configuration'", "launch_configuration", name);
+ assertEquals("config name should be 'launch_configuration'", "launch_configuration", name); //$NON-NLS-1$ //$NON-NLS-2$
getLaunchConfiguration(name);
name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("config name should be 'launch_configuration (1)'", "launch_configuration (1)", name);
- ILaunchConfiguration config = getLaunchConfiguration("launch_configuration");
+ assertEquals("config name should be 'launch_configuration (1)'", "launch_configuration (1)", name); //$NON-NLS-1$ //$NON-NLS-2$
+ ILaunchConfiguration config = getLaunchConfiguration("launch_configuration"); //$NON-NLS-1$
config.delete();
}
}
@@ -128,12 +128,12 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* Tests the {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)} method for correctness
*/
public void testValidateConfigGoodName() {
- String configname = "configname";
+ String configname = "configname"; //$NON-NLS-1$
try {
getLaunchManager().isValidLaunchConfigurationName(configname);
}
catch(IllegalArgumentException iae) {
- fail("the config name should not have thrown an exception during validation");
+ fail("the config name should not have thrown an exception during validation"); //$NON-NLS-1$
}
}
@@ -141,14 +141,14 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* Tests the {@link org.eclipse.debug.core.ILaunchManager#isValidLaunchConfigurationName(String)} method for correctness
*/
public void testValidateConfigBadCharName() {
- String configname = "config:name";
+ String configname = "config:name"; //$NON-NLS-1$
try {
getLaunchManager().isValidLaunchConfigurationName(configname);
}
catch(IllegalArgumentException iae) {
return;
}
- fail("the config name should have thrown an exception during validation");
+ fail("the config name should have thrown an exception during validation"); //$NON-NLS-1$
}
/**
@@ -156,14 +156,14 @@ public class LaunchManagerTests extends AbstractLaunchTest {
*/
public void testValidateConfigBadName() {
if(Platform.OS_WIN32.equals(Platform.getOS())) {
- String configname = "com1";
+ String configname = "com1"; //$NON-NLS-1$
try {
getLaunchManager().isValidLaunchConfigurationName(configname);
}
catch(IllegalArgumentException iae) {
return;
}
- fail("the config name should have thrown an exception during validation");
+ fail("the config name should have thrown an exception during validation"); //$NON-NLS-1$
}
}
@@ -172,18 +172,18 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* already properly updates a '(N)' counter at the end
*/
public void testGenerateNameExistingConfig() throws Exception {
- String configname = "x.y.z.configname";
+ String configname = "x.y.z.configname"; //$NON-NLS-1$
getLaunchConfiguration(configname);
String name = getLaunchManager().generateLaunchConfigurationName(configname);
- assertEquals("the configuration name should have been "+configname+" (1)", configname+" (1)", name);
+ assertEquals("the configuration name should have been " + configname + " (1)", configname + " (1)", name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
getLaunchConfiguration(name);
name = getLaunchManager().generateLaunchConfigurationName(name);
- assertEquals("the configuration name should have been "+configname+" (2)", configname+" (2)", name);
+ assertEquals("the configuration name should have been " + configname + " (2)", configname + " (2)", name); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
ILaunchConfiguration config = getLaunchConfiguration(configname);
if(config != null) {
config.delete();
}
- config = getLaunchConfiguration(configname +" (1)");
+ config = getLaunchConfiguration(configname + " (1)"); //$NON-NLS-1$
if(config != null) {
config.delete();
}
@@ -193,11 +193,11 @@ public class LaunchManagerTests extends AbstractLaunchTest {
* Tests that removing an accelerator properly removes it without affecting the base string (readable) value
*/
public void testRemoveAcc() {
- String text = "&Remove";
+ String text = "&Remove"; //$NON-NLS-1$
String label = LaunchManager.removeAccelerators(text);
- assertEquals("the label should be 'Remove'", "Remove", label);
- text = "Remo&ve";
+ assertEquals("the label should be 'Remove'", "Remove", label); //$NON-NLS-1$ //$NON-NLS-2$
+ text = "Remo&ve"; //$NON-NLS-1$
label = LaunchManager.removeAccelerators(text);
- assertEquals("the label should be 'Remove'", "Remove", label);
+ assertEquals("the label should be 'Remove'", "Remove", label); //$NON-NLS-1$ //$NON-NLS-2$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java
index 900e4d066..d56adac1d 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/launching/RefreshTabTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation 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
@@ -51,17 +51,17 @@ public class RefreshTabTests extends AbstractLaunchTest {
*/
protected void setSelection(IResource resource) {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- assertNotNull("The active workbench page should not be null", page);
+ assertNotNull("The active workbench page should not be null", page); //$NON-NLS-1$
IViewPart part;
try {
- part = page.showView("org.eclipse.ui.views.ResourceNavigator");
+ part = page.showView("org.eclipse.ui.views.ResourceNavigator"); //$NON-NLS-1$
IWorkbenchPartSite site = part.getSite();
- assertNotNull("The part site for org.eclipse.ui.views.ResourceNavigator should not be null ", site);
+ assertNotNull("The part site for org.eclipse.ui.views.ResourceNavigator should not be null ", site); //$NON-NLS-1$
ISelectionProvider provider = site.getSelectionProvider();
- assertNotNull("the selection provider should not be null for org.eclipse.ui.views.ResourceNavigator", provider);
+ assertNotNull("the selection provider should not be null for org.eclipse.ui.views.ResourceNavigator", provider); //$NON-NLS-1$
provider.setSelection(new StructuredSelection(resource));
} catch (PartInitException e) {
- assertNotNull("Failed to open navigator view", null);
+ assertNotNull("Failed to open navigator view", null); //$NON-NLS-1$
}
}
@@ -70,8 +70,8 @@ public class RefreshTabTests extends AbstractLaunchTest {
* @throws CoreException
*/
public void testSelectedResource() throws CoreException {
- String scope = "${resource}";
- IResource resource = getProject().getFolder("src");
+ String scope = "${resource}"; //$NON-NLS-1$
+ IResource resource = getProject().getFolder("src"); //$NON-NLS-1$
setSelection(resource);
IResource[] result = RefreshTab.getRefreshResources(scope);
assertNotNull(result);
@@ -84,8 +84,8 @@ public class RefreshTabTests extends AbstractLaunchTest {
* @throws CoreException
*/
public void testSelectionsFolder() throws CoreException {
- String scope = "${container}";
- IResource resource = getProject().getFolder("src");
+ String scope = "${container}"; //$NON-NLS-1$
+ IResource resource = getProject().getFolder("src"); //$NON-NLS-1$
setSelection(resource);
IResource[] result = RefreshTab.getRefreshResources(scope);
assertNotNull(result);
@@ -98,8 +98,8 @@ public class RefreshTabTests extends AbstractLaunchTest {
* @throws CoreException
*/
public void testSelectionsProject() throws CoreException {
- String scope = "${project}";
- IResource resource = getProject().getFolder("src");
+ String scope = "${project}"; //$NON-NLS-1$
+ IResource resource = getProject().getFolder("src"); //$NON-NLS-1$
setSelection(resource);
IResource[] result = RefreshTab.getRefreshResources(scope);
assertNotNull(result);
@@ -112,7 +112,7 @@ public class RefreshTabTests extends AbstractLaunchTest {
* @throws CoreException
*/
public void testWorkspaceScope() throws CoreException {
- String scope = "${workspace}";
+ String scope = "${workspace}"; //$NON-NLS-1$
IResource[] result = RefreshTab.getRefreshResources(scope);
assertNotNull(result);
assertEquals(1, result.length);
@@ -124,8 +124,8 @@ public class RefreshTabTests extends AbstractLaunchTest {
* @throws CoreException
*/
public void testSpecificResource() throws CoreException {
- String scope = "${resource:/RefreshTabTests/some.file}";
- IResource resource = getProject().getFile("some.file");
+ String scope = "${resource:/RefreshTabTests/some.file}"; //$NON-NLS-1$
+ IResource resource = getProject().getFile("some.file"); //$NON-NLS-1$
IResource[] result = RefreshTab.getRefreshResources(scope);
assertNotNull(result);
assertEquals(1, result.length);
@@ -138,7 +138,7 @@ public class RefreshTabTests extends AbstractLaunchTest {
*/
public void testWorkingSet() throws CoreException {
String scope= "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<launchConfigurationWorkingSet factoryID=\"org.eclipse.ui.internal.WorkingSetFactory\" name=\"workingSet\" editPageId=\"org.eclipse.ui.resourceWorkingSetPage\">\n<item factoryID=\"org.eclipse.ui.internal.model.ResourceFactory\" path=\"/RefreshTabTests/some.file\" type=\"1\"/>\n</launchConfigurationWorkingSet>}"; //$NON-NLS-1$
- IResource resource = getProject().getFile("some.file");
+ IResource resource = getProject().getFile("some.file"); //$NON-NLS-1$
IResource[] result = RefreshTab.getRefreshResources(scope);
assertNotNull(result);
assertEquals(1, result.length);
@@ -152,13 +152,13 @@ public class RefreshTabTests extends AbstractLaunchTest {
*/
protected IProject getProject() throws CoreException {
IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot();
- IProject project= root.getProject("RefreshTabTests");
+ IProject project = root.getProject("RefreshTabTests"); //$NON-NLS-1$
if (!project.exists()) {
- project = TestsPlugin.createProject("RefreshTabTests");
- IFolder folder = project.getFolder("src");
+ project = TestsPlugin.createProject("RefreshTabTests"); //$NON-NLS-1$
+ IFolder folder = project.getFolder("src"); //$NON-NLS-1$
folder.create(false, true, null);
- IFile file = project.getFile("some.file");
- file.create(new ByteArrayInputStream("test file".getBytes()), false, null);
+ IFile file = project.getFile("some.file"); //$NON-NLS-1$
+ file.create(new ByteArrayInputStream("test file".getBytes()), false, null); //$NON-NLS-1$
}
return project;
}
@@ -171,8 +171,8 @@ public class RefreshTabTests extends AbstractLaunchTest {
*/
public void testRefreshScopeComparator() throws CoreException {
String oldStyle = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<launchConfigurationWorkingSet factoryID=\"org.eclipse.ui.internal.WorkingSetFactory\" name=\"workingSet\" editPageId=\"org.eclipse.ui.resourceWorkingSetPage\">\n<item factoryID=\"org.eclipse.ui.internal.model.ResourceFactory\" path=\"/RefreshTabTests/some.file\" type=\"1\"/>\n</launchConfigurationWorkingSet>}"; //$NON-NLS-1$
- String newStyle = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<resources>\n<item path=\"/RefreshTabTests/some.file\" type=\"1\"/>\n</resources>}";
- assertEquals("Comparator should return 0", 0, new RefreshScopeComparator().compare(oldStyle, newStyle));
+ String newStyle = "${working_set:<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<resources>\n<item path=\"/RefreshTabTests/some.file\" type=\"1\"/>\n</resources>}"; //$NON-NLS-1$
+ assertEquals("Comparator should return 0", 0, new RefreshScopeComparator().compare(oldStyle, newStyle)); //$NON-NLS-1$
}
/**
@@ -181,7 +181,7 @@ public class RefreshTabTests extends AbstractLaunchTest {
* @throws CoreException
*/
public void testResourceMemento() throws CoreException {
- IResource[] resources = new IResource[]{getProject(), getProject().getFile("not.exist"), getProject().getFile("some.file")};
+ IResource[] resources = new IResource[] { getProject(), getProject().getFile("not.exist"), getProject().getFile("some.file") }; //$NON-NLS-1$ //$NON-NLS-2$
String memento = RefreshUtil.toMemento(resources);
IResource[] restore = RefreshUtil.toResources(memento);
assertEquals(resources.length, restore.length);
@@ -199,6 +199,6 @@ public class RefreshTabTests extends AbstractLaunchTest {
String memento = RefreshUtil.toMemento(new IResource[]{});
IResource[] resources = RefreshUtil.toResources(memento);
assertNotNull(resources);
- assertEquals("Should be empty", 0, resources.length);
+ assertEquals("Should be empty", 0, resources.length); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java
index 0bf6f5c5e..648b97674 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/DynamicRenderingBindings.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation 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
@@ -25,7 +25,7 @@ public class DynamicRenderingBindings extends AbstractMemoryRenderingBindingsPro
private static DynamicRenderingBindings fgSingleton = null;
// id of rendering type bound by this provider
- private String fId = "rendering_type_1";
+ private String fId = "rendering_type_1"; //$NON-NLS-1$
/**
* Constructor
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java
index d9705418f..994f4a158 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryBlock.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation 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
@@ -65,7 +65,7 @@ public class MemoryBlock implements IMemoryBlock {
* @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
*/
public String getModelIdentifier() {
- return "no.debugger";
+ return "no.debugger"; //$NON-NLS-1$
}
/**
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java
index 6850d134a..8c7a9f2ca 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/view/memory/MemoryRenderingTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2012 IBM Corporation and others.
+ * Copyright (c) 2000, 2013 IBM Corporation 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
@@ -30,89 +30,89 @@ public class MemoryRenderingTests extends TestCase {
public void testRenderingTypes() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryRenderingType[] types = manager.getRenderingTypes();
- assertTrue("Wrong number of rendering types contributed", types.length > 6);
- assertTrue("Missing type 1", indexOf(manager.getRenderingType("rendering_type_1"), types) >= 0);
- assertTrue("Missing type 2", indexOf(manager.getRenderingType("rendering_type_2"), types) >= 0);
- assertTrue("Missing type 3", indexOf(manager.getRenderingType("rendering_type_3"), types) >= 0);
- assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.raw_memory"), types) >= 0);
- assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.ascii"), types) >= 0);
- assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.signedint"), types) >= 0);
- assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.unsignedint"), types) >= 0);
+ assertTrue("Wrong number of rendering types contributed", types.length > 6); //$NON-NLS-1$
+ assertTrue("Missing type 1", indexOf(manager.getRenderingType("rendering_type_1"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing type 2", indexOf(manager.getRenderingType("rendering_type_2"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing type 3", indexOf(manager.getRenderingType("rendering_type_3"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.raw_memory"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.ascii"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.signedint"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing type", indexOf(manager.getRenderingType("org.eclipse.debug.ui.rendering.unsignedint"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testRenderingTypeNames() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
- IMemoryRenderingType type = manager.getRenderingType("rendering_type_1");
- assertEquals("Wrong name", "Rendering One", type.getLabel());
- type = manager.getRenderingType("rendering_type_2");
- assertEquals("Wrong name", "Rendering Two", type.getLabel());
+ IMemoryRenderingType type = manager.getRenderingType("rendering_type_1"); //$NON-NLS-1$
+ assertEquals("Wrong name", "Rendering One", type.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
+ type = manager.getRenderingType("rendering_type_2"); //$NON-NLS-1$
+ assertEquals("Wrong name", "Rendering Two", type.getLabel()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSingleBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockOne();
IMemoryRenderingType[] types = manager.getRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_1", types[0].getId());
+ assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
+ assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testDoubleBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockTwo();
IMemoryRenderingType[] types = manager.getRenderingTypes(block);
- assertEquals("Wrong number of bindings", 2, types.length);
- assertTrue("Missing binding", indexOf(manager.getRenderingType("rendering_type_1"), types) >= 0);
- assertTrue("Missing binding", indexOf(manager.getRenderingType("rendering_type_2"), types) >= 0);
+ assertEquals("Wrong number of bindings", 2, types.length); //$NON-NLS-1$
+ assertTrue("Missing binding", indexOf(manager.getRenderingType("rendering_type_1"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
+ assertTrue("Missing binding", indexOf(manager.getRenderingType("rendering_type_2"), types) >= 0); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testDefaultBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockOne();
IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_1", types[0].getId());
+ assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
+ assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testNoDefaultBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockTwo();
IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
- assertEquals("Wrong number of bindings", 0, types.length);
+ assertEquals("Wrong number of bindings", 0, types.length); //$NON-NLS-1$
}
public void testPrimaryBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockOne();
IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
- assertEquals("Wrong binding", "rendering_type_1", type.getId());
+ assertEquals("Wrong binding", "rendering_type_1", type.getId()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testNoPrimaryBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockTwo();
IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
- assertNull("Wrong binding", type);
+ assertNull("Wrong binding", type); //$NON-NLS-1$
}
public void testDefaultWithoutPrimaryBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockThree();
IMemoryRenderingType[] types = manager.getDefaultRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_3", types[0].getId());
+ assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
+ assertEquals("Wrong binding", "rendering_type_3", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testDynamicBinding() {
IMemoryRenderingManager manager = DebugUITools.getMemoryRenderingManager();
IMemoryBlock block = new MemoryBlockDynamic();
IMemoryRenderingType[] types = manager.getRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_1", types[0].getId());
+ assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
+ assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
types = manager.getDefaultRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_1", types[0].getId());
+ assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
+ assertEquals("Wrong binding", "rendering_type_1", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
IMemoryRenderingType type = manager.getPrimaryRenderingType(block);
- assertEquals("Wrong bindings", manager.getRenderingType("rendering_type_1"), type);
+ assertEquals("Wrong bindings", manager.getRenderingType("rendering_type_1"), type); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testBindingChangeNotification() {
@@ -131,15 +131,15 @@ public class MemoryRenderingTests extends TestCase {
try {
manager.addListener(listener);
- assertFalse("Renderings should not have changed yet", changed[0]);
- DynamicRenderingBindings.setBinding("rendering_type_2");
- assertTrue("Renderings should have changed", changed[0]);
+ assertFalse("Renderings should not have changed yet", changed[0]); //$NON-NLS-1$
+ DynamicRenderingBindings.setBinding("rendering_type_2"); //$NON-NLS-1$
+ assertTrue("Renderings should have changed", changed[0]); //$NON-NLS-1$
types = manager.getRenderingTypes(block);
- assertEquals("Wrong number of bindings", 1, types.length);
- assertEquals("Wrong binding", "rendering_type_2", types[0].getId());
+ assertEquals("Wrong number of bindings", 1, types.length); //$NON-NLS-1$
+ assertEquals("Wrong binding", "rendering_type_2", types[0].getId()); //$NON-NLS-1$ //$NON-NLS-2$
} finally {
// restore original bindings
- DynamicRenderingBindings.setBinding("rendering_type_1");
+ DynamicRenderingBindings.setBinding("rendering_type_1"); //$NON-NLS-1$
manager.removeListener(listener);
}
}
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 435827411..9cc09fec0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -68,14 +69,18 @@ abstract public class CheckTests extends TestCase {
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -96,7 +101,11 @@ abstract public class CheckTests extends TestCase {
fViewer.setInput(model.getRootElement());
// Wait for the updates to complete.
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -111,7 +120,11 @@ abstract public class CheckTests extends TestCase {
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -157,7 +170,11 @@ abstract public class CheckTests extends TestCase {
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -168,8 +185,11 @@ abstract public class CheckTests extends TestCase {
fListener.reset(elementPath, element, -1, true, false);
model.postDelta(delta);
- while (!fListener.isFinished(ITestModelUpdatesListenerConstants.LABEL_COMPLETE | ITestModelUpdatesListenerConstants.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ITestModelUpdatesListenerConstants.LABEL_COMPLETE | ITestModelUpdatesListenerConstants.MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
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 64be95af6..9c85204e0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation 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
@@ -14,8 +14,8 @@ import junit.framework.TestCase;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.internal.ui.viewers.model.ChildrenUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.ILabelUpdateListener;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
+import org.eclipse.debug.internal.ui.viewers.model.ILabelUpdateListener;
import org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelChangedListener;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IModelDelta;
@@ -193,23 +193,23 @@ public class ChildrenUpdateTests extends TestCase {
TreeModelContentProvider cp = getContentProvider();
ChildrenUpdate update1 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 1, null);
ChildrenUpdate update2 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 2, null);
- assertTrue("Should coalesce", update1.coalesce(update2));
- assertEquals("Wrong offset", 1, update1.getOffset());
- assertEquals("Wrong length", 2, update1.getLength());
+ assertTrue("Should coalesce", update1.coalesce(update2)); //$NON-NLS-1$
+ assertEquals("Wrong offset", 1, update1.getOffset()); //$NON-NLS-1$
+ assertEquals("Wrong length", 2, update1.getLength()); //$NON-NLS-1$
update2 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 3, null);
- assertTrue("Should coalesce", update1.coalesce(update2));
- assertEquals("Wrong offset", 1, update1.getOffset());
- assertEquals("Wrong length", 3, update1.getLength());
+ assertTrue("Should coalesce", update1.coalesce(update2)); //$NON-NLS-1$
+ assertEquals("Wrong offset", 1, update1.getOffset()); //$NON-NLS-1$
+ assertEquals("Wrong length", 3, update1.getLength()); //$NON-NLS-1$
update2 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 2, null);
- assertTrue("Should coalesce", update1.coalesce(update2));
- assertEquals("Wrong offset", 1, update1.getOffset());
- assertEquals("Wrong length", 3, update1.getLength());
+ assertTrue("Should coalesce", update1.coalesce(update2)); //$NON-NLS-1$
+ assertEquals("Wrong offset", 1, update1.getOffset()); //$NON-NLS-1$
+ assertEquals("Wrong length", 3, update1.getLength()); //$NON-NLS-1$
update2 = new ChildrenUpdate(cp, element, TreePath.EMPTY, element, 5, null);
- assertFalse("Should not coalesce", update1.coalesce(update2));
- assertEquals("Wrong offset", 1, update1.getOffset());
- assertEquals("Wrong length", 3, update1.getLength());
+ assertFalse("Should not coalesce", update1.coalesce(update2)); //$NON-NLS-1$
+ assertEquals("Wrong offset", 1, update1.getOffset()); //$NON-NLS-1$
+ assertEquals("Wrong length", 3, update1.getLength()); //$NON-NLS-1$
}
}
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 c45e888d7..b8f406e75 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -67,7 +68,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
fShell = new Shell(fDisplay);
fShell.setSize(800, 600);
fShell.setLayout(new FillLayout());
- fViewer = new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ fViewer = new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
fViewer.getTree().addControlListener(new ControlListener() {
public void controlResized(ControlEvent e) {
fResized = true;
@@ -108,7 +109,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
static String[] makeDefaultColumnIds() {
String[] columnIds = new String[5];
for (int i = 0; i < columnIds.length; i++) {
- columnIds[i] = "ColumnId_" + i;
+ columnIds[i] = "ColumnId_" + i; //$NON-NLS-1$
}
return columnIds;
}
@@ -149,7 +150,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
}
public String getId() {
- return "MyColumnPresentationID";
+ return "MyColumnPresentationID"; //$NON-NLS-1$
}
public boolean isOptional() {
@@ -164,7 +165,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
MyColumnPresentation2() {
super();
for (int i = 0; i < columnIds.length; i++) {
- columnIds[i] += "_2";
+ columnIds[i] += "_2"; //$NON-NLS-1$
}
repliedWidths = new int[columnIds.length];
Arrays.fill(repliedWidths, -2);
@@ -194,7 +195,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
}
public String getId() {
- return "MyColumnPresentation2ID";
+ return "MyColumnPresentation2ID"; //$NON-NLS-1$
}
}
@@ -225,13 +226,13 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
private TestModel makeModel(MyColumnPresentation cp, String rootSufffix) throws InterruptedException {
MyModel model = new MyModel(cp);
- model.setRoot(new TestElement(model, "root" + rootSufffix, new TestElement[] {
- new TestElement(model, "1", true, true, new TestElement[0]),
- new TestElement(model, "2", true, false, new TestElement[0]),
- new TestElement(model, "3", false, true, new TestElement[0]),
- new TestElement(model, "4", false, false, new TestElement[0]),
- new TestElement(model, "5", new TestElement[0]),
- new TestElement(model, "6", new TestElement[0]) }));
+ model.setRoot(new TestElement(model, "root" + rootSufffix, new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2", true, false, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "4", false, false, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "6", new TestElement[0]) })); //$NON-NLS-1$
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
fViewer.setInput(model.getRootElement());
while (!fListener.isFinished()) {
@@ -253,11 +254,13 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
*/
public void testInitialColumnAverageWidth() throws InterruptedException {
// Try to wait for the shell painting to settle
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
fResized = false;
MyColumnPresentation colPre = new MyColumnPresentation();
- makeModel(colPre, "m1");
+ makeModel(colPre, "m1"); //$NON-NLS-1$
Tree tree = fViewer.getTree();
TreeColumn[] columns = tree.getColumns();
int treeWidth = tree.getSize().x;
@@ -284,11 +287,13 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
*/
public void testInitialColumnWidth() throws InterruptedException {
// Try to wait for the shell painting to settle
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
fResized = false;
MyColumnPresentation2 colPre = new MyColumnPresentation2();
- makeModel(colPre, "m2");
+ makeModel(colPre, "m2"); //$NON-NLS-1$
Tree tree = fViewer.getTree();
TreeColumn[] columns = tree.getColumns();
@@ -313,7 +318,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
*/
public void testRespectUserSettings() throws InterruptedException {
MyColumnPresentation2 colPre = new MyColumnPresentation2();
- makeModel(colPre, "m2");
+ makeModel(colPre, "m2"); //$NON-NLS-1$
TreeColumn[] columns = fViewer.getTree().getColumns();
// simulate user resizing each column width
int[] newWidths = new int[columns.length];
@@ -327,8 +332,8 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
// get InternalTreeModelViewer to rebuild columns due to change of
// model and presentation - first set to another model and column
// presentation, then switch to a model with original presentation.
- makeModel(new MyColumnPresentation(), "m1");
- makeModel(colPre, "m3");
+ makeModel(new MyColumnPresentation(), "m1"); //$NON-NLS-1$
+ makeModel(colPre, "m3"); //$NON-NLS-1$
// verify user resized widths are used instead of the initial widths from IColumnPresentation2
columns = fViewer.getTree().getColumns();
for (int i = 0; i < columns.length; i++) {
@@ -363,7 +368,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
*/
public void testRespectMemento() throws InterruptedException {
MyColumnPresentation2 colPre = new MyColumnPresentation2();
- makeModel(colPre, "m2");
+ makeModel(colPre, "m2"); //$NON-NLS-1$
TreeColumn[] columns = fViewer.getTree().getColumns();
// simulate user resizing each column width
int[] newWidths = new int[columns.length];
@@ -375,7 +380,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
assertEquals(newWidths[i], columns[i].getWidth());
}
// save memento
- final XMLMemento memento = XMLMemento.createWriteRoot("TEST");
+ final XMLMemento memento = XMLMemento.createWriteRoot("TEST"); //$NON-NLS-1$
fViewer.saveState(memento);
// throw away any settings inside the viewer and create a new viewer
// with memento settings, this is the same effect resulted from closing
@@ -383,7 +388,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
recreateViewer();
fViewer.initState(memento);
// get InternalTreeModelViewer to rebuild columns
- makeModel(colPre, "m2");
+ makeModel(colPre, "m2"); //$NON-NLS-1$
// verify widths from memento are used instead of the initial widths from IColumnPresentation2
columns = fViewer.getTree().getColumns();
for (int i = 0; i < columns.length; i++) {
@@ -398,7 +403,7 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
public void testChangedColumnIds() throws InterruptedException {
MyColumnPresentation colPre = new MyColumnPresentation();
- makeModel(colPre, "m1");
+ makeModel(colPre, "m1"); //$NON-NLS-1$
TreeColumn[] columns = fViewer.getTree().getColumns();
// Select visible columns
fViewer.setVisibleColumns(new String[] { colPre.columnIds[0] });
@@ -411,13 +416,13 @@ public class ColumnPresentationTests extends TestCase implements ITestModelUpdat
// get InternalTreeModelViewer to rebuild columns due to change of
// model and presentation - first set to another model and column
// presentation, then switch to a model with original presentation.
- makeModel(new MyColumnPresentation2(), "m2");
+ makeModel(new MyColumnPresentation2(), "m2"); //$NON-NLS-1$
String[] newColumnIds = MyColumnPresentation.makeDefaultColumnIds();
- newColumnIds[0] = "new_column_id";
+ newColumnIds[0] = "new_column_id"; //$NON-NLS-1$
colPre = new MyColumnPresentation(newColumnIds);
- makeModel(colPre, "m3");
+ makeModel(colPre, "m3"); //$NON-NLS-1$
// verify user resized widths are used instead of the initial widths from IColumnPresentation2
columns = fViewer.getTree().getColumns();
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 98b884064..d2dff371a 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
@@ -76,14 +76,18 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -104,7 +108,11 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
fViewer.setInput(model.getRootElement());
// Wait for the updates to complete.
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
@@ -121,7 +129,11 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
@@ -183,27 +195,31 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureLabelUpdates = true;
- model.setRoot( new TestElement(model, "root", new TestElement[] {
- new TestElement(model, "1", new TestElement[0]),
- new TestElement(model, "2", new TestElement[0]),
+ 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$
}) );
// Set input into the view to update it, but block children updates.
// Wait for view to start retrieving content.
fViewer.setInput(model.getRootElement());
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
List firstUpdates = model.fCapturedUpdates;
model.fCapturedUpdates = new ArrayList(2);
// // Change the model and run another update set.
- model.getElement(model.findElement("1")).setLabelAppendix(" - changed");
- model.getElement(model.findElement("2")).setLabelAppendix(" - changed");
+ 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);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
// Complete the second set of children updates
@@ -218,7 +234,11 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
capturedUpdate.done();
}
- while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CHILDREN_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
@@ -236,29 +256,33 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureLabelUpdates = true;
- model.setRoot( new TestElement(model, "root", new TestElement[] {
- new TestElement(model, "1", new TestElement[0]),
- new TestElement(model, "2", new TestElement[0]),
+ 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$
}) );
// Set input into the view to update it, but block children updates.
// Wait for view to start retrieving content.
fViewer.setInput(model.getRootElement());
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
List firstUpdates = model.fCapturedUpdates;
model.fCapturedUpdates = new ArrayList(2);
// Change the model and run another update set.
- model.setElementChildren(TreePath.EMPTY, new TestElement[] {
- new TestElement(model, "1-new", new TestElement[0]),
- new TestElement(model, "2-new", new TestElement[0]),
+ 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);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (model.fCapturedUpdates.size() < model.getRootElement().fChildren.length) {
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
// Complete the second set of children updates
@@ -273,7 +297,11 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
capturedUpdate.done();
}
- while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CHILDREN_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
@@ -292,29 +320,33 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
TestModelWithCapturedUpdates model = new TestModelWithCapturedUpdates();
model.fCaptureChildrenUpdates = true;
- model.setRoot( new TestElement(model, "root", new TestElement[] {
- new TestElement(model, "1", new TestElement[0]),
- new TestElement(model, "2", new TestElement[0]),
+ 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$
}) );
// Set input into the view to update it, but block children updates.
// Wait for view to start retrieving content.
fViewer.setInput(model.getRootElement());
while (!areCapturedChildrenUpdatesComplete(model.fCapturedUpdates, model.getRootElement().fChildren.length)) {
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
IChildrenUpdate[] firstUpdates = (IChildrenUpdate[])model.fCapturedUpdates.toArray(new IChildrenUpdate[0]);
model.fCapturedUpdates.clear();
// Change the model and run another update set.
model.setElementChildren(TreePath.EMPTY, new TestElement[] {
- new TestElement(model, "1-new", new TestElement[0]),
- new TestElement(model, "2-new", new TestElement[0]),
+ 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);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
while (!areCapturedChildrenUpdatesComplete(model.fCapturedUpdates, model.getRootElement().fChildren.length)) {
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
// Complete the second set of children updates
@@ -327,7 +359,11 @@ abstract public class ContentTests extends TestCase implements ITestModelUpdates
firstUpdates[i].done();
}
- while (!fListener.isFinished(CHILDREN_UPDATES)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CHILDREN_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check viewer data
model.validateData(fViewer, TreePath.EMPTY);
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 86b86ab44..93fac0a2c 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
@@ -72,14 +72,18 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -94,18 +98,25 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
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");
+ ModelDelta delta = model.appendElementLabel(elementPath, "-modified"); //$NON-NLS-1$
fListener.reset(elementPath, element, -1, true, false);
model.postDelta(delta);
- while (!fListener.isFinished(LABEL_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(LABEL_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -120,22 +131,30 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
TestElement element = model.getRootElement().getChildren()[0];
TreePath elementPath = new TreePath(new Object[] { element });
TestElement[] newChildren = new TestElement[] {
- new TestElement(model, "1.1 - new", new TestElement[0]),
- new TestElement(model, "1.2 - new", new TestElement[0]),
- new TestElement(model, "1.3 - new", new TestElement[0]),
+ new TestElement(model, "1.1 - new", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "1.2 - new", new TestElement[0]), //$NON-NLS-1$
+ 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);
model.postDelta(delta);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -150,32 +169,36 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
- String prefix = "new - ";
+ String prefix = "new - "; //$NON-NLS-1$
model.setElementChildren(TreePath.EMPTY, new TestElement[] {
- new TestElement(model, prefix + "1", new TestElement[0]),
- new TestElement(model, prefix + "2", true, false, new TestElement[] {
- new TestElement(model, prefix + "2.1", true, true, new TestElement[0]),
- new TestElement(model, prefix + "2.2", false, true, new TestElement[0]),
- new TestElement(model, prefix + "2.3", true, false, new TestElement[0]),
+ new TestElement(model, prefix + "1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, prefix + "2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "2.3", true, false, new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, prefix + "3", new TestElement[] {
- new TestElement(model, prefix + "3.1", new TestElement[] {
- new TestElement(model, prefix + "3.1.1", new TestElement[0]),
- new TestElement(model, prefix + "3.1.2", new TestElement[0]),
- new TestElement(model, prefix + "3.1.3", new TestElement[0]),
+ new TestElement(model, prefix + "3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, prefix + "3.1", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, prefix + "3.1.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "3.1.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "3.1.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, prefix + "3.2", new TestElement[] {
- new TestElement(model, prefix + "3.2.1", new TestElement[0]),
- new TestElement(model, prefix + "3.2.2", new TestElement[0]),
- new TestElement(model, prefix + "3.2.3", new TestElement[0]),
+ new TestElement(model, prefix + "3.2", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, prefix + "3.2.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "3.2.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "3.2.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, prefix + "3.3", new TestElement[] {
- new TestElement(model, prefix + "3.3.1", new TestElement[0]),
- new TestElement(model, prefix + "3.3.2", new TestElement[0]),
- new TestElement(model, prefix + "3.3.3", new TestElement[0]),
+ new TestElement(model, prefix + "3.3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, prefix + "3.3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "3.3.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, prefix + "3.3.3", new TestElement[0]), //$NON-NLS-1$
}),
})
});
@@ -184,8 +207,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
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 ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -198,7 +224,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
for (int i = 0; i < rootChildren.length; i++) {
model.setElementChildren(
new TreePath(new Object[] { rootChildren[i]} ),
- new TestElement[] { new TestElement(model, i + ".1", new TestElement[0]) });
+ new TestElement[] { new TestElement(model, i + ".1", new TestElement[0]) }); //$NON-NLS-1$
}
fViewer.setAutoExpandLevel(-1);
@@ -208,13 +234,20 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
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))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
assertTrue( fListener.checkCoalesced(TreePath.EMPTY, 0, 6) );
@@ -233,11 +266,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);
+ 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]);
+ 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);
@@ -251,8 +288,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// TODO: redundant label updates on insert!
fListener.setFailOnRedundantUpdates(false);
model.postDelta(delta);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -272,15 +312,18 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
// Insert two new elements at once
- TestElement element0 = new TestElement(model, "00", new TestElement[] {});
- TestElement element1 = new TestElement(model, "01", new TestElement[] {});
+ TestElement element0 = new TestElement(model, "00", new TestElement[] {}); //$NON-NLS-1$
+ TestElement element1 = new TestElement(model, "01", new TestElement[] {}); //$NON-NLS-1$
TreePath elementPath0 = new TreePath(new Object[] { element0 });
TreePath elementPath1 = new TreePath(new Object[] { element1 });
ModelDelta rootDelta = model.insertElementChild(TreePath.EMPTY, 0, element0);
@@ -300,8 +343,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.setFailOnRedundantUpdates(false);
model.postDelta(rootDelta);
- while (!fListener.isFinished())
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -318,8 +364,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished())
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
@@ -328,7 +377,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
IModelDelta removeDelta = model.removeElementChild(TreePath.EMPTY, 3).getChildDeltas()[0];
// Insert new elements at once
- TestElement element = new TestElement(model, "00", new TestElement[] {});
+ TestElement element = new TestElement(model, "00", new TestElement[] {}); //$NON-NLS-1$
TreePath elementPath = new TreePath(new Object[] { element });
IModelDelta insertDelta = model.insertElementChild(TreePath.EMPTY, 1, element).getChildDeltas()[0];
@@ -346,8 +395,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.setFailOnRedundantUpdates(false);
model.postDelta(combinedDelta);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -364,11 +416,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);
+ 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]);
+ 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);
@@ -378,8 +434,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// TODO: redundant updates on add!
fListener.setFailOnRedundantUpdates(false);
model.postDelta(delta);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -397,40 +456,53 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Update the model
- TreePath parentPath = model.findElement("1");
- ModelDelta rootDelta = model.addElementChild(parentPath, null, 0, new TestElement(model, "1.1", new TestElement[0]));
- model.addElementChild(parentPath, rootDelta, 1, new TestElement(model, "1.2", new TestElement[0]));
- model.addElementChild(parentPath, rootDelta, 2, new TestElement(model, "1.3", new TestElement[0]));
- model.addElementChild(parentPath, rootDelta, 3, new TestElement(model, "1.4", new TestElement[0]));
+ TreePath parentPath = model.findElement("1"); //$NON-NLS-1$
+ ModelDelta rootDelta = model.addElementChild(parentPath, null, 0, new TestElement(model, "1.1", new TestElement[0])); //$NON-NLS-1$
+ 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);
model.postDelta(rootDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Update the elements that were added.
fListener.reset();
fListener.addUpdates((IInternalTreeModelViewer)fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
- model.getElementDelta(rootDelta, model.findElement("1.1"), true).setFlags(IModelDelta.CONTENT);
- model.getElementDelta(rootDelta, model.findElement("1.2"), true).setFlags(IModelDelta.CONTENT);
- model.getElementDelta(rootDelta, model.findElement("1.3"), true).setFlags(IModelDelta.CONTENT);
- model.getElementDelta(rootDelta, model.findElement("1.4"), true).setFlags(IModelDelta.CONTENT);
+ model.getElementDelta(rootDelta, model.findElement("1.1"), true).setFlags(IModelDelta.CONTENT); //$NON-NLS-1$
+ 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);
+ 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);
- while (fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, parentPath);
}
@@ -448,15 +520,22 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Expand elment "2"
- TreePath parentPath = model.findElement("2");
+ TreePath parentPath = model.findElement("2"); //$NON-NLS-1$
fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
((IInternalTreeModelViewer)fViewer).expandToLevel(parentPath, 1);
- while (fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Collapse back element "2"
((IInternalTreeModelViewer)fViewer).setExpandedState(parentPath, false);
@@ -465,20 +544,26 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset();
fListener.addUpdates((IInternalTreeModelViewer)fViewer, TreePath.EMPTY, model.getRootElement(), -1, ALL_UPDATES_COMPLETE);
ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.CONTENT);
- model.getElementDelta(rootDelta, model.findElement("2.1"), true).setFlags(IModelDelta.CONTENT);
- model.getElementDelta(rootDelta, model.findElement("2.2"), true).setFlags(IModelDelta.CONTENT);
- model.getElementDelta(rootDelta, model.findElement("2.3"), true).setFlags(IModelDelta.CONTENT);
+ 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 ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Expand back element "2"
fListener.reset(parentPath, model.getElement(parentPath), 1, false, true);
((IInternalTreeModelViewer)fViewer).expandToLevel(parentPath, 1);
- while (fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (fListener.isFinished(CONTENT_SEQUENCE_STARTED) && !fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, parentPath, true);
}
@@ -495,7 +580,11 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
@@ -505,8 +594,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// be processed.
fListener.reset();
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -518,7 +610,11 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Create the delta
@@ -571,8 +667,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
assertFalse(contentProviderViewer.getExpandedState(path_root_3_2_2));
model.postDelta(deltaRoot);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Validate the expansion state AFTER posting the delta.
@@ -586,7 +685,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
List selectionPathsList = Arrays.asList( ((ITreeSelection)selection).getPaths() );
assertTrue(selectionPathsList.contains(path_root_3_2_2));
} else {
- fail("Not a tree selection");
+ fail("Not a tree selection"); //$NON-NLS-1$
}
}
@@ -601,7 +700,11 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Create the delta
@@ -630,7 +733,9 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
break;
}
}
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -643,7 +748,7 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
List selectionPathsList = Arrays.asList( ((ITreeSelection)selection).getPaths() );
assertTrue(selectionPathsList.contains(path_root_3));
} else {
- fail("Not a tree selection");
+ fail("Not a tree selection"); //$NON-NLS-1$
}
}
@@ -659,24 +764,32 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Update the model
- TreePath m4_2_1Path = model.findElement("m4.2.1");
+ TreePath m4_2_1Path = model.findElement("m4.2.1"); //$NON-NLS-1$
TestElement m4_2_1 = model.getElement(m4_2_1Path);
TestModel m4 = m4_2_1.getModel();
TestElement[] newChildren = new TestElement[] {
- new TestElement(m4, "4.2.1.new-1", new TestElement[0]),
- new TestElement(m4, "4.2.1.new-2", new TestElement[0]),
- new TestElement(m4, "4.2.1.new-3", new TestElement[0]),
+ new TestElement(m4, "4.2.1.new-1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m4, "4.2.1.new-2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m4, "4.2.1.new-3", new TestElement[0]), //$NON-NLS-1$
};
ModelDelta delta = m4.setElementChildren(m4_2_1Path, newChildren);
fListener.reset(m4_2_1Path, m4_2_1, -1, true, false);
model.postDelta(delta);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -690,13 +803,17 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
- TreePath m3_1Path = model.findElement("m3.1");
+ 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]);
+ 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);
@@ -705,8 +822,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.setFailOnRedundantUpdates(false);
m3.postDelta(delta);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -718,12 +838,16 @@ 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
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");
+ TreePath parentPath = model.findElement("2"); //$NON-NLS-1$
TestElement parentElement = model.getElement(parentPath);
ModelDelta delta = model.removeElementChild(parentPath, 0);
@@ -731,8 +855,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(parentPath, parentElement, 0, false, false);
//fListener.addChildreCountUpdate(parentPath);
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate the viewer data.
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -744,8 +871,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Update the viewer
fListener.reset(parentPath, parentElement, 0, false, false);
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate the viewer data.
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -757,8 +887,11 @@ abstract public class DeltaTests extends TestCase implements ITestModelUpdatesLi
// Update the viewer
fListener.reset(parentPath, parentElement, 0, false, false);
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate the viewer data.
model.validateData(fViewer, TreePath.EMPTY, true);
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 7c6d8d45a..52308e2d1 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
@@ -76,14 +76,18 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -138,32 +142,32 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
public void testSimpleSingleLevel() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
- doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter("2") });
+ doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
}
public void testSimpleSingleLevelWithTMVFilter() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
- doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter("2", model.getRootElement()) });
+ doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter("2", model.getRootElement()) }); //$NON-NLS-1$
}
public void testSimpleSingleLevelWithMixedFilters() throws InterruptedException {
TestModel model = TestModel.simpleSingleLevel();
- doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter("2", model.getRootElement()), new TestViewerFilter("1") });
+ doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter("2", model.getRootElement()), new TestViewerFilter("1") }); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSimpleMultiLevel() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
- doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter(".1"), new TestViewerFilter(".2") });
+ doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter(".1"), new TestViewerFilter(".2") }); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSimpleMultiLevelWithTMVFilter() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
- doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter(".1", null), new TestTMVFilter(".2", null) });
+ doTestSimpleLevel(model, new ViewerFilter[] { new TestTMVFilter(".1", null), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSimpleMultiLevelWithMixedFilters() throws InterruptedException {
TestModel model = TestModel.simpleMultiLevel();
- doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter(".1"), new TestTMVFilter(".2", null) });
+ doTestSimpleLevel(model, new ViewerFilter[] { new TestViewerFilter(".1"), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
}
private void doTestSimpleLevel(TestModel model, ViewerFilter[] filters) throws InterruptedException {
@@ -181,23 +185,27 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
fViewer.setInput(model.getRootElement());
// Wait for the updates to complete.
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, false, filters);
}
public void testLargeSingleLevel() throws InterruptedException {
- doTestLargeSingleLevel(new ViewerFilter[] { new TestViewerFilter("2") });
+ doTestLargeSingleLevel(new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
}
public void testLargeSingleLevelWithTMVFilter() throws InterruptedException {
- doTestLargeSingleLevel(new ViewerFilter[] { new TestTMVFilter("2", null) });
+ doTestLargeSingleLevel(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
}
private void doTestLargeSingleLevel(ViewerFilter[] filters) throws InterruptedException {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
- model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 3000, "model."));
+ model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 3000, "model.")); //$NON-NLS-1$
// Set filters
fViewer.setFilters(filters);
@@ -208,7 +216,11 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
@@ -217,7 +229,7 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
* Fire REPLACE delta.
*/
public void testReplacedUnrealizedFilteredElement() throws InterruptedException {
- doTestReplacedUnrealizedFilteredElement(new ViewerFilter[] { new TestViewerFilter("2") });
+ doTestReplacedUnrealizedFilteredElement(new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
}
@@ -226,15 +238,15 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
* Fire REPLACE delta.
*/
public void testReplacedUnrealizedFilteredElementWithTMVFilter() throws InterruptedException {
- doTestReplacedUnrealizedFilteredElement(new ViewerFilter[] { new TestTMVFilter("2", null) });
+ doTestReplacedUnrealizedFilteredElement(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
}
private void doTestReplacedUnrealizedFilteredElement(ViewerFilter[] filters) throws InterruptedException {
// Populate a view with a large model (only first 100 elements will be visible in virtual viewer).
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
- model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 300, "model."));
+ model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 300, "model.")); //$NON-NLS-1$
fViewer.setFilters(filters);
@@ -244,20 +256,32 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
// Populate the view (all elements containing a "2" will be filtered out.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Switch out element "201" which is filtered out, with a "replaced element" which should NOT be
// filtered out.
- TestElement replacedElement = new TestElement(model, "replaced element", new TestElement[0]);
+ TestElement replacedElement = new TestElement(model, "replaced element", new TestElement[0]); //$NON-NLS-1$
IModelDelta replaceDelta = model.replaceElementChild(TreePath.EMPTY, 200, replacedElement);
fListener.reset();
model.postDelta(replaceDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Reposition the viewer to make element 100 the top element, making the replaced element visible.
fListener.reset();
((IInternalTreeModelViewer) fViewer).reveal(TreePath.EMPTY, 150);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Verify that the replaced element is in viewer now (i.e. it's not filtered out.
TreePath[] replacedElementPaths = fViewer.getElementPaths(replacedElement);
@@ -266,11 +290,11 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
public void testRefreshUnrealizedFilteredElement() throws InterruptedException {
- doTestRefreshUnrealizedFilteredElement(new ViewerFilter[] { new TestViewerFilter("2") });
+ doTestRefreshUnrealizedFilteredElement(new ViewerFilter[] { new TestViewerFilter("2") }); //$NON-NLS-1$
}
public void testRefreshUnrealizedFilteredElementWithTMVFilter() throws InterruptedException {
- doTestRefreshUnrealizedFilteredElement(new ViewerFilter[] { new TestTMVFilter("2", null) });
+ doTestRefreshUnrealizedFilteredElement(new ViewerFilter[] { new TestTMVFilter("2", null) }); //$NON-NLS-1$
}
/**
@@ -280,8 +304,8 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
private void doTestRefreshUnrealizedFilteredElement(ViewerFilter[] filters) throws InterruptedException {
// Populate a view with a large model (only first 100 elements will be visible in virtual viewer).
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
- model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 300, "model."));
+ model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, 300, "model.")); //$NON-NLS-1$
fViewer.setFilters(filters);
@@ -291,20 +315,32 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
// Populate the view (all elements containing a "2" will be filtered out.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Switch out element "201" which is filtered out, with a "replaced element" which should NOT be
// filtered out.
- TestElement replacedElement = new TestElement(model, "replaced element", new TestElement[0]);
+ TestElement replacedElement = new TestElement(model, "replaced element", new TestElement[0]); //$NON-NLS-1$
model.replaceElementChild(TreePath.EMPTY, 200, replacedElement);
fListener.reset();
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Reposition the viewer to make element 100 the top element, making the replaced element visible.
fListener.reset();
((IInternalTreeModelViewer) fViewer).reveal(TreePath.EMPTY, 150);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Verify that the replaced element is in viewer now (i.e. it's not filtered out.
TreePath[] replacedElementPaths = fViewer.getElementPaths(replacedElement);
@@ -312,15 +348,15 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
}
public void testRefreshToUnfilterElements() throws InterruptedException {
- doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestViewerFilter(".1"), new TestViewerFilter(".2") });
+ doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestViewerFilter(".1"), new TestViewerFilter(".2") }); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testRefreshToUnfilterElementsWithTMVFilter() throws InterruptedException {
- doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestTMVFilter(".1", null), new TestTMVFilter(".2", null) });
+ doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestTMVFilter(".1", null), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testRefreshToUnfilterElementsWithMixedFilters() throws InterruptedException {
- doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestViewerFilter(".1"), new TestTMVFilter(".2", null) });
+ doTestRefreshToUnfilterElements(new ViewerFilter[] { new TestViewerFilter(".1"), new TestTMVFilter(".2", null) }); //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@@ -342,14 +378,22 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
// Populate the view (all elements containing a "2" will be filtered out.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Turn off filters and refresh.
filters = new ViewerFilter[0];
fViewer.setFilters(filters);
fListener.reset();
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, false, filters);
}
@@ -365,7 +409,11 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
StateTests.expandAlternateElements(fListener, model, true);
@@ -373,12 +421,12 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
// Set a selection in view
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(
- new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") });
+new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fViewer.setSelection(originalSelection);
assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
// Set a filter to remove element "1"
- ViewerFilter[] filters = new ViewerFilter[] { new TestViewerFilter("^1$") };
+ ViewerFilter[] filters = new ViewerFilter[] { new TestViewerFilter("^1$") }; //$NON-NLS-1$
fViewer.setFilters(filters);
// Note: Re-expanding nodes causes redundant updates.
@@ -387,18 +435,21 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
// Post the refresh delta
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true, filters);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
// Note: in past it was observed sub-optimal coalescing in this test due
@@ -413,18 +464,21 @@ abstract public class FilterTests extends TestCase implements ITestModelUpdatesL
fListener.reset();
fListener.addUpdates(getInternalViewer(), TreePath.EMPTY, model.getRootElement(), filters, -1, ALL_UPDATES_COMPLETE);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true, filters);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false); //$NON-NLS-1$
assertTrue( StateTests.areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
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 b18ff6f50..afe51e13c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation 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
@@ -77,61 +77,61 @@ public class FilterTransformTests extends TestCase {
}
public void testRemoveMiddleElementFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 3));
+ assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 3)); //$NON-NLS-1$
transform.removeElementFromFilters(TreePath.EMPTY, element3);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 3));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{0, 2, 5, 6}));
+ assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 3)); //$NON-NLS-1$
+ assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 0, 2, 5, 6 })); //$NON-NLS-1$
}
public void testRemoveFirstElementFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0));
+ assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
transform.removeElementFromFilters(TreePath.EMPTY, element0);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 0));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{1, 2, 5, 6}));
+ assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
+ assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 1, 2, 5, 6 })); //$NON-NLS-1$
}
public void testRemoveLastFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 7));
+ assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 7)); //$NON-NLS-1$
transform.removeElementFromFilters(TreePath.EMPTY, element7);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 7));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{0, 2, 3, 6}));
+ assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 7)); //$NON-NLS-1$
+ assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 0, 2, 3, 6 })); //$NON-NLS-1$
}
public void testClearMiddleElementFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 3));
+ assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 3)); //$NON-NLS-1$
transform.clear(TreePath.EMPTY, 3);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 3));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{0, 2, 6, 7}));
+ assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 3)); //$NON-NLS-1$
+ assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 0, 2, 6, 7 })); //$NON-NLS-1$
}
public void testClearFirstElementFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0));
+ assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
transform.clear(TreePath.EMPTY, 0);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 0));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{2, 3, 6, 7}));
+ assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
+ assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 2, 3, 6, 7 })); //$NON-NLS-1$
}
public void testClearLastFromFilters() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 7));
+ assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 7)); //$NON-NLS-1$
transform.clear(TreePath.EMPTY, 7);
- assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 7));
- assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[]{0, 2, 3, 6}));
+ assertFalse("Element should be unfiltered", transform.isFiltered(TreePath.EMPTY, 7)); //$NON-NLS-1$
+ assertTrue("Wrong filter state", equals(transform.getFilteredChildren(TreePath.EMPTY), new int[] { 0, 2, 3, 6 })); //$NON-NLS-1$
}
public void testViewToModelCount() {
- assertEquals("Wrong model count", 8, transform.viewToModelCount(TreePath.EMPTY, 3));
+ assertEquals("Wrong model count", 8, transform.viewToModelCount(TreePath.EMPTY, 3)); //$NON-NLS-1$
}
public void testViewToModelIndex() {
- assertEquals("Wrong model index", 1, transform.viewToModelIndex(TreePath.EMPTY, 0));
- assertEquals("Wrong model index", 4, transform.viewToModelIndex(TreePath.EMPTY, 1));
- assertEquals("Wrong model index", 5, transform.viewToModelIndex(TreePath.EMPTY, 2));
+ assertEquals("Wrong model index", 1, transform.viewToModelIndex(TreePath.EMPTY, 0)); //$NON-NLS-1$
+ assertEquals("Wrong model index", 4, transform.viewToModelIndex(TreePath.EMPTY, 1)); //$NON-NLS-1$
+ assertEquals("Wrong model index", 5, transform.viewToModelIndex(TreePath.EMPTY, 2)); //$NON-NLS-1$
}
public void testAddAlreadyFiltered() {
- assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0));
+ assertTrue("Element should be filtered", transform.isFiltered(TreePath.EMPTY, 0)); //$NON-NLS-1$
boolean added = transform.addFilteredIndex(TreePath.EMPTY, 0, element0);
- assertFalse("Filter should not be added - should already have been there", added);
+ assertFalse("Filter should not be added - should already have been there", added); //$NON-NLS-1$
}
@@ -144,9 +144,9 @@ public class FilterTransformTests extends TestCase {
try {
transform.addFilteredIndex(TreePath.EMPTY, 3, new Object());
} catch (ArrayIndexOutOfBoundsException e) {
- fail("AIOOBE Exception should not be thrown here, " +
- "setModelChildCount should leave " +
- "FilterTransform$Node in a consistent state");
+ fail("AIOOBE Exception should not be thrown here, " + //$NON-NLS-1$
+ "setModelChildCount should leave " + //$NON-NLS-1$
+ "FilterTransform$Node in a consistent state"); //$NON-NLS-1$
}
}
}
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 004fde021..b2f3db69a 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,6 +28,6 @@ public class JFaceViewerCheckTests extends CheckTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.CHECK, new PresentationContext("TestViewer"));
+ 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 2cfae9e6e..68e860470 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,6 +28,6 @@ public class JFaceViewerContentTests extends ContentTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ 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 d43cc73d1..8853315a0 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,7 +28,7 @@ public class JFaceViewerDeltaTests extends DeltaTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ 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/JFaceViewerFilterTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/JFaceViewerFilterTests.java
index 853d2e7c1..654d97b9f 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems and others.
+ * Copyright (c) 2011, 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,6 +28,6 @@ public class JFaceViewerFilterTests extends FilterTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer"));
+ 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 d71000262..b511a32d3 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -27,6 +27,6 @@ public class JFaceViewerLazyTests extends LazyTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ 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 6bd1e922f..e046751c9 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -27,7 +27,7 @@ public class JFaceViewerPerformanceTests extends PerformanceTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
protected int getTestModelDepth() {
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 7e41bac5b..8c4b923a6 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,6 +28,6 @@ public class JFaceViewerPopupTests extends PopupTests {
}
protected ITreeModelViewer createViewer(Display display, Shell shell, int style) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL | style, new PresentationContext("TestViewer"));
+ 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 4a27de8b0..94009bb2c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,6 +28,6 @@ public class JFaceViewerSelectionTests extends SelectionTests {
}
protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ 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 801c75d8c..a20055571 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,6 +28,6 @@ public class JFaceViewerStateTests extends StateTests {
}
protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer"));
+ 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 f1c57adc3..b51a4247b 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
@@ -69,14 +69,18 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -90,7 +94,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
* @return the new viewer
*/
protected TreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer"));
+ return new TreeModelViewer(fShell, SWT.VIRTUAL | SWT.MULTI, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
/**
@@ -110,7 +114,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
new TestElement(model, text, new TestElement[0] );
}
- model.setRoot(new TestElement(model, "root", elements));
+ model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
// Create the listener, only check the first level
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
@@ -118,7 +122,11 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Stop forcing view updates.
@@ -129,7 +137,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
getCTargetViewer().reveal(TreePath.EMPTY, indexRevealElem);
while(fDisplay.readAndDispatch()) {}
final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", originalTopPath);
+ assertNotNull("Top item should not be null!", originalTopPath); //$NON-NLS-1$
// Bug 116105: On a Mac the reveal call is not reliable. Use the viewer returned path instead.
// assertEquals(elements[indexRevealElem], originalTopPath.getLastSegment());
@@ -142,18 +150,25 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model to trigger RESTORE operation.
fListener.reset(false, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
while (fDisplay.readAndDispatch ()) {}
// check if REVEAL was restored OK
final TreePath topPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", topPath);
+ assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
TreePathWrapper.assertEqual(originalTopPath, topPath);
}
@@ -175,8 +190,8 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
if (i == 0) {
elements[i] =
new TestElement(model, text, new TestElement[] {
- new TestElement(model, text + ".1", new TestElement[0] ),
- new TestElement(model, text + ".2", new TestElement[0] )
+ new TestElement(model, text + ".1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, text + ".2", new TestElement[0]) //$NON-NLS-1$
});
} else {
// rest of elements don't have children
@@ -185,7 +200,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
}
}
- model.setRoot(new TestElement(model, "root", elements));
+ model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
// Create the listener, only check the first level
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
@@ -193,7 +208,11 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Expand first element
@@ -211,8 +230,11 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
model.postDelta(rootDelta);
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate that the first node is expanded
assertTrue(getCTargetViewer().getExpandedState(firstElemPath) == true);
@@ -224,7 +246,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
getCTargetViewer().reveal(TreePath.EMPTY, 1);
while(fDisplay.readAndDispatch()) {}
final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", originalTopPath);
+ assertNotNull("Top item should not be null!", originalTopPath); //$NON-NLS-1$
// Bug 116105: On a Mac the reveal call is not reliable. Use the viewer returned path instead.
//assertEquals(elements[1], originalTopPath.getLastSegment());
@@ -236,17 +258,25 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.reset(true, false);
fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model
fListener.reset(false, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
while (fDisplay.readAndDispatch ()) {}
// check if REVEAL was restored OK
final TreePath topPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", topPath);
+ assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
TreePathWrapper.assertEqual(originalTopPath, topPath);
}
@@ -268,8 +298,8 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
if (i == elements.length - 1) {
elements[i] =
new TestElement(model, text, new TestElement[] {
- new TestElement(model, text + ".1", new TestElement[0] ),
- new TestElement(model, text + ".2", new TestElement[0] )
+ new TestElement(model, text + ".1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, text + ".2", new TestElement[0]) //$NON-NLS-1$
});
} else {
// rest of elements don't have children
@@ -280,7 +310,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
}
fViewer.setAutoExpandLevel(-1);
- model.setRoot(new TestElement(model, "root", elements));
+ model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
// Create the listener, only check the first level
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
@@ -288,7 +318,11 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
int indexLastElem = elements.length-1;
@@ -306,7 +340,7 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
getCTargetViewer().reveal(TreePath.EMPTY, indexLastElem-1);
while(fDisplay.readAndDispatch()) {}
final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", originalTopPath);
+ assertNotNull("Top item should not be null!", originalTopPath); //$NON-NLS-1$
// Extract the original state from viewer
ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -317,18 +351,25 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model.
fListener.reset(false, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
while (fDisplay.readAndDispatch ()) {}
// check if REVEAL was restored OK
final TreePath topPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", topPath);
+ assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
TreePathWrapper.assertEqual(originalTopPath, topPath);
}
@@ -349,7 +390,11 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Stop autopopulating the view.
@@ -362,35 +407,48 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Trigger save of state.
fListener.reset();
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ Thread.sleep(0);
+ }
// Set input back to root element.
// Note: Wait only for the processing of the delta and the start of state restore, not for all updates
fListener.reset();
- TreePath elementPath = model.findElement("3");
+ TreePath elementPath = model.findElement("3"); //$NON-NLS-1$
fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 1, STATE_UPDATES);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | STATE_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Update the viewer with new selection delta to something new in the view
- ModelDelta revealDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.REVEAL);
+ ModelDelta revealDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.REVEAL); //$NON-NLS-1$
// Wait for the second model delta to process
fListener.reset();
model.postDelta(revealDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Clear view then reset it again.
fListener.reset();
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ Thread.sleep(0);
+ }
autopopulateAgent = new TreeModelViewerAutopopulateAgent(fViewer);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
autopopulateAgent.dispose();
}
@@ -415,7 +473,11 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Stop auto-populating and auto-expanding the view.
@@ -429,21 +491,26 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Trigger save of state.
fListener.reset();
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ Thread.sleep(0);
+ }
// Set input back to root element.
// Note: Wait only for the processing of the delta and the start of state restore, not for all updates
fListener.reset();
- TreePath elementPath = model.findElement("2");
+ TreePath elementPath = model.findElement("2"); //$NON-NLS-1$
fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 1, STATE_UPDATES | CHILDREN_UPDATES | LABEL_UPDATES);
- elementPath = model.findElement("3");
+ elementPath = model.findElement("3"); //$NON-NLS-1$
fListener.addUpdates(fViewer, elementPath, model.getElement(elementPath), 0, STATE_UPDATES);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Update the viewer with new selection delta to something new in the view
- TreePath pathToBeRevealed = model.findElement("2.1");
+ TreePath pathToBeRevealed = model.findElement("2.1"); //$NON-NLS-1$
ModelDelta revealDelta = model.makeElementDelta(pathToBeRevealed, IModelDelta.REVEAL);
revealDelta.accept(new IModelDeltaVisitor() {
@@ -455,13 +522,16 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Wait for the second model delta to process
model.postDelta(revealDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES | LABEL_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES | LABEL_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// check if REVEAL was triggered by the delta and not by the
// state restore operation
TreePath topPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", topPath);
+ assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
TreePathWrapper.assertEqual(pathToBeRevealed, topPath);
}
@@ -486,17 +556,21 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Stop forcing view updates.
autopopulateAgent.dispose();
// Scroll down to the last part of the tree.
- getCTargetViewer().reveal(model.findElement("3.6.3.16.16.16.16.16"), 1);
+ getCTargetViewer().reveal(model.findElement("3.6.3.16.16.16.16.16"), 1); //$NON-NLS-1$
while(fDisplay.readAndDispatch()) {}
final TreePath originalTopPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", originalTopPath);
+ assertNotNull("Top item should not be null!", originalTopPath); //$NON-NLS-1$
// Extract the original state from viewer
ModelDelta originalState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -506,18 +580,26 @@ public class JFaceViewerTopIndexTests extends TestCase implements ITestModelUpda
fListener.reset(true, false);
fListener.addStateUpdates(getCTargetViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model
fListener.reset(false, false);
fListener.addUpdates(getCTargetViewer(), originalTopPath, (TestElement)originalTopPath.getLastSegment(), 0, STATE_UPDATES);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(STATE_UPDATES | CONTENT_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_UPDATES | CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
while (fDisplay.readAndDispatch ()) {}
// check if REVEAL was restored OK
final TreePath topPath = getCTargetViewer().getTopElementPath();
- assertNotNull("Top item should not be null!", topPath);
+ assertNotNull("Top item should not be null!", topPath); //$NON-NLS-1$
TreePathWrapper.assertEqual(originalTopPath, topPath);
}
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 9c6b5c555..4ebd01ad7 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,6 +28,6 @@ public class JFaceViewerUpdateTests extends UpdateTests {
}
protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new TreeModelViewer(fShell, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ 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 c47cb0ad6..7dacab8ef 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
@@ -69,14 +69,18 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -95,10 +99,10 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
TestModel model = new TestModel();
TestElement[] children = new TestElement[size];
for (int i = 0; i < size; i++) {
- children[i] = new TestElement(model, "1." + i, new TestElement[0]);
+ children[i] = new TestElement(model, "1." + i, new TestElement[0]); //$NON-NLS-1$
}
- TestElement element = new TestElement(model, "1", children);
- model.setRoot(new TestElement(model, "root", new TestElement[] { element }));
+ TestElement element = new TestElement(model, "1", children); //$NON-NLS-1$
+ model.setRoot(new TestElement(model, "root", new TestElement[] { element })); //$NON-NLS-1$
return model;
}
@@ -117,7 +121,11 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Populate initial view content
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, true, true);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Create delta to expand the "1" element.
TestElement rootElement = model.getRootElement();
@@ -129,7 +137,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Add first 250 elements as acceptable to materialize
fListener.reset();
fListener.setFailOnRedundantUpdates(true);
- TreePath expandElementPath = model.findElement("1");
+ TreePath expandElementPath = model.findElement("1"); //$NON-NLS-1$
fListener.addChildreCountUpdate(expandElementPath);
fListener.addLabelUpdate(expandElementPath); // TODO: not sure why label is updated upon expand?
for (int i = 0; i < 250; i++) {
@@ -140,8 +148,11 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
}
model.postDelta(rootDelta);
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE | LABEL_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE | LABEL_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
/**
@@ -164,11 +175,15 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
fListener.setFailOnMultipleModelUpdateSequences(true);
fListener.setFailOnRedundantUpdates(false);
fViewer.setInput(model.getRootElement());
- fListener.addLabelUpdate(model.findElement("1.0"));
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ fListener.addLabelUpdate(model.findElement("1.0")); //$NON-NLS-1$
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set selection so that the initial selection is not empty
- fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("1.0")} ));
+ fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("1.0") })); //$NON-NLS-1$
// Create delta to select the "1" element.
TestElement rootElement = model.getRootElement();
@@ -178,20 +193,23 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
ModelDelta _1Delta = baseDelta.addNode(_1Element, 0, IModelDelta.NO_CHANGE, _1Element.getChildren().length);
// Add the delta to select the "1.1" element.
- TestElement _1_0_newElement = new TestElement(model, "1.0 - new", new TestElement[0]);
- TreePath _1ElementPath = model.findElement("1");
+ TestElement _1_0_newElement = new TestElement(model, "1.0 - new", new TestElement[0]); //$NON-NLS-1$
+ TreePath _1ElementPath = model.findElement("1"); //$NON-NLS-1$
model.replaceElementChild(_1ElementPath, 0, _1_0_newElement);
_1Delta.addNode(_1_0_newElement, 0, IModelDelta.SELECT);
// Add element label update and post the delta
fListener.reset();
fListener.setFailOnRedundantUpdates(true);
- TreePath _1_0_newElementPath = model.findElement("1.0 - new");
+ TreePath _1_0_newElementPath = model.findElement("1.0 - new"); //$NON-NLS-1$
fListener.addLabelUpdate(_1_0_newElementPath);
model.postDelta(rootDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | LABEL_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | LABEL_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
assertEquals(((IStructuredSelection)fViewer.getSelection()).getFirstElement(), _1_0_newElement);
@@ -209,7 +227,11 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Populate initial view content
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, true, true);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Turn off autoexpand
fViewer.setAutoExpandLevel(0);
@@ -217,8 +239,12 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Reposition the viewer to middle of list
fListener.reset();
fListener.setFailOnRedundantUpdates(false);
- fViewer.reveal(model.findElement("1"), 500);
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ fViewer.reveal(model.findElement("1"), 500); //$NON-NLS-1$
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Create delta to refresh the "1" element.
TestElement rootElement = model.getRootElement();
@@ -233,7 +259,7 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
// Add first 250 elements (after element 500) as acceptable to materialize
fListener.reset();
fListener.setFailOnRedundantUpdates(true);
- TreePath refreshElementPath = model.findElement("1");
+ TreePath refreshElementPath = model.findElement("1"); //$NON-NLS-1$
fListener.addRedundantExceptionChildCount(refreshElementPath);
fListener.addRedundantExceptionLabel(refreshElementPath);
fListener.addChildreUpdate(TreePath.EMPTY, 0);
@@ -248,8 +274,11 @@ abstract public class LazyTests extends TestCase implements ITestModelUpdatesLis
}
model.postDelta(rootDelta);
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
}
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 b074971df..0caaf4593 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -70,14 +71,18 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -92,8 +97,8 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
public void testRefreshStruct() throws InterruptedException {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
- model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "model."));
+ model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "model.")); //$NON-NLS-1$
fViewer.setAutoExpandLevel(-1);
@@ -102,7 +107,11 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
@@ -110,15 +119,18 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
try {
for (int i = 0; i < 10; i++) {
// Update the model
- model.setAllAppendix(" - pass " + i);
+ model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
TestElement element = model.getRootElement();
fListener.reset(TreePath.EMPTY, element, -1, false, false);
meter.start();
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
meter.stop();
System.gc();
}
@@ -132,8 +144,8 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
public void testRefreshStruct2() throws InterruptedException {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
- model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements2(model, new int[] { 2, 3000, 1}, "model."));
+ model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements2(model, new int[] { 2, 3000, 1 }, "model.")); //$NON-NLS-1$
fViewer.setAutoExpandLevel(2);
// Create the listener
@@ -142,8 +154,14 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
- //model.validateData(fViewer, TreePath.EMPTY);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE))
+ {
+ if (!fDisplay.readAndDispatch ())
+ {
+ Thread.sleep(0);
+ //model.validateData(fViewer, TreePath.EMPTY);
+ }
+ }
fVirtualItemValidator.setVisibleRange(0, 50);
@@ -152,7 +170,7 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
try {
for (int i = 0; i < 100; i++) {
// Update the model
- model.setAllAppendix(" - pass " + i);
+ model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
TestElement element = model.getRootElement();
//fListener.reset(TreePath.EMPTY, element, -1, false, false);
@@ -160,11 +178,17 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
meter.start();
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
meter.stop();
System.gc();
}
@@ -179,8 +203,8 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
public void testRefreshStructReplaceElements() throws InterruptedException {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
- model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "model."));
+ model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "model.")); //$NON-NLS-1$
fViewer.setAutoExpandLevel(-1);
@@ -189,7 +213,11 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
@@ -197,15 +225,18 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
try {
for (int i = 0; i < 100; i++) {
// Update the model
- model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "pass " + i + "."));
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeMultiLevelElements(model, getTestModelDepth(), "pass " + i + ".")); //$NON-NLS-1$ //$NON-NLS-2$
TestElement element = model.getRootElement();
fListener.reset(TreePath.EMPTY, element, -1, false, false);
meter.start();
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
meter.stop();
System.gc();
}
@@ -220,9 +251,9 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
public void testRefreshList() throws InterruptedException {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
+ model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
int numElements = (int)Math.pow(2, getTestModelDepth());
- model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, numElements, "model."));
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, numElements, "model.")); //$NON-NLS-1$
fViewer.setAutoExpandLevel(-1);
@@ -231,7 +262,11 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
@@ -239,15 +274,18 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
try {
for (int i = 0; i < 100; i++) {
// Update the model
- model.setAllAppendix(" - pass " + i);
+ model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
TestElement element = model.getRootElement();
fListener.reset(TreePath.EMPTY, element, -1, false, false);
meter.start();
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
meter.stop();
System.gc();
}
@@ -271,11 +309,15 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Set a selection in view
- fViewer.setSelection(new TreeSelection(model.findElement("3.2.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);
@@ -285,14 +327,18 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
try {
for (int i = 0; i < 100; i++) {
// Update the model
- model.setAllAppendix(" - pass " + i);
+ model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
// Set the viewer input to null. This will trigger the view to save the viewer state.
fListener.reset(true, false);
meter.start();
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model. When view updates are complete
// the viewer
@@ -300,7 +346,11 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
// TODO: add state updates somehow?
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
meter.stop();
System.gc();
}
@@ -315,9 +365,9 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
public void testRefreshListFiltered() throws InterruptedException {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[0] ) );
+ model.setRoot(new TestElement(model, "root", new TestElement[0])); //$NON-NLS-1$
int numElements = (int)Math.pow(2, getTestModelDepth());
- model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, numElements, "model."));
+ model.setElementChildren(TreePath.EMPTY, TestModel.makeSingleLevelModelElements(model, numElements, "model.")); //$NON-NLS-1$
fViewer.setAutoExpandLevel(-1);
@@ -328,8 +378,8 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (element instanceof TestElement) {
String id = ((TestElement)element).getID();
- if (id.startsWith("model.")) {
- id = id.substring("model.".length());
+ if (id.startsWith("model.")) { //$NON-NLS-1$
+ id = id.substring("model.".length()); //$NON-NLS-1$
}
if (id.length() >= 2 && (id.charAt(1) == '1' || id.charAt(1) == '3' || id.charAt(1) == '5' || id.charAt(1) == '7' || id.charAt(1) == '9')) {
return false;
@@ -341,7 +391,11 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
Performance perf = Performance.getDefault();
@@ -349,15 +403,18 @@ abstract public class PerformanceTests extends TestCase implements ITestModelUpd
try {
for (int i = 0; i < 100; i++) {
// Update the model
- model.setAllAppendix(" - pass " + i);
+ model.setAllAppendix(" - pass " + i); //$NON-NLS-1$
TestElement element = model.getRootElement();
fListener.reset(TreePath.EMPTY, element, -1, false, false);
meter.start();
model.postDelta(new ModelDelta(element, IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
meter.stop();
System.gc();
}
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 e50a3fa23..d99c149ae 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
@@ -81,7 +81,11 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
/**
@@ -98,22 +102,30 @@ abstract public class PopupTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
TestElement element = model.getRootElement().getChildren()[0];
TreePath elementPath = new TreePath(new Object[] { element });
TestElement[] newChildren = new TestElement[] {
- new TestElement(model, "1.1 - new", new TestElement[0]),
- new TestElement(model, "1.2 - new", new TestElement[0]),
- new TestElement(model, "1.3 - new", new TestElement[0]),
+ new TestElement(model, "1.1 - new", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "1.2 - new", new TestElement[0]), //$NON-NLS-1$
+ 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);
model.postDelta(delta);
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -128,7 +140,11 @@ abstract public class PopupTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Create the delta
@@ -161,7 +177,9 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
break;
}
}
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
model.validateData(fViewer, TreePath.EMPTY, true);
@@ -174,7 +192,7 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
List selectionPathsList = Arrays.asList( ((ITreeSelection)selection).getPaths() );
assertFalse(selectionPathsList.contains(path_root_3));
} else {
- fail("Not a tree selection");
+ fail("Not a tree selection"); //$NON-NLS-1$
}
}
@@ -192,21 +210,25 @@ abstract public class PopupTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Turn off auto-expansion
fViewer.setAutoExpandLevel(0);
// Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("3.3.1"));
+ 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]));
+ 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");
+ TreePath elementPath = model.findElement("3"); //$NON-NLS-1$
ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
ModelDelta elementDelta = model.getElementDelta(rootDelta, elementPath, true);
elementDelta.setFlags(IModelDelta.CONTENT);
@@ -217,17 +239,20 @@ abstract public class PopupTests extends TestCase implements ITestModelUpdatesLi
// Post the sub-tree update
model.postDelta(rootDelta);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
- assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true);
+ assertTrue(getCTargetViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
// On windows, getExpandedState() may return true for an element with no children:
// assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.0 - new")) == false);
- assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.2")) == true);
- assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.3")) == true);
+ assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.2")) == true); //$NON-NLS-1$
+ assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.3")) == true); //$NON-NLS-1$
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
diff --git a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java
index 7e4d2d280..654f8074d 100644
--- a/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipe/debug/tests/viewer/model/PresentationContextTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2009 Wind River Systems and others.
+ * Copyright (c) 2008, 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
@@ -33,21 +33,21 @@ public class PresentationContextTests extends TestCase {
* Tests saving and restoring presentation context properties.
*/
public void testSaveRestore () {
- PresentationContext context = new PresentationContext("test");
- context.setProperty("string", "string");
- context.setProperty("integer", new Integer(1));
- context.setProperty("boolean", new Boolean(true));
- context.setProperty("persistable", ResourcesPlugin.getWorkspace().getRoot().getAdapter(IPersistableElement.class));
+ PresentationContext context = new PresentationContext("test"); //$NON-NLS-1$
+ context.setProperty("string", "string"); //$NON-NLS-1$ //$NON-NLS-2$
+ context.setProperty("integer", new Integer(1)); //$NON-NLS-1$
+ context.setProperty("boolean", new Boolean(true)); //$NON-NLS-1$
+ context.setProperty("persistable", ResourcesPlugin.getWorkspace().getRoot().getAdapter(IPersistableElement.class)); //$NON-NLS-1$
- final XMLMemento memento = XMLMemento.createWriteRoot("TEST");
+ final XMLMemento memento = XMLMemento.createWriteRoot("TEST"); //$NON-NLS-1$
context.saveProperites(memento);
- context = new PresentationContext("test");
+ context = new PresentationContext("test"); //$NON-NLS-1$
context.initProperties(memento);
- assertEquals("Wrong value restored", "string", context.getProperty("string"));
- assertEquals("Wrong value restored", new Integer(1), context.getProperty("integer"));
- assertEquals("Wrong value restored", new Boolean(true), context.getProperty("boolean"));
- assertEquals("Wrong value restored", ResourcesPlugin.getWorkspace().getRoot(), context.getProperty("persistable"));
+ assertEquals("Wrong value restored", "string", context.getProperty("string")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ assertEquals("Wrong value restored", new Integer(1), context.getProperty("integer")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong value restored", new Boolean(true), context.getProperty("boolean")); //$NON-NLS-1$ //$NON-NLS-2$
+ assertEquals("Wrong value restored", ResourcesPlugin.getWorkspace().getRoot(), context.getProperty("persistable")); //$NON-NLS-1$ //$NON-NLS-2$
context.dispose();
}
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 3deb65e5d..8f51de89c 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -70,11 +71,15 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
private static class SelectionListener implements ISelectionChangedListener {
- private List fEvents = new ArrayList(1);
+ private final List fEvents = new ArrayList(1);
public void selectionChanged(SelectionChangedEvent event) {
fEvents.add(event);
@@ -86,7 +91,11 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
return model;
}
@@ -106,7 +115,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
fViewer.addSelectionChangedListener(listener);
// Set the selection and verify that the listener is called.
- TreeSelection selection = new TreeSelection(model.findElement("3.3.3"));
+ TreeSelection selection = new TreeSelection(model.findElement("3.3.3")); //$NON-NLS-1$
fViewer.setSelection(selection, true, false);
assertTrue(listener.fEvents.size() == 1);
@@ -125,7 +134,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
final TestModel model = makeMultiLevelModel();
// Set the selection and verify it.
- TreeSelection selection_3_3_3 = new TreeSelection(model.findElement("3.3.3"));
+ 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());
@@ -149,7 +158,7 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
});
// Attempt to change selection and verify that old selection is still valid.
- TreeSelection selection_3_3_1 = new TreeSelection(model.findElement("3.3.1"));
+ TreeSelection selection_3_3_1 = new TreeSelection(model.findElement("3.3.1")); //$NON-NLS-1$
fViewer.setSelection(selection_3_3_1, true, false);
assertEquals(selection_3_3_3, fViewer.getSelection());
@@ -159,21 +168,27 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// 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");
+ TreePath path_3_3_3 = model.findElement("3.3.3"); //$NON-NLS-1$
ModelDelta baseDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
ModelDelta delta_3_3_3 = model.getElementDelta(baseDelta, path_3_3_3, false);
delta_3_3_3.setFlags(IModelDelta.SELECT);
fViewer.updateViewer(baseDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
assertEquals(selection_3_3_1, fViewer.getSelection());
// Add the *force* flag to the selection delta and update viewer again.
// Verify that selection did change.
delta_3_3_3.setFlags(IModelDelta.SELECT | IModelDelta.FORCE);
fViewer.updateViewer(baseDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
assertEquals(selection_3_3_3, fViewer.getSelection());
}
@@ -192,14 +207,14 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
TestModel model = makeMultiLevelModel();
// Create a selection object to the deepest part of the tree.
- TreePath elementPath = model.findElement("3.3.3");
+ TreePath elementPath = model.findElement("3.3.3"); //$NON-NLS-1$
TreeSelection selection = new TreeSelection(elementPath);
// Set the selection.
fViewer.setSelection(selection, true, false);
// Remove the element
- TreePath removePath = model.findElement("3");
+ TreePath removePath = model.findElement("3"); //$NON-NLS-1$
TreePath parentPath = removePath.getParentPath();
int removeIndex = model.getElement(parentPath).indexOf( model.getElement(removePath) );
ModelDelta delta = model.removeElementChild(removePath.getParentPath(), removeIndex);
@@ -212,8 +227,11 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// delta only wait for the delta to be processed.
fListener.reset();
model.postDelta(delta);
- while (!fListener.isFinished(ITestModelUpdatesListenerConstants.MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ITestModelUpdatesListenerConstants.MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check to make sure the selection was made
//assertTrue(listener.fEvents.size() == 1);
@@ -238,14 +256,14 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
TestModel model = makeMultiLevelModel();
// Create a selection object to the deepest part of the tree.
- TreePath elementPath = model.findElement("3.3.3");
+ TreePath elementPath = model.findElement("3.3.3"); //$NON-NLS-1$
TreeSelection selection = new TreeSelection(elementPath);
// Set the selection.
fViewer.setSelection(selection, true, false);
// Remove the element
- TreePath removePath = model.findElement("3");
+ TreePath removePath = model.findElement("3"); //$NON-NLS-1$
TreePath parentPath = removePath.getParentPath();
int removeIndex = model.getElement(parentPath).indexOf( model.getElement(removePath) );
model.removeElementChild(removePath.getParentPath(), removeIndex);
@@ -260,8 +278,11 @@ abstract public class SelectionTests extends TestCase implements ITestModelUpdat
// Refresh the viewer
model.postDelta( new ModelDelta(model.getRootElement(), IModelDelta.CONTENT) );
- while (!fListener.isFinished(ITestModelUpdatesListenerConstants.ALL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ITestModelUpdatesListenerConstants.ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check to make sure the selection was made
// Commented out until JFace bug 219887 is fixed.
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 bef7245cb..ee5206699 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
@@ -75,14 +75,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -103,7 +107,11 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Create the update delta
@@ -138,15 +146,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addLabelUpdate(path3);
fViewer.updateViewer(updateDelta);
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE | LABEL_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// 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);
+ fail("Expected:\n" + updateDelta.toString() + "\nGot:\n" + savedDelta); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -197,12 +208,12 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
String text = Integer.toString(i + 1);
elements[i] =
new TestElement(model, text, new TestElement[] {
- new TestElement(model, text + ".1", new TestElement[] {
- new TestElement(model, text + ".1.1", new TestElement[0])
+ 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));
+ model.setRoot(new TestElement(model, "root", elements)); //$NON-NLS-1$
return model;
}
@@ -247,8 +258,11 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
}
model.postDelta(rootDelta);
- while (!listener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE))
- if (!Display.getDefault().readAndDispatch ()) Thread.sleep(0);
+ while (!listener.isFinished(CONTENT_SEQUENCE_COMPLETE | MODEL_CHANGED_COMPLETE)) {
+ if (!Display.getDefault().readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
public void testPreserveExpandedOnRemove() throws InterruptedException {
@@ -262,13 +276,17 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(fListener, model, true);
// Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1"));
+ TreeSelection originalSelection = new TreeSelection(model.findElement("5.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
// Update the model
@@ -277,18 +295,21 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Remove delta should not generate any new updates
fListener.reset();
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ 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);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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()) );
}
@@ -303,38 +324,45 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(fListener, model, true);
// Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1"));
+ 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]));
+ 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");
+ 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.addChildreUpdate(TreePath.EMPTY, 0);
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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()) );
}
@@ -349,7 +377,11 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(fListener, model, true);
@@ -357,7 +389,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set a selection in view
// Set a selection in view
TreeSelection originalSelection = new TreeSelection(
- new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") });
+new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fViewer.setSelection(originalSelection);
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
@@ -370,23 +402,26 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// 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);
+ 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))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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
@@ -407,21 +442,25 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Turn off auto-expansion
fViewer.setAutoExpandLevel(0);
// Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("3.3.1"));
+ 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]));
+ 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");
+ TreePath elementPath = model.findElement("3"); //$NON-NLS-1$
ModelDelta rootDelta = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
ModelDelta elementDelta = model.getElementDelta(rootDelta, elementPath, true);
elementDelta.setFlags(IModelDelta.CONTENT);
@@ -432,17 +471,20 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Post the sub-tree update
model.postDelta(rootDelta);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
// On windows, getExpandedState() may return true for an element with no children:
// assertTrue(getCTargetViewer().getExpandedState(model.findElement("3.0 - new")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.2")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.3")) == true);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.2")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.3")) == true); //$NON-NLS-1$
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
}
@@ -457,7 +499,11 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
expandAlternateElements(fListener, model, true);
@@ -465,7 +511,7 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set a selection in view
// TreeSelection originalSelection = new TreeSelection(
// new TreePath[] { model.findElement("5"), model.findElement("5.1"), model.findElement("6") });
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1"));
+ TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
@@ -479,39 +525,45 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(false, false);
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 ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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]));
+ 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);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
model.validateData(fViewer, TreePath.EMPTY, true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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()) );
}
}
@@ -527,13 +579,19 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE))
+ {
+ if (!fDisplay.readAndDispatch ())
+ {
+ Thread.sleep(0);
// model.validateData(fViewer, TreePath.EMPTY, true);
+ }
+ }
expandAlternateElements(fListener, model, false);
// Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1"));
+ TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
@@ -543,34 +601,42 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Note: Re-expanding nodes causes redundant updates.
fListener.reset(false, false);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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]));
+ 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));
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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()) );
}
@@ -591,11 +657,15 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Set a selection in view
- fViewer.setSelection(new TreeSelection(model.findElement("3.1.1")));
+ fViewer.setSelection(new TreeSelection(model.findElement("3.1.1"))); //$NON-NLS-1$
// Reset the listener (ignore redundant updates)
fListener.reset(TreePath.EMPTY, model.getRootElement(), -1, false, false);
@@ -603,25 +673,34 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Refresh content.
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Update the viewer with new selection delta to something new in the view
- ModelDelta selectDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.SELECT);
+ ModelDelta selectDelta = model.makeElementDelta(model.findElement("2.1"), IModelDelta.SELECT); //$NON-NLS-1$
// Wait for the second model delta to process
fListener.resetModelChanged();
model.postDelta(selectDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ 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))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check to make sure that the state restore didn't change the selection.
- assertEquals(new TreeSelection(model.findElement("2.1")), fViewer.getSelection());
+ assertEquals(new TreeSelection(model.findElement("2.1")), fViewer.getSelection()); //$NON-NLS-1$
}
public void testPreserveCollapseDeltaAfterContent() throws InterruptedException {
@@ -636,7 +715,11 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Turn off auto-expand
@@ -648,38 +731,47 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Refresh content.
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Update the viewer to collapse an element
- ModelDelta collapseDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.COLLAPSE);
+ ModelDelta collapseDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.COLLAPSE); //$NON-NLS-1$
// 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"));
- fListener.removeLabelUpdate(model.findElement("3.1.2"));
- fListener.removeLabelUpdate(model.findElement("3.1.3"));
- fListener.removeHasChildrenUpdate(model.findElement("3.1.1"));
- fListener.removeHasChildrenUpdate(model.findElement("3.1.2"));
- fListener.removeHasChildrenUpdate(model.findElement("3.1.3"));
- fListener.removeChildreCountUpdate(model.findElement("3.1"));
- fListener.removeChildrenUpdate(model.findElement("3.1"), 0);
- fListener.removeChildrenUpdate(model.findElement("3.1"), 1);
- fListener.removeChildrenUpdate(model.findElement("3.1"), 2);
+ fListener.removeLabelUpdate(model.findElement("3.1.1")); //$NON-NLS-1$
+ fListener.removeLabelUpdate(model.findElement("3.1.2")); //$NON-NLS-1$
+ fListener.removeLabelUpdate(model.findElement("3.1.3")); //$NON-NLS-1$
+ fListener.removeHasChildrenUpdate(model.findElement("3.1.1")); //$NON-NLS-1$
+ fListener.removeHasChildrenUpdate(model.findElement("3.1.2")); //$NON-NLS-1$
+ fListener.removeHasChildrenUpdate(model.findElement("3.1.3")); //$NON-NLS-1$
+ fListener.removeChildreCountUpdate(model.findElement("3.1")); //$NON-NLS-1$
+ fListener.removeChildrenUpdate(model.findElement("3.1"), 0); //$NON-NLS-1$
+ fListener.removeChildrenUpdate(model.findElement("3.1"), 1); //$NON-NLS-1$
+ fListener.removeChildrenUpdate(model.findElement("3.1"), 2); //$NON-NLS-1$
// Wait for the second model delta to process
model.postDelta(collapseDelta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ 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))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check to make sure that the state restore didn't change the selection.
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == false); //$NON-NLS-1$
}
public void testPreserveExpandDeltaAfterContent() throws InterruptedException {
@@ -693,7 +785,11 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Reset the listener (ignore redundant updates)
@@ -702,25 +798,34 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Refresh content.
// Note: Wait only for the processing of the delta, not for all updates
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Update the viewer to expand an element
- ModelDelta expandDelta = model.makeElementDelta(model.findElement("3.1"), IModelDelta.EXPAND);
+ 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);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ 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))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE | STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check to make sure that the state restore didn't change the selection.
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
}
@@ -735,14 +840,18 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Expand some, but not all elements
expandAlternateElements(fListener, model, true);
// 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") } ));
+ 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);
@@ -752,8 +861,11 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(false, false);
fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model. When view updates are complete
// the viewer
@@ -761,14 +873,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
// TODO: add state updates somehow?
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Extract the restored state from viewer
ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
if (!deltaMatches(originalState, restoredState)) {
- fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState);
+ fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -784,12 +900,16 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Set a selection in view
- fViewer.setSelection(new TreeSelection(new TreePath[] { model.findElement("3.2"), model.findElement("3.2.1"), model.findElement("2") } ));
- fViewer.setSelection(new TreeSelection(model.findElement("3.2.3")));
+ 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);
@@ -803,8 +923,11 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model. When view updates are complete
// the viewer
@@ -812,14 +935,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
// TODO: add state updates somehow?
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Extract the restored state from viewer
ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
if (!deltaMatches(originalState, restoredState)) {
- fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState);
+ fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -834,14 +961,18 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Expand some, but not all elements
expandAlternateElements(fListener, model, true);
// 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") } ));
+ 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);
@@ -854,14 +985,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// 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 ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Extract the restored state from viewer
ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
if (!deltaMatches(originalState, restoredState)) {
- fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState);
+ fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -876,14 +1011,18 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// Expand some, but not all elements
expandAlternateElements(fListener, model, true);
// 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") } ));
+ 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);
@@ -899,14 +1038,18 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.reset(TreePath.EMPTY, model.getRootElement(), 1, false, false);
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Extract the restored state from viewer
ModelDelta restoredState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
fViewer.saveElementState(TreePath.EMPTY, restoredState, IModelDelta.EXPAND | IModelDelta.SELECT);
if (!deltaMatches(originalState, restoredState)) {
- fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState);
+ fail("Expected:\n" + originalState.toString() + "\nGot:\n" + restoredState); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -922,12 +1065,16 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
expandAlternateElements(fListener, model, false);
// Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1"));
+ TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
@@ -940,26 +1087,33 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model. When view updates are complete
// the viewer
// Note: disable redundant updates because the reveal delta triggers one.
fListener.reset();
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data (only select visible elements).
- assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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()) );
}
@@ -979,12 +1133,16 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
expandAlternateElements(fListener, model, false);
// Set a selection in view
- TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1"));
+ TreeSelection originalSelection = new TreeSelection(model.findElement("5.1.1")); //$NON-NLS-1$
fViewer.setSelection(originalSelection);
assertTrue( areTreeSelectionsEqual(originalSelection, (ITreeSelection)fViewer.getSelection()) );
@@ -997,8 +1155,11 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.addStateUpdates(getInternalViewer(), originalState, IModelDelta.EXPAND | IModelDelta.SELECT | IModelDelta.REVEAL);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE | STATE_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
TestElement[] elements = model.getRootElement().getChildren();
@@ -1013,18 +1174,22 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fViewer.setInput(model.getRootElement());
// MONITOR FOR THE STATE RESTORE TO COMPLETE
- while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE| STATE_RESTORE_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_SEQUENCE_COMPLETE| STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Validate data
- assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("5.1")) == true);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("6")) == false);
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("1.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3.1")) == true); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("4")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("5")) == true); //$NON-NLS-1$
+ 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()) );
}
@@ -1040,10 +1205,14 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
- fViewer.setSelection(new TreeSelection(model.findElement("3")));
+ fViewer.setSelection(new TreeSelection(model.findElement("3"))); //$NON-NLS-1$
// Turn off auto-expand
fViewer.setAutoExpandLevel(0);
@@ -1051,50 +1220,68 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
// Set the viewer input to null. This will trigger the view to save the viewer state.
fListener.reset(false, false);
fViewer.setInput(null);
- while (!fListener.isFinished(STATE_SAVE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_SAVE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Set the viewer input back to the model. When view updates are complete
// 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());
- TreePath path = model.findElement("2");
+ TreePath path = model.findElement("2"); //$NON-NLS-1$
fListener.addUpdates(null, path, (TestElement)path.getLastSegment(), 0, STATE_UPDATES);
- path = model.findElement("3");
+ path = model.findElement("3"); //$NON-NLS-1$
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
// posting the next delta.
- while (!fListener.isFinished(STATE_RESTORE_STARTED | STATE_UPDATES | CHILDREN_UPDATES | MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ 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));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ model.postDelta(model.makeElementDelta(model.findElement("2"), IModelDelta.COLLAPSE)); //$NON-NLS-1$
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Post second collapse delta
fListener.resetModelChanged();
- model.postDelta(model.makeElementDelta(model.findElement("3"), IModelDelta.COLLAPSE));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ model.postDelta(model.makeElementDelta(model.findElement("3"), IModelDelta.COLLAPSE)); //$NON-NLS-1$
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Post select delta
- model.postDelta(model.makeElementDelta(model.findElement("1"), IModelDelta.SELECT));
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ model.postDelta(model.makeElementDelta(model.findElement("1"), IModelDelta.SELECT)); //$NON-NLS-1$
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Wait for all the updates to complete (note: we're not resetting the listener).
- while (!fListener.isFinished(STATE_RESTORE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(STATE_RESTORE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Check to make sure that the state restore didn't change the selection.
- assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false);
- assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == false);
- assertEquals(new TreeSelection(model.findElement("1")), fViewer.getSelection());
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("2")) == false); //$NON-NLS-1$
+ assertTrue(getInternalViewer().getExpandedState(model.findElement("3")) == false); //$NON-NLS-1$
+ assertEquals(new TreeSelection(model.findElement("1")), fViewer.getSelection()); //$NON-NLS-1$
}
/**
@@ -1114,7 +1301,11 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY, true);
// a new similar model
@@ -1125,9 +1316,11 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
fListener.expectRestoreAfterSaveComplete();
fViewer.setInput(copyModel.getRootElement());
while (!fListener.isFinished(STATE_RESTORE_STARTED)) {
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
- assertTrue("RESTORE started before SAVE to complete", fListener.isFinished(STATE_SAVE_COMPLETE));
+ assertTrue("RESTORE started before SAVE to complete", fListener.isFinished(STATE_SAVE_COMPLETE)); //$NON-NLS-1$
}
/**
@@ -1143,7 +1336,11 @@ abstract public class StateTests 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);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
ModelDelta expandedState = new ModelDelta(model.getRootElement(), IModelDelta.NO_CHANGE);
@@ -1155,13 +1352,20 @@ abstract public class StateTests extends TestCase implements ITestModelUpdatesLi
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);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
fViewer.setInput(null);
fViewer.updateViewer(expandedState);
- while (!fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING)) {
+ if (!fDisplay.readAndDispatch ()) {
+ 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 4bed630bd..fd46141f7 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -15,8 +16,6 @@ import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
-import junit.framework.Assert;
-
import org.eclipse.core.runtime.PlatformObject;
import org.eclipse.debug.internal.ui.viewers.model.IInternalTreeModelViewer;
import org.eclipse.debug.internal.ui.viewers.model.provisional.ICheckUpdate;
@@ -43,6 +42,7 @@ import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
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
@@ -57,7 +57,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
private final TestModel fModel;
private final String fID;
TestElement[] fChildren;
- String fLabelAppendix = "";
+ String fLabelAppendix = ""; //$NON-NLS-1$
boolean fExpanded;
boolean fChecked;
boolean fGrayed;
@@ -324,7 +324,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
update.done();
}
- public final static String ELEMENT_MEMENTO_ID = "id";
+ public final static String ELEMENT_MEMENTO_ID = "id"; //$NON-NLS-1$
public void compareElements(final IElementCompareRequest[] updates) {
doUpdate(updates);
@@ -412,8 +412,8 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
IInternalTreeModelViewer viewer = (IInternalTreeModelViewer)_viewer;
TestElement element = getElement(path);
if ( Boolean.TRUE.equals(_viewer.getPresentationContext().getProperty(ICheckUpdate.PROP_CHECK)) ) {
- Assert.assertEquals(element.getChecked(), viewer.getElementChecked(path));
- Assert.assertEquals(element.getGrayed(), viewer.getElementGrayed(path));
+ Assert.assertTrue(element.getChecked() == viewer.getElementChecked(path));
+ Assert.assertTrue(element.getGrayed() == viewer.getElementGrayed(path));
}
if (!expandedElementsOnly || path.getSegmentCount() == 0 || viewer.getExpandedState(path) ) {
@@ -424,14 +424,14 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
if (TestModelUpdatesListener.isFiltered(children[i], filters)) {
continue;
}
- Assert.assertEquals(children[i], viewer.getChildElement(path, viewerIndex));
+ Assert.assertEquals(children[i], viewer.getChildElement(path, viewerIndex));
validateData(viewer, path.createChildPath(children[i]), expandedElementsOnly, filters);
viewerIndex++;
}
Assert.assertEquals(viewerIndex, viewer.getChildCount(path));
} else if (!viewer.getExpandedState(path)) {
// If element not expanded, verify the plus sign.
- Assert.assertEquals(viewer.getHasChildren(path), element.getChildren().length > 0);
+ Assert.assertTrue(viewer.getHasChildren(path) == element.getChildren().length > 0);
}
}
@@ -470,7 +470,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
}
if (j == children.length) {
- throw new IllegalArgumentException("Invalid path");
+ throw new IllegalArgumentException("Invalid path"); //$NON-NLS-1$
}
}
return delta;
@@ -486,7 +486,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
public ModelDelta appendElementLabel(TreePath path, String labelAppendix) {
- Assert.assertTrue(path.startsWith(fRootPath, null));
+ org.junit.Assert.assertTrue(path.startsWith(fRootPath, null));
ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
ModelDelta baseDelta = getBaseDelta(rootDelta);
TreePath relativePath = getRelativePath(path);
@@ -499,7 +499,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
public ModelDelta setElementChecked(TreePath path, boolean checked, boolean grayed) {
- Assert.assertTrue(path.startsWith(fRootPath, null));
+ Assert.assertTrue(path.startsWith(fRootPath, null));
ModelDelta rootDelta = new ModelDelta(fInput, IModelDelta.NO_CHANGE);
ModelDelta baseDelta = getBaseDelta(rootDelta);
TreePath relativePath = getRelativePath(path);
@@ -658,7 +658,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
}
public String toString() {
- return getElementString(fRoot, "");
+ return getElementString(fRoot, ""); //$NON-NLS-1$
}
public String getElementString(TestElement element, String indent) {
@@ -668,14 +668,14 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
builder.append('\n');
TestElement[] children = element.getChildren();
for (int i = 0; i < children.length; i++) {
- builder.append(getElementString(children[i], indent + " "));
+ builder.append(getElementString(children[i], indent + " ")); //$NON-NLS-1$
}
return builder.toString();
}
public static TestModel simpleSingleLevel() {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", makeSingleLevelModelElements(model, 6, "")));
+ model.setRoot( new TestElement(model, "root", makeSingleLevelModelElements(model, 6, ""))); //$NON-NLS-1$ //$NON-NLS-2$
return model;
}
@@ -692,7 +692,7 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
TestElement[] elements = new TestElement[depth];
for (int i = 0; i < depth; i++) {
String name = prefix + i;
- elements[i] = new TestElement(model, name, makeMultiLevelElements(model, i, name + "."));
+ elements[i] = new TestElement(model, name, makeMultiLevelElements(model, i, name + ".")); //$NON-NLS-1$
}
return elements;
}
@@ -706,35 +706,35 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
TestElement[] elements = new TestElement[count];
for (int i = 0; i < count; i++) {
String name = prefix + i;
- elements[i] = new TestElement(model, name, makeMultiLevelElements2(model, levelCounts, name + "."));
+ elements[i] = new TestElement(model, name, makeMultiLevelElements2(model, levelCounts, name + ".")); //$NON-NLS-1$
}
return elements;
}
public static TestModel simpleMultiLevel() {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[] {
- new TestElement(model, "1", new TestElement[0]),
- new TestElement(model, "2", true, false, new TestElement[] {
- new TestElement(model, "2.1", true, true, new TestElement[0]),
- new TestElement(model, "2.2", false, true, new TestElement[0]),
- new TestElement(model, "2.3", true, false, new TestElement[0]),
+ 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", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2.3", true, false, new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3", new TestElement[] {
- new TestElement(model, "3.1", new TestElement[] {
- new TestElement(model, "3.1.1", new TestElement[0]),
- new TestElement(model, "3.1.2", new TestElement[0]),
- new TestElement(model, "3.1.3", new TestElement[0]),
+ new TestElement(model, "3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.1", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.1.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.1.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.1.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3.2", new TestElement[] {
- new TestElement(model, "3.2.1", new TestElement[0]),
- new TestElement(model, "3.2.2", new TestElement[0]),
- new TestElement(model, "3.2.3", new TestElement[0]),
+ new TestElement(model, "3.2", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.2.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.2.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.2.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3.3", new TestElement[] {
- new TestElement(model, "3.3.1", new TestElement[0]),
- new TestElement(model, "3.3.2", new TestElement[0]),
- new TestElement(model, "3.3.3", new TestElement[0]),
+ new TestElement(model, "3.3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.3.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.3.3", new TestElement[0]), //$NON-NLS-1$
}),
})
}) );
@@ -743,39 +743,39 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
public static TestModel compositeMultiLevel() {
TestModel m2 = new TestModel();
- m2.setRoot( new TestElement(m2, "m2.root", new TestElement[] {
- new TestElement(m2, "m2.1", new TestElement[0]),
- new TestElement(m2, "m2.2", true, false, new TestElement[] {
- new TestElement(m2, "m2.2.1", true, true, new TestElement[0]),
- new TestElement(m2, "m2.2.2", false, true, new TestElement[0]),
- new TestElement(m2, "m2.2.3", true, false, new TestElement[0]),
+ m2.setRoot( new TestElement(m2, "m2.root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(m2, "m2.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m2, "m2.2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(m2, "m2.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m2, "m2.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m2, "m2.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
}),
}) );
TestModel m3 = new TestModel();
- m3.setRoot( new TestElement(m3, "m3.root", new TestElement[] {
- new TestElement(m3, "m3.1", new TestElement[0]),
- new TestElement(m3, "m3.2", true, false, new TestElement[] {
- new TestElement(m3, "m3.2.1", true, true, new TestElement[0]),
- new TestElement(m3, "m3.2.2", false, true, new TestElement[0]),
- new TestElement(m3, "m3.2.3", true, false, new TestElement[0]),
+ m3.setRoot( new TestElement(m3, "m3.root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(m3, "m3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m3, "m3.2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(m3, "m3.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m3, "m3.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m3, "m3.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
}),
}) );
TestModel m4 = new TestModel();
- m4.setRoot( new TestElement(m4, "m4.root", new TestElement[] {
- new TestElement(m4, "m4.1", new TestElement[0]),
- new TestElement(m4, "m4.2", true, false, new TestElement[] {
- new TestElement(m4, "m4.2.1", true, true, new TestElement[0]),
- new TestElement(m4, "m4.2.2", false, true, new TestElement[0]),
- new TestElement(m4, "m4.2.3", true, false, new TestElement[0]),
+ m4.setRoot( new TestElement(m4, "m4.root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(m4, "m4.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m4, "m4.2", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(m4, "m4.2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m4, "m4.2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m4, "m4.2.3", true, false, new TestElement[0]), //$NON-NLS-1$
}),
}) );
TestModel m1 = new TestModel();
- m1.setRoot( new TestElement(m1, "m1.root", new TestElement[] {
- new TestElement(m1, "m1.1", new TestElement[0]),
- new TestElement(m1, "m1.2", true, false, new TestElement[] {
+ m1.setRoot( new TestElement(m1, "m1.root", new TestElement[] { //$NON-NLS-1$
+ new TestElement(m1, "m1.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(m1, "m1.2", true, false, new TestElement[] { //$NON-NLS-1$
m2.fRoot,
m3.fRoot,
m4.fRoot,
@@ -788,133 +788,133 @@ public class TestModel implements IElementContentProvider, IElementLabelProvider
public static TestModel simpleDeepMultiLevel() {
TestModel model = new TestModel();
- model.setRoot( new TestElement(model, "root", new TestElement[] {
- new TestElement(model, "1", new TestElement[0]),
- new TestElement(model, "2", true, false, new TestElement[] {
- new TestElement(model, "2.1", true, true, new TestElement[0]),
- new TestElement(model, "2.2", false, true, new TestElement[0]),
- new TestElement(model, "2.3", true, false, new TestElement[0]),
+ 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", true, false, new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "2.1", true, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2.2", false, true, new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2.3", true, false, new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3", new TestElement[] {
- new TestElement(model, "3.1", new TestElement[] {
- new TestElement(model, "3.1.1", new TestElement[0]),
- new TestElement(model, "3.1.2", new TestElement[0]),
- new TestElement(model, "3.1.3", new TestElement[0]),
+ new TestElement(model, "3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.1", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.1.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.1.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.1.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3.2", new TestElement[] {
- new TestElement(model, "3.2.1", new TestElement[0]),
- new TestElement(model, "3.2.2", new TestElement[0]),
- new TestElement(model, "3.2.3", new TestElement[0]),
+ new TestElement(model, "3.2", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.2.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.2.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.2.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3.3", new TestElement[] {
- new TestElement(model, "3.3.1", new TestElement[0]),
- new TestElement(model, "3.3.2", new TestElement[0]),
- new TestElement(model, "3.3.3", new TestElement[0]),
+ new TestElement(model, "3.3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.3.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.3.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3.4", new TestElement[] {
- new TestElement(model, "3.4.1", new TestElement[0]),
- new TestElement(model, "3.4.2", new TestElement[0]),
- new TestElement(model, "3.4.3", new TestElement[0]),
+ new TestElement(model, "3.4", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.4.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.4.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.4.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3.5", new TestElement[] {
- new TestElement(model, "3.5.1", new TestElement[0]),
- new TestElement(model, "3.5.2", new TestElement[0]),
- new TestElement(model, "3.5.3", new TestElement[0]),
+ new TestElement(model, "3.5", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.5.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.5.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.5.3", new TestElement[0]), //$NON-NLS-1$
}),
- new TestElement(model, "3.6", new TestElement[] {
- new TestElement(model, "3.6.1", new TestElement[0]),
- new TestElement(model, "3.6.2", new TestElement[0]),
- new TestElement(model, "3.6.3", new TestElement[] {
- new TestElement(model, "3.6.3.1", new TestElement[0]),
- new TestElement(model, "3.6.3.2", new TestElement[0]),
- new TestElement(model, "3.6.3.4", new TestElement[0]),
- new TestElement(model, "3.6.3.5", new TestElement[0]),
- new TestElement(model, "3.6.3.6", new TestElement[0]),
- new TestElement(model, "3.6.3.7", new TestElement[0]),
- new TestElement(model, "3.6.3.8", new TestElement[0]),
- new TestElement(model, "3.6.3.9", new TestElement[0]),
- new TestElement(model, "3.6.3.10", new TestElement[0]),
- new TestElement(model, "3.6.3.11", new TestElement[0]),
- new TestElement(model, "3.6.3.12", new TestElement[0]),
- new TestElement(model, "3.6.3.13", new TestElement[0]),
- new TestElement(model, "3.6.3.14", new TestElement[0]),
- new TestElement(model, "3.6.3.15", new TestElement[0]),
- new TestElement(model, "3.6.3.16", new TestElement[] {
- new TestElement(model, "3.6.3.16.1", new TestElement[0]),
- new TestElement(model, "3.6.3.16.2", new TestElement[0]),
- new TestElement(model, "3.6.3.16.4", new TestElement[0]),
- new TestElement(model, "3.6.3.16.5", new TestElement[0]),
- new TestElement(model, "3.6.3.16.6", new TestElement[0]),
- new TestElement(model, "3.6.3.16.7", new TestElement[0]),
- new TestElement(model, "3.6.3.16.8", new TestElement[0]),
- new TestElement(model, "3.6.3.16.9", new TestElement[0]),
- new TestElement(model, "3.6.3.16.10", new TestElement[0]),
- new TestElement(model, "3.6.3.16.11", new TestElement[0]),
- new TestElement(model, "3.6.3.16.12", new TestElement[0]),
- new TestElement(model, "3.6.3.16.13", new TestElement[0]),
- new TestElement(model, "3.6.3.16.14", new TestElement[0]),
- new TestElement(model, "3.6.3.16.15", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16", new TestElement[] {
- new TestElement(model, "3.6.3.16.16.1", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.2", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.4", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.5", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.6", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.7", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.8", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.9", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.10", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.11", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.12", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.13", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.14", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.15", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16", new TestElement[] {
- new TestElement(model, "3.6.3.16.16.16.1", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.2", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.4", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.5", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.6", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.7", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.8", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.9", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.10", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.11", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.12", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.13", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.14", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.15", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16", new TestElement[] {
- new TestElement(model, "3.6.3.16.16.16.16.1", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.2", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.4", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.5", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.6", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.7", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.8", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.9", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.10", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.11", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.12", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.13", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.14", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.15", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16", new TestElement[] {
- new TestElement(model, "3.6.3.16.16.16.16.16.1", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.2", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.4", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.5", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.6", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.7", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.8", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.9", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.10", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.11", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.12", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.13", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.14", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.15", new TestElement[0]),
- new TestElement(model, "3.6.3.16.16.16.16.16.16", new TestElement[0]),
+ new TestElement(model, "3.6", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16", new TestElement[] { //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.4", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.5", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.6", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.7", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.8", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.9", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.10", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.11", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.12", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.13", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.14", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.15", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3.6.3.16.16.16.16.16.16", new TestElement[0]), //$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 1a1f66c4c..fe151710b 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 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
@@ -8,6 +8,7 @@
* Contributors:
* Wind River Systems - initial API and implementation
* Dorin Ciuca - Top index fix (Bug 324100)
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -19,8 +20,6 @@ import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
-import junit.framework.Assert;
-
import org.eclipe.debug.tests.viewer.model.TestModel.TestElement;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
@@ -42,6 +41,7 @@ import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.jface.viewers.ViewerFilter;
+import org.junit.Assert;
public class TestModelUpdatesListener
implements IViewerUpdateListener, ILabelUpdateListener, IModelChangedListener, ITestModelUpdatesListenerConstants,
@@ -432,7 +432,7 @@ public class TestModelUpdatesListener
public boolean isFinished(int flags) {
if (isTimedOut()) {
- throw new RuntimeException("Timed Out: " + toString(flags));
+ throw new RuntimeException("Timed Out: " + toString(flags)); //$NON-NLS-1$
}
if (fFailExpectation != null) {
@@ -440,20 +440,20 @@ public class TestModelUpdatesListener
}
if (fJobError != null) {
- throw new RuntimeException("Job Error: " + fJobError);
+ throw new RuntimeException("Job Error: " + fJobError); //$NON-NLS-1$
}
if (fFailOnRedundantUpdates && !fRedundantUpdates.isEmpty()) {
- Assert.fail("Redundant Updates: " + fRedundantUpdates.toString());
+ Assert.fail("Redundant Updates: " + fRedundantUpdates.toString()); //$NON-NLS-1$
}
if (fFailOnRedundantLabelUpdates && !fRedundantLabelUpdates.isEmpty()) {
- Assert.fail("Redundant Label Updates: " + fRedundantLabelUpdates.toString());
+ Assert.fail("Redundant Label Updates: " + fRedundantLabelUpdates.toString()); //$NON-NLS-1$
}
if (fFailOnMultipleLabelUpdateSequences && fLabelUpdatesComplete > (fLabelUpdatesCompleteAtReset + 1)) {
- Assert.fail("Multiple label update sequences detected");
+ Assert.fail("Multiple label update sequences detected"); //$NON-NLS-1$
}
if (fFailOnMultipleModelUpdateSequences && fViewerUpdatesComplete > (fViewerUpdatesCompleteAtReset + 1)) {
- Assert.fail("Multiple viewer update sequences detected");
+ Assert.fail("Multiple viewer update sequences detected"); //$NON-NLS-1$
}
if ( (flags & LABEL_SEQUENCE_COMPLETE) != 0) {
@@ -626,14 +626,14 @@ public class TestModelUpdatesListener
public void viewerUpdatesBegin() {
if (fViewerUpdatesStarted > fViewerUpdatesComplete) {
- fFailExpectation = new RuntimeException("Unmatched updatesStarted/updateCompleted notifications observed.");
+ fFailExpectation = new RuntimeException("Unmatched updatesStarted/updateCompleted notifications observed."); //$NON-NLS-1$
}
fViewerUpdatesStarted++;
}
public void viewerUpdatesComplete() {
if (fViewerUpdatesStarted <= fViewerUpdatesComplete) {
- fFailExpectation = new RuntimeException("Unmatched updatesStarted/updateCompleted notifications observed.");
+ fFailExpectation = new RuntimeException("Unmatched updatesStarted/updateCompleted notifications observed."); //$NON-NLS-1$
}
fViewerUpdatesComplete++;
}
@@ -647,7 +647,7 @@ public class TestModelUpdatesListener
!fRedundantLabelUpdateExceptions.contains(update.getElementPath()))
{
fRedundantLabelUpdates.add(update);
- Assert.fail("Redundant update: " + update);
+ Assert.fail("Redundant update: " + update); //$NON-NLS-1$
}
}
@@ -658,14 +658,14 @@ public class TestModelUpdatesListener
public void labelUpdatesBegin() {
if (fLabelUpdatesStarted > fLabelUpdatesComplete) {
- fFailExpectation = new RuntimeException("Unmatched labelUpdatesStarted/labelUpdateCompleted notifications observed.");
+ fFailExpectation = new RuntimeException("Unmatched labelUpdatesStarted/labelUpdateCompleted notifications observed."); //$NON-NLS-1$
}
fLabelUpdatesStarted++;
}
public void labelUpdatesComplete() {
if (fLabelUpdatesStarted <= fLabelUpdatesComplete) {
- fFailExpectation = new RuntimeException("Unmatched labelUpdatesStarted/labelUpdateCompleted notifications observed.");
+ fFailExpectation = new RuntimeException("Unmatched labelUpdatesStarted/labelUpdateCompleted notifications observed."); //$NON-NLS-1$
}
fLabelUpdatesComplete++;
}
@@ -684,13 +684,13 @@ public class TestModelUpdatesListener
public void stateRestoreUpdatesBegin(Object input) {
if (fExpectRestoreAfterSaveComplete && !fStateSaveComplete) {
- fFailExpectation = new RuntimeException("RESTORE should begin after SAVE completed!");
+ fFailExpectation = new RuntimeException("RESTORE should begin after SAVE completed!"); //$NON-NLS-1$
}
fStateRestoreStarted = true;
}
public void stateRestoreUpdatesComplete(Object input) {
- Assert.assertFalse("RESTORE STATE already complete!", fStateRestoreComplete);
+ Assert.assertFalse("RESTORE STATE already complete!", fStateRestoreComplete); //$NON-NLS-1$
fStateRestoreComplete = true;
}
@@ -712,133 +712,133 @@ public class TestModelUpdatesListener
}
private String toString(int flags) {
- StringBuffer buf = new StringBuffer("Viewer Update Listener");
+ StringBuffer buf = new StringBuffer("Viewer Update Listener"); //$NON-NLS-1$
if (fJobError != null) {
- buf.append("\n\t");
- buf.append("fJobError = " + fJobError);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fJobError = " + fJobError); //$NON-NLS-1$
if (fJobError.getException() != null) {
StackTraceElement[] trace = fJobError.getException().getStackTrace();
for (int i = 0; i < trace.length; i++) {
- buf.append("\n\t\t");
+ buf.append("\n\t\t"); //$NON-NLS-1$
buf.append(trace[i]);
}
}
}
if (fFailOnRedundantUpdates) {
- buf.append("\n\t");
- buf.append("fRedundantUpdates = " + fRedundantUpdates);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fRedundantUpdates = " + fRedundantUpdates); //$NON-NLS-1$
}
if ( (flags & LABEL_SEQUENCE_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fLabelUpdatesComplete = " + fLabelUpdatesComplete);
- buf.append("\n\t");
- buf.append("fLabelUpdatesCompleteAtReset = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fLabelUpdatesComplete = " + fLabelUpdatesComplete); //$NON-NLS-1$
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fLabelUpdatesCompleteAtReset = "); //$NON-NLS-1$
buf.append( fLabelUpdatesCompleteAtReset );
}
if ( (flags & LABEL_UPDATES_RUNNING) != 0) {
- buf.append("\n\t");
- buf.append("fLabelUpdatesRunning = " + fLabelUpdatesCounter);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fLabelUpdatesRunning = " + fLabelUpdatesCounter); //$NON-NLS-1$
}
if ( (flags & LABEL_SEQUENCE_STARTED) != 0) {
- buf.append("\n\t");
- buf.append("fLabelUpdatesStarted = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fLabelUpdatesStarted = "); //$NON-NLS-1$
buf.append( fLabelUpdatesStarted );
- buf.append("\n\t");
- buf.append("fLabelUpdatesCompleted = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fLabelUpdatesCompleted = "); //$NON-NLS-1$
buf.append( fLabelUpdatesCompleted );
}
if ( (flags & LABEL_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fLabelUpdates = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fLabelUpdates = "); //$NON-NLS-1$
buf.append( toString(fLabelUpdates) );
}
if ( (flags & VIEWER_UPDATES_RUNNING) != 0) {
- buf.append("\n\t");
- buf.append("fViewerUpdatesStarted = " + fViewerUpdatesStarted);
- buf.append("\n\t");
- buf.append("fViewerUpdatesRunning = " + fViewerUpdatesCounter);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fViewerUpdatesStarted = " + fViewerUpdatesStarted); //$NON-NLS-1$
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fViewerUpdatesRunning = " + fViewerUpdatesCounter); //$NON-NLS-1$
}
if ( (flags & CONTENT_SEQUENCE_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fViewerUpdatesComplete = " + fViewerUpdatesComplete);
- buf.append("\n\t");
- buf.append("fViewerUpdatesCompleteAtReset = " + fViewerUpdatesCompleteAtReset);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fViewerUpdatesComplete = " + fViewerUpdatesComplete); //$NON-NLS-1$
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fViewerUpdatesCompleteAtReset = " + fViewerUpdatesCompleteAtReset); //$NON-NLS-1$
}
if ( (flags & HAS_CHILDREN_UPDATES_STARTED) != 0) {
- buf.append("\n\t");
- buf.append("fHasChildrenUpdatesRunning = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fHasChildrenUpdatesRunning = "); //$NON-NLS-1$
buf.append( fHasChildrenUpdatesRunning );
- buf.append("\n\t");
- buf.append("fHasChildrenUpdatesCompleted = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fHasChildrenUpdatesCompleted = "); //$NON-NLS-1$
buf.append( fHasChildrenUpdatesCompleted );
}
if ( (flags & HAS_CHILDREN_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fHasChildrenUpdates = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fHasChildrenUpdates = "); //$NON-NLS-1$
buf.append( toString(fHasChildrenUpdatesScheduled) );
}
if ( (flags & CHILD_COUNT_UPDATES_STARTED) != 0) {
- buf.append("\n\t");
- buf.append("fChildCountUpdatesRunning = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fChildCountUpdatesRunning = "); //$NON-NLS-1$
buf.append( fChildCountUpdatesRunning );
- buf.append("\n\t");
- buf.append("fChildCountUpdatesCompleted = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fChildCountUpdatesCompleted = "); //$NON-NLS-1$
buf.append( fChildCountUpdatesCompleted );
}
if ( (flags & CHILD_COUNT_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fChildCountUpdates = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fChildCountUpdates = "); //$NON-NLS-1$
buf.append( toString(fChildCountUpdatesScheduled) );
}
if ( (flags & CHILDREN_UPDATES_STARTED) != 0) {
- buf.append("\n\t");
- buf.append("fChildrenUpdatesRunning = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fChildrenUpdatesRunning = "); //$NON-NLS-1$
buf.append( fChildrenUpdatesRunning );
- buf.append("\n\t");
- buf.append("fChildrenUpdatesCompleted = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fChildrenUpdatesCompleted = "); //$NON-NLS-1$
buf.append( fChildrenUpdatesCompleted );
}
if ( (flags & CHILDREN_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fChildrenUpdates = ");
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fChildrenUpdates = "); //$NON-NLS-1$
buf.append( toString(fChildrenUpdatesScheduled) );
}
if ( (flags & MODEL_CHANGED_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fModelChangedComplete = " + fModelChangedComplete);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fModelChangedComplete = " + fModelChangedComplete); //$NON-NLS-1$
}
if ( (flags & STATE_SAVE_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fStateSaveComplete = " + fStateSaveComplete);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fStateSaveComplete = " + fStateSaveComplete); //$NON-NLS-1$
}
if ( (flags & STATE_RESTORE_COMPLETE) != 0) {
- buf.append("\n\t");
- buf.append("fStateRestoreComplete = " + fStateRestoreComplete);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fStateRestoreComplete = " + fStateRestoreComplete); //$NON-NLS-1$
}
if ( (flags & MODEL_PROXIES_INSTALLED) != 0) {
- buf.append("\n\t");
- buf.append("fProxyModels = " + fProxyModels);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fProxyModels = " + fProxyModels); //$NON-NLS-1$
}
if ( (flags & STATE_UPDATES) != 0) {
- buf.append("\n\t");
- buf.append("fStateUpdates = " + toString(fStateUpdates));
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fStateUpdates = " + toString(fStateUpdates)); //$NON-NLS-1$
}
if (fTimeoutInterval > 0) {
- buf.append("\n\t");
- buf.append("fTimeoutInterval = " + fTimeoutInterval);
+ buf.append("\n\t"); //$NON-NLS-1$
+ buf.append("fTimeoutInterval = " + fTimeoutInterval); //$NON-NLS-1$
}
return buf.toString();
}
private String toString(Set set) {
if (set.isEmpty()) {
- return "(EMPTY)";
+ return "(EMPTY)"; //$NON-NLS-1$
}
StringBuffer buf = new StringBuffer();
for (Iterator itr = set.iterator(); itr.hasNext(); ) {
- buf.append("\n\t\t");
+ buf.append("\n\t\t"); //$NON-NLS-1$
buf.append(toString((TreePath)itr.next()));
}
return buf.toString();
@@ -846,15 +846,15 @@ public class TestModelUpdatesListener
private String toString(Map map) {
if (map.isEmpty()) {
- return "(EMPTY)";
+ return "(EMPTY)"; //$NON-NLS-1$
}
StringBuffer buf = new StringBuffer();
for (Iterator itr = map.keySet().iterator(); itr.hasNext(); ) {
- buf.append("\n\t\t");
+ buf.append("\n\t\t"); //$NON-NLS-1$
TreePath path = (TreePath)itr.next();
buf.append(toString(path));
Set updates = (Set)map.get(path);
- buf.append(" = ");
+ buf.append(" = "); //$NON-NLS-1$
buf.append(updates.toString());
}
return buf.toString();
@@ -862,11 +862,11 @@ public class TestModelUpdatesListener
private String toString(TreePath path) {
if (path.getSegmentCount() == 0) {
- return "/";
+ return "/"; //$NON-NLS-1$
}
StringBuffer buf = new StringBuffer();
for (int i = 0; i < path.getSegmentCount(); i++) {
- buf.append("/");
+ buf.append("/"); //$NON-NLS-1$
buf.append(path.getSegment(i));
}
return buf.toString();
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 23484333f..bac73a857 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 IBM Corporation and others.
+ * Copyright (c) 2011, 2013 IBM Corporation 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
@@ -10,9 +10,9 @@
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
-import junit.framework.Assert;
import org.eclipse.jface.viewers.TreePath;
+import org.junit.Assert;
/**
* Utility for comparing TreePath objects in unit tests. This wrapper prints the tree
@@ -38,14 +38,14 @@ public class TreePathWrapper {
public String toString() {
if (fPath.getSegmentCount() == 0) {
- return "TreePath:EMPTY";
+ return "TreePath:EMPTY"; //$NON-NLS-1$
}
- StringBuffer buf = new StringBuffer("TreePath:[");
+ StringBuffer buf = new StringBuffer("TreePath:["); //$NON-NLS-1$
for (int i = 0; i < fPath.getSegmentCount(); i++) {
if (i != 0) {
- buf.append(", ");
+ buf.append(", "); //$NON-NLS-1$
}
buf.append(fPath.getSegment(i));
}
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 f119cd81f..2af970dc6 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -76,14 +77,18 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
protected void runTest() throws Throwable {
try {
super.runTest();
} catch (Throwable t) {
- throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t);
+ throw new ExecutionException("Test failed: " + t.getMessage() + "\n fListener = " + fListener.toString(), t); //$NON-NLS-1$ //$NON-NLS-2$
}
}
@@ -102,16 +107,20 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
TestElement root = model.getRootElement();
TreePath rootPath = new TreePath(new Object[] {});
TestElement[] newElements = new TestElement[] {
- new TestElement(model, "1", new TestElement[0]),
- new TestElement(model, "2", new TestElement[0]),
- new TestElement(model, "3", new TestElement[0]),
+ new TestElement(model, "1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "3", new TestElement[0]), //$NON-NLS-1$
};
model.setElementChildren(rootPath, newElements);
@@ -122,7 +131,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fListener.reset(rootPath, root, -1, false, false);
model.postDelta(new ModelDelta(root, IModelDelta.CONTENT));
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -141,16 +154,20 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
TestElement element = model.getRootElement().getChildren()[0];
TreePath elementPath = new TreePath(new Object[] { element });
TestElement[] newChildren = new TestElement[] {
- new TestElement(model, "1.1", new TestElement[0]),
- new TestElement(model, "1.2", new TestElement[0]),
- new TestElement(model, "1.3", new TestElement[0]),
+ new TestElement(model, "1.1", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "1.2", new TestElement[0]), //$NON-NLS-1$
+ new TestElement(model, "1.3", new TestElement[0]), //$NON-NLS-1$
};
model.setElementChildren(elementPath, newChildren);
@@ -163,7 +180,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Refresh the viewer
model.postDelta(new ModelDelta(rootElement, IModelDelta.CONTENT));
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -175,7 +196,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// be processed.
fListener.reset();
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
if (validate) {
model.validateData(fViewer, TreePath.EMPTY);
@@ -191,11 +216,18 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
model.postDelta(delta);
if (validate) {
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
} else {
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
}
@@ -208,11 +240,18 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
model.postDelta(delta);
if (validate) {
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
} else {
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
}
@@ -227,18 +266,22 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Update the model
removeElement(model, 2, true);
- addElement(model, "3-new", 3, true);
+ addElement(model, "3-new", 3, true); //$NON-NLS-1$
removeElement(model, 4, true);
- addElement(model, "5-new", 5, true);
+ addElement(model, "5-new", 5, true); //$NON-NLS-1$
removeElement(model, 1, true);
- addElement(model, "1-new", 1, true);
+ addElement(model, "1-new", 1, true); //$NON-NLS-1$
removeElement(model, 3, true);
- addElement(model, "4-new", 4, true);
+ addElement(model, "4-new", 4, true); //$NON-NLS-1$
}
/**
@@ -255,7 +298,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Refresh the viewer so that updates are generated.
@@ -263,7 +310,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
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);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
Assert.assertTrue( fListener.isFinished(CONTENT_SEQUENCE_STARTED) );
}
@@ -284,21 +335,29 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// 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;
+ String pass = "pass #" + i; //$NON-NLS-1$
// Request a content update for view
childrenCountUpdateListener.reset();
childrenCountUpdateListener.addChildreCountUpdate(TreePath.EMPTY);
model.postDelta(new ModelDelta(model.getRootElement(), IModelDelta.CONTENT));
// Wait until the delta is processed
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
removeElement(model, 5, false);
removeElement(model, 4, false);
@@ -309,18 +368,24 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// 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);
+ while (!childrenCountUpdateListener.isFinished(CHILD_COUNT_UPDATES)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
- insertElement(model, "1 - " + pass, 0, false);
- insertElement(model, "2 - " + pass, 1, false);
- insertElement(model, "3 - " + pass, 2, false);
- insertElement(model, "4 - " + pass, 3, false);
- insertElement(model, "5 - " + pass, 4, false);
- insertElement(model, "6 - " + pass, 5, false);
+ 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);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -344,12 +409,16 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Insert element at the end of the list.
final int insertIndex = model.getRootElement().getChildren().length;
- ModelDelta delta = model.insertElementChild(TreePath.EMPTY, insertIndex, new TestElement(model, "last - invalid index", new TestElement[0]));
+ 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() {
@@ -367,8 +436,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
fListener.reset();
model.postDelta(delta);
- while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE))
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CONTENT_SEQUENCE_COMPLETE | LABEL_SEQUENCE_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
}
@@ -386,7 +458,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
for (int i = 0; i < 5; i++) {
@@ -397,11 +473,15 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
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);
+ 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);
+ addElement(model, "1", 0, true); //$NON-NLS-1$
}
}
@@ -421,7 +501,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
@@ -433,12 +517,20 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
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);
+ 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);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
@@ -458,7 +550,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
@@ -470,7 +566,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
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);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES_STARTED)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
@@ -481,7 +581,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
model.setQeueueingUpdate(false);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
/**
@@ -500,7 +604,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
@@ -515,12 +623,18 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES_STARTED)) {
completeQueuedUpdatesOfType(model, IChildrenCountUpdate.class);
completeQueuedUpdatesOfType(model, IHasChildrenUpdate.class);
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
}
model.setQeueueingUpdate(false);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
@@ -540,7 +654,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
@@ -555,7 +673,9 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILDREN_UPDATES_STARTED)) {
completeQueuedUpdatesOfType(model, IChildrenCountUpdate.class);
completeQueuedUpdatesOfType(model, IHasChildrenUpdate.class);
- if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
}
}
@@ -567,7 +687,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
}
model.setQeueueingUpdate(false);
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
/**
@@ -587,24 +711,36 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
// Refresh the viewer so that updates are generated.
fListener.reset();
- TreePath path = model.findElement("2");
+ TreePath path = model.findElement("2"); //$NON-NLS-1$
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 ()) Thread.sleep(0);
+ while (!fListener.isFinished(MODEL_CHANGED_COMPLETE | CHILD_COUNT_UPDATES | CHILDREN_UPDATES_RUNNING)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
// Remove element "2"
removeElement(model, 1, true);
// Wait for all updates to finish.
- while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(ALL_UPDATES_COMPLETE)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
/**
@@ -623,7 +759,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
model.setQeueueingUpdate(false);
@@ -634,14 +774,21 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
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);
+ 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]));
+ model2.setRoot(new TestElement(model2, "root", new TestElement[0])); //$NON-NLS-1$
fViewer.setInput(model2.getRootElement());
- while (!fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
@@ -661,7 +808,11 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
// Set the input into the view and update the view.
fViewer.setInput(model.getRootElement());
- while (!fListener.isFinished()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
model.validateData(fViewer, TreePath.EMPTY);
model.setQeueueingUpdate(false);
@@ -672,12 +823,19 @@ abstract public class UpdateTests extends TestCase implements ITestModelUpdatesL
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);
+ 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)) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fListener.isFinished(CONTENT_COMPLETE | VIEWER_UPDATES_RUNNING)) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
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 a7998c8db..6f06e6346 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -26,6 +27,6 @@ public class VirtualViewerContentTests extends ContentTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
+ 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 4614cdf99..a2ab1a21b 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -26,6 +27,6 @@ public class VirtualViewerDeltaTests extends DeltaTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
+ 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 969d74a21..fd584069a 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011, 2012 Wind River Systems and others.
+ * Copyright (c) 2011, 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,6 +28,6 @@ public class VirtualViewerFilterTests extends FilterTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"), new VisibleVirtualItemValidator(0, 100));
+ 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 5ea544562..94c370675 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -60,7 +61,7 @@ public class VirtualViewerLazyModeTests extends TestCase {
* @return the viewer
*/
protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(display, SWT.VIRTUAL, new PresentationContext("TestViewer"));
+ return new VirtualTreeModelViewer(display, SWT.VIRTUAL, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
/**
@@ -72,7 +73,11 @@ public class VirtualViewerLazyModeTests extends TestCase {
// Close the shell and exit.
fShell.close();
- while (!fShell.isDisposed()) if (!fDisplay.readAndDispatch ()) Thread.sleep(0);
+ while (!fShell.isDisposed()) {
+ if (!fDisplay.readAndDispatch ()) {
+ Thread.sleep(0);
+ }
+ }
}
public void test() {
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 d0180f7f8..e21fd505b 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -27,7 +28,7 @@ public class VirtualViewerPerformanceTests extends PerformanceTests {
}
protected IInternalTreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"), fVirtualItemValidator);
+ return new VirtualTreeModelViewer(fDisplay, SWT.VIRTUAL, new PresentationContext("TestViewer"), fVirtualItemValidator); //$NON-NLS-1$
}
protected int getTestModelDepth() {
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 62bf033c0..4c2dcda52 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -26,7 +27,7 @@ public class VirtualViewerPopupTests extends PopupTests {
}
protected ITreeModelViewer createViewer(Display display, Shell shell, int style) {
- return new VirtualTreeModelViewer(fDisplay, style, new PresentationContext("TestViewer"));
+ 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 d71140e21..a0df1576f 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -26,6 +27,6 @@ public class VirtualViewerSelectionTests extends SelectionTests {
}
protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
+ 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 d794c3f13..b441ca685 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -26,6 +27,6 @@ public class VirtualViewerStateTests extends StateTests {
}
protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
+ 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 9f6013678..d1ce76967 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2011 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Wind River Systems - initial API and implementation
+ * IBM Corporation - bug fixing
*******************************************************************************/
package org.eclipe.debug.tests.viewer.model;
@@ -26,6 +27,6 @@ public class VirtualViewerUpdateTests extends UpdateTests {
}
protected ITreeModelViewer createViewer(Display display, Shell shell) {
- return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer"));
+ return new VirtualTreeModelViewer(fDisplay, 0, new PresentationContext("TestViewer")); //$NON-NLS-1$
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java
index 6652d3339..36de236c9 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/TestsPlugin.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 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
@@ -81,7 +81,7 @@ public class TestsPlugin extends AbstractUIPlugin {
public File getFileInPlugin(IPath path) {
try {
Bundle bundle = getDefault().getBundle();
- URL installURL= new URL(bundle.getEntry("/"), path.toString());
+ URL installURL = new URL(bundle.getEntry("/"), path.toString()); //$NON-NLS-1$
URL localURL= FileLocator.toFileURL(installURL);//Platform.asLocalURL(installURL);
return new File(localURL.getFile());
} catch (IOException e) {
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java
index 96254046e..2454caa1c 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java
@@ -53,7 +53,7 @@ public class BreakpointOrderingTests extends TestCase {
*/
static class TestBreakpoint implements IBreakpoint {
- private String fText;
+ private final String fText;
private IMarker fMarker = null;
TestBreakpoint(String text) {
@@ -74,7 +74,7 @@ public class BreakpointOrderingTests extends TestCase {
ResourcesPlugin.getWorkspace().run( wr, null );
}
catch ( CoreException e ) {
- fail("Unexpected exception: " + e.toString());
+ fail("Unexpected exception: " + e.toString()); //$NON-NLS-1$
}
}
@@ -97,26 +97,26 @@ public class BreakpointOrderingTests extends TestCase {
}
public String getModelIdentifier() {
- return "Test";
+ return "Test"; //$NON-NLS-1$
}
public boolean isEnabled() throws CoreException {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return false;
}
public boolean isPersisted() throws CoreException {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return false;
}
public boolean isRegistered() throws CoreException {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return false;
}
public void setEnabled(boolean enabled) throws CoreException {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public void setMarker(IMarker marker) throws CoreException {
@@ -125,16 +125,16 @@ public class BreakpointOrderingTests extends TestCase {
}
public void setPersisted(boolean registered) throws CoreException {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public void setRegistered(boolean registered) throws CoreException {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public Object getAdapter(Class adapter) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return null;
}
@@ -144,7 +144,7 @@ public class BreakpointOrderingTests extends TestCase {
* Test only implementation of ILineBreakpoint.
*/
static class TestLineBreakpoint extends TestBreakpoint implements ILineBreakpoint {
- private int fLineNum;
+ private final int fLineNum;
TestLineBreakpoint(String text, int lineNum) {
super(text, IBreakpoint.LINE_BREAKPOINT_MARKER);
@@ -156,12 +156,12 @@ public class BreakpointOrderingTests extends TestCase {
}
public int getCharEnd() throws CoreException {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return 0;
}
public int getCharStart() throws CoreException {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return 0;
}
}
@@ -176,38 +176,38 @@ public class BreakpointOrderingTests extends TestCase {
}
protected Widget doFindInputItem(Object element) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return null;
}
protected Widget doFindItem(Object element) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return null;
}
protected void doUpdateItem(Widget item, Object element, boolean fullMap) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
protected List getSelectionFromWidget() {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return null;
}
protected void internalRefresh(Object element) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public void reveal(Object element) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
protected void setSelectionToWidget(List l, boolean reveal) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public Control getControl() {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return null;
}};
@@ -215,72 +215,72 @@ public class BreakpointOrderingTests extends TestCase {
IDebugModelPresentation fDebugModelPres = new IDebugModelPresentation() {
public void computeDetail(IValue value, IValueDetailListener listener) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public Image getImage(Object element) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return null;
}
public String getText(Object element) {
- assertTrue("Unexpected element", element instanceof TestBreakpoint);
+ assertTrue("Unexpected element", element instanceof TestBreakpoint); //$NON-NLS-1$
return ((TestBreakpoint)element).getText();
}
public void setAttribute(String attribute, Object value) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public void addListener(ILabelProviderListener listener) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public void dispose() {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public boolean isLabelProperty(Object element, String property) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return false;
}
public void removeListener(ILabelProviderListener listener) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
}
public String getEditorId(IEditorInput input, Object element) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return null;
}
public IEditorInput getEditorInput(Object element) {
- fail("not implemented in test");
+ fail("not implemented in test"); //$NON-NLS-1$
return null;
}};
// Test vector with some UNIX paths
TestBreakpoint[] createTestBreakpoints0() {
TestBreakpoint[] fTestBps = {
- new TestBreakpoint(""),
- new TestBreakpoint("/file/text.c"),
- new TestBreakpoint("/file/text.c:1"),
- new TestLineBreakpoint("", 0),
- new TestLineBreakpoint("/file/text.c", 0),
- new TestLineBreakpoint("/file/text.c", 1),
- new TestLineBreakpoint("/file/text.c:", 0),
- new TestLineBreakpoint("/file/text.c:0", 0),
- new TestLineBreakpoint("/file/text.c:1", 1),
- new TestLineBreakpoint("/file/text.c:0002", 2),
- new TestLineBreakpoint("/file/text.c:3xxx", 3),
- new TestLineBreakpoint("/file/text.c:10xxx", 10),
- new TestLineBreakpoint("/file/text.c:a_01", 1),
- new TestLineBreakpoint("/file/text.c:a_01a", 1),
- new TestLineBreakpoint("/file/text.c:a_09", 9),
- new TestLineBreakpoint("/file/text.c:a_09a", 9),
- new TestLineBreakpoint("/file/text.c:a_011", 11),
- new TestLineBreakpoint("/file/text.c:a_011a", 11),
- new TestLineBreakpoint("/file/text.c:y", 0),
+ new TestBreakpoint(""), //$NON-NLS-1$
+ new TestBreakpoint("/file/text.c"), //$NON-NLS-1$
+ new TestBreakpoint("/file/text.c:1"), //$NON-NLS-1$
+ new TestLineBreakpoint("", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:0", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:1", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:0002", 2), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:3xxx", 3), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:10xxx", 10), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:a_01", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:a_01a", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:a_09", 9), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:a_09a", 9), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:a_011", 11), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:a_011a", 11), //$NON-NLS-1$
+ new TestLineBreakpoint("/file/text.c:y", 0), //$NON-NLS-1$
};
return fTestBps;
}
@@ -288,19 +288,19 @@ public class BreakpointOrderingTests extends TestCase {
// Check plain numbers
TestBreakpoint[] createTestBreakpoints1() {
TestBreakpoint[] fTestBps = {
- new TestLineBreakpoint("0", 0),
- new TestLineBreakpoint("1", 1),
- new TestLineBreakpoint("1_a", 1),
- new TestLineBreakpoint("001_b", 1),
- new TestLineBreakpoint("01_c", 1),
- new TestLineBreakpoint("3", 3),
- new TestLineBreakpoint("10", 10),
- new TestLineBreakpoint("11", 11),
- new TestLineBreakpoint("20", 20),
- new TestLineBreakpoint("110", 110),
- new TestLineBreakpoint("112", 112),
- new TestLineBreakpoint("112a", 112),
- new TestLineBreakpoint("112b", 112),
+ new TestLineBreakpoint("0", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("1", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("1_a", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("001_b", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("01_c", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("3", 3), //$NON-NLS-1$
+ new TestLineBreakpoint("10", 10), //$NON-NLS-1$
+ new TestLineBreakpoint("11", 11), //$NON-NLS-1$
+ new TestLineBreakpoint("20", 20), //$NON-NLS-1$
+ new TestLineBreakpoint("110", 110), //$NON-NLS-1$
+ new TestLineBreakpoint("112", 112), //$NON-NLS-1$
+ new TestLineBreakpoint("112a", 112), //$NON-NLS-1$
+ new TestLineBreakpoint("112b", 112), //$NON-NLS-1$
};
return fTestBps;
}
@@ -308,13 +308,13 @@ public class BreakpointOrderingTests extends TestCase {
// Test consistent behavior with leading 0's
TestBreakpoint[] createTestBreakpoints2() {
TestBreakpoint[] fTestBps = {
- new TestLineBreakpoint("0", 0),
- new TestLineBreakpoint("00", 0),
- new TestLineBreakpoint("0000", 0),
- new TestLineBreakpoint("0001", 1),
- new TestLineBreakpoint("0010", 10),
- new TestLineBreakpoint("1000", 1000),
- new TestLineBreakpoint("10000", 10000),
+ new TestLineBreakpoint("0", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("00", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("0000", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("0001", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("0010", 10), //$NON-NLS-1$
+ new TestLineBreakpoint("1000", 1000), //$NON-NLS-1$
+ new TestLineBreakpoint("10000", 10000), //$NON-NLS-1$
};
return fTestBps;
}
@@ -322,10 +322,10 @@ public class BreakpointOrderingTests extends TestCase {
// Test Win32 paths
TestBreakpoint[] createTestBreakpoints3() {
TestBreakpoint[] fTestBps = {
- new TestLineBreakpoint(":a", 0),
- new TestLineBreakpoint("c:\\file\\text.c:1", 1),
- new TestLineBreakpoint("c:\\file\\text.c:2", 2),
- new TestLineBreakpoint("d:\\file\\text.c:3", 3),
+ new TestLineBreakpoint(":a", 0), //$NON-NLS-1$
+ new TestLineBreakpoint("c:\\file\\text.c:1", 1), //$NON-NLS-1$
+ new TestLineBreakpoint("c:\\file\\text.c:2", 2), //$NON-NLS-1$
+ new TestLineBreakpoint("d:\\file\\text.c:3", 3), //$NON-NLS-1$
};
return fTestBps;
}
@@ -360,11 +360,11 @@ public class BreakpointOrderingTests extends TestCase {
boolean equalCheck = (res == 0) == (inner == outer);
boolean ltCheck = (res < 0) == (inner < outer);
if (!equalCheck) {
- System.err.println("Equal Comparison in between " + inner + " and " + outer + " ("+testBps[inner].getText()+ " and "+testBps[outer].getText()+") failed" );
+ System.err.println("Equal Comparison in between " + inner + " and " + outer + " (" + testBps[inner].getText() + " and " + testBps[outer].getText() + ") failed"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
failed = true;
}
if (!ltCheck) {
- System.err.println("Less Comparison in between " + inner + " and " + outer + " ("+testBps[inner].getText()+ " and "+testBps[outer].getText()+") failed" );
+ System.err.println("Less Comparison in between " + inner + " and " + outer + " (" + testBps[inner].getText() + " and " + testBps[outer].getText() + ") failed"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
failed = true;
}
}
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
index 927632bcc..7238c93f7 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/expressions/ExpressionManagerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2013 IBM Corporation 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
@@ -181,12 +181,12 @@ public class ExpressionManagerTests extends TestCase {
manager.addExpressionListener(single);
manager.addExpressionListener(multi);
try {
- IWatchExpression exp1 = manager.newWatchExpression("exp1");
- IWatchExpression exp2 = manager.newWatchExpression("exp2");
- IWatchExpression exp3 = manager.newWatchExpression("exp3");
+ IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
+ IWatchExpression exp2 = manager.newWatchExpression("exp2"); //$NON-NLS-1$
+ IWatchExpression exp3 = manager.newWatchExpression("exp3"); //$NON-NLS-1$
manager.addExpressions(new IExpression[]{exp1, exp2, exp3});
IExpression[] expressions = manager.getExpressions();
- assertEquals("Wrong number of expressions", 3, expressions.length);
+ assertEquals("Wrong number of expressions", 3, expressions.length); //$NON-NLS-1$
assertEquals(single.addedCallbacks, 3);
assertEquals(3, single.added.size());
assertEquals(0, single.added.indexOf(exp1));
@@ -216,13 +216,13 @@ public class ExpressionManagerTests extends TestCase {
manager.addExpressionListener(single);
manager.addExpressionListener(multi);
try {
- IWatchExpression exp1 = manager.newWatchExpression("exp1");
- IWatchExpression exp2 = manager.newWatchExpression("exp2");
- IWatchExpression exp3 = manager.newWatchExpression("exp3");
+ IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
+ IWatchExpression exp2 = manager.newWatchExpression("exp2"); //$NON-NLS-1$
+ IWatchExpression exp3 = manager.newWatchExpression("exp3"); //$NON-NLS-1$
manager.addExpressions(new IExpression[]{exp1, exp2, exp3});
manager.removeExpressions(new IExpression[]{exp1, exp3});
IExpression[] expressions = manager.getExpressions();
- assertEquals("Wrong number of expressions", 1, expressions.length);
+ assertEquals("Wrong number of expressions", 1, expressions.length); //$NON-NLS-1$
assertEquals(single.addedCallbacks, 3);
assertEquals(3, single.added.size());
assertEquals(0, single.added.indexOf(exp1));
@@ -256,14 +256,14 @@ public class ExpressionManagerTests extends TestCase {
manager.addExpressionListener(single);
manager.addExpressionListener(multi);
try {
- IWatchExpression exp1 = manager.newWatchExpression("exp1");
- IWatchExpression exp2 = manager.newWatchExpression("exp2");
- IWatchExpression exp3 = manager.newWatchExpression("exp3");
+ IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
+ IWatchExpression exp2 = manager.newWatchExpression("exp2"); //$NON-NLS-1$
+ IWatchExpression exp3 = manager.newWatchExpression("exp3"); //$NON-NLS-1$
manager.addExpressions(new IExpression[]{exp1, exp2, exp3});
IExpression[] expressions = manager.getExpressions();
exp1.setEnabled(false);
- exp2.setExpressionText("exp2changed");
- assertEquals("Wrong number of expressions", 3, expressions.length);
+ exp2.setExpressionText("exp2changed"); //$NON-NLS-1$
+ assertEquals("Wrong number of expressions", 3, expressions.length); //$NON-NLS-1$
assertEquals(single.addedCallbacks, 3);
assertEquals(3, single.added.size());
assertEquals(0, single.added.indexOf(exp1));
@@ -296,14 +296,14 @@ public class ExpressionManagerTests extends TestCase {
MultiListener multi = new MultiListener();
InsertMoveListener insert = new InsertMoveListener();
try {
- IWatchExpression exp1 = manager.newWatchExpression("exp1");
- IWatchExpression exp2 = manager.newWatchExpression("exp2");
- IWatchExpression exp3 = manager.newWatchExpression("exp3");
- IWatchExpression exp4 = manager.newWatchExpression("exp4");
- IWatchExpression exp5 = manager.newWatchExpression("exp5");
+ IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
+ IWatchExpression exp2 = manager.newWatchExpression("exp2"); //$NON-NLS-1$
+ IWatchExpression exp3 = manager.newWatchExpression("exp3"); //$NON-NLS-1$
+ IWatchExpression exp4 = manager.newWatchExpression("exp4"); //$NON-NLS-1$
+ IWatchExpression exp5 = manager.newWatchExpression("exp5"); //$NON-NLS-1$
manager.addExpressions(new IExpression[]{exp1, exp2, exp3});
IExpression[] expressions = manager.getExpressions();
- assertEquals("Wrong number of expressions", 3, expressions.length);
+ assertEquals("Wrong number of expressions", 3, expressions.length); //$NON-NLS-1$
assertEquals(0, indexOf(exp1, expressions));
assertEquals(1, indexOf(exp2, expressions));
assertEquals(2, indexOf(exp3, expressions));
@@ -330,7 +330,7 @@ public class ExpressionManagerTests extends TestCase {
assertEquals(1, insert.inserted.indexOf(exp5));
expressions = manager.getExpressions();
- assertEquals("Wrong number of expressions", 5, expressions.length);
+ assertEquals("Wrong number of expressions", 5, expressions.length); //$NON-NLS-1$
assertEquals(0, indexOf(exp1, expressions));
assertEquals(1, indexOf(exp4, expressions));
assertEquals(2, indexOf(exp5, expressions));
@@ -353,14 +353,14 @@ public class ExpressionManagerTests extends TestCase {
MultiListener multi = new MultiListener();
InsertMoveListener insert = new InsertMoveListener();
try {
- IWatchExpression exp1 = manager.newWatchExpression("exp1");
- IWatchExpression exp2 = manager.newWatchExpression("exp2");
- IWatchExpression exp3 = manager.newWatchExpression("exp3");
- IWatchExpression exp4 = manager.newWatchExpression("exp4");
- IWatchExpression exp5 = manager.newWatchExpression("exp5");
+ IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
+ IWatchExpression exp2 = manager.newWatchExpression("exp2"); //$NON-NLS-1$
+ IWatchExpression exp3 = manager.newWatchExpression("exp3"); //$NON-NLS-1$
+ IWatchExpression exp4 = manager.newWatchExpression("exp4"); //$NON-NLS-1$
+ IWatchExpression exp5 = manager.newWatchExpression("exp5"); //$NON-NLS-1$
manager.addExpressions(new IExpression[]{exp1, exp2, exp3});
IExpression[] expressions = manager.getExpressions();
- assertEquals("Wrong number of expressions", 3, expressions.length);
+ assertEquals("Wrong number of expressions", 3, expressions.length); //$NON-NLS-1$
assertEquals(0, indexOf(exp1, expressions));
assertEquals(1, indexOf(exp2, expressions));
assertEquals(2, indexOf(exp3, expressions));
@@ -387,7 +387,7 @@ public class ExpressionManagerTests extends TestCase {
assertEquals(1, insert.inserted.indexOf(exp5));
expressions = manager.getExpressions();
- assertEquals("Wrong number of expressions", 5, expressions.length);
+ assertEquals("Wrong number of expressions", 5, expressions.length); //$NON-NLS-1$
assertEquals(0, indexOf(exp1, expressions));
assertEquals(1, indexOf(exp2, expressions));
assertEquals(2, indexOf(exp4, expressions));
@@ -410,11 +410,11 @@ public class ExpressionManagerTests extends TestCase {
MultiListener multi = new MultiListener();
InsertMoveListener insert = new InsertMoveListener();
try {
- IWatchExpression exp1 = manager.newWatchExpression("exp1");
- IWatchExpression exp2 = manager.newWatchExpression("exp2");
- IWatchExpression exp3 = manager.newWatchExpression("exp3");
- IWatchExpression exp4 = manager.newWatchExpression("exp4");
- IWatchExpression exp5 = manager.newWatchExpression("exp5");
+ IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
+ IWatchExpression exp2 = manager.newWatchExpression("exp2"); //$NON-NLS-1$
+ IWatchExpression exp3 = manager.newWatchExpression("exp3"); //$NON-NLS-1$
+ IWatchExpression exp4 = manager.newWatchExpression("exp4"); //$NON-NLS-1$
+ IWatchExpression exp5 = manager.newWatchExpression("exp5"); //$NON-NLS-1$
manager.addExpressions(new IExpression[]{exp1, exp2, exp3, exp4, exp5});
// add listeners
manager.addExpressionListener(single);
@@ -437,7 +437,7 @@ public class ExpressionManagerTests extends TestCase {
assertEquals(2, insert.insertIndex);
IExpression[] expressions = manager.getExpressions();
- assertEquals("Wrong number of expressions", 5, expressions.length);
+ assertEquals("Wrong number of expressions", 5, expressions.length); //$NON-NLS-1$
assertEquals(0, indexOf(exp3, expressions));
assertEquals(1, indexOf(exp4, expressions));
assertEquals(2, indexOf(exp1, expressions));
@@ -460,11 +460,11 @@ public class ExpressionManagerTests extends TestCase {
MultiListener multi = new MultiListener();
InsertMoveListener insert = new InsertMoveListener();
try {
- IWatchExpression exp1 = manager.newWatchExpression("exp1");
- IWatchExpression exp2 = manager.newWatchExpression("exp2");
- IWatchExpression exp3 = manager.newWatchExpression("exp3");
- IWatchExpression exp4 = manager.newWatchExpression("exp4");
- IWatchExpression exp5 = manager.newWatchExpression("exp5");
+ IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
+ IWatchExpression exp2 = manager.newWatchExpression("exp2"); //$NON-NLS-1$
+ IWatchExpression exp3 = manager.newWatchExpression("exp3"); //$NON-NLS-1$
+ IWatchExpression exp4 = manager.newWatchExpression("exp4"); //$NON-NLS-1$
+ IWatchExpression exp5 = manager.newWatchExpression("exp5"); //$NON-NLS-1$
manager.addExpressions(new IExpression[]{exp1, exp2, exp3, exp4, exp5});
// add listeners
manager.addExpressionListener(single);
@@ -487,7 +487,7 @@ public class ExpressionManagerTests extends TestCase {
assertEquals(1, insert.insertIndex);
IExpression[] expressions = manager.getExpressions();
- assertEquals("Wrong number of expressions", 5, expressions.length);
+ assertEquals("Wrong number of expressions", 5, expressions.length); //$NON-NLS-1$
assertEquals(0, indexOf(exp3, expressions));
assertEquals(1, indexOf(exp1, expressions));
assertEquals(2, indexOf(exp2, expressions));
@@ -506,23 +506,23 @@ public class ExpressionManagerTests extends TestCase {
*/
public void testPersistExpressions() {
ExpressionManager manager = (ExpressionManager) getManager();
- IWatchExpression exp1 = manager.newWatchExpression("exp1");
- IWatchExpression exp2 = manager.newWatchExpression("exp2");
- IWatchExpression exp3 = manager.newWatchExpression("exp3");
- IWatchExpression exp4 = manager.newWatchExpression("exp4");
- IWatchExpression exp5 = manager.newWatchExpression("exp5");
+ IWatchExpression exp1 = manager.newWatchExpression("exp1"); //$NON-NLS-1$
+ IWatchExpression exp2 = manager.newWatchExpression("exp2"); //$NON-NLS-1$
+ IWatchExpression exp3 = manager.newWatchExpression("exp3"); //$NON-NLS-1$
+ IWatchExpression exp4 = manager.newWatchExpression("exp4"); //$NON-NLS-1$
+ IWatchExpression exp5 = manager.newWatchExpression("exp5"); //$NON-NLS-1$
manager.addExpressions(new IExpression[]{exp1, exp2, exp3, exp4, exp5});
manager.storeWatchExpressions();
// create a new manager that will restore the expressions
ExpressionManager manager2 = new ExpressionManager();
IExpression[] expressions = manager2.getExpressions();
- assertEquals("Wrong number of expressions", 5, expressions.length);
- assertEquals("exp1", expressions[0].getExpressionText());
- assertEquals("exp2", expressions[1].getExpressionText());
- assertEquals("exp3", expressions[2].getExpressionText());
- assertEquals("exp4", expressions[3].getExpressionText());
- assertEquals("exp5", expressions[4].getExpressionText());
+ assertEquals("Wrong number of expressions", 5, expressions.length); //$NON-NLS-1$
+ assertEquals("exp1", expressions[0].getExpressionText()); //$NON-NLS-1$
+ assertEquals("exp2", expressions[1].getExpressionText()); //$NON-NLS-1$
+ assertEquals("exp3", expressions[2].getExpressionText()); //$NON-NLS-1$
+ assertEquals("exp4", expressions[3].getExpressionText()); //$NON-NLS-1$
+ assertEquals("exp5", expressions[4].getExpressionText()); //$NON-NLS-1$
}
/**
diff --git a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java
index 9b560c30c..e1c68a0c9 100644
--- a/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java
+++ b/org.eclipse.debug.tests/src/org/eclipse/debug/tests/statushandlers/StatusHandlerTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 IBM Corporation and others.
+ * Copyright (c) 2009, 2013 IBM Corporation 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
@@ -29,15 +29,15 @@ public class StatusHandlerTests extends TestCase {
/**
* Status for which a handler is registered.
*/
- public static final IStatus STATUS = new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, 333,"", null);
+ public static final IStatus STATUS = new Status(IStatus.ERROR, TestsPlugin.PLUGIN_ID, 333, "", null); //$NON-NLS-1$
/**
* Tests that a status handler extension exists
*/
public void testStatusHandlerExtension() {
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(STATUS);
- assertNotNull("missing status handler extension", handler);
- assertTrue("Unexpected handler", handler instanceof StatusHandler);
+ assertNotNull("missing status handler extension", handler); //$NON-NLS-1$
+ assertTrue("Unexpected handler", handler instanceof StatusHandler); //$NON-NLS-1$
}
/**
@@ -47,7 +47,7 @@ public class StatusHandlerTests extends TestCase {
try {
Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, false, InstanceScope.INSTANCE);
IStatusHandler handler = DebugPlugin.getDefault().getStatusHandler(STATUS);
- assertNull("status handler extension should be disabled", handler);
+ assertNull("status handler extension should be disabled", handler); //$NON-NLS-1$
} finally {
Preferences.setBoolean(DebugPlugin.getUniqueIdentifier(), IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, true, InstanceScope.INSTANCE);
}

Back to the top