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


Java IExpressionFragment.getAssociatedExpression方法代碼示例

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


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

示例1: isLiteralNodeSelected

import org.eclipse.jdt.internal.corext.dom.fragments.IExpressionFragment; //導入方法依賴的package包/類
private boolean isLiteralNodeSelected() throws JavaModelException {
  IExpressionFragment fragment = getSelectedExpression();
  if (fragment == null) return false;
  Expression expression = fragment.getAssociatedExpression();
  if (expression == null) return false;
  switch (expression.getNodeType()) {
    case ASTNode.BOOLEAN_LITERAL:
    case ASTNode.CHARACTER_LITERAL:
    case ASTNode.NULL_LITERAL:
    case ASTNode.NUMBER_LITERAL:
      return true;

    default:
      return false;
  }
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:17,代碼來源:ExtractTempRefactoring.java

示例2: isLiteralNodeSelected

import org.eclipse.jdt.internal.corext.dom.fragments.IExpressionFragment; //導入方法依賴的package包/類
private boolean isLiteralNodeSelected() throws JavaModelException {
	IExpressionFragment fragment= getSelectedExpression();
	if (fragment == null)
		return false;
	Expression expression= fragment.getAssociatedExpression();
	if (expression == null)
		return false;
	switch (expression.getNodeType()) {
		case ASTNode.BOOLEAN_LITERAL:
		case ASTNode.CHARACTER_LITERAL:
		case ASTNode.NULL_LITERAL:
		case ASTNode.NUMBER_LITERAL:
			return true;

		default:
			return false;
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:19,代碼來源:ExtractTempRefactoring.java

示例3: isLiteralNodeSelected

import org.eclipse.jdt.internal.corext.dom.fragments.IExpressionFragment; //導入方法依賴的package包/類
private boolean isLiteralNodeSelected() throws JavaModelException {
	IExpressionFragment fragment= getSelectedExpression();
	if (fragment == null)
		return false;
	Expression expression= fragment.getAssociatedExpression();
	if (expression == null)
		return false;
	switch (expression.getNodeType()) {
		case ASTNode.BOOLEAN_LITERAL :
		case ASTNode.CHARACTER_LITERAL :
		case ASTNode.NULL_LITERAL :
		case ASTNode.NUMBER_LITERAL :
			return true;

		default :
			return false;
	}
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:19,代碼來源:ExtractConstantRefactoring.java

示例4: checkExpression

import org.eclipse.jdt.internal.corext.dom.fragments.IExpressionFragment; //導入方法依賴的package包/類
private RefactoringStatus checkExpression() throws JavaModelException {
	RefactoringStatus result= new RefactoringStatus();
	result.merge(checkExpressionBinding());
	if(result.hasFatalError())
		return result;
	checkAllStaticFinal();

	IExpressionFragment selectedExpression= getSelectedExpression();
	Expression associatedExpression= selectedExpression.getAssociatedExpression();
	if (associatedExpression instanceof NullLiteral)
		result.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_null_literals));
	else if (!ConstantChecks.isLoadTimeConstant(selectedExpression))
		result.merge(RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_not_load_time_constant));
	else if (associatedExpression instanceof SimpleName) {
		if (associatedExpression.getParent() instanceof QualifiedName && associatedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
				|| associatedExpression.getParent() instanceof FieldAccess && associatedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
			return RefactoringStatus.createFatalErrorStatus(RefactoringCoreMessages.ExtractConstantRefactoring_select_expression);
	}

	return result;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:22,代碼來源:ExtractConstantRefactoring.java

示例5: checkExpression

import org.eclipse.jdt.internal.corext.dom.fragments.IExpressionFragment; //導入方法依賴的package包/類
private RefactoringStatus checkExpression() throws JavaModelException {
  RefactoringStatus result = new RefactoringStatus();
  result.merge(checkExpressionBinding());
  if (result.hasFatalError()) return result;
  checkAllStaticFinal();

  IExpressionFragment selectedExpression = getSelectedExpression();
  Expression associatedExpression = selectedExpression.getAssociatedExpression();
  if (associatedExpression instanceof NullLiteral)
    result.merge(
        RefactoringStatus.createFatalErrorStatus(
            RefactoringCoreMessages.ExtractConstantRefactoring_null_literals));
  else if (!ConstantChecks.isLoadTimeConstant(selectedExpression))
    result.merge(
        RefactoringStatus.createFatalErrorStatus(
            RefactoringCoreMessages.ExtractConstantRefactoring_not_load_time_constant));
  else if (associatedExpression instanceof SimpleName) {
    if (associatedExpression.getParent() instanceof QualifiedName
            && associatedExpression.getLocationInParent() == QualifiedName.NAME_PROPERTY
        || associatedExpression.getParent() instanceof FieldAccess
            && associatedExpression.getLocationInParent() == FieldAccess.NAME_PROPERTY)
      return RefactoringStatus.createFatalErrorStatus(
          RefactoringCoreMessages.ExtractConstantRefactoring_select_expression);
  }

  return result;
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:28,代碼來源:ExtractConstantRefactoring.java


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