Community
Participate
Working Groups
When trying to run XMLUITestSuite, the test suite hangs on TestOpenEditorXML's testSetDocument() method with a confirmation dialog in the Eclipse instance being tested. At the moment I don't believe that particular test to be the problem. The confirmation dialog says the following: The file 'XMLCodeFoldingTest/XMLFoldingCommentTest.xml' has been deleted or is not accessible. Do you want to save your changes or close the editor without saving? The stack trace of the shell being constructed is below. Thread [main] (Suspended (breakpoint at line 278 in Shell)) Shell.<init>(Display, Shell, int, int, boolean) line: 278 Shell.<init>(Shell, int) line: 375 MessageDialog(Window).createShell() line: 487 MessageDialog(Window).create() line: 430 MessageDialog(Dialog).create() line: 1089 MessageDialog(Window).open() line: 790 MessageDialog.open() line: 334 StructuredTextEditor(AbstractTextEditor).handleEditorInputChanged() line: 4735 StructuredTextEditor(StatusTextEditor).handleEditorInputChanged() line: 267 StructuredTextEditor(AbstractDecoratedTextEditor).handleEditorInputChanged() line: 1474 StructuredTextEditor(AbstractTextEditor).sanityCheckState(IEditorInput) line: 4887 StructuredTextEditor(StatusTextEditor).sanityCheckState(IEditorInput) line: 257 StructuredTextEditor.sanityCheckState(IEditorInput) line: 2908 StructuredTextEditor(AbstractTextEditor).safelySanityCheckState(IEditorInput) line: 4865 StructuredTextEditor.safelySanityCheckState(IEditorInput) line: 2902 XMLMultiPageEditorPart$ActivationListener.handleActivation() line: 223 XMLMultiPageEditorPart$ActivationListener.partActivated(IWorkbenchPart) line: 144 PartService$1.run() line: 76 SafeRunner.run(ISafeRunnable) line: 42 PartService.partActivated(IWorkbenchPart) line: 74 WorkbenchPage$10.run() line: 3818 SafeRunner.run(ISafeRunnable) line: 42 WorkbenchPage.firePartActivated(MPart) line: 3816 WorkbenchPage.access$13(WorkbenchPage, MPart) line: 3805 WorkbenchPage$E4PartListener.partActivated(MPart) line: 167 PartServiceImpl$2.run() line: 191 SafeRunner.run(ISafeRunnable) line: 42 PartServiceImpl.firePartActivated(MPart) line: 189 PartServiceImpl.setPart(MPart) line: 163 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available Method.invoke(Object, Object...) line: not available MethodRequestor.execute() line: 56 ContextObjectSupplier$ContextInjectionListener.update(IEclipseContext, int, Object[]) line: 76 TrackableComputationExt.update(ContextChangeEvent) line: 91 EclipseContext.processScheduled(List<Scheduled>) line: 326 EclipseContext.set(String, Object) line: 343 EclipseContext.activate() line: 596 EclipseContext.activateBranch() line: 601 PartActivationHistory.activate(MPart, boolean) line: 52 PartServiceImpl.activate(MPart, boolean, boolean) line: 571 PartServiceImpl.activate(MPart, boolean) line: 530 ContributedPartRenderer(AbstractPartRenderer).activate(MPart) line: 105 ContributedPartRenderer$1.handleEvent(Event) line: 61 EventTable.sendEvent(Event) line: 84 ContributedPartRenderer$2(Widget).sendEvent(Event) line: 1053 ContributedPartRenderer$2(Widget).sendEvent(int, Event, boolean) line: 1077 ContributedPartRenderer$2(Widget).sendEvent(int) line: 1058 Shell.setActiveControl(Control) line: 1447 ToolBar(Control).sendFocusEvent(int) line: 2836 ToolBar(Widget).wmSetFocus(int, int, int) line: 2403 ToolBar(Control).WM_SETFOCUS(int, int) line: 5152 ToolBar.WM_SETFOCUS(int, int) line: 1404 ToolBar(Control).windowProc(int, int, int, int) line: 4598 Display.windowProc(int, int, int, int) line: 4985 OS.SetFocus(int) line: not available [native method] ToolBar(Control).forceFocus() line: 1098 ToolBar(Control).setFocus() line: 3303 ToolBar(Composite).setFocus() line: 1040 Composite.setFocus() line: 1038 Composite.setFocus() line: 1038 XMLMultiPageEditorPart(MultiPageEditorPart).setFocus(int) line: 1130 XMLMultiPageEditorPart(MultiPageEditorPart).setFocus() line: 1106 XMLMultiPageEditorPart.setFocus() line: 1077 CompatibilityEditor(CompatibilityPart).delegateSetFocus() line: 154 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available Method.invoke(Object, Object...) line: not available MethodRequestor.execute() line: 56 InjectorImpl.invokeUsingClass(Object, Class<?>, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean) line: 228 InjectorImpl.invokeUsingClass(Object, Class<?>, Class<Annotation>, Object, PrimaryObjectSupplier, PrimaryObjectSupplier, boolean) line: 234 InjectorImpl.invoke(Object, Class<Annotation>, Object, PrimaryObjectSupplier) line: 205 ContextInjectionFactory.invoke(Object, Class<Annotation>, IEclipseContext, Object) line: 101 PartServiceImpl.activate(MPart, boolean, boolean) line: 561 PartServiceImpl.activate(MPart, boolean) line: 530 PartServiceImpl.activate(MPart) line: 519 PartServiceImpl.hidePart(MPart, boolean) line: 1062 WorkbenchPage.hidePart(MPart, boolean, boolean, boolean, boolean) line: 1224 WorkbenchPage.hidePart(MPart, boolean, boolean, boolean) line: 1176 WorkbenchPage.closeEditors(IEditorReference[], boolean) line: 1146 WorkbenchPage.closeEditor(IEditorPart, boolean) line: 1272 TestOpenEditorXML.tearDown() line: 80 TestOpenEditorXML(TestCase).runBare() line: 140 TestResult$1.protect() line: 110 TestResult.runProtected(Test, Protectable) line: 128 TestResult.run(TestCase) line: 113 TestOpenEditorXML(TestCase).run(TestResult) line: 124 TestSuite.runTest(Test, TestResult) line: 243 TestSuite.run(TestResult) line: 238 XMLUITestSuite(TestSuite).runTest(Test, TestResult) line: 243 XMLUITestSuite(TestSuite).run(TestResult) line: 238 JUnit3TestReference.run(TestExecution) line: 130 TestExecution.run(ITestReference[]) line: 38 RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String, TestExecution) line: 467 RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecution) line: 683 RemotePluginTestRunner(RemoteTestRunner).run() line: 390 RemotePluginTestRunner.main(String[]) line: 62
The editors are closed by invoking the StructuredTextEditor's close(boolean) method. The close is done asynchronously which explains why the editor is still lingering around when we're farther in the test suite.
It seems that in 3.x the activation event may be suppressed if the active control is not visible.
> At the moment I don't believe that particular test to be the problem. Does the test pass on 3.x? To me it looks like different resources are created and/or deleted. Another reason could be the ordering of the test(method)s. The order is not guaranteed by JUnit - especially - it is not guaranteed to be the same as seen in the source or class file.
(In reply to comment #3) Oops, only now read the other two comments.
One interesting thing is that the test project is deleted during the tear down process. So even if the close requests were dispatched asynchronously, why didn't the editors get closed when their input file's parent project was deleted?
(In reply to comment #5) > So even if the close requests were dispatched asynchronously, why > didn't the editors get closed when their input file's parent project was > deleted? The close request caused by the deletion is also asynchronous. Well, that explains that.
The event deferral code was added to fix bug 168524.
Adding the same code we introduced in bug 168524 doesn't really work right because the isVisible() check on the control always returns 'true'. This seems to be because we never call setVisible(false) on a control while this seemed to be a common pattern in 3.x. I'm not quite sure what should be done here yet but I feel like SSE should change their code to just close the editors immediately instead of doing it asynchronously.
That the dialog is shown is the correct behavior, hence in real life everything is fine. I suggest to simply let the test wait with the deletion until the editor has been closed.
Changes to immediately close the editor have been released.
The test runs to completion now. Thank you for your time, Nick.