本文整理匯總了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;
}
示例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());
}
示例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());
}
示例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;
}
示例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;
}
示例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());
}
示例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));
}
示例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;
}
示例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;
}
示例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));
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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));
}