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

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

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

RefactoringStatus.addWarning介绍

[英]Adds a WARNING entry filled with the given message to this status. If the current severity is OK or INFO it will be changed to WARNING. It will remain unchanged otherwise.
[中]将包含给定消息的WARNING条目添加到此状态。如果当前严重性为OKINFO,则将更改为WARNING。否则将保持不变。

代码示例

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

/**
 * Adds a <code>WARNING</code> entry filled with the given message to this status.
 * If the current severity is <code>OK</code> or <code>INFO</code> it will be
 * changed to <code>WARNING</code>. It will remain unchanged otherwise.
 *
 * @param msg the message of the warning entry
 *
 * @see RefactoringStatusEntry
 */
public void addWarning(String msg) {
  addWarning(msg, null);
}

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

/**
 * Adds a <code>WARNING</code> entry filled with the given message to this status.
 * If the current severity is <code>OK</code> or <code>INFO</code> it will be 
 * changed to <code>WARNING</code>. It will remain unchanged otherwise.
 * 
 * @param msg the message of the warning entry
 * 
 * @see RefactoringStatusEntry
 */
public void addWarning(String msg) {
  addWarning(msg, null);
}

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

private void checkMissingKeys(RefactoringStatus status) {
  for (int i= 0; i < fSubstitutions.length; i++) {
    NLSSubstitution substitution= fSubstitutions[i];
    if ((substitution.getValue() == null) && (substitution.getKey() != null)) {
      status.addWarning(NLSUIMessages.ExternalizeWizardPage_warning_keymissing);
      return;
    }
  }
}

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

private void checkMissingKeys(RefactoringStatus status) {
  for (int i= 0; i < fSubstitutions.length; i++) {
    NLSSubstitution substitution= fSubstitutions[i];
    if ((substitution.getValue() == null) && (substitution.getKey() != null)) {
      status.addWarning(NLSUIMessages.ExternalizeWizardPage_warning_keymissing);
      return;
    }
  }
}

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

public RefactoringStatus checkTempName(String newName) {
  RefactoringStatus status= Checks.checkTempName(newName);
  if (Arrays.asList(getExcludedVariableNames()).contains(newName))
    status.addWarning(Messages.format(RefactoringCoreMessages.ExtractTempRefactoring_another_variable, newName)); 
  return status;
}

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

private RefactoringStatus createWarning(Exception e) {
  RefactoringStatus result= new RefactoringStatus();
  result.addWarning(Messages.format(FixMessages.PotentialProgrammingProblemsFix_calculatingUIDFailed_exception, new String[] {fProject.getElementName(), e.getLocalizedMessage()}), new RefactoringStatusContext() {
    public Object getCorrespondingElement() {
      return fProject;
    }
  });
  return result;
}

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

public RefactoringStatus checkTempName(String newName) {
  RefactoringStatus status = Checks.checkTempName(newName, fCu);
  if (Arrays.asList(getExcludedVariableNames()).contains(newName)) {
    status.addWarning(Messages.format(RefactoringCoreMessages.ExtractTempRefactoring_another_variable, BasicElementLabels.getJavaElementName(newName)));
  }
  return status;
}

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

public RefactoringStatus checkTempName(String newName) {
  RefactoringStatus status= Checks.checkTempName(newName, fCu);
  if (Arrays.asList(getExcludedVariableNames()).contains(newName))
    status.addWarning(Messages.format(RefactoringCoreMessages.ExtractTempRefactoring_another_variable, BasicElementLabels.getJavaElementName(newName)));
  return status;
}

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

public RefactoringStatus checkTempName(String newName) {
  RefactoringStatus status= Checks.checkTempName(newName, fCu);
  if (Arrays.asList(getExcludedVariableNames()).contains(newName))
    status.addWarning(Messages.format(RefactoringCoreMessages.ExtractTempRefactoring_another_variable, BasicElementLabels.getJavaElementName(newName)));
  return status;
}

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

@Override
public RefactoringStatus checkConditions() {
  RefactoringStatus status= super.checkConditions();
  if (fContext.isCustomArray() || fContext.isLimitItems())
    status.addWarning(CodeGenerationMessages.GenerateToStringOperation_warning_no_arrays_collections_with_this_style);
  return status;
}

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

public static RefactoringStatus checkTempName(String newName) {
  RefactoringStatus result= Checks.checkIdentifier(newName);
  if (result.hasFatalError())
    return result;
  if (! Checks.startsWithLowerCase(newName))
    result.addWarning(RefactoringCoreMessages.ExtractTempRefactoring_convention); 
  return result;		
}

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

public static RefactoringStatus checkTempName(String newName, IJavaElement context) {
  RefactoringStatus result= Checks.checkIdentifier(newName, context);
  if (result.hasFatalError())
    return result;
  if (! Checks.startsWithLowerCase(newName))
    result.addWarning(RefactoringCoreMessages.ExtractTempRefactoring_convention);
  return result;
}

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

public static RefactoringStatus checkTempName(String newName, IJavaElement context) {
  RefactoringStatus result= Checks.checkIdentifier(newName, context);
  if (result.hasFatalError())
    return result;
  if (! Checks.startsWithLowerCase(newName))
    result.addWarning(RefactoringCoreMessages.ExtractTempRefactoring_convention);
  return result;
}

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

public RefactoringStatus checkNewElementName(String newName) throws JavaModelException {
  RefactoringStatus result= Checks.checkFieldName(newName);
  if (! Checks.startsWithLowerCase(newName))
    if (fIsComposite) {
      final String nameOfParent= (fLocalVariable.getParent() instanceof IMethod) ? fLocalVariable.getParent().getElementName() : RefactoringCoreMessages.JavaElementUtil_initializer;
      final String nameOfType= fLocalVariable.getAncestor(IJavaElement.TYPE).getElementName();
      result.addWarning(Messages.format(RefactoringCoreMessages.RenameTempRefactoring_lowercase2, new String[] { newName, nameOfParent, nameOfType }));
    } else {
      result.addWarning(RefactoringCoreMessages.RenameTempRefactoring_lowercase);
    }
  return result;		
}

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

public RefactoringStatus checkFinalConditions(IProgressMonitor pm) throws CoreException {
  fChange= createTextChange(pm);
  RefactoringStatus result= new RefactoringStatus();
  if (Arrays.asList(getExcludedVariableNames()).contains(fTempName))
    result.addWarning(Messages.format(RefactoringCoreMessages.ExtractTempRefactoring_another_variable, fTempName)); 
  result.merge(checkMatchingFragments());
  
  fChange.setKeepPreviewEdits(true);
  checkNewSource(result);
  
  return result;
}

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

private void checkCompileErrors(RefactoringStatus result, CompilationUnit root, ICompilationUnit element) {
  IProblem[] messages = root.getProblems();
  for (int i = 0; i < messages.length; i++) {
    IProblem problem = messages[i];
    if (!isIgnorableProblem(problem)) {
      result.addWarning(Messages.format(RefactoringCoreMessages.SelfEncapsulateField_compiler_errors_update, BasicElementLabels.getFileName(element)), JavaStatusContext.create(element));
      return;
    }
  }
}

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

private void checkCompileErrors(RefactoringStatus result, CompilationUnit root, ICompilationUnit element) {
  IProblem[] messages= root.getProblems();
  for (int i= 0; i < messages.length; i++) {
    IProblem problem= messages[i];
    if (!isIgnorableProblem(problem)) {
      result.addWarning(Messages.format(
          RefactoringCoreMessages.SelfEncapsulateField_compiler_errors_update,
          BasicElementLabels.getFileName(element)), JavaStatusContext.create(element));
      return;
    }
  }
}

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

private void checkCompileErrors(RefactoringStatus result, CompilationUnit root, ICompilationUnit element) {
  IProblem[] messages= root.getProblems();
  for (int i= 0; i < messages.length; i++) {
    IProblem problem= messages[i];
    if (!isIgnorableProblem(problem)) {
      result.addWarning(Messages.format(
          RefactoringCoreMessages.SelfEncapsulateField_compiler_errors_update,
          BasicElementLabels.getFileName(element)), JavaStatusContext.create(element));
      return;
    }
  }
}

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

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;
}

相关文章