Skip to content

Commit

Permalink
Stop requiring jdt.ui in o.e.ui.tests
Browse files Browse the repository at this point in the history
There are enough resources available to handle tests without loading JDT
UI and putting extra requirements and circular dependencies between
repositories.
  • Loading branch information
akurtakov committed Dec 10, 2024
1 parent b379121 commit 78615b8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2006 IBM Corporation and others.
* Copyright (c) 2004, 2024 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -67,7 +67,7 @@ public void testNonDependantBundleIcon() {
.getDefaultEditor(
"foo.icontest2").getImageDescriptor().createImage();
i2 = ResourceLocator.imageDescriptorFromBundle(
"org.eclipse.jdt.ui", "icons/full/obj16/class_obj.png") // layer breaker!
"org.eclipse.debug.ui", "icons/full/obj16/file_obj.png") // layer breaker!
.orElseThrow(AssertionError::new).createImage();
ImageTests.assertEquals(i1, i2);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* Test opening and closing of items.
*/
public class OpenCloseTest {
private static final String ORG_ECLIPSE_JDT_UI_JAVA_PERSPECTIVE = "org.eclipse.jdt.ui.JavaPerspective";
private static final String ORG_ECLIPSE_RESOURCE_PERSPECTIVE = "org.eclipse.ui.resourcePerspective";

private static final int numIterations = 10;

Expand All @@ -67,7 +67,7 @@ public void setup() {
}

try {
PlatformUI.getWorkbench().showPerspective(ORG_ECLIPSE_JDT_UI_JAVA_PERSPECTIVE, workbenchWindow);
PlatformUI.getWorkbench().showPerspective(ORG_ECLIPSE_RESOURCE_PERSPECTIVE, workbenchWindow);
} catch (WorkbenchException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public void testOpenCloseFile() throws CoreException {
*/
@Test
public void testOpenCloseWorkbenchWindow() throws WorkbenchException {
IWorkbenchWindow secondWorkbenchWindow = null;
IWorkbenchWindow secondWorkbenchWindow;
for (int index = 0; index < numIterations; index++) {
secondWorkbenchWindow = PlatformUI.getWorkbench()
.openWorkbenchWindow(ResourcesPlugin.getWorkspace().getRoot());
Expand All @@ -119,15 +119,15 @@ public void testOpenClosePerspective() {

HashMap<String, String> parameters = new HashMap<>();
parameters.put(IWorkbenchCommandConstants.WINDOW_CLOSE_PERSPECTIVE_PARM_ID,
ORG_ECLIPSE_JDT_UI_JAVA_PERSPECTIVE);
ORG_ECLIPSE_RESOURCE_PERSPECTIVE);

ParameterizedCommand pCommand = ParameterizedCommand.generateCommand(command, parameters);

IHandlerService handlerService = workbenchWindow.getService(IHandlerService.class);

for (int index = 0; index < numIterations; index++) {
try {
PlatformUI.getWorkbench().showPerspective(ORG_ECLIPSE_JDT_UI_JAVA_PERSPECTIVE, workbenchWindow);
PlatformUI.getWorkbench().showPerspective(ORG_ECLIPSE_RESOURCE_PERSPECTIVE, workbenchWindow);
try {
handlerService.executeCommand(pCommand, null);
} catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e1) {
Expand All @@ -143,8 +143,8 @@ public void testOpenClosePerspective() {
*/
@Test
public void testOpenCloseView() throws WorkbenchException {
IViewPart consoleView = null;
IWorkbenchPage page = PlatformUI.getWorkbench().showPerspective(ORG_ECLIPSE_JDT_UI_JAVA_PERSPECTIVE,
IViewPart consoleView;
IWorkbenchPage page = PlatformUI.getWorkbench().showPerspective(ORG_ECLIPSE_RESOURCE_PERSPECTIVE,
workbenchWindow);
for (int index = 0; index < numIterations; index++) {
consoleView = page.showView(IPageLayout.ID_MINIMAP_VIEW);
Expand All @@ -157,7 +157,7 @@ public void testOpenCloseView() throws WorkbenchException {
*/
@Test
public void testOpenCloseIntro() {
IIntroPart introPart = null;
IIntroPart introPart;
for (int index = 0; index < numIterations; index++) {
introPart = PlatformUI.getWorkbench().getIntroManager().showIntro(workbenchWindow, false);
PlatformUI.getWorkbench().getIntroManager().closeIntro(introPart);
Expand Down
2 changes: 1 addition & 1 deletion tests/org.eclipse.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ Require-Bundle: org.eclipse.core.resources;bundle-version="3.14.0",
org.eclipse.e4.ui.workbench.renderers.swt;bundle-version="0.10.0",
org.mockito.mockito-core;bundle-version="2.13.0",
org.eclipse.ui.views.log;bundle-version="1.2.1300",
org.eclipse.jdt.ui,
org.eclipse.ui.navigator;bundle-version="3.12.100",
org.eclipse.search,
org.eclipse.debug.ui,
org.eclipse.emf.ecore
Import-Package: jakarta.annotation,
jakarta.inject,
Expand Down
2 changes: 1 addition & 1 deletion tests/org.eclipse.ui.tests/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@
extensions="icontest1"/>
<editor
class="org.eclipse.ui.tests.api.MockEditorPart"
icon="platform:/plugin/org.eclipse.jdt.ui/icons/full/obj16/class_obj.png"
icon="platform:/plugin/org.eclipse.debug.ui/icons/full/obj16/file_obj.png"
default="true"
name="Plugin Icon Test 2"
id="org.eclipse.ui.tests.IconTestEditor2"
Expand Down

0 comments on commit 78615b8

Please sign in to comment.