當前位置: 首頁>>代碼示例>>Java>>正文


Java IProblem.isWarning方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.core.compiler.IProblem.isWarning方法的典型用法代碼示例。如果您正苦於以下問題:Java IProblem.isWarning方法的具體用法?Java IProblem.isWarning怎麽用?Java IProblem.isWarning使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.core.compiler.IProblem的用法示例。


在下文中一共展示了IProblem.isWarning方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getProblems

import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
public static IProblem[] getProblems(ASTNode node, int scope, int severity) {
	ASTNode root= node.getRoot();
	if (!(root instanceof CompilationUnit)) {
		return EMPTY_PROBLEMS;
	}
	IProblem[] problems= ((CompilationUnit)root).getProblems();
	if (root == node) {
		return problems;
	}
	final int iterations= computeIterations(scope);
	List<IProblem> result= new ArrayList<>(5);
	for (int i= 0; i < problems.length; i++) {
		IProblem problem= problems[i];
		boolean consider= false;
		if ((severity & PROBLEMS) == PROBLEMS) {
			consider= true;
		} else if ((severity & WARNING) != 0) {
			consider= problem.isWarning();
		} else if ((severity & ERROR) != 0) {
			consider= problem.isError();
		} else if ((severity & INFO) != 0) {
			consider= problem.isInfo();
		}
		if (consider) {
			ASTNode temp= node;
			int count= iterations;
			do {
				int nodeOffset= temp.getStartPosition();
				int problemOffset= problem.getSourceStart();
				if (nodeOffset <= problemOffset && problemOffset < nodeOffset + temp.getLength()) {
					result.add(problem);
					count= 0;
				} else {
					count--;
				}
			} while ((temp= temp.getParent()) != null && count > 0);
		}
	}
	return result.toArray(new IProblem[result.size()]);
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:41,代碼來源:ASTNodes.java

示例2: convertSeverity

import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private static DiagnosticSeverity convertSeverity(IProblem problem) {
	if(problem.isError()) {
		return DiagnosticSeverity.Error;
	}
	if(problem.isWarning()) {
		return DiagnosticSeverity.Warning;
	}
	return DiagnosticSeverity.Information;
}
 
開發者ID:eclipse,項目名稱:eclipse.jdt.ls,代碼行數:10,代碼來源:DiagnosticsHandler.java

示例3: getProblems

import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
public static IProblem[] getProblems(ASTNode node, int scope, int severity) {
  ASTNode root = node.getRoot();
  if (!(root instanceof CompilationUnit)) return EMPTY_PROBLEMS;
  IProblem[] problems = ((CompilationUnit) root).getProblems();
  if (root == node) return problems;
  final int iterations = computeIterations(scope);
  List<IProblem> result = new ArrayList<IProblem>(5);
  for (int i = 0; i < problems.length; i++) {
    IProblem problem = problems[i];
    boolean consider = false;
    if ((severity & PROBLEMS) == PROBLEMS) consider = true;
    else if ((severity & WARNING) != 0) consider = problem.isWarning();
    else if ((severity & ERROR) != 0) consider = problem.isError();
    if (consider) {
      ASTNode temp = node;
      int count = iterations;
      do {
        int nodeOffset = temp.getStartPosition();
        int problemOffset = problem.getSourceStart();
        if (nodeOffset <= problemOffset && problemOffset < nodeOffset + temp.getLength()) {
          result.add(problem);
          count = 0;
        } else {
          count--;
        }
      } while ((temp = temp.getParent()) != null && count > 0);
    }
  }
  return result.toArray(new IProblem[result.size()]);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:31,代碼來源:ASTNodes.java

示例4: GetProblemType

import org.eclipse.jdt.core.compiler.IProblem; //導入方法依賴的package包/類
private FileParseMessagesResponse.Problem.ProblemType GetProblemType(IProblem problem)
{
	if (problem.isError()) 
		return FileParseMessagesResponse.Problem.ProblemType.Error;
	if (problem.isWarning()) 
		return FileParseMessagesResponse.Problem.ProblemType.Warning;
	return FileParseMessagesResponse.Problem.ProblemType.Message;
}
 
開發者ID:Microsoft,項目名稱:vsminecraft,代碼行數:9,代碼來源:JavaParser.java


注:本文中的org.eclipse.jdt.core.compiler.IProblem.isWarning方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。