diff --git a/de.prob.core/src/de/prob/cli/CliStarter.java b/de.prob.core/src/de/prob/cli/CliStarter.java index 73aa32abaa9a0473e2205862ece172ba5ea35745..089d984770005d1a3e7fd27ed1cb1294947ced66 100644 --- a/de.prob.core/src/de/prob/cli/CliStarter.java +++ b/de.prob.core/src/de/prob/cli/CliStarter.java @@ -259,14 +259,13 @@ public final class CliStarter { if (line == null) { break; } - // Logger.log(IStatus.INFO, IStatus.OK, prefix + line, - // null); + // Logger.log(IStatus.INFO, prefix + line, null); System.err.println(prefix + line); } } catch (IOException e) { if (!"Stream closed".equals(e.getMessage())) { final String message = "OutputLogger died with error"; - Logger.log(IStatus.INFO, Logger.DEBUG, message, e); + Logger.log(IStatus.INFO, message, e); } } finally { if (in != null) { diff --git a/de.prob.core/src/de/prob/core/ProblemHandler.java b/de.prob.core/src/de/prob/core/ProblemHandler.java index 7a269ea4cd37c9cef509740474908f3b2e6e50dc..30a76a8dd19cc4db1982835c24ba189d96324a44 100644 --- a/de.prob.core/src/de/prob/core/ProblemHandler.java +++ b/de.prob.core/src/de/prob/core/ProblemHandler.java @@ -16,8 +16,8 @@ import de.prob.logging.Logger; public class ProblemHandler { /** - * Notifies the User about a fatal problem inside a command by adding a - * {@link Logger#FATALERROR} to the log. This method takes a message + * Notifies the User about a fatal problem inside a command by adding an error + * to the log. This method takes a message * describing the problem.<br> * * <b>Note:</b> Calling this method logs the problem and throws a new @@ -37,8 +37,8 @@ public class ProblemHandler { } /** - * Notifies the User about a fatal problem inside a command by adding a - * {@link Logger#FATALERROR} to the log. This method takes a message + * Notifies the User about a fatal problem inside a command by adding an error + * to the log. This method takes a message * describing the problem.<br> * * <b>Note:</b> Calling this method logs the problem and throws a new @@ -74,8 +74,8 @@ public class ProblemHandler { /** * - * Notifies the User about a fatal problem by adding a - * {@link Logger#FATALERROR} to the log. This method takes a message + * Notifies the User about a fatal problem by adding an error + * to the log. This method takes a message * describing the problem and the causing exception. * * Note: Calling this method logs the problem and throws a CliException that @@ -95,8 +95,8 @@ public class ProblemHandler { /** * - * Notifies the User about a fatal problem by adding a - * {@link Logger#FATALERROR} to the log. This method takes a message + * Notifies the User about a fatal problem by adding an error + * to the log. This method takes a message * describing the problem and the causing exception. * * Note: Calling this method logs the problem and throws a CliException that diff --git a/de.prob.core/src/de/prob/core/PrologException.java b/de.prob.core/src/de/prob/core/PrologException.java index 84ae7bdf94cb3c15fe5ed51cce8e9a4eb92f0451..8b99996f252a29b67ef3489fb16dad256eeb54b7 100644 --- a/de.prob.core/src/de/prob/core/PrologException.java +++ b/de.prob.core/src/de/prob/core/PrologException.java @@ -26,8 +26,7 @@ public class PrologException extends ProBException { if (!handled) { handled = true; if (onlyWarnings) { - Logger.log(IStatus.WARNING, Logger.NOTIFY_USER, - this.getMessage(), this); + Logger.log(IStatus.WARNING, this.getMessage(), this); } else { Logger.notifyUser(this.getMessage(), this); } diff --git a/de.prob.core/src/de/prob/logging/Logger.java b/de.prob.core/src/de/prob/logging/Logger.java index e8d1d95be870ba5f90a5368808e213238bfce0f0..2893acd1d4090b9807eacf575455e122579236f9 100644 --- a/de.prob.core/src/de/prob/logging/Logger.java +++ b/de.prob.core/src/de/prob/logging/Logger.java @@ -23,12 +23,6 @@ import de.prob.parser.BindingGenerator; * */ public final class Logger { - - public static final int DEBUG = 0; - public static final int INFO = 1; - public static final int WARNING = 2; - public static final int NOTIFY_USER = 4; - /** * Registers a new {@link ILogListener}. The listener's * {@link ILogListener#logging(IStatus, String)} method is called, if @@ -41,8 +35,8 @@ public final class Logger { } /** - * Notifies the User about a fatal problem by adding a - * {@link Logger#FATALERROR} to the log. This method takes a message + * Notifies the User about a fatal problem by adding an error + * to the log. This method takes a message * describing the problem as well as an exception. * <p> * Note: Use this only if you don't want to throw an exception. If you want @@ -58,7 +52,7 @@ public final class Logger { */ public static void notifyUser(final String message, final Throwable throwable) { - log(IStatus.ERROR, NOTIFY_USER, message, throwable); + log(IStatus.ERROR, message, throwable); } public static void notifyUser(final String message) { @@ -121,10 +115,8 @@ public final class Logger { assertProB(assertion, false); } - public static void log(final int severity, final int code, - final String message, final Throwable exception) { - final IStatus status = new Status(severity, Activator.PLUGIN_ID, code, - message, exception); + public static void log(final int severity, final String message, final Throwable exception) { + final IStatus status = new Status(severity, Activator.PLUGIN_ID, message, exception); log(status); } diff --git a/de.prob.eventb.disprover.core/src/de/prob/eventb/disprover/core/DisproverReasoner.java b/de.prob.eventb.disprover.core/src/de/prob/eventb/disprover/core/DisproverReasoner.java index d4074c2b254fd2011d14741a2640c46190c22abb..0e9309ca46bf6bfdea5c4da1fb35db282824d47b 100644 --- a/de.prob.eventb.disprover.core/src/de/prob/eventb/disprover/core/DisproverReasoner.java +++ b/de.prob.eventb.disprover.core/src/de/prob/eventb/disprover/core/DisproverReasoner.java @@ -3,7 +3,17 @@ package de.prob.eventb.disprover.core; import java.util.HashSet; import java.util.Set; -import org.eclipse.core.runtime.Status; +import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog; +import de.be4.classicalb.core.parser.node.AEventBContextParseUnit; +import de.prob.core.Animator; +import de.prob.eventb.disprover.core.internal.DisproverCommand; +import de.prob.eventb.disprover.core.internal.ICounterExample; +import de.prob.eventb.disprover.core.translation.DisproverContextCreator; +import de.prob.eventb.translator.internal.TranslationVisitor; +import de.prob.logging.Logger; +import de.prob.prolog.output.PrologTermStringOutput; + +import org.eclipse.core.runtime.IStatus; import org.eventb.core.IEventBProject; import org.eventb.core.IPOSequent; import org.eventb.core.ast.Predicate; @@ -22,16 +32,6 @@ import org.eventb.core.seqprover.SerializeException; import org.rodinp.core.IRodinProject; import org.rodinp.core.RodinDBException; -import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog; -import de.be4.classicalb.core.parser.node.AEventBContextParseUnit; -import de.prob.core.Animator; -import de.prob.eventb.disprover.core.internal.DisproverCommand; -import de.prob.eventb.disprover.core.internal.ICounterExample; -import de.prob.eventb.disprover.core.translation.DisproverContextCreator; -import de.prob.eventb.translator.internal.TranslationVisitor; -import de.prob.logging.Logger; -import de.prob.prolog.output.PrologTermStringOutput; - public class DisproverReasoner implements IReasoner { static final String DISPROVER_CONTEXT = "disprover_context"; @@ -62,7 +62,7 @@ public class DisproverReasoner implements IReasoner { timeoutFactor, pm); return createDisproverResult(ce, sequent, input); } catch (RodinDBException e) { - Logger.log(Logger.WARNING, Status.WARNING, e.getMessage(), e); + Logger.log(IStatus.WARNING, e.getMessage(), e); return ProverFactory.reasonerFailure(this, input, e.getMessage()); } catch (InterruptedException e) { return ProverFactory.reasonerFailure(this, input, e.getMessage()); diff --git a/de.prob.ui/src/de/prob/ui/eventb/StartAnimationHandler.java b/de.prob.ui/src/de/prob/ui/eventb/StartAnimationHandler.java index c041a905ab929ff6a99fd77b54510a070cecca1a..88c9ed078678e552a7402401b7a7f3c3a6d80a6c 100644 --- a/de.prob.ui/src/de/prob/ui/eventb/StartAnimationHandler.java +++ b/de.prob.ui/src/de/prob/ui/eventb/StartAnimationHandler.java @@ -95,7 +95,7 @@ public class StartAnimationHandler extends AbstractHandler implements IHandler { } else if (realError) Logger.notifyUser(stringBuffer.toString()); else - Logger.log(IStatus.WARNING, Logger.NOTIFY_USER, stringBuffer.toString(), null); + Logger.log(IStatus.WARNING, stringBuffer.toString(), null); } else { Animator.getAnimator().resetRodinProjectHasErrorsOrWarnings(); } diff --git a/de.prob.ui/src/de/prob/ui/ticket/ProBLogListener.java b/de.prob.ui/src/de/prob/ui/ticket/ProBLogListener.java index 8f739f954b4b2c8dbf0a148a932edb1251fa220a..c5b2118b057bf4db66427880d8cbfd079956ece5 100644 --- a/de.prob.ui/src/de/prob/ui/ticket/ProBLogListener.java +++ b/de.prob.ui/src/de/prob/ui/ticket/ProBLogListener.java @@ -11,8 +11,6 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.swt.widgets.Display; -import de.prob.logging.Logger; - public final class ProBLogListener implements ILogListener { private static final Display display = Display.getDefault(); @@ -25,9 +23,7 @@ public final class ProBLogListener implements ILogListener { return; } - final int code = status.getCode(); - - if (code == Logger.NOTIFY_USER) { + if (status.getSeverity() == IStatus.ERROR || status.getSeverity() == IStatus.WARNING) { display.asyncExec(new Runnable() { public void run() { String title = (status.getSeverity() == IStatus.ERROR) ? "An Error occured"