public boolean reloadRefactoring() { try { factorer = new FactoryMethod(currentConstructor, new NullContext(getProject())); factorer.setHostingClass((BinClass) currentClass); return true; } catch (NullPointerException e) { return false; } }
@Override public boolean applyCheckingPreAndPosCondictions(Resolution resolution) throws RefactoringException { Translate translate = Translate.getTranslate(); CreateFactoryMethodResolution cfmResolution = (CreateFactoryMethodResolution) resolution; factorer.setMethodName(cfmResolution.getMethodName()); factorer.setOptimizeVisibility(cfmResolution.getOptimizeVisibility()); refactoring = factorer; RefactoringStatus status = checkPreconditions(); if (status.isErrorOrFatal()) { throw new RefactoringException(translate.notRefactored(status.getAllMessages())); } status.merge(checkUserInput()); status.merge(factorer.apply()); if (!status.isOk()) { throw new RefactoringException(translate.error(status.getAllMessages())); } System.out.println(status.getAllMessages()); return !status.isErrorOrFatal(); }