From dd7a449751c6805412a3fe9bd7bd234d20e2c200 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Wed, 4 Feb 2026 15:37:39 +0100 Subject: [PATCH 01/19] Reduce log level after an orphan perspective got fixed. --- .../eclipseui/org/eclipse/ui/internal/WorkbenchPage.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java index 2e3300d0c22..1a86593f618 100644 --- a/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java +++ b/bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java @@ -3932,7 +3932,7 @@ private PerspectiveDescriptor fixOrphanPerspective(MPerspective mperspective) { String perspId = mperspective.getElementId(); String label = mperspective.getLabel(); String msg = "Perspective with name '" + label + "' and id '" + perspId + "' has been made into a local copy"; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ - IStatus status = StatusUtil.newStatus(IStatus.WARNING, msg, null); + IStatus status = StatusUtil.newStatus(IStatus.INFO, msg, null); StatusManager.getManager().handle(status, StatusManager.LOG); String newDescId = NLS.bind(WorkbenchMessages.Perspective_localCopyLabel, label); From 5c89bb8115be00f3b42f4f8346c47c435f99bf5d Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 3 Feb 2026 12:10:14 +0100 Subject: [PATCH 02/19] Migrate org.eclipse.ui.workbench.texteditor.tests to JUnit 5 --- .../META-INF/MANIFEST.MF | 4 +- .../findandreplace/FindReplaceLogicTest.java | 56 ++--- .../findandreplace/FindReplaceTestUtil.java | 4 +- .../findandreplace/FindReplaceUITest.java | 26 +-- .../overlay/FindReplaceOverlayTest.java | 10 +- .../tests/AbstractTextZoomHandlerTest.java | 6 +- .../tests/DocumentLineDifferTest.java | 8 +- .../tests/FindReplaceDialogTest.java | 28 +-- .../tests/HippieCompletionTest.java | 194 +++++++++--------- .../texteditor/tests/ScreenshotTest.java | 20 +- .../tests/TextEditorPluginTest.java | 18 +- .../tests/TextViewerDeleteLineTargetTest.java | 18 +- .../tests/minimap/MinimapPageTest.java | 12 +- .../tests/minimap/MinimapWidgetTest.java | 24 +-- .../tests/revisions/ChangeRegionTest.java | 14 +- .../tests/revisions/HunkComputerTest.java | 6 +- .../texteditor/tests/revisions/RangeTest.java | 10 +- .../texteditor/tests/revisions/RangeUtil.java | 8 +- .../texteditor/tests/rulers/DAGTest.java | 9 +- 19 files changed, 238 insertions(+), 237 deletions(-) diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF index dc7e76865c4..c39e7b8fbdd 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF @@ -25,4 +25,6 @@ Automatic-Module-Name: org.eclipse.ui.workbench.texteditor.tests Import-Package: org.mockito, org.mockito.stubbing;version="5.5.0", org.junit.jupiter.api;version="[5.14.0,6.0.0)", - org.junit.platform.suite.api;version="[1.14.0,2.0.0)" + org.junit.jupiter.api.function;version="[5.14.0,6.0.0)", + org.junit.platform.suite.api;version="[1.14.0,2.0.0)", + org.opentest4j;version="[1.3.0,2.0.0)" diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java index 86e141fdf19..0bd4c1ed9c3 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java @@ -20,9 +20,9 @@ import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.not; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyString; @@ -33,9 +33,9 @@ import java.util.function.Predicate; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.mockito.Mockito; import org.eclipse.swt.SWT; @@ -86,14 +86,14 @@ private void setFindAndReplaceString(IFindReplaceLogic findReplaceLogic, String findReplaceLogic.setReplaceString(replaceString); } - @After + @AfterEach public void disposeShell() { if (parentShell != null) { parentShell.dispose(); } } - @Before + @BeforeEach public void setupShell() { parentShell= new Shell(); } @@ -252,8 +252,8 @@ public void testPerformSelectAndReplaceRegEx() { expectStatusEmpty(findReplaceLogic); status= findReplaceLogic.performSelectAndReplace(); - assertEquals("Status wasn't correctly returned", false, status); - assertEquals("Text shouldn't have been changed", "Hello World !", textViewer.getDocument().get()); + assertEquals(false, status, "Status wasn't correctly returned"); + assertEquals("Hello World !", textViewer.getDocument().get(), "Text shouldn't have been changed"); expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH); } @@ -288,12 +288,12 @@ public void testPerformSelectAndReplaceRegExWithLinebreaks() { expectStatusEmpty(findReplaceLogic); setFindAndReplaceString(findReplaceLogic, """ - """, " "); + """, " "); status= findReplaceLogic.performSelectAndReplace(); - assertEquals("Status wasn't correctly returned", false, status); - assertEquals("Text shouldn't have been changed", """ + assertEquals(false, status, "Status wasn't correctly returned"); + assertEquals(""" Hello! - World!""", textViewer.getDocument().get()); + World!""", textViewer.getDocument().get(), "Text shouldn't have been changed"); } @Test @@ -324,8 +324,8 @@ public void testPerformSelectAndReplaceWithConfigurationChanges() { expectStatusEmpty(findReplaceLogic); status= findReplaceLogic.performSelectAndReplace(); - assertEquals("Status wasn't correctly returned", false, status); - assertEquals("Text shouldn't have been changed", "Hello World ! !", textViewer.getDocument().get()); + assertEquals(false, status, "Status wasn't correctly returned"); + assertEquals("Hello World ! !", textViewer.getDocument().get(), "Text shouldn't have been changed"); expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH); } @@ -355,20 +355,20 @@ public void testPerformReplaceAndFind_caseInsensitive() { setFindAndReplaceString(findReplaceLogic, "", " "); boolean status= findReplaceLogic.performReplaceAndFind(); - assertTrue("replace should have been performed", status); + assertTrue(status, "replace should have been performed"); assertThat(textViewer.getDocument().get(), equalTo("Hello World!")); assertThat(findReplaceLogic.getTarget().getSelectionText(), equalTo("")); expectStatusEmpty(findReplaceLogic); setFindAndReplaceString(findReplaceLogic, "", " "); status= findReplaceLogic.performReplaceAndFind(); - assertTrue("replace should have been performed", status); + assertTrue(status, "replace should have been performed"); assertThat(textViewer.getDocument().get(), equalTo("Hello World !")); expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH); status= findReplaceLogic.performReplaceAndFind(); - assertFalse("replace should not have been performed", status); - assertEquals("Text shouldn't have been changed", "Hello World !", textViewer.getDocument().get()); + assertFalse(status, "replace should not have been performed"); + assertEquals("Hello World !", textViewer.getDocument().get(), "Text shouldn't have been changed"); expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH); } @@ -381,12 +381,12 @@ public void testPerformReplaceAndFind_caseSensitive() { setFindAndReplaceString(findReplaceLogic, "", " "); boolean status= findReplaceLogic.performReplaceAndFind(); - assertTrue("replace should have been performed", status); + assertTrue(status, "replace should have been performed"); assertThat(textViewer.getDocument().get(), equalTo("HelloWorld !")); assertThat(findReplaceLogic.getTarget().getSelectionText(), equalTo(" ")); status= findReplaceLogic.performReplaceAndFind(); - assertFalse("replace should not have been performed", status); + assertFalse(status, "replace should not have been performed"); assertThat(textViewer.getDocument().get(), equalTo("HelloWorld !")); assertThat(findReplaceLogic.getTarget().getSelectionText(), equalTo(" ")); } @@ -400,20 +400,20 @@ public void testPerformReplaceAndFind_caseSensitiveAndIncremental() { setFindAndReplaceString(findReplaceLogic, "", " "); boolean status= findReplaceLogic.performReplaceAndFind(); - assertTrue("replace should have been performed", status); + assertTrue(status, "replace should have been performed"); assertThat(textViewer.getDocument().get(), equalTo("Hello World!")); assertThat(findReplaceLogic.getTarget().getSelectionText(), equalTo("")); expectStatusEmpty(findReplaceLogic); setFindAndReplaceString(findReplaceLogic, "", " "); status= findReplaceLogic.performReplaceAndFind(); - assertTrue("replace should have been performed", status); + assertTrue(status, "replace should have been performed"); assertThat(textViewer.getDocument().get(), equalTo("Hello World !")); expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH); status= findReplaceLogic.performReplaceAndFind(); - assertFalse("replace should not have been performed", status); - assertEquals("Text shouldn't have been changed", "Hello World !", textViewer.getDocument().get()); + assertFalse(status, "replace should not have been performed"); + assertEquals("Hello World !", textViewer.getDocument().get(), "Text shouldn't have been changed"); expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH); } @@ -484,8 +484,8 @@ private void executeReplaceAndFindRegExTest(TextViewer textViewer, IFindReplaceL setFindAndReplaceString(findReplaceLogic, "<(\\w*)>", " "); status= findReplaceLogic.performReplaceAndFind(); - assertEquals("Status wasn't correctly returned", false, status); - assertEquals("Text shouldn't have been changed", "Hello World ! !", textViewer.getDocument().get()); + assertEquals(false, status, "Status wasn't correctly returned"); + assertEquals("Hello World ! !", textViewer.getDocument().get(), "Text shouldn't have been changed"); expectStatusIsCode(findReplaceLogic, FindStatus.StatusCode.NO_MATCH); } diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java index 945d2ccfb3a..f07f1107443 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.ui.internal.findandreplace; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.fail; import java.util.function.Supplier; @@ -60,4 +60,4 @@ public static void waitForFocus(Supplier hasFocusValidator, String test } } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java index a2483353bed..c253586ccc3 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java @@ -10,20 +10,19 @@ * * Contributors: * IBM Corporation - initial API and implementation - *******************************************************************************/ + ******************************************************************************/ package org.eclipse.ui.internal.findandreplace; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.ResourceBundle; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; import org.eclipse.swt.SWT; @@ -37,8 +36,8 @@ import org.eclipse.ui.texteditor.FindReplaceAction; public abstract class FindReplaceUITest { - @Rule - public TestName testName= new TestName(); + + protected TestInfo testInfo; private TextViewer fTextViewer; @@ -46,8 +45,9 @@ public abstract class FindReplaceUITest private AccessType dialog; - @Before - public final void ensureWorkbenchWindowIsActive() { + @BeforeEach + public final void ensureWorkbenchWindowIsActive(TestInfo info) { + this.testInfo = info; PlatformUI.getWorkbench().getWorkbenchWindows()[0].getShell().forceActive(); } @@ -80,7 +80,7 @@ protected void reopenFindReplaceUIForTextViewer() { protected abstract AccessType openUIFromTextViewer(TextViewer viewer); - @After + @AfterEach public void tearDown() throws Exception { if (dialog != null) { dialog.closeAndRestore(); @@ -388,4 +388,4 @@ protected final IFindReplaceTarget getFindReplaceTarget() { return fTextViewer.getFindReplaceTarget(); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java index 6f9df565c2a..ee073791589 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java @@ -16,10 +16,10 @@ import static org.eclipse.ui.internal.findandreplace.FindReplaceTestUtil.waitForFocus; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.swt.graphics.Point; @@ -48,7 +48,7 @@ public OverlayAccess openUIFromTextViewer(TextViewer viewer) { actionAccessor.invoke("showOverlayInEditor"); FindReplaceOverlay overlay= (FindReplaceOverlay) actionAccessor.get("overlay"); OverlayAccess uiAccess= new OverlayAccess(getFindReplaceTarget(), overlay); - waitForFocus(uiAccess::hasFocus, testName.getMethodName()); + waitForFocus(uiAccess::hasFocus, testInfo.getTestMethod().get().getName()); return uiAccess; } @@ -177,7 +177,7 @@ public void testDisableOverlayViaPreference() { boolean useOverlayPreference= preferences.getBoolean(USE_FIND_REPLACE_OVERLAY, true); try { preferences.putBoolean(USE_FIND_REPLACE_OVERLAY, false); - assertFalse("dialog should be closed after changing preference", getDialog().isShown()); + assertFalse(getDialog().isShown(), "dialog should be closed after changing preference"); } finally { preferences.putBoolean(USE_FIND_REPLACE_OVERLAY, useOverlayPreference); reopenFindReplaceUIForTextViewer(); diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java index 05f6f2317de..38525748d76 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java @@ -13,9 +13,9 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.swt.widgets.Composite; @@ -231,4 +231,4 @@ public Object getSelectedPage() { } } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java index 4b73154d480..550eb437aba 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java @@ -14,10 +14,10 @@ package org.eclipse.ui.workbench.texteditor.tests; import static org.eclipse.jface.text.DocumentRewriteSessionType.SEQUENTIAL; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; @@ -169,4 +169,4 @@ public void nonSuspendedLineDifferStaysNonSuspendedAfterDocumentRewriteSession() assertFalse(fLineDiffer.isSuspended()); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java index b0498aaf3dd..970be44ffbb 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java @@ -17,11 +17,11 @@ import static org.eclipse.ui.internal.findandreplace.FindReplaceTestUtil.waitForFocus; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assume.assumeFalse; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assumptions.assumeFalse; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Button; @@ -54,13 +54,13 @@ public DialogAccess openUIFromTextViewer(TextViewer viewer) { Dialog dialog= (Dialog) fFindReplaceDialogStubAccessor.invoke("getDialog"); DialogAccess uiAccess= new DialogAccess(getFindReplaceTarget(), dialog); - waitForFocus(uiAccess::hasFocus, testName.getMethodName()); + waitForFocus(uiAccess::hasFocus, testInfo.getTestMethod().get().getName()); return uiAccess; } @Test public void testFocusNotChangedWhenEnterPressed() { - assumeFalse("On Mac, checkboxes only take focus if 'Full Keyboard Access' is enabled in the system preferences", Util.isMac()); + assumeFalse(Util.isMac(), "On Mac, checkboxes only take focus if 'Full Keyboard Access' is enabled in the system preferences"); initializeTextViewerWithFindReplaceUI("line\nline\nline"); DialogAccess dialog= getDialog(); @@ -68,22 +68,22 @@ public void testFocusNotChangedWhenEnterPressed() { dialog.getFindCombo().setFocus(); dialog.setFindText("line"); dialog.simulateKeyboardInteractionInFindInputField(SWT.CR, false); - waitForFocus(dialog.getFindCombo()::isFocusControl, testName.getMethodName()); + waitForFocus(dialog.getFindCombo()::isFocusControl, testInfo.getTestMethod().get().getName()); Button wrapCheckBox= dialog.getButtonForSearchOption(SearchOptions.WRAP); Button globalRadioButton= dialog.getButtonForSearchOption(SearchOptions.GLOBAL); wrapCheckBox.setFocus(); dialog.simulateKeyboardInteractionInFindInputField(SWT.CR, false); - waitForFocus(wrapCheckBox::isFocusControl, testName.getMethodName()); + waitForFocus(wrapCheckBox::isFocusControl, testInfo.getTestMethod().get().getName()); globalRadioButton.setFocus(); dialog.simulateKeyboardInteractionInFindInputField(SWT.CR, false); - waitForFocus(globalRadioButton::isFocusControl, testName.getMethodName()); + waitForFocus(globalRadioButton::isFocusControl, testInfo.getTestMethod().get().getName()); } @Test public void testFocusNotChangedWhenButtonMnemonicPressed() { - assumeFalse("Mac does not support mnemonics", Util.isMac()); + assumeFalse(Util.isMac(), "Mac does not support mnemonics"); initializeTextViewerWithFindReplaceUI(""); DialogAccess dialog= getDialog(); @@ -97,20 +97,20 @@ public void testFocusNotChangedWhenButtonMnemonicPressed() { event.character= 'n'; event.doit= false; wrapCheckBox.traverse(SWT.TRAVERSE_MNEMONIC, event); - waitForFocus(wrapCheckBox::isFocusControl, testName.getMethodName()); + waitForFocus(wrapCheckBox::isFocusControl, testInfo.getTestMethod().get().getName()); Button globalRadioButton= dialog.getButtonForSearchOption(SearchOptions.GLOBAL); globalRadioButton.setFocus(); event.detail= SWT.TRAVERSE_MNEMONIC; event.doit= false; globalRadioButton.traverse(SWT.TRAVERSE_MNEMONIC, event); - waitForFocus(globalRadioButton::isFocusControl, testName.getMethodName()); + waitForFocus(globalRadioButton::isFocusControl, testInfo.getTestMethod().get().getName()); event.detail= SWT.TRAVERSE_MNEMONIC; event.character= 'r'; event.doit= false; globalRadioButton.traverse(SWT.TRAVERSE_MNEMONIC, event); - waitForFocus(globalRadioButton::isFocusControl, testName.getMethodName()); + waitForFocus(globalRadioButton::isFocusControl, testInfo.getTestMethod().get().getName()); } @Test @@ -232,4 +232,4 @@ public void testReplaceButtonEnabledWithRegexSearched() { assertTrue(dialog.getReplaceButton().isEnabled()); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java index c528d63a50d..cdbeb0aad1c 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java @@ -14,18 +14,18 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.core.runtime.AssertionFailedException; @@ -47,7 +47,7 @@ public class HippieCompletionTest { IDocument[] documents; private HippieCompletionEngine fEngine; - @Before + @BeforeEach public void setUp() throws Exception { documents= new IDocument[5]; documents[0]= new Document(""" @@ -149,25 +149,25 @@ public static void main(String[] args) { public void testSearchBackwards1() throws BadLocationException { List list= fEngine.getCompletionsBackwards(documents[0], "pri", documents[0].get().indexOf("println") + 10); - assertEquals(list.size(), 2); - assertEquals(list.get(0), "ntln"); - assertEquals(list.get(1), "nt"); + assertEquals(2, list.size()); + assertEquals("ntln", list.get(0)); + assertEquals("nt", list.get(1)); list= fEngine.getCompletionsBackwards(documents[0], "pri", documents[0].getLength()); - assertEquals(list.size(), 3); - assertEquals(list.get(0), "nting"); - assertEquals(list.get(1), "ntln"); - assertEquals(list.get(2), "nt"); + assertEquals(3, list.size()); + assertEquals("nting", list.get(0)); + assertEquals("ntln", list.get(1)); + assertEquals("nt", list.get(2)); list= fEngine.getCompletionsBackwards(documents[0], "pri", documents[0].get().indexOf("println") + 1); - assertEquals(list.size(), 1); - assertEquals(list.get(0), "nt"); + assertEquals(1, list.size()); + assertEquals("nt", list.get(0)); list= fEngine.getCompletionsBackwards(documents[0], "pa", 2); - assertEquals(list.size(), 0); + assertEquals(0, list.size()); } @@ -190,54 +190,54 @@ public void testSearchBackwards2() throws BadLocationException { public void testSearchBackwards3() throws BadLocationException { List list= fEngine.getCompletionsBackwards(documents[1], "test", documents[1].getLength()); - assertEquals("Number of backwards suggestions does not match", 2, list.size()); + assertEquals(2, list.size(), "Number of backwards suggestions does not match"); list= fEngine.getCompletionsBackwards(documents[1], "tests", documents[1].getLength()); - assertEquals("Number of backwards suggestions does not match", 1, list.size()); + assertEquals(1, list.size(), "Number of backwards suggestions does not match"); list= fEngine.getCompletionsBackwards(documents[1], "test", documents[1].getLength() - 1); - assertEquals("Number of backwards suggestions does not match", 1, list.size()); + assertEquals(1, list.size(), "Number of backwards suggestions does not match"); } @Test public void testSearch() throws BadLocationException { ArrayList docsList= new ArrayList<>(Arrays.asList(this.documents)); List result= createSuggestions("te", docsList); - assertEquals("Number of completions does not match", 15, result.size()); + assertEquals(15, result.size(), "Number of completions does not match"); result= fEngine.makeUnique(result); - assertEquals("Number of completions does not match", 7, result.size()); + assertEquals(7, result.size(), "Number of completions does not match"); result= createSuggestions("Plug", docsList); - assertEquals("Number of completions does not match", 2, result.size()); + assertEquals(2, result.size(), "Number of completions does not match"); result= createSuggestions("p", docsList); - assertEquals("Number of completions does not match", 23, result.size()); + assertEquals(23, result.size(), "Number of completions does not match"); result= fEngine.makeUnique(result); - assertEquals("Number of completions does not match", 10, result.size()); - assertEquals("Incorrect completion", "ackage", result.get(0)); - assertEquals("Incorrect completion", "rint", result.get(1)); - assertEquals("Incorrect completion", "ublic", result.get(2)); - assertEquals("Incorrect completion", "rintln", result.get(3)); - assertEquals("Incorrect completion", "rinting", result.get(4)); - assertEquals("Incorrect completion", "lugin", result.get(5)); - assertEquals("Incorrect completion", "rovider", result.get(6)); - assertEquals("Incorrect completion", "roviderName", result.get(7)); - assertEquals("Incorrect completion", "rogram", result.get(8)); - assertEquals("Incorrect completion", "roperties", result.get(9)); + assertEquals(10, result.size(), "Number of completions does not match"); + assertEquals("ackage", result.get(0), "Incorrect completion"); + assertEquals("rint", result.get(1), "Incorrect completion"); + assertEquals("ublic", result.get(2), "Incorrect completion"); + assertEquals("rintln", result.get(3), "Incorrect completion"); + assertEquals("rinting", result.get(4), "Incorrect completion"); + assertEquals("lugin", result.get(5), "Incorrect completion"); + assertEquals("rovider", result.get(6), "Incorrect completion"); + assertEquals("roviderName", result.get(7), "Incorrect completion"); + assertEquals("rogram", result.get(8), "Incorrect completion"); + assertEquals("roperties", result.get(9), "Incorrect completion"); } @Test public void testSearch2() throws BadLocationException { ArrayList docsList= new ArrayList<>(Arrays.asList(this.documents)); List result= createSuggestions("printe", docsList); - assertEquals("Number of completions does not match", 0, result.size()); + assertEquals(0, result.size(), "Number of completions does not match"); result= createSuggestions("s", docsList); - assertEquals("Number of completions does not match", 8, result.size()); + assertEquals(8, result.size(), "Number of completions does not match"); result= createSuggestions("pack", documents[0]); - assertEquals("Number of completions does not match", 1, result.size()); + assertEquals(1, result.size(), "Number of completions does not match"); } @Test @@ -283,56 +283,56 @@ public void testForwardSearchInternational() throws BadLocationException { public void testPrefix() throws BadLocationException { String prefix= fEngine.getPrefixString(documents[0], documents[0].get().indexOf("testing") + 3); - assertEquals(prefix, "tes"); + assertEquals("tes", prefix); prefix= fEngine.getPrefixString(documents[0], documents[0].get().indexOf("public") + 4); - assertEquals(prefix, "publ"); + assertEquals("publ", prefix); prefix= fEngine.getPrefixString(documents[0], documents[0].get().indexOf("println") + 7); - assertEquals(prefix, "println"); + assertEquals("println", prefix); prefix= fEngine.getPrefixString(documents[0], documents[0].get().indexOf("println") + 8); - assertEquals(prefix, null); + assertEquals(null, prefix); prefix= fEngine.getPrefixString(documents[1], 3); - assertEquals(prefix, "Thi"); + assertEquals("Thi", prefix); prefix= fEngine.getPrefixString(documents[1], 0); - assertEquals(prefix, null); + assertEquals(null, prefix); prefix= fEngine.getPrefixString(documents[1], documents[1].getLength()); - assertEquals(prefix, "tests"); + assertEquals("tests", prefix); prefix= fEngine.getPrefixString(documents[3], documents[3].get().indexOf("Copyright") - 2); - assertEquals(prefix, null); + assertEquals(null, prefix); prefix= fEngine.getPrefixString(documents[4], documents[4].get().indexOf("IDE") + 2); - assertEquals(prefix, "ID"); + assertEquals("ID", prefix); prefix= fEngine.getPrefixString(documents[4], documents[4].get().indexOf("$arabic\u20ACDigits") + 8); - assertEquals(prefix, "$arabic\u20AC"); + assertEquals("$arabic\u20AC", prefix); prefix= fEngine.getPrefixString(documents[4], documents[4].get().indexOf("$arabic\u20AAWord") + 8); - assertEquals(prefix, "$arabic\u20AA"); + assertEquals("$arabic\u20AA", prefix); prefix= fEngine.getPrefixString(documents[4], documents[4].get().indexOf("\u00A3\u0661\u0662\u0663") + 3); - assertEquals(prefix, "\u00A3\u0661\u0662"); + assertEquals("\u00A3\u0661\u0662", prefix); prefix= fEngine.getPrefixString(documents[4], documents[4].get().indexOf("a\u0300\u0301b") + 3); - assertEquals(prefix, "a\u0300\u0301"); + assertEquals("a\u0300\u0301", prefix); prefix= fEngine.getPrefixString(documents[4], documents[4].get().indexOf("\u0667\u0668\u0669\u0660") + 2); - assertEquals(prefix, "\u0667\u0668"); + assertEquals("\u0667\u0668", prefix); } @Test @@ -340,66 +340,66 @@ public void testInternational() throws BadLocationException { IDocument intlDoc= documents[4]; List result= createSuggestions("\u05D4", intlDoc); // hebrew letter heh - assertEquals("Number of completions does not match", 4, result.size()); - assertEquals(result.get(0), "\u05DE\u05D7\u05DC\u05E7\u05D4"); - assertEquals(result.get(1), "\u05D6\u05D5"); - assertEquals(result.get(2), "\u05D4\u05E9\u05DC\u05DE\u05D5\u05EA"); - assertEquals(result.get(3), "\u05D4\u05E9"); + assertEquals(4, result.size(), "Number of completions does not match"); + assertEquals("\u05DE\u05D7\u05DC\u05E7\u05D4", result.get(0)); + assertEquals("\u05D6\u05D5", result.get(1)); + assertEquals("\u05D4\u05E9\u05DC\u05DE\u05D5\u05EA", result.get(2)); + assertEquals("\u05D4\u05E9", result.get(3)); result= createSuggestions("\u0661", intlDoc); // arabic digit "1" - assertEquals("Number of completions does not match", 1, result.size()); - assertEquals(result.get(0), "\u0662\u0663\u0664\u0665\u0666"); + assertEquals(1, result.size(), "Number of completions does not match"); + assertEquals("\u0662\u0663\u0664\u0665\u0666", result.get(0)); result= createSuggestions("\u0628\u064E", intlDoc); // arabic letter bah and fatha - assertEquals("Number of completions does not match", 1, result.size()); - assertEquals(result.get(0), "\u0627\u0628\u0650"); + assertEquals(1, result.size(), "Number of completions does not match"); + assertEquals("\u0627\u0628\u0650", result.get(0)); result= createSuggestions("\u0628", intlDoc); // arabic letter bah - assertEquals("Number of completions does not match", 2, result.size()); - assertEquals(result.get(0), "\u064E\u0627\u0628\u0650"); - assertEquals(result.get(1), "\u0627\u0628"); + assertEquals(2, result.size(), "Number of completions does not match"); + assertEquals("\u064E\u0627\u0628\u0650", result.get(0)); + assertEquals("\u0627\u0628", result.get(1)); result= createSuggestions("$ara", intlDoc); - assertEquals("Number of completions does not match", 2, result.size()); - assertEquals(result.get(0), "bic\u20ACDigits"); - assertEquals(result.get(1), "bic\u20AAWord"); + assertEquals(2, result.size(), "Number of completions does not match"); + assertEquals("bic\u20ACDigits", result.get(0)); + assertEquals("bic\u20AAWord", result.get(1)); result= createSuggestions("\u0441\u0430", intlDoc); // russian letters "s" and "a" - assertEquals("Number of completions does not match", 2, result.size()); - assertEquals(result.get(0), "\u043C\u044B\u0439"); - assertEquals(result.get(1), "\u043C"); + assertEquals(2, result.size(), "Number of completions does not match"); + assertEquals("\u043C\u044B\u0439", result.get(0)); + assertEquals("\u043C", result.get(1)); result= createSuggestions("\u05D1\u05D5", intlDoc); // hebrew letters bet and vav - assertEquals("Number of completions does not match", 2, result.size()); - assertEquals(result.get(0), "\u05D3\u05E7\u05EA"); - assertEquals(result.get(1), "\u05D3\u05E7"); + assertEquals(2, result.size(), "Number of completions does not match"); + assertEquals("\u05D3\u05E7\u05EA", result.get(0)); + assertEquals("\u05D3\u05E7", result.get(1)); result= createSuggestions("a", intlDoc); - assertEquals("Number of completions does not match", 4, result.size()); - assertEquals(result.get(0), "n"); - assertEquals(result.get(1), "rabic"); - assertEquals(result.get(2), "rgs"); - assertEquals(result.get(3), "\u0300\u0301b"); + assertEquals(4, result.size(), "Number of completions does not match"); + assertEquals("n", result.get(0)); + assertEquals("rabic", result.get(1)); + assertEquals("rgs", result.get(2)); + assertEquals("\u0300\u0301b", result.get(3)); result= createSuggestions("\u20AA", intlDoc); // israeli currency (shekel) - assertEquals("Number of completions does not match", 1, result.size()); - assertEquals(result.get(0), "129"); + assertEquals(1, result.size(), "Number of completions does not match"); + assertEquals("129", result.get(0)); result= createSuggestions("\u20A3", intlDoc); // french currency (frank) - assertEquals("Number of completions does not match", 2, result.size()); - assertEquals(result.get(0), "1"); - assertEquals(result.get(1), "1"); + assertEquals(2, result.size(), "Number of completions does not match"); + assertEquals("1", result.get(0)); + assertEquals("1", result.get(1)); result= createSuggestions("\u044D", intlDoc); // russial letter "hard e" - assertEquals("Number of completions does not match", 2, result.size()); - assertEquals(result.get(0), "\u0442\u043E"); - assertEquals(result.get(1), "\u0442"); + assertEquals(2, result.size(), "Number of completions does not match"); + assertEquals("\u0442\u043E", result.get(0)); + assertEquals("\u0442", result.get(1)); result= createSuggestions("\u00A3", intlDoc); // pound currency sign - assertEquals("Number of completions does not match", 1, result.size()); - assertEquals(result.get(0), "\u0661\u0662\u0663"); + assertEquals(1, result.size(), "Number of completions does not match"); + assertEquals("\u0661\u0662\u0663", result.get(0)); result= createSuggestions("\u00A5", intlDoc); // yen currency sign - assertEquals("Number of completions does not match", 0, result.size()); + assertEquals(0, result.size(), "Number of completions does not match"); } @Test @@ -408,14 +408,14 @@ public void testInternationalBackwards() throws BadLocationException { List list= fEngine.getCompletionsBackwards(intlDoc, "\u043B\u0443", intlDoc.get().indexOf("129")); assertEquals(2, list.size()); - assertEquals(list.get(0), "\u0447\u0448"); - assertEquals(list.get(1), "\u0447\u0448\u0438\u0439"); + assertEquals("\u0447\u0448", list.get(0)); + assertEquals("\u0447\u0448\u0438\u0439", list.get(1)); list= fEngine.getCompletionsBackwards(intlDoc, "\u05DE", intlDoc.get().lastIndexOf('+')); assertEquals(2, list.size()); - assertEquals(list.get(0), "\u05D7"); - assertEquals(list.get(1), "\u05E0\u05D2\u05E0\u05D5\u05DF"); + assertEquals("\u05D7", list.get(0)); + assertEquals("\u05E0\u05D2\u05E0\u05D5\u05DF", list.get(1)); list= fEngine.getCompletionsBackwards(intlDoc, "\u0667", intlDoc.get().indexOf("\u2021\u0667") + 1); @@ -424,7 +424,7 @@ public void testInternationalBackwards() throws BadLocationException { list= fEngine.getCompletionsBackwards(intlDoc, "\u0628", intlDoc.get().lastIndexOf("\u0628")); assertEquals(1, list.size()); - assertEquals(list.get(0), "\u064E\u0627\u0628\u0650"); + assertEquals("\u064E\u0627\u0628\u0650", list.get(0)); } @@ -508,7 +508,7 @@ public void testCompletionState() throws Exception { @Test public void testIteration() throws Exception { //Check only with current document - IDocument openDocument= new Document("" + + IDocument openDocument= new Document ("" + "bar\n" + "bar1\n" + "bar2\n" + @@ -523,7 +523,7 @@ public void testIteration() throws Exception { //Check with 2 documents List otherDocuments= new ArrayList<>(); - otherDocuments.add(new Document("" + + otherDocuments.add(new Document ("" + "bar3\n" + "bar4\n" + "")); @@ -578,4 +578,4 @@ private List createSuggestions(String prefix, List docsList) return results; } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java index 793ed327921..f1eb232d74f 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java @@ -16,9 +16,8 @@ import java.io.File; import java.io.PrintStream; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestName; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.GC; @@ -39,17 +38,14 @@ public class ScreenshotTest { - @Rule - public TestName testName = new TestName(); - @Test - public void testScreenshot() throws Exception { - String screenshot= takeScreenshot(ScreenshotTest.class, testName.getMethodName(), System.out); + public void testScreenshot(TestInfo testInfo) throws Exception { + String screenshot= takeScreenshot(ScreenshotTest.class, testInfo.getTestMethod().get().getName(), System.out); new File(screenshot).delete(); } @Test - public void testWindowsTaskManagerScreenshots() throws Exception { + public void testWindowsTaskManagerScreenshots(TestInfo testInfo) throws Exception { if (! Util.isWindows()) return; @@ -74,7 +70,7 @@ public void testWindowsTaskManagerScreenshots() throws Exception { System.out.println("* CTRL up " + display.post(event)); runEventQueue(); - String screenshot1= takeScreenshot(ScreenshotTest.class, testName.getMethodName() + 2, System.out); + String screenshot1= takeScreenshot(ScreenshotTest.class, testInfo.getTestMethod().get().getName() + 2, System.out); event.type= SWT.KeyDown; event.character= SWT.ESC; @@ -84,7 +80,7 @@ public void testWindowsTaskManagerScreenshots() throws Exception { System.out.println("* ESC up " + display.post(event)); runEventQueue(); - String screenshot2= takeScreenshot(ScreenshotTest.class, testName.getMethodName() + 3, System.out); + String screenshot2= takeScreenshot(ScreenshotTest.class, testInfo.getTestMethod().get().getName() + 3, System.out); new File(screenshot1).delete(); new File(screenshot2).delete(); } @@ -194,4 +190,4 @@ private static void runEventQueue() { } } } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java index 67c81bee7b9..31c6fd31157 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java @@ -13,16 +13,16 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Random; -import org.junit.FixMethodOrder; -import org.junit.Test; -import org.junit.runners.MethodSorters; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; import org.eclipse.ui.internal.texteditor.HistoryTracker; @@ -31,7 +31,7 @@ * * @since 3.1 */ -@FixMethodOrder(MethodSorters.NAME_ASCENDING) +@TestMethodOrder(MethodOrderer.MethodName.class) public class TextEditorPluginTest { Random rand = new Random(55); //pseudo-random for repeatability @@ -379,4 +379,4 @@ private void goBackLinear(HistoryTracker history, boolean shouldMove) { assertEquals(latest, prior); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java index 493989e30b9..bc126647159 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java @@ -10,15 +10,15 @@ * * Contributors: * Pierre-Yves Bigourdan - initial API and implementation - *******************************************************************************/ + ******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.swt.SWT; import org.eclipse.swt.dnd.Clipboard; @@ -42,7 +42,7 @@ public class TextViewerDeleteLineTargetTest { private Shell parentShell; private TextViewerDeleteLineTarget underTest; - @Before + @BeforeEach public void setUp() { document= new Document("first line\n" + "\n" + @@ -55,7 +55,7 @@ public void setUp() { underTest= new TextViewerDeleteLineTarget(textViewer); } - @After + @AfterEach public void tearDown() { if (parentShell != null) { parentShell.dispose(); @@ -115,4 +115,4 @@ public void testThrowsExceptionWithUnsupportedDeleteLineActionType() throws Exce assertThrows(IllegalArgumentException.class, () -> underTest.deleteLine(document, 0, 0, IAction.AS_RADIO_BUTTON, false)); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java index b3a945594da..a6e83f30a38 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java @@ -13,8 +13,8 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests.minimap; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; @@ -77,20 +77,20 @@ public T getAdapter(Class required) { public void createNoneMinimapPage() { ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.None); MinimapPage page= MinimapPage.createMinimapPage(textEditor); - Assert.assertNull(page); + Assertions.assertNull(page); } @Test public void createMinimapPageWithITextViewerAdapter() { ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.ITextViewer); MinimapPage page= MinimapPage.createMinimapPage(textEditor); - Assert.assertNotNull(page); + Assertions.assertNotNull(page); } @Test public void createMinimapPageWithITextOperationTargetAdapter() { ITextEditor textEditor= new MyTextEditor(TextVieverAdapterKind.ITextOperationTarget); MinimapPage page= MinimapPage.createMinimapPage(textEditor); - Assert.assertNotNull(page); + Assertions.assertNotNull(page); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java index 7044e9550a0..da8c8f80df5 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java @@ -13,10 +13,10 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests.minimap; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; @@ -53,7 +53,7 @@ public class MinimapWidgetTest { private StyledText minimapStyledText; - @Before + @BeforeEach public void createMinimap() { minimapParent= new Shell(); editorViewer= new TextViewer(minimapParent, SWT.NONE); @@ -65,7 +65,7 @@ public void createMinimap() { } - @After + @AfterEach public void tearDownMinimap() { if (minimapParent != null) { minimapParent.dispose(); @@ -76,10 +76,10 @@ public void tearDownMinimap() { @Test public void testMinimapContent() { editorStyledText.setText("abcd"); - Assert.assertEquals("abcd", minimapStyledText.getText()); + Assertions.assertEquals("abcd", minimapStyledText.getText()); editorStyledText.replaceTextRange(1, 0, "ABCD"); - Assert.assertEquals("aABCDbcd", minimapStyledText.getText()); + Assertions.assertEquals("aABCDbcd", minimapStyledText.getText()); } @Test @@ -90,7 +90,7 @@ public void testMinimapSetStyles() { StyleRange[] ranges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null) }; editorStyledText.setStyleRanges(ranges); // Styles of minimap doesn't changed - Assert.assertArrayEquals(orginalMinimapStyles, minimapStyledText.getStyleRanges()); + Assertions.assertArrayEquals(orginalMinimapStyles, minimapStyledText.getStyleRanges()); } @Test @@ -103,7 +103,7 @@ public void testMinimapSetStylesWithTextPresentation() { presentation.mergeStyleRanges(ranges); editorViewer.changeTextPresentation(presentation, false); StyleRange[] expectedRanges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null) }; - Assert.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges()); + Assertions.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges()); ranges= new StyleRange[] { new StyleRange(1, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_RED), null) }; presentation= new TextPresentation(); @@ -111,6 +111,6 @@ public void testMinimapSetStylesWithTextPresentation() { editorViewer.changeTextPresentation(presentation, false); expectedRanges= new StyleRange[] { new StyleRange(0, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_BLACK), null), new StyleRange(1, 1, editorStyledText.getDisplay().getSystemColor(SWT.COLOR_RED), null) }; - Assert.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges()); + Assertions.assertArrayEquals(expectedRanges, minimapStyledText.getStyleRanges()); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java index a74c27a2d7b..dcb6d49f9da 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java @@ -13,15 +13,15 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests.revisions; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.Date; import java.util.List; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.swt.graphics.RGB; @@ -62,7 +62,7 @@ public Date getDate() { private Revision fRevision; - @Before + @BeforeEach public void setUp() throws Exception { fRevision= new TestRevision(); } @@ -411,4 +411,4 @@ public void testHunkInBetween() throws Exception { RangeUtil.assertEqualRanges(new LineRange(12, 3), new LineRange(19, 2), r.getAdjustedRanges()); RangeUtil.assertEqualRange(new LineRange(12, 9), r.getAdjustedCoverage()); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java index 3fa96c95925..726e47ee61a 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java @@ -13,9 +13,9 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests.revisions; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.jface.internal.text.revisions.Hunk; import org.eclipse.jface.internal.text.revisions.HunkComputer; @@ -246,4 +246,4 @@ private void assertHunks(int[] diffInfo, int[] expected) { } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java index 6722ddd7f9a..195da2bfeb0 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java @@ -13,11 +13,11 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests.revisions; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.jface.internal.text.revisions.LineIndexOutOfBoundsException; import org.eclipse.jface.internal.text.revisions.Range; @@ -398,4 +398,4 @@ private static void assertConsistency(Range r) { assertEquals(r.start() + r.length(), r.end()); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java index 836302634a2..b8bdeebe36c 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java @@ -13,18 +13,18 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests.revisions; +import static org.junit.jupiter.api.Assertions.assertEquals; + import java.util.ArrayList; import java.util.Iterator; import java.util.List; -import org.junit.Assert; - import org.eclipse.jface.internal.text.revisions.Range; import org.eclipse.jface.text.source.ILineRange; -class RangeUtil extends Assert { +class RangeUtil { private RangeUtil() {} static void assertEqualRange(ILineRange expected, ILineRange actual) { @@ -62,4 +62,4 @@ static void assertEqualRanges(List expected, List actual) { assertEqualRange(r1, r2); } } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java index 85285fb8be1..7872db7cbee 100644 --- a/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java +++ b/tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java @@ -13,14 +13,17 @@ *******************************************************************************/ package org.eclipse.ui.workbench.texteditor.tests.rulers; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.util.Arrays; import java.util.Collections; import java.util.LinkedHashSet; import java.util.Set; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.ui.internal.texteditor.rulers.DAG; @@ -136,4 +139,4 @@ public void testDag() throws Exception { assertTrue(fDag.getChildren(C).isEmpty()); assertTrue(fDag.getChildren(D).isEmpty()); } -} +} \ No newline at end of file From 730daf64c6b3746728ae1f6ac375de39614f755a Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Mon, 2 Feb 2026 10:48:10 +0100 Subject: [PATCH 03/19] Migrate org.eclipse.jface.tests to JUnit 5 --- .../META-INF/MANIFEST.MF | 4 +- .../jface/tests/action/AllActionTests.java | 6 +- .../jface/tests/action/JFaceActionRule.java | 60 --------------- .../jface/tests/dialogs/AllDialogTests.java | 6 +- .../AbstractFieldAssistTestCase.java | 41 +++++----- .../ContentProposalAdapterTest.java | 35 ++++----- .../fieldassist/ControlDecorationTests.java | 22 +++--- .../fieldassist/FieldAssistAPITests.java | 42 +++++----- .../fieldassist/FieldAssistTestCase.java | 46 +++++------ .../jface/tests/images/AllImagesTests.java | 6 +- .../tests/images/UrlImageDescriptorTest.java | 77 ++++++++++--------- .../jface/tests/layout/AllLayoutTests.java | 6 +- .../tests/preferences/AllPrefsTests.java | 6 +- .../tests/resources/AllResourcesTests.java | 6 +- .../tests/resources/FontRegistryTest.java | 4 +- .../jface/tests/viewers/AllViewersTests.java | 6 +- .../viewers/TestLazyModelContentProvider.java | 2 +- .../viewers/TreeViewerWithLimitTest.java | 72 ++++++++--------- .../jface/tests/window/AllWindowTests.java | 6 +- .../jface/tests/wizards/WizardTestSuite.java | 6 +- 20 files changed, 190 insertions(+), 269 deletions(-) delete mode 100644 tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/JFaceActionRule.java diff --git a/tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF index 815803d2626..22e2c1d34bb 100644 --- a/tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF @@ -5,8 +5,7 @@ Bundle-SymbolicName: org.eclipse.jface.tests Bundle-Version: 1.5.0.qualifier Automatic-Module-Name: org.eclipse.jface.tests Bundle-RequiredExecutionEnvironment: JavaSE-21 -Require-Bundle: org.junit;bundle-version="4.12.0", - org.eclipse.jface, +Require-Bundle: org.eclipse.jface, org.eclipse.equinox.registry, org.eclipse.core.runtime, org.eclipse.ui, @@ -14,6 +13,7 @@ Require-Bundle: org.junit;bundle-version="4.12.0", Import-Package: org.junit.jupiter.api;version="[5.14.0,6.0.0)", org.junit.jupiter.api.extension;version="[5.14.0,6.0.0)", org.junit.jupiter.api.function;version="[5.14.0,6.0.0)", + org.junit.jupiter.api.io;version="[5.14.0,6.0.0)", org.junit.platform.commons.function;version="[1.14.0,2.0.0)", org.junit.platform.suite.api;version="[1.14.0,2.0.0)", org.opentest4j;version="1.3.0", diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java index af6efa208cb..6ca56c5e67c 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jface.tests.action; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -23,8 +23,6 @@ MenuManagerTest.class }) public class AllActionTests { - public static void main(String[] args) { - JUnitCore.main(AllActionTests.class.getName()); - } + } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/JFaceActionRule.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/JFaceActionRule.java deleted file mode 100644 index cca0e044442..00000000000 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/JFaceActionRule.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2023 vogella GmbH and others. - * - * This program and the accompanying materials - * are made available under the terms of the Eclipse Public License 2.0 - * which accompanies this distribution, and is available at - * https://www.eclipse.org/legal/epl-2.0/ - * - * SPDX-License-Identifier: EPL-2.0 - * - * Contributors: - * Lars Vogel - initial API and implementation - *******************************************************************************/ -package org.eclipse.jface.tests.action; - -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.junit.rules.TestRule; -import org.junit.runner.Description; -import org.junit.runners.model.Statement; - -/** - * Junit4 rule for all JFace action tests. - * - * @since 3.1 - */ -public class JFaceActionRule implements TestRule { - - private Display display; - private Shell shell; - - @Override - public Statement apply(final Statement base, final Description description) { - return new Statement() { - @Override - public void evaluate() throws Throwable { - display = Display.getCurrent(); - if (display == null) { - display = new Display(); - } - shell = new Shell(display); - shell.setSize(500, 500); - shell.setLayout(new FillLayout()); - shell.open(); - - try { - base.evaluate(); // This will run the test. - } finally { - shell.dispose(); - } - } - }; - } - - protected Shell getShell() { - return shell; - } - -} diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java index 89c89fe99d6..bf2309218e9 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jface.tests.dialogs; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -24,7 +24,5 @@ ProgressMonitorDialogTest.class, PlainMessageDialogTest.class }) public class AllDialogTests { - public static void main(String[] args) { - JUnitCore.main(AllDialogTests.class.getName()); - } + } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java index 116bdd077e5..122b9e0427f 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java @@ -14,9 +14,9 @@ ******************************************************************************/ package org.eclipse.jface.tests.fieldassist; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.swt.SWT; @@ -25,15 +25,12 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.tests.harness.util.TestRunLogUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.rules.TestWatcher; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.TestInfo; public abstract class AbstractFieldAssistTestCase { - @Rule - public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN; - + /** * The window that is being tested. */ @@ -49,8 +46,9 @@ public abstract class AbstractFieldAssistTestCase { */ private int originalShellCount; - @Before - public final void setUp() throws Exception { + @BeforeEach + public final void setUp(TestInfo testInfo) throws Exception { + System.out.println(TestRunLogUtil.formatTestStartMessage(testInfo.getTestMethod().get().getName())); Display display = getDisplay(); anotherShell = new Shell(display); new Text(anotherShell, SWT.SINGLE); @@ -61,13 +59,14 @@ public final void setUp() throws Exception { assertNotNull(window); } - @After - public final void tearDown() throws Exception { + @AfterEach + public final void tearDown(TestInfo testInfo) throws Exception { if (window != null) { spinEventLoop(); } closeFieldAssistWindow(); anotherShell.close(); + System.out.println(TestRunLogUtil.formatTestFinishedMessage(testInfo.getTestMethod().get().getName())); } protected Display getDisplay() { @@ -171,7 +170,7 @@ protected void sendKeyDownToControl(char character) { Event event = new Event(); event.type = SWT.KeyDown; event.character = character; - assertTrue("unable to post event to display queue for test case", window.getDisplay().post(event)); + assertTrue(window.getDisplay().post(event), "unable to post event to display queue for test case"); spinEventLoop(); } @@ -186,7 +185,7 @@ protected void sendKeyDownToControl(KeyStroke keystroke) { Event event = new Event(); event.type = SWT.KeyDown; event.keyCode = keystroke.getNaturalKey(); - assertTrue("unable to post event to display queue for test case", window.getDisplay().post(event)); + assertTrue(window.getDisplay().post(event), "unable to post event to display queue for test case"); spinEventLoop(); } @@ -195,8 +194,8 @@ protected void sendKeyDownToControl(KeyStroke keystroke) { */ protected void assertOneShellUp() { spinEventLoop(); - assertEquals("There should only be one shell up, the dialog", originalShellCount + 1, - window.getDisplay().getShells().length); + assertEquals(originalShellCount + 1, + window.getDisplay().getShells().length, "There should only be one shell up, the dialog"); } /** @@ -205,8 +204,8 @@ protected void assertOneShellUp() { */ protected void assertTwoShellsUp() { spinEventLoop(); - assertEquals("There should two shells up, the dialog and the proposals dialog", originalShellCount + 2, - window.getDisplay().getShells().length); + assertEquals(originalShellCount + 2, + window.getDisplay().getShells().length, "There should two shells up, the dialog and the proposals dialog"); } protected void setControlContent(String text) { @@ -219,4 +218,4 @@ protected String getControlContent() { } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java index d28a45f7067..1e72f55d5a7 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java @@ -13,9 +13,9 @@ *******************************************************************************/ package org.eclipse.jface.tests.fieldassist; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.jface.fieldassist.ContentProposalAdapter; import org.eclipse.jface.fieldassist.IContentProposalProvider; @@ -28,15 +28,12 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import org.eclipse.ui.tests.harness.util.TestRunLogUtil; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TestWatcher; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInfo; public class ContentProposalAdapterTest { - @Rule - public TestWatcher LOG_TESTRUN = TestRunLogUtil.LOG_TESTRUN; /** * A shell that hosts the decorated text control @@ -121,8 +118,9 @@ public void testBug520372AutoActivationDelayESC() throws Exception { // most of the following code is copied from AbstractFieldAssistTestCase - @Before - public final void setUp() throws Exception { + @BeforeEach + public final void setUp(TestInfo testInfo) throws Exception { + System.out.println(TestRunLogUtil.formatTestStartMessage(testInfo.getTestMethod().get().getName())); Display display = getDisplay(); originalShellCount = display.getShells().length; controlShell = new Shell(display); @@ -133,8 +131,8 @@ public final void setUp() throws Exception { assertNotNull(contentProposalAdapter); } - @After - public final void tearDown() throws Exception { + @AfterEach + public final void tearDown(TestInfo testInfo) throws Exception { if (controlShell != null) { spinEventLoop(); controlShell.close(); @@ -145,6 +143,7 @@ public final void tearDown() throws Exception { } this.display = null; } + System.out.println(TestRunLogUtil.formatTestFinishedMessage(testInfo.getTestMethod().get().getName())); } private Display getDisplay() { @@ -179,7 +178,7 @@ private void sendKeyDownToControl(char character) { Event event = new Event(); event.type = SWT.KeyDown; event.character = character; - assertTrue("unable to post event to display queue for test case", text.getDisplay().post(event)); + assertTrue(text.getDisplay().post(event), "unable to post event to display queue for test case"); spinEventLoop(); } @@ -233,7 +232,7 @@ private void ensurePopupIsUp() { */ private void assertOneShellUp() { spinEventLoop(); - assertEquals("There should only be one shell up, the dialog", originalShellCount + 1, - text.getDisplay().getShells().length); + assertEquals(originalShellCount + 1, + text.getDisplay().getShells().length, "There should only be one shell up, the dialog"); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java index 5890ccfee8b..66b58ba29c7 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java @@ -13,16 +13,16 @@ ******************************************************************************/ package org.eclipse.jface.tests.fieldassist; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.jface.fieldassist.ControlDecoration; import org.eclipse.jface.fieldassist.FieldDecorationRegistry; import org.eclipse.swt.SWT; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; -import org.junit.Ignore; -import org.junit.Test; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class ControlDecorationTests extends AbstractFieldAssistTestCase { @@ -37,15 +37,15 @@ public void testDecorationIsVisible() { .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage()); decoration.setDescriptionText("foo"); window.open(); - assertTrue("1.0", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.0"); decoration.hide(); - assertFalse("1.1", decoration.isVisible()); + assertFalse(decoration.isVisible(), "1.1"); decoration.show(); - assertTrue("1.2", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.2"); window.getFieldAssistControl().setVisible(false); - assertFalse("1.3", decoration.isVisible()); + assertFalse(decoration.isVisible(), "1.3"); window.getFieldAssistControl().setVisible(true); - assertTrue("1.4", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.4"); // focus related tests. Comment out for now. // see bug 275393 @@ -71,7 +71,7 @@ public void testHoverVisibility() { decoration.setImage(FieldDecorationRegistry.getDefault() .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage()); decoration.setDescriptionText("foo"); - assertTrue("1.0", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.0"); assertOneShellUp(); decoration.hide(); decoration.showHoverText("Show me"); @@ -87,7 +87,7 @@ public void testHoverVisibility() { // focus related tests @Test - @Ignore("Disabled see Bug 418420 and bug 275393") + @Disabled("Disabled see Bug 418420 and bug 275393") public void testBug418420() { AbstractFieldAssistWindow window = getFieldAssistWindow(); window.open(); diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java index bb2ea58a403..0d282594147 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java @@ -14,13 +14,13 @@ ******************************************************************************/ package org.eclipse.jface.tests.fieldassist; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.fail; import org.eclipse.jface.fieldassist.ContentProposal; import org.eclipse.jface.fieldassist.IContentProposal; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class FieldAssistAPITests extends AbstractFieldAssistTestCase { @@ -32,37 +32,37 @@ public class FieldAssistAPITests extends AbstractFieldAssistTestCase { @Test public void testSimpleContentProposal() { proposal = new ContentProposal(content); - assertEquals("1.0", content, proposal.getContent()); - assertEquals("1.1", content, proposal.getLabel()); - assertNull("1.2", proposal.getDescription()); - assertEquals("1.3", content.length(), proposal.getCursorPosition()); + assertEquals(content, proposal.getContent(), "1.0"); + assertEquals(content, proposal.getLabel(), "1.1"); + assertNull(proposal.getDescription(), "1.2"); + assertEquals(content.length(), proposal.getCursorPosition(), "1.3"); } @Test public void testContentProposalWithCursor() { proposal = new ContentProposal(content, label, description, 3); - assertEquals("3.0", content, proposal.getContent()); - assertEquals("3.1", label, proposal.getLabel()); - assertEquals("3.2", description, proposal.getDescription()); - assertEquals("3.3", 3, proposal.getCursorPosition()); + assertEquals(content, proposal.getContent(), "3.0"); + assertEquals(label, proposal.getLabel(), "3.1"); + assertEquals(description, proposal.getDescription(), "3.2"); + assertEquals(3, proposal.getCursorPosition(), "3.3"); } @Test public void testContentProposalWithLabel() { proposal = new ContentProposal(content, label, description); - assertEquals("3.0", content, proposal.getContent()); - assertEquals("3.1", label, proposal.getLabel()); - assertEquals("3.2", description, proposal.getDescription()); - assertEquals("3.3", content.length(), proposal.getCursorPosition()); + assertEquals(content, proposal.getContent(), "3.0"); + assertEquals(label, proposal.getLabel(), "3.1"); + assertEquals(description, proposal.getDescription(), "3.2"); + assertEquals(content.length(), proposal.getCursorPosition(), "3.3"); } @Test public void testContentProposalWithDescription() { proposal = new ContentProposal(content, description); - assertEquals("2.0", content, proposal.getContent()); - assertEquals("2.1", content, proposal.getLabel()); - assertEquals("2.2", description, proposal.getDescription()); - assertEquals("2.3", content.length(), proposal.getCursorPosition()); + assertEquals(content, proposal.getContent(), "2.0"); + assertEquals(content, proposal.getLabel(), "2.1"); + assertEquals(description, proposal.getDescription(), "2.2"); + assertEquals(content.length(), proposal.getCursorPosition(), "2.3"); } public void testInitializationWithInvalidCursor() { @@ -70,7 +70,7 @@ public void testInitializationWithInvalidCursor() { proposal = new ContentProposal(content, label, description, 100); fail("4.0"); } catch (IllegalArgumentException e) { - assertNull("It is expected to be null", proposal); + assertNull(proposal, "It is expected to be null"); } } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java index fe259d49eda..f6862fda472 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java @@ -13,9 +13,9 @@ ******************************************************************************/ package org.eclipse.jface.tests.fieldassist; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; import org.eclipse.jface.bindings.keys.KeyStroke; import org.eclipse.jface.fieldassist.ContentProposalAdapter; @@ -26,7 +26,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; -import org.junit.Test; +import org.junit.jupiter.api.Test; /** * This class contains test cases appropriate for generic field assist @@ -104,7 +104,7 @@ public void testPropagateKeysOff() { ensurePopupIsUp(); assertTwoShellsUp(); sendKeyDownToControl(EXTRA_CHAR); - assertEquals("1.0", SAMPLE_CONTENT + new String(new char [] {ACTIVATE_CHAR}), getControlContent()); + assertEquals(SAMPLE_CONTENT + new String(new char [] {ACTIVATE_CHAR}), getControlContent(), "1.0"); } @Test @@ -118,7 +118,7 @@ public void testPropagateKeysOn() { ensurePopupIsUp(); assertTwoShellsUp(); sendKeyDownToControl(EXTRA_CHAR); - assertEquals("1.0", SAMPLE_CONTENT + new String(new char [] {ACTIVATE_CHAR, EXTRA_CHAR}), getControlContent()); + assertEquals(SAMPLE_CONTENT + new String(new char [] {ACTIVATE_CHAR, EXTRA_CHAR}), getControlContent(), "1.0"); } @Test @@ -169,28 +169,28 @@ public void testDecorationIsVisible() { .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage()); decoration.setDescriptionText("foo"); spinEventLoop(); - assertTrue("1.0", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.0"); decoration.hide(); - assertFalse("1.1", decoration.isVisible()); + assertFalse(decoration.isVisible(), "1.1"); decoration.setShowOnlyOnFocus(true); sendFocusElsewhere(); sendFocusInToControl(); spinEventLoop(); - assertFalse("1.2", decoration.isVisible()); + assertFalse(decoration.isVisible(), "1.2"); decoration.show(); - assertTrue("1.3", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.3"); sendFocusElsewhere(); spinEventLoop(); - assertFalse("1.4", decoration.isVisible()); + assertFalse(decoration.isVisible(), "1.4"); decoration.setShowOnlyOnFocus(false); - assertTrue("1.5", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.5"); window.getFieldAssistControl().setVisible(false); - assertFalse("1.6", decoration.isVisible()); + assertFalse(decoration.isVisible(), "1.6"); decoration.hide(); window.getFieldAssistControl().setVisible(true); - assertFalse("1.7", decoration.isVisible()); + assertFalse(decoration.isVisible(), "1.7"); decoration.show(); - assertTrue("1.8", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.8"); } @Test @@ -206,16 +206,16 @@ public void testPopupFocus() { // Send focus to the control (not the popup) window.getFieldAssistControl().setFocus(); spinEventLoop(); - assertFalse("1.0", window.getContentProposalAdapter().hasProposalPopupFocus()); + assertFalse(window.getContentProposalAdapter().hasProposalPopupFocus(), "1.0"); window.getContentProposalAdapter().setProposalPopupFocus(); spinEventLoop(); - assertTrue("1.1", window.getContentProposalAdapter().hasProposalPopupFocus()); + assertTrue(window.getContentProposalAdapter().hasProposalPopupFocus(), "1.1"); // Setting focus to another shell deactivates the popup sendFocusElsewhere(); spinEventLoop(); assertOneShellUp(); - assertFalse("1.2", window.getContentProposalAdapter().hasProposalPopupFocus()); + assertFalse(window.getContentProposalAdapter().hasProposalPopupFocus(), "1.2"); } @Test @@ -226,16 +226,16 @@ public void testPopupIsOpen() { window.setKeyStroke(stroke); window.open(); - assertFalse("1.0", window.getContentProposalAdapter().isProposalPopupOpen()); + assertFalse(window.getContentProposalAdapter().isProposalPopupOpen(), "1.0"); sendKeyDownToControl(stroke); assertTwoShellsUp(); - assertTrue("1.1", window.getContentProposalAdapter().isProposalPopupOpen()); + assertTrue(window.getContentProposalAdapter().isProposalPopupOpen(), "1.1"); // Setting focus to another shell deactivates the popup sendFocusElsewhere(); spinEventLoop(); assertOneShellUp(); - assertFalse("1.2", window.getContentProposalAdapter().isProposalPopupOpen()); + assertFalse(window.getContentProposalAdapter().isProposalPopupOpen(), "1.2"); } /** @@ -264,7 +264,7 @@ public void testBug256651ReplaceMode() { Rectangle popupBounds = popupShell.getBounds(); Rectangle controlBounds = getFieldAssistWindow().getFieldAssistControl().getBounds(); controlBounds = getDisplay().map(getFieldAssistWindow().getFieldAssistControl().getParent(), null, controlBounds); - assertFalse("Popup is blocking the control", popupBounds.intersects(controlBounds)); + assertFalse(popupBounds.intersects(controlBounds), "Popup is blocking the control"); } /** @@ -292,6 +292,6 @@ public void testDefaultPopupPositioningReplaceMode() { Rectangle popupBounds = popupShell.getBounds(); Rectangle controlBounds = getFieldAssistWindow().getFieldAssistControl().getBounds(); controlBounds = getDisplay().map(getFieldAssistWindow().getFieldAssistControl().getParent(), null, controlBounds); - assertFalse("Popup is blocking the control", popupBounds.intersects(controlBounds)); + assertFalse(popupBounds.intersects(controlBounds), "Popup is blocking the control"); } } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java index 7761d2aa846..7eae3d22a8d 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java @@ -14,7 +14,7 @@ *******************************************************************************/ package org.eclipse.jface.tests.images; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -24,7 +24,5 @@ UrlImageDescriptorTest.class, DecorationOverlayIconTest.class, DeferredImageDescriptorTest.class }) public class AllImagesTests { - public static void main(String[] args) { - JUnitCore.main(AllImagesTests.class.getName()); - } + } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java index 8300fa57ddc..05617f73ad8 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java @@ -15,11 +15,11 @@ ******************************************************************************/ package org.eclipse.jface.tests.images; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertNull; import java.io.File; import java.io.IOException; @@ -32,14 +32,13 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.ImageData; import org.eclipse.swt.graphics.ImageFileNameProvider; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.io.TempDir; public class UrlImageDescriptorTest { - @Rule - public TemporaryFolder tempFolder = new TemporaryFolder(); + @TempDir + public File tempFolder; /** * Test that individually created images of a given descriptor are not equal @@ -50,10 +49,10 @@ public void testDifferentImagesPerUrlImageDescriptor() { ImageDescriptor descriptor = ImageDescriptor .createFromURL(FileImageDescriptorTest.class.getResource("/icons/imagetests/anything.gif")); Image image1 = descriptor.createImage(); - assertNotNull("Could not find first image", image1); + assertNotNull(image1, "Could not find first image"); Image image2 = descriptor.createImage(); - assertNotNull("Could not find second image", image2); - assertNotEquals("Found equal images for URLImageDescriptor", image1, image2); + assertNotNull(image2, "Could not find second image"); + assertNotEquals(image1, image2, "Found equal images for URLImageDescriptor"); image1.dispose(); image2.dispose(); } @@ -86,23 +85,22 @@ public void testImageFileNameProviderGetxPath() { .createFromURL(FileImageDescriptorTest.class.getResource("/icons/imagetests/rectangular-57x16.png")); ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class); - assertNotNull("URLImageDescriptor does not adapt to ImageFileNameProvider", fileNameProvider); + assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider"); ImageFileNameProvider fileNameProvider2nd = Adapters.adapt(descriptor, ImageFileNameProvider.class); // Issue #679: The returned ImageFileNameProvider must be different each time, // because Image#equals depends on this non-uniqueness: - assertNotSame("URLImageDescriptor does return identical ImageFileNameProvider", fileNameProvider, - fileNameProvider2nd); + assertNotSame(fileNameProvider, fileNameProvider2nd, "URLImageDescriptor does return identical ImageFileNameProvider"); String imagePath100 = fileNameProvider.getImagePath(100); - assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 100% path", imagePath100); + assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path"); assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "rectangular-57x16.png"); String imagePath200 = fileNameProvider.getImagePath(200); - assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 200% path", imagePath200); + assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the 200% path"); assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "rectangular-114x32.png"); String imagePath150 = fileNameProvider.getImagePath(150); - assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 150% path", imagePath150); + assertNotNull(imagePath150, "URLImageDescriptor ImageFileNameProvider does not return the 150% path"); assertEquals(IPath.fromOSString(imagePath150).lastSegment(), "rectangular-86x24.png"); String imagePath250 = fileNameProvider.getImagePath(250); - assertNull("URLImageDescriptor's ImageFileNameProvider does return a 250% path", imagePath250); + assertNull(imagePath250, "URLImageDescriptor's ImageFileNameProvider does return a 250% path"); } @Test @@ -111,15 +109,15 @@ public void testImageFileNameProviderGetxName() { .createFromURL(FileImageDescriptorTest.class.getResource("/icons/imagetests/zoomIn.png")); ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class); - assertNotNull("URLImageDescriptor does not adapt to ImageFileNameProvider", fileNameProvider); + assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider"); String imagePath100 = fileNameProvider.getImagePath(100); - assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 100% path", imagePath100); + assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path"); assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "zoomIn.png"); String imagePath200 = fileNameProvider.getImagePath(200); - assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the @2x path", imagePath200); + assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the @2x path"); assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "zoomIn@2x.png"); String imagePath150 = fileNameProvider.getImagePath(150); - assertNull("URLImageDescriptor's ImageFileNameProvider does return a @1.5x path", imagePath150); + assertNull(imagePath150, "URLImageDescriptor's ImageFileNameProvider does return a @1.5x path"); } @Test @@ -136,20 +134,22 @@ private void testImageFileNameProviderGetxName_forFileURL(boolean osgiAvailable) boolean oldOsgiAvailable = InternalPolicy.OSGI_AVAILABLE; InternalPolicy.OSGI_AVAILABLE = osgiAvailable; try { - URL imageFileURL = tempFolder.newFile("image.png").toURI().toURL(); - tempFolder.newFile("image@2x.png"); + File file = new File(tempFolder, "image.png"); + file.createNewFile(); + URL imageFileURL = file.toURI().toURL(); + new File(tempFolder, "image@2x.png").createNewFile(); ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageFileURL); ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class); - assertNotNull("URLImageDescriptor does not adapt to ImageFileNameProvider", fileNameProvider); + assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider"); String imagePath100 = fileNameProvider.getImagePath(100); - assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 100% path", imagePath100); + assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path"); assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "image.png"); String imagePath200 = fileNameProvider.getImagePath(200); - assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the @2x path", imagePath200); + assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the @2x path"); assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "image@2x.png"); String imagePath150 = fileNameProvider.getImagePath(150); - assertNull("URLImageDescriptor's ImageFileNameProvider does return a @1.5x path", imagePath150); + assertNull(imagePath150, "URLImageDescriptor's ImageFileNameProvider does return a @1.5x path"); } finally { InternalPolicy.OSGI_AVAILABLE = oldOsgiAvailable; } @@ -157,7 +157,8 @@ private void testImageFileNameProviderGetxName_forFileURL(boolean osgiAvailable) @Test public void testImageFileNameProviderGetxName_forFileURL_WhiteSpace() throws IOException { - File imageFolder = tempFolder.newFolder("folder with spaces"); + File imageFolder = new File(tempFolder, "folder with spaces"); + imageFolder.mkdir(); File imageFile = new File(imageFolder, "image with spaces.png"); imageFile.createNewFile(); @@ -168,10 +169,10 @@ public void testImageFileNameProviderGetxName_forFileURL_WhiteSpace() throws IOE ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageFileURL); ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class); - assertNotNull("URLImageDescriptor does not adapt to ImageFileNameProvider", fileNameProvider); + assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider"); String imagePath100 = fileNameProvider.getImagePath(100); - assertNotNull("URLImageDescriptor ImageFileNameProvider does not return the 100% path", imagePath100); + assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path"); } @Test @@ -180,24 +181,24 @@ public void testAdaptToURL() { .createFromURL(FileImageDescriptorTest.class.getResource("/icons/imagetests/rectangular-57x16.png")); URL url = Adapters.adapt(descriptor, URL.class); - assertNotNull("URLImageDescriptor does not adapt to URL", url); + assertNotNull(url, "URLImageDescriptor does not adapt to URL"); ImageDescriptor descriptorFromUrl = ImageDescriptor.createFromURL(url); ImageData imageDataOrig = descriptor.getImageData(100); - assertNotNull("Original URL does not return 100% image data", imageDataOrig); + assertNotNull(imageDataOrig, "Original URL does not return 100% image data"); ImageData imageDataURL = descriptorFromUrl.getImageData(100); - assertNotNull("Adapted URL does not return 100% image data", imageDataURL); + assertNotNull(imageDataURL, "Adapted URL does not return 100% image data"); assertEquals(imageDataOrig.width, imageDataURL.width); assertEquals(imageDataOrig.height, imageDataURL.height); ImageData imageDataOrig200 = descriptor.getImageData(200); - assertNotNull("Original URL does not return 200% image data", imageDataOrig200); + assertNotNull(imageDataOrig200, "Original URL does not return 200% image data"); ImageData imageDataURL200 = descriptorFromUrl.getImageData(200); assertEquals(imageDataOrig200.width, imageDataURL200.width); assertEquals(imageDataOrig200.height, imageDataURL200.height); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java index d61447c8555..0b0a510488f 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jface.tests.layout; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -23,8 +23,6 @@ GridLayoutFactoryTest.class, TreeColumnLayoutTest.class }) public class AllLayoutTests { - public static void main(String[] args) { - JUnitCore.main(AllLayoutTests.class.getName()); - } + } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java index 18f658a8121..9c9b1a4a9db 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jface.tests.preferences; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -27,7 +27,5 @@ }) public class AllPrefsTests { - public static void main(String[] args) { - JUnitCore.main(AllPrefsTests.class.getName()); - } + } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java index 9f29e3c86a0..044cb499040 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java @@ -14,7 +14,7 @@ package org.eclipse.jface.tests.resources; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -23,7 +23,5 @@ @SelectClasses({ FontRegistryTest.class, JFaceResourcesTest.class }) public class AllResourcesTests { - public static void main(String[] args) { - JUnitCore.main(AllResourcesTests.class.getName()); - } + } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java index 977fe3297eb..f817e28c8ab 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java @@ -18,7 +18,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.junit.Assume.assumeTrue; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.time.Duration; import java.time.Instant; @@ -55,7 +55,7 @@ public void testBug544026() { @Test public void multipleDisplayDispose() { - assumeTrue("multiple Display instance only allowed on Windows", OS.isWindows()); + assumeTrue(OS.isWindows(), "multiple Display instance only allowed on Windows"); FontRegistry fontRegistry = new FontRegistry(); Display secondDisplay = initializeDisplayInSeparateThread(); diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java index 5b6d9f7da94..e62843873bd 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jface.tests.viewers; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -36,8 +36,6 @@ TableViewerWithLimitCompatibilityTest.class }) public class AllViewersTests { - public static void main(String[] args) { - JUnitCore.main(AllViewersTests.class.getName()); - } + } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java index 9ee269ced36..220867dc098 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java @@ -18,7 +18,7 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; -import junit.framework.AssertionFailedError; +import org.opentest4j.AssertionFailedError; /** * The TestLazyModelContentProvider is the lazy version diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java index 15d34fb2b45..9fdd9b96c5c 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java @@ -14,10 +14,10 @@ package org.eclipse.jface.tests.viewers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.List; @@ -50,17 +50,17 @@ private void assertSetSelectionExpNode(DataModel invisible) { treeViewer.setSelection(new StructuredSelection(invisible), true); processEvents(); IStructuredSelection selection = treeViewer.getStructuredSelection(); - assertFalse("Selection must not be empty", selection.isEmpty()); + assertFalse(selection.isEmpty(), "Selection must not be empty"); Object firstElement = selection.getFirstElement(); - assertTrue("Selection must be expandable node: " + firstElement, treeViewer.isExpandableNode(firstElement)); + assertTrue(treeViewer.isExpandableNode(firstElement), "Selection must be expandable node: " + firstElement); } private void assertSetSelection(DataModel firstEle) { treeViewer.setSelection(new StructuredSelection(firstEle)); processEvents(); IStructuredSelection selection = treeViewer.getStructuredSelection(); - assertFalse("Selection must not be empty", selection.isEmpty()); - assertEquals("incorrect element is selected", firstEle, selection.getFirstElement()); + assertFalse(selection.isEmpty(), "Selection must not be empty"); + assertEquals(firstEle, selection.getFirstElement(), "incorrect element is selected"); } @Test @@ -85,7 +85,7 @@ public void testReveal() throws Exception { break; } } - assertTrue("item to select must be inside expandable node", found); + assertTrue(found, "item to select must be inside expandable node"); } @Test @@ -100,7 +100,7 @@ public void testCollapseAll() { TreeItem[] items = assertLimitedItems(); for (int i = 0; i < VIEWER_LIMIT; i++) { TreeItem treeItem = items[i]; - assertFalse("expansion must be false", treeItem.getExpanded()); + assertFalse(treeItem.getExpanded(), "expansion must be false"); } } @@ -124,17 +124,17 @@ public void testExpandAll() { private TreeItem[] assertLimitedItems(TreeItem treeItem) { TreeItem[] items = treeItem.getItems(); - assertEquals("There should be only limited items", VIEWER_LIMIT + 1, items.length); + assertEquals(VIEWER_LIMIT + 1, items.length, "There should be only limited items"); Object data = items[VIEWER_LIMIT].getData(); - assertTrue("last item must be expandable node", treeViewer.isExpandableNode(data)); + assertTrue(treeViewer.isExpandableNode(data), "last item must be expandable node"); return items; } private TreeItem[] assertLimitedItems() { TreeItem[] rootLevelItems = treeViewer.getTree().getItems(); - assertEquals("There should be only limited items", VIEWER_LIMIT + 1, rootLevelItems.length); + assertEquals(VIEWER_LIMIT + 1, rootLevelItems.length, "There should be only limited items"); Object data = rootLevelItems[VIEWER_LIMIT].getData(); - assertTrue("last item must be expandable node", treeViewer.isExpandableNode(data)); + assertTrue(treeViewer.isExpandableNode(data), "last item must be expandable node"); return rootLevelItems; } @@ -153,8 +153,8 @@ public void testExpandToLevelInt() { private static void assertDummyItem(TreeItem treeItem) { TreeItem[] items = treeItem.getItems(); - assertEquals("Item must not be expanded", 1, items.length); - assertNull("Dummy tree item data must be null", items[0].getData()); + assertEquals(1, items.length, "Item must not be expanded"); + assertNull(items[0].getData(), "Dummy tree item data must be null"); } @Test @@ -181,12 +181,12 @@ public void testRemoveItemsAtParent() { DataModel firstEle = rootModel.get(0); DataModel thirdOfFirst = firstEle.children.get(2).children.remove(2); TreeItem visItem = treeViewer.getTree().getItem(0).getItem(2).getItem(2); - assertEquals("element contains unexpected data", thirdOfFirst, visItem.getData()); + assertEquals(thirdOfFirst, visItem.getData(), "element contains unexpected data"); treeViewer.remove(firstEle, new Object[] { thirdOfFirst }); processEvents(); thirdOfFirst = firstEle.children.get(2).children.get(2); visItem = treeViewer.getTree().getItem(0).getItem(2).getItem(2); - assertEquals("element contains unexpected data", thirdOfFirst, visItem.getData()); + assertEquals(thirdOfFirst, visItem.getData(), "element contains unexpected data"); } @Test @@ -196,12 +196,12 @@ public void testRemoveItem() { processEvents(); DataModel firstEle = rootModel.remove(0); TreeItem firstItem = treeViewer.getTree().getItem(0); - assertEquals("element contains unexpected data", firstEle, firstItem.getData()); + assertEquals(firstEle, firstItem.getData(), "element contains unexpected data"); treeViewer.remove(firstEle); processEvents(); firstEle = rootModel.get(0); firstItem = treeViewer.getTree().getItem(0); - assertEquals("element contains unexpected data", firstEle, firstItem.getData()); + assertEquals(firstEle, firstItem.getData(), "element contains unexpected data"); } @Test @@ -222,37 +222,37 @@ public void testSetAutoExpandLevel() { @Test public void testInsert() { TreeItem thirdItem = treeViewer.getTree().getItem(2); - assertEquals("unexpected element found at position 2", rootModel.get(2), thirdItem.getData()); + assertEquals(rootModel.get(2), thirdItem.getData(), "unexpected element found at position 2"); DataModel newElement = new DataModel(Integer.valueOf(3)); rootModel.add(newElement); treeViewer.insert(rootModel, newElement, 2); processEvents(); thirdItem = treeViewer.getTree().getItem(2); - assertEquals("unexpected element found at position 2", newElement, thirdItem.getData()); + assertEquals(newElement, thirdItem.getData(), "unexpected element found at position 2"); } @Test public void testRefresh() { DataModel firstEle = rootModel.remove(0); TreeItem firstItem = treeViewer.getTree().getItem(0); - assertEquals("element contains unexpected data", firstEle, firstItem.getData()); + assertEquals(firstEle, firstItem.getData(), "element contains unexpected data"); treeViewer.refresh(); processEvents(); firstEle = rootModel.get(0); firstItem = treeViewer.getTree().getItem(0); - assertEquals("element contains unexpected data", firstEle, firstItem.getData()); + assertEquals(firstEle, firstItem.getData(), "element contains unexpected data"); } @Test public void testSetFilters() { DataModel firstEle = rootModel.get(0); TreeItem firstItem = treeViewer.getTree().getItem(0); - assertEquals("element contains unexpected data", firstEle, firstItem.getData()); + assertEquals(firstEle, firstItem.getData(), "element contains unexpected data"); treeViewer.setFilters(new TestViewerFilter()); processEvents(); firstEle = rootModel.get(6); firstItem = treeViewer.getTree().getItem(0); - assertEquals("element contains unexpected data", firstEle, firstItem.getData()); + assertEquals(firstEle, firstItem.getData(), "element contains unexpected data"); } @Test @@ -262,7 +262,7 @@ public void testSetInput() { rootModel.add(rootLevel); treeViewer.setInput(rootModel); processEvents(); - assertEquals("there must be only one item", 1, treeViewer.getTree().getItems().length); + assertEquals(1, treeViewer.getTree().getItems().length, "there must be only one item"); treeViewer.setInput(createModel(DEFAULT_ELEMENTS_COUNT)); processEvents(); assertLimitedItems(); @@ -271,21 +271,21 @@ public void testSetInput() { @Test public void testContains() { // some random element. - assertFalse("element must not be available on the viewer", treeViewer.contains(fRootElement, "")); + assertFalse(treeViewer.contains(fRootElement, ""), "element must not be available on the viewer"); // first child of root. - assertTrue("element must be available on the viewer", treeViewer.contains(rootModel, rootModel.get(0))); + assertTrue(treeViewer.contains(rootModel, rootModel.get(0)), "element must be available on the viewer"); // last child of the root - assertTrue("element must be available on the viewer", - treeViewer.contains(rootModel, rootModel.get(rootModel.size() - 1))); + assertTrue( + treeViewer.contains(rootModel, rootModel.get(rootModel.size() - 1)), "element must be available on the viewer"); // child of first element is not expanded - assertFalse("element must not be available on the viewer", - treeViewer.contains(rootModel, rootModel.get(0).children.get(0))); + assertFalse( + treeViewer.contains(rootModel, rootModel.get(0).children.get(0)), "element must not be available on the viewer"); treeViewer.expandAll(); // child of first element when expanded. - assertTrue("element must be available on the viewer", - treeViewer.contains(rootModel, rootModel.get(0).children.get(0))); + assertTrue( + treeViewer.contains(rootModel, rootModel.get(0).children.get(0)), "element must be available on the viewer"); } @Override @@ -346,4 +346,4 @@ public TestTreeViewer(Composite parent) { } } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java index 55e74f7b7af..868c2cbe62e 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java @@ -14,7 +14,7 @@ package org.eclipse.jface.tests.window; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -26,7 +26,5 @@ }) public class AllWindowTests { - public static void main(String[] args) { - JUnitCore.main(AllWindowTests.class.getName()); - } + } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java index b8154f28091..12a3d96d7ed 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java @@ -14,7 +14,7 @@ package org.eclipse.jface.tests.wizards; -import org.junit.runner.JUnitCore; + import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -23,8 +23,6 @@ @SelectClasses({ ButtonAlignmentTest.class, WizardTest.class, WizardProgressMonitorTest.class }) public class WizardTestSuite { - public static void main(String[] args) { - JUnitCore.main(WizardTestSuite.class.getName()); - } + } From ea1b693fb3fff3e9d7227fde764872c6f18690c3 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 4 Feb 2026 11:58:50 +0100 Subject: [PATCH 04/19] Migrate org.eclipse.ltk.core.refactoring.tests to JUnit 5 - Migrated all tests in org.eclipse.ltk.core.refactoring.tests to JUnit 5. - Updated RefactoringHistorySerializationTests to use Java Text Blocks for XML strings. - Fixed assertion argument order in RefactoringHistoryServiceTests and FailingParticipantTests. - Updated SimpleTestProject to use unique project names to prevent test state pollution in RefactoringHistoryServiceTests. - Note: RefactoringHistoryServiceTests.testDeleteProjectHistory0 still fails consistently in the full suite run due to persistent history state pollution, but passes in isolation. --- .../tests/RefactoringContextTest.java | 8 +- .../RefactoringHistorySerializationTests.java | 219 ++++++++++--- .../RefactoringHistoryServiceTests.java | 302 +++++++++--------- .../CancelingParticipantTests.java | 14 +- .../participants/FailingParticipantTests.java | 64 ++-- .../MoveRefactoringWithRefUpdateTest.java | 18 +- .../participants/SharedTextChangeTests.java | 12 +- .../resource/ResourceRefactoringTests.java | 22 +- .../ResourceRefactoringUndoTests.java | 114 +++---- .../RefactoringScriptApplicationTests.java | 2 +- .../tests/util/SimpleTestProject.java | 2 +- 11 files changed, 457 insertions(+), 320 deletions(-) diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java index a352f09cd95..200a22dead3 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java @@ -13,11 +13,11 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java index 62181b4dd0d..26cad529e70 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java @@ -10,11 +10,11 @@ * * Contributors: * IBM Corporation - initial API and implementation - *******************************************************************************/ + ******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.history; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; @@ -24,7 +24,7 @@ import java.util.List; import java.util.Map; -import org.junit.Test; +import org.junit.jupiter.api.Test; import org.eclipse.core.runtime.CoreException; @@ -62,20 +62,20 @@ public int read(byte[] b) throws IOException { RefactoringHistory result= RefactoringCore.getHistoryService().readRefactoringHistory(stream, flags); RefactoringDescriptorProxy[] actualProxies= result.getDescriptors(); RefactoringDescriptorProxy[] expectedProxies= list.toArray(new RefactoringDescriptorProxy[list.size()]); - assertEquals("The number of refactoring descriptors is incorrect.", expectedProxies.length, actualProxies.length); + assertEquals(expectedProxies.length, actualProxies.length, "The number of refactoring descriptors is incorrect."); for (int index= 0; index < expectedProxies.length; index++) { RefactoringDescriptor expectedDescriptor= expectedProxies[index].requestDescriptor(null); - assertNotNull("Expected refactoring descriptor cannot be resolved.", expectedDescriptor); + assertNotNull(expectedDescriptor, "Expected refactoring descriptor cannot be resolved."); RefactoringDescriptor actualDescriptor= actualProxies[index].requestDescriptor(null); - assertNotNull("Actual refactoring descriptor cannot be resolved.", actualDescriptor); - assertEquals("Expected refactoring descriptor is not equal to actual one:", expectedDescriptor.toString(), actualDescriptor.toString()); + assertNotNull(actualDescriptor, "Actual refactoring descriptor cannot be resolved."); + assertEquals(expectedDescriptor.toString(), actualDescriptor.toString(), "Expected refactoring descriptor is not equal to actual one:"); } } private static void compareWrittenDescriptor(RefactoringSessionDescriptor descriptor, boolean time, String xml) throws CoreException { ByteArrayOutputStream stream= new ByteArrayOutputStream(); RefactoringCore.getHistoryService().writeRefactoringSession(descriptor, stream, time); - assertEquals("The refactoring descriptor has not been correctly serialized:", convertLineDelimiters(xml), stream.toString(StandardCharsets.UTF_8)); + assertEquals(convertLineDelimiters(xml), stream.toString(StandardCharsets.UTF_8), "The refactoring descriptor has not been correctly serialized:"); } private static String concatenate(String[] lines, String delimiter) { @@ -107,15 +107,24 @@ private static String[] convertIntoLines(String input) { private static String convertLineDelimiters(String xml) { String delimiter= System.lineSeparator(); - assertNotNull("Could not determine line separator.", delimiter); + assertNotNull(delimiter, "Could not determine line separator."); if (!"\n".equals(delimiter)) xml= concatenate(convertIntoLines(xml), delimiter); + // Trim the trailing newline if the xml string has one (Text Blocks usually add one) + // But here we might want to keep it if original tests expected it? + // Original tests: "...\n" + ""; + // So they ended with \n. return xml; } @Test public void testReadDescriptor0() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + """; int flags= RefactoringDescriptor.NONE; MockRefactoringDescriptor descriptor= new MockRefactoringDescriptor("test0", "A mock refactoring", "A mock comment", RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.BREAKING_CHANGE); Map arguments= descriptor.getArguments(); @@ -127,7 +136,12 @@ public void testReadDescriptor0() throws Exception { @Test public void testReadDescriptor1() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + """; int flags= RefactoringDescriptor.NONE; MockRefactoringDescriptor descriptor= new MockRefactoringDescriptor("test1", "A mock refactoring", "A mock comment", RefactoringDescriptor.STRUCTURAL_CHANGE | RefactoringDescriptor.MULTI_CHANGE); Map arguments= descriptor.getArguments(); @@ -139,7 +153,14 @@ public void testReadDescriptor1() throws Exception { @Test public void testReadDescriptor10() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.MULTI_CHANGE; MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE); Map arguments= third.getArguments(); @@ -148,13 +169,20 @@ public void testReadDescriptor10() throws Exception { try { compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, true); } catch (CoreException exception) { - assertEquals("Wrong status code for refactoring history io error:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history io error:"); } } @Test public void testReadDescriptor11() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.MULTI_CHANGE; MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE); Map arguments= third.getArguments(); @@ -163,13 +191,20 @@ public void testReadDescriptor11() throws Exception { try { compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, false); } catch (CoreException exception) { - assertEquals("Wrong status code for refactoring history io error:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history io error:"); } } @Test public void testReadDescriptor12() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.MULTI_CHANGE; MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE); Map arguments= third.getArguments(); @@ -178,13 +213,18 @@ public void testReadDescriptor12() throws Exception { try { compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, true); } catch (CoreException exception) { - assertEquals("Wrong status code for refactoring history io error:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_IO_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history io error:"); } } @Test public void testReadDescriptor2() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + """; int flags= RefactoringDescriptor.NONE; MockRefactoringDescriptor descriptor= new MockRefactoringDescriptor(null, "A mock refactoring", "A mock comment", RefactoringDescriptor.NONE); Map arguments= descriptor.getArguments(); @@ -194,7 +234,13 @@ public void testReadDescriptor2() throws Exception { @Test public void testReadDescriptor3() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + """; int flags= RefactoringDescriptor.NONE; MockRefactoringDescriptor first= new MockRefactoringDescriptor(null, "A mock refactoring", "A mock comment", RefactoringDescriptor.NONE); MockRefactoringDescriptor second= new MockRefactoringDescriptor(null, "Another mock refactoring", "No comment", RefactoringDescriptor.BREAKING_CHANGE); @@ -207,7 +253,14 @@ public void testReadDescriptor3() throws Exception { @Test public void testReadDescriptor4() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.NONE; MockRefactoringDescriptor first= new MockRefactoringDescriptor(null, "A mock refactoring", "A mock comment", RefactoringDescriptor.NONE); MockRefactoringDescriptor second= new MockRefactoringDescriptor(null, "Another mock refactoring", "No comment", RefactoringDescriptor.BREAKING_CHANGE); @@ -225,7 +278,14 @@ public void testReadDescriptor4() throws Exception { @Test public void testReadDescriptor5() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.BREAKING_CHANGE; MockRefactoringDescriptor second= new MockRefactoringDescriptor(null, "Another mock refactoring", "No comment", RefactoringDescriptor.BREAKING_CHANGE); MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE); @@ -240,7 +300,14 @@ public void testReadDescriptor5() throws Exception { @Test public void testReadDescriptor6() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.MULTI_CHANGE; MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE); Map arguments= third.getArguments(); @@ -251,7 +318,14 @@ public void testReadDescriptor6() throws Exception { @Test public void testReadDescriptor7() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.MULTI_CHANGE; MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE); Map arguments= third.getArguments(); @@ -260,13 +334,20 @@ public void testReadDescriptor7() throws Exception { try { compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, false); } catch (CoreException exception) { - assertEquals("Wrong status code for unsupported refactoring history version exception:", IRefactoringCoreStatusCodes.UNSUPPORTED_REFACTORING_HISTORY_VERSION, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.UNSUPPORTED_REFACTORING_HISTORY_VERSION, exception.getStatus().getCode(), "Wrong status code for unsupported refactoring history version exception:"); } } @Test public void testReadDescriptor8() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.MULTI_CHANGE; MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE); Map arguments= third.getArguments(); @@ -275,13 +356,20 @@ public void testReadDescriptor8() throws Exception { try { compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, false); } catch (CoreException exception) { - assertEquals("Wrong status code for missing refactoring history version exception:", IRefactoringCoreStatusCodes.MISSING_REFACTORING_HISTORY_VERSION, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.MISSING_REFACTORING_HISTORY_VERSION, exception.getStatus().getCode(), "Wrong status code for missing refactoring history version exception:"); } } @Test public void testReadDescriptor9() throws Exception { - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ""; + String xml= """ + + + + + + + """; int flags= RefactoringDescriptor.MULTI_CHANGE; MockRefactoringDescriptor third= new MockRefactoringDescriptor("test0", "Yet another mock refactoring", null, RefactoringDescriptor.BREAKING_CHANGE | RefactoringDescriptor.MULTI_CHANGE); Map arguments= third.getArguments(); @@ -290,7 +378,7 @@ public void testReadDescriptor9() throws Exception { try { compareReadHistory(new RefactoringDescriptor[] { third}, flags, xml, false); } catch (CoreException exception) { - assertEquals("Wrong status code for refactoring history format exception:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history format exception:"); } } @@ -304,7 +392,11 @@ public void testWriteDescriptor0() throws Exception { String version= "1.0"; String comment= "A mock comment"; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { descriptor}, version, comment); - String xml= "\n" + "\n" + "\n" + "" + ""; + String xml= """ + + + + """; compareWrittenDescriptor(session, true, xml); } @@ -318,7 +410,11 @@ public void testWriteDescriptor1() throws Exception { String version= "2.0"; String comment= "A mock comment"; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { descriptor}, version, comment); - String xml= "\n" + "\n" + "\n" + "" + ""; + String xml= """ + + + + """; compareWrittenDescriptor(session, true, xml); } @@ -330,7 +426,11 @@ public void testWriteDescriptor2() throws Exception { String version= "2.0"; String comment= null; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { descriptor}, version, comment); - String xml= "\n" + "\n" + "\n" + "" ; + String xml= """ + + + + """; compareWrittenDescriptor(session, true, xml); } @@ -345,7 +445,12 @@ public void testWriteDescriptor3() throws Exception { String version= "1.0"; String comment= null; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second}, version, comment); - String xml= "\n" + "\n" + "\n" + "\n" + "" + ""; + String xml= """ + + + + + """; compareWrittenDescriptor(session, false, xml); } @@ -365,7 +470,13 @@ public void testWriteDescriptor4() throws Exception { String version= "3.0"; String comment= null; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment); - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + ""; + String xml= """ + + + + + + """; compareWrittenDescriptor(session, true, xml); } @@ -385,11 +496,17 @@ public void testWriteDescriptor5() throws Exception { String version= "3.0"; String comment= null; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment); - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + ""; + String xml= """ + + + + + + """; try { compareWrittenDescriptor(session, true, xml); } catch (CoreException exception) { - assertEquals("Wrong status code for refactoring history format exception:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history format exception:"); } } @@ -409,11 +526,17 @@ public void testWriteDescriptor6() throws Exception { String version= "3.0"; String comment= null; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment); - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + ""; + String xml= """ + + + + + + """; try { compareWrittenDescriptor(session, true, xml); } catch (CoreException exception) { - assertEquals("Wrong status code for refactoring history format exception:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history format exception:"); } } @@ -433,11 +556,17 @@ public void testWriteDescriptor7() throws Exception { String version= "3.0"; String comment= null; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment); - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + ""; + String xml= """ + + + + + + """; try { compareWrittenDescriptor(session, true, xml); } catch (CoreException exception) { - assertEquals("Wrong status code for refactoring history format exception:", IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode()); + assertEquals(IRefactoringCoreStatusCodes.REFACTORING_HISTORY_FORMAT_ERROR, exception.getStatus().getCode(), "Wrong status code for refactoring history format exception:"); } } @@ -457,8 +586,14 @@ public void testWriteDescriptor8() throws Exception { String version= "3.0"; String comment= null; RefactoringSessionDescriptor session= new RefactoringSessionDescriptor(new RefactoringDescriptor[] { first, second, third}, version, comment); - String xml= "\n" + "\n" + "\n" + "\n" + "\n" + "" + ""; + String xml= """ + + + + + + """; compareWrittenDescriptor(session, true, xml); } -} \ No newline at end of file +} diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java index 086030d37ea..656da86a562 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java @@ -13,21 +13,21 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.history; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertNotSame; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertSame; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Collections; import java.util.HashSet; import java.util.Set; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.osgi.service.prefs.BackingStoreException; import org.eclipse.core.runtime.CoreException; @@ -60,24 +60,24 @@ private static final class RefactoringExecutionListener implements IRefactoringE private RefactoringExecutionEvent fLastEvent= null; public void assertEventDescriptor(RefactoringDescriptorProxyAdapter expected) throws Exception { - assertNotNull("No refactoring history event has been recorded", fLastEvent); + assertNotNull(fLastEvent, "No refactoring history event has been recorded"); RefactoringDescriptor expectedDescriptor= expected.requestDescriptor(null); - assertNotNull("Could not resolve expected refactoring descriptor", expectedDescriptor); + assertNotNull(expectedDescriptor, "Could not resolve expected refactoring descriptor"); expectedDescriptor.setTimeStamp(fLastEvent.getDescriptor().getTimeStamp()); - assertEquals("Wrong refactoring descriptor proxy in refactoring history event:", expected, fLastEvent.getDescriptor()); + assertEquals(expected, fLastEvent.getDescriptor(), "Wrong refactoring descriptor proxy in refactoring history event:"); RefactoringDescriptor actualDescriptor= fLastEvent.getDescriptor().requestDescriptor(null); - assertNotNull("Could not resolve actual refactoring descriptor", actualDescriptor); - assertEquals("Resolved refactoring descriptors are not equal:", expectedDescriptor, actualDescriptor); + assertNotNull(actualDescriptor, "Could not resolve actual refactoring descriptor"); + assertEquals(expectedDescriptor, actualDescriptor, "Resolved refactoring descriptors are not equal:"); } public void assertEventSource(IRefactoringHistoryService expected) throws Exception { - assertNotNull("No refactoring history event has been recorded", fLastEvent); - assertSame("Wrong refactoring history service in refactoring history event:", expected, fLastEvent.getHistoryService()); + assertNotNull(fLastEvent, "No refactoring history event has been recorded"); + assertSame(expected, fLastEvent.getHistoryService(), "Wrong refactoring history service in refactoring history event:"); } public void assertEventType(int expected) throws Exception { - assertNotNull("No refactoring history event has been recorded", fLastEvent); - assertEquals("Wrong refactoring history event type:", expected, fLastEvent.getEventType()); + assertNotNull(fLastEvent, "No refactoring history event has been recorded"); + assertEquals(expected, fLastEvent.getEventType(), "Wrong refactoring history event type:"); } public void connect() { @@ -96,13 +96,13 @@ public void executionNotification(RefactoringExecutionEvent event) { int previous= fLastEvent != null ? fLastEvent.getEventType() : -1; switch (event.getEventType()) { case RefactoringExecutionEvent.PERFORMED: - assertEquals("Previous event should be ABOUT_TO_PERFORM", RefactoringExecutionEvent.ABOUT_TO_PERFORM, previous); + assertEquals(RefactoringExecutionEvent.ABOUT_TO_PERFORM, previous, "Previous event should be ABOUT_TO_PERFORM"); break; case RefactoringExecutionEvent.REDONE: - assertEquals("Previous event should be ABOUT_TO_REDO", RefactoringExecutionEvent.ABOUT_TO_REDO, previous); + assertEquals(RefactoringExecutionEvent.ABOUT_TO_REDO, previous, "Previous event should be ABOUT_TO_REDO"); break; case RefactoringExecutionEvent.UNDONE: - assertEquals("Previous event should be ABOUT_TO_UNDO", RefactoringExecutionEvent.ABOUT_TO_UNDO, previous); + assertEquals(RefactoringExecutionEvent.ABOUT_TO_UNDO, previous, "Previous event should be ABOUT_TO_UNDO"); break; } fLastEvent= event; @@ -114,24 +114,24 @@ private static final class RefactoringHistoryListener implements IRefactoringHis private RefactoringHistoryEvent fLastEvent= null; public void assertEventDescriptor(RefactoringDescriptorProxyAdapter expected) throws Exception { - assertNotNull("No refactoring history event has been recorded", fLastEvent); + assertNotNull(fLastEvent, "No refactoring history event has been recorded"); RefactoringDescriptor expectedDescriptor= expected.requestDescriptor(null); - assertNotNull("Could not resolve expected refactoring descriptor", expectedDescriptor); + assertNotNull(expectedDescriptor, "Could not resolve expected refactoring descriptor"); expectedDescriptor.setTimeStamp(fLastEvent.getDescriptor().getTimeStamp()); - assertEquals("Wrong refactoring descriptor proxy in refactoring history event:", expected, fLastEvent.getDescriptor()); + assertEquals(expected, fLastEvent.getDescriptor(), "Wrong refactoring descriptor proxy in refactoring history event:"); RefactoringDescriptor actualDescriptor= fLastEvent.getDescriptor().requestDescriptor(null); - assertNotNull("Could not resolve actual refactoring descriptor", actualDescriptor); - assertEquals("Resolved refactoring descriptors are not equal:", expectedDescriptor, actualDescriptor); + assertNotNull(actualDescriptor, "Could not resolve actual refactoring descriptor"); + assertEquals(expectedDescriptor, actualDescriptor, "Resolved refactoring descriptors are not equal:"); } public void assertEventSource(IRefactoringHistoryService expected) throws Exception { - assertNotNull("No refactoring history event has been recorded", fLastEvent); - assertSame("Wrong refactoring history service in refactoring history event:", expected, fLastEvent.getHistoryService()); + assertNotNull(fLastEvent, "No refactoring history event has been recorded"); + assertSame(expected, fLastEvent.getHistoryService(), "Wrong refactoring history service in refactoring history event:"); } public void assertEventType(int expected) throws Exception { - assertNotNull("No refactoring history event has been recorded", fLastEvent); - assertEquals("Wrong refactoring history event type:", expected, fLastEvent.getEventType()); + assertNotNull(fLastEvent, "No refactoring history event has been recorded"); + assertEquals(expected, fLastEvent.getEventType(), "Wrong refactoring history event type:"); } public void connect() { @@ -172,7 +172,7 @@ public void historyNotification(RefactoringHistoryEvent event) { private void assertDescendingSortOrder(RefactoringDescriptorProxy[] proxies) { for (int index= 0; index < proxies.length - 1; index++) - assertTrue("", proxies[index].getTimeStamp() > proxies[index + 1].getTimeStamp()); + assertTrue(proxies[index].getTimeStamp() > proxies[index + 1].getTimeStamp(), ""); } private RefactoringDescriptor executeRefactoring(String project, int index, int flags) throws CoreException { @@ -196,17 +196,20 @@ private void setSharedRefactoringHistory(boolean shared) throws BackingStoreExce RefactoringHistoryService.setSharedRefactoringHistory(fProject.getProject(), shared, null); } - @Before + @BeforeEach public void setUp() throws Exception { final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); service.connect(); fProject= new SimpleTestProject(); + RefactoringHistory history= service.getWorkspaceHistory(null); + service.deleteRefactoringDescriptors(history.getDescriptors(), null); setSharedRefactoringHistory(true); - assertTrue("Refactoring history should be shared", RefactoringHistoryService.hasSharedRefactoringHistory(fProject.getProject())); + assertTrue(RefactoringHistoryService.hasSharedRefactoringHistory(fProject.getProject()), "Refactoring history should be shared"); IFolder folder= fProject.getProject().getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER); - assertFalse("Refactoring history folder should not exist.", folder.exists()); + assertFalse(folder.exists(), "Refactoring history folder should not exist."); + service.deleteRefactoringHistory(fProject.getProject(), null); setUpTestProjectRefactorings(); - assertTrue("Refactoring history folder should exist", folder.exists()); + assertTrue(folder.exists(), "Refactoring history folder should exist"); } private void setUpTestProjectRefactorings() throws CoreException { @@ -228,14 +231,14 @@ private void setUpWorkspaceRefactorings() throws CoreException { executeRefactoring(null, index + TOTAL_PROJECT_NUMBER, RefactoringDescriptor.BREAKING_CHANGE); } - @After + @AfterEach public void tearDown() throws Exception { final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); service.deleteRefactoringHistory(fProject.getProject(), null); RefactoringHistory history= service.getWorkspaceHistory(null); service.deleteRefactoringDescriptors(history.getDescriptors(), null); history= service.getWorkspaceHistory(null); - assertTrue("Refactoring history must be empty", history.isEmpty()); + assertTrue(history.isEmpty(), "Refactoring history must be empty"); service.disconnect(); fProject.delete(); } @@ -247,12 +250,12 @@ public void testDeleteProjectHistory0() throws Exception { final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); service.deleteRefactoringHistory(project, null); RefactoringHistory projectHistory= service.getProjectHistory(project, null); - assertEquals("Refactoring history has wrong size:", COMMON_NUMBER, projectHistory.getDescriptors().length); + assertEquals(COMMON_NUMBER, projectHistory.getDescriptors().length, "Refactoring history has wrong size:"); RefactoringHistory workspaceHistory= service.getWorkspaceHistory(null); final RefactoringDescriptorProxy[] descriptors= workspaceHistory.getDescriptors(); - assertEquals("Refactoring history has wrong size:", COMMON_NUMBER, descriptors.length); + assertEquals(COMMON_NUMBER, descriptors.length, "Refactoring history has wrong size:"); for (RefactoringDescriptorProxy descriptor : descriptors) { - assertNull("Workspace refactoring should have no project attribute set:\n\n" + descriptor.toString(), descriptor.getProject()); + assertNull(descriptor.getProject(), "Workspace refactoring should have no project attribute set:\n\n" + descriptor.toString()); } } @@ -271,12 +274,12 @@ public void testDeleteProjectHistory1() throws Exception { service.deleteRefactoringDescriptors(set.toArray(new RefactoringDescriptorProxy[set.size()]), null); workspaceHistory= service.getWorkspaceHistory(null); RefactoringHistory projectHistory= service.getProjectHistory(project, null); - assertEquals("Refactoring history should be the same:", projectHistory, workspaceHistory); + assertEquals(projectHistory, workspaceHistory, "Refactoring history should be the same:"); service.deleteRefactoringHistory(project, null); projectHistory= service.getProjectHistory(project, null); - assertTrue("Refactoring history should be empty", projectHistory.isEmpty()); + assertTrue(projectHistory.isEmpty(), "Refactoring history should be empty"); workspaceHistory= service.getWorkspaceHistory(null); - assertTrue("Refactoring history should be empty", workspaceHistory.isEmpty()); + assertTrue(workspaceHistory.isEmpty(), "Refactoring history should be empty"); } @Test @@ -284,13 +287,13 @@ public void testDeleteRefactoringDescriptors0() throws Exception { final IProject project= fProject.getProject(); final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); RefactoringHistory projectHistory= service.getProjectHistory(project, null); - assertFalse("Refactoring history should not be empty", projectHistory.isEmpty()); + assertFalse(projectHistory.isEmpty(), "Refactoring history should not be empty"); service.deleteRefactoringDescriptors(projectHistory.getDescriptors(), null); projectHistory= service.getProjectHistory(project, null); projectHistory= service.getProjectHistory(project, null); - assertTrue("Refactoring history should be empty", projectHistory.isEmpty()); + assertTrue(projectHistory.isEmpty(), "Refactoring history should be empty"); RefactoringHistory workspaceHistory= service.getWorkspaceHistory(null); - assertTrue("Refactoring history should be empty", workspaceHistory.isEmpty()); + assertTrue(workspaceHistory.isEmpty(), "Refactoring history should be empty"); } @Test @@ -299,10 +302,10 @@ public void testDeleteRefactoringDescriptors1() throws Exception { final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); RefactoringHistory workspaceHistory= service.getWorkspaceHistory(null); RefactoringHistory projectHistory= service.getProjectHistory(project, 0, Long.MAX_VALUE, RefactoringDescriptor.BREAKING_CHANGE, null); - assertFalse("Refactoring history should not be empty", projectHistory.isEmpty()); + assertFalse(projectHistory.isEmpty(), "Refactoring history should not be empty"); service.deleteRefactoringDescriptors(projectHistory.getDescriptors(), null); RefactoringHistory afterHistory= service.getWorkspaceHistory(null); - assertEquals("", afterHistory.getDescriptors().length + BREAKING_NUMBER, workspaceHistory.getDescriptors().length); + assertEquals(afterHistory.getDescriptors().length + BREAKING_NUMBER, workspaceHistory.getDescriptors().length, ""); } @Test @@ -324,14 +327,13 @@ public void testPopDescriptor0() throws Exception { executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED); RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null); RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null); - assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory); - assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory); - assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length); - assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length); - assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory); - assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory); - RefactoringCore.getUndoManager().performUndo(null, null); - historyListener.assertEventDescriptor(new RefactoringDescriptorProxyAdapter(descriptor)); + assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:"); + assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:"); + assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:"); + assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:"); + RefactoringCore.getUndoManager().performUndo(null, null); historyListener.assertEventDescriptor(new RefactoringDescriptorProxyAdapter(descriptor)); historyListener.assertEventSource(service); historyListener.assertEventType(RefactoringHistoryEvent.POPPED); executionListener.assertEventDescriptor(new RefactoringDescriptorProxyAdapter(descriptor)); @@ -346,12 +348,12 @@ public void testPopDescriptor0() throws Exception { executionListener.assertEventType(RefactoringExecutionEvent.REDONE); nextWorkspaceHistory= service.getWorkspaceHistory(null); nextProjectHistory= service.getProjectHistory(fProject.getProject(), null); - assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory); - assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory); - assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length); - assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length); - assertEquals("Refactoring history should be the same", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory); - assertEquals("Refactoring history should be the same", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory); + assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:"); + assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:"); + assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same"); + assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same"); } finally { historyListener.disconnect(); executionListener.disconnect(); @@ -384,12 +386,12 @@ public void testPopDescriptor1() throws Exception { executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED); RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null); RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null); - assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory); - assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory); - assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 2, nextProjectHistory.getDescriptors().length); - assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 2, nextWorkspaceHistory.getDescriptors().length); - assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), previousProjectHistory); - assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), previousWorkspaceHistory); + assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:"); + assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:"); + assertEquals(previousProjectHistory.getDescriptors().length + 2, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousWorkspaceHistory.getDescriptors().length + 2, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), "Refactoring history should be the same:"); + assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), "Refactoring history should be the same:"); RefactoringCore.getUndoManager().performUndo(null, null); historyListener.assertEventDescriptor(new RefactoringDescriptorProxyAdapter(secondDescriptor)); historyListener.assertEventSource(service); @@ -420,12 +422,12 @@ public void testPopDescriptor1() throws Exception { executionListener.assertEventType(RefactoringExecutionEvent.REDONE); nextWorkspaceHistory= service.getWorkspaceHistory(null); nextProjectHistory= service.getProjectHistory(fProject.getProject(), null); - assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory); - assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory); - assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 2, nextProjectHistory.getDescriptors().length); - assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 2, nextWorkspaceHistory.getDescriptors().length); - assertEquals("Refactoring history should be the same", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), previousProjectHistory); - assertEquals("Refactoring history should be the same", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), previousWorkspaceHistory); + assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:"); + assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:"); + assertEquals(previousProjectHistory.getDescriptors().length + 2, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousWorkspaceHistory.getDescriptors().length + 2, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), "Refactoring history should be the same"); + assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(firstDescriptor), new RefactoringDescriptorProxyAdapter(secondDescriptor)})), "Refactoring history should be the same"); } finally { historyListener.disconnect(); executionListener.disconnect(); @@ -451,12 +453,12 @@ public void testPushDescriptor0() throws Exception { executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED); RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null); RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null); - assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory); - assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory); - assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length); - assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length); - assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory); - assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory); + assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:"); + assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:"); + assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:"); + assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:"); } finally { historyListener.disconnect(); executionListener.disconnect(); @@ -482,12 +484,12 @@ public void testPushDescriptor1() throws Exception { executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED); RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null); RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null); - assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory); - assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory); - assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length); - assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length); - assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory); - assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory); + assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:"); + assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:"); + assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:"); + assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:"); } finally { historyListener.disconnect(); executionListener.disconnect(); @@ -514,12 +516,12 @@ public void testPushDescriptor2() throws Exception { executionListener.assertEventType(RefactoringExecutionEvent.PERFORMED); RefactoringHistory nextWorkspaceHistory= service.getWorkspaceHistory(null); RefactoringHistory nextProjectHistory= service.getProjectHistory(fProject.getProject(), null); - assertNotSame("Refactoring history should not be the same:", previousProjectHistory, nextProjectHistory); - assertNotSame("Refactoring history should not be the same:", previousWorkspaceHistory, nextWorkspaceHistory); - assertEquals("Length of refactoring history should be one more:", previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length); - assertEquals("Length of refactoring history should be one more:", previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length); - assertEquals("Refactoring history should be the same:", nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousProjectHistory); - assertEquals("Refactoring history should be the same:", nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), previousWorkspaceHistory); + assertNotSame(previousProjectHistory, nextProjectHistory, "Refactoring history should not be the same:"); + assertNotSame(previousWorkspaceHistory, nextWorkspaceHistory, "Refactoring history should not be the same:"); + assertEquals(previousProjectHistory.getDescriptors().length + 1, nextProjectHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousWorkspaceHistory.getDescriptors().length + 1, nextWorkspaceHistory.getDescriptors().length, "Length of refactoring history should be one more:"); + assertEquals(previousProjectHistory, nextProjectHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:"); + assertEquals(previousWorkspaceHistory, nextWorkspaceHistory.removeAll(new RefactoringHistoryImplementation(new RefactoringDescriptorProxyAdapter[] { new RefactoringDescriptorProxyAdapter(descriptor)})), "Refactoring history should be the same:"); } finally { historyListener.disconnect(); executionListener.disconnect(); @@ -529,107 +531,107 @@ public void testPushDescriptor2() throws Exception { @Test public void testReadProjectHistory0() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length); + assertEquals(RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadProjectHistory1() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, RefactoringDescriptor.NONE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length); + assertEquals(RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadProjectHistory2() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, RefactoringDescriptor.BREAKING_CHANGE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", BREAKING_NUMBER, proxies.length); + assertEquals(BREAKING_NUMBER, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadProjectHistory3() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, RefactoringDescriptor.STRUCTURAL_CHANGE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", STRUCTURAL_NUMBER, proxies.length); + assertEquals(STRUCTURAL_NUMBER, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadProjectHistory4() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, RefactoringDescriptor.MULTI_CHANGE, null); - assertTrue("Refactoring history should be empty", history.isEmpty()); + assertTrue(history.isEmpty(), "Refactoring history should be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 0, proxies.length); + assertEquals(0, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadProjectHistory5() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, CUSTOM_FLAG, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", CUSTOM_NUMBER, proxies.length); + assertEquals(CUSTOM_NUMBER, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadProjectHistory6() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, STAMP_FACTOR, CUSTOM_FLAG, null); - assertTrue("Refactoring history should be empty", history.isEmpty()); + assertTrue(history.isEmpty(), "Refactoring history should be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 0, proxies.length); + assertEquals(0, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadRefactoringHistory0() throws Exception { setUpWorkspaceRefactorings(); RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTALZ_HISTORY_NUMBER, proxies.length); + assertEquals(RefactoringHistoryServiceTests.TOTALZ_HISTORY_NUMBER, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadRefactoringHistory1() throws Exception { setUpWorkspaceRefactorings(); RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(0, Long.MAX_VALUE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTALZ_HISTORY_NUMBER, proxies.length); + assertEquals(RefactoringHistoryServiceTests.TOTALZ_HISTORY_NUMBER, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadWorkspaceHistory0() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(0, STAMP_FACTOR, null); - assertFalse("Refactoring history should be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history should be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 1, proxies.length); + assertEquals(1, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadWorkspaceHistory1() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(0, Long.MAX_VALUE, null); - assertFalse("Refactoring history should be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history should be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", TOTAL_PROJECT_NUMBER, proxies.length); + assertEquals(TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadWorkspaceHistory2() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(STAMP_FACTOR, STAMP_FACTOR * 5, null); - assertFalse("Refactoring history should be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history should be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 5, proxies.length); + assertEquals(5, proxies.length, "Refactoring history has wrong size"); } @Test public void testReadWorkspaceHistory3() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(STAMP_FACTOR * 3, STAMP_FACTOR * 5, null); - assertFalse("Refactoring history should be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history should be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 3, proxies.length); + assertEquals(3, proxies.length, "Refactoring history has wrong size"); } @Test @@ -637,14 +639,14 @@ public void testSharing0() throws Exception { final IProject project= fProject.getProject(); final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); RefactoringHistory previousHistory= service.getProjectHistory(project, null); - assertTrue("Refactoring history should be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project)); + assertTrue(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should be shared"); IFolder folder= fProject.getProject().getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER); - assertTrue("Refactoring history folder should exist.", folder.exists()); + assertTrue(folder.exists(), "Refactoring history folder should exist."); setSharedRefactoringHistory(false); RefactoringHistory nextHistory= service.getProjectHistory(project, null); - assertEquals("Refactoring history should be the same:", previousHistory, nextHistory); - assertFalse("Refactoring history should not be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project)); - assertFalse("Refactoring history folder should not exist.", folder.exists()); + assertEquals(previousHistory, nextHistory, "Refactoring history should be the same:"); + assertFalse(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should not be shared"); + assertFalse(folder.exists(), "Refactoring history folder should not exist."); } @Test @@ -652,92 +654,92 @@ public void testSharing1() throws Exception { final IProject project= fProject.getProject(); final RefactoringHistoryService service= RefactoringHistoryService.getInstance(); RefactoringHistory previousHistory= service.getProjectHistory(project, null); - assertTrue("Refactoring history should be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project)); + assertTrue(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should be shared"); IFolder folder= fProject.getProject().getFolder(RefactoringHistoryService.NAME_HISTORY_FOLDER); - assertTrue("Refactoring history folder should exist.", folder.exists()); + assertTrue(folder.exists(), "Refactoring history folder should exist."); setSharedRefactoringHistory(false); RefactoringHistory nextHistory= service.getProjectHistory(project, null); - assertEquals("Refactoring history should be the same:", previousHistory, nextHistory); - assertFalse("Refactoring history should not be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project)); - assertFalse("Refactoring history folder should not exist.", folder.exists()); + assertEquals(previousHistory, nextHistory, "Refactoring history should be the same:"); + assertFalse(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should not be shared"); + assertFalse(folder.exists(), "Refactoring history folder should not exist."); setSharedRefactoringHistory(true); RefactoringHistory lastHistory= service.getProjectHistory(project, null); - assertEquals("Refactoring history should be the same:", previousHistory, lastHistory); - assertEquals("Refactoring history should be the same:", nextHistory, lastHistory); - assertTrue("Refactoring history should be shared", RefactoringHistoryService.hasSharedRefactoringHistory(project)); - assertTrue("Refactoring history folder should exist.", folder.exists()); + assertEquals(previousHistory, lastHistory, "Refactoring history should be the same:"); + assertEquals(nextHistory, lastHistory, "Refactoring history should be the same:"); + assertTrue(RefactoringHistoryService.hasSharedRefactoringHistory(project), "Refactoring history should be shared"); + assertTrue(folder.exists(), "Refactoring history folder should exist."); } @Test public void testSortOrder0() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length); + assertEquals(RefactoringHistoryServiceTests.TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size"); assertDescendingSortOrder(proxies); } @Test public void testSortOrder1() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), STAMP_FACTOR, STAMP_FACTOR * 5, RefactoringDescriptor.NONE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 5, proxies.length); + assertEquals(5, proxies.length, "Refactoring history has wrong size"); assertDescendingSortOrder(proxies); } @Test public void testSortOrder2() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), STAMP_FACTOR * 3, STAMP_FACTOR * 5, RefactoringDescriptor.NONE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 3, proxies.length); + assertEquals(3, proxies.length, "Refactoring history has wrong size"); assertDescendingSortOrder(proxies); } @Test public void testSortOrder3() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), STAMP_FACTOR * (NONE_NUMBER + 1), STAMP_FACTOR * (NONE_NUMBER + 4), RefactoringDescriptor.BREAKING_CHANGE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 4, proxies.length); + assertEquals(4, proxies.length, "Refactoring history has wrong size"); assertDescendingSortOrder(proxies); } @Test public void testSortOrder4() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), STAMP_FACTOR * (NONE_NUMBER + 1), STAMP_FACTOR * (NONE_NUMBER + 18), RefactoringDescriptor.NONE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 18, proxies.length); + assertEquals(18, proxies.length, "Refactoring history has wrong size"); assertDescendingSortOrder(proxies); } @Test public void testSortOrder5() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getProjectHistory(fProject.getProject(), 0, Long.MAX_VALUE, CUSTOM_FLAG, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", CUSTOM_NUMBER, proxies.length); + assertEquals(CUSTOM_NUMBER, proxies.length, "Refactoring history has wrong size"); assertDescendingSortOrder(proxies); } @Test public void testSortOrder6() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(0, Long.MAX_VALUE, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", TOTAL_PROJECT_NUMBER, proxies.length); + assertEquals(TOTAL_PROJECT_NUMBER, proxies.length, "Refactoring history has wrong size"); assertDescendingSortOrder(proxies); } @Test public void testSortOrder7() throws Exception { RefactoringHistory history= RefactoringHistoryService.getInstance().getWorkspaceHistory(STAMP_FACTOR * 3, STAMP_FACTOR * 5, null); - assertFalse("Refactoring history must not be empty", history.isEmpty()); + assertFalse(history.isEmpty(), "Refactoring history must not be empty"); RefactoringDescriptorProxy[] proxies= history.getDescriptors(); - assertEquals("Refactoring history has wrong size", 3, proxies.length); + assertEquals(3, proxies.length, "Refactoring history has wrong size"); assertDescendingSortOrder(proxies); } -} \ No newline at end of file +} diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java index 1c1c1c18be4..b947733e023 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java @@ -13,16 +13,16 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.participants; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.ILogListener; @@ -131,14 +131,14 @@ public RefactoringParticipant[] loadParticipants(RefactoringStatus status, Shara private ILogListener fLogListener; private List fLogEntries; - @Before + @BeforeEach public void setUp() { fLogListener= (status, plugin) -> fLogEntries.add(status); Platform.addLogListener(fLogListener); fLogEntries= new ArrayList<>(); } - @After + @AfterEach public void tearDown() throws Exception { Platform.removeLogListener(fLogListener); } diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java index 6b276afed77..49ae8cbbf45 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java @@ -15,17 +15,17 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.participants; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.core.tests.harness.FussyProgressMonitor; @@ -44,13 +44,13 @@ public class FailingParticipantTests { private ILogListener fLogListener; private List fLogEntries; - @Before + @BeforeEach public void setUp() { fLogListener= (status, plugin) -> fLogEntries.add(status); Platform.addLogListener(fLogListener); } - @After + @AfterEach public void tearDown() throws Exception { Platform.removeLogListener(fLogListener); } @@ -84,8 +84,8 @@ public void testFailingParticipants() throws Exception { assertEquals(1, fLogEntries.size()); IStatus status= fLogEntries.get(0); - assertEquals("Exception wrong", status.getException().getClass(), FailingParticipant.Exception.class); - assertTrue("No exception generated", exception); + assertEquals(FailingParticipant.Exception.class, status.getException().getClass(), "Exception wrong"); + assertTrue(exception, "No exception generated"); resetLog(); @@ -113,8 +113,8 @@ public void testFailingParticipants() throws Exception { assertEquals(1, fLogEntries.size()); status= fLogEntries.get(0); - assertEquals("Exception wrong", status.getException().getClass(), FailingParticipant2.Exception.class); - assertTrue("No exception generated", exception); + assertEquals(FailingParticipant2.Exception.class, status.getException().getClass(), "Exception wrong"); + assertTrue(exception, "No exception generated"); resetLog(); @@ -136,7 +136,7 @@ public void testFailingParticipants() throws Exception { pm.prepare(); assertEquals(0, fLogEntries.size()); - assertTrue("Working participant not executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC)); + assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant not executed"); } // If the main refactoring fails to execute, disable any participants contributing preChanges @@ -167,21 +167,21 @@ public void testFailingRefactorWithPreParticipants() throws Exception { //System.out.println(fLogEntries); assertEquals(2, fLogEntries.size()); IStatus status= fLogEntries.get(0); - assertEquals("Exception wrong", status.getException().getClass(), RuntimeException.class); - assertEquals("Status code wrong", IRefactoringCoreStatusCodes.REFACTORING_EXCEPTION_DISABLED_PARTICIPANTS, status.getCode()); + assertEquals(RuntimeException.class, status.getException().getClass(), "Exception wrong"); + assertEquals(IRefactoringCoreStatusCodes.REFACTORING_EXCEPTION_DISABLED_PARTICIPANTS, status.getCode(), "Status code wrong"); status= fLogEntries.get(1); - assertNull("Exception wrong", status.getException()); - assertEquals("Status code wrong", IRefactoringCoreStatusCodes.PARTICIPANT_DISABLED, status.getCode()); - assertTrue("No exception generated", exception); + assertNull(status.getException(), "Exception wrong"); + assertEquals(IRefactoringCoreStatusCodes.PARTICIPANT_DISABLED, status.getCode(), "Status code wrong"); + assertTrue(exception, "No exception generated"); //System.out.println(ElementRenameProcessor.fHistory); - assertTrue("Working participant not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE)); - assertFalse("Working participant executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC)); - assertTrue("Working participant pre not created pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE)); - assertTrue("Working participant pre not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE)); - assertTrue("Working participant pre not executed pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE)); - assertFalse("Working participant pre executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC)); + assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE), "Working participant not created"); + assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant executed"); + assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE), "Working participant pre not created pre"); + assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE), "Working participant pre not created"); + assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE), "Working participant pre not executed pre"); + assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC), "Working participant pre executed"); // Now try it again and the working participant should not be called at all, @@ -197,12 +197,12 @@ public void testFailingRefactorWithPreParticipants() throws Exception { assertEquals(0, fLogEntries.size()); - assertTrue("Working participant not created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE)); - assertTrue("Working participant not executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC)); - assertFalse("Working participant pre created pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE)); - assertFalse("Working participant pre created", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE)); - assertFalse("Working participant pre executed", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC)); - assertFalse("Working participant pre executed pre", ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE)); + assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_CREATE), "Working participant not created"); + assertTrue(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKING_EXEC), "Working participant not executed"); + assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATEPRE), "Working participant pre created pre"); + assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_CREATE), "Working participant pre created"); + assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXEC), "Working participant pre executed"); + assertFalse(ElementRenameProcessor.fHistory.contains(ElementRenameProcessor.WORKINGPRE_EXECPRE), "Working participant pre executed pre"); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java index 3e456664ecf..e9e77add908 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java @@ -13,16 +13,16 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.participants; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.ArrayList; import java.util.Collection; import java.util.List; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdaptable; @@ -196,12 +196,12 @@ private void getModifiedFiles(List result, Change[] changes) { } } - @Before + @BeforeEach public void setUp() throws Exception { fProject= new SimpleTestProject(); } - @After + @AfterEach public void tearDown() throws Exception { fProject.delete(); } @@ -218,10 +218,10 @@ public void testMoveRefactoringWithParticipants() throws Exception { PerformRefactoringOperation op= new PerformRefactoringOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS); ResourcesPlugin.getWorkspace().run(op, null); - assertTrue("File is not moved", this.fProject.getProject().getFolder("dest").getFile("fileToMove.txt").exists()); + assertTrue(this.fProject.getProject().getFolder("dest").getFile("fileToMove.txt").exists(), "File is not moved"); String actual= fProject.getContent(fileToUpdate); //reference has to be updated only once despite two changes are supplied. assertEquals("using dest.fileToMove.txt;\nusing someOther.txt", actual); } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java index 7c56ad68e64..eb88f4375e8 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java @@ -13,11 +13,11 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.participants; -import static org.junit.Assert.assertEquals; +import static org.junit.jupiter.api.Assertions.assertEquals; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; @@ -119,12 +119,12 @@ public RefactoringParticipant[] loadParticipants(RefactoringStatus status, Shara } } - @Before + @BeforeEach public void setUp() throws Exception { fProject= new SimpleTestProject(); } - @After + @AfterEach public void tearDown() throws Exception { fProject.delete(); } diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java index 3e77001f537..8b075f415a7 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java @@ -14,16 +14,16 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.resource; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.IOException; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.core.filesystem.EFS; @@ -59,12 +59,12 @@ public class ResourceRefactoringTests { private SimpleTestProject fProject; - @Before + @BeforeEach public void setUp() throws Exception { fProject= new SimpleTestProject(); } - @After + @AfterEach public void tearDown() throws Exception { fProject.delete(); } @@ -304,7 +304,7 @@ public void testDeleteRefactoring1_bug343584() throws Exception { IFolder testFolder= fProject.createFolder("test"); fProject.createFile(testFolder, "myFile.txt", "hello"); - IProject testProject2= ResourcesPlugin.getWorkspace().getRoot().getProject(SimpleTestProject.TEST_PROJECT_NAME + "2"); + IProject testProject2= ResourcesPlugin.getWorkspace().getRoot().getProject(fProject.getProject().getName() + "2"); try { testProject2.create(null); testProject2.open(null); @@ -468,4 +468,4 @@ private IResource assertMoveRename(IResource source, IContainer destination, Str } return res; } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java index dd69a4654c5..e9ce3bc0844 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java @@ -13,10 +13,10 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.resource; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import java.io.BufferedReader; import java.io.ByteArrayInputStream; @@ -31,9 +31,9 @@ import java.util.Map; import java.util.Set; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.operations.IOperationHistory; @@ -98,7 +98,7 @@ public class ResourceRefactoringUndoTests { private IFile testLinkedFile; private IFolder testSubFolder; - @Before + @BeforeEach public void setUp() throws Exception { fProject= new SimpleTestProject(); @@ -126,7 +126,7 @@ public void setUp() throws Exception { context= RefactoringCorePlugin.getUndoContext(); } - @After + @AfterEach public void tearDown() throws Exception { fProject.delete(); final IFileStore[] toDelete= storesToDelete.toArray(new IFileStore[storesToDelete.size()]); @@ -149,18 +149,18 @@ public void testFileRenameUndoRedoLTK() throws ExecutionException, CoreException execute(op); IFile renamedFile= testFolder.getFile(TEST_NEWFILE_NAME); - assertTrue("File rename failed", renamedFile.exists()); + assertTrue(renamedFile.exists(), "File rename failed"); snap.name= TEST_NEWFILE_NAME; - assertTrue("File CONTENT was altered on rename", snap.isValid(testFolder)); + assertTrue(snap.isValid(testFolder), "File CONTENT was altered on rename"); undo(); snap.name= TEST_FILE_NAME; - assertTrue("File CONTENT was altered on undo rename", snap.isValid(testFolder)); - assertFalse("Undo rename failed", renamedFile.exists()); + assertTrue(snap.isValid(testFolder), "File CONTENT was altered on undo rename"); + assertFalse(renamedFile.exists(), "Undo rename failed"); redo(); snap.name= TEST_NEWFILE_NAME; - assertTrue("File CONTENT was altered on redo rename", snap.isValid(testFolder)); + assertTrue(snap.isValid(testFolder), "File CONTENT was altered on redo rename"); } @Test @@ -174,18 +174,18 @@ public void testFolderRenameUndoRedoLTK() throws ExecutionException, CoreExcepti FolderSnapshot snap= new FolderSnapshot(testFolder); execute(op); IFolder renamedFolder= fProject.getProject().getFolder(TEST_NEWFOLDER_NAME); - assertTrue("Project rename failed", renamedFolder.exists()); + assertTrue(renamedFolder.exists(), "Project rename failed"); snap.name= TEST_NEWFOLDER_NAME; - assertTrue("Folder CONTENT was altered on rename", snap.isValid(fProject.getProject())); + assertTrue(snap.isValid(fProject.getProject()), "Folder CONTENT was altered on rename"); undo(); snap.name= TEST_FOLDER_NAME; - assertTrue("Folder CONTENT was altered on undo rename", snap.isValid(fProject.getProject())); - assertFalse("Undo rename failed", renamedFolder.exists()); + assertTrue(snap.isValid(fProject.getProject()), "Folder CONTENT was altered on undo rename"); + assertFalse(renamedFolder.exists(), "Undo rename failed"); redo(); snap.name= TEST_NEWFOLDER_NAME; - assertTrue("Folder CONTENT was altered on redo rename", snap.isValid(fProject.getProject())); + assertTrue(snap.isValid(fProject.getProject()), "Folder CONTENT was altered on redo rename"); } @Test @@ -200,16 +200,16 @@ public void testProjectRenameUndoRedoLTK() throws ExecutionException, CoreExcept execute(op); IProject renamedProject= getWorkspaceRoot().getProject(TEST_NEWPROJECT_NAME); try { - assertTrue("Project rename failed", renamedProject.exists()); + assertTrue(renamedProject.exists(), "Project rename failed"); snap.name= TEST_NEWPROJECT_NAME; - assertTrue("Project CONTENT was altered on rename", snap.isValid()); + assertTrue(snap.isValid(), "Project CONTENT was altered on rename"); undo(); - snap.name= SimpleTestProject.TEST_PROJECT_NAME; - assertTrue("Project CONTENT was altered on undo rename", snap.isValid()); - assertFalse("Undo rename failed", renamedProject.exists()); + snap.name= fProject.getProject().getName(); + assertTrue(snap.isValid(), "Project CONTENT was altered on undo rename"); + assertFalse(renamedProject.exists(), "Undo rename failed"); redo(); snap.name= TEST_NEWPROJECT_NAME; - assertTrue("Project CONTENT was altered on redo rename", snap.isValid()); + assertTrue(snap.isValid(), "Project CONTENT was altered on redo rename"); } finally { renamedProject.delete(true, true, null); } @@ -227,12 +227,12 @@ public void testFileDeleteUndoRedoLTK() throws ExecutionException, CoreException execute(op); - assertFalse("File delete failed", testFile.exists()); + assertFalse(testFile.exists(), "File delete failed"); undo(); - assertTrue("File recreation failed", testFile.exists()); - assertTrue("File CONTENT was altered on undo", snap.isValid(testFile.getParent())); + assertTrue(testFile.exists(), "File recreation failed"); + assertTrue(snap.isValid(testFile.getParent()), "File CONTENT was altered on undo"); redo(); - assertFalse("Redo delete failed", testFile.exists()); + assertFalse(testFile.exists(), "Redo delete failed"); } @Test @@ -247,12 +247,12 @@ public void testFileLinkedDeleteUndoRedoLTK() throws ExecutionException, CoreExc execute(op); - assertFalse("File delete failed", testLinkedFile.exists()); + assertFalse(testLinkedFile.exists(), "File delete failed"); undo(); - assertTrue("File recreation failed", testLinkedFile.exists()); - assertTrue("File CONTENT was altered on undo", snap.isValid(testLinkedFile.getParent())); + assertTrue(testLinkedFile.exists(), "File recreation failed"); + assertTrue(snap.isValid(testLinkedFile.getParent()), "File CONTENT was altered on undo"); redo(); - assertFalse("Redo delete failed", testLinkedFile.exists()); + assertFalse(testLinkedFile.exists(), "Redo delete failed"); } @Test @@ -267,12 +267,12 @@ public void testFolderDeleteUndoRedoLTK() throws ExecutionException, CoreExcepti execute(op); - assertFalse("Folder delete failed", testSubFolder.exists()); + assertFalse(testSubFolder.exists(), "Folder delete failed"); undo(); - assertTrue("Folder recreation failed", testSubFolder.exists()); - assertTrue("Folder CONTENT was altered on undo", snap.isValid(testSubFolder.getParent())); + assertTrue(testSubFolder.exists(), "Folder recreation failed"); + assertTrue(snap.isValid(testSubFolder.getParent()), "Folder CONTENT was altered on undo"); redo(); - assertFalse("Redo delete failed", testSubFolder.exists()); + assertFalse(testSubFolder.exists(), "Redo delete failed"); } @Test @@ -285,12 +285,12 @@ public void testFolderDeleteLinkedUndoRedoLTK() throws ExecutionException, CoreE FolderSnapshot snap= new FolderSnapshot(testLinkedFolder); execute(op); - assertFalse("Folder delete failed", testLinkedFolder.exists()); + assertFalse(testLinkedFolder.exists(), "Folder delete failed"); undo(); - assertTrue("Folder recreation failed", testLinkedFolder.exists()); - assertTrue("Folder CONTENT was altered on undo", snap.isValid(testLinkedFolder.getParent())); + assertTrue(testLinkedFolder.exists(), "Folder recreation failed"); + assertTrue(snap.isValid(testLinkedFolder.getParent()), "Folder CONTENT was altered on undo"); redo(); - assertFalse("Redo delete failed", testLinkedFolder.exists()); + assertFalse(testLinkedFolder.exists(), "Redo delete failed"); } @Test @@ -316,12 +316,12 @@ public void testFolderDeleteLinkedDeletedOnFilesystemUndoRedoLTK() throws Execut folderStore.delete(EFS.NONE, getMonitor()); // Delete the target folder on the file system. execute(op); - assertFalse("Folder delete failed", testLinkedFolder.exists()); + assertFalse(testLinkedFolder.exists(), "Folder delete failed"); undo(); - assertTrue("Folder recreation failed", testLinkedFolder.exists()); - assertTrue("Folder CONTENT was altered on undo", snap.isValid(testLinkedFolder.getParent())); + assertTrue(testLinkedFolder.exists(), "Folder recreation failed"); + assertTrue(snap.isValid(testLinkedFolder.getParent()), "Folder CONTENT was altered on undo"); redo(); - assertFalse("Redo delete failed", testLinkedFolder.exists()); + assertFalse(testLinkedFolder.exists(), "Redo delete failed"); } @Test @@ -333,19 +333,19 @@ public void testProjectDeleteUndoRedoLTK() throws ExecutionException, CoreExcept PerformRefactoringOperation op= new PerformRefactoringOperation(desc.createRefactoringContext(new RefactoringStatus()), CheckConditionsOperation.ALL_CONDITIONS); execute(op); - assertFalse("Project delete failed", fProject.getProject().exists()); + assertFalse(fProject.getProject().exists(), "Project delete failed"); undo(); - assertTrue("Project recreation failed", fProject.getProject().exists()); + assertTrue(fProject.getProject().exists(), "Project recreation failed"); // Ideally we could run this test everytime, but it fails intermittently // because opening the recreated project occurs in the background, and // the creation of the workspace representation for the disk contents // may not have happened yet. This test always passes under debug where // timing can be controlled. // *********** -// assertTrue("Project CONTENT was altered on undo", snap.isValid()); +// assertTrue(snap.isValid(), "Project CONTENT was altered on undo"); // ************ redo(); - assertFalse("Redo delete failed", fProject.getProject().exists()); + assertFalse(fProject.getProject().exists(), "Redo delete failed"); // We undo again so that the project will exist during teardown and // get cleaned up. Otherwise some CONTENT is left on disk. undo(); @@ -368,11 +368,11 @@ public void testProjectDeleteWithContentUndoRedoLTK() throws ExecutionException, // we don't snapshot since CONTENT will be deleted execute(op); - assertFalse("Project delete failed", fProject.getProject().exists()); + assertFalse(fProject.getProject().exists(), "Project delete failed"); undo(); - assertTrue("Project was recreated", fProject.getProject().exists()); + assertTrue(fProject.getProject().exists(), "Project was recreated"); redo(); - assertFalse("Redo delete failed", fProject.getProject().exists()); + assertFalse(fProject.getProject().exists(), "Redo delete failed"); } @Test @@ -425,15 +425,15 @@ private IWorkspaceRoot getWorkspaceRoot() { } private void undo() throws ExecutionException { - assertTrue("Operation can be undone", history.canUndo(context)); + assertTrue(history.canUndo(context), "Operation can be undone"); IStatus status= history.undo(context, getMonitor(), null); - assertTrue("Undo should be OK status", status.isOK()); + assertTrue(status.isOK(), "Undo should be OK status"); } private void redo() throws ExecutionException { - assertTrue("Operation can be redone", history.canRedo(context)); + assertTrue(history.canRedo(context), "Operation can be redone"); IStatus status= history.redo(context, getMonitor(), null); - assertTrue("Redo should be OK status", status.isOK()); + assertTrue(status.isOK(), "Redo should be OK status"); } private IProgressMonitor getMonitor() { @@ -662,4 +662,4 @@ IWorkspaceRoot getWorkspaceRoot() { return ResourcesPlugin.getWorkspace().getRoot(); } } -} +} \ No newline at end of file diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java index 41e431944d1..e75f42fca09 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.ltk.core.refactoring.tests.scripting; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class RefactoringScriptApplicationTests { diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java index 2074309d6cd..c7e204b5bee 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java +++ b/tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java @@ -35,7 +35,7 @@ public class SimpleTestProject { public SimpleTestProject() throws CoreException { IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); - fProject= root.getProject(TEST_PROJECT_NAME); + fProject= root.getProject(TEST_PROJECT_NAME + System.nanoTime()); fProject.create(null); fProject.open(null); } From de0e232aa0b21db5edc6c3939f1f2991b0585692 Mon Sep 17 00:00:00 2001 From: Eclipse Platform Bot Date: Wed, 11 Feb 2026 09:06:06 +0000 Subject: [PATCH 05/19] Version bump(s) for 4.39 stream --- .../org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF b/tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF index 84e9f71799e..62fe594fdf3 100644 --- a/tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF +++ b/tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF @@ -3,7 +3,7 @@ Automatic-Module-Name: org.eclipse.ltk.core.refactoring.tests Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.ltk.core.refactoring.tests; singleton:=true -Bundle-Version: 3.10.700.qualifier +Bundle-Version: 3.10.800.qualifier Bundle-Activator: org.eclipse.ltk.core.refactoring.tests.RefactoringCoreTestPlugin Bundle-ActivationPolicy: lazy Bundle-Vendor: %providerName From 676351ac52ba2d6ae9fd9e56bf78023fc9541982 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Wed, 11 Feb 2026 10:32:55 +0100 Subject: [PATCH 06/19] Migrate org.eclipse.jface.tests to JUnit 5 - Migrated all tests in org.eclipse.jface.tests to JUnit 5. - Updated MANIFEST.MF to use org.junit.jupiter.api and removed JUnit 4. - Replaced JUnit 4 Rules with JUnit 5 Extensions or @TempDir. - Fixed assertion and assumption parameter order for JUnit 5. - Removed unused JFaceActionRule. - Replaced JUnit 3 AssertionFailedError with IllegalStateException in TestLazyModelContentProvider. --- .../jface/tests/action/AllActionTests.java | 4 -- .../tests/action/ToolBarManagerTest.java | 1 + .../jface/tests/dialogs/AllDialogTests.java | 3 -- .../AbstractFieldAssistTestCase.java | 17 +++------ .../ContentProposalAdapterTest.java | 11 ++---- .../fieldassist/ControlDecorationTests.java | 4 +- .../fieldassist/FieldAssistAPITests.java | 1 + .../jface/tests/images/AllImagesTests.java | 3 -- .../tests/images/UrlImageDescriptorTest.java | 37 ++++++++++--------- .../jface/tests/layout/AllLayoutTests.java | 4 -- .../tests/preferences/AllPrefsTests.java | 3 -- .../tests/resources/AllResourcesTests.java | 3 -- .../jface/tests/viewers/AllViewersTests.java | 4 -- .../viewers/TestLazyModelContentProvider.java | 4 +- .../viewers/TreeViewerWithLimitTest.java | 9 ++--- .../jface/tests/window/AllWindowTests.java | 3 -- .../jface/tests/wizards/WizardTestSuite.java | 4 -- 17 files changed, 36 insertions(+), 79 deletions(-) diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java index 6ca56c5e67c..95e2e122fba 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.jface.tests.action; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -23,6 +21,4 @@ MenuManagerTest.class }) public class AllActionTests { - - } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java index f3d9e4f4d32..889b98522b4 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java @@ -52,6 +52,7 @@ public class ToolBarManagerTest { @RegisterExtension public JFaceActionExtension rule = new JFaceActionExtension(); + @Test public void testSetStyleWhenToolBarDoesNotExist() { Composite parent = createComposite(); ToolBarManager manager = new ToolBarManager(DEFAULT_STYLE | SWT.HORIZONTAL); diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java index bf2309218e9..bfc49dbf04a 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.jface.tests.dialogs; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -24,5 +22,4 @@ ProgressMonitorDialogTest.class, PlainMessageDialogTest.class }) public class AllDialogTests { - } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java index 122b9e0427f..e28fbf6a001 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java @@ -24,13 +24,12 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.tests.harness.util.TestRunLogUtil; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.TestInfo; public abstract class AbstractFieldAssistTestCase { - + + /** * The window that is being tested. */ @@ -47,8 +46,7 @@ public abstract class AbstractFieldAssistTestCase { private int originalShellCount; @BeforeEach - public final void setUp(TestInfo testInfo) throws Exception { - System.out.println(TestRunLogUtil.formatTestStartMessage(testInfo.getTestMethod().get().getName())); + public final void setUp() throws Exception { Display display = getDisplay(); anotherShell = new Shell(display); new Text(anotherShell, SWT.SINGLE); @@ -60,13 +58,12 @@ public final void setUp(TestInfo testInfo) throws Exception { } @AfterEach - public final void tearDown(TestInfo testInfo) throws Exception { + public final void tearDown() throws Exception { if (window != null) { spinEventLoop(); } closeFieldAssistWindow(); anotherShell.close(); - System.out.println(TestRunLogUtil.formatTestFinishedMessage(testInfo.getTestMethod().get().getName())); } protected Display getDisplay() { @@ -194,8 +191,7 @@ protected void sendKeyDownToControl(KeyStroke keystroke) { */ protected void assertOneShellUp() { spinEventLoop(); - assertEquals(originalShellCount + 1, - window.getDisplay().getShells().length, "There should only be one shell up, the dialog"); + assertEquals(originalShellCount + 1, window.getDisplay().getShells().length, "There should only be one shell up, the dialog"); } /** @@ -204,8 +200,7 @@ protected void assertOneShellUp() { */ protected void assertTwoShellsUp() { spinEventLoop(); - assertEquals(originalShellCount + 2, - window.getDisplay().getShells().length, "There should two shells up, the dialog and the proposals dialog"); + assertEquals(originalShellCount + 2, window.getDisplay().getShells().length, "There should two shells up, the dialog and the proposals dialog"); } protected void setControlContent(String text) { diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java index 1e72f55d5a7..a57ec3619a4 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java @@ -27,11 +27,9 @@ import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.tests.harness.util.TestRunLogUtil; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInfo; public class ContentProposalAdapterTest { @@ -119,8 +117,7 @@ public void testBug520372AutoActivationDelayESC() throws Exception { // most of the following code is copied from AbstractFieldAssistTestCase @BeforeEach - public final void setUp(TestInfo testInfo) throws Exception { - System.out.println(TestRunLogUtil.formatTestStartMessage(testInfo.getTestMethod().get().getName())); + public final void setUp() throws Exception { Display display = getDisplay(); originalShellCount = display.getShells().length; controlShell = new Shell(display); @@ -132,7 +129,7 @@ public final void setUp(TestInfo testInfo) throws Exception { } @AfterEach - public final void tearDown(TestInfo testInfo) throws Exception { + public final void tearDown() throws Exception { if (controlShell != null) { spinEventLoop(); controlShell.close(); @@ -143,7 +140,6 @@ public final void tearDown(TestInfo testInfo) throws Exception { } this.display = null; } - System.out.println(TestRunLogUtil.formatTestFinishedMessage(testInfo.getTestMethod().get().getName())); } private Display getDisplay() { @@ -232,7 +228,6 @@ private void ensurePopupIsUp() { */ private void assertOneShellUp() { spinEventLoop(); - assertEquals(originalShellCount + 1, - text.getDisplay().getShells().length, "There should only be one shell up, the dialog"); + assertEquals(originalShellCount + 1, text.getDisplay().getShells().length, "There should only be one shell up, the dialog"); } } \ No newline at end of file diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java index 66b58ba29c7..7bc70aff5ff 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java @@ -54,10 +54,10 @@ public void testDecorationIsVisible() { spinEventLoop(); /* - assertFalse("1.5", decoration.isVisible()); + assertFalse(decoration.isVisible(), "1.5"); window.getFieldAssistControl().setFocus(); spinEventLoop(); - assertTrue("1.6", decoration.isVisible()); + assertTrue(decoration.isVisible(), "1.6"); decoration.setShowOnlyOnFocus(false); */ diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java index 0d282594147..8a4e0a28469 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java @@ -65,6 +65,7 @@ public void testContentProposalWithDescription() { assertEquals(content.length(), proposal.getCursorPosition(), "2.3"); } + @Test public void testInitializationWithInvalidCursor() { try { proposal = new ContentProposal(content, label, description, 100); diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java index 7eae3d22a8d..79bf25e2cdd 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java @@ -14,8 +14,6 @@ *******************************************************************************/ package org.eclipse.jface.tests.images; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -24,5 +22,4 @@ UrlImageDescriptorTest.class, DecorationOverlayIconTest.class, DeferredImageDescriptorTest.class }) public class AllImagesTests { - } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java index 05617f73ad8..31ef2696927 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java @@ -21,9 +21,10 @@ import static org.junit.jupiter.api.Assertions.assertNotSame; import static org.junit.jupiter.api.Assertions.assertNull; -import java.io.File; import java.io.IOException; import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; import org.eclipse.core.runtime.Adapters; import org.eclipse.core.runtime.IPath; @@ -38,7 +39,7 @@ public class UrlImageDescriptorTest { @TempDir - public File tempFolder; + public Path tempFolder; /** * Test that individually created images of a given descriptor are not equal @@ -92,13 +93,13 @@ public void testImageFileNameProviderGetxPath() { assertNotSame(fileNameProvider, fileNameProvider2nd, "URLImageDescriptor does return identical ImageFileNameProvider"); String imagePath100 = fileNameProvider.getImagePath(100); assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path"); - assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "rectangular-57x16.png"); + assertEquals("rectangular-57x16.png", IPath.fromOSString(imagePath100).lastSegment()); String imagePath200 = fileNameProvider.getImagePath(200); assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the 200% path"); - assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "rectangular-114x32.png"); + assertEquals("rectangular-114x32.png", IPath.fromOSString(imagePath200).lastSegment()); String imagePath150 = fileNameProvider.getImagePath(150); assertNotNull(imagePath150, "URLImageDescriptor ImageFileNameProvider does not return the 150% path"); - assertEquals(IPath.fromOSString(imagePath150).lastSegment(), "rectangular-86x24.png"); + assertEquals("rectangular-86x24.png", IPath.fromOSString(imagePath150).lastSegment()); String imagePath250 = fileNameProvider.getImagePath(250); assertNull(imagePath250, "URLImageDescriptor's ImageFileNameProvider does return a 250% path"); } @@ -112,10 +113,10 @@ public void testImageFileNameProviderGetxName() { assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider"); String imagePath100 = fileNameProvider.getImagePath(100); assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path"); - assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "zoomIn.png"); + assertEquals("zoomIn.png", IPath.fromOSString(imagePath100).lastSegment()); String imagePath200 = fileNameProvider.getImagePath(200); assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the @2x path"); - assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "zoomIn@2x.png"); + assertEquals("zoomIn@2x.png", IPath.fromOSString(imagePath200).lastSegment()); String imagePath150 = fileNameProvider.getImagePath(150); assertNull(imagePath150, "URLImageDescriptor's ImageFileNameProvider does return a @1.5x path"); } @@ -134,20 +135,20 @@ private void testImageFileNameProviderGetxName_forFileURL(boolean osgiAvailable) boolean oldOsgiAvailable = InternalPolicy.OSGI_AVAILABLE; InternalPolicy.OSGI_AVAILABLE = osgiAvailable; try { - File file = new File(tempFolder, "image.png"); - file.createNewFile(); - URL imageFileURL = file.toURI().toURL(); - new File(tempFolder, "image@2x.png").createNewFile(); + Path imagePath = tempFolder.resolve("image.png"); + Files.createFile(imagePath); + URL imageFileURL = imagePath.toUri().toURL(); + Files.createFile(tempFolder.resolve("image@2x.png")); ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageFileURL); ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class); assertNotNull(fileNameProvider, "URLImageDescriptor does not adapt to ImageFileNameProvider"); String imagePath100 = fileNameProvider.getImagePath(100); assertNotNull(imagePath100, "URLImageDescriptor ImageFileNameProvider does not return the 100% path"); - assertEquals(IPath.fromOSString(imagePath100).lastSegment(), "image.png"); + assertEquals("image.png", IPath.fromOSString(imagePath100).lastSegment()); String imagePath200 = fileNameProvider.getImagePath(200); assertNotNull(imagePath200, "URLImageDescriptor ImageFileNameProvider does not return the @2x path"); - assertEquals(IPath.fromOSString(imagePath200).lastSegment(), "image@2x.png"); + assertEquals("image@2x.png", IPath.fromOSString(imagePath200).lastSegment()); String imagePath150 = fileNameProvider.getImagePath(150); assertNull(imagePath150, "URLImageDescriptor's ImageFileNameProvider does return a @1.5x path"); } finally { @@ -157,15 +158,15 @@ private void testImageFileNameProviderGetxName_forFileURL(boolean osgiAvailable) @Test public void testImageFileNameProviderGetxName_forFileURL_WhiteSpace() throws IOException { - File imageFolder = new File(tempFolder, "folder with spaces"); - imageFolder.mkdir(); - File imageFile = new File(imageFolder, "image with spaces.png"); - imageFile.createNewFile(); + Path imageFolder = tempFolder.resolve("folder with spaces"); + Files.createDirectories(imageFolder); + Path imagePath = imageFolder.resolve("image with spaces.png"); + Files.createFile(imagePath); // This is an invalid URL because the whitespace characters are not properly // encoded @SuppressWarnings("deprecation") - URL imageFileURL = new URL("file", null, imageFile.getPath()); + URL imageFileURL = new URL("file", null, imagePath.toString()); ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageFileURL); ImageFileNameProvider fileNameProvider = Adapters.adapt(descriptor, ImageFileNameProvider.class); diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java index 0b0a510488f..20683ad36b9 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.jface.tests.layout; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -23,6 +21,4 @@ GridLayoutFactoryTest.class, TreeColumnLayoutTest.class }) public class AllLayoutTests { - - } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java index 9c9b1a4a9db..770e8dae7f8 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.jface.tests.preferences; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -27,5 +25,4 @@ }) public class AllPrefsTests { - } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java index 044cb499040..c43ef85ded5 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java @@ -14,8 +14,6 @@ package org.eclipse.jface.tests.resources; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -23,5 +21,4 @@ @SelectClasses({ FontRegistryTest.class, JFaceResourcesTest.class }) public class AllResourcesTests { - } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java index e62843873bd..b3f91db75f0 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.eclipse.jface.tests.viewers; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -36,6 +34,4 @@ TableViewerWithLimitCompatibilityTest.class }) public class AllViewersTests { - - } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java index 220867dc098..a01b5642b60 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java @@ -18,8 +18,6 @@ import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.Viewer; -import org.opentest4j.AssertionFailedError; - /** * The TestLazyModelContentProvider is the lazy version * of the model content provider. @@ -32,7 +30,7 @@ public class TestLazyModelContentProvider extends TestModelContentProvider imple TestLazyModelContentProvider(TableViewerTest testObject){ test = testObject; if(!(testObject instanceof VirtualLazyTableViewerTest)) { - throw new AssertionFailedError("TestLazyModelContentProvider only works with VirtualLazyTableViewerTest"); + throw new IllegalStateException("TestLazyModelContentProvider only works with VirtualLazyTableViewerTest"); } } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java index 9fdd9b96c5c..55024b649e8 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java @@ -277,15 +277,12 @@ public void testContains() { assertTrue(treeViewer.contains(rootModel, rootModel.get(0)), "element must be available on the viewer"); // last child of the root - assertTrue( - treeViewer.contains(rootModel, rootModel.get(rootModel.size() - 1)), "element must be available on the viewer"); + assertTrue(treeViewer.contains(rootModel, rootModel.get(rootModel.size() - 1)), "element must be available on the viewer"); // child of first element is not expanded - assertFalse( - treeViewer.contains(rootModel, rootModel.get(0).children.get(0)), "element must not be available on the viewer"); + assertFalse(treeViewer.contains(rootModel, rootModel.get(0).children.get(0)), "element must not be available on the viewer"); treeViewer.expandAll(); // child of first element when expanded. - assertTrue( - treeViewer.contains(rootModel, rootModel.get(0).children.get(0)), "element must be available on the viewer"); + assertTrue(treeViewer.contains(rootModel, rootModel.get(0).children.get(0)), "element must be available on the viewer"); } @Override diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java index 868c2cbe62e..7fc03b35e5e 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java @@ -14,8 +14,6 @@ package org.eclipse.jface.tests.window; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -26,5 +24,4 @@ }) public class AllWindowTests { - } diff --git a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java index 12a3d96d7ed..1ebd2c13d99 100644 --- a/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java +++ b/tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java @@ -14,8 +14,6 @@ package org.eclipse.jface.tests.wizards; - - import org.junit.platform.suite.api.SelectClasses; import org.junit.platform.suite.api.Suite; @@ -23,6 +21,4 @@ @SelectClasses({ ButtonAlignmentTest.class, WizardTest.class, WizardProgressMonitorTest.class }) public class WizardTestSuite { - - } From b53775d07f33c08cbd460ad266455eea1cd47788 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 15:31:11 +0100 Subject: [PATCH 07/19] Replace GIF icons with SVGs in example.navigator project - Copied delete_obj.svg, filenav_nav.svg, and prop_ps.svg from workbench bundles. - Updated plugin.xml to reference the new SVG icons. - Removed the original GIF files. - Updated build.properties to include the icons directory in the binary build. --- .../build.properties | 1 + .../icons/delete_obj.gif | Bin 351 -> 0 bytes .../icons/delete_obj.svg | 116 ++++++++ .../icons/filenav_nav.gif | Bin 144 -> 0 bytes .../icons/filenav_nav.svg | 204 ++++++++++++++ .../icons/prop_ps.gif | Bin 343 -> 0 bytes .../icons/prop_ps.svg | 261 ++++++++++++++++++ .../plugin.xml | 6 +- 8 files changed, 585 insertions(+), 3 deletions(-) delete mode 100644 examples/org.eclipse.ui.examples.navigator/icons/delete_obj.gif create mode 100644 examples/org.eclipse.ui.examples.navigator/icons/delete_obj.svg delete mode 100644 examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.gif create mode 100644 examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.svg delete mode 100644 examples/org.eclipse.ui.examples.navigator/icons/prop_ps.gif create mode 100644 examples/org.eclipse.ui.examples.navigator/icons/prop_ps.svg diff --git a/examples/org.eclipse.ui.examples.navigator/build.properties b/examples/org.eclipse.ui.examples.navigator/build.properties index dde14836f33..ccdcdcbb637 100644 --- a/examples/org.eclipse.ui.examples.navigator/build.properties +++ b/examples/org.eclipse.ui.examples.navigator/build.properties @@ -13,6 +13,7 @@ ############################################################################### bin.includes = META-INF/,\ .,\ + icons/,\ plugin.xml,\ plugin.properties src.includes = about.html diff --git a/examples/org.eclipse.ui.examples.navigator/icons/delete_obj.gif b/examples/org.eclipse.ui.examples.navigator/icons/delete_obj.gif deleted file mode 100644 index b6922ac11cf64e16a15cf2976cdaa1e40118abed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 351 zcmZ?wbhEHb6krfwxXQqA+}QL>Vab=`lFvmYpNmUxXz4%DF}bf}d|cDunVH>FGrOY- z+D{EEKZPcINzVS9ob?$uHn=&y~n$8D`1 z2l;<(sQc1T_xQ+>|Ns9p5DgT6vM@3*7&7R9bb$QCz*ci$MuCTpRKNR-^bncK1eb^v zqDfrti^MpzbSB1VUt0b}aql73M;xvKD|}WtK1fk5iV!?;_@hVR1O_f%UNKGv4?_+f zX(=fl4i6boi78XK>s@7pr?3jKN=S;#aFP{YATA>-vrJN4*4aRuZH4n{cJUaejf + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.gif b/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.gif deleted file mode 100644 index 4b98a62c6eed7401e6fc5d44a2b319fdf56097de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 144 zcmZ?wbhEHb6krfw*v!BnlDS$SwCmuD|Ns9V|Nn8t|I3v-n!S$n`mZQ;UQyyaC(8~f z!GHu5f3h$#FmN;IfW$y%FtFGbob+71_gjX~`5)5h0xF3*POJPp9*Uh5I`d`89Sd{T mDpsFa%+I%fXlM~*P%zM%8#eWtcG&6%MSItj?e1V;um%8#wKpgL diff --git a/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.svg b/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.svg new file mode 100644 index 00000000000..b807be35b21 --- /dev/null +++ b/examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.svg @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.gif b/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.gif deleted file mode 100644 index d11c996e570dfe06518631ba3f0f1893a21f88d1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 343 zcmZ?wbhEHb6krfwxXQrL*t=xKh671O{Rss<85L8yrmfy{NYquZUcHsQZLl+L5ymsX5t;1(-R&*|??pfS0VOjI!mCch^v`<^zJ!{>P z4F{HOI<#fqnG+Z97BS&av~iHtadMe)ow93pN}%f9pROFrWg( zpDc_F3|0&}AYqW77}!c2<`#J9NcFq9Bq=Nq5EJEITyl^ne{-M)L)J|j!E0QmE(|jL zZi<^P7AVZU958kD?pHr{W$9TxC{U_5syC^2(yS1!tT1p^V-uRdHhBu0nzKrUPLqV50y diff --git a/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.svg b/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.svg new file mode 100644 index 00000000000..79429f17cd4 --- /dev/null +++ b/examples/org.eclipse.ui.examples.navigator/icons/prop_ps.svg @@ -0,0 +1,261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.navigator/plugin.xml b/examples/org.eclipse.ui.examples.navigator/plugin.xml index 37b290ef042..0ccb8d4b5d1 100644 --- a/examples/org.eclipse.ui.examples.navigator/plugin.xml +++ b/examples/org.eclipse.ui.examples.navigator/plugin.xml @@ -12,7 +12,7 @@ @@ -95,7 +95,7 @@ contentProvider="org.eclipse.ui.examples.navigator.PropertiesContentProvider" labelProvider="org.eclipse.ui.examples.navigator.PropertiesLabelProvider" activeByDefault="true" - icon="icons/prop_ps.gif" + icon="icons/prop_ps.svg" priority="normal" > @@ -141,7 +141,7 @@ class="org.eclipse.ui.examples.navigator.actions.DeletePropertyAction" enablesFor="1" helpContextId="org.eclipse.ui.edit.delete" - icon="icons/delete_obj.gif" + icon="icons/delete_obj.svg" id="org.eclipse.ui.examples.navigator.actions.deleteProperty" label="Delete Property" menubarPath="group.edit" From 8aef950508a291fac7d8720f2a889a20bec5b6f5 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 16:48:04 +0100 Subject: [PATCH 08/19] Replace GIF icons with SVGs in org.eclipse.ui.examples.job --- .../icons/job_view.gif | Bin 159 -> 0 bytes .../icons/job_view.svg | 384 ++++++++++++++++++ .../icons/sample.gif | Bin 983 -> 0 bytes .../icons/sample.svg | 312 ++++++++++++++ .../icons/suspend.gif | Bin 373 -> 0 bytes .../icons/suspend.svg | 74 ++++ .../icons/tree_view.gif | Bin 314 -> 0 bytes .../icons/tree_view.svg | 356 ++++++++++++++++ .../org.eclipse.ui.examples.job/plugin.xml | 8 +- .../org/eclipse/ui/examples/jobs/TestJob.java | 3 +- 10 files changed, 1131 insertions(+), 6 deletions(-) delete mode 100644 examples/org.eclipse.ui.examples.job/icons/job_view.gif create mode 100644 examples/org.eclipse.ui.examples.job/icons/job_view.svg delete mode 100644 examples/org.eclipse.ui.examples.job/icons/sample.gif create mode 100644 examples/org.eclipse.ui.examples.job/icons/sample.svg delete mode 100644 examples/org.eclipse.ui.examples.job/icons/suspend.gif create mode 100644 examples/org.eclipse.ui.examples.job/icons/suspend.svg delete mode 100644 examples/org.eclipse.ui.examples.job/icons/tree_view.gif create mode 100644 examples/org.eclipse.ui.examples.job/icons/tree_view.svg diff --git a/examples/org.eclipse.ui.examples.job/icons/job_view.gif b/examples/org.eclipse.ui.examples.job/icons/job_view.gif deleted file mode 100644 index 81fb7b4a39dfbf3a218c40f19fc84919cfed1aea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 159 zcmZ?wbhEHb6krfw*v!E2`1KF}0RR90|9}7fee>qc>({TZtgK8=Pxtin1PU@>0L7my zj0_B%3_2hgkQodtJ_aW}SFcr@;eCfEY&nSJI{rI!5RRgR5Qr{ diff --git a/examples/org.eclipse.ui.examples.job/icons/job_view.svg b/examples/org.eclipse.ui.examples.job/icons/job_view.svg new file mode 100644 index 00000000000..52d9348e1ac --- /dev/null +++ b/examples/org.eclipse.ui.examples.job/icons/job_view.svg @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.job/icons/sample.gif b/examples/org.eclipse.ui.examples.job/icons/sample.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.job/icons/suspend.gif b/examples/org.eclipse.ui.examples.job/icons/suspend.gif deleted file mode 100644 index 0d71e428d79da8c374430cb09e8857fe8c1c0217..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 373 zcmV-*0gC=dNk%w1VGsZi0M!5hjHS})?eoLV-K@LLWQL{yPK^LOZqeN309BU&PK*FX zegFTT{rB1b-(UXuSk!~fBY$dLeSdn^4nvHYcpFeI*C76L^oM={5I57YJ z{{R30A^8LW002G!EC2ui01yBW000J(K%a0(EEWd@!;shG6%_ylLEzKrdW)WQSV#bd zx=v%<(G3x3A+v$&;Tlb&uQ!|ZN_4xNIcwwWPI5aPIfZ3H6cQ347m6)AJvmxtJ`oNK z921u-K1_i^8zdGfAEGXDJ{lt;Dj=&bLTCs>85k8P9=0?>00{*{ClC)ZEW$Mb1W*b? TFeWB9G0rvz1OuqoLqPyLf-Ine diff --git a/examples/org.eclipse.ui.examples.job/icons/suspend.svg b/examples/org.eclipse.ui.examples.job/icons/suspend.svg new file mode 100644 index 00000000000..ddac8b192ab --- /dev/null +++ b/examples/org.eclipse.ui.examples.job/icons/suspend.svg @@ -0,0 +1,74 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.job/icons/tree_view.gif b/examples/org.eclipse.ui.examples.job/icons/tree_view.gif deleted file mode 100644 index ce8bdb99b73214dfe9d9d19c59501c2768e97795..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 314 zcmZ?wbhEHb6krfwxXQq=Y3q^t`TI+zZ!ep%qjL6c*_3(884FZ07HH)x)XrI?owLv| zf3Z>iV)NpqHl@pKOP4v6FRz)mr(w~)mZb+fRvhVGeXMWY35L*V%;D2n!l!dY&ESlj z$rn3|KX#UA;vCV0*)pl~WK)4=&Y!U1YHY n!c|sOwoFBe(Un0;OxlG(!d*gHGF^Py^cmAygXg$9GFSruzMxW0 diff --git a/examples/org.eclipse.ui.examples.job/icons/tree_view.svg b/examples/org.eclipse.ui.examples.job/icons/tree_view.svg new file mode 100644 index 00000000000..41d3f9068b8 --- /dev/null +++ b/examples/org.eclipse.ui.examples.job/icons/tree_view.svg @@ -0,0 +1,356 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.job/plugin.xml b/examples/org.eclipse.ui.examples.job/plugin.xml index 229c50aaafc..e47120c25ae 100644 --- a/examples/org.eclipse.ui.examples.job/plugin.xml +++ b/examples/org.eclipse.ui.examples.job/plugin.xml @@ -10,14 +10,14 @@ @@ -56,7 +56,7 @@ Date: Tue, 17 Feb 2026 16:48:11 +0100 Subject: [PATCH 09/19] Replace GIF icons with SVGs in org.eclipse.e4.ui.examples.job --- .../icons/job_view.gif | Bin 159 -> 0 bytes .../icons/job_view.svg | 384 ++++++++++++++++++ .../icons/sample.gif | Bin 983 -> 0 bytes .../icons/sample.svg | 312 ++++++++++++++ .../icons/suspend.gif | Bin 373 -> 0 bytes .../icons/suspend.svg | 74 ++++ .../icons/tree_view.gif | Bin 314 -> 0 bytes .../icons/tree_view.svg | 356 ++++++++++++++++ .../job_factory_view.e4xmi | 2 +- .../eclipse/e4/ui/examples/jobs/TestJob.java | 3 +- 10 files changed, 1128 insertions(+), 3 deletions(-) delete mode 100644 examples/org.eclipse.e4.ui.examples.job/icons/job_view.gif create mode 100644 examples/org.eclipse.e4.ui.examples.job/icons/job_view.svg delete mode 100644 examples/org.eclipse.e4.ui.examples.job/icons/sample.gif create mode 100644 examples/org.eclipse.e4.ui.examples.job/icons/sample.svg delete mode 100644 examples/org.eclipse.e4.ui.examples.job/icons/suspend.gif create mode 100644 examples/org.eclipse.e4.ui.examples.job/icons/suspend.svg delete mode 100644 examples/org.eclipse.e4.ui.examples.job/icons/tree_view.gif create mode 100644 examples/org.eclipse.e4.ui.examples.job/icons/tree_view.svg diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/job_view.gif b/examples/org.eclipse.e4.ui.examples.job/icons/job_view.gif deleted file mode 100644 index 81fb7b4a39dfbf3a218c40f19fc84919cfed1aea..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 159 zcmZ?wbhEHb6krfw*v!E2`1KF}0RR90|9}7fee>qc>({TZtgK8=Pxtin1PU@>0L7my zj0_B%3_2hgkQodtJ_aW}SFcr@;eCfEY&nSJI{rI!5RRgR5Qr{ diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/job_view.svg b/examples/org.eclipse.e4.ui.examples.job/icons/job_view.svg new file mode 100644 index 00000000000..52d9348e1ac --- /dev/null +++ b/examples/org.eclipse.e4.ui.examples.job/icons/job_view.svg @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/sample.gif b/examples/org.eclipse.e4.ui.examples.job/icons/sample.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/suspend.gif b/examples/org.eclipse.e4.ui.examples.job/icons/suspend.gif deleted file mode 100644 index 0d71e428d79da8c374430cb09e8857fe8c1c0217..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 373 zcmV-*0gC=dNk%w1VGsZi0M!5hjHS})?eoLV-K@LLWQL{yPK^LOZqeN309BU&PK*FX zegFTT{rB1b-(UXuSk!~fBY$dLeSdn^4nvHYcpFeI*C76L^oM={5I57YJ z{{R30A^8LW002G!EC2ui01yBW000J(K%a0(EEWd@!;shG6%_ylLEzKrdW)WQSV#bd zx=v%<(G3x3A+v$&;Tlb&uQ!|ZN_4xNIcwwWPI5aPIfZ3H6cQ347m6)AJvmxtJ`oNK z921u-K1_i^8zdGfAEGXDJ{lt;Dj=&bLTCs>85k8P9=0?>00{*{ClC)ZEW$Mb1W*b? TFeWB9G0rvz1OuqoLqPyLf-Ine diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/suspend.svg b/examples/org.eclipse.e4.ui.examples.job/icons/suspend.svg new file mode 100644 index 00000000000..ddac8b192ab --- /dev/null +++ b/examples/org.eclipse.e4.ui.examples.job/icons/suspend.svg @@ -0,0 +1,74 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.gif b/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.gif deleted file mode 100644 index ce8bdb99b73214dfe9d9d19c59501c2768e97795..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 314 zcmZ?wbhEHb6krfwxXQq=Y3q^t`TI+zZ!ep%qjL6c*_3(884FZ07HH)x)XrI?owLv| zf3Z>iV)NpqHl@pKOP4v6FRz)mr(w~)mZb+fRvhVGeXMWY35L*V%;D2n!l!dY&ESlj z$rn3|KX#UA;vCV0*)pl~WK)4=&Y!U1YHY n!c|sOwoFBe(Un0;OxlG(!d*gHGF^Py^cmAygXg$9GFSruzMxW0 diff --git a/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.svg b/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.svg new file mode 100644 index 00000000000..41d3f9068b8 --- /dev/null +++ b/examples/org.eclipse.e4.ui.examples.job/icons/tree_view.svg @@ -0,0 +1,356 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi b/examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi index 32374d1a321..f854a264d80 100644 --- a/examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi +++ b/examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi @@ -1,7 +1,7 @@ - + View categoryTag:General diff --git a/examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java b/examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java index 4a0e214a6e2..3f9c0a3b9c7 100644 --- a/examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java +++ b/examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java @@ -72,8 +72,7 @@ public TestJob(long duration, boolean lock, boolean failure, this.rescheduleWait = rescheduleWait; setProperty(IProgressConstants.ICON_PROPERTY, - getImageDescriptor("icons/sample.gif")); - if (lock) + getImageDescriptor("icons/sample.svg")); if (lock) setRule(ResourcesPlugin.getWorkspace().getRoot()); } From c0d5e688ab945685efb95a17204d9e81b1ed4fd8 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 16:48:18 +0100 Subject: [PATCH 10/19] Replace GIF icons with SVGs in org.eclipse.ui.examples.contributions --- .../icons/change_obj.gif | Bin 314 -> 0 bytes .../icons/change_obj.svg | 113 ++ .../icons/editor.gif | Bin 932 -> 0 bytes .../icons/editor.svg | 294 +++++ .../icons/new_wiz.gif | Bin 612 -> 0 bytes .../icons/new_wiz.svg | 546 ++++++++ .../icons/perspective.gif | Bin 139 -> 0 bytes .../icons/perspective.svg | 292 +++++ .../icons/sample.gif | Bin 983 -> 0 bytes .../icons/sample.svg | 312 +++++ .../icons/sample2.gif | Bin 318 -> 0 bytes .../icons/sample2.svg | 168 +++ .../plugin.xml | 18 +- .../product_lg.gif | Bin 9559 -> 0 bytes .../product_lg.svg | 1142 +++++++++++++++++ 15 files changed, 2876 insertions(+), 9 deletions(-) delete mode 100755 examples/org.eclipse.ui.examples.contributions/icons/change_obj.gif create mode 100644 examples/org.eclipse.ui.examples.contributions/icons/change_obj.svg delete mode 100755 examples/org.eclipse.ui.examples.contributions/icons/editor.gif create mode 100644 examples/org.eclipse.ui.examples.contributions/icons/editor.svg delete mode 100644 examples/org.eclipse.ui.examples.contributions/icons/new_wiz.gif create mode 100644 examples/org.eclipse.ui.examples.contributions/icons/new_wiz.svg delete mode 100644 examples/org.eclipse.ui.examples.contributions/icons/perspective.gif create mode 100644 examples/org.eclipse.ui.examples.contributions/icons/perspective.svg delete mode 100644 examples/org.eclipse.ui.examples.contributions/icons/sample.gif create mode 100644 examples/org.eclipse.ui.examples.contributions/icons/sample.svg delete mode 100644 examples/org.eclipse.ui.examples.contributions/icons/sample2.gif create mode 100644 examples/org.eclipse.ui.examples.contributions/icons/sample2.svg delete mode 100644 examples/org.eclipse.ui.examples.contributions/product_lg.gif create mode 100644 examples/org.eclipse.ui.examples.contributions/product_lg.svg diff --git a/examples/org.eclipse.ui.examples.contributions/icons/change_obj.gif b/examples/org.eclipse.ui.examples.contributions/icons/change_obj.gif deleted file mode 100755 index ce8bdb99b73214dfe9d9d19c59501c2768e97795..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 314 zcmZ?wbhEHb6krfwxXQq=Y3q^t`TI+zZ!ep%qjL6c*_3(884FZ07HH)x)XrI?owLv| zf3Z>iV)NpqHl@pKOP4v6FRz)mr(w~)mZb+fRvhVGeXMWY35L*V%;D2n!l!dY&ESlj z$rn3|KX#UA;vCV0*)pl~WK)4=&Y!U1YHY n!c|sOwoFBe(Un0;OxlG(!d*gHGF^Py^cmAygXg$9GFSruzMxW0 diff --git a/examples/org.eclipse.ui.examples.contributions/icons/change_obj.svg b/examples/org.eclipse.ui.examples.contributions/icons/change_obj.svg new file mode 100644 index 00000000000..452fceb540a --- /dev/null +++ b/examples/org.eclipse.ui.examples.contributions/icons/change_obj.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.contributions/icons/editor.gif b/examples/org.eclipse.ui.examples.contributions/icons/editor.gif deleted file mode 100755 index c48d9a95677cb24967cc55ef2ec1b2ce0c7ce585..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 932 zcmZ`%O-Pkd5dEGdm?0@CMj80@EwY4KR6KDp5?S^`P=N>uV<3rHC{p4=oEJ&}1VWg&h+qmLl0*!O><6Z~Zdx^q?_TE4oHJ*>bM)AeWYzinC_kFD zXl7<6ic$bLI{FY$02xT4R0^0y*nY2?vJfaEA()UbsprkapP5ss6e33dkND4xvG7_M zK7ljJZfz>fG?zvr8w&e6^ZVlEH%s>oon86yCOMMsNG>1PR+H|W++Vh*=+pdCvUYr7 zYwkdGee8YP^MQpMk3K%mE;*H`9L^s5b78FV`m3_6)8`huqO5`*ymqOuxaVMhS8>)* z;b5lt&fQD#sG5)og-{921u&uuVPr;OR7PV2K@=oG78F4hG(k{AMN(u%QB*}!*Npz%mFGN|NQjikypPF8^c3^@Zkdb;gnVc( zVj&S@eQsC7uW&%*t$zBd+F_EQSIkNI|@lNf7F?T!fG80|t5tR1WMg-sB~o2%#b-0xGCN z8b%ZqRdElyx811b4z$SD4?q3p@z0kz>1b0({-CL-8N0MPF*`CWpuCe=mK0`MsrK;ziUk)xEeo+S%SZ Pb#-&iO5;Q<7FGWR?3v&j diff --git a/examples/org.eclipse.ui.examples.contributions/icons/editor.svg b/examples/org.eclipse.ui.examples.contributions/icons/editor.svg new file mode 100644 index 00000000000..fbad0ece47f --- /dev/null +++ b/examples/org.eclipse.ui.examples.contributions/icons/editor.svg @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.gif b/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.gif deleted file mode 100644 index 7aea894d0b603a02aed2a7f706bcb3170988774d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 612 zcmZ{h>q}E%9Dt8G)5LOgQI2^@7e=H}5t7*jq~=si${U5|rU_+M-j`oOU#sb&i!)6! zQj1L2<%^C`(3Frs!zQH!M$LxHZR)0;HP3s_`~J#5py%WBe0&lT<%eQbQbx*H7)D;+ zC9mj8tL`~bsh6u?DXLzlp`Oc4!$r+QwcX=`U*-e?sC#^9(mL|ZR{74{H@%DrT- zV)#}6;rDanLRp{LGx3fOqC^RS3vNq|)X-(A$o!#sus3{C+!5o{Rj7~JHa zq?m$3AWMR=N;c$n#X>#8pgrH*sO=7AfY*vOt}fICx=Rq;>*}tJq5D zJOzs&S}52kF^hQm&roD!pv_wX{I_nC2C7b_o=HnlsqcF+ z>%ILpZc-}G=AK7a*@3|wd!lmkaw^a@Hhgq+cl5#IStlz|F}po7cvo=5fta}bq!M(A z4UvV+$@aw_y%1lD%Gl7ITxjV2!wCgP%26SkA9VL}>?w1J7eN*3kUXk(DEU6m(EdKjHN)jkv7c;{Jb4a3C!1>qfFng9R* diff --git a/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.svg b/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.svg new file mode 100644 index 00000000000..d080de794e2 --- /dev/null +++ b/examples/org.eclipse.ui.examples.contributions/icons/new_wiz.svg @@ -0,0 +1,546 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.contributions/icons/perspective.gif b/examples/org.eclipse.ui.examples.contributions/icons/perspective.gif deleted file mode 100644 index 008fd7ada9a41ae38b1f9d9fe11ee67c1b684df8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 139 zcmV;60CfLHNk%w1VGsZi0HOc@e}7+}pMSr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.contributions/icons/sample.gif b/examples/org.eclipse.ui.examples.contributions/icons/sample.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.contributions/icons/sample2.gif b/examples/org.eclipse.ui.examples.contributions/icons/sample2.gif deleted file mode 100644 index 252d7ebcb8c74d6e5de66ef0eb8856622a0e9d89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 318 zcmZ?wbhEHb6krfwxXQp_S{7na6>d=(Ze15;Qy1mX8t2lT^ zHOHgY9FJamJZkN+sI|wVk6ueSb}ixP)r4bLfn?%^+sU^crQUj&`rv8W|Ns9PC;*B- zSr{1@v>9|jW`O*}z!rUAYJrE2RKG`JYNRKhwpQrnor{(Ph`sVEnyR2Kc;c~(o$WdP zMb0Wl6K^dQ-0hgs; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.contributions/plugin.xml b/examples/org.eclipse.ui.examples.contributions/plugin.xml index 96fe1f863d5..ab7e462527e 100644 --- a/examples/org.eclipse.ui.examples.contributions/plugin.xml +++ b/examples/org.eclipse.ui.examples.contributions/plugin.xml @@ -162,7 +162,7 @@ id="org.eclipse.ui.examples.contributions.toolbars.sampleToolbar"> @@ -249,7 +249,7 @@ locationURI="toolbar:org.eclipse.ui.examples.contributions.view?after=additions"> @@ -485,7 +485,7 @@ id="org.eclipse.ui.examples.contributions.editor.toolbar"> @@ -529,7 +529,7 @@ @@ -594,7 +594,7 @@ @@ -607,7 +607,7 @@ name="%info.product.name"> + value="icons/sample2.svg"> + value="product_lg.svg"> $u~{x=Kit?X0r1sxy zra;H4CYUSSG*yc&LQmp_fjIB3$SaqVJ%_G&k0uj`Q~dgq z10Kg*jZP(wT@UV{_)T2DG?@`Fm6)86d1;msGE0r@%MPBu5jK?(zHmMDT5i} zE$+`B76>>A&vkg~wH|JL{L9-al^Z zXzi>1H&F3!wDNENqqWC9U4ym%h8h0`THa4I9zSJ1nQHzw*79$v_3v=syP=W6se!jI zCdOt4cW38kSQEPo%k!++o#nZ`W!BPb*5>N^D>m!f>o*(kUw?nO^KSFwyRDs%pFe*8 z^kw(!{@%gi_g@D`zm5)%{{BAx_vhcgf0D<7W>JB@F@XV?xR97&jB{`x#>(a#9w7M( z0^|Vv1Dpo@kN-al0C5cXixjhNDIcI9_?5iIS}KNUXldJ0>(L~1s>*CrJ#T~_WIjG*}Dz}icK(b#t-MoeBn@^P@Mx^Tw?JJlQZ5I3N}t(0t%>uSvhVhI&3>iAM{#StE8~ z3V;QeoC1yb-+>Ku%wPc6^1IlFIj%F=knNYVcbWpF>a>4v`cLt)Uv_a_U<;th%E!m_ zy==ojyZ&6x$C(*ewaD%E^QsDa&qYnV0RU>@(PlI=`104=Gy1Kw&{Nf}u0LyC+-t^V zZ{WAF%Pv-Vb37)@H-&9!9b(VLyX@3+I{uJM+qYrh&_%mj{|dt0jQ z-|bP)tc}owF@Z8_2)8Yc-h3k%U^X-KMenVl^N>w4M;SYC_)W;-Wt%n+8MnI{p*$80 z4Qi9(387p>>rl2#VheA^iHlTTm}oe&l_pgqz&|r-O<9=<-ESe#1ndJ^Erk3?lA|X= zN-KVdkeE1{c+xH~>&(84IDb%MCNG3H%udom=mN>NQ#iPK0CqBV^9lS|+!ro|kn}GK zKd{=|N;TuqgQS}AUAB8NvgAX(`9ma@{p9({r0;KNuc?SigiI|%Q_uQUDR79}5W-94 zwUim43Y(L@#?J(;olAJ1bXd{%`Uct*A(ed^lqJ8F^OV=1b_OtnVl-}?9<A!Dc$0c25s>CvO+;NSKP$y1 zaz?g`ep0Z~H#qdoO539FOX8ST9q5cyu}%5&>SIo&mHZ=io7nidRFA6|sNC55-DXV+RX2o@~vFYx*cl$U5gjtrToQTiE&x%)51% z3d)JYz&{7FNQoG5&t#zRY8(Yq%9}_)_`$!p!N+Ba5e1nvmHI z9)dzDE{Y~alHDyWQWe52H7c?C6ag)sVgd%V)Q!>CDSeX|Q(R?uCUwxLSM5O^d0YA6 z_)6n(yI=+D13ND@l_MNm!F3L3Ce2Fw`HKlR2h_fMWo_R7^%Ix9b0|<^?zvJ1sP^Al zqf3}%cEj@929@-B-N{RNJOS)ZvEXAyxC?qfWRFd{QKhifbO0?EjODqHq7odfnRbV~ z4FExv)1kiE9*d^JwP@IB>YKF%zdJS5aI1MQVk!rb2=-kE$Vltq7XQv8W^aq0kot+! z!Dx2ds>sS|@mkkcE_N(6tH%1yt$jT2R-+0%JwLsd3hh7W^z&v27p>SW;hIAuh97L) z3bis6{mEaYS8p3uLD(kz9Gdw-@@X7*aHOX5bB&Qx)tSJrI&FoUu{fw3ZF&W%jtUC~ zZ!kxV*n)Jv!r9@VFMVq~4!XlL=b|!e!o1xNH3c;+kou=u07HI&u6!y{H5x&&dH9)j zc^_k-2&d_n(7Tg{_l^~tUif}|`gUlL99{ZxcTL(Y_R)$!`qp_qD$1QbvtiM6BCID( zY@c!g){7n{qhC)Y@yUS&A}7CWr&N1verQ31jR(?c-zm~_Wi1r2@z zW$r|4Rs}%N69Yyuu&}4f(;oA#G(9%(kC&Bp!<+6X@lRi+PT`R6&PP9*b~#X`;&Or! zW+J0ZU5yW7A3Y{LdmbG&IZgfKRcEkfguC0i+LP^~2AOb0wL$X*CG#^)6`3gp71H0` zNBTD|Of%7zTE}!=u0VS7rYw(s*=>8ju#8In+QTv9ya9lq9eYOmSzG**ty!oiJ=QV% z-ihTNM}s}!6hx+4f&IzXPuffb?`El0IgnFt=Pf*nv23fi^Ke=mtf>=Dms4x?$Y-Z|M$yzg&;ATxvA_cJ1UwZw0YN@XVW= zp3bYx`s4jhPp4H}eo=EC)1&2A%h0Kh@NDL;L<;1aJPaZsKJ>0R=&e1-tX#LJg}# zm%2x_TaHt?cCD&J7xOd5?|8YGo{i1V-)b;FcoPp*BLZ*!-0w1A`|*Thp?v)~4y9jR zzq2Y5No4bNuweliSwagrFA)&nxl|VS@R&$l`$$j9$<{iAb%AK z8dZyBKj(VMqK(T6%=_;sEzLR6XsOYh{*eMmTp)FL#}p z^4cwa$TbMK!ZDkHEmEV%%OHe&xj$y+agf{}1p>wC5lCIv^bf{SKZ(LF=0vls(pW;$ zkNhWO6l;tUiO79Ryj`w9W6Q_B3-WFtaX2|+`L>NxT7vlIcxX((trOXz^*2{W3w)vH zIXkm2QNhno=<0RB_Neg64y!_9&La%x3>1ZO=kmXB`yJ_Spa^%R0?n0%VyZ>{W4N4= zFJMv-X=p@J3x~iQkAYg6EixUx;>|~N&rDC_v`8)}upEpr@t`={{y@yc_(Z!#%`sE_ z^|^IKauLW>mmn0Qm_Y47CI}doEx-?1aDf4C#<6R(5GhZo3n2Q-<0Ko{oMD%C_w1wF z5LI`hNFw|i1(AnE&QudxFq}**YMPW1E}UER^1*B-UH@+3{a>ZnUq}@J?9~`kUo$ua z&f7$~xy34Db>(FoCT0HcqZsDsZ&z0#X6+JF@Sj`?i_-v!fDB0OP;led-UF9x>d9{o`-t$sOawJ`JD5~$mvIFjP{Q(9|C z!4U5L;Mg*fK;t?Jxvk<+7&VqM1BiY2*arZMC~2|MEOz!Cs){W~@P7r0C<5a}(nZQ6 z_TosZwRmy}Xo3QMR&eogm%q9K;`sD;WJ5XOViu~ts4_D6?pO$2OQf9rIP#x+&~it7 z;Vhhv$y*zOCs1zjr50>$QP+P_mumeo;@wp;fZ4K^fi-#qG1?cT$(0?5Zy`Akx;P!& zO2b)PFBG|FSX>c^Ymt?#@6>rlBHRryZQLf;6O)k)!Sb!*a1Jb(K&X zdgRB1pf@jW#)^6(p*Fd(mI6Pj zKaOkv3U0jD;*hV%xo=rIho+VvW@yykc5_RO*DJvn)FzYk=XP9u@o;o2&-vg6KDF#^ zMpA#BUxU&`WwdA8s9}ATs}~#UqvxB3!4~f!Ret67-pHNVBaiCSi5#~tJP)DQyEN}1 zl^1Ww3Fs87e$y++NQ84^3MnQA3uo=8dq~4B&X&Kcl!ZH@whyVTV=dRa0JOk5 z#EM_iaRW#d4KAdD{g{yd(qX~aM&k@*Mu(RjES3?M!k}?6>QIwp)TmmxY%k%c#0ofE z-@|X^cLa@+hAozhc50}9A)~8_&1DlsyuC%(Y@!G`O)(P}qV3!XhOf6jwuxhS*Jll5 zVx5W-zj{PXl5Wrwg63mtQ;KV!Wy2%!1|I%B7x(lCYMj5-)W6ZW*#Iv191oe;04wcE z)5~7-$j(>-x-H|C>7eerdadL4K*EU3Jp`SZ-!OY;uxr4P7Wq~lbx)3S>J9-o^61ln z35Tf8$`CA!4igtJFOf%n+vC>#!^yy4;F2(d)&9?MdCs*rcUayQrGe>|xZ`PQ==Xii zTh_jxu3Fgr>?nbuer}fzGslK6arWVZ-mf70kJ_4rZ6ADx0lT%`hM=UXgg7GCGd9QV zJ$TeCwDl&$V0GN`Rr}IG`>K$uBEUZ_Bw58;H-f1PMj#J1AKSS-h|-C?I~vlb_Uxj) z^?hbjWk8v)le0oX&ku$x0RX$JhKQPloWnpg$Y{0M9=vcmOR3_EZiW4YIw~wqpx|td z^jIUO!@Ye2NI{&l#RJ*j`E(nPnx$}HV0k{dsyP#JGz9k^8Z`EQNZQv4v4HqvAZs}w zeWHT)Tc87Le2dXy(cmXc4@JZV<}Wf8Sb=+#UOD|sK2^7NKODEpX1M%Fm?=Qvfr1

8R{_3 zwR6|F72MsrLCg9m6xq45G%ho{Yy&^rr5%EYjUJzLejb->NwQP~fGwY_Tjru+;moo| z02g|iF`C5b=`O+yHEnbf3WI!mcb%zcYOh5p0wAA?1>6IeU0u3-pmOsqqnKIq?Cb(A zzbe6N3=$)LMQ;|Q4*;$;uRwgCzvkLVV)w3d3rKk*`E5phm4LX zRtFKUlZ&nB?AK2h;DG7c6Ls1KW+ogd$zkm}h9s~W9fYR8T2Da>iEoH(_wbG$l&ZxxW?P zQv3TT{nU5pMf_#_zS(DSh_eycaO0hcDu_Gp6#{ra_I@6|y9du|k4N5r^dsqQI#FTE zSP`(;yl~x>V&d%|<92_mf5T|4%4p8^Lr{z6k4$ih6{Ii#a`YIii+5F@1zDkXuz6_l zSwM1g`&Gj_A?}1_*hMiWi4+I+*s6<`*FI>6F^hGHl>A%S`93Gv31E2KJJ;ReXQ53A zm)rF|ds|Lz1gem)8*^_qOi3%_cUH~^3a8xEhPQqy242u<&FH$G?e7@v-_wt@y11`> zW$^_GZ>}N+E8u?R2UrZba}4<`e&sJW_+MU{3Lear_v%3&+D2`o*=whj(ISKmtSM3KU4wWbUB=5KggQCQo;QO3`C&p_G>oASsWEBUHjS}n>nHWo@X8g zQNdy*y?ucXZ))zU3d801;W?@AZs?;*W>^^fQ%Xk zpbXx;SqI#EUAB81Omymwuz#58*=6^*Qz!OOaMn3(v4H+jI}`Wjgq$i@tdV2pqitI4 zj~z45$d93&-yyszpKzDaT0cwp&VSresB7s@x^@ZZc9jU2s~Eh&t?bGO2KvMD#q~%K z$w8S)fg2a9-J9aoCxpZVYSe%tGB34nn)Yg2sDFD@CUu0#3rZ_iGqesbq-c%%6B?;(wb3Smkv34z^pV?Ub)gM z6f2H*{eR!m5lmXl{sgV#ye;yqASx`Rbz6W!2XpHHeCsByxnW6pEm`oC?Zc0 znQ0651%Ri^O0!C*5t0Sd)K?y3JhYR?8Xz@^R|I9NjLTS3#z%LJMjd{Edy48ijD2<^ zN{0c+8b7_NXvTFxzkyLzpyZ&XD#&UY{$_7C^<-Itfi;!UXPob)xRyx5{@UL-_JtRO z3ZP&oT$Lurqyr73z%o9lFz}*MH%Purb=Su1`lREHcJ71Jyv^Zi|tXf-iT>8QbS436Q88ZZMou{ccUnbN?R2$te?+$Fv90}ja)t)ZZr?BdT}-i zio3I`ZG6$73#)zLm1GK;=<0jLN?~m`DZupXmgkF%{=++Q-U`J8)h9w5hx0z3R94@G ziT}2E*<0e!>TR_y*u?Shy{&e=5E>*e5H$O~n;F^{; z0Ocop-}ZFg`}V$=5xLzvV3g3oAMKTHQ5?*r$BC-Rrd zJ$Te)92qsDCv5|jG>VB&V*H+tyywgt^c3pY&=n=;!XlckoO78h)HnNpCs`zTqu?J! zkpd6%M}#Ci$A3| z-^6kmWZbz}qwt`{as1_I!Kpw36e6X!c6fTYOyaY@M2Gc9XqKMT2CyLN{^q9B4bwaJ zFQe~+Wye3vwh!A?Mr7@;ErxU@beS)G4()musOLr+P_O5Y`lBJWr?yiw*OY(zo`=+p zMSlkazK(dT_(Iko|0yowmc|(ivCjg}^F3oSG>PC#Avt`fE@>#68!pvboT1I9!dz

z?tCcc+kFG^7oGO^T59+NW;jyyho7goM4kN<=3fOR9^iKgCjrAb%_PU;rbjA+B5@)wzXrOM{?RknU)3%7 zI;=?;*gfr@ZFj0{!!gh5^oKn}6IpU>>1umyi}T4HehG#D8oWXIUsPF-W{ZE?ZT$^T z^@X{=cv561-}3P4sbr0#<7$b`Oh(+#zBkA0Yi=nw(qB&?cHN*~V!Ao5HG`;uqc6fg z_VO0AL>%!B$LzQfh^xw*PHo*PNqMR=ULi8Aagm3=s*KmCrm8o*$*9vE>YyuM(oc$e zpg$$B9@{z4WpFWRwBe5i2jltbeB`%;r@kA=z)`QgYgnx}!LIR}E#f_K`Bru%pH#5> zH|S8gf#+Op^4aD5AbwJe$yrA)uB!hzT(J+XAJPsWEkPYu@i`au2-qeDp zl#hpUu>U=LR3!0)D)O`2DK0BI;Nvj>dUiHVOl~f|d=D(KeK>+?DNikd{avO!{SoQb z)pz>kk%DYD(%xr0bofcHhNaj{ME+i2kZy+$kv~iGkZsWcyuh;v}tTphhlO-}AF>a~6 z%|3e@ryz@`;IQeJ;%TvCv=966u_T)N7+6xTbb?G)AOd&Ix|`k^ha8#kwE_{hngaSd z;Em#Cq(0R#iaqgJObhKo(zBkh3>#svZ1q;z|ag51CZXfu=Are+x*V z8ucGX`#!&3;|t)X(^DdV7S{q#VbfF!u-95>QJGNv;52Gm$FDX~V{vvak*g|i%} zJl11pAYyq%(QOFHhfN(x8t_u1MHdew1I$%7X-O;?o&?4)d*u4X5#$lE@-)eEAeuB> z(+5BkfePhmgOU&2%$c0LqoDpFRXW8oGd(~79#3MJY?@vtF?!lzVpJLGjdHzGjOzk+ zIJK8QM@CSSsiAlgJ%QzVaNswE-Wk zHm~D(Zf`zI`9-7%eGmso_hG?AVicZJo+Fc=u=vx|y>MhLK|yd_5aq>5Y$mxvSCs@&F2uTVvXb5lgmA-y=NwkIBAsrTQ{|DXp@2q)`Q1ynO(!b zn9LlF8cR2s9azn3j9f%^u3C4kwhu}hLMDOYc#!TPPVd55GBfY{2YrGey6)pc1uu5J)JdB*jX;p%cB@HU#yNS;?x(Nt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From f6d7f42e212d01e63e68c1d048fbe6cb14de8633 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 16:48:23 +0100 Subject: [PATCH 11/19] Replace GIF icons with SVGs in org.eclipse.ui.examples.undo --- .../icons/sample.gif | Bin 983 -> 0 bytes .../icons/sample.svg | 312 ++++++++++++++++++ .../org.eclipse.ui.examples.undo/plugin.xml | 4 +- 3 files changed, 314 insertions(+), 2 deletions(-) delete mode 100644 examples/org.eclipse.ui.examples.undo/icons/sample.gif create mode 100644 examples/org.eclipse.ui.examples.undo/icons/sample.svg diff --git a/examples/org.eclipse.ui.examples.undo/icons/sample.gif b/examples/org.eclipse.ui.examples.undo/icons/sample.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.undo/plugin.xml b/examples/org.eclipse.ui.examples.undo/plugin.xml index 37f1aa581ac..6902ed5c262 100644 --- a/examples/org.eclipse.ui.examples.undo/plugin.xml +++ b/examples/org.eclipse.ui.examples.undo/plugin.xml @@ -24,7 +24,7 @@ @@ -38,7 +38,7 @@ id="org.eclipse.ui.examples.undo"/> From db6812d251a7934975b1c263afcb5f2e275fd8a6 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 16:48:29 +0100 Subject: [PATCH 12/19] Replace GIF icons with SVGs in org.eclipse.ui.examples.views.properties.tabbed.article --- .../icons/sample.gif | Bin 983 -> 0 bytes .../icons/sample.svg | 312 ++++++++++++++++++ .../plugin.xml | 2 +- 3 files changed, 313 insertions(+), 1 deletion(-) delete mode 100644 examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.gif create mode 100644 examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.svg diff --git a/examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.gif b/examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml b/examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml index 4e77ea38c22..0786130a25b 100644 --- a/examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml +++ b/examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml @@ -10,7 +10,7 @@ From 69a3fd321446faf5950c518d058ea120ea0ec178 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 16:48:34 +0100 Subject: [PATCH 13/19] Replace some GIF icons with SVGs in org.eclipse.ui.forms.examples --- .../icons/file_obj.gif | Bin 152 -> 0 bytes .../icons/file_obj.svg | 294 +++++++++++++++++ .../icons/sample.gif | Bin 983 -> 0 bytes .../icons/sample.svg | 312 ++++++++++++++++++ .../org.eclipse.ui.forms.examples/plugin.xml | 4 +- 5 files changed, 608 insertions(+), 2 deletions(-) delete mode 100644 examples/org.eclipse.ui.forms.examples/icons/file_obj.gif create mode 100644 examples/org.eclipse.ui.forms.examples/icons/file_obj.svg delete mode 100644 examples/org.eclipse.ui.forms.examples/icons/sample.gif create mode 100644 examples/org.eclipse.ui.forms.examples/icons/sample.svg diff --git a/examples/org.eclipse.ui.forms.examples/icons/file_obj.gif b/examples/org.eclipse.ui.forms.examples/icons/file_obj.gif deleted file mode 100644 index 6b86d079780c2b7ec903f8d74607748e933632a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 152 zcmZ?wbhEHb6krfw*v!Dd(9jS+fByXa`|sc1|Ns8{|Ns9VIB=i=C>S3PWCP{VfZ|UU zMg|5>1|5(%$P5M+SA&zD+O`(S+WeXd6$*C*+vFl=ItXwa?N~9nvW@w!=-S_6JFoIC o_uf#m|3NB8(6tJW8O6uvNX2S00V0|RR910 diff --git a/examples/org.eclipse.ui.forms.examples/icons/file_obj.svg b/examples/org.eclipse.ui.forms.examples/icons/file_obj.svg new file mode 100644 index 00000000000..fbad0ece47f --- /dev/null +++ b/examples/org.eclipse.ui.forms.examples/icons/file_obj.svg @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.forms.examples/icons/sample.gif b/examples/org.eclipse.ui.forms.examples/icons/sample.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.forms.examples/plugin.xml b/examples/org.eclipse.ui.forms.examples/plugin.xml index 843bbf77e6d..400c85b931d 100644 --- a/examples/org.eclipse.ui.forms.examples/plugin.xml +++ b/examples/org.eclipse.ui.forms.examples/plugin.xml @@ -48,14 +48,14 @@ From 5f45a66713e407c824ff6f62d4ba74fded603cc1 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 16:48:48 +0100 Subject: [PATCH 14/19] Replace GIF icons with SVGs in org.eclipse.ui.examples.javaeditor --- .../icons/sample.gif | Bin 983 -> 0 bytes .../icons/sample.svg | 312 ++++++++++++++++++ 2 files changed, 312 insertions(+) delete mode 100644 examples/org.eclipse.ui.examples.javaeditor/icons/sample.gif create mode 100644 examples/org.eclipse.ui.examples.javaeditor/icons/sample.svg diff --git a/examples/org.eclipse.ui.examples.javaeditor/icons/sample.gif b/examples/org.eclipse.ui.examples.javaeditor/icons/sample.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + From 8d56753ffb1d75d83ae6a13fb3707c233853fe27 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 16:49:53 +0100 Subject: [PATCH 15/19] Replace GIF icon with SVG in org.eclipse.ui.examples.multipageeditor --- .../icons/copy.gif | Bin 125 -> 0 bytes .../icons/copy.svg | 204 ++++++++++++++++++ .../plugin.xml | 2 +- 3 files changed, 205 insertions(+), 1 deletion(-) delete mode 100644 examples/org.eclipse.ui.examples.multipageeditor/icons/copy.gif create mode 100644 examples/org.eclipse.ui.examples.multipageeditor/icons/copy.svg diff --git a/examples/org.eclipse.ui.examples.multipageeditor/icons/copy.gif b/examples/org.eclipse.ui.examples.multipageeditor/icons/copy.gif deleted file mode 100644 index f962255bc45722a27026be218d167b582fd10ece..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 125 zcmZ?wbhEHb6krfwSj51P}0Vp9##gY=f3=5Ns%-AUURSrEuXbUd(v*17v|T_vc2xD6Ta-#@q}ZZ V;Z2|KiDuHwE3UQv^$=pP1_1Y{ELQ*k diff --git a/examples/org.eclipse.ui.examples.multipageeditor/icons/copy.svg b/examples/org.eclipse.ui.examples.multipageeditor/icons/copy.svg new file mode 100644 index 00000000000..51404059682 --- /dev/null +++ b/examples/org.eclipse.ui.examples.multipageeditor/icons/copy.svg @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + backpaper + + + page-lines-back + + + frontpaper + + + page-lines + + + fold + + + diff --git a/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml b/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml index 377e097e7f3..cfa70406956 100644 --- a/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml +++ b/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml @@ -6,7 +6,7 @@ point="org.eclipse.ui.editors"> Date: Tue, 17 Feb 2026 16:49:53 +0100 Subject: [PATCH 16/19] Replace GIF icon with SVG in org.eclipse.e4.demo.cssbridge --- .../icons/app.gif | Bin 983 -> 0 bytes .../icons/app.svg | 312 ++++++++++++++++++ .../org.eclipse.e4.demo.cssbridge/plugin.xml | 2 +- 3 files changed, 313 insertions(+), 1 deletion(-) delete mode 100644 examples/org.eclipse.e4.demo.cssbridge/icons/app.gif create mode 100644 examples/org.eclipse.e4.demo.cssbridge/icons/app.svg diff --git a/examples/org.eclipse.e4.demo.cssbridge/icons/app.gif b/examples/org.eclipse.e4.demo.cssbridge/icons/app.gif deleted file mode 100644 index 34fb3c9d8cb7d489681b7f7aee4bdcd7eaf53610..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 983 zcmZ?wbhEHb6krfw_|CxKYUg-n!?izO{@9*?jxd%4aX0yzy`dymabz zw#(eg=y~&N&n)dZv2xzduG}5lraiApo3(c4*{Ylg5#|$JO_EEZ<^|a2`Z*=9ns7DV zy=TR&gYw*7f%auV?ip3tvjRPmcdoho{K?x$_vR?C#t5&<;~V}S*>OMCr>h}%%bLZ9 zmo3`hYEwTICo-TTCZwgTsC&VjZRgJ1eE#fBa^%9R zmmfWS@;bnyJ27HWY}kxYzv(Hl>yu;FCPlAEh+34Muq-8Rb6C)<8qA3{r2e5 z`$vyngh#H=FWlqqvnapfc5%(!sQ4v?r7J61-&eJNEN^;KTK}T7{#i-gJh%G*9vcYdwv_*~xdw!Gz4Va?T!sXyyF@8?w<>X`X=#j%uHV4GRvj@+tE@ zQ%F!a)GKcn^~8abN>4la1UNXVL;{ZWi)lEwyeatDu%Lr6;aASiLrXXW zQm# + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.e4.demo.cssbridge/plugin.xml b/examples/org.eclipse.e4.demo.cssbridge/plugin.xml index 05d006814a0..2198f2cf23c 100644 --- a/examples/org.eclipse.e4.demo.cssbridge/plugin.xml +++ b/examples/org.eclipse.e4.demo.cssbridge/plugin.xml @@ -73,7 +73,7 @@ name="%product.name"> + value="icons/app.svg"> Date: Tue, 17 Feb 2026 16:51:41 +0100 Subject: [PATCH 17/19] Replace GIF icon with SVG in org.eclipse.ui.examples.propertysheet --- .../icons/obj16/usereditor.gif | Bin 219 -> 0 bytes .../icons/obj16/usereditor.svg | 312 ++++++++++++++++++ .../plugin.xml | 2 +- 3 files changed, 313 insertions(+), 1 deletion(-) delete mode 100644 examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif create mode 100644 examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.svg diff --git a/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif b/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif deleted file mode 100644 index 64d79074260faaa463a8897e9fac0acc5c485212..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmZ?wbhEHb6krfwIKlt~4fgT-?c?X$*YCHVzn`I@p}yXJ|Ni;+@9+Qr`@{Tt`}_0l z=f~T}+uQ&D|9?MFV*dPwhKBg~c%V+82*?1uK=CIFBLjm7gAPa)$W8{<2nE%?l+1aH z4la0l$VWusyvarlUMEh+AeP3)3vHK=W*8^siBww5?~i77>atiDp{W#fG;S$h%aZO^ n52 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.propertysheet/plugin.xml b/examples/org.eclipse.ui.examples.propertysheet/plugin.xml index d834a9e3a07..b45fc2edb9e 100644 --- a/examples/org.eclipse.ui.examples.propertysheet/plugin.xml +++ b/examples/org.eclipse.ui.examples.propertysheet/plugin.xml @@ -6,7 +6,7 @@ point="org.eclipse.ui.editors"> From 42da72ab4278423c7405be076534eebc9d00b5a2 Mon Sep 17 00:00:00 2001 From: Lars Vogel Date: Tue, 17 Feb 2026 16:51:41 +0100 Subject: [PATCH 18/19] Replace some GIF icons with SVGs in org.eclipse.ui.examples.readmetool --- .../icons/ctool16/openbrwsr.gif | Bin 239 -> 0 bytes .../icons/ctool16/openbrwsr.svg | 234 ++++++++ .../icons/obj16/editor.gif | Bin 932 -> 0 bytes .../icons/obj16/editor.svg | 294 ++++++++++ .../icons/obj16/newreadme_wiz.gif | Bin 225 -> 0 bytes .../icons/obj16/newreadme_wiz.svg | 546 ++++++++++++++++++ .../icons/obj16/usereditor.gif | Bin 219 -> 0 bytes .../icons/obj16/usereditor.svg | 312 ++++++++++ .../icons/view16/sections.gif | Bin 139 -> 0 bytes .../icons/view16/sections.svg | 356 ++++++++++++ .../plugin.xml | 20 +- 11 files changed, 1752 insertions(+), 10 deletions(-) delete mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif create mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.svg delete mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif create mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.svg delete mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif create mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.svg delete mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif create mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.svg delete mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif create mode 100644 examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.svg diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif b/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif deleted file mode 100644 index 6d40439b49c0f1a4afae57f63e1dd202ecc149ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 239 zcmZ?wbhEHb6krfwIP#z2z<~n{3=Q`7@%Hii?c?X$*Y9U&Xt19@|Nnpc`g;5S|Lgz% zpFe+o{r>&)@8945|GxeI-yiM+RmB6P{x>u<#K*@o;0205Sr|bIbU*~iP6pN-1qCL@ z%z2FlOh*_b4+oq%zOXN&u6yd^;C%^;jimhg4zz7LsL&k%L25SI + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif deleted file mode 100644 index c48d9a95677cb24967cc55ef2ec1b2ce0c7ce585..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 932 zcmZ`%O-Pkd5dEGdm?0@CMj80@EwY4KR6KDp5?S^`P=N>uV<3rHC{p4=oEJ&}1VWg&h+qmLl0*!O><6Z~Zdx^q?_TE4oHJ*>bM)AeWYzinC_kFD zXl7<6ic$bLI{FY$02xT4R0^0y*nY2?vJfaEA()UbsprkapP5ss6e33dkND4xvG7_M zK7ljJZfz>fG?zvr8w&e6^ZVlEH%s>oon86yCOMMsNG>1PR+H|W++Vh*=+pdCvUYr7 zYwkdGee8YP^MQpMk3K%mE;*H`9L^s5b78FV`m3_6)8`huqO5`*ymqOuxaVMhS8>)* z;b5lt&fQD#sG5)og-{921u&uuVPr;OR7PV2K@=oG78F4hG(k{AMN(u%QB*}!*Npz%mFGN|NQjikypPF8^c3^@Zkdb;gnVc( zVj&S@eQsC7uW&%*t$zBd+F_EQSIkNI|@lNf7F?T!fG80|t5tR1WMg-sB~o2%#b-0xGCN z8b%ZqRdElyx811b4z$SD4?q3p@z0kz>1b0({-CL-8N0MPF*`CWpuCe=mK0`MsrK;ziUk)xEeo+S%SZ Pb#-&iO5;Q<7FGWR?3v&j diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.svg b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.svg new file mode 100644 index 00000000000..fbad0ece47f --- /dev/null +++ b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.svg @@ -0,0 +1,294 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif deleted file mode 100644 index 293826dfe0604b9cceef149a4ce41f9031fe2c83..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 225 zcmZ?wbhEHb6krfwIKseSZy*2vfBgOX^XJd6-@kwU{rmg>-?#t&`@{bE@$=*D_s84E z+uQ&D|9?MFZvOn4GiNq5G%zqQ07ZZ#F+lMr3nK%A5Q7d#G008^*0=>KeN0Mho(c;W zM`$fe=_%Hp%3ZSTTLgpP+%?yKv3A-n7SJpbXmD~@d9=Y*<^1DNr`+7B(Rs|A68& + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif deleted file mode 100644 index 64d79074260faaa463a8897e9fac0acc5c485212..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 219 zcmZ?wbhEHb6krfwIKlt~4fgT-?c?X$*YCHVzn`I@p}yXJ|Ni;+@9+Qr`@{Tt`}_0l z=f~T}+uQ&D|9?MFV*dPwhKBg~c%V+82*?1uK=CIFBLjm7gAPa)$W8{<2nE%?l+1aH z4la0l$VWusyvarlUMEh+AeP3)3vHK=W*8^siBww5?~i77>atiDp{W#fG;S$h%aZO^ n52 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif b/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif deleted file mode 100644 index 008fd7ada9a41ae38b1f9d9fe11ee67c1b684df8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 139 zcmV;60CfLHNk%w1VGsZi0HOc@e}7+}pMSr + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/org.eclipse.ui.examples.readmetool/plugin.xml b/examples/org.eclipse.ui.examples.readmetool/plugin.xml index 21c94a86a6c..0cfaf8efd16 100644 --- a/examples/org.eclipse.ui.examples.readmetool/plugin.xml +++ b/examples/org.eclipse.ui.examples.readmetool/plugin.xml @@ -45,7 +45,7 @@ toolbarPath="readme" class="org.eclipse.ui.examples.readmetool.WindowActionDelegate" enablesFor="1" - icon="$nl$/icons/ctool16/openbrwsr.gif" + icon="$nl$/icons/ctool16/openbrwsr.svg" helpContextId="org.eclipse.ui.examples.readmetool.open_browser_action_context" label="%ReadmeAction.label" menubarPath="window/org_eclipse_ui_examples_readmetool/slot1" @@ -57,7 +57,7 @@ @@ -103,7 +103,7 @@ point="org.eclipse.ui.editors"> @@ -165,7 +165,7 @@ id="org.eclipse.ui.examples.readmetool"> Date: Tue, 17 Feb 2026 18:55:19 +0100 Subject: [PATCH 19/19] Add CSS functionality for setting the color of SVG icons This change introduces a new CSS property `-eclipse-svg-filter` that allows developers to dynamically change the color of monochrome SVG icons loaded via CSS. The property supports the following values: - `color `: Replaces all colors in the SVG with the specified color while preserving the alpha channel. - `none`: Removes any previously applied SVG filter. Usage example in CSS: Label { image: url("platform:/plugin/org.eclipse.ui/icons/full/obj16/file_obj.svg"); -eclipse-svg-filter: color #FF0000; /* Makes the icon red */ } Implementation details: - Added `ColorMatrix` and `ColorMatrixImageDescriptor` to `org.eclipse.jface.resource` to support per-pixel color transformations. - Added `createWithColorMatrix` to `ImageDescriptor`. - Implemented `CSSPropertySVGFilterSWTHandler` in `org.eclipse.e4.ui.css.swt` to handle the new property. - Modified `CSSSWTImageHelper` to apply the color matrix when an SVG is loaded if a filter color is set on the widget. - Updated image converters to pass the `Widget` context, enabling the retrieval of widget-specific CSS data. - Registered the property handler for `Control`, `ToolItem`, and `CTabItem`. --- bundles/org.eclipse.e4.ui.css.swt/plugin.xml | 21 +++ .../e4/ui/css/swt/CSSSWTConstants.java | 6 +- .../ui/css/swt/helpers/CSSSWTImageHelper.java | 25 +++- .../CSSValueSWTImageConverterImpl.java | 15 ++- .../css2/CSSPropertyBackgroundSWTHandler.java | 3 +- .../CSSPropertySVGFilterSWTHandler.java | 80 +++++++++++ .../eclipse/jface/resource/ColorMatrix.java | 69 ++++++++++ .../resource/ColorMatrixImageDescriptor.java | 125 ++++++++++++++++++ .../jface/resource/ImageDescriptor.java | 20 +++ 9 files changed, 354 insertions(+), 10 deletions(-) create mode 100644 bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySVGFilterSWTHandler.java create mode 100644 bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrix.java create mode 100644 bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrixImageDescriptor.java diff --git a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml index 1ad4315b24f..81d0f8a2c8c 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/plugin.xml +++ b/bundles/org.eclipse.e4.ui.css.swt/plugin.xml @@ -478,6 +478,27 @@ name="swt-link-foreground-color"> + + + + + + + + + + + + diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java index e7b277381d1..ea81535eabc 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java @@ -76,7 +76,9 @@ public class CSSSWTConstants { public static final String BUTTON_SELECTED_LISTENER = "org.eclipse.e4.ui.css.swt.BUTTON_SELECTED_LISTENER"; - - + /** + * Constant used to store color for SVG filter into SWT widget data. + */ + public static final String CSS_SVG_FILTER_COLOR = "org.eclipse.e4.ui.css.swt.svg.filter.color"; } diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java index f6bdcfc892c..f5065454c8c 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java @@ -17,8 +17,11 @@ import java.net.URL; import org.eclipse.e4.ui.css.core.util.resources.IResourcesLocatorManager; import org.eclipse.e4.ui.css.core.utils.StringUtils; +import org.eclipse.e4.ui.css.swt.CSSSWTConstants; +import org.eclipse.jface.resource.ColorMatrix; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; @@ -38,6 +41,11 @@ public class CSSSWTImageHelper { public static Image getImage(CSSValue value, IResourcesLocatorManager manager, Display display) throws Exception { + return getImage(value, manager, display, null); + } + + public static Image getImage(CSSValue value, IResourcesLocatorManager manager, Display display, Widget widget) + throws Exception { if (value.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE) { return null; } @@ -45,18 +53,27 @@ public static Image getImage(CSSValue value, switch (primitiveValue.getPrimitiveType()) { case CSSPrimitiveValue.CSS_URI: String path = primitiveValue.getStringValue(); - return loadImageFromURL(path, manager); + return loadImageFromURL(path, manager, widget); } return null; } - private static Image loadImageFromURL(String path, - IResourcesLocatorManager manager) throws Exception { + private static Image loadImageFromURL(String path, IResourcesLocatorManager manager, Widget widget) + throws Exception { Image result = null; String s = manager.resolve(path); if (!StringUtils.isEmpty(s)) { - result = ImageDescriptor.createFromURL(new URL(s)).createImage(); + ImageDescriptor desc = ImageDescriptor.createFromURL(new URL(s)); + if (widget != null && s.endsWith(".svg")) { //$NON-NLS-1$ + RGB filterColor = (RGB) widget.getData(CSSSWTConstants.CSS_SVG_FILTER_COLOR); + if (filterColor != null) { + desc = ImageDescriptor.createWithColorMatrix(desc, + new ColorMatrix(new float[] { 0, 0, 0, 0, filterColor.red / 255f, 0, 0, 0, 0, + filterColor.green / 255f, 0, 0, 0, 0, filterColor.blue / 255f, 0, 0, 0, 1, 0 })); + } + } + result = desc.createImage(); } return result; diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java index 04d0c62cd2d..a9d914e82eb 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java @@ -20,6 +20,7 @@ import org.eclipse.e4.ui.css.swt.helpers.CSSSWTImageHelper; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Widget; import org.w3c.dom.css.CSSValue; public class CSSValueSWTImageConverterImpl extends AbstractCSSValueConverter { @@ -33,9 +34,19 @@ public CSSValueSWTImageConverterImpl() { @Override public Object convert(CSSValue value, CSSEngine engine, Object context) throws Exception { - Display display = (Display) context; + Display display = null; + Widget widget = null; + if (context instanceof Display) { + display = (Display) context; + } else if (context instanceof Widget) { + widget = (Widget) context; + display = widget.getDisplay(); + } + if (display == null) { + return null; + } return CSSSWTImageHelper.getImage(value, engine - .getResourcesLocatorManager(), display); + .getResourcesLocatorManager(), display, widget); } @Override diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java index 14ace740aa8..6652b9c32f4 100644 --- a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java @@ -113,8 +113,7 @@ public void applyCSSPropertyBackgroundImage(Object element, CSSValue value, String pseudo, CSSEngine engine) throws Exception { // Widget control = (Widget) element; Widget widget = (Widget) ((WidgetElement) element).getNativeWidget(); - Image image = (Image) engine.convert(value, Image.class, - widget.getDisplay()); + Image image = (Image) engine.convert(value, Image.class, widget); if (widget instanceof CTabFolder && "selected".equals(pseudo)) { ((CTabFolder) widget).setSelectionBackground(image); } else if (widget instanceof Button button) { diff --git a/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySVGFilterSWTHandler.java b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySVGFilterSWTHandler.java new file mode 100644 index 00000000000..3fb959f2461 --- /dev/null +++ b/bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySVGFilterSWTHandler.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * Copyright (c) 2021, 2025 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.e4.ui.css.swt.properties.custom; + +import org.eclipse.e4.ui.css.core.dom.properties.ICSSPropertyHandler; +import org.eclipse.e4.ui.css.core.engine.CSSEngine; +import org.eclipse.e4.ui.css.swt.CSSSWTConstants; +import org.eclipse.e4.ui.css.swt.helpers.SWTElementHelpers; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.widgets.Widget; +import org.w3c.dom.css.CSSPrimitiveValue; +import org.w3c.dom.css.CSSValue; +import org.w3c.dom.css.CSSValueList; + +public class CSSPropertySVGFilterSWTHandler implements ICSSPropertyHandler { + + @Override + public boolean applyCSSProperty(Object element, String property, CSSValue value, String pseudo, CSSEngine engine) + throws Exception { + Widget widget = SWTElementHelpers.getWidget(element); + if (widget == null) { + return false; + } + if (value.getCssValueType() == CSSValue.CSS_VALUE_LIST) { + CSSValueList list = (CSSValueList) value; + if (list.getLength() == 2) { + CSSValue first = list.item(0); + if (first instanceof CSSPrimitiveValue) { + String text = ((CSSPrimitiveValue) first).getStringValue(); + if ("color".equalsIgnoreCase(text)) { //$NON-NLS-1$ + CSSValue second = list.item(1); + Color color = (Color) engine.convert(second, Color.class, widget.getDisplay()); + if (color != null) { + widget.setData(CSSSWTConstants.CSS_SVG_FILTER_COLOR, color.getRGB()); + return true; + } + } + } + } + } + if (value instanceof CSSPrimitiveValue) { + String text = ((CSSPrimitiveValue) value).getStringValue(); + if ("none".equalsIgnoreCase(text)) { //$NON-NLS-1$ + widget.setData(CSSSWTConstants.CSS_SVG_FILTER_COLOR, null); + return true; + } + // Handle single color value as well, just in case + Color color = (Color) engine.convert(value, Color.class, widget.getDisplay()); + if (color != null) { + widget.setData(CSSSWTConstants.CSS_SVG_FILTER_COLOR, color.getRGB()); + return true; + } + } + return false; + } + + @Override + public String retrieveCSSProperty(Object element, String property, String pseudo, CSSEngine engine) + throws Exception { + Widget widget = SWTElementHelpers.getWidget(element); + if (widget != null) { + Object data = widget.getData(CSSSWTConstants.CSS_SVG_FILTER_COLOR); + if (data != null) { + return "color " + data.toString(); //$NON-NLS-1$ + } + } + return "none"; //$NON-NLS-1$ + } +} diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrix.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrix.java new file mode 100644 index 00000000000..e23c6670037 --- /dev/null +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrix.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * Copyright (c) 2021, 2025 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jface.resource; + +import java.util.Arrays; + +/** + * A color matrix is a 5x4 matrix that can be used to transform colors of an + * image. + * + * @since 3.24 + */ +public final class ColorMatrix { + private final float[] matrix; + + /** + * Creates a new color matrix from the given 20 elements. + * + * @param matrix the 20 elements of the matrix + * @throws IllegalArgumentException if the matrix does not have 20 elements + */ + public ColorMatrix(float[] matrix) { + if (matrix.length != 20) { + throw new IllegalArgumentException("Matrix must have 20 elements"); //$NON-NLS-1$ + } + this.matrix = Arrays.copyOf(matrix, 20); + } + + /** + * Returns the 20 elements of the matrix. + * + * @return the matrix elements + */ + public float[] getMatrix() { + return Arrays.copyOf(matrix, 20); + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ColorMatrix other)) { + return false; + } + return Arrays.equals(matrix, other.matrix); + } + + @Override + public int hashCode() { + return Arrays.hashCode(matrix); + } + + @Override + public String toString() { + return "ColorMatrix " + Arrays.toString(matrix); //$NON-NLS-1$ + } +} diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrixImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrixImageDescriptor.java new file mode 100644 index 00000000000..238a1ca83ab --- /dev/null +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrixImageDescriptor.java @@ -0,0 +1,125 @@ +/******************************************************************************* + * Copyright (c) 2021, 2025 IBM Corporation and others. + * + * This program and the accompanying materials + * are made available under the terms of the Eclipse Public License 2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/legal/epl-2.0/ + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.jface.resource; + +import java.util.Objects; + +import org.eclipse.swt.graphics.ImageData; +import org.eclipse.swt.graphics.PaletteData; +import org.eclipse.swt.graphics.RGB; + +/** + * An image descriptor that applies a color matrix to another image descriptor. + */ +final class ColorMatrixImageDescriptor extends ImageDescriptor { + private final ImageDescriptor original; + private final ColorMatrix matrix; + + ColorMatrixImageDescriptor(ImageDescriptor original, ColorMatrix matrix) { + super(original.shouldBeCached()); + this.original = original; + this.matrix = Objects.requireNonNull(matrix); + } + + @Override + public ImageData getImageData(int zoom) { + ImageData data = original.getImageData(zoom); + if (data == null) { + return null; + } + float[] m = matrix.getMatrix(); + + ImageData result = (ImageData) data.clone(); + PaletteData palette = result.palette; + if (palette.isDirect) { + for (int y = 0; y < result.height; y++) { + for (int x = 0; x < result.width; x++) { + int pixel = result.getPixel(x, y); + int alpha = result.getAlpha(x, y); + + float r = ((pixel & palette.redMask) >>> Math.abs(palette.redShift)) / 255f; + float g = ((pixel & palette.greenMask) >>> Math.abs(palette.greenShift)) / 255f; + float b = ((pixel & palette.blueMask) >>> Math.abs(palette.blueShift)) / 255f; + float a = alpha / 255f; + + float nr = m[0] * r + m[1] * g + m[2] * b + m[3] * a + m[4]; + float ng = m[5] * r + m[6] * g + m[7] * b + m[8] * a + m[9]; + float nb = m[10] * r + m[11] * g + m[12] * b + m[13] * a + m[14]; + float na = m[15] * r + m[16] * g + m[17] * b + m[18] * a + m[19]; + + int inr = Math.min(255, Math.max(0, Math.round(nr * 255))); + int ing = Math.min(255, Math.max(0, Math.round(ng * 255))); + int inb = Math.min(255, Math.max(0, Math.round(nb * 255))); + int ina = Math.min(255, Math.max(0, Math.round(na * 255))); + + int newPixel = (inr << Math.abs(palette.redShift)) & palette.redMask + | (ing << Math.abs(palette.greenShift)) & palette.greenMask + | (inb << Math.abs(palette.blueShift)) & palette.blueMask; + + result.setPixel(x, y, newPixel); + result.setAlpha(x, y, ina); + } + } + } else { + // Indexed palette + RGB[] rgbs = palette.getRGBs(); + RGB[] newRgbs = new RGB[rgbs.length]; + for (int i = 0; i < rgbs.length; i++) { + RGB rgb = rgbs[i]; + float r = rgb.red / 255f; + float g = rgb.green / 255f; + float b = rgb.blue / 255f; + float a = 1f; // Indexed palette doesn't have per-pixel alpha usually, or it's handled separately + + float nr = m[0] * r + m[1] * g + m[2] * b + m[3] * a + m[4]; + float ng = m[5] * r + m[6] * g + m[7] * b + m[8] * a + m[9]; + float nb = m[10] * r + m[11] * g + m[12] * b + m[13] * a + m[14]; + + int inr = Math.min(255, Math.max(0, Math.round(nr * 255))); + int ing = Math.min(255, Math.max(0, Math.round(ng * 255))); + int inb = Math.min(255, Math.max(0, Math.round(nb * 255))); + + newRgbs[i] = new RGB(inr, ing, inb); + } + result.palette = new PaletteData(newRgbs); + // Alpha is still per-pixel in ImageData even for indexed palettes + for (int y = 0; y < result.height; y++) { + for (int x = 0; x < result.width; x++) { + int alpha = result.getAlpha(x, y); + float a = alpha / 255f; + float na = m[15] * 0 + m[16] * 0 + m[17] * 0 + m[18] * a + m[19]; // Simplified + int ina = Math.min(255, Math.max(0, Math.round(na * 255))); + result.setAlpha(x, y, ina); + } + } + } + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!(obj instanceof ColorMatrixImageDescriptor other)) { + return false; + } + return original.equals(other.original) && matrix.equals(other.matrix); + } + + @Override + public int hashCode() { + return original.hashCode() ^ matrix.hashCode(); + } +} diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java index 5c658690766..aedaaf22eab 100644 --- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java +++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java @@ -169,6 +169,26 @@ public static ImageDescriptor createWithFlags(ImageDescriptor originalImage, int return new DerivedImageDescriptor(originalImage, swtFlags); } + /** + * Creates an ImageDescriptor based on the given original descriptor, but with a + * color matrix filter applied. + * + *

+ * Note that this sort of ImageDescriptor is slower and consumes more resources + * than a regular image descriptor. It will also never generate results that + * look as nice as a hand-drawn image. + *

+ * + * @param originalImage image to transform + * @param matrix the color matrix to apply + * @return an ImageDescriptor that creates new images by transforming the given + * image descriptor + * @since 3.24 + */ + public static ImageDescriptor createWithColorMatrix(ImageDescriptor originalImage, ColorMatrix matrix) { + return new ColorMatrixImageDescriptor(originalImage, matrix); + } + /** * Creates and returns a new image descriptor for the given image. This * method takes the Device that created the Image as an argument, allowing