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:
parent
9742045d4a
commit
56c7e8b130
2 changed files with 6 additions and 0 deletions
|
@ -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");
|
||||
|
|
|
@ -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=
|
||||
|
|
Loading…
Add table
Reference in a new issue