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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -108,18 +108,11 @@ public void setInitializationData(IConfigurationElement config,
} else if (data instanceof Map) {
parameterMap = (Map<String, String>) 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);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down Expand Up @@ -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
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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++;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"));
Expand All @@ -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));
Expand All @@ -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
Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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));
}

/**
Expand All @@ -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));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -69,8 +69,7 @@ public void handleEvent(Event event) {
@Test
public void testDefaultSupportProviderEnablement(){
Map<Object, Object> 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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand Down Expand Up @@ -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));
}
Expand Down
Loading