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

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

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

RefactoringStatus.createErrorStatus介绍

[英]Creates a new RefactoringStatus with one ERROR entry filled with the given message.
[中]创建一个新的RefactoringStatus,其中一个ERROR条目填充了给定的消息。

代码示例

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.api.tools.ui

@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException, OperationCanceledException {
  if (fChanges == null || fChanges.size() < 1) {
    return RefactoringStatus.createErrorStatus(WizardMessages.JavadocTagRefactoring_0);
  }
  return RefactoringStatus.create(Status.OK_STATUS);
}

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

/**
 * Returns a <code>RefactoringStatus</code> that identifies whether the
 * the name <code>newMethodName</code> is available to use as the name of
 * the new factory method within the factory-owner class (either a to-be-
 * created factory class or the constructor-owning class, depending on the
 * user options).
 * @param methodName
 */
private RefactoringStatus isUniqueMethodName(String methodName) {
  boolean	conflict= hasMethod(fFactoryOwningClass, methodName);
  return conflict ? RefactoringStatus.createErrorStatus(RefactoringCoreMessages.IntroduceFactory_duplicateMethodName + methodName) : new RefactoringStatus(); 
}

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

public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
  try {
    RefactoringStatus status= validateInput();
    if (accessesAnonymousFields())
      status.merge(RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_anonymous_field_access)); 
    return status;
  } finally {
    pm.done();
  }
}

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

@Override
public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
  try {
    RefactoringStatus status= validateInput();
    if (accessesAnonymousFields())
      status.merge(RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ConvertAnonymousToNestedRefactoring_anonymous_field_access));
    return status;
  } finally {
    pm.done();
  }
}

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

@Override
public RefactoringStatus verifyDestination(IReorgDestination destination) throws JavaModelException {
  if (destination instanceof JavaElementDestination) {
    return verifyDestination(((JavaElementDestination)destination).getJavaElement());
  } else if (destination instanceof ResourceDestination) {
    return verifyDestination(((ResourceDestination)destination).getResource());
  }
  return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_invalidDestinationKind);
}

代码示例来源:origin: org.eclipse.pde.api.tools/ui

public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException {
  if(fProject.isAccessible()) {
    return RefactoringStatus.create(Status.OK_STATUS);
  }
  return RefactoringStatus.createErrorStatus(MessageFormat.format(WizardMessages.ProjectUpdateChange_project_not_accessible, new String[] {fProject.getName()}));
}

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

@Override
public RefactoringStatus verifyDestination(IReorgDestination destination) throws JavaModelException {
  if (destination instanceof JavaElementDestination) {
    return verifyDestination(((JavaElementDestination)destination).getJavaElement());
  } else if (destination instanceof ResourceDestination) {
    return verifyDestination(((ResourceDestination)destination).getResource());
  }
  return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_invalidDestinationKind);
}

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

@Override
public RefactoringStatus verifyDestination(IReorgDestination destination) throws JavaModelException {
  if (destination instanceof JavaElementDestination) {
    return verifyDestination(((JavaElementDestination)destination).getJavaElement());
  } else if (destination instanceof ResourceDestination) {
    return verifyDestination(((ResourceDestination)destination).getResource());
  }
  return RefactoringStatus.createErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_invalidDestinationKind);
}

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

private RefactoringStatus checkEnclosedTypes() throws CoreException {
  IType enclosedType= findEnclosedType(fType, getNewElementName());
  if (enclosedType == null)
    return null;
  String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_encloses,  
                                  new String[]{JavaModelUtil.getFullyQualifiedName(fType), getNewElementName()});
  return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosedType));
}

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

private RefactoringStatus checkEnclosingTypes() {
  IType enclosingType= findEnclosingType(fType, getNewElementName());
  if (enclosingType == null)
    return null;
    
  String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_enclosed,
              new String[]{JavaModelUtil.getFullyQualifiedName(fType), getNewElementName()});
  return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosingType));
}

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

private RefactoringStatus checkTypeNameInPackage() throws JavaModelException {
  IType type= Checks.findTypeInPackage(fType.getPackageFragment(), fType.getElementName());
  if (type == null || !type.exists() || fType.equals(type)) {
    return null;
  }
  String message= Messages.format(RefactoringCoreMessages.MoveInnerToTopRefactoring_type_exists, new String[] { BasicElementLabels.getJavaElementName(fType.getElementName()), JavaElementLabels.getElementLabel(fType.getPackageFragment(), JavaElementLabels.ALL_DEFAULT)});
  return RefactoringStatus.createErrorStatus(message);
}

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

private RefactoringStatus checkTypeNameInPackage() throws JavaModelException {
  IType type= Checks.findTypeInPackage(fType.getPackageFragment(), fType.getElementName());
  if (type == null || !type.exists() || fType.equals(type)) {
    return null;
  }
  String message= Messages.format(RefactoringCoreMessages.MoveInnerToTopRefactoring_type_exists, new String[] { BasicElementLabels.getJavaElementName(fType.getElementName()), JavaElementLabels.getElementLabel(fType.getPackageFragment(), JavaElementLabels.ALL_DEFAULT)});
  return RefactoringStatus.createErrorStatus(message);
}

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

private RefactoringStatus checkEnclosedTypes() throws CoreException {
  IType enclosedType = findEnclosedType(fType, getNewElementName());
  if (enclosedType == null) {
    return null;
  }
  String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_encloses, new String[] { BasicElementLabels.getJavaElementName(fType.getFullyQualifiedName('.')), getNewElementLabel() });
  return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosedType));
}

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

private RefactoringStatus checkEnclosingTypes() {
  IType enclosingType = findEnclosingType(fType, getNewElementName());
  if (enclosingType == null) {
    return null;
  }
  String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_enclosed, new String[] { BasicElementLabels.getJavaElementName(fType.getFullyQualifiedName('.')), getNewElementLabel() });
  return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosingType));
}

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

private RefactoringStatus checkEnclosedTypes() throws CoreException {
  IType enclosedType= findEnclosedType(fType, getNewElementName());
  if (enclosedType == null)
    return null;
  String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_encloses,
      new String[] { BasicElementLabels.getJavaElementName(fType.getFullyQualifiedName('.')), getNewElementLabel()});
  return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosedType));
}

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

private RefactoringStatus checkEnclosedTypes() throws CoreException {
  IType enclosedType= findEnclosedType(fType, getNewElementName());
  if (enclosedType == null)
    return null;
  String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_encloses,
      new String[] { BasicElementLabels.getJavaElementName(fType.getFullyQualifiedName('.')), getNewElementLabel()});
  return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(enclosedType));
}

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

private RefactoringStatus checkTypeNameInPackage() throws JavaModelException {
  IType type= Checks.findTypeInPackage(fType.getPackageFragment(), fType.getElementName());
  if (type == null || !type.exists())
    return null;
  String message= Messages.format(RefactoringCoreMessages.MoveInnerToTopRefactoring_type_exists, new String[] { fType.getElementName(), fType.getPackageFragment().getElementName()}); 
  return RefactoringStatus.createErrorStatus(message);
}

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

private RefactoringStatus checkTypesInPackage() throws CoreException {
  IType type = Checks.findTypeInPackage(fType.getPackageFragment(), getNewElementName());
  if (type == null || !type.exists()) {
    return null;
  }
  String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_exists, new String[] { getNewElementLabel(), JavaElementLabels.getElementLabel(fType.getPackageFragment(), JavaElementLabels.ALL_DEFAULT) });
  return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(type));
}

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

private RefactoringStatus checkTypesImportedInCu() throws CoreException {
  IImportDeclaration imp= getImportedType(fType.getCompilationUnit(), getNewElementName());
  
  if (imp == null)
    return null;	
    
  String msg= Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_imported, 
                    new Object[]{getNewElementName(), fType.getCompilationUnit().getResource().getFullPath()});
  IJavaElement grandParent= imp.getParent().getParent();
  if (grandParent instanceof ICompilationUnit)
    return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(imp));
  return null;	
}

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

private RefactoringStatus checkTypesImportedInCu() throws CoreException {
  IImportDeclaration imp = getImportedType(fType.getCompilationUnit(), getNewElementName());
  if (imp == null) {
    return null;
  }
  String msg = Messages.format(RefactoringCoreMessages.RenameTypeRefactoring_imported, new Object[] { getNewElementLabel(), BasicElementLabels.getPathLabel(fType.getCompilationUnit().getResource().getFullPath(), false) });
  IJavaElement grandParent = imp.getParent().getParent();
  if (grandParent instanceof ICompilationUnit) {
    return RefactoringStatus.createErrorStatus(msg, JavaStatusContext.create(imp));
  }
  return null;
}

相关文章