org.eclipse.ltk.core.refactoring.RefactoringStatus.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.0k)|赞(0)|评价(0)|浏览(70)

本文整理了Java中org.eclipse.ltk.core.refactoring.RefactoringStatus.<init>方法的一些代码示例,展示了RefactoringStatus.<init>的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RefactoringStatus.<init>方法的具体详情如下:
包路径:org.eclipse.ltk.core.refactoring.RefactoringStatus
类名称:RefactoringStatus
方法名:<init>

RefactoringStatus.<init>介绍

[英]Creates a new refactoring status with an empty list of status entries and a severity of OK.
[中]创建一个新的重构状态,状态条目列表为空,严重性为[$0$]。

代码示例

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public RefactoringStatus checkActivation() throws JavaModelException {
  return new RefactoringStatus();
}
@Override

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

public static RefactoringStatus checkPostConditions(IProgressMonitor monitor) {
  if (monitor != null)
    monitor.done();
  fCurrentContext= null;
  return new RefactoringStatus();
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
protected RefactoringStatus doCheckFinalConditions(IProgressMonitor pm, CheckConditionsContext context) throws CoreException {
  pm.beginTask("", 1); //$NON-NLS-1$
  try{
    return new RefactoringStatus();
  } finally{
    pm.done();
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {
  if (pm != null) {
    pm.beginTask("", 1); //$NON-NLS-1$
    pm.worked(1);
    pm.done();
  }
  return new RefactoringStatus();
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private RefactoringStatus checkNonAbstractMembersInDestinationClasses(IMember[] membersToPushDown, IType[] destinationClassesForNonAbstract) throws JavaModelException {
  RefactoringStatus result= new RefactoringStatus();
  List<IMember> list= new ArrayList<>(); // Arrays.asList does not support removing
  list.addAll(Arrays.asList(membersToPushDown));
  list.removeAll(Arrays.asList(getAbstractMembers(membersToPushDown)));
  IMember[] nonAbstractMembersToPushDown= list.toArray(new IMember[list.size()]);
  for (int i= 0; i < destinationClassesForNonAbstract.length; i++) {
    result.merge(MemberCheckUtil.checkMembersInDestinationType(nonAbstractMembersToPushDown, destinationClassesForNonAbstract[i]));
  }
  return result;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

/**
 * Clears all results found so far, and sets resets the status to {@link RefactoringStatus#OK}.
 */
public final void clearResults() {
  getCollector().clearResults();
  fStatus= new RefactoringStatus();
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private RefactoringStatus checkAbstractMembersInDestinationClasses(IMember[] membersToPushDown, IType[] destinationClassesForAbstract) throws JavaModelException {
  RefactoringStatus result= new RefactoringStatus();
  IMember[] abstractMembersToPushDown= getAbstractMembers(membersToPushDown);
  for (int index= 0; index < destinationClassesForAbstract.length; index++) {
    result.merge(MemberCheckUtil.checkMembersInDestinationType(abstractMembersToPushDown, destinationClassesForAbstract[index]));
  }
  return result;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
  try{
    RefactoringStatus result= new RefactoringStatus();
    result.merge(checkClashesWithExistingFields());
    if (fInitializeIn == INITIALIZE_IN_CONSTRUCTOR)
      result.merge(checkClashesInConstructors());
    return result;
  } finally {
    pm.done();
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  if (fSubstitutions.length == 0) {
    String message= Messages.format(NLSMessages.NLSRefactoring_no_strings, BasicElementLabels.getFileName(fCu));
    return RefactoringStatus.createFatalErrorStatus(message);
  }
  return new RefactoringStatus();
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

public RefactoringStatus perform(TextEditGroup textEditGroup) throws CoreException {
  RefactoringStatus result= new RefactoringStatus();
  String[] blocks= fSourceProvider.getCodeBlocks(fContext, fImportRewrite);
  if(!fFieldInitializer) {
    initializeInsertionPoint(fSourceProvider.getNumberOfStatements() + fLocals.size());
  }
  addNewLocals(textEditGroup);
  replaceCall(result, blocks, textEditGroup);
  return result;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

private RefactoringStatus analyzeCompilationUnits() throws CoreException {
  if (fOccurrences.length == 0) {
    return null;
  }
  RefactoringStatus result= new RefactoringStatus();
  fOccurrences= Checks.excludeCompilationUnits(fOccurrences, result);
  if (result.hasFatalError()) {
    return result;
  }
  result.merge(Checks.checkCompileErrorsInAffectedFiles(fOccurrences));
  return result;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

private RefactoringStatus analyzeAffectedCompilationUnits() throws CoreException{
  RefactoringStatus result= new RefactoringStatus();
  fReferences= Checks.excludeCompilationUnits(fReferences, result);
  if (result.hasFatalError()) {
    return result;
  }
  result.merge(Checks.checkCompileErrorsInAffectedFiles(fReferences));
  return result;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private RefactoringStatus checkIfAnythingToDo() throws JavaModelException {
  if (NLSSubstitution.countItems(fSubstitutions, NLSSubstitution.EXTERNALIZED) != 0 && willCreateAccessorClass())
    return null;
  if (willModifyPropertyFile())
    return null;
  if (willModifySource())
    return null;
  RefactoringStatus result= new RefactoringStatus();
  result.addFatalError(NLSMessages.NLSRefactoring_nothing_to_do);
  return result;
}

代码示例来源:origin: eclipse/eclipse.jdt.ls

private RefactoringStatus checkMatchingFragments() throws JavaModelException {
  RefactoringStatus result = new RefactoringStatus();
  IASTFragment[] matchingFragments = getMatchingFragments();
  for (int i = 0; i < matchingFragments.length; i++) {
    ASTNode node = matchingFragments[i].getAssociatedNode();
    if (isLeftValue(node) && !isReferringToLocalVariableFromFor((Expression) node)) {
      String msg = RefactoringCoreMessages.ExtractTempRefactoring_assigned_to;
      result.addWarning(msg, JavaStatusContext.create(fCu, node));
    }
  }
  return result;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

public static RefactoringStatus checkMembersInDestinationType(IMember[] members, IType destinationType) throws JavaModelException {
  RefactoringStatus result= new RefactoringStatus();
  for (int i= 0; i < members.length; i++) {
    if (members[i].getElementType() == IJavaElement.METHOD)
      checkMethodInType(destinationType, result, (IMethod)members[i]);
    else if (members[i].getElementType() == IJavaElement.FIELD)
      checkFieldInType(destinationType, result, (IField)members[i]);
    else if (members[i].getElementType() == IJavaElement.TYPE)
      checkTypeInType(destinationType, result, (IType)members[i]);
  }
  return result;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

public RefactoringStatus checkActivationBasics(CompilationUnit rootNode) throws CoreException {
  RefactoringStatus result= new RefactoringStatus();
  fRootNode= rootNode;
  fAnalyzer= new SurroundWithTryCatchAnalyzer(fCUnit, fSelection);
  fRootNode.accept(fAnalyzer);
  result.merge(fAnalyzer.getStatus());
  ITypeBinding[] exceptions= fAnalyzer.getExceptions();
  if (fIsMultiCatch && (exceptions == null || exceptions.length <= 1)) {
    result.merge(RefactoringStatus.createWarningStatus(RefactoringCoreMessages.SurroundWithTryCatchRefactoring_notMultipleexceptions));
  }
  return result;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private RefactoringStatus validatePage(boolean text) {
  RefactoringStatus result= new RefactoringStatus();
  if (text) {
    result.merge(validateMethodName());
    result.merge(validateParameters());
  } else {
    result.merge(validateParameters());
    result.merge(validateMethodName());
  }
  return result;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private static RefactoringStatus analyzeCompileErrors(String newCuSource, CompilationUnit newCUNode, CompilationUnit oldCUNode) {
    RefactoringStatus result= new RefactoringStatus();
    IProblem[] newProblems= RefactoringAnalyzeUtil.getIntroducedCompileProblems(newCUNode, oldCUNode);
    for (int i= 0; i < newProblems.length; i++) {
      IProblem problem= newProblems[i];
      if (problem.isError())
        result.addEntry(new RefactoringStatusEntry((problem.isError() ? RefactoringStatus.ERROR : RefactoringStatus.WARNING), problem.getMessage(), new JavaStringStatusContext(newCuSource,
            SourceRangeFactory.create(problem))));
    }
    return result;
  }
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private RefactoringStatus checkTypesInCompilationUnit() {
  RefactoringStatus result= new RefactoringStatus();
  if (! Checks.isTopLevel(fType)){ //the other case checked in checkTypesInPackage
    IType siblingType= fType.getDeclaringType().getType(getNewElementName());
    if (siblingType.exists()){
      String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_member_type_exists,
        new String[] { getNewElementLabel(), BasicElementLabels.getJavaElementName(fType.getDeclaringType().getFullyQualifiedName('.'))});
      result.addError(msg, JavaStatusContext.create(siblingType));
    }
  }
  return result;
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private RefactoringStatus checkClass() {
  RefactoringStatus status= new RefactoringStatus();
  IType type= fDescriptor.getType();
  if (!fDescriptor.isCreateTopLevel()) {
    if (type.getType(fDescriptor.getClassName()).exists()) {
      status.addError(Messages.format(RefactoringCoreMessages.ExtractClassRefactoring_errror_nested_name_clash, new Object[] { BasicElementLabels.getJavaElementName(fDescriptor.getClassName()), BasicElementLabels.getJavaElementName(type.getElementName()) }));
    }
  } else {
    status.merge(checkPackageClass());
  }
  return status;
}

相关文章