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


Java StructuralPropertyDescriptor.isChildListProperty方法代码示例

本文整理汇总了Java中org.eclipse.jdt.core.dom.StructuralPropertyDescriptor.isChildListProperty方法的典型用法代码示例。如果您正苦于以下问题:Java StructuralPropertyDescriptor.isChildListProperty方法的具体用法?Java StructuralPropertyDescriptor.isChildListProperty怎么用?Java StructuralPropertyDescriptor.isChildListProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jdt.core.dom.StructuralPropertyDescriptor的用法示例。


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

示例1: isStringNodeInPatternElement

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
public static boolean isStringNodeInPatternElement(StringLiteral node) {
	ASTNode parent = node.getParent();
	StructuralPropertyDescriptor locationInParent = node.getLocationInParent();
	if (locationInParent.isChildProperty() && !locationInParent.isChildListProperty()) {
		return false;
	}
	if (parent instanceof MethodInvocation) {
		MethodInvocation parentMethodInvocation = (MethodInvocation) parent;
		if (isPatternPart(parentMethodInvocation)) {
			return true;
		} else if (isStringPattern(parentMethodInvocation)) {
			return true;
		} else {

		}
	} else {
		LOG.fine("not ClassInstanceCreation " + parent.getClass().getName() + " " + parent);
	}
	return false;
}
 
开发者ID:impetuouslab,项目名称:eclipse-filecompletion,代码行数:21,代码来源:FileClassFinder.java

示例2: postAddChildEvent

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
void postAddChildEvent(ASTNode node, ASTNode child,	StructuralPropertyDescriptor property) {
	if(property.isChildListProperty()) {

		ListRewriteEvent event = getListEvent(node, property);
		List list = (List)node.getStructuralProperty(property);
		int i = list.indexOf(child);
		int s = list.size();
		int index;
		if(i + 1 < s) {
			ASTNode nextNode = (ASTNode)list.get(i + 1);
			index = event.getIndex(nextNode, ListRewriteEvent.NEW);
		} else {
			index = -1;
		}
		event.insert(child, index);
		if(child != null) {
			markAsMoveOrCopyTarget(node, child);
		}
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:21,代码来源:InternalASTRewrite.java

示例3: getContainingList

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
/**
 * Returns the list that contains the given ASTNode. If the node
 * isn't part of any list, <code>null</code> is returned.
 *
 * @param node the node in question
 * @return the list that contains the node or <code>null</code>
 */
public static List<? extends ASTNode> getContainingList(ASTNode node) {
	StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
	if (locationInParent != null && locationInParent.isChildListProperty()) {
		return getChildListProperty(node.getParent(), (ChildListPropertyDescriptor) locationInParent);
	}
	return null;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:15,代码来源:ASTNodes.java

示例4: matchesLocationInEnclosingBodyDecl

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
private boolean matchesLocationInEnclosingBodyDecl(BodyDeclaration originalEnclosingBodyDeclaration, BodyDeclaration duplicateEnclosingBodyDeclaration, VariableDeclaration originalReturnNode, VariableDeclaration duplicateReturnNode) {
	boolean matches = true;
	ASTNode original = originalReturnNode;
	ASTNode dupliacte = duplicateReturnNode;

	// walk up the parent chains to check if the location of the return nodes in their respective parent chains is same
	do {
		ASTNode originalParent = original.getParent();
		ASTNode duplicateParent = dupliacte.getParent();
		StructuralPropertyDescriptor originalLoc = original.getLocationInParent();
		StructuralPropertyDescriptor duplicateLoc = dupliacte.getLocationInParent();

		if (originalParent != null && duplicateParent != null && originalLoc.getNodeClass().equals(duplicateLoc.getNodeClass()) && originalLoc.getId().equals(duplicateLoc.getId())) {
			if (originalLoc.isChildListProperty() && duplicateLoc.isChildListProperty()) {
				int indexOfOriginal = ((List<?>) originalParent.getStructuralProperty(originalLoc)).indexOf(original);
				int indexOfDuplicate = ((List<?>) duplicateParent.getStructuralProperty(duplicateLoc)).indexOf(dupliacte);
				if (indexOfOriginal != indexOfDuplicate) {
					matches = false;
					break;
				}
			}
		} else {
			matches = false;
			break;
		}

		original = originalParent;
		dupliacte = duplicateParent;

		if ((originalEnclosingBodyDeclaration.equals(original) && !duplicateEnclosingBodyDeclaration.equals(dupliacte)) || (!originalEnclosingBodyDeclaration.equals(original) && duplicateEnclosingBodyDeclaration.equals(dupliacte))) {
			matches = false;
			break;
		}
	} while (!originalEnclosingBodyDeclaration.equals(original) && !duplicateEnclosingBodyDeclaration.equals(dupliacte));

	return matches;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:38,代码来源:ExtractMethodRefactoring.java

示例5: getProperty

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
private ChildListPropertyDescriptor getProperty() {
	List<StructuralPropertyDescriptor> list= fCallerNode.structuralPropertiesForType();
	for (int i= 0; i < list.size(); i++) {
		StructuralPropertyDescriptor curr= list.get(i);
		if (curr.isChildListProperty() && "arguments".equals(curr.getId())) { //$NON-NLS-1$
			return (ChildListPropertyDescriptor) curr;
		}
	}
	return null;

}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:12,代码来源:AddArgumentCorrectionProposal.java

示例6: getProperty

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
private ChildListPropertyDescriptor getProperty() {
  List<StructuralPropertyDescriptor> list = fCallerNode.structuralPropertiesForType();
  for (int i = 0; i < list.size(); i++) {
    StructuralPropertyDescriptor curr = list.get(i);
    if (curr.isChildListProperty() && "arguments".equals(curr.getId())) { // $NON-NLS-1$
      return (ChildListPropertyDescriptor) curr;
    }
  }
  return null;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:AddArgumentCorrectionProposal.java

示例7: getIndex

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
private int getIndex(ASTNode node) {
  StructuralPropertyDescriptor locationInParent = node.getLocationInParent();
  if (locationInParent != null && locationInParent.isChildListProperty()) {
    List<ASTNode> parentsChildren =
        (List<ASTNode>) node.getParent().getStructuralProperty(
        locationInParent);
    if (parentsChildren != null) {
      return parentsChildren.indexOf(node);
    }
  }

  // The node is not contained within a list-based property on the parent
  return NOT_FROM_LIST;
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:16,代码来源:EquivalentNodeFinder.java

示例8: getSiblingNodes

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
static ASTNode[] getSiblingNodes(ASTNode node) {
	ASTNode parent= node.getParent();
	StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
	if (locationInParent.isChildListProperty()) {
		List<? extends ASTNode> siblings= ASTNodes.getChildListProperty(parent, (ChildListPropertyDescriptor) locationInParent);
		return siblings.toArray(new ASTNode[siblings.size()]);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:StructureSelectionAction.java

示例9: remove

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
/**
 * Removes the given node from its parent in this rewriter. The AST itself
    * is not actually modified in any way; rather, the rewriter just records
    * a note that this node should not be there.
 *
 * @param node the node being removed. The node can either be an original node in the AST
 * or (since 3.4) a new node already inserted or used as replacement in this AST rewriter.
 * @param editGroup the edit group in which to collect the corresponding
 * text edits, or <code>null</code> if ungrouped
 * @throws IllegalArgumentException if the node is null, or if the node is not
 * part of this rewriter's AST, or if the described modification is invalid
 * (such as removing a required node)
 */
public final void remove(ASTNode node, TextEditGroup editGroup) {
	if (node == null) {
		throw new IllegalArgumentException();
	}

	StructuralPropertyDescriptor property;
	ASTNode parent;
	if (RewriteEventStore.isNewNode(node)) { // remove a new node, bug 164862
		PropertyLocation location= this.eventStore.getPropertyLocation(node, RewriteEventStore.NEW);
		if (location != null) {
			property= location.getProperty();
			parent= location.getParent();
		} else {
			throw new IllegalArgumentException("Node is not part of the rewriter's AST"); //$NON-NLS-1$
		}
	} else {
		property= node.getLocationInParent();
		parent= node.getParent();
	}

	if (property.isChildListProperty()) {
		getListRewrite(parent, (ChildListPropertyDescriptor) property).remove(node, editGroup);
	} else {
		set(parent, property, null, editGroup);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:40,代码来源:ASTRewrite.java

示例10: replace

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
/**
 * Replaces the given node in this rewriter. The replacement node
 * must either be brand new (not part of the original AST) or a placeholder
 * node (for example, one created by {@link #createCopyTarget(ASTNode)}
 * or {@link #createStringPlaceholder(String, int)}). The AST itself
    * is not actually modified in any way; rather, the rewriter just records
    * a note that this node has been replaced.
 *
 * @param node the node being replaced. The node can either be an original node in the AST
 * or (since 3.4) a new node already inserted or used as replacement in this AST rewriter.
 * @param replacement the replacement node, or <code>null</code> if no
 * replacement
 * @param editGroup the edit group in which to collect the corresponding
 * text edits, or <code>null</code> if ungrouped
 * @throws IllegalArgumentException if the node is null, or if the node is not part
 * of this rewriter's AST, or if the replacement node is not a new node (or
    * placeholder), or if the described modification is otherwise invalid
 */
public final void replace(ASTNode node, ASTNode replacement, TextEditGroup editGroup) {
	if (node == null) {
		throw new IllegalArgumentException();
	}

	StructuralPropertyDescriptor property;
	ASTNode parent;
	if (RewriteEventStore.isNewNode(node)) { // replace a new node, bug 164862
		PropertyLocation location= this.eventStore.getPropertyLocation(node, RewriteEventStore.NEW);
		if (location != null) {
			property= location.getProperty();
			parent= location.getParent();
		} else {
			throw new IllegalArgumentException("Node is not part of the rewriter's AST"); //$NON-NLS-1$
		}
	} else {
		property= node.getLocationInParent();
		parent= node.getParent();
	}

	if (property.isChildListProperty()) {
		getListRewrite(parent, (ChildListPropertyDescriptor) property).replace(node, replacement, editGroup);
	} else {
		set(parent, property, replacement, editGroup);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:45,代码来源:ASTRewrite.java

示例11: getContainingList

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
/**
 * Returns the list that contains the given ASTNode. If the node
 * isn't part of any list, <code>null</code> is returned.
 *
 * @param node the node in question
 * @return the list that contains the node or <code>null</code>
 */
public static List<? extends ASTNode> getContainingList(ASTNode node) {
	StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
	if (locationInParent != null && locationInParent.isChildListProperty()) {
		return (List<? extends ASTNode>) node.getParent().getStructuralProperty(locationInParent);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:15,代码来源:ASTNodes.java

示例12: getSiblingNodes

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
static ASTNode[] getSiblingNodes(ASTNode node) {
	ASTNode parent= node.getParent();
	StructuralPropertyDescriptor locationInParent= node.getLocationInParent();
	if (locationInParent.isChildListProperty()) {
		List<? extends ASTNode> siblings= (List<? extends ASTNode>) parent.getStructuralProperty(locationInParent);
		return siblings.toArray(new ASTNode[siblings.size()]);
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:10,代码来源:StructureSelectionAction.java

示例13: preAddChildEvent

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
void preAddChildEvent(ASTNode node, ASTNode child,	StructuralPropertyDescriptor property) {
	if(property.isChildProperty()) {
		NodeRewriteEvent event = getNodeEvent(node, property);
		event.setNewValue(child);
		if(child != null) {
			markAsMoveOrCopyTarget(node, child);
		}
	} else if(property.isChildListProperty()) {
		// force event creation
		getListEvent(node, property);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion-Juno38,代码行数:13,代码来源:InternalASTRewrite.java

示例14: validateIsListProperty

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
private void validateIsListProperty(StructuralPropertyDescriptor property) {
	if (!property.isChildListProperty()) {
		String message= property.getId() + " is not a list property"; //$NON-NLS-1$
		throw new IllegalArgumentException(message);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:RewriteEventStore.java

示例15: validateIsNodeProperty

import org.eclipse.jdt.core.dom.StructuralPropertyDescriptor; //导入方法依赖的package包/类
private void validateIsNodeProperty(StructuralPropertyDescriptor property) {
	if (property.isChildListProperty()) {
		String message= property.getId() + " is not a node property"; //$NON-NLS-1$
		throw new IllegalArgumentException(message);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:7,代码来源:RewriteEventStore.java


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