diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java index 173234f867a32c572a306e519e4cfa3f87e1cbcb..d76f9fadea560e15ec0d0500bbd0cf1553fc1137 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/EditPartFactoryService.java @@ -19,7 +19,6 @@ package org.fortiss.tooling.kernel.ui.internal; import java.util.List; -import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.ecore.EObject; import org.eclipse.gef.EditPart; import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase; @@ -54,18 +53,17 @@ public class EditPartFactoryService extends public EditPart createEditPart(EditPart context, Object modelElement) { if (!(modelElement instanceof EObject)) { - LoggingUtils.log(ToolingKernelUIActivator.getDefault(), + LoggingUtils.error(ToolingKernelUIActivator.getDefault(), EditPartFactoryService.class.getSimpleName() - + " may only be used for EObjects!", IStatus.ERROR); + + " may only be used for EObjects!"); return null; } Class<? extends EObject> clazz = ((EObject) modelElement).getClass(); List<IEditPartFactory<EObject>> factories = getRegisteredHandlers(clazz); if (factories == null || factories.isEmpty()) { - LoggingUtils.log(ToolingKernelUIActivator.getDefault(), - "No editpart factory registered for " + clazz.getName(), - IStatus.ERROR); + LoggingUtils.error(ToolingKernelUIActivator.getDefault(), + "No editpart factory registered for " + clazz.getName()); return null; } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ModelElementHandlerService.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ModelElementHandlerService.java index 7cbbe20f0a9ef662c4847f2bafda0d2900f52f9f..acde3f039b431f5c0053a67a776e8600917714c8 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ModelElementHandlerService.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/ModelElementHandlerService.java @@ -19,7 +19,6 @@ package org.fortiss.tooling.kernel.ui.internal; import java.util.List; -import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.ecore.EObject; import org.fortiss.tooling.kernel.ToolingKernelActivator; import org.fortiss.tooling.kernel.service.base.EObjectAwareServiceBase; @@ -59,9 +58,9 @@ public class ModelElementHandlerService extends Class<? extends EObject> clazz = modelElement.getClass(); List<IModelElementHandler<EObject>> handlerList = getRegisteredHandlers(clazz); if (handlerList == null || handlerList.isEmpty()) { - LoggingUtils.log(ToolingKernelActivator.getDefault(), "ERROR: " + LoggingUtils.error(ToolingKernelActivator.getDefault(), "ERROR: " + modelElement.getClass().getName() - + " does not have a registered handler!", IStatus.ERROR); + + " does not have a registered handler!"); return null; } return handlerList.get(0); diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EMFTransactionalCommand.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EMFTransactionalCommand.java index ae8a3ee70fedfdf0755c56fdd2f96d945dbb704c..712c4776707bd65a195369281dc1be533b408751 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EMFTransactionalCommand.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/internal/storage/eclipse/EMFTransactionalCommand.java @@ -19,7 +19,6 @@ package org.fortiss.tooling.kernel.internal.storage.eclipse; import java.util.Collection; -import org.eclipse.core.runtime.IStatus; import org.eclipse.emf.common.command.Command; import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.transaction.RecordingCommand; @@ -39,7 +38,7 @@ import org.fortiss.tooling.kernel.util.LoggingUtils; * @author hummel * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 033E90E46FF2E736A09F2FEBD2365AF1 + * @ConQAT.Rating YELLOW Hash: 6AF9B849FA94FE28EEAE8F998B9511F0 */ public class EMFTransactionalCommand implements Command { @@ -114,12 +113,12 @@ public class EMFTransactionalCommand implements Command { try { tx.commit(); } catch (RollbackException e) { - LoggingUtils.log(ToolingKernelActivator.getDefault(), - "Transaction was rolled back!", IStatus.ERROR, e); + LoggingUtils.error(ToolingKernelActivator.getDefault(), + "Transaction was rolled back!", e); } } else { - LoggingUtils.log(ToolingKernelActivator.getDefault(), - "Was not able to start transaction!", IStatus.ERROR); + LoggingUtils.error(ToolingKernelActivator.getDefault(), + "Was not able to start transaction!"); } } } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/base/ObjectAware2ServiceBase.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/base/ObjectAware2ServiceBase.java index c6a0603f847e870148d2db670ae80ca90009b08a..532ed6f4e55fbb7401da5e29bf95efd8efdb5dd6 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/base/ObjectAware2ServiceBase.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/base/ObjectAware2ServiceBase.java @@ -24,7 +24,6 @@ import java.util.Map; import org.conqat.lib.commons.reflect.ReflectionUtils; import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IStatus; import org.fortiss.tooling.kernel.ToolingKernelActivator; import org.fortiss.tooling.kernel.internal.ConnectionCompositorService; import org.fortiss.tooling.kernel.internal.ElementCompositorService; @@ -69,7 +68,7 @@ import org.osgi.framework.Bundle; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating RED Hash: 786F8E4DCC1D8024AB6DB6FBE101DB56 + * @ConQAT.Rating YELLOW Hash: A84331A14E4EF55D9FD9FB282DA918B2 */ public abstract class ObjectAware2ServiceBase<T extends IObjectAware2<? extends Object, ? extends Object>> { @@ -231,12 +230,12 @@ public abstract class ObjectAware2ServiceBase<T extends IObjectAware2<? extends } if (requiresUniqueHandler() && !list.isEmpty()) { - LoggingUtils.log( + LoggingUtils.warning( ToolingKernelActivator.getDefault(), "Encountered more than one handler registered with " + getExtensionPointName() + "(" + handler.getClass() + "," + list.get(0).getClass() - + ")", IStatus.WARNING); + + ")"); } list.add(handler); } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/base/ObjectAwareServiceBase.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/base/ObjectAwareServiceBase.java index c25909c62db2814fc06425254483cf5517860b16..b3bc67362ce72acd16ea08684c91f53d59e54449 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/base/ObjectAwareServiceBase.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/service/base/ObjectAwareServiceBase.java @@ -26,7 +26,6 @@ import java.util.Set; import org.conqat.lib.commons.reflect.ReflectionUtils; import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IStatus; import org.fortiss.tooling.kernel.ToolingKernelActivator; import org.fortiss.tooling.kernel.internal.ConnectionCompositorService; import org.fortiss.tooling.kernel.util.ExtensionPointUtils; @@ -64,7 +63,7 @@ import org.osgi.framework.Bundle; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: 1A071A45F987F422A550D0D78B863F90 + * @ConQAT.Rating YELLOW Hash: 93375807324DBDF3639FA5D77D1E61BE */ public abstract class ObjectAwareServiceBase<T extends IObjectAware<? extends Object>> { @@ -123,12 +122,12 @@ public abstract class ObjectAwareServiceBase<T extends IObjectAware<? extends Ob handlerMap.put(modelElementClass, list); } if (requiresUniqueHandler() && !list.isEmpty()) { - LoggingUtils.log( + LoggingUtils.warning( ToolingKernelActivator.getDefault(), "Encountered more than one handler registered with " + getExtensionPointName() + "(" + handler.getClass() + "," + list.get(0).getClass() - + ")", IStatus.WARNING); + + ")"); } list.add(handler); allHandlersSet.add(handler); diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/ExtensionPointUtils.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/ExtensionPointUtils.java index 3198f64921ab7d1ad5f79f471be06a92a21fa946..0a8c91b7851bea61a137d76c5996df00cca1eb1d 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/ExtensionPointUtils.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/ExtensionPointUtils.java @@ -24,7 +24,6 @@ import java.util.List; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Platform; import org.fortiss.tooling.kernel.ToolingKernelActivator; import org.osgi.framework.Bundle; @@ -39,7 +38,7 @@ import org.osgi.framework.Bundle; * @author hummel * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 9EFBA1C989BEFB70A825EC0F299A0B46 + * @ConQAT.Rating YELLOW Hash: F8469E65054BB71EB418921037100326 */ public class ExtensionPointUtils { @@ -69,9 +68,8 @@ public class ExtensionPointUtils { IExtensionPoint extensionPoint = Platform.getExtensionRegistry() .getExtensionPoint(extensionPointName); if (extensionPoint == null) { - LoggingUtils.log(ToolingKernelActivator.getDefault(), - "Could not find extension point " + extensionPointName, - IStatus.ERROR); + LoggingUtils.error(ToolingKernelActivator.getDefault(), + "Could not find extension point " + extensionPointName); return Collections.EMPTY_LIST; } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/LoggingUtils.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/LoggingUtils.java index d096571b2029be43823100a2f97c3ae0444add93..86ca0e4c49061be68d30e484eb06d1fcfcaaa955 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/LoggingUtils.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/util/LoggingUtils.java @@ -30,49 +30,19 @@ import org.eclipse.core.runtime.Status; * * @author hummel * @author schwitze + * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 5489A04000105CF881046928C19E6E14 + * @ConQAT.Rating YELLOW Hash: 1166B933696B4D525D5D97DE2724E3DD */ public class LoggingUtils { - /** - * Logs a message that occurred in the context of the given plug-in with the - * given severity. - * - * @see IStatus - * - * @param plugin - * The plug-in that logs the message in its context. - * @param message - * The message text to log. - * @param severity - * The severity of the log message. See {@link IStatus} for valid - * constants. - * - */ - public static void log(Plugin plugin, String message, int severity) { - log(plugin, message, severity, null); - } - /** * Logs a message that occurred in the context of the given plug-in with the * given severity and a given {@link Throwable} that originally caused this * log message. - * - * @see IStatus - * - * @param plugin - * The plug-in that logs the message in its context. - * @param message - * The message text to log. - * @param severity - * The severity of the log message. See {@link IStatus} for valid - * constants. - * @param cause - * The {@link Throwable} that originally caused this log message. */ - public static void log(Plugin plugin, String message, int severity, + private static void log(Plugin plugin, String message, int severity, Throwable cause) { String pluginId = plugin.getBundle().getSymbolicName(); IStatus status = new Status(severity, pluginId, message, cause); @@ -82,15 +52,48 @@ public class LoggingUtils { /** * Logs an exception that occurred in the context of the given plug-in with * the severity {@link IStatus#ERROR}. - * - * @param plugin - * The plug-in that logs the message in its context. - * @param message - * The message text to log. - * @param cause - * The {@link Throwable} that originally caused this log message. */ public static void error(Plugin plugin, String message, Throwable cause) { log(plugin, message, IStatus.ERROR, cause); } + + /** + * Logs an exception that occurred in the context of the given plug-in with + * the severity {@link IStatus#ERROR}. + */ + public static void error(Plugin plugin, String message) { + error(plugin, message, null); + } + + /** + * Logs an exception that occurred in the context of the given plug-in with + * the severity {@link IStatus#WARNING}. + */ + public static void warning(Plugin plugin, String message, Throwable cause) { + log(plugin, message, IStatus.WARNING, cause); + } + + /** + * Logs an exception that occurred in the context of the given plug-in with + * the severity {@link IStatus#WARNING}. + */ + public static void warning(Plugin plugin, String message) { + warning(plugin, message, null); + } + + /** + * Logs an exception that occurred in the context of the given plug-in with + * the severity {@link IStatus#INFO}. + */ + public static void info(Plugin plugin, String message, Throwable cause) { + log(plugin, message, IStatus.INFO, cause); + } + + /** + * Logs an exception that occurred in the context of the given plug-in with + * the severity {@link IStatus#INFO}. + */ + public static void info(Plugin plugin, String message) { + info(plugin, message, null); + } }