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

Remove logging distinction of "with bugreport" and "without bugreport"

The bug report mechanism doesn't exist anymore, so the two variants did
the same thing.
parent 465b84df
No related branches found
No related tags found
No related merge requests found
Showing
with 26 additions and 48 deletions
......@@ -123,7 +123,7 @@ public class OpenObserverAction extends SelectionAction {
}
} else {
Logger.notifyUserWithoutBugreport("The Observer \""
Logger.notifyUser("The Observer \""
+ observer.getName()
+ "\" does not support a wizard.");
}
......
......@@ -124,7 +124,7 @@ public class OpenSchedulerEventAction extends SelectionAction {
}
} else {
Logger.notifyUserWithoutBugreport("The Scheduler Event \""
Logger.notifyUser("The Scheduler Event \""
+ newSchedulerEvent.getName()
+ "\" does not support a wizard.");
}
......
......@@ -23,9 +23,8 @@ public abstract class ProBJobFinishedListener extends JobChangeAdapter {
showResult(checkJob.getCommand(), checkJob.getAnimator());
}
} else {
final String message = "The job has a wrong type. Expected ProBCommandJob but got "
+ job.getClass();
Logger.notifyUserWithoutBugreport(message);
Logger.notifyUser("The job has a wrong type. Expected ProBCommandJob but got "
+ job.getClass());
}
}
......
......@@ -26,7 +26,7 @@ public class PrologException extends ProBException {
if (!handled) {
handled = true;
if (onlyWarnings) {
Logger.log(IStatus.WARNING, Logger.NOBUGREPORT,
Logger.log(IStatus.WARNING, Logger.NOTIFY_USER,
this.getMessage(), this);
} else {
Logger.notifyUser(this.getMessage(), this);
......
......@@ -87,12 +87,12 @@ public final class ExploreStateCommand implements IComposableCommand {
// only show error message on SETUP_CONSTANTS and
// PARTIALLY_SETUP_CONSTANTS
if (unsatPropertiesExist) {
Logger.notifyUserWithoutBugreport("ProB could not find valid constants wich satisfy the properties.\n"
Logger.notifyUser("ProB could not find valid constants wich satisfy the properties.\n"
+ unsatPropsCommand.getUnsatPropertiesDescription());
} else if (!initialised && enabledOperations.isEmpty()
&& !timeoutOccured) {
Logger.notifyUserWithoutBugreport("ProB could not find valid constants/variables. This might be caused by the animation settings (e.g., Integer range or deferred set size) or by an inconsistency in the axioms.");
Logger.notifyUser("ProB could not find valid constants/variables. This might be caused by the animation settings (e.g., Integer range or deferred set size) or by an inconsistency in the axioms.");
}
Set<String> timeouts = new HashSet<String>(
......
......@@ -104,7 +104,7 @@ public final class LoadEventBModelCommand {
+ " Typically this means, that your axioms are too complicated for automatic solving. "
+ "You might create an animation refinement using the context menu to help ProB finding a solution.";
}
Logger.notifyUserWithoutBugreport(message);
Logger.notifyUser(message);
}
} catch (CommandException ex) {
Logger.notifyUser("Event-B Model or Context could not be loaded due to an exception: "
......
......@@ -165,8 +165,7 @@ public class ServerConnection implements IServerConnection {
shutdown = false;
} else {
// This should never happen
final String message = "Tried to start a server that is already running";
Logger.notifyUserWithoutBugreport(message);
Logger.notifyUser("Tried to start a server that is already running");
}
}
......
......@@ -114,8 +114,7 @@ public class ModelTranslator extends AbstractComponentTranslator {
public AEventBModelParseUnit getModelAST() {
if (broken) {
final String message = "The machine contains Rodin Problems. ProB will continue, but you may observe unexpected behaviour";
Logger.notifyUserWithoutBugreport(message);
Logger.notifyUser("The machine contains Rodin Problems. ProB will continue, but you may observe unexpected behaviour");
return model;
}
return model;
......
......@@ -27,8 +27,7 @@ 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 BUGREPORT = 4;
public static final int NOBUGREPORT = 8;
public static final int NOTIFY_USER = 4;
/**
* Registers a new {@link ILogListener}. The listener's
......@@ -59,22 +58,13 @@ public final class Logger {
*/
public static void notifyUser(final String message,
final Throwable throwable) {
log(IStatus.ERROR, BUGREPORT, message, throwable);
log(IStatus.ERROR, NOTIFY_USER, message, throwable);
}
public static void notifyUser(final String message) {
notifyUser(message, null);
}
public static void notifyUserWithoutBugreport(final String message,
final Throwable throwable) {
log(IStatus.ERROR, NOBUGREPORT, message, throwable);
}
public static void notifyUserWithoutBugreport(final String message) {
notifyUserWithoutBugreport(message, null);
}
/**
* Check a property. The method notifies the user and throws an exception if
* the assertion fails. <br>
......@@ -151,8 +141,4 @@ public final class Logger {
private static void log(final IStatus status) {
Activator.getDefault().getLog().log(status);
}
public static void notifyUserAboutWarningWithoutBugreport(String string) {
log(IStatus.WARNING, NOBUGREPORT, string, null);
}
}
......@@ -47,9 +47,7 @@ public class ModelCheckingFinishedListener extends JobChangeAdapter {
ModelCheckingJob ccJob = (ModelCheckingJob) job;
showResult(ccJob.getModelCheckingResult());
} else {
final String message = "The job has a wrong type. Expected ModelCheckingJob but got "
+ job.getClass();
Logger.notifyUserWithoutBugreport(message);
Logger.notifyUser("The job has a wrong type. Expected ModelCheckingJob but got " + job.getClass());
}
}
......
......@@ -36,7 +36,7 @@ public class OpenClassicHandler extends AbstractHandler implements IHandler {
final String prob_location = getBinaryLocation();
if (prob_location == null) {
Logger.notifyUserWithoutBugreport("You need to specify a location for" + PROB_STANDALONE_NAME +". See Preferences -> ProB Standalone.");
Logger.notifyUser("You need to specify a location for" + PROB_STANDALONE_NAME +". See Preferences -> ProB Standalone.");
} else {
final IEventBRoot root = getSelection();
if (root != null) {
......@@ -53,7 +53,7 @@ public class OpenClassicHandler extends AbstractHandler implements IHandler {
runProBClassic(prob_location, tmp);
}
} else {
Logger.notifyUserWithoutBugreport("You need to select a context or machine to open with " + PROB_STANDALONE_NAME);
Logger.notifyUser("You need to select a context or machine to open with " + PROB_STANDALONE_NAME);
}
}
return null;
......@@ -97,7 +97,7 @@ public class OpenClassicHandler extends AbstractHandler implements IHandler {
new Thread(new ClassicConsole(output)).start();
} catch (IOException e) {
Logger.notifyUserWithoutBugreport("You need to specify a correct location for "
Logger.notifyUser("You need to specify a correct location for "
+ PROB_CLASSIC_NAME + ". See Preferences -> ProB Standalone.\n"
+ PROB_CLASSIC_NAME + " location: "+ probBinary +
"\nModel file: " + modelFile +
......@@ -121,7 +121,7 @@ public class OpenClassicHandler extends AbstractHandler implements IHandler {
new Thread(new ClassicConsole(voutput)).start();
vprocess.waitFor(); // this blocks Rodin
if (vprocess.exitValue() != 0) {
Logger.notifyUserWithoutBugreport("Failed to start java -version. Exit code: " + vprocess.exitValue());
Logger.notifyUser("Failed to start java -version. Exit code: " + vprocess.exitValue());
}
final String[] command = {"java", "-jar", probBinary, "--machine-file", modelFile};
......@@ -136,7 +136,7 @@ public class OpenClassicHandler extends AbstractHandler implements IHandler {
} catch (IOException | InterruptedException e) {
// } catch (IOException e) {
Logger.notifyUserWithoutBugreport("You need to specify a correct location for "
Logger.notifyUser("You need to specify a correct location for "
+ PROB2_NAME + ". See Preferences -> ProB Standalone.\n"
+ PROB2_NAME + " location: "+ probBinary +
"\nModel file: " + modelFile +
......@@ -157,7 +157,7 @@ public class OpenClassicHandler extends AbstractHandler implements IHandler {
temp = File.createTempFile("prob_", ".eventb");
temp.deleteOnExit();
} catch (IOException e) {
Logger.notifyUserWithoutBugreport("Something went wrong while saving temp file.\n"
Logger.notifyUser("Something went wrong while saving temp file.\n"
+ e.getLocalizedMessage());
}
return temp;
......
......@@ -17,6 +17,7 @@ import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
......@@ -92,10 +93,9 @@ public class StartAnimationHandler extends AbstractHandler implements IHandler {
Logger.info(stringBuffer.toString());
LimitedLogger.getLogger().log(stringBuffer.toString(),rootElement.getElementName(), null);
} else if (realError)
Logger.notifyUserWithoutBugreport(stringBuffer.toString());
Logger.notifyUser(stringBuffer.toString());
else
Logger.notifyUserAboutWarningWithoutBugreport(stringBuffer
.toString());
Logger.log(IStatus.WARNING, Logger.NOTIFY_USER, stringBuffer.toString(), null);
} else {
Animator.getAnimator().resetRodinProjectHasErrorsOrWarnings();
}
......
......@@ -68,8 +68,7 @@ public class StartDistributedModelcheckHandler extends AbstractHandler implement
final IFile resource = extractResource(rootElement);
if (!checkErrorMarkers(resource)) {
String message = "A model/context in your project contains Errors or Warnings. This can lead to unexpected behavior (e.g. missing variables) when animating.";
Logger.notifyUserWithoutBugreport(message);
Logger.notifyUser("A model/context in your project contains Errors or Warnings. This can lead to unexpected behavior (e.g. missing variables) when animating.");
}
;
......@@ -83,7 +82,7 @@ public class StartDistributedModelcheckHandler extends AbstractHandler implement
s = new Socket("localhost", 4444);
new ObjectOutputStream(s.getOutputStream()).writeObject(output);
} catch (IOException e) {
Logger.notifyUserWithoutBugreport("unable to connect to master", e);
Logger.notifyUser("unable to connect to master", e);
} finally {
if (s != null) {
try {
......
......@@ -34,9 +34,7 @@ public class LtlCheckingFinishedListener extends JobChangeAdapter {
showResult(ltlJob.getModelCheckingResult());
}
} else {
final String message = "The job has a wrong type. Expected LtlCheckingJob but got "
+ job.getClass();
Logger.notifyUserWithoutBugreport(message);
Logger.notifyUser("The job has a wrong type. Expected LtlCheckingJob but got " + job.getClass());
}
}
......
......@@ -27,7 +27,7 @@ public final class ProBLogListener implements ILogListener {
final int code = status.getCode();
if (code == Logger.BUGREPORT || code == Logger.NOBUGREPORT) {
if (code == Logger.NOTIFY_USER) {
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