コード例 #1
0
 public boolean reloadRefactoring() {
   try {
     factorer = new FactoryMethod(currentConstructor, new NullContext(getProject()));
     factorer.setHostingClass((BinClass) currentClass);
     return true;
   } catch (NullPointerException e) {
     return false;
   }
 }
コード例 #2
0
  @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();
  }