diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ListenOperationByPredicate.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ListenOperationByPredicate.java index 83542e852adb82a1f600507b4fd50705f7331ff2..e97873f78c913ab05b6579ed8d7c1625c374b75b 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ListenOperationByPredicate.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/observer/ListenOperationByPredicate.java @@ -9,7 +9,7 @@ package de.bmotionstudio.gef.editor.observer; import java.util.ArrayList; import java.util.List; -import de.be4.classicalb.core.parser.exceptions.BException; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.bmotionstudio.gef.editor.Animation; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.attribute.AbstractAttribute; @@ -128,7 +128,7 @@ public class ListenOperationByPredicate extends Observer { // addError(control, animation, // "An error occurred while evaluating. Reason: " // + e.getMessage()); - } catch (BException e) { + } catch (BCompoundException e) { // addError(control, animation, "Parsing error in: " // + fPredicate + " Reason: " + e.getMessage()); } diff --git a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/util/BMSUtil.java b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/util/BMSUtil.java index ed487db0020ca2b9fa7657c1866e35b2a0159489..4fa2ef9c3f57b55c2eb22f9c6ace6420aba70f70 100644 --- a/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/util/BMSUtil.java +++ b/de.bmotionstudio.gef.editor/src/de/bmotionstudio/gef/editor/util/BMSUtil.java @@ -9,7 +9,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import de.be4.classicalb.core.parser.exceptions.BException; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.bmotionstudio.gef.editor.Animation; import de.bmotionstudio.gef.editor.AttributeConstants; import de.bmotionstudio.gef.editor.model.BControl; @@ -213,7 +213,7 @@ public class BMSUtil { opRandom); } catch (ProBException e) { - } catch (BException e) { + } catch (BCompoundException e) { } return null; diff --git a/de.prob.core/src/de/prob/core/command/ConstructTraceCommand.java b/de.prob.core/src/de/prob/core/command/ConstructTraceCommand.java index a12b0d913e8e0e1a8c92c6bddd407527defa97e5..53e3aa38a02ceb6fc67a15cedd1d620e1ed18b87 100644 --- a/de.prob.core/src/de/prob/core/command/ConstructTraceCommand.java +++ b/de.prob.core/src/de/prob/core/command/ConstructTraceCommand.java @@ -14,7 +14,7 @@ import java.util.List; import java.util.Set; import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog; -import de.be4.classicalb.core.parser.exceptions.BException; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.prob.core.Animator; import de.prob.core.domainobjects.Operation; import de.prob.core.domainobjects.State; @@ -53,7 +53,7 @@ public final class ConstructTraceCommand implements IComposableCommand { for (String string : predicates) { try { evalElement.add(PredicateEvalElement.create(string)); - } catch (BException e) { + } catch (BCompoundException e) { throw new IllegalArgumentException( "Formula must be a predicate: " + string); } diff --git a/de.prob.core/src/de/prob/core/command/GetOperationByPredicateCommand.java b/de.prob.core/src/de/prob/core/command/GetOperationByPredicateCommand.java index 51d42750422363ec023d2556f1af61998007dfab..62d7767af6297c27d88a434da524878cd9c332b2 100644 --- a/de.prob.core/src/de/prob/core/command/GetOperationByPredicateCommand.java +++ b/de.prob.core/src/de/prob/core/command/GetOperationByPredicateCommand.java @@ -10,7 +10,7 @@ import java.util.ArrayList; import java.util.List; import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog; -import de.be4.classicalb.core.parser.exceptions.BException; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.prob.core.Animator; import de.prob.core.ProblemHandler; import de.prob.core.domainobjects.Operation; @@ -51,7 +51,7 @@ public final class GetOperationByPredicateCommand implements IComposableCommand PredicateEvalElement parsedEvalElement = null; try { parsedEvalElement = PredicateEvalElement.create(predicate); - } catch (BException e) { + } catch (BCompoundException e) { String message = "Fatal error when trying to parse " + predicate + ". Execution of operation " + name + " aborted."; ProblemHandler.raiseCommandException(message); @@ -66,7 +66,7 @@ public final class GetOperationByPredicateCommand implements IComposableCommand */ public static Operation getOperation(final Animator a, final String stateId, final String name, final String predicate) - throws ProBException, BException { + throws ProBException, BCompoundException { List<Operation> operations = getOperations(a, stateId, name, predicate, 1); @@ -91,14 +91,14 @@ public final class GetOperationByPredicateCommand implements IComposableCommand * @param nrOfSolutions * - maximum number of solutions * @return an Operation or null - * @throws BException + * @throws BCompoundException * - if the B predicate contains errors * @throws ProBException * - if something terrible happens ;-) */ public static List<Operation> getOperations(final Animator a, final String stateId, final String name, final String predicate, - final int nrOfSolutions) throws ProBException, BException { + final int nrOfSolutions) throws ProBException, BCompoundException { GetOperationByPredicateCommand executeOperationCommand = new GetOperationByPredicateCommand( stateId, name, predicate, nrOfSolutions); diff --git a/de.prob.core/src/de/prob/core/command/LoadClassicalBModelCommand.java b/de.prob.core/src/de/prob/core/command/LoadClassicalBModelCommand.java index 5dcff86255e0bad589bee54de880d53465f11d4d..2fa022b600b4ab0f0b895d957d7a9cf157fe0636 100644 --- a/de.prob.core/src/de/prob/core/command/LoadClassicalBModelCommand.java +++ b/de.prob.core/src/de/prob/core/command/LoadClassicalBModelCommand.java @@ -19,7 +19,7 @@ import org.osgi.service.prefs.Preferences; import de.be4.classicalb.core.parser.BParser; import de.be4.classicalb.core.parser.analysis.prolog.RecursiveMachineLoader; -import de.be4.classicalb.core.parser.exceptions.BException; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.be4.classicalb.core.parser.node.Start; import de.prob.core.Animator; import de.prob.core.domainobjects.Operation; @@ -154,7 +154,7 @@ public final class LoadClassicalBModelCommand { } catch (IOException e) { Logger.notifyUser("IO Error", e); throw new CommandException(e.getLocalizedMessage(), e); - } catch (BException e) { + } catch (BCompoundException e) { Logger.notifyUser("Parser Error " + e.getLocalizedMessage(), e); throw new CommandException(e.getLocalizedMessage(), e); } diff --git a/de.prob.core/src/de/prob/core/domainobjects/eval/AbstractEvalElement.java b/de.prob.core/src/de/prob/core/domainobjects/eval/AbstractEvalElement.java index acf76587124350e940e193362ee62224bcf4b6fd..d725f17fd58dda61e3e36be9886ce8df9c77d540 100644 --- a/de.prob.core/src/de/prob/core/domainobjects/eval/AbstractEvalElement.java +++ b/de.prob.core/src/de/prob/core/domainobjects/eval/AbstractEvalElement.java @@ -7,7 +7,7 @@ package de.prob.core.domainobjects.eval; import de.be4.classicalb.core.parser.BParser; -import de.be4.classicalb.core.parser.exceptions.BException; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.be4.classicalb.core.parser.node.Start; import de.prob.core.Animator; import de.prob.core.command.EvaluateRawExpressionsCommand; @@ -30,7 +30,7 @@ public abstract class AbstractEvalElement { public abstract String getLabel(); protected Start parse(final String prefix, final String code) - throws BException { + throws BCompoundException { final BParser parser = new BParser(); final Start modelAst = parser.parse(prefix + code, false); return modelAst; diff --git a/de.prob.core/src/de/prob/core/domainobjects/eval/ExpressionEvalElement.java b/de.prob.core/src/de/prob/core/domainobjects/eval/ExpressionEvalElement.java index 02b22f69b7e4db39e10487a95bef3fd9c13ec93f..cb5932d9ee1336e4a0716468bb7b36ece0f35c1a 100644 --- a/de.prob.core/src/de/prob/core/domainobjects/eval/ExpressionEvalElement.java +++ b/de.prob.core/src/de/prob/core/domainobjects/eval/ExpressionEvalElement.java @@ -9,6 +9,7 @@ package de.prob.core.domainobjects.eval; import org.eventb.core.ast.Expression; import de.be4.classicalb.core.parser.BParser; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.be4.classicalb.core.parser.exceptions.BException; import de.be4.classicalb.core.parser.node.AExpressionParseUnit; import de.be4.classicalb.core.parser.node.EOF; @@ -22,10 +23,10 @@ public final class ExpressionEvalElement extends AbstractEvalElement { private final String expression; public static ExpressionEvalElement fromRodin(final Expression expression) - throws BException { + throws BCompoundException { if (expression == null) { String message = "Expression input must not be null"; - throw new BException("", new NullPointerException(message)); + throw new BCompoundException(new BException("", message, new NullPointerException(message))); } final PExpression expr = TranslationVisitor .translateExpression(expression); @@ -35,11 +36,11 @@ public final class ExpressionEvalElement extends AbstractEvalElement { } public static ExpressionEvalElement create(final String expression) - throws BException { + throws BCompoundException { return new ExpressionEvalElement(expression); } - public ExpressionEvalElement(final String expression) throws BException { + public ExpressionEvalElement(final String expression) throws BCompoundException { this.expression = expression; parse = parse(BParser.EXPRESSION_PREFIX, expression); } diff --git a/de.prob.core/src/de/prob/core/domainobjects/eval/PredicateEvalElement.java b/de.prob.core/src/de/prob/core/domainobjects/eval/PredicateEvalElement.java index c5589b2a195b8be2c16aa8d9261993a75ac9d5c4..d545f152b7046037976fc8602644d6403677fb89 100644 --- a/de.prob.core/src/de/prob/core/domainobjects/eval/PredicateEvalElement.java +++ b/de.prob.core/src/de/prob/core/domainobjects/eval/PredicateEvalElement.java @@ -10,6 +10,7 @@ import org.eventb.core.ast.Predicate; import de.be4.classicalb.core.parser.BParser; import de.be4.classicalb.core.parser.analysis.DepthFirstAdapter; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.be4.classicalb.core.parser.exceptions.BException; import de.be4.classicalb.core.parser.node.AConjunctPredicate; import de.be4.classicalb.core.parser.node.ADisjunctPredicate; @@ -30,10 +31,10 @@ public class PredicateEvalElement extends AbstractEvalElement { private final String predicate; public static PredicateEvalElement fromRodin(final Predicate predicate) - throws BException { + throws BCompoundException { if (predicate == null) { String message = "Predicate input must not be null"; - throw new BException("", new NullPointerException(message)); + throw new BCompoundException(new BException("", message, new NullPointerException(message))); } final PPredicate apred = TranslationVisitor .translatePredicate(predicate); @@ -43,11 +44,11 @@ public class PredicateEvalElement extends AbstractEvalElement { } public static PredicateEvalElement create(final String predicate) - throws BException { + throws BCompoundException { return new PredicateEvalElement(predicate); } - private PredicateEvalElement(final String predicate) throws BException { + private PredicateEvalElement(final String predicate) throws BCompoundException { this.predicate = predicate; parse = parse(BParser.PREDICATE_PREFIX, predicate); } diff --git a/de.prob.ui/src/de/prob/ui/operationview/CustomPreconditionInputDialog.java b/de.prob.ui/src/de/prob/ui/operationview/CustomPreconditionInputDialog.java index 5873a5e261151b727dc7d2ec3daee7bd3993d69f..38f3b9aff3b4a8afad44cd1b63b314503d3f810e 100644 --- a/de.prob.ui/src/de/prob/ui/operationview/CustomPreconditionInputDialog.java +++ b/de.prob.ui/src/de/prob/ui/operationview/CustomPreconditionInputDialog.java @@ -13,7 +13,7 @@ import java.util.List; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.swt.widgets.Shell; -import de.be4.classicalb.core.parser.exceptions.BException; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.prob.core.Animator; import de.prob.core.command.*; import de.prob.core.domainobjects.Operation; @@ -81,7 +81,7 @@ public class CustomPreconditionInputDialog extends InputDialog { } catch (ProBException e) { // TODO Auto-generated catch block e.printStackTrace(); - } catch (BException e) { + } catch (BCompoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } diff --git a/de.prob.ui/src/de/prob/ui/operationview/GetOperationByPredicateCommand2.java b/de.prob.ui/src/de/prob/ui/operationview/GetOperationByPredicateCommand2.java index 86620965dee94c8f39c91514e2ee7cc328e0a7db..eadac737afb48d660c7d679944c0d82211792c63 100644 --- a/de.prob.ui/src/de/prob/ui/operationview/GetOperationByPredicateCommand2.java +++ b/de.prob.ui/src/de/prob/ui/operationview/GetOperationByPredicateCommand2.java @@ -14,7 +14,7 @@ import org.eventb.core.ast.IParseResult; import org.eventb.core.ast.Predicate; import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog; -import de.be4.classicalb.core.parser.exceptions.BException; +import de.be4.classicalb.core.parser.exceptions.BCompoundException; import de.prob.core.Animator; import de.prob.core.ProblemHandler; import de.prob.core.command.CommandException; @@ -64,7 +64,7 @@ public final class GetOperationByPredicateCommand2 implements try { parsedEvalElement = PredicateEvalElement.fromRodin(parsedPredicate); - } catch (BException e) { + } catch (BCompoundException e) { String message = "Fatal error when trying to parse " + predicate + ". Execution of event " + name + " aborted."; ProblemHandler.raiseCommandException(message); @@ -79,7 +79,7 @@ public final class GetOperationByPredicateCommand2 implements */ public static Operation getOperation(final Animator a, final String stateId, final String name, final String predicate) - throws ProBException, BException { + throws ProBException, BCompoundException { List<Operation> operations = getOperations(a, stateId, name, predicate, 1); @@ -104,14 +104,14 @@ public final class GetOperationByPredicateCommand2 implements * @param nrOfSolutions * - maximum number of solutions * @return an Operation or null - * @throws BException + * @throws BCompoundException * - if the B predicate contains errors * @throws ProBException * - if something terrible happens ;-) */ public static List<Operation> getOperations(final Animator a, final String stateId, final String name, final String predicate, - final int nrOfSolutions) throws ProBException, BException { + final int nrOfSolutions) throws ProBException, BCompoundException { GetOperationByPredicateCommand2 executeOperationCommand = new GetOperationByPredicateCommand2( stateId, name, predicate, nrOfSolutions);