当前位置: 首页>>代码示例>>Java>>正文


Java ChildPropertyDescriptor类代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.ChildPropertyDescriptor的典型用法代码示例。如果您正苦于以下问题:Java ChildPropertyDescriptor类的具体用法?Java ChildPropertyDescriptor怎么用?Java ChildPropertyDescriptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ChildPropertyDescriptor类属于org.eclipse.jdt.core.dom包,在下文中一共展示了ChildPropertyDescriptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getArrayTypeElementPropertyDescriptor

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
public static ChildPropertyDescriptor getArrayTypeElementPropertyDescriptor(ArrayType node) {
	List<?> propertyDescriptors = ArrayType.propertyDescriptors(node.getAST().apiLevel());
	for (Object propertyDescriptor : propertyDescriptors) {
		if (propertyDescriptor instanceof ChildPropertyDescriptor) {
			ChildPropertyDescriptor childListPropertyDescriptor = (ChildPropertyDescriptor) propertyDescriptor;
			if (DESCRIPTOR_NAME_AST4.equals(childListPropertyDescriptor.getId())) {
				if (OptimusLogger.logger.isLoggable(Level.FINE)) {
					OptimusLogger.logger.fine(String.format(RETURNED_DESCRIPTOR_MESSAGE, DESCRIPTOR_NAME_AST4));
				}
				return childListPropertyDescriptor;
			} else if (DESCRIPTOR_NAME_AST8.equals(childListPropertyDescriptor.getId())) {
				if (OptimusLogger.logger.isLoggable(Level.FINE)) {
					OptimusLogger.logger.fine(String.format(RETURNED_DESCRIPTOR_MESSAGE, DESCRIPTOR_NAME_AST8));
				}
				return childListPropertyDescriptor;
			}
		}
	}
	return null;
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:21,代码来源:ASTArrayTypeHelper.java

示例2: handle

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
private void handle(Statement body, ChildPropertyDescriptor bodyProperty) {
  if ((body.getFlags() & ASTNode.RECOVERED) != 0) return;
  Statement parent = (Statement) body.getParent();
  if ((parent.getFlags() & ASTNode.RECOVERED) != 0) return;

  if (fRemoveUnnecessaryBlocksOnlyWhenReturnOrThrow) {
    if (!(body instanceof Block)) {
      if (body.getNodeType() != ASTNode.IF_STATEMENT
          && body.getNodeType() != ASTNode.RETURN_STATEMENT
          && body.getNodeType() != ASTNode.THROW_STATEMENT) {
        fResult.add(new AddBlockOperation(bodyProperty, body, parent));
      }
    } else {
      if (RemoveBlockOperation.satisfiesCleanUpPrecondition(parent, bodyProperty, true)) {
        fResult.add(new RemoveBlockOperation(parent, bodyProperty));
      }
    }
  } else if (fFindControlStatementsWithoutBlock) {
    if (!(body instanceof Block)) {
      fResult.add(new AddBlockOperation(bodyProperty, body, parent));
    }
  } else if (fRemoveUnnecessaryBlocks) {
    if (RemoveBlockOperation.satisfiesCleanUpPrecondition(parent, bodyProperty, false)) {
      fResult.add(new RemoveBlockOperation(parent, bodyProperty));
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:28,代码来源:ControlStatementsFix.java

示例3: getBodyProperty

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
@Override
protected ChildPropertyDescriptor getBodyProperty() {
  return VariableDeclarationFragment.INITIALIZER_PROPERTY;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:DelegateFieldCreator.java

示例4: isDangligIf

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
public boolean isDangligIf() {
  List<Statement> statements = fDeclaration.getBody().statements();
  if (statements.size() != 1) return false;

  ASTNode p = statements.get(0);

  while (true) {
    if (p instanceof IfStatement) {
      return ((IfStatement) p).getElseStatement() == null;
    } else {

      ChildPropertyDescriptor childD;
      if (p instanceof WhileStatement) {
        childD = WhileStatement.BODY_PROPERTY;
      } else if (p instanceof ForStatement) {
        childD = ForStatement.BODY_PROPERTY;
      } else if (p instanceof EnhancedForStatement) {
        childD = EnhancedForStatement.BODY_PROPERTY;
      } else if (p instanceof DoStatement) {
        childD = DoStatement.BODY_PROPERTY;
      } else if (p instanceof LabeledStatement) {
        childD = LabeledStatement.BODY_PROPERTY;
      } else {
        return false;
      }
      Statement body = (Statement) p.getStructuralProperty(childD);
      if (body instanceof Block) {
        return false;
      } else {
        p = body;
      }
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:35,代码来源:SourceProvider.java

示例5: isDangligIf

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
public boolean isDangligIf() {
	List<Statement> statements= fDeclaration.getBody().statements();
	if (statements.size() != 1)
		return false;

	ASTNode p= statements.get(0);

	while (true) {
		if (p instanceof IfStatement) {
			return ((IfStatement) p).getElseStatement() == null;
		} else {

			ChildPropertyDescriptor childD;
			if (p instanceof WhileStatement) {
				childD= WhileStatement.BODY_PROPERTY;
			} else if (p instanceof ForStatement) {
				childD= ForStatement.BODY_PROPERTY;
			} else if (p instanceof EnhancedForStatement) {
				childD= EnhancedForStatement.BODY_PROPERTY;
			} else if (p instanceof DoStatement) {
				childD= DoStatement.BODY_PROPERTY;
			} else if (p instanceof LabeledStatement) {
				childD= LabeledStatement.BODY_PROPERTY;
			} else {
				return false;
			}
			Statement body= (Statement) p.getStructuralProperty(childD);
			if (body instanceof Block) {
				return false;
			} else {
				p= body;
			}
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:36,代码来源:SourceProvider.java

示例6: handle

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
private void handle(Statement body, ChildPropertyDescriptor bodyProperty) {
	if ((body.getFlags() & ASTNode.RECOVERED) != 0)
		return;
	Statement parent= (Statement)body.getParent();
	if ((parent.getFlags() & ASTNode.RECOVERED) != 0)
		return;

	if (fRemoveUnnecessaryBlocksOnlyWhenReturnOrThrow) {
		if (!(body instanceof Block)) {
			if (body.getNodeType() != ASTNode.IF_STATEMENT && body.getNodeType() != ASTNode.RETURN_STATEMENT && body.getNodeType() != ASTNode.THROW_STATEMENT) {
				fResult.add(new AddBlockOperation(bodyProperty, body, parent));
			}
		} else {
			if (RemoveBlockOperation.satisfiesCleanUpPrecondition(parent, bodyProperty, true)) {
				fResult.add(new RemoveBlockOperation(parent, bodyProperty));
			}
		}
	} else if (fFindControlStatementsWithoutBlock) {
		if (!(body instanceof Block)) {
			fResult.add(new AddBlockOperation(bodyProperty, body, parent));
		}
	} else if (fRemoveUnnecessaryBlocks) {
		if (RemoveBlockOperation.satisfiesCleanUpPrecondition(parent, bodyProperty, false)) {
			fResult.add(new RemoveBlockOperation(parent, bodyProperty));
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:28,代码来源:ControlStatementsFix.java

示例7: getComponentType

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
public static Type getComponentType(ArrayType arrayType) {
	ChildPropertyDescriptor cpd = ASTArrayTypeHelper.getArrayTypeElementPropertyDescriptor(arrayType);
	if (cpd != null) {
		Object structuralProperty = arrayType.getStructuralProperty(cpd);
		if (structuralProperty instanceof Type) {
			return (Type) structuralProperty;
		}
	}
	return null;
}
 
开发者ID:awltech,项目名称:eclipse-optimus,代码行数:11,代码来源:ASTArrayTypeHelper.java

示例8: AddBlockOperation

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
public AddBlockOperation(
    ChildPropertyDescriptor bodyProperty, Statement body, Statement controlStatement) {
  fBodyProperty = bodyProperty;
  fBody = body;
  fControlStatement = controlStatement;
}
 
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:ControlStatementsFix.java

示例9: RemoveBlockOperation

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
public RemoveBlockOperation(Statement controlStatement, ChildPropertyDescriptor child) {
  fStatement = controlStatement;
  fChild = child;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:ControlStatementsFix.java

示例10: satisfiesCleanUpPrecondition

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
public static boolean satisfiesCleanUpPrecondition(
    Statement controlStatement,
    ChildPropertyDescriptor childDescriptor,
    boolean onlyReturnAndThrows) {
  return satisfiesPrecondition(controlStatement, childDescriptor, onlyReturnAndThrows, true);
}
 
开发者ID:eclipse,项目名称:che,代码行数:7,代码来源:ControlStatementsFix.java

示例11: satisfiesQuickAssistPrecondition

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
public static boolean satisfiesQuickAssistPrecondition(
    Statement controlStatement, ChildPropertyDescriptor childDescriptor) {
  return satisfiesPrecondition(controlStatement, childDescriptor, false, false);
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:ControlStatementsFix.java

示例12: satisfiesPrecondition

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
private static boolean satisfiesPrecondition(
    Statement controlStatement,
    ChildPropertyDescriptor childDescriptor,
    boolean onlyReturnAndThrows,
    boolean cleanUpCheck) {
  Object child = controlStatement.getStructuralProperty(childDescriptor);

  if (!(child instanceof Block)) return false;

  Block block = (Block) child;
  List<Statement> list = block.statements();
  if (list.size() != 1) return false;

  ASTNode singleStatement = list.get(0);

  if (onlyReturnAndThrows)
    if (!(singleStatement instanceof ReturnStatement)
        && !(singleStatement instanceof ThrowStatement)) return false;

  if (controlStatement instanceof IfStatement) {
    // if (true) {
    //  while (true)
    // 	 if (false)
    //    ;
    // } else
    //   ;

    if (((IfStatement) controlStatement).getThenStatement() != child)
      return true; // can always remove blocks in else part

    IfStatement ifStatement = (IfStatement) controlStatement;
    if (ifStatement.getElseStatement() == null)
      return true; // can always remove if no else part

    return !hasUnblockedIf((Statement) singleStatement, onlyReturnAndThrows, cleanUpCheck);
  } else {
    // if (true)
    // while (true) {
    //  if (false)
    //   ;
    // }
    // else
    // ;
    if (!hasUnblockedIf((Statement) singleStatement, onlyReturnAndThrows, cleanUpCheck))
      return true;

    ASTNode currentChild = controlStatement;
    ASTNode parent = currentChild.getParent();
    while (true) {
      Statement body = null;
      if (parent instanceof IfStatement) {
        body = ((IfStatement) parent).getThenStatement();
        if (body == currentChild
            && ((IfStatement) parent).getElseStatement()
                != null) // ->currentChild is an unblocked then part
        return false;
      } else if (parent instanceof WhileStatement) {
        body = ((WhileStatement) parent).getBody();
      } else if (parent instanceof DoStatement) {
        body = ((DoStatement) parent).getBody();
      } else if (parent instanceof ForStatement) {
        body = ((ForStatement) parent).getBody();
      } else if (parent instanceof EnhancedForStatement) {
        body = ((EnhancedForStatement) parent).getBody();
      } else {
        return true;
      }
      if (body != currentChild) // ->parents child is a block
      return true;

      currentChild = parent;
      parent = currentChild.getParent();
    }
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:76,代码来源:ControlStatementsFix.java

示例13: getJavaDocProperty

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
@Override
protected ChildPropertyDescriptor getJavaDocProperty() {
  return MethodDeclaration.JAVADOC_PROPERTY;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:DelegateMethodCreator.java

示例14: getBodyProperty

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
@Override
protected ChildPropertyDescriptor getBodyProperty() {
  return MethodDeclaration.BODY_PROPERTY;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:DelegateMethodCreator.java

示例15: getJavaDocProperty

import org.eclipse.jdt.core.dom.ChildPropertyDescriptor; //导入依赖的package包/类
@Override
protected ChildPropertyDescriptor getJavaDocProperty() {
  return FieldDeclaration.JAVADOC_PROPERTY;
}
 
开发者ID:eclipse,项目名称:che,代码行数:5,代码来源:DelegateFieldCreator.java


注:本文中的org.eclipse.jdt.core.dom.ChildPropertyDescriptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。