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 {
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) {
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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());
......
......@@ -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();
}
......
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment