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

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

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

RefactoringStatus.createFatalErrorStatus介绍

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

代码示例

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

/**
   * Can destination be a target for the given source elements?
   *
   * @param destination the destination to verify
   * @return OK status if valid destination
   * @throws JavaModelException should not happen
   */
  protected RefactoringStatus verifyDestination(IResource destination) throws JavaModelException {
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_no_resource);
  }
}

代码示例来源:origin: org.eclipse/org.eclipse.ltk.core.refactoring

/**
   * {@inheritDoc}
   */
  public Refactoring createRefactoring(final RefactoringStatus status) throws CoreException {
    status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.UnknownRefactoringDescriptor_cannot_create_refactoring));
    return null;
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ltk.core.refactoring

@Override
  public Refactoring createRefactoring(final RefactoringStatus status) throws CoreException {
    status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.UnknownRefactoringDescriptor_cannot_create_refactoring));
    return null;
  }
}

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

private RefactoringStatus checkDeclaringType(){
  IType declaringType= getDeclaringType();
      
  if (JavaModelUtil.getFullyQualifiedName(declaringType).equals("java.lang.Object")) //$NON-NLS-1$
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveMembersRefactoring_Object);	 
  if (declaringType.isBinary())
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveMembersRefactoring_binary);	 
  if (declaringType.isReadOnly())
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveMembersRefactoring_read_only);	 
  
  return null;
}

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

public RefactoringStatus setDestination(IJavaElement destination) {
  fDestination= destination;
  if (ReorgUtils.getCompilationUnit(destination) == null)
    return RefactoringStatus.createFatalErrorStatus(ReorgMessages.PasteAction_wrong_destination); 
  if (! destination.exists())
    return RefactoringStatus.createFatalErrorStatus(ReorgMessages.PasteAction_element_doesnot_exist); 
  if (! canPasteAll(destination))
    return RefactoringStatus.createFatalErrorStatus(ReorgMessages.PasteAction_invalid_destination); 
  return new RefactoringStatus();
}
private boolean canPasteAll(IJavaElement destination) {

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

@Override
public final boolean visit(final SuperFieldAccess node) {
  Assert.isNotNull(node);
  fStatus.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveInstanceMethodProcessor_uses_super, JavaStatusContext.create(fMethod.getCompilationUnit(), node)));
  fResult.add(node);
  return false;
}

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

/**
   * {@inheritDoc}
   */
  public final RefactoringStatus initialize(final RefactoringArguments arguments) {
    Assert.isNotNull(arguments);
    final RefactoringProcessor processor= getProcessor();
    if (processor instanceof IScriptableRefactoring) {
      return ((IScriptableRefactoring) processor).initialize(arguments);
    }
    return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.ProcessorBasedRefactoring_error_unsupported_initialization, IJavaRefactorings.USE_SUPER_TYPE));
  }
}

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

public final boolean visit(final ThisExpression node) {
    Assert.isNotNull(node);
    if (node.getQualifier() != null) {
      fStatus.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.MoveInstanceMethodProcessor_refers_enclosing_instances, JavaStatusContext.create(fMethod.getCompilationUnit(), node)));
      fResult.add(node);
    }
    return false;
  }
}

代码示例来源: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

private void changeRefactoring(InlineMethodRefactoring.Mode mode) {
    RefactoringStatus status;
    try {
      status= fRefactoring.setCurrentMode(mode);
    } catch (JavaModelException e) {
      status= RefactoringStatus.createFatalErrorStatus(e.getMessage());
    }
    setPageComplete(status);
  }
}

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

private void changeRefactoring(InlineMethodRefactoring.Mode mode) {
    RefactoringStatus status;
    try {
      status= fRefactoring.setCurrentMode(mode);
    } catch (JavaModelException e) {
      status= RefactoringStatus.createFatalErrorStatus(e.getMessage());
    }
    setPageComplete(status);
  }    
}

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

public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  initAST();
  if (fTempDeclarationNode == null || fTempDeclarationNode.resolveBinding() == null)
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.RenameTempRefactoring_must_select_local); 
  if (! Checks.isDeclaredIn(fTempDeclarationNode, MethodDeclaration.class) 
   && ! Checks.isDeclaredIn(fTempDeclarationNode, Initializer.class))
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.RenameTempRefactoring_only_in_methods_and_initializers); 
      
  initNames();            
  return new RefactoringStatus();
}

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

protected RefactoringStatus validateNewName(String newName) {
    INameUpdating ref= getNameUpdating();
    ref.setNewElementName(newName);
    try{
      return ref.checkNewElementName(newName);
    } catch (CoreException e){
      JavaPlugin.log(e);
      return RefactoringStatus.createFatalErrorStatus(RefactoringMessages.RenameRefactoringWizard_internal_error);
    }    
  }
}

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

protected RefactoringStatus checkDeclaringType(final IProgressMonitor monitor) throws JavaModelException {
  final RefactoringStatus status= super.checkDeclaringType(monitor);
  if (JavaModelUtil.getFullyQualifiedName(getDeclaringType()).equals("java.lang.Object")) //$NON-NLS-1$
    status.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.PullUpRefactoring_no_java_lang_Object));
  status.merge(checkDeclaringSuperTypes(monitor));
  return status;
}

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

@Override
protected RefactoringStatus verifyDestination(IJavaElement javaElement) throws JavaModelException {
  RefactoringStatus superStatus= super.verifyDestination(javaElement);
  if (superStatus.hasFatalError()) {
    return superStatus;
  }
  IJavaProject javaProject= getDestinationJavaProject();
  if (isParentOfAny(javaProject, getPackageFragmentRoots())) {
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_element2parent);
  }
  return superStatus;
}

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

@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor monitor) throws CoreException, OperationCanceledException {
  Assert.isNotNull(monitor);
  if (!fTypeParameter.exists())
    return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.RenameTypeParameterRefactoring_deleted, BasicElementLabels.getFileName(fTypeParameter.getDeclaringMember().getCompilationUnit())));
  return Checks.checkIfCuBroken(fTypeParameter.getDeclaringMember());
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ltk.core.refactoring

@Override
public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException {
  if (!fResourceState.isValid()) {
    return RefactoringStatus.createFatalErrorStatus(Messages.format(RefactoringCoreMessages.UndoDeleteResourceChange_cannot_restore, BasicElementLabels.getResourceName(fResourceState.getName())));
  }
  return new RefactoringStatus();
}

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

@Override
public RefactoringStatus checkInitialConditions(IProgressMonitor pm) throws CoreException {
  IField primary= (IField) fField.getPrimaryElement();
  if (primary == null || !primary.exists()) {
    String message= Messages.format(RefactoringCoreMessages.RenameFieldRefactoring_deleted, BasicElementLabels.getFileName(fField.getCompilationUnit()));
    return RefactoringStatus.createFatalErrorStatus(message);
  }
  fField= primary;
  return Checks.checkIfCuBroken(fField);
}

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

@Override
protected RefactoringStatus verifyDestination(IResource destination) {
  RefactoringStatus superStatus= super.verifyDestination(destination);
  if (superStatus.hasFatalError()) {
    return superStatus;
  }
  Object commonParent= new ParentChecker(getResources(), getJavaElements()).getCommonParent();
  if (destination.equals(commonParent)) {
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_cannot_move_source_to_parent);
  }
  return superStatus;
}

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

@Override
protected RefactoringStatus verifyDestination(IResource destination) {
  RefactoringStatus superStatus= super.verifyDestination(destination);
  if (superStatus.hasFatalError()) {
    return superStatus;
  }
  Object commonParent= new ParentChecker(getResources(), getJavaElements()).getCommonParent();
  if (destination.equals(commonParent)) {
    return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ReorgPolicyFactory_cannot_move_package_to_parent);
  }
  return superStatus;
}

相关文章