本文整理匯總了Java中org.eclipse.jdt.core.dom.ASTNode.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java ASTNode.toString方法的具體用法?Java ASTNode.toString怎麽用?Java ASTNode.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jdt.core.dom.ASTNode
的用法示例。
在下文中一共展示了ASTNode.toString方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: selectionChanged
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (selection instanceof ITextSelection) {
ASTNode node = ASTUtils.getASTNode((ITextSelection) selection);
if (node != null) {
String string = node.toString();
CharSequence subSequence = string.subSequence(0,
string.length() > 100 ? 100 : string.length());
RelatedObjectsEdges.this.setContentDescription(subSequence.toString()
.trim());
RelatedObjectsEdges.this.fTreeViewer.setInput(node);
RelatedObjectsEdges.this.fTreeViewer.expandAll();
RelatedObjectsEdges.this.tableViewer.setInput(null);
}
}
}
示例2: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static ArrayInit createFrom(ASTNode node) {
ArrayInit retNode = null;
Adapter factory = Adapter.getInstance();
// XXX. Check compatible types
AstNode astNode = factory.get(node);
if ( astNode instanceof ArrayInit ) {
retNode = (ArrayInit)astNode;
}
else {
retNode = ArrayInit.create();
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
return retNode;
}
示例3: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static ClassInstanceCreation createFrom(ASTNode node) {
ClassInstanceCreation retNode = null;
Adapter factory = Adapter.getInstance();
AstNode astNode = factory.get(node);
if ( astNode instanceof ClassInstanceCreation ) {
retNode = (ClassInstanceCreation)astNode;
}
else {
retNode = ClassInstanceCreation.create();
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
return retNode;
}
示例4: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static FieldWrite createFrom(ASTNode node){
FieldWrite retNode = null;
boolean compatibleType = false;
if(node instanceof Assignment){
compatibleType = true;
} else if (node instanceof VariableDeclarationFragment){
VariableDeclarationFragment vdf = (VariableDeclarationFragment)node;
if (vdf.getInitializer()!=null){
compatibleType = true;
}
}
if (compatibleType){
Adapter factory = Adapter.getInstance();
AstNode astNode = factory.get(node);
if ( astNode instanceof FieldWrite ) {
retNode = (FieldWrite)astNode;
}
else {
retNode = FieldWrite.create();
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
} else {
throw new IllegalArgumentException();
}
return retNode;
}
示例5: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static ArrayCreation createFrom(ASTNode node) {
ArrayCreation retNode = null;
Adapter factory = Adapter.getInstance();
// XXX. Check compatible types
AstNode astNode = factory.get(node);
if ( astNode instanceof ArrayCreation ) {
retNode = (ArrayCreation)astNode;
}
else {
retNode = ArrayCreation.create();
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
return retNode;
}
示例6: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static ArrayWrite createFrom(ASTNode node){
ArrayWrite retNode = null;
// XXX. Check compatible types!
Adapter factory = Adapter.getInstance();
AstNode astNode = factory.get(node);
if (astNode instanceof ArrayWrite) {
retNode = (ArrayWrite) astNode;
}
else {
retNode = ArrayWrite.create();
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
return retNode;
}
示例7: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static LoadLiteral createFrom(ASTNode node) {
LoadLiteral retNode = null;
Adapter factory = Adapter.getInstance();
// XXX. Check compatible types
AstNode astNode = factory.get(node);
if ( astNode instanceof LoadLiteral ) {
retNode = (LoadLiteral)astNode;
}
else {
retNode = LoadLiteral.create();
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
return retNode;
}
示例8: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static FieldAccess createFrom(ASTNode node){
FieldAccess retNode = null;
if(node instanceof org.eclipse.jdt.core.dom.FieldAccess){
Adapter factory = Adapter.getInstance();
AstNode astNode = factory.get(node);
if ( astNode instanceof FieldAccess ) {
retNode = (FieldAccess)astNode;
}
else {
retNode = FieldAccess.create();
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
}else{
throw new IllegalArgumentException();
}
return retNode;
}
示例9: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static FieldDeclaration createFrom(ASTNode node) {
FieldDeclaration retNode = null;
if(node instanceof VariableDeclarationFragment){
VariableDeclarationFragment domVDF = (VariableDeclarationFragment)node;
Adapter factory = Adapter.getInstance();
AstNode astNode = factory.get(node);
if ( astNode instanceof FieldDeclaration ) {
retNode = (FieldDeclaration)astNode;
}
else {
retNode = FieldDeclaration.create();
retNode.enclosingType = TraceabilityFactory.getEnclosingTypeDeclaration(domVDF);
retNode.enclosingDeclaration = retNode.enclosingType;
retNode.fieldName = domVDF.getName().getFullyQualifiedName();
retNode.fieldType = TraceabilityFactory.getType(domVDF.resolveBinding().getType());
factory.map(node, retNode);
}
}else{
throw new IllegalArgumentException(node.toString() + " must be of instance org.eclipse.jdt.core.dom.VariableDeclarationFragment");
}
return retNode;
}
示例10: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static MethodInvocation createFrom(ASTNode node) {
MethodInvocation retNode = null;
if(node instanceof org.eclipse.jdt.core.dom.MethodInvocation
|| node instanceof SuperMethodInvocation){
Adapter factory = Adapter.getInstance();
AstNode astNode = factory.get(node);
if ( astNode instanceof MethodInvocation ) {
retNode = (MethodInvocation)astNode;
}
else {
retNode = MethodInvocation.create();
ast.MethodDeclaration methDec = TraceabilityFactory.getMethodDeclaration(node);
if(methDec!= null){
retNode.methodDeclaration = methDec;
}
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
}else{
throw new IllegalArgumentException(node.toString());
}
return retNode;
}
示例11: createFrom
import org.eclipse.jdt.core.dom.ASTNode; //導入方法依賴的package包/類
public static ArrayRead createFrom(ASTNode node){
ArrayRead retNode = null;
// XXX. Check compatible types
Adapter factory = Adapter.getInstance();
AstNode astNode = factory.get(node);
if (astNode instanceof ArrayRead) {
retNode = (ArrayRead) astNode;
}
else {
retNode = ArrayRead.create();
retNode.complexExpression = node.toString();
factory.map(node, retNode);
}
return retNode;
}