Bug 458226 - Use StatusReporter in org.eclipse.ui.ide
Change-Id: Ie57c2eca2a7d364d94ad036c3b3640ef7d276d01
Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
diff --git a/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
index 0dc4efb..f956ec1 100644
--- a/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.ui.ide/META-INF/MANIFEST.MF
@@ -55,6 +55,7 @@
org.eclipse.ui.forms;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
org.eclipse.equinox.p2.engine;bundle-version="[2.0.0,3.0.0)",
org.eclipse.equinox.p2.metadata;bundle-version="[2.0.0,3.0.0)",
- org.eclipse.equinox.bidi;bundle-version="[0.10.0,2.0.0)"
+ org.eclipse.equinox.bidi;bundle-version="[0.10.0,2.0.0)",
+ org.eclipse.e4.core.services;bundle-version="2.0.0"
Import-Package: com.ibm.icu.text
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/ShowInSystemExplorerHandler.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/ShowInSystemExplorerHandler.java
index 01ab781..eaaf710 100644
--- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/ShowInSystemExplorerHandler.java
+++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/handlers/ShowInSystemExplorerHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+ * Copyright (c) 2013, 2015 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,7 +10,6 @@
******************************************************************************/
package org.eclipse.ui.internal.ide.handlers;
-
import java.io.File;
import java.io.IOException;
@@ -23,6 +22,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.e4.core.services.statusreporter.StatusReporter;
import org.eclipse.jface.util.Util;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
@@ -36,6 +36,7 @@
import org.eclipse.ui.internal.ide.IDEWorkbenchMessages;
import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
+
/**
* @since 3.106
*/
@@ -58,6 +59,9 @@
return null;
}
+ final StatusReporter statusReporter = HandlerUtil.getActiveWorkbenchWindow(event).getService(
+ StatusReporter.class);
+
Job job = new Job(IDEWorkbenchMessages.ShowInSystemExplorerHandler_jobTitle) {
@Override
@@ -73,22 +77,14 @@
try {
File canonicalPath = getSystemExplorerPath(item);
if (canonicalPath == null) {
- return new Status(
- IStatus.ERROR,
- IDEWorkbenchPlugin.getDefault().getBundle()
- .getSymbolicName(),
- logMsgPrefix
- + IDEWorkbenchMessages.ShowInSystemExplorerHandler_notDetermineLocation);
+ return statusReporter.newStatus(IStatus.ERROR, logMsgPrefix
+ + IDEWorkbenchMessages.ShowInSystemExplorerHandler_notDetermineLocation, null);
}
String launchCmd = formShowInSytemExplorerCommand(canonicalPath);
if ("".equals(launchCmd)) { //$NON-NLS-1$
- return new Status(
- IStatus.ERROR,
- IDEWorkbenchPlugin.getDefault().getBundle()
- .getSymbolicName(),
- logMsgPrefix
- + IDEWorkbenchMessages.ShowInSystemExplorerHandler_commandUnavailable);
+ return statusReporter.newStatus(IStatus.ERROR, logMsgPrefix
+ + IDEWorkbenchMessages.ShowInSystemExplorerHandler_commandUnavailable, null);
}
File dir = item.getWorkspace().getRoot().getLocation().toFile();
@@ -100,19 +96,14 @@
}
int retCode = p.waitFor();
if (retCode != 0 && !Util.isWindows()) {
- return new Status(IStatus.ERROR, IDEWorkbenchPlugin
- .getDefault().getBundle().getSymbolicName(),
- logMsgPrefix + "Execution of '" + launchCmd //$NON-NLS-1$
- + "' failed with return code: " + retCode); //$NON-NLS-1$
+ return statusReporter.newStatus(IStatus.ERROR, "Execution of '" + launchCmd //$NON-NLS-1$
+ + "' failed with return code: " + retCode, null); //$NON-NLS-1$
}
} catch (Exception e) {
- return new Status(IStatus.ERROR, IDEWorkbenchPlugin.getDefault()
- .getBundle().getSymbolicName(), logMsgPrefix
- + "Unhandled failure.", e); //$NON-NLS-1$
+ return statusReporter.newStatus(IStatus.ERROR, logMsgPrefix + "Unhandled failure.", e); //$NON-NLS-1$
}
return Status.OK_STATUS;
}
-
};
job.schedule();
return null;