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

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

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

RefactoringStatus.addFatalError介绍

[英]Adds a FATAL entry filled with the given message to this status. The severity of this status will changed to FATAL.
[中]将包含给定消息的FATAL条目添加到此状态。此状态的严重性将更改为[$1$]。

代码示例

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

private void check(RefactoringStatus status) {
    if (fBeforeTypeReferenced != null)
      status.addFatalError(fBeforeTypeReferenced);
    if (fSelectedTypeReferenced != null)
      status.addFatalError(fSelectedTypeReferenced);
  }
}

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

/**
 * Adds a <code>FATAL</code> entry filled with the given message to this status.
 * The severity of this status will changed to <code>FATAL</code>. 
 * 
 * @param msg the message of the fatal entry
 * 
 * @see RefactoringStatusEntry
 */
public void addFatalError(String msg) {
  addFatalError(msg, null);
}

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

private void checkDuplicateKeys(RefactoringStatus status) {
  for (int i= 0; i < fSubstitutions.length; i++) {
    NLSSubstitution substitution= fSubstitutions[i];
    if (conflictingKeys(substitution)) {
      status.addFatalError(NLSUIMessages.ExternalizeWizardPage_warning_conflicting);
      return;
    }
  }
}

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

@Override
public RefactoringStatus checkNewElementName(String newName) {
  Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
  RefactoringStatus result = Checks.checkTypeName(newName, fType);
  if (Checks.isAlreadyNamed(fType, newName)) {
    result.addFatalError(RefactoringCoreMessages.RenameTypeRefactoring_choose_another_name);
  }
  return result;
}

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

private void checkExpression(RefactoringStatus status) {
  ASTNode[] nodes= getSelectedNodes();
  if (nodes != null && nodes.length == 1) {
    ASTNode node= nodes[0];
    if (node instanceof Type) {
      status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_type_reference, JavaStatusContext.create(fCUnit, node)); 
    } else if (node.getLocationInParent() == SwitchCase.EXPRESSION_PROPERTY) {
      status.addFatalError(RefactoringCoreMessages.ExtractMethodAnalyzer_cannot_extract_switch_case, JavaStatusContext.create(fCUnit, node)); 
    }
  }
}

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

public static RefactoringStatus isValid(IDocument document, int length) {
    RefactoringStatus result= new RefactoringStatus();
    if (length != document.getLength()) {
      result.addFatalError(RefactoringCoreMessages.TextChanges_error_document_content_changed);
    }
    return result;
  }
}

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

public static RefactoringStatus isValid(IDocument document, int length) {
    RefactoringStatus result= new RefactoringStatus();
    if (length != document.getLength()) {
      result.addFatalError(RefactoringCoreMessages.TextChanges_error_document_content_changed);
    }
    return result;
  }
}

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

private static void checkExistence(RefactoringStatus status, IResource element) {
  if (element == null) {
    status.addFatalError(RefactoringCoreMessages.ResourceChange_error_no_input);
  } else if (!element.exists()) {
    status.addFatalError(Messages.format(RefactoringCoreMessages.ResourceChange_error_does_not_exist, BasicElementLabels.getPathLabel(element.getFullPath(), false)));
  }
}

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

private void checkParameterName(RefactoringStatus result, ParameterInfo info, int position) {
  if (info.getNewName().trim().length() == 0) {
    result.addFatalError(Messages.format(
        RefactoringCoreMessages.ChangeSignatureRefactoring_param_name_not_empty, Integer.toString(position)));
  } else {
    result.merge(Checks.checkTempName(info.getNewName(), fMethod));
  }
}

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

private RefactoringStatus mappingErrorFound(RefactoringStatus result, ASTNode node) {
  if (node != null && (node.getFlags() & ASTNode.MALFORMED) != 0 && processCompilerError(result, node))
    return result;
  result.addFatalError(getMappingErrorMessage());
  return result;
}

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

private RefactoringStatus mappingErrorFound(RefactoringStatus result, ASTNode node) {
  if (node != null && (node.getFlags() & ASTNode.MALFORMED) != 0 && processCompilerError(result, node)) {
    return result;
  }
  result.addFatalError(getMappingErrorMessage());
  return result;
}

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

public void checkSameReadOnly(RefactoringStatus status, boolean valueToMatch) {
  if (fReadOnly != valueToMatch) {
    status.addFatalError(Messages.format(RefactoringCoreMessages.ResourceChange_error_read_only_state_changed, BasicElementLabels.getPathLabel(fResource.getFullPath(), false)));
  }
}

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

public void checkReadOnly(RefactoringStatus status) {
  if (fReadOnly) {
    status.addFatalError(Messages.format(RefactoringCoreMessages.ResourceChange_error_read_only, BasicElementLabels.getPathLabel(fResource.getFullPath(), false)));
  }
}

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

@Override
public RefactoringStatus checkNewElementName(String newName) throws CoreException {
  Assert.isNotNull(newName, "new name"); //$NON-NLS-1$
  String typeName= removeFileNameExtension(newName);
  RefactoringStatus result= Checks.checkCompilationUnitName(newName, fCu);
  if (fWillRenameType)
    result.merge(fRenameTypeProcessor.checkNewElementName(typeName));
  if (Checks.isAlreadyNamed(fCu, newName))
    result.addFatalError(RefactoringCoreMessages.RenameCompilationUnitRefactoring_same_name);
  return result;
}

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

@Override
public RefactoringStatus checkNewElementName(String newName) throws CoreException {
  RefactoringStatus result= Checks.checkEnumConstantName(newName, getField());
  if (Checks.isAlreadyNamed(getField(), newName)) {
    result.addFatalError(RefactoringCoreMessages.RenameEnumConstRefactoring_another_name);
  }
  if (getField().getDeclaringType().getField(newName).exists()) {
    result.addFatalError(RefactoringCoreMessages.RenameEnumConstRefactoring_const_already_defined);
  }
  return result;
}

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

public void saveIfDirty(RefactoringStatus status, long stampToMatch, IProgressMonitor pm) throws CoreException {
  if (fDirty) {
    if (fKind == DOCUMENT && fTextFileBuffer != null && stampToMatch == fModificationStamp) {
      fTextFileBuffer.commit(pm, false);
    } else {
      status.addFatalError(Messages.format(RefactoringCoreMessages.ResourceChange_error_unsaved, BasicElementLabels.getPathLabel(fResource.getFullPath(), false)));
    }
  }
}

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

private boolean processCompilerError(RefactoringStatus result, ASTNode node) {
  Message[] messages = ASTNodes.getMessages(node, ASTNodes.INCLUDE_ALL_PARENTS);
  if (messages.length == 0) {
    return false;
  }
  result.addFatalError(Messages.format(RefactoringCoreMessages.SelfEncapsulateField_compiler_errors_field, new String[] { BasicElementLabels.getJavaElementName(fField.getElementName()), messages[0].getMessage() }));
  return true;
}

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

private boolean processCompilerError(RefactoringStatus result, ASTNode node) {
  Message[] messages= ASTNodes.getMessages(node, ASTNodes.INCLUDE_ALL_PARENTS);
  if (messages.length == 0)
    return false;
  result.addFatalError(Messages.format(
    RefactoringCoreMessages.SelfEncapsulateField_compiler_errors_field,
    new String[] { BasicElementLabels.getJavaElementName(fField.getElementName()), messages[0].getMessage()}));
  return true;
}

代码示例来源: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: org.eclipse/org.eclipse.datatools.connectivity.ui

public RefactoringStatus isValid(IProgressMonitor pm) throws CoreException, OperationCanceledException
{
  RefactoringStatus result = new RefactoringStatus();
  // Make sure the element exists
  if (mProfileToDelete == null || ProfileManager.getInstance().getProfileByName(mProfileToDelete.getName()) == null)
  {
    result.addFatalError(ConnectivityUIPlugin.getDefault().getResourceString("CPDeleteChange.error.ProfileDoesNotExist"));
  }
  return result;
}

相关文章