1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Added protection against opening a dialog in JUnit test.

This commit is contained in:
Sergey Prigogin 2009-05-10 21:57:19 +00:00
parent 9742045d4a
commit 56c7e8b130
2 changed files with 6 additions and 0 deletions

View file

@ -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");

View file

@ -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=