// If the current exception is appropriate, or its cause is
// appropriate, then we look for the missing variable. If the
// exception or its cause does not have the node name, then we
// can't do anything.
UndefinedConstantOrIdentifierException idException = null;
if (exception instanceof UndefinedConstantOrIdentifierException) {
idException = (UndefinedConstantOrIdentifierException) exception;
} else {
if (exception.getCause() instanceof UndefinedConstantOrIdentifierException) {
idException = (UndefinedConstantOrIdentifierException) exception
.getCause();
}
}
if (idException == null) {
// The exception or the cause was not an
// UndefinedConstantOrIdentifierException, so we cannot do
// anything.
return false;
}
// We have an exception that has the name of the missing
// variable.
// Find the variable in the object we are copying.
// Get the name of the variable without the .auto.
String variableName = exception.getNameable1().getFullName().substring(
((NamedObj) exception.getNameable1()).toplevel().getName()
.length() + 2);
Attribute masterAttribute = container.getAttribute(variableName);
if (masterAttribute instanceof Variable) {
Variable masterVariable = (Variable) masterAttribute;
ParserScope parserScope = masterVariable.getParserScope();
if (parserScope instanceof ModelScope) {
if (masterVariable != null) {
Variable node = masterVariable.getVariable(idException
.nodeName());
if (node == _previousNode) {
// We've already seen this node, so stop
// looping through the getToken() loop.