|
24 | 24 | import org.eclipse.linuxtools.internal.cdt.autotools.ui.editors.automake.AutomakeEditor;
|
25 | 25 | import org.eclipse.linuxtools.internal.cdt.autotools.ui.editors.automake.AutomakeTextHover;
|
26 | 26 | import org.eclipse.linuxtools.internal.cdt.autotools.ui.editors.automake.AutomakefileSourceConfiguration;
|
| 27 | +import org.eclipse.swt.widgets.Display; |
27 | 28 | import org.eclipse.ui.IEditorPart;
|
28 | 29 | import org.eclipse.ui.IWorkbench;
|
29 | 30 |
|
@@ -65,33 +66,43 @@ public class AutomakeTextHoverTest extends TestCase {
|
65 | 66 | "\t" + "echo $?" + "\n" +
|
66 | 67 | "";
|
67 | 68 | private IWorkbench workbench;
|
68 |
| - |
| 69 | + |
69 | 70 | protected void setUp() throws Exception {
|
70 |
| - super.setUp(); |
71 |
| - tools = new ProjectTools(); |
72 |
| - if (!ProjectTools.setup()) |
73 |
| - fail("could not perform basic project workspace setup"); |
74 |
| - |
75 |
| - project = ProjectTools.createProject("testProjectATHT"); |
76 |
| - |
77 |
| - if(project == null) { |
78 |
| - fail("Unable to create test project"); |
79 |
| - } |
80 |
| - |
81 |
| - project.open(new NullProgressMonitor()); |
82 |
| - |
83 |
| - makefileAmFile = tools.createFile(project, "Makefile.am", makefileAmContents); |
84 |
| - workbench = AutotoolsTestsPlugin.getDefault().getWorkbench(); |
85 |
| - |
86 |
| - IEditorPart openEditor = org.eclipse.ui.ide.IDE.openEditor(workbench |
87 |
| - .getActiveWorkbenchWindow().getActivePage(), makefileAmFile, |
88 |
| - true); |
89 |
| - |
90 |
| - automakeEditor = (AutomakeEditor) openEditor; |
91 |
| - AutomakeDocumentProvider docProvider = automakeEditor.getAutomakefileDocumentProvider(); |
92 |
| - automakeDocument = docProvider.getDocument(openEditor.getEditorInput()); |
93 |
| - AutomakefileSourceConfiguration automakeSourceViewerConfig = automakeEditor.getAutomakeSourceViewerConfiguration(); |
94 |
| - textHover = (AutomakeTextHover) automakeSourceViewerConfig.getTextHover(null, ""); |
| 71 | + super.setUp(); |
| 72 | + tools = new ProjectTools(); |
| 73 | + if (!ProjectTools.setup()) |
| 74 | + fail("could not perform basic project workspace setup"); |
| 75 | + |
| 76 | + project = ProjectTools.createProject("testProjectATHT"); |
| 77 | + |
| 78 | + if(project == null) { |
| 79 | + fail("Unable to create test project"); |
| 80 | + } |
| 81 | + |
| 82 | + project.open(new NullProgressMonitor()); |
| 83 | + |
| 84 | + Display.getDefault().syncExec(new Runnable() { |
| 85 | + |
| 86 | + public void run() { |
| 87 | + try { |
| 88 | + makefileAmFile = tools.createFile(project, "Makefile.am", makefileAmContents); |
| 89 | + workbench = AutotoolsTestsPlugin.getDefault().getWorkbench(); |
| 90 | + |
| 91 | + IEditorPart openEditor = org.eclipse.ui.ide.IDE.openEditor(workbench |
| 92 | + .getActiveWorkbenchWindow().getActivePage(), makefileAmFile, |
| 93 | + true); |
| 94 | + |
| 95 | + automakeEditor = (AutomakeEditor) openEditor; |
| 96 | + AutomakeDocumentProvider docProvider = automakeEditor.getAutomakefileDocumentProvider(); |
| 97 | + automakeDocument = docProvider.getDocument(openEditor.getEditorInput()); |
| 98 | + AutomakefileSourceConfiguration automakeSourceViewerConfig = automakeEditor.getAutomakeSourceViewerConfiguration(); |
| 99 | + textHover = (AutomakeTextHover) automakeSourceViewerConfig.getTextHover(null, ""); |
| 100 | + } catch (Exception e) { |
| 101 | + fail(); |
| 102 | + } |
| 103 | + } |
| 104 | + |
| 105 | + }); |
95 | 106 | }
|
96 | 107 |
|
97 | 108 | protected void tearDown() throws Exception {
|
|
0 commit comments