List of usage examples for org.eclipse.jdt.core.jdom IDOMMethod getName
@Override
public String getName();
IDOMMethod
refinement of this IDOMNode
method returns the name of this method. From source file:org.eclipse.emf.codegen.jet.JETSkeleton.java
License:Open Source License
public String getMethodName() { IDOMMethod method = getLastMethod(); if (method != null) { return method.getName(); } else {/* ww w . ja va2 s. co m*/ return ""; } }
From source file:org.eclipse.emf.codegen.jmerge.JMerger.java
License:Open Source License
protected void pullTargetMethod(IDOMMethod targetMethod) { String qualifiedTargetMethodName = targetPatternDictionary.getQualifiedName(targetMethod); IDOMMethod sourceMethod = (IDOMMethod) sourcePatternDictionary.getMethodMap() .get(qualifiedTargetMethodName); if (sourceMethod == null && jControlModel.getRedirect() != null && targetMethod.getName() != null && targetMethod.getName().endsWith(jControlModel.getRedirect())) { int index = qualifiedTargetMethodName.indexOf("("); //) qualifiedTargetMethodName = qualifiedTargetMethodName.substring(0, index - jControlModel.getRedirect().length()) + qualifiedTargetMethodName.substring(index); sourceMethod = (IDOMMethod) sourcePatternDictionary.getMethodMap().get(qualifiedTargetMethodName); }/* w w w . ja v a 2 s. c o m*/ map(sourceMethod, targetMethod); if (sourceMethod != null) { applyPullRules(sourceMethod, targetMethod); /* // PULL: Comment // String sourceComment = sourceMethod.getComment(); if (sourceComment != null) { targetMethod.setComment(sourceComment); } */ /* // PULL: Flags // int sourceFlags = sourceMethod.getFlags(); targetMethod.setFlags(sourceFlags); // PULL: Body // String sourceMethodBody = sourceMethod.getBody(); if (sourceMethodBody != null) { targetMethod.setBody(sourceMethodBody); } // PULL: ReturnType // String sourceMethodReturnType = sourceMethod.getReturnType(); if (sourceMethodReturnType != null) { targetMethod.setReturnType(sourceMethodReturnType); } */ /* // PULL: Exceptions // ArrayList additionalExceptions = new ArrayList(); String [] sourceMethodExceptions = sourceMethod.getExceptions(); if (sourceMethodExceptions != null) { additionalExceptions.addAll(Arrays.asList(sourceMethodExceptions)); String [] targetMethodExceptions = targetMethod.getExceptions(); if (targetMethodExceptions != null) { additionalExceptions.removeAll(Arrays.asList(targetMethodExceptions)); } } for (Iterator i = additionalExceptions.iterator(); i.hasNext(); ) { String exception = (String)i.next(); targetMethod.addException(exception); } */ } }
From source file:org.eclipse.emf.codegen.jmerge.JPatternDictionary.java
License:Open Source License
public String getQualifiedName(IDOMNode jdomNode) { switch (jdomNode.getNodeType()) { case IDOMNode.COMPILATION_UNIT: { return jdomNode.getName(); }/*w w w. j a v a 2 s .co m*/ case IDOMNode.PACKAGE: { return jdomNode.getName(); } case IDOMNode.IMPORT: { return jdomNode.getName(); } case IDOMNode.TYPE: { return jPackage != null ? jPackage.getName() + "." + jdomNode.getName() : jdomNode.getName(); } case IDOMNode.FIELD: { return getQualifiedName(jdomNode.getParent()) + "." + jdomNode.getName(); } case IDOMNode.INITIALIZER: { String name = getQualifiedName(jdomNode.getParent()); int index = 0; for (jdomNode = jdomNode.getNextNode(); jdomNode != null; jdomNode = jdomNode.getNextNode()) { if (jdomNode.getNodeType() == IDOMNode.INITIALIZER) { ++index; } } return name + "." + index; } case IDOMNode.METHOD: { IDOMMethod jdomMethod = (IDOMMethod) jdomNode; StringBuffer result = new StringBuffer(getQualifiedName(jdomNode.getParent())); result.append("."); if (jdomMethod.isConstructor()) { result.append(jdomMethod.getParent().getName()); } else { result.append(jdomMethod.getName()); } result.append("("); //) String[] parameters = jdomMethod.getParameterTypes(); if (parameters != null) { for (int i = 0; i < parameters.length; ++i) { if (i != 0) { result.append(", "); } result.append(parameters[i]); } } // ( result.append(")"); return result.toString(); } default: { return ""; } } }