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

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

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

RefactoringStatus.hasError介绍

[英]Returns true if the current severity is FATAL or ERROR.
[中]如果当前严重性为FATALERROR,则返回true

代码示例

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

public static ReorgMoveStarter create(IJavaElement[] javaElements, IResource[] resources, IReorgDestination destination) throws JavaModelException {
  Assert.isNotNull(javaElements);
  Assert.isNotNull(resources);
  Assert.isNotNull(destination);
  IMovePolicy policy= ReorgPolicyFactory.createMovePolicy(resources, javaElements);
  if (!policy.canEnable())
    return null;
  JavaMoveProcessor processor= new JavaMoveProcessor(policy);
  if (processor.setDestination(destination).hasError())
    return null;
  return new ReorgMoveStarter(processor);
}

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

public static ReorgMoveStarter create(IJavaElement[] javaElements, IResource[] resources, IReorgDestination destination) throws JavaModelException {
  Assert.isNotNull(javaElements);
  Assert.isNotNull(resources);
  Assert.isNotNull(destination);
  IMovePolicy policy= ReorgPolicyFactory.createMovePolicy(resources, javaElements);
  if (!policy.canEnable())
    return null;
  JavaMoveProcessor processor= new JavaMoveProcessor(policy);
  if (processor.setDestination(destination).hasError())
    return null;
  return new ReorgMoveStarter(processor);
}

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

private void validateInput(boolean methodName) {
   RefactoringStatus merged= new RefactoringStatus();
   if (fMethodNameStatus != null && (methodName || fMethodNameStatus.hasError()))
     merged.merge(fMethodNameStatus);
   if (fDestinationStatus != null && (!methodName || fDestinationStatus.hasError()))
     merged.merge(fDestinationStatus);
   setPageComplete(!merged.hasError());
   int severity= merged.getSeverity();
   String message= merged.getMessageMatchingSeverity(severity);
   if (severity >= RefactoringStatus.INFO) {
     setMessage(message, severity);
   } else {
     setMessage("", NONE); //$NON-NLS-1$
   }
 }
}

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

private void validateInput(boolean methodName) {
   RefactoringStatus merged= new RefactoringStatus();
   if (fMethodNameStatus != null && (methodName || fMethodNameStatus.hasError()))
     merged.merge(fMethodNameStatus);
   if (fDestinationStatus != null && (!methodName || fDestinationStatus.hasError()))
     merged.merge(fDestinationStatus);
   setPageComplete(!merged.hasError());
   int severity= merged.getSeverity();
   String message= merged.getMessageMatchingSeverity(severity);
   if (severity >= RefactoringStatus.INFO) {
     setMessage(message, severity);
   } else {
     setMessage("", NONE); //$NON-NLS-1$
   }
 }
}

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

private void validateInput(boolean methodName) {
   RefactoringStatus merged= new RefactoringStatus();
   if (fMethodNameStatus != null && (methodName || fMethodNameStatus.hasError()))
     merged.merge(fMethodNameStatus);
   if (fDestinationStatus != null && (!methodName || fDestinationStatus.hasError()))
     merged.merge(fDestinationStatus);
   
   setPageComplete(!merged.hasError());
   int severity= merged.getSeverity();
   String message= merged.getMessageMatchingSeverity(severity);
   if (severity >= RefactoringStatus.INFO) {
     setMessage(message, severity);
   } else {
     setMessage("", NONE); //$NON-NLS-1$
   }
 }
}

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

private int showStatus(RefactoringStatus status) {
  if (!status.hasError())
    return Window.OK;
  Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
  Dialog dialog= RefactoringUI.createRefactoringStatusDialog(status, shell, "", false); //$NON-NLS-1$
  return dialog.open();
}

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

private int showStatus(RefactoringStatus status) {
  if (!status.hasError())
    return Window.OK;
  Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
  
  Dialog dialog= RefactoringUI.createRefactoringStatusDialog(status, shell, "", false); //$NON-NLS-1$
  return dialog.open(); 
}

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

private int showStatus(RefactoringStatus status) {
  if (!status.hasError())
    return Window.OK;
  Shell shell= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
  Dialog dialog= RefactoringUI.createRefactoringStatusDialog(status, shell, "", false); //$NON-NLS-1$
  return dialog.open();
}

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

private IStatus validateType() {
  if (fType == null)
    return null;
  String type= fType.getText();
  RefactoringStatus status= TypeContextChecker.checkParameterTypeSyntax(type, fContext.getCuHandle().getJavaProject());
  if (status == null || status.isOK())
    return Status.OK_STATUS;
  if (status.hasError())
    return createErrorStatus(status.getEntryWithHighestSeverity().getMessage());
  else
    return createWarningStatus(status.getEntryWithHighestSeverity().getMessage());
}

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

private IStatus validateType() {
  if (fType == null)
    return null;
  String type= fType.getText();
  RefactoringStatus status= TypeContextChecker.checkParameterTypeSyntax(type, fContext.getCuHandle().getJavaProject());
  if (status == null || status.isOK())
    return Status.OK_STATUS;
  if (status.hasError())
    return createErrorStatus(status.getEntryWithHighestSeverity().getMessage());
  else
    return createWarningStatus(status.getEntryWithHighestSeverity().getMessage());
}

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

private IStatus validateType() {
  if (fType == null)
    return null;
  String type= fType.getText();
  
  RefactoringStatus status= TypeContextChecker.checkParameterTypeSyntax(type, fContext.getCuHandle().getJavaProject());
  if (status == null || status.isOK())
    return createOkStatus();
  if (status.hasError())
    return createErrorStatus(status.getEntryWithHighestSeverity().getMessage());
  else
    return createWarningStatus(status.getEntryWithHighestSeverity().getMessage());
}

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

public final RefactoringStatus checkInitialConditions(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
  Assert.isNotNull(monitor);
  final RefactoringStatus status= new RefactoringStatus();
  try {
    monitor.beginTask("", 4); //$NON-NLS-1$
    monitor.setTaskName(RefactoringCoreMessages.MoveInstanceMethodProcessor_checking);
    status.merge(Checks.checkIfCuBroken(fMethod));
    if (!status.hasError()) {
      checkMethodDeclaration(new SubProgressMonitor(monitor, 1), status);
      if (status.isOK()) {
        final MethodDeclaration declaration= ASTNodeSearchUtil.getMethodDeclarationNode(fMethod, fSourceRewrite.getRoot());
        checkGenericTypes(new SubProgressMonitor(monitor, 1), declaration, status);
        checkMethodBody(new SubProgressMonitor(monitor, 1), declaration, status);
        checkPossibleTargets(new SubProgressMonitor(monitor, 1), declaration, status);
      }
    }
  } finally {
    monitor.done();
  }
  return status;
}

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

@Override
public final RefactoringStatus checkInitialConditions(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
  Assert.isNotNull(monitor);
  final RefactoringStatus status= new RefactoringStatus();
  try {
    monitor.beginTask("", 4); //$NON-NLS-1$
    monitor.setTaskName(RefactoringCoreMessages.MoveInstanceMethodProcessor_checking);
    status.merge(Checks.checkIfCuBroken(fMethod));
    if (!status.hasError()) {
      checkMethodDeclaration(new SubProgressMonitor(monitor, 1), status);
      if (status.isOK()) {
        final MethodDeclaration declaration= ASTNodeSearchUtil.getMethodDeclarationNode(fMethod, fSourceRewrite.getRoot());
        checkGenericTypes(new SubProgressMonitor(monitor, 1), declaration, status);
        checkMethodBody(new SubProgressMonitor(monitor, 1), declaration, status);
        checkPossibleTargets(new SubProgressMonitor(monitor, 1), declaration, status);
      }
    }
  } finally {
    monitor.done();
  }
  return status;
}

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

private void validateInput() {
  RefactoringStatus merged= new RefactoringStatus();
  merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryTypeName(fIntermediaryTypeName.getText()));
  merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryMethodName(fIntermediaryMethodName.getText()));
  setPageComplete(!merged.hasError());
  int severity= merged.getSeverity();
  String message= merged.getMessageMatchingSeverity(severity);
  if (severity >= RefactoringStatus.INFO) {
    setMessage(message, severity);
  } else {
    setMessage("", NONE); //$NON-NLS-1$
  }
}

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

@Override
public final RefactoringStatus checkInitialConditions(final IProgressMonitor monitor) throws CoreException, OperationCanceledException {
  Assert.isNotNull(monitor);
  final RefactoringStatus status= new RefactoringStatus();
  try {
    monitor.beginTask("", 4); //$NON-NLS-1$
    monitor.setTaskName(RefactoringCoreMessages.MoveInstanceMethodProcessor_checking);
    status.merge(Checks.checkIfCuBroken(fMethod));
    if (!status.hasError()) {
      checkMethodDeclaration(new SubProgressMonitor(monitor, 1), status);
      if (status.isOK()) {
        final MethodDeclaration declaration= ASTNodeSearchUtil.getMethodDeclarationNode(fMethod, fSourceRewrite.getRoot());
        checkGenericTypes(new SubProgressMonitor(monitor, 1), declaration, status);
        checkMethodBody(new SubProgressMonitor(monitor, 1), declaration, status);
        checkPossibleTargets(new SubProgressMonitor(monitor, 1), declaration, status);
      }
    }
  } finally {
    monitor.done();
  }
  return status;
}

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

private void validateInput() {
  RefactoringStatus merged= new RefactoringStatus();
  merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryClassName(fIntermediaryTypeName.getText()));
  merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryMethodName(fIntermediaryMethodName.getText()));
  setPageComplete(!merged.hasError());
  int severity= merged.getSeverity();
  String message= merged.getMessageMatchingSeverity(severity);
  if (severity >= RefactoringStatus.INFO) {
    setMessage(message, severity);
  } else {
    setMessage("", NONE); //$NON-NLS-1$
  }
}

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

private void validateInput() {
  RefactoringStatus merged= new RefactoringStatus();
  merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryTypeName(fIntermediaryTypeName.getText()));
  merged.merge(getIntroduceIndirectionRefactoring().setIntermediaryMethodName(fIntermediaryMethodName.getText()));
  setPageComplete(!merged.hasError());
  int severity= merged.getSeverity();
  String message= merged.getMessageMatchingSeverity(severity);
  if (severity >= RefactoringStatus.INFO) {
    setMessage(message, severity);
  } else {
    setMessage("", NONE); //$NON-NLS-1$
  }
}

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

private int handleValidateMove(Object target) throws JavaModelException{
  if (fMoveProcessor == null) {
    IMovePolicy policy= ReorgPolicyFactory.createMovePolicy(ReorgUtils.getResources(fElements), ReorgUtils.getJavaElements(fElements));
    if (policy.canEnable())
      fMoveProcessor= new JavaMoveProcessor(policy);
  }
  if (!canMoveElements())
    return DND.DROP_NONE;
  if (fMoveProcessor == null)
    return DND.DROP_NONE;
  RefactoringStatus moveStatus= fMoveProcessor.setDestination(ReorgDestinationFactory.createDestination(target, getCurrentLocation()));
  if (moveStatus.hasError())
    return DND.DROP_NONE;
  return DND.DROP_MOVE;
}

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

private int handleValidateMove(Object target) throws JavaModelException{
  if (fMoveProcessor == null) {
    IMovePolicy policy= ReorgPolicyFactory.createMovePolicy(ReorgUtils.getResources(fElements), ReorgUtils.getJavaElements(fElements));
    if (policy.canEnable())
      fMoveProcessor= new JavaMoveProcessor(policy);
  }
  if (!canMoveElements())
    return DND.DROP_NONE;
  if (fMoveProcessor == null)
    return DND.DROP_NONE;
  RefactoringStatus moveStatus= fMoveProcessor.setDestination(ReorgDestinationFactory.createDestination(target, getCurrentLocation()));
  if (moveStatus.hasError())
    return DND.DROP_NONE;
  return DND.DROP_MOVE;
}

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

if (result.hasError()) {
  return result;

相关文章