/** * Comprueba el valor de verdad del predicado. * * @return <code>true</code> si no existen llamadas al método en todo el modelo; <code>false * </code>, en caso contrario. */ @Override public boolean isValid() { Collection<ClassDef> allClasses = MOONRefactoring.getModel().getClassDefSourceAvailable(); for (ClassDef nextClass : allClasses) { List<MethDec> modelMethods = nextClass.getMethDec(); for (MethDec nextMethod : modelMethods) { MethodInstructionsCollector mic = new MethodInstructionsCollector(nextMethod); for (Instr instruction : mic.getCollection()) { if (instruction instanceof CallInstr) { if (!checkCallInstr((CallInstr) instruction)) return false; } else { if (instruction instanceof AssignmentInstr) { Expr expresion = ((AssignmentInstr) instruction).getRighSide(); if (expresion instanceof CallExpr) if (!(checkCallExpr((CallExpr) expresion))) return false; } } } } } return true; }
/** Ejecuta los renombrado. */ public void run() { listenerReg.notify("# run():RenameGenericClassType #"); // $NON-NLS-1$ Collection<Type> types = MOONRefactoring.getModel().getTypes(); for (Type type : types) if (type instanceof ClassType && type.getClassDef() != null && type.getClassDef().isGeneric() && ((ClassType) type).getClassDef() == classDef) { actions.add(new RenameType(((ClassType) type), newName)); } for (Action next : actions) next.run(); }