當前位置: 首頁>>代碼示例>>Java>>正文


Java Problem.isFatal方法代碼示例

本文整理匯總了Java中org.netbeans.modules.refactoring.api.Problem.isFatal方法的典型用法代碼示例。如果您正苦於以下問題:Java Problem.isFatal方法的具體用法?Java Problem.isFatal怎麽用?Java Problem.isFatal使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.netbeans.modules.refactoring.api.Problem的用法示例。


在下文中一共展示了Problem.isFatal方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validation

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
private Problem validation(int phase, CompilationController javac) throws IOException {
    Problem result = null;
    for (EncapsulateFieldRefactoringPlugin ref : refactorings) {
        Problem lastresult = null;
        switch (phase) {
        case 1: lastresult = ref.fastCheckParameters(); break;
        case 2:
            lastresult = ref.preCheck(javac);
            result = JavaPluginUtils.chainProblems(result, lastresult);
            if (result != null && result.isFatal()) {
                return result;
            }
            lastresult = ref.checkParameters(javac);
            ref.addProgressListener(listener);
            break;
        }
        
        result = JavaPluginUtils.chainProblems(result, lastresult);
        if (result != null && result.isFatal()) {
            return result;
        }
        
    }

    return result;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:EncapsulateFieldsPlugin.java

示例2: checkParameters

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
public Problem checkParameters() {
    if (!isRenameTestClass() && !isRenameTestClassMethod()) {
        return null;
    }

    initDelegates();

    Problem p = null;
    for (RenameRefactoring delegate : renameDelegates) {
        p = JavaPluginUtils.chainProblems(p, delegate.checkParameters());
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    return JavaPluginUtils.chainProblems(p, super.checkParameters());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:RenameTestClassRefactoringPlugin.java

示例3: fastCheckParameters

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
  public Problem fastCheckParameters() {
      if (!isRenameTestClass() && !isRenameTestClassMethod()) {
          return null;
      }
      initDelegates();

      Problem p = null;
      for (RenameRefactoring delegate : renameDelegates) {
          FileObject delegateFile = delegate.getRefactoringSource().lookup(FileObject.class);
   if(!isRenameTestClassMethod()) {
delegate.setNewName(newName(treePathHandle.getFileObject(), delegateFile, refactoring.getNewName()));
   }
          p = JavaPluginUtils.chainProblems(p, delegate.fastCheckParameters());
          if (p != null && p.isFatal()) {
              return p;
          }
      }
      return JavaPluginUtils.chainProblems(p, super.fastCheckParameters());
  }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:RenameTestClassRefactoringPlugin.java

示例4: prepare

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
public Problem prepare(RefactoringElementsBag reb) {
    if (!isRenameTestClass() && !isRenameTestClassMethod()) {
        return null;
    }
    initDelegates();
    fireProgressListenerStart(ProgressEvent.START, renameDelegates.length);
    Problem p = null;
    for (RenameRefactoring delegate : renameDelegates) {
        p = JavaPluginUtils.chainProblems(p, delegate.prepare(reb.getSession()));
        if (p != null && p.isFatal()) {
            return p;
        }
        fireProgressListenerStep();
    }
    fireProgressListenerStop();
    return p;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:RenameTestClassRefactoringPlugin.java

示例5: chainProblems

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
public static Problem chainProblems(Problem result, Problem problem) {
    if (result == null) {
        return problem;
    }
    if (problem == null) {
        return result;
    }
    Problem value;
    if(problem.isFatal()) {
        problem.setNext(result);
        value = problem;
    } else {
        Problem next = value = result;
        while (next.getNext() != null) {
            next = next.getNext();
        }
        next.setNext(problem);
    }
    return value;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:JavaPluginUtils.java

示例6: checkParameters

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
public Problem checkParameters() {
    if (!isRenameProperty()) {
        return null;
    }

    initDelegates();

    Problem p = null;
    if (getterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, getterDelegate.checkParameters());
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    if (setterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, setterDelegate.checkParameters());
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    if (parameterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, parameterDelegate.checkParameters());
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    return p = JavaPluginUtils.chainProblems(p, super.checkParameters());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:RenamePropertyRefactoringPlugin.java

示例7: preCheck

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
protected Problem preCheck(CompilationController javac) throws IOException {
    if (!isRenameProperty()) {
        return null;
    }
    initDelegates();
    Problem p = null;
    if (getterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, getterDelegate.preCheck());
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    if (setterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, setterDelegate.preCheck());
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    if (parameterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, parameterDelegate.preCheck());
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    return p = JavaPluginUtils.chainProblems(p, super.preCheck(javac));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:28,代碼來源:RenamePropertyRefactoringPlugin.java

示例8: prepare

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
public Problem prepare(RefactoringElementsBag reb) {
    if (!isRenameProperty()) {
        return null;
    }
    initDelegates();
    fireProgressListenerStart(AbstractRefactoring.PREPARE, 3);
    Problem p = null;
    if (getterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, getterDelegate.prepare(reb.getSession()));
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    fireProgressListenerStep();
    if (setterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, setterDelegate.prepare(reb.getSession()));
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    fireProgressListenerStep();
    if (parameterDelegate != null) {
        p = JavaPluginUtils.chainProblems(p, parameterDelegate.prepare(reb.getSession()));
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    fireProgressListenerStep();

    fireProgressListenerStop();

    return p;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:35,代碼來源:RenamePropertyRefactoringPlugin.java

示例9: prepare

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
public Problem prepare(RefactoringElementsBag elements) {
    Problem problem = null;
    Set<FileObject> references = new LinkedHashSet<FileObject>();
    List<EncapsulateDesc> descs = new ArrayList<EncapsulateDesc>(refactorings.size());
    fireProgressListenerStart(AbstractRefactoring.PREPARE, refactorings.size() + 1);
    for (EncapsulateFieldRefactoringPlugin ref : refactorings) {
        if (cancelRequested.get()) {
            return null;
        }
        
        EncapsulateDesc desc = ref.prepareEncapsulator(problem);
        problem = desc.p;
        desc.p = null;
        if (problem != null && problem.isFatal()) {
            return problem;
        }
        descs.add(desc);
        references.addAll(desc.refs);
        fireProgressListenerStep();
    }

    Encapsulator encapsulator = new Encapsulator(descs, problem,
            refactoring.getContext().lookup(Integer.class),
            refactoring.getContext().lookup(SortBy.class),
            refactoring.getContext().lookup(Javadoc.class)
            );
    Problem prob = createAndAddElements(references, new TransformTask(encapsulator, descs.get(0).fieldHandle), elements, refactoring);
    fireProgressListenerStop();
    problem = encapsulator.getProblem();
    return prob != null ? prob : problem;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:33,代碼來源:EncapsulateFieldsPlugin.java

示例10: preCheck

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
protected Problem preCheck(CompilationController javac) throws IOException {
    if (!isRenameTestClass() && !isRenameTestClassMethod()) {
        return null;
    }
    initDelegates();
    Problem p = null;
    for (RenameRefactoring delegate : renameDelegates) {
        p = JavaPluginUtils.chainProblems(p, delegate.preCheck());
        if (p != null && p.isFatal()) {
            return p;
        }
    }
    return JavaPluginUtils.chainProblems(p, super.preCheck(javac));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:16,代碼來源:RenameTestClassRefactoringPlugin.java

示例11: problemIsFatal

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
protected static boolean problemIsFatal(List<Problem> problems) {
    for (Problem problem : problems) {
        if (problem.isFatal()) {
            return true;
        }
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:9,代碼來源:RefTestBase.java

示例12: perform

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
public boolean perform(AbstractRefactoring absRefactoring, ParameterSetter parameterSetter) {
    Problem problem = absRefactoring.preCheck();
    boolean fatal = false;
    while (problem != null) {
        ref(problem.getMessage());
        fatal = fatal || problem.isFatal();
        problem = problem.getNext();
    }
    if (fatal) {
        return false;
    }
    parameterSetter.setParameters();
    problem = absRefactoring.fastCheckParameters();
    while (problem != null) {
        ref(problem.getMessage());
        fatal = fatal || problem.isFatal();
        problem = problem.getNext();
    }
    if (fatal) {
        return false;
    }
    problem = absRefactoring.checkParameters();
    while (problem != null) {
        ref(problem.getMessage());
        fatal = fatal || problem.isFatal();
        problem = problem.getNext();
    }
    if (fatal) {
        return false;
    }
    RefactoringSession rs = RefactoringSession.create("Session");
    try {
        absRefactoring.prepare(rs);
        Collection<RefactoringElement> elems = rs.getRefactoringElements();
        rs.doRefactoring(true);
    } catch (Throwable t) {
        t.printStackTrace();
    }
    return true;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:41,代碼來源:RefPerfTestCase.java

示例13: problemIsFatal

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
protected static boolean problemIsFatal(List<Problem> problems) {
    for (Problem problem : problems) {
        Problem next = problem;
        do {
            if (next.isFatal()) {
                return true;
            }
            next = next.getNext();
        } while (next != null);
    }
    return false;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:RefactoringTestBase.java

示例14: doRenameRefactoring

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
private static void doRenameRefactoring(FormDataObject dao, String newName, TreePathHandle handle) throws IOException {
    if(handle==null){
        //this would only happen if setName were called without the correct component being
        //selected some how...
        return;
    }
    FormEditorSupport fes = (FormEditorSupport)dao.getFormEditorSupport();
    if (fes.isModified()) {
        fes.saveDocument();
    }
    //ok, so we are now ready to actually setup our RenameRefactoring...we need the element TreePathHandle
    Lookup rnl = Lookups.singleton(handle);
    RefactoringSession renameSession = RefactoringSession.create("Change variable name");//NOI18N
    RenameRefactoring refactoring = new RenameRefactoring(rnl);
    Problem pre = refactoring.preCheck();
    if(pre!=null&&pre.isFatal()){
        Logger.getLogger("global").log(Level.WARNING, "There were problems trying to perform the refactoring.");
    }

    Problem p = null;

    if( (!(pre!=null&&pre.isFatal())) && !emptyOrWhite(newName) ){
        refactoring.setNewName(newName);
        p = refactoring.prepare(renameSession);
    }

    if( (!(p!=null&&p.isFatal())) && !emptyOrWhite(newName) ){
        renameSession.doRefactoring(true);
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:RADComponentRenameRefactoringSupport.java

示例15: fastCheckParameters

import org.netbeans.modules.refactoring.api.Problem; //導入方法依賴的package包/類
@Override
protected Problem fastCheckParameters(CompilationController info) throws IOException {
    if (!isRenameProperty()) {
        return null;
    }
    initDelegates();
    
    info.toPhase(JavaSource.Phase.RESOLVED);
    Element el = property.resolveElement(info);
    if (el == null || el.getKind() != ElementKind.FIELD) {
        return null;
    }
    String oldName = el.getSimpleName().toString();
    String bareName = RefactoringUtils.removeFieldPrefixSuffix(el, codeStyle);

    boolean isStatic = el.getModifiers().contains(Modifier.STATIC);
    String bareNewName = CodeStyleUtils.removePrefixSuffix(refactoring.getNewName(),
            isStatic ? codeStyle.getStaticFieldNamePrefix() : codeStyle.getFieldNamePrefix(),
            isStatic ? codeStyle.getStaticFieldNameSuffix() : codeStyle.getFieldNameSuffix());
    
    if (bareName.equals(bareNewName)) {
        return null;
    }
    
    Problem p = null;
    JavaRenameProperties renameProps = refactoring.getContext().lookup(JavaRenameProperties.class);
    boolean saveNoChange = false;
    if (renameProps != null) {
        saveNoChange = renameProps.isNoChangeOK();
        renameProps.setNoChangeOK(true);
    }
    try {
        if (getterDelegate != null) {
            String gettername = CodeStyleUtils.computeGetterName(
                                    refactoring.getNewName(), isBoolean, isStatic, codeStyle);
            getterDelegate.setNewName(gettername);
            p = JavaPluginUtils.chainProblems(p, getterDelegate.fastCheckParameters());
            if (p != null && p.isFatal()) {
                return p;
            }
        }
        if (setterDelegate != null) {
            String settername = CodeStyleUtils.computeSetterName(
                                    refactoring.getNewName(), isStatic, codeStyle);
            setterDelegate.setNewName(settername);
            p = JavaPluginUtils.chainProblems(p, setterDelegate.fastCheckParameters());
            if (p != null && p.isFatal()) {
                return p;
            }
        }
        if (parameterDelegate != null) {
            String newParam = RefactoringUtils.addParamPrefixSuffix(
                            CodeStyleUtils.removePrefixSuffix(
                            refactoring.getNewName(),
                            isStatic ? codeStyle.getStaticFieldNamePrefix() : codeStyle.getFieldNamePrefix(),
                            isStatic ? codeStyle.getStaticFieldNameSuffix() : codeStyle.getFieldNameSuffix()), codeStyle);
            parameterDelegate.setNewName(newParam);
            p = JavaPluginUtils.chainProblems(p, parameterDelegate.fastCheckParameters());
            if (p != null && p.isFatal()) {
                return p;
            }
        }
    } finally {
        if (renameProps != null) {
            renameProps.setNoChangeOK(saveNoChange);
        }
    }
    return p = JavaPluginUtils.chainProblems(p, super.fastCheckParameters(info));
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:70,代碼來源:RenamePropertyRefactoringPlugin.java


注:本文中的org.netbeans.modules.refactoring.api.Problem.isFatal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。