Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStéphane Bégaudeau2016-02-03 10:43:55 +0000
committerPierre-Charles David2016-02-04 09:56:05 +0000
commitd7f35f193b6d44b57a00c83901075a4f3f13bf36 (patch)
treef63e0267635ee8721706d6c26362abfb8db5ee40
parent601c98fb0660da06d5befa2eda7bfaa6e955cbc8 (diff)
downloadorg.eclipse.sirius-d7f35f193b6d44b57a00c83901075a4f3f13bf36.tar.gz
org.eclipse.sirius-d7f35f193b6d44b57a00c83901075a4f3f13bf36.tar.xz
org.eclipse.sirius-d7f35f193b6d44b57a00c83901075a4f3f13bf36.zip
[482528] Use the new superclass for the activator to improve logging
Bug: 482528 Change-Id: I0e49369e51c3e9ccc9583e43fa0d09d6b26d5470 Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
-rw-r--r--incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusUIPropertiesPlugin.java77
-rw-r--r--incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/SiriusTabDescriptorProvider.java6
2 files changed, 6 insertions, 77 deletions
diff --git a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusUIPropertiesPlugin.java b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusUIPropertiesPlugin.java
index 558cf6ab94..64192c0b22 100644
--- a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusUIPropertiesPlugin.java
+++ b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/SiriusUIPropertiesPlugin.java
@@ -10,9 +10,7 @@
*******************************************************************************/
package org.eclipse.sirius.ui.properties.internal;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.eef.core.api.AbstractEEFEclipsePlugin;
import org.eclipse.emf.common.EMFPlugin;
import org.eclipse.emf.common.util.ResourceLocator;
@@ -64,84 +62,15 @@ public class SiriusUIPropertiesPlugin extends EMFPlugin {
*
* @author sbegaudeau
*/
- public static class Implementation extends EclipsePlugin {
+ public static class Implementation extends AbstractEEFEclipsePlugin {
/**
* The constructor.
*/
public Implementation() {
- super();
+ super(PLUGIN_ID);
SiriusUIPropertiesPlugin.plugin = this;
}
- /**
- * Logs the status.
- *
- * @param severity
- * The severity of the status
- * @param message
- * The message to log or <code>null</code>. If the message is
- * <code>null</code>, the message of the exception will be
- * used instead
- * @param exception
- * The exception to log
- */
- private void doLog(int severity, String message, Exception exception) {
- String messageToLog = message;
- if (messageToLog == null && exception != null) {
- messageToLog = exception.getMessage();
- }
- IStatus status = new Status(severity, PLUGIN_ID, messageToLog, exception);
- this.getLog().log(status);
- }
-
- /**
- * Logs an error with the exception and the given message.
- *
- * @param message
- * The message
- * @param exception
- * The exception
- */
- public void error(String message, Exception exception) {
- if (exception instanceof CoreException) {
- this.getLog().log(((CoreException) exception).getStatus());
- } else {
- this.doLog(IStatus.ERROR, message, exception);
- }
- }
-
- /**
- * Logs a warning with the exception and the given message.
- *
- * @param message
- * The message
- * @param exception
- * The exception
- */
- public void warning(String message, Exception exception) {
- if (exception instanceof CoreException) {
- this.getLog().log(((CoreException) exception).getStatus());
- } else {
- this.doLog(IStatus.WARNING, message, exception);
- }
- }
-
- /**
- * Logs an info with the exception and the given message.
- *
- * @param message
- * The message
- * @param exception
- * The exception
- */
- public void info(String message, Exception exception) {
- if (exception instanceof CoreException) {
- this.getLog().log(((CoreException) exception).getStatus());
- } else {
- this.doLog(IStatus.INFO, message, exception);
- }
- }
-
}
}
diff --git a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/SiriusTabDescriptorProvider.java b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/SiriusTabDescriptorProvider.java
index 72b68686c8..f7bdf04b52 100644
--- a/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/SiriusTabDescriptorProvider.java
+++ b/incubation/org.eclipse.sirius.ui.properties/src/org/eclipse/sirius/ui/properties/internal/tabprovider/SiriusTabDescriptorProvider.java
@@ -71,14 +71,14 @@ public class SiriusTabDescriptorProvider implements IEEFTabDescriptorProvider {
// FIXME We take the first one
if (objects.length > 0) {
if (objects.length > 1) {
- SiriusUIPropertiesPlugin.getPlugin().warning(Messages.SiriusTabDescriptorProvider_UnsupportedMultipleSelection, null);
+ SiriusUIPropertiesPlugin.getPlugin().warning(Messages.SiriusTabDescriptorProvider_UnsupportedMultipleSelection);
}
SiriusContext ctx = SiriusContext.from(objects[0]);
if (ctx.getMainSemanticElement().some()) {
// Let's find out the description of the view
return this.getTabDescriptors(ctx.getMainSemanticElement().get());
} else {
- SiriusUIPropertiesPlugin.getPlugin().error(Messages.SiriusTabDescriptorProvider_UndefinedSemanticElement, null);
+ SiriusUIPropertiesPlugin.getPlugin().error(Messages.SiriusTabDescriptorProvider_UndefinedSemanticElement);
}
}
}
@@ -152,7 +152,7 @@ public class SiriusTabDescriptorProvider implements IEEFTabDescriptorProvider {
effectivePages.addAll(viewExtensionDescription.getPages());
}
} else {
- SiriusUIPropertiesPlugin.getPlugin().error(Messages.SiriusTabDescriptorProvider_DefaultPropertiesNotFound, null);
+ SiriusUIPropertiesPlugin.getPlugin().error(Messages.SiriusTabDescriptorProvider_DefaultPropertiesNotFound);
}
}

Back to the top