本文整理汇总了Java中org.eclipse.jdt.core.dom.AbstractTypeDeclaration.bodyDeclarations方法的典型用法代码示例。如果您正苦于以下问题:Java AbstractTypeDeclaration.bodyDeclarations方法的具体用法?Java AbstractTypeDeclaration.bodyDeclarations怎么用?Java AbstractTypeDeclaration.bodyDeclarations使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.dom.AbstractTypeDeclaration
的用法示例。
在下文中一共展示了AbstractTypeDeclaration.bodyDeclarations方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; //导入方法依赖的package包/类
/**
* @see HierarchicalASTVisitor#visit(org.eclipse.jdt.core.dom.AbstractTypeDeclaration)
*/
@Override
public boolean visit(AbstractTypeDeclaration node) {
progressMonitorWorked(1);
if (!isFurtherTraversalNecessary(node)) {
return false;
}
if (isNodeWithinMethod(node)) {
List<BodyDeclaration> bodyDeclarations= node.bodyDeclarations();
for (Iterator<BodyDeclaration> iter= bodyDeclarations.iterator(); iter.hasNext(); ) {
BodyDeclaration bodyDeclaration= iter.next();
if (bodyDeclaration instanceof MethodDeclaration) {
MethodDeclaration child= (MethodDeclaration) bodyDeclaration;
if (child.isConstructor()) {
addMethodCall(child.resolveBinding(), child.getName());
}
}
}
return false;
}
return true;
}
示例2: computeInsertIndexForNewConstructor
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; //导入方法依赖的package包/类
private int computeInsertIndexForNewConstructor(AbstractTypeDeclaration declaration) {
List<BodyDeclaration> declarations = declaration.bodyDeclarations();
if (declarations.isEmpty()) return 0;
int index = findFirstMethodIndex(declaration);
if (index == -1) return declarations.size();
else return index;
}
示例3: computeInsertIndexForNewConstructor
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; //导入方法依赖的package包/类
private int computeInsertIndexForNewConstructor(AbstractTypeDeclaration declaration) {
List<BodyDeclaration> declarations= declaration.bodyDeclarations();
if (declarations.isEmpty())
return 0;
int index= findFirstMethodIndex(declaration);
if (index == -1)
return declarations.size();
else
return index;
}
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:PromoteTempToFieldRefactoring.java
示例4: run
import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; //导入方法依赖的package包/类
public void run(IProgressMonitor monitor) throws CoreException {
if (monitor == null)
monitor= new NullProgressMonitor();
try {
monitor.beginTask("", 1); //$NON-NLS-1$
monitor.setTaskName(CodeGenerationMessages.GenerateToStringOperation_description);
AbstractTypeDeclaration declaration= (AbstractTypeDeclaration)ASTNodes.findDeclaration(fContext.getTypeBinding(), fRewrite.getRoot());
ListRewrite rewriter= fRewrite.getASTRewrite().getListRewrite(declaration, declaration.getBodyDeclarationsProperty());
if (fContext.getTypeBinding() != null && rewriter != null) {
MethodDeclaration toStringMethod= fGenerator.generateToStringMethod();
List<BodyDeclaration> list= declaration.bodyDeclarations();
BodyDeclaration replace= findMethodToReplace(list, toStringMethod);
if (replace == null || ((Boolean)toStringMethod.getProperty(AbstractToStringGenerator.OVERWRITE_METHOD_PROPERTY)).booleanValue())
insertMethod(toStringMethod, rewriter, replace);
List<MethodDeclaration> helperMethods= fGenerator.generateHelperMethods();
for (Iterator<MethodDeclaration> iterator= helperMethods.iterator(); iterator.hasNext();) {
MethodDeclaration method= iterator.next();
replace= findMethodToReplace(list, method);
if (replace == null || ((Boolean)method.getProperty(AbstractToStringGenerator.OVERWRITE_METHOD_PROPERTY)).booleanValue()) {
insertMethod(method, rewriter, replace);
}
}
JavaModelUtil.applyEdit((ICompilationUnit)fUnit.getJavaElement(), fRewrite.createChange(true).getEdit(), false, monitor);
}
} finally {
monitor.done();
}
}