Skip to content
Snippets Groups Projects
Commit ea00a761 authored by dgelessus's avatar dgelessus
Browse files

Remove last uses of IStatus.getCode

The severity now determines whether the user is notified - errors and
warnings are displayed and everything else isn't.
parent 9df10849
No related branches found
No related tags found
No related merge requests found
Pipeline #119697 passed
...@@ -259,14 +259,13 @@ public final class CliStarter { ...@@ -259,14 +259,13 @@ public final class CliStarter {
if (line == null) { if (line == null) {
break; break;
} }
// Logger.log(IStatus.INFO, IStatus.OK, prefix + line, // Logger.log(IStatus.INFO, prefix + line, null);
// null);
System.err.println(prefix + line); System.err.println(prefix + line);
} }
} catch (IOException e) { } catch (IOException e) {
if (!"Stream closed".equals(e.getMessage())) { if (!"Stream closed".equals(e.getMessage())) {
final String message = "OutputLogger died with error"; final String message = "OutputLogger died with error";
Logger.log(IStatus.INFO, Logger.DEBUG, message, e); Logger.log(IStatus.INFO, message, e);
} }
} finally { } finally {
if (in != null) { if (in != null) {
......
...@@ -16,8 +16,8 @@ import de.prob.logging.Logger; ...@@ -16,8 +16,8 @@ import de.prob.logging.Logger;
public class ProblemHandler { public class ProblemHandler {
/** /**
* Notifies the User about a fatal problem inside a command by adding a * Notifies the User about a fatal problem inside a command by adding an error
* {@link Logger#FATALERROR} to the log. This method takes a message * to the log. This method takes a message
* describing the problem.<br> * describing the problem.<br>
* *
* <b>Note:</b> Calling this method logs the problem and throws a new * <b>Note:</b> Calling this method logs the problem and throws a new
...@@ -37,8 +37,8 @@ public class ProblemHandler { ...@@ -37,8 +37,8 @@ public class ProblemHandler {
} }
/** /**
* Notifies the User about a fatal problem inside a command by adding a * Notifies the User about a fatal problem inside a command by adding an error
* {@link Logger#FATALERROR} to the log. This method takes a message * to the log. This method takes a message
* describing the problem.<br> * describing the problem.<br>
* *
* <b>Note:</b> Calling this method logs the problem and throws a new * <b>Note:</b> Calling this method logs the problem and throws a new
...@@ -74,8 +74,8 @@ public class ProblemHandler { ...@@ -74,8 +74,8 @@ public class ProblemHandler {
/** /**
* *
* Notifies the User about a fatal problem by adding a * Notifies the User about a fatal problem by adding an error
* {@link Logger#FATALERROR} to the log. This method takes a message * to the log. This method takes a message
* describing the problem and the causing exception. * describing the problem and the causing exception.
* *
* Note: Calling this method logs the problem and throws a CliException that * Note: Calling this method logs the problem and throws a CliException that
...@@ -95,8 +95,8 @@ public class ProblemHandler { ...@@ -95,8 +95,8 @@ public class ProblemHandler {
/** /**
* *
* Notifies the User about a fatal problem by adding a * Notifies the User about a fatal problem by adding an error
* {@link Logger#FATALERROR} to the log. This method takes a message * to the log. This method takes a message
* describing the problem and the causing exception. * describing the problem and the causing exception.
* *
* Note: Calling this method logs the problem and throws a CliException that * Note: Calling this method logs the problem and throws a CliException that
......
...@@ -26,8 +26,7 @@ public class PrologException extends ProBException { ...@@ -26,8 +26,7 @@ public class PrologException extends ProBException {
if (!handled) { if (!handled) {
handled = true; handled = true;
if (onlyWarnings) { if (onlyWarnings) {
Logger.log(IStatus.WARNING, Logger.NOTIFY_USER, Logger.log(IStatus.WARNING, this.getMessage(), this);
this.getMessage(), this);
} else { } else {
Logger.notifyUser(this.getMessage(), this); Logger.notifyUser(this.getMessage(), this);
} }
......
...@@ -23,12 +23,6 @@ import de.prob.parser.BindingGenerator; ...@@ -23,12 +23,6 @@ import de.prob.parser.BindingGenerator;
* *
*/ */
public final class Logger { 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 * Registers a new {@link ILogListener}. The listener's
* {@link ILogListener#logging(IStatus, String)} method is called, if * {@link ILogListener#logging(IStatus, String)} method is called, if
...@@ -41,8 +35,8 @@ public final class Logger { ...@@ -41,8 +35,8 @@ public final class Logger {
} }
/** /**
* Notifies the User about a fatal problem by adding a * Notifies the User about a fatal problem by adding an error
* {@link Logger#FATALERROR} to the log. This method takes a message * to the log. This method takes a message
* describing the problem as well as an exception. * describing the problem as well as an exception.
* <p> * <p>
* Note: Use this only if you don't want to throw an exception. If you want * Note: Use this only if you don't want to throw an exception. If you want
...@@ -58,7 +52,7 @@ public final class Logger { ...@@ -58,7 +52,7 @@ public final class Logger {
*/ */
public static void notifyUser(final String message, public static void notifyUser(final String message,
final Throwable throwable) { final Throwable throwable) {
log(IStatus.ERROR, NOTIFY_USER, message, throwable); log(IStatus.ERROR, message, throwable);
} }
public static void notifyUser(final String message) { public static void notifyUser(final String message) {
...@@ -121,10 +115,8 @@ public final class Logger { ...@@ -121,10 +115,8 @@ public final class Logger {
assertProB(assertion, false); assertProB(assertion, false);
} }
public static void log(final int severity, final int code, public static void log(final int severity, final String message, final Throwable exception) {
final String message, final Throwable exception) { final IStatus status = new Status(severity, Activator.PLUGIN_ID, message, exception);
final IStatus status = new Status(severity, Activator.PLUGIN_ID, code,
message, exception);
log(status); log(status);
} }
......
...@@ -3,7 +3,17 @@ package de.prob.eventb.disprover.core; ...@@ -3,7 +3,17 @@ package de.prob.eventb.disprover.core;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; 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.IEventBProject;
import org.eventb.core.IPOSequent; import org.eventb.core.IPOSequent;
import org.eventb.core.ast.Predicate; import org.eventb.core.ast.Predicate;
...@@ -22,16 +32,6 @@ import org.eventb.core.seqprover.SerializeException; ...@@ -22,16 +32,6 @@ import org.eventb.core.seqprover.SerializeException;
import org.rodinp.core.IRodinProject; import org.rodinp.core.IRodinProject;
import org.rodinp.core.RodinDBException; 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 { public class DisproverReasoner implements IReasoner {
static final String DISPROVER_CONTEXT = "disprover_context"; static final String DISPROVER_CONTEXT = "disprover_context";
...@@ -62,7 +62,7 @@ public class DisproverReasoner implements IReasoner { ...@@ -62,7 +62,7 @@ public class DisproverReasoner implements IReasoner {
timeoutFactor, pm); timeoutFactor, pm);
return createDisproverResult(ce, sequent, input); return createDisproverResult(ce, sequent, input);
} catch (RodinDBException e) { } 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()); return ProverFactory.reasonerFailure(this, input, e.getMessage());
} catch (InterruptedException e) { } catch (InterruptedException e) {
return ProverFactory.reasonerFailure(this, input, e.getMessage()); return ProverFactory.reasonerFailure(this, input, e.getMessage());
......
...@@ -95,7 +95,7 @@ public class StartAnimationHandler extends AbstractHandler implements IHandler { ...@@ -95,7 +95,7 @@ public class StartAnimationHandler extends AbstractHandler implements IHandler {
} else if (realError) } else if (realError)
Logger.notifyUser(stringBuffer.toString()); Logger.notifyUser(stringBuffer.toString());
else else
Logger.log(IStatus.WARNING, Logger.NOTIFY_USER, stringBuffer.toString(), null); Logger.log(IStatus.WARNING, stringBuffer.toString(), null);
} else { } else {
Animator.getAnimator().resetRodinProjectHasErrorsOrWarnings(); Animator.getAnimator().resetRodinProjectHasErrorsOrWarnings();
} }
......
...@@ -11,8 +11,6 @@ import org.eclipse.core.runtime.IStatus; ...@@ -11,8 +11,6 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import de.prob.logging.Logger;
public final class ProBLogListener implements ILogListener { public final class ProBLogListener implements ILogListener {
private static final Display display = Display.getDefault(); private static final Display display = Display.getDefault();
...@@ -25,9 +23,7 @@ public final class ProBLogListener implements ILogListener { ...@@ -25,9 +23,7 @@ public final class ProBLogListener implements ILogListener {
return; return;
} }
final int code = status.getCode(); if (status.getSeverity() == IStatus.ERROR || status.getSeverity() == IStatus.WARNING) {
if (code == Logger.NOTIFY_USER) {
display.asyncExec(new Runnable() { display.asyncExec(new Runnable() {
public void run() { public void run() {
String title = (status.getSeverity() == IStatus.ERROR) ? "An Error occured" String title = (status.getSeverity() == IStatus.ERROR) ? "An Error occured"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment