Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests for Generic Target Platform Editor
Bundle-SymbolicName: org.eclipse.pde.genericeditor.extension.tests
Bundle-Version: 1.3.100.qualifier
Bundle-Version: 1.3.200.qualifier
Bundle-Vendor: Eclipse.org
Bundle-RequiredExecutionEnvironment: JavaSE-21
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.29.0,4.0.0)",
Expand Down
2 changes: 1 addition & 1 deletion ui/org.eclipse.pde.genericeditor.extension.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<relativePath>../../</relativePath>
</parent>
<artifactId>org.eclipse.pde.genericeditor.extension.tests</artifactId>
<version>1.3.100-SNAPSHOT</version>
<version>1.3.200-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.pde.internal.genericeditor.target.extension.autocomplete.TargetDefinitionContentAssist;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.junit.After;
Expand Down Expand Up @@ -87,6 +89,14 @@ protected String getLocationForSite(String name) {

@After
public void tearDown() throws Exception {
// Close any editors we opened
IWorkbenchWindow[] workbenchPages = PlatformUI.getWorkbench().getWorkbenchWindows();
for (IWorkbenchWindow workbenchPage : workbenchPages) {
IWorkbenchPage page = workbenchPage.getActivePage();
if (page != null) {
page.closeAllEditors(false);
}
}
if (tempFile != null) {
tempFile.delete();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.eclipse.pde.genericeditor.extension.tests;

import org.eclipse.swt.widgets.Display;

public class TestUtils {

public static void processUIEvents() {
Display display = Display.getCurrent();
if (display != null && !display.isDisposed()) {
while (display.readAndDispatch()) {
// Keep pumping events until the queue is empty
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ private void confirmVersionUpdates(Map<String, String> expected) throws Exceptio
@SuppressWarnings("unchecked")
String updatedText = ((CompletableFuture<String>) response).get();
assertNotNull(updatedText);
TestUtils.processUIEvents();

Map<String, String> actual = getVersionsForIdsFromTargetFile(updatedText);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.pde.genericeditor.extension;singleton:=true
Bundle-Version: 1.3.200.qualifier
Bundle-Version: 1.3.300.qualifier
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.jface.text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

public class UpdateUnitVersions extends AbstractHandler {

private static Parser parser;

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IDocument document = getDocument();
Expand All @@ -52,7 +54,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
return null;
}

Parser parser = Parser.getDefault();
Parser parser = parser();
try {
parser.parse(document);
} catch (XMLStreamException e) {
Expand Down Expand Up @@ -144,4 +146,11 @@ private IDocument getDocument() {
IEditorInput input = editor.getEditorInput();
return provider.getDocument(input);
}

private static synchronized Parser parser() {
if (parser == null) {
parser = new Parser();
}
return parser;
}
}
Loading