Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergey Prigogin2009-05-10 21:57:19 +0000
committerSergey Prigogin2009-05-10 21:57:19 +0000
commit56c7e8b1304259166af4833f9885de4ff781a123 (patch)
tree4f6f145146ab900f9766619171e93fd4de8cbe57
parent9742045d4a95d2adee672c6e79e007f86d0a21e1 (diff)
downloadorg.eclipse.cdt-56c7e8b1304259166af4833f9885de4ff781a123.tar.gz
org.eclipse.cdt-56c7e8b1304259166af4833f9885de4ff781a123.tar.xz
org.eclipse.cdt-56c7e8b1304259166af4833f9885de4ff781a123.zip
Added protection against opening a dialog in JUnit test.
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/AddIncludeTest.java1
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java5
2 files changed, 6 insertions, 0 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/AddIncludeTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/AddIncludeTest.java
index 8fe48b17d8e..1f939da068e 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/AddIncludeTest.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/AddIncludeTest.java
@@ -91,6 +91,7 @@ public class AddIncludeTest extends TestCase {
}
private void assertAddIncludeResult() throws Exception {
+ AddIncludeOnSelectionAction.sIsJUnitTest= true;
new AddIncludeOnSelectionAction(fEditor).run();
String file= createFileName(".expected");
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java
index 4328b71f058..61af19b1a2d 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeOnSelectionAction.java
@@ -96,6 +96,8 @@ import org.eclipse.cdt.internal.ui.util.ExceptionHandler;
* selected name.
*/
public class AddIncludeOnSelectionAction extends TextEditorAction {
+ public static boolean sIsJUnitTest = false;
+
private ITranslationUnit fTu;
private IProject fProject;
private String[] fIncludePath;
@@ -251,6 +253,9 @@ public class AddIncludeOnSelectionAction extends TextEditorAction {
final ArrayList<IncludeCandidate> candidates = new ArrayList<IncludeCandidate>(candidatesMap.values());
if (candidates.size() > 1) {
+ if (sIsJUnitTest) {
+ throw new RuntimeException("ambiguous input"); //$NON-NLS-1$
+ }
runInUIThread(new Runnable() {
public void run() {
ElementListSelectionDialog dialog=

Back to the top