diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/GenericCommandActionDelegate.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/GenericCommandActionDelegate.java index 56970b98156a..a17476d22bb7 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/GenericCommandActionDelegate.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/GenericCommandActionDelegate.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2017 IBM Corporation and others. + * Copyright (c) 2006, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -108,18 +108,11 @@ public void setInitializationData(IConfigurationElement config, } else if (data instanceof Map) { parameterMap = (Map) data; if (parameterMap.get(PARM_COMMAND_ID) == null) { - Status status = new Status(IStatus.ERROR, - "org.eclipse.ui.tests", "The '" + id - + "' action won't work without a commandId"); + IStatus status = Status.error("The '" + id + "' action won't work without a commandId"); throw new CoreException(status); } } else { - Status status = new Status( - IStatus.ERROR, - "org.eclipse.ui.tests", - "The '" - + id - + "' action won't work without some initialization parameters"); + IStatus status = Status.error("The '" + id + "' action won't work without some initialization parameters"); throw new CoreException(status); } } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIErrorDialogs.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIErrorDialogs.java index 07028cd5d1e7..00856368a60c 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIErrorDialogs.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIErrorDialogs.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 IBM Corporation and others. + * Copyright (c) 2000, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -35,15 +35,12 @@ private Shell getShell() { private ErrorDialog getMultiStatusErrorDialog() { IStatus[] childStatuses = new IStatus[2]; - childStatuses[0] = new Status(IStatus.ERROR, "org.eclipse.ui.tests", - IStatus.ERROR, "Error message 1", new Throwable()); - childStatuses[1] = new Status(IStatus.ERROR, "org.eclipse.ui.tests", - IStatus.ERROR, "Error message 2", new Throwable()); - MultiStatus mainStatus = new MultiStatus("org.eclipse.ui.tests", - IStatus.ERROR, childStatuses, "Main error", new Throwable()); - - return new ErrorDialog(getShell(), "Error Test", "Error message", - mainStatus, IStatus.ERROR); + childStatuses[0] = Status.error("Error message 1", new Throwable()); + childStatuses[1] = Status.error("Error message 2", new Throwable()); + MultiStatus mainStatus = new MultiStatus("org.eclipse.ui.tests", IStatus.ERROR, childStatuses, "Main error", + new Throwable()); + + return new ErrorDialog(getShell(), "Error Test", "Error message", mainStatus, IStatus.ERROR); } @Test diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/VirtualTestFileStore.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/VirtualTestFileStore.java index e27d9c59a8e8..f6edc10a0a17 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/VirtualTestFileStore.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/VirtualTestFileStore.java @@ -18,7 +18,6 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; /** @@ -112,8 +111,7 @@ public InputStream openInputStream(int options, IProgressMonitor monitor) throws if (contents != null) { return new ByteArrayInputStream(contents); } - throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.ui.tests", //$NON-NLS-1$ - "File does not exist: " + toURI())); //$NON-NLS-1$ + throw new CoreException(Status.error("File does not exist: " + toURI())); //$NON-NLS-1$ } @Override @@ -133,16 +131,14 @@ public IFileStore mkdir(int options, IProgressMonitor monitor) throws CoreExcept IFileInfo info = fetchInfo(); if (info.exists()) { if (!info.isDirectory()) { - throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.ui.tests", //$NON-NLS-1$ - "mkdir failed - file already exists with name: " + toURI())); //$NON-NLS-1$ + throw new CoreException(Status.error("mkdir failed - file already exists with name: " + toURI())); //$NON-NLS-1$ } } else { IFileStore parent = getParent(); if (parent.fetchInfo().exists()) { VirtualTestFileSystem.getDefault().setContents(toURI(), VirtualTestFileSystem.DIRECTORY_BYTES); } else if ((options & EFS.SHALLOW) > 0) { - throw new CoreException(new Status(IStatus.ERROR, "org.eclipse.ui.tests", //$NON-NLS-1$ - "mkdir failed - parent does not exist: " + toURI())); //$NON-NLS-1$ + throw new CoreException(Status.error("mkdir failed - parent does not exist: " + toURI())); //$NON-NLS-1$ } else { parent.mkdir(EFS.NONE, null); } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/TestBackgroundSaveEditor.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/TestBackgroundSaveEditor.java index 787bc1dd80fe..4753edd29345 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/TestBackgroundSaveEditor.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/TestBackgroundSaveEditor.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006, 2023 IBM Corporation and others. + * Copyright (c) 2006, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -93,9 +93,7 @@ public IJobRunnable doSave(IProgressMonitor monitor, monitor.worked(1); } if (data.throwExceptionInForeground) { - throw new CoreException(new Status(IStatus.ERROR, - "org.eclipse.ui.tests", - "Saving in the foreground failed")); + throw new CoreException(Status.error("Saving in the foreground failed")); } monitor.done(); if (!data.saveInBackground) { @@ -119,7 +117,7 @@ public IJobRunnable doSave(IProgressMonitor monitor, monitor1.worked(1); } if (data.throwExceptionInBackground) { - return new Status(IStatus.ERROR, "org.eclipse.ui.tests", "Saving in the background failed"); + return Status.error("Saving in the background failed"); } data.setOutput(data.getInput()); setDirty(false); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/AccumulatingProgressMonitorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/AccumulatingProgressMonitorTest.java index 6f17408b2b8a..86f5608a18f5 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/AccumulatingProgressMonitorTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/AccumulatingProgressMonitorTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016, 2021 Red Hat Inc. and others. + * Copyright (c) 2016, 2026 Red Hat Inc. and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -207,7 +207,7 @@ public void run() { wrapper.worked(10); wrapper.isCanceled(); wrapper.setCanceled(false); - wrapper.setBlocked(new Status(IStatus.ERROR, "org.eclipse.ui.tests", "Some Error")); + wrapper.setBlocked(Status.error("Some Error")); uiSemaphore.release(); uiReleaseCount++; diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java index b18785a96819..dd17cdb97380 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/progress/ProgressContantsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2024 IBM Corporation and others. + * Copyright (c) 2009, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -219,7 +219,7 @@ public void testKeepOneProperty() throws Exception { // Solution is to add an unique job after the 'keep one' jobs are finished and // wait for it's appearance. The UI updates are ordered enough to be sure that // kept job processing is finished when this error job appears. - DummyJob errorJob = new DummyJob("Last Job", new Status(IStatus.ERROR, TestPlugin.PLUGIN_ID, "error")); + DummyJob errorJob = new DummyJob("Last Job", Status.error("error")); errorJob.schedule(); processEventsUntil(() -> findProgressInfoItem(errorJob) != null, 3000); } @@ -252,7 +252,7 @@ public void testKeepOneProperty() throws Exception { // Process events to ensure job completion events are handled processEvents(); { - DummyJob errorJob = new DummyJob("Last Job", new Status(IStatus.ERROR, TestPlugin.PLUGIN_ID, "error")); + DummyJob errorJob = new DummyJob("Last Job", Status.error("error")); errorJob.schedule(); processEventsUntil(() -> findProgressInfoItem(errorJob) != null, 3000); } diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/LabelProviderWrapperTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/LabelProviderWrapperTest.java index 9c8788f0f0d0..a8ea801624f3 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/LabelProviderWrapperTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/LabelProviderWrapperTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2017 IBM Corporation and others. + * Copyright (c) 2009, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -100,13 +100,13 @@ public Image getColumnImage(Object element, int columnIndex) { @Test public void testImages(){ - StatusAdapter saError = new StatusAdapter(new Status(IStatus.ERROR, "org.eclipse.ui.tests", "errorMessage")); + StatusAdapter saError = new StatusAdapter(Status.error("errorMessage")); assertEquals(wrapper.getSWTImage(SWT.ICON_ERROR), wrapper.getImage(saError)); - StatusAdapter saWarning = new StatusAdapter(new Status(IStatus.WARNING, "org.eclipse.ui.tests", "warningMessage")); + StatusAdapter saWarning = new StatusAdapter(Status.warning("warningMessage")); assertEquals(wrapper.getSWTImage(SWT.ICON_WARNING), wrapper.getImage(saWarning)); - StatusAdapter saInfo = new StatusAdapter(new Status(IStatus.INFO, "org.eclipse.ui.tests", "infoMessage")); + StatusAdapter saInfo = new StatusAdapter(Status.info("infoMessage")); assertEquals(wrapper.getSWTImage(SWT.ICON_INFORMATION), wrapper.getImage(saInfo)); StatusAdapter cancelOK = new StatusAdapter(new Status(IStatus.CANCEL, "org.eclipse.ui.tests", "cancelMessage")); @@ -125,7 +125,7 @@ public void testProvidedText_1(){ final String title = "title"; final String message = "errorMessage"; - StatusAdapter saError = new StatusAdapter(new Status(IStatus.ERROR, "org.eclipse.ui.tests", message)); + StatusAdapter saError = new StatusAdapter(Status.error(message)); saError.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, title); assertEquals(title, wrapper.getMainMessage(saError)); @@ -144,26 +144,19 @@ public void testDecorating(){ dialogState.put(IStatusDialogConstants.DECORATOR, new ILabelDecorator() { @Override public void removeListener(ILabelProviderListener listener) { - // TODO Auto-generated method stub - } @Override public boolean isLabelProperty(Object element, String property) { - // TODO Auto-generated method stub return false; } @Override public void dispose() { - // TODO Auto-generated method stub - } @Override public void addListener(ILabelProviderListener listener) { - // TODO Auto-generated method stub - } @Override @@ -173,11 +166,10 @@ public String decorateText(String text, Object element) { @Override public Image decorateImage(Image image, Object element) { - // TODO Auto-generated method stub return null; } }); - StatusAdapter saError = new StatusAdapter(new Status(IStatus.ERROR, "org.eclipse.ui.tests", "message")); + StatusAdapter saError = new StatusAdapter(Status.error("message")); saError.setProperty(IStatusAdapterConstants.TITLE_PROPERTY, "title"); assertEquals("decoratedtitle", wrapper.getMainMessage(saError)); assertEquals("decoratedmessage", wrapper.getSecondaryMessage(saError)); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/StatusDialogManagerTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/StatusDialogManagerTest.java index b870aa0e74cc..d24d6a1fe597 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/StatusDialogManagerTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/StatusDialogManagerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008, 2020 IBM Corporation and others. + * Copyright (c) 2008, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -693,8 +693,7 @@ public void testBug260937(){ @Test public void testBug276371(){ - StatusAdapter bomb = new StatusAdapter(new Status(IStatus.ERROR, - "org.eclipse.ui.tests", "bomb"){ + StatusAdapter bomb = new StatusAdapter(new Status(IStatus.ERROR, "org.eclipse.ui.tests", "bomb") { int i = 0; @Override @@ -969,7 +968,7 @@ public void testBug288765() { selectWidget(StatusDialogUtil.getOkButton()); MultiStatus ms = new MultiStatus("org.eclipse.ui.tests", 0, MESSAGE_1, null); for (int i = 0; i < 50; i++) { - ms.add(new Status(IStatus.ERROR, "org.eclipse.ui.tests", MESSAGE_2)); + ms.add(Status.error(MESSAGE_2)); } wsdm.addStatusAdapter(new StatusAdapter(ms), false); shell = StatusDialogUtil.getStatusShell(); @@ -1307,8 +1306,7 @@ private void selectWidget(Widget control) { * @return created StatusAdapter */ private StatusAdapter createStatusAdapter(String message) { - return new StatusAdapter(new Status(IStatus.ERROR, - "org.eclipse.ui.tests", message)); + return new StatusAdapter(Status.error(message)); } /** @@ -1322,8 +1320,7 @@ private StatusAdapter createStatusAdapter(String message) { */ private StatusAdapter createStatusAdapter(String message, Throwable throwable) { - return new StatusAdapter(new Status(IStatus.ERROR, - "org.eclipse.ui.tests", message, throwable)); + return new StatusAdapter(Status.error(message, throwable)); } /** diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/SupportTrayTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/SupportTrayTest.java index c20062655d95..8861f5f289c7 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/SupportTrayTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/SupportTrayTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009, 2018 IBM Corporation and others. + * Copyright (c) 2009, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -69,8 +69,7 @@ public void handleEvent(Event event) { @Test public void testDefaultSupportProviderEnablement(){ Map dialogState = new HashMap<>(); - Status status = new Status(IStatus.ERROR, "org.eclipse.ui.test", - "Message.", new NullPointerException()); + IStatus status = Status.error("Message.", new NullPointerException()); StatusAdapter sa = new StatusAdapter(status); dialogState.put(IStatusDialogConstants.CURRENT_STATUS_ADAPTER, sa); SupportTray st = new SupportTray(dialogState, new NullListener()); diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/WorkbenchStatusDialogManagerImplTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/WorkbenchStatusDialogManagerImplTest.java index eeefac3734e3..729259c54046 100644 --- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/WorkbenchStatusDialogManagerImplTest.java +++ b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/statushandlers/WorkbenchStatusDialogManagerImplTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 IBM Corporation and others. + * Copyright (c) 2009, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -18,7 +18,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; -import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.ui.internal.statushandlers.IStatusDialogConstants; @@ -80,21 +79,21 @@ public void testCheckMasking(){ @Test public void testCheckRecognizingImmediatePrompting1(){ //no property - StatusAdapter sa = new StatusAdapter(new Status(IStatus.ERROR, "org.eclipse.ui.tests", "message")); + StatusAdapter sa = new StatusAdapter(Status.error("message")); assertTrue(mgr.shouldPrompt(sa)); } @Test public void testCheckRecognizingImmediatePrompting2(){ //property set to false - StatusAdapter sa = new StatusAdapter(new Status(IStatus.ERROR, "org.eclipse.ui.tests", "message")); + StatusAdapter sa = new StatusAdapter(Status.error("message")); sa.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.FALSE); assertTrue(mgr.shouldPrompt(sa)); } @Test public void testCheckRecognizingNonImmediatePrompting(){ - StatusAdapter sa = new StatusAdapter(new Status(IStatus.ERROR, "org.eclipse.ui.tests", "message")); + StatusAdapter sa = new StatusAdapter(Status.error("message")); sa.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE); assertFalse(mgr.shouldPrompt(sa)); }