Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2018-12-14 15:36:52 +0000
committerLars Vogel2018-12-15 20:22:04 +0000
commita3e71bad48d64f849c072afda3dc528f42e1a251 (patch)
treec37ef6d3031ac93f4f758e9d45ecf2a59701ef91
parentf90c5e698f500d07ac129ac3cb27ab8e50f9776c (diff)
downloadeclipse.platform.ui-a3e71bad48d64f849c072afda3dc528f42e1a251.tar.gz
eclipse.platform.ui-a3e71bad48d64f849c072afda3dc528f42e1a251.tar.xz
eclipse.platform.ui-a3e71bad48d64f849c072afda3dc528f42e1a251.zip
org.eclipse.ui.internal.ideStatusUtil.newError Change-Id: Id37185138a4b53b8886ae8b955c1ea3a882805ef Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java4
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/StatusUtil.java16
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java7
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkCompletedHandler.java4
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerFieldFilterGroup.java4
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerSupportInternalUtilities.java9
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkersPropertyPage.java5
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/QuickFixWizard.java12
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java8
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/MarkerViewHandler.java3
10 files changed, 27 insertions, 45 deletions
diff --git a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java
index 87f8d8fe308..3197453ab66 100644
--- a/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java
+++ b/bundles/org.eclipse.ui.ide.application/src/org/eclipse/ui/internal/ide/application/IDEApplication.java
@@ -599,8 +599,8 @@ public class IDEApplication implements IApplication, IExecutableExtension {
props.store(output, null);
} catch (IOException e) {
- IDEWorkbenchPlugin.log("Could not write version file", //$NON-NLS-1$
- StatusUtil.newStatus(IStatus.ERROR, e.getMessage(), e));
+ IDEWorkbenchPlugin.log("Could not write version file", //$NON-NLS-1$
+ StatusUtil.newError(e));
} finally {
try {
if (output != null) {
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/StatusUtil.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/StatusUtil.java
index dbbd5172723..396e548e99a 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/StatusUtil.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/StatusUtil.java
@@ -80,8 +80,7 @@ public class StatusUtil {
* @param exception
* @return {@link IStatus}
*/
- public static IStatus newStatus(int severity, String message,
- Throwable exception) {
+ public static IStatus newStatus(int severity, String message, Throwable exception) {
String statusMessage = message;
if (message == null || message.trim().length() == 0) {
@@ -98,6 +97,18 @@ public class StatusUtil {
statusMessage, exception);
}
+ /**
+ * This method must not be called outside the workbench.
+ *
+ * Utility method for creating error status messages delegating to
+ * <code>StatusUtil{@link #newStatus(int, String, Throwable)}</code>.
+ *
+ * @param exception
+ * @return {@link IStatus}
+ */
+ public static IStatus newError(Throwable exception) {
+ return newStatus(IStatus.ERROR, exception.getLocalizedMessage(), exception);
+ }
/**
* This method must not be called outside the workbench.
@@ -126,5 +137,4 @@ public class StatusUtil {
return newStatus(stati, message, exception);
}
-
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java
index 0ec0e6346be..bd18de3587d 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/CachedMarkerBuilder.java
@@ -18,7 +18,6 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Iterator;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
@@ -260,10 +259,8 @@ public class CachedMarkerBuilder {
SortingJob job = new SortingJob(CachedMarkerBuilder.this);
job.run(monitor);
});
- } catch (InvocationTargetException e) {
- StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, e.getLocalizedMessage(), e));
- } catch (InterruptedException e) {
- StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, e.getLocalizedMessage(), e));
+ } catch (InvocationTargetException | InterruptedException e) {
+ StatusManager.getManager().handle(StatusUtil.newError(e));
}
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkCompletedHandler.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkCompletedHandler.java
index 55b16d267e0..e8d610bba11 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkCompletedHandler.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkCompletedHandler.java
@@ -59,9 +59,7 @@ public class MarkCompletedHandler extends MarkerViewHandler {
execute(op, MarkerMessages.markCompletedAction_title, subMonitor.split(80), null);
});
} catch (InvocationTargetException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- e.getLocalizedMessage(), e), StatusManager.LOG);
+ StatusManager.getManager().handle(StatusUtil.newError(e), StatusManager.LOG);
} catch (InterruptedException e) {
StatusManager.getManager().handle(
StatusUtil.newStatus(IStatus.WARNING, e
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerFieldFilterGroup.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerFieldFilterGroup.java
index 2caf86937d2..8bd78542659 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerFieldFilterGroup.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerFieldFilterGroup.java
@@ -32,7 +32,6 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
@@ -519,8 +518,7 @@ class MarkerFieldFilterGroup {
} catch (InstantiationException | IllegalArgumentException | IllegalAccessException
| InvocationTargetException | NoSuchMethodException
| SecurityException e) {
- StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR, e.getLocalizedMessage(), e),
- StatusManager.SHOW);
+ StatusManager.getManager().handle(StatusUtil.newError(e), StatusManager.SHOW);
return false;
}
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerSupportInternalUtilities.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerSupportInternalUtilities.java
index db7b87777e8..245f3f4389b 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerSupportInternalUtilities.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerSupportInternalUtilities.java
@@ -420,16 +420,11 @@ public class MarkerSupportInternalUtilities {
}
if (status == null)
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- exception.getLocalizedMessage(), exception),
- handlingMethod);
+ StatusManager.getManager().handle(StatusUtil.newError(exception), handlingMethod);
else
StatusManager.getManager().handle(status, handlingMethod);
return;
}
- StatusManager.getManager().handle(StatusUtil.newStatus(IStatus.ERROR,
- exception.getLocalizedMessage(), exception),
- handlingMethod);
+ StatusManager.getManager().handle(StatusUtil.newError(exception), handlingMethod);
}
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkersPropertyPage.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkersPropertyPage.java
index bc37bee4d20..c30b2918eb7 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkersPropertyPage.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkersPropertyPage.java
@@ -24,7 +24,6 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.osgi.util.NLS;
@@ -345,9 +344,7 @@ public class MarkersPropertyPage extends PropertyPage {
((CoreException) e.getCause()).getStatus(),
StatusManager.SHOW);
} else {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR, e
- .getLocalizedMessage(), e));
+ StatusManager.getManager().handle(StatusUtil.newError(e));
}
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/QuickFixWizard.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/QuickFixWizard.java
index 77108e8a8c6..801ab82bb99 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/QuickFixWizard.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/QuickFixWizard.java
@@ -19,7 +19,6 @@ import java.util.Collection;
import java.util.Map;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardPage;
@@ -86,15 +85,8 @@ class QuickFixWizard extends Wizard {
try {
getContainer().run(false, true, finishRunnable);
- } catch (InvocationTargetException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- e.getLocalizedMessage(), e));
- return false;
- } catch (InterruptedException e) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR,
- e.getLocalizedMessage(), e));
+ } catch (InvocationTargetException | InterruptedException e) {
+ StatusManager.getManager().handle(StatusUtil.newError(e));
return false;
}
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java
index de5e8a0a79f..7402a9980c4 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/wizards/datatransfer/WizardProjectsImportPage.java
@@ -1059,9 +1059,7 @@ public class WizardProjectsImportPage extends WizardDataTransferPage {
try {
directoriesVisited.add(directory.getCanonicalPath());
} catch (IOException exception) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR, exception
- .getLocalizedMessage(), exception));
+ StatusManager.getManager().handle(StatusUtil.newError(exception));
}
}
@@ -1091,9 +1089,7 @@ public class WizardProjectsImportPage extends WizardDataTransferPage {
continue;
}
} catch (IOException exception) {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR, exception
- .getLocalizedMessage(), exception));
+ StatusManager.getManager().handle(StatusUtil.newError(exception));
}
collectProjectFilesFromDirectory(files, dir,
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/MarkerViewHandler.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/MarkerViewHandler.java
index 0ff2e6a45bf..cd977fe28f8 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/MarkerViewHandler.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/views/markers/MarkerViewHandler.java
@@ -75,8 +75,7 @@ public abstract class MarkerViewHandler extends AbstractHandler {
StatusManager.SHOW);
} else {
- StatusManager.getManager().handle(
- StatusUtil.newStatus(IStatus.ERROR, title, e));
+ StatusManager.getManager().handle(StatusUtil.newError(e));
}
}
}

Back to the top