Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / corext / codemanipulation / StubUtility.java
index 8b8c9f4..2041355 100644 (file)
@@ -4,16 +4,16 @@
  */
 package net.sourceforge.phpdt.internal.corext.codemanipulation;
 
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.StringTokenizer;
+//import java.util.Arrays;
+//import java.util.Comparator;
+//import java.util.List;
+//import java.util.StringTokenizer;
 
-import net.sourceforge.phpdt.core.Flags;
-import net.sourceforge.phpdt.core.IBuffer;
+//import net.sourceforge.phpdt.core.Flags;
+//import net.sourceforge.phpdt.core.IBuffer;
 import net.sourceforge.phpdt.core.ICodeFormatter;
 import net.sourceforge.phpdt.core.ICompilationUnit;
-import net.sourceforge.phpdt.core.IJavaElement;
+//import net.sourceforge.phpdt.core.IJavaElement;
 import net.sourceforge.phpdt.core.IJavaProject;
 import net.sourceforge.phpdt.core.IMethod;
 import net.sourceforge.phpdt.core.IPackageFragment;
@@ -41,7 +41,7 @@ import org.eclipse.jface.text.templates.Template;
 import org.eclipse.jface.text.templates.TemplateBuffer;
 import org.eclipse.jface.text.templates.TemplateException;
 import org.eclipse.jface.text.templates.TemplateVariable;
-import org.eclipse.swt.SWT;
+//import org.eclipse.swt.SWT;
 
 public class StubUtility {
 
@@ -62,7 +62,7 @@ public class StubUtility {
 
        }
 
-       private static final String[] EMPTY = new String[0];
+       //private static final String[] EMPTY = new String[0];
 
        /**
         * Generates a method stub including the method comment. Given a template
@@ -85,58 +85,58 @@ public class StubUtility {
         *            type names are qualified.
         * @throws JavaModelException
         */
-       public static String genStub(ICompilationUnit cu, String destTypeName,
-                       IMethod method, IType definingType, GenStubSettings settings)
-                       throws CoreException {
-               // IImportsStructure imports) throws CoreException {
-               String methName = method.getElementName();
-               String[] paramNames = suggestArgumentNames(method.getJavaProject(),
-                               method.getParameterNames());
-               String returnType = method.isConstructor() ? null : method
-                               .getReturnType();
-               String lineDelimiter = String.valueOf('\n'); // reformatting required
-
-               StringBuffer buf = new StringBuffer();
-               // add method comment
-               if (settings.createComments && cu != null) {
-                       IMethod overridden = null;
-                       if (settings.methodOverwrites && returnType != null) {
-                               overridden = JavaModelUtil.findMethod(methName, method
-                                               .getParameterTypes(), false, definingType.getMethods());
-                       }
-                       String comment = getMethodComment(cu, destTypeName, methName,
-                                       paramNames, method.getExceptionTypes(), returnType,
-                                       overridden, lineDelimiter);
-                       if (comment != null) {
-                               buf.append(comment);
-                       } else {
-                               buf.append("/**").append(lineDelimiter); //$NON-NLS-1$
-                               buf.append(" *").append(lineDelimiter); //$NON-NLS-1$
-                               buf.append(" */").append(lineDelimiter); //$NON-NLS-1$                                                  
-                       }
-                       buf.append(lineDelimiter);
-               }
-               // add method declaration
-               String bodyContent = null;
-               if (!settings.noBody) {
-                       String bodyStatement = getDefaultMethodBodyStatement(methName,
-                                       paramNames, returnType, settings.callSuper);
-                       bodyContent = getMethodBodyContent(returnType == null, method
-                                       .getJavaProject(), destTypeName, methName, bodyStatement,
-                                       lineDelimiter);
-                       if (bodyContent == null) {
-                               bodyContent = ""; //$NON-NLS-1$
-                       }
-               }
-               int flags = settings.methodModifiers;
-               if (flags == -1) {
-                       flags = method.getFlags();
-               }
-
-               genMethodDeclaration(destTypeName, method, flags, bodyContent, buf); // imports,
-                                                                                                                                                               // buf);
-               return buf.toString();
-       }
+//     public static String genStub(ICompilationUnit cu, String destTypeName,
+//                     IMethod method, IType definingType, GenStubSettings settings)
+//                     throws CoreException {
+//             // IImportsStructure imports) throws CoreException {
+//             String methName = method.getElementName();
+//             String[] paramNames = suggestArgumentNames(method.getJavaProject(),
+//                             method.getParameterNames());
+//             String returnType = method.isConstructor() ? null : method
+//                             .getReturnType();
+//             String lineDelimiter = String.valueOf('\n'); // reformatting required
+//
+//             StringBuffer buf = new StringBuffer();
+//             // add method comment
+//             if (settings.createComments && cu != null) {
+//                     IMethod overridden = null;
+//                     if (settings.methodOverwrites && returnType != null) {
+//                             overridden = JavaModelUtil.findMethod(methName, method
+//                                             .getParameterTypes(), false, definingType.getMethods());
+//                     }
+//                     String comment = getMethodComment(cu, destTypeName, methName,
+//                                     paramNames, method.getExceptionTypes(), returnType,
+//                                     overridden, lineDelimiter);
+//                     if (comment != null) {
+//                             buf.append(comment);
+//                     } else {
+//                             buf.append("/**").append(lineDelimiter); //$NON-NLS-1$
+//                             buf.append(" *").append(lineDelimiter); //$NON-NLS-1$
+//                             buf.append(" */").append(lineDelimiter); //$NON-NLS-1$                                                  
+//                     }
+//                     buf.append(lineDelimiter);
+//             }
+//             // add method declaration
+//             String bodyContent = null;
+//             if (!settings.noBody) {
+//                     String bodyStatement = getDefaultMethodBodyStatement(methName,
+//                                     paramNames, returnType, settings.callSuper);
+//                     bodyContent = getMethodBodyContent(returnType == null, method
+//                                     .getJavaProject(), destTypeName, methName, bodyStatement,
+//                                     lineDelimiter);
+//                     if (bodyContent == null) {
+//                             bodyContent = ""; //$NON-NLS-1$
+//                     }
+//             }
+//             int flags = settings.methodModifiers;
+//             if (flags == -1) {
+//                     flags = method.getFlags();
+//             }
+//
+//             genMethodDeclaration(destTypeName, method, flags, bodyContent, buf); // imports,
+//                                                                                                                                                             // buf);
+//             return buf.toString();
+//     }
 
        /**
         * Generates a method stub not including the method comment. Given a
@@ -158,13 +158,13 @@ public class StubUtility {
         *            The buffer to append the gerenated code.
         * @throws JavaModelException
         */
-       public static void genMethodDeclaration(String destTypeName,
-                       IMethod method, String bodyContent, StringBuffer buf)
-                       throws CoreException { // IImportsStructure imports, StringBuffer
-                                                                       // buf) throws CoreException {
-               genMethodDeclaration(destTypeName, method, method.getFlags(),
-                               bodyContent, buf);
-       }
+//     public static void genMethodDeclaration(String destTypeName,
+//                     IMethod method, String bodyContent, StringBuffer buf)
+//                     throws CoreException { // IImportsStructure imports, StringBuffer
+//                                                                     // buf) throws CoreException {
+//             genMethodDeclaration(destTypeName, method, method.getFlags(),
+//                             bodyContent, buf);
+//     }
 
        /**
         * Generates a method stub not including the method comment. Given a
@@ -186,135 +186,135 @@ public class StubUtility {
         *            The buffer to append the gerenated code.
         * @throws JavaModelException
         */
-       public static void genMethodDeclaration(String destTypeName,
-                       IMethod method, int flags, String bodyContent, StringBuffer buf)
-                       throws CoreException {
-               // IImportsStructure imports, StringBuffer buf) throws CoreException {
-               IType parentType = method.getDeclaringType();
-               String methodName = method.getElementName();
-               String[] paramTypes = method.getParameterTypes();
-               String[] paramNames = suggestArgumentNames(parentType.getJavaProject(),
-                               method.getParameterNames());
-
-               String[] excTypes = method.getExceptionTypes();
-
-               boolean isConstructor = method.isConstructor();
-               String retTypeSig = isConstructor ? null : method.getReturnType();
-
-               int lastParam = paramTypes.length - 1;
-
-               if (Flags.isPublic(flags)
-                               || (parentType.isInterface() && bodyContent != null)) {
-                       buf.append("public "); //$NON-NLS-1$
-               } else if (Flags.isProtected(flags)) {
-                       buf.append("protected "); //$NON-NLS-1$
-               } else if (Flags.isPrivate(flags)) {
-                       buf.append("private "); //$NON-NLS-1$
-               }
-               // if (Flags.isSynchronized(flags)) {
-               // buf.append("synchronized "); //$NON-NLS-1$
-               // }
-               // if (Flags.isVolatile(flags)) {
-               // buf.append("volatile "); //$NON-NLS-1$
-               // }
-               // if (Flags.isStrictfp(flags)) {
-               // buf.append("strictfp "); //$NON-NLS-1$
-               // }
-               if (Flags.isStatic(flags)) {
-                       buf.append("static "); //$NON-NLS-1$
-               }
-
-               if (isConstructor) {
-                       buf.append(destTypeName);
-               } else {
-                       String retTypeFrm;
-                       if (!isPrimitiveType(retTypeSig)) {
-                               retTypeFrm = resolveAndAdd(retTypeSig, parentType);
-                       } else {
-                               retTypeFrm = Signature.toString(retTypeSig);
-                       }
-                       buf.append(retTypeFrm);
-                       buf.append(' ');
-                       buf.append(methodName);
-               }
-               buf.append('(');
-               for (int i = 0; i <= lastParam; i++) {
-                       String paramTypeSig = paramTypes[i];
-                       String paramTypeFrm;
-
-                       if (!isPrimitiveType(paramTypeSig)) {
-                               paramTypeFrm = resolveAndAdd(paramTypeSig, parentType);
-                       } else {
-                               paramTypeFrm = Signature.toString(paramTypeSig);
-                       }
-                       buf.append(paramTypeFrm);
-                       buf.append(' ');
-                       buf.append(paramNames[i]);
-                       if (i < lastParam) {
-                               buf.append(", "); //$NON-NLS-1$
-                       }
-               }
-               buf.append(')');
-
-               int lastExc = excTypes.length - 1;
-               if (lastExc >= 0) {
-                       buf.append(" throws "); //$NON-NLS-1$
-                       for (int i = 0; i <= lastExc; i++) {
-                               String excTypeSig = excTypes[i];
-                               String excTypeFrm = resolveAndAdd(excTypeSig, parentType);
-                               buf.append(excTypeFrm);
-                               if (i < lastExc) {
-                                       buf.append(", "); //$NON-NLS-1$
-                               }
-                       }
-               }
-               if (bodyContent == null) {
-                       buf.append(";\n\n"); //$NON-NLS-1$
-               } else {
-                       buf.append(" {\n\t"); //$NON-NLS-1$
-                       if ((bodyContent != null) && (bodyContent.length() > 0)) {
-                               buf.append(bodyContent);
-                               buf.append('\n');
-                       }
-                       buf.append("}\n"); //$NON-NLS-1$
-               }
-       }
-
-       public static String getDefaultMethodBodyStatement(String methodName,
-                       String[] paramNames, String retTypeSig, boolean callSuper) {
-               StringBuffer buf = new StringBuffer();
-               if (callSuper) {
-                       if (retTypeSig != null) {
-                               if (!Signature.SIG_VOID.equals(retTypeSig)) {
-                                       buf.append("return "); //$NON-NLS-1$
-                               }
-                               buf.append("super."); //$NON-NLS-1$
-                               buf.append(methodName);
-                       } else {
-                               buf.append("super"); //$NON-NLS-1$
-                       }
-                       buf.append('(');
-                       for (int i = 0; i < paramNames.length; i++) {
-                               if (i > 0) {
-                                       buf.append(", "); //$NON-NLS-1$
-                               }
-                               buf.append(paramNames[i]);
-                       }
-                       buf.append(");"); //$NON-NLS-1$
-               } else {
-                       if (retTypeSig != null && !retTypeSig.equals(Signature.SIG_VOID)) {
-                               if (!isPrimitiveType(retTypeSig)
-                                               || Signature.getArrayCount(retTypeSig) > 0) {
-                                       buf.append("return null;"); //$NON-NLS-1$
-                               } else if (retTypeSig.equals(Signature.SIG_BOOLEAN)) {
-                                       buf.append("return false;"); //$NON-NLS-1$
-                               } else {
-                                       buf.append("return 0;"); //$NON-NLS-1$
-                               }
-                       }
-               }
-               return buf.toString();
-       }
+//     public static void genMethodDeclaration(String destTypeName,
+//                     IMethod method, int flags, String bodyContent, StringBuffer buf)
+//                     throws CoreException {
+//             // IImportsStructure imports, StringBuffer buf) throws CoreException {
+//             IType parentType = method.getDeclaringType();
+//             String methodName = method.getElementName();
+//             String[] paramTypes = method.getParameterTypes();
+//             String[] paramNames = suggestArgumentNames(parentType.getJavaProject(),
+//                             method.getParameterNames());
+//
+//             String[] excTypes = method.getExceptionTypes();
+//
+//             boolean isConstructor = method.isConstructor();
+//             String retTypeSig = isConstructor ? null : method.getReturnType();
+//
+//             int lastParam = paramTypes.length - 1;
+//
+//             if (Flags.isPublic(flags)
+//                             || (parentType.isInterface() && bodyContent != null)) {
+//                     buf.append("public "); //$NON-NLS-1$
+//             } else if (Flags.isProtected(flags)) {
+//                     buf.append("protected "); //$NON-NLS-1$
+//             } else if (Flags.isPrivate(flags)) {
+//                     buf.append("private "); //$NON-NLS-1$
+//             }
+//             // if (Flags.isSynchronized(flags)) {
+//             // buf.append("synchronized "); //$NON-NLS-1$
+//             // }
+//             // if (Flags.isVolatile(flags)) {
+//             // buf.append("volatile "); //$NON-NLS-1$
+//             // }
+//             // if (Flags.isStrictfp(flags)) {
+//             // buf.append("strictfp "); //$NON-NLS-1$
+//             // }
+//             if (Flags.isStatic(flags)) {
+//                     buf.append("static "); //$NON-NLS-1$
+//             }
+//
+//             if (isConstructor) {
+//                     buf.append(destTypeName);
+//             } else {
+//                     String retTypeFrm;
+//                     if (!isPrimitiveType(retTypeSig)) {
+//                             retTypeFrm = resolveAndAdd(retTypeSig, parentType);
+//                     } else {
+//                             retTypeFrm = Signature.toString(retTypeSig);
+//                     }
+//                     buf.append(retTypeFrm);
+//                     buf.append(' ');
+//                     buf.append(methodName);
+//             }
+//             buf.append('(');
+//             for (int i = 0; i <= lastParam; i++) {
+//                     String paramTypeSig = paramTypes[i];
+//                     String paramTypeFrm;
+//
+//                     if (!isPrimitiveType(paramTypeSig)) {
+//                             paramTypeFrm = resolveAndAdd(paramTypeSig, parentType);
+//                     } else {
+//                             paramTypeFrm = Signature.toString(paramTypeSig);
+//                     }
+//                     buf.append(paramTypeFrm);
+//                     buf.append(' ');
+//                     buf.append(paramNames[i]);
+//                     if (i < lastParam) {
+//                             buf.append(", "); //$NON-NLS-1$
+//                     }
+//             }
+//             buf.append(')');
+//
+//             int lastExc = excTypes.length - 1;
+//             if (lastExc >= 0) {
+//                     buf.append(" throws "); //$NON-NLS-1$
+//                     for (int i = 0; i <= lastExc; i++) {
+//                             String excTypeSig = excTypes[i];
+//                             String excTypeFrm = resolveAndAdd(excTypeSig, parentType);
+//                             buf.append(excTypeFrm);
+//                             if (i < lastExc) {
+//                                     buf.append(", "); //$NON-NLS-1$
+//                             }
+//                     }
+//             }
+//             if (bodyContent == null) {
+//                     buf.append(";\n\n"); //$NON-NLS-1$
+//             } else {
+//                     buf.append(" {\n\t"); //$NON-NLS-1$
+//                     if ((bodyContent != null) && (bodyContent.length() > 0)) {
+//                             buf.append(bodyContent);
+//                             buf.append('\n');
+//                     }
+//                     buf.append("}\n"); //$NON-NLS-1$
+//             }
+//     }
+
+//     public static String getDefaultMethodBodyStatement(String methodName,
+//                     String[] paramNames, String retTypeSig, boolean callSuper) {
+//             StringBuffer buf = new StringBuffer();
+//             if (callSuper) {
+//                     if (retTypeSig != null) {
+//                             if (!Signature.SIG_VOID.equals(retTypeSig)) {
+//                                     buf.append("return "); //$NON-NLS-1$
+//                             }
+//                             buf.append("super."); //$NON-NLS-1$
+//                             buf.append(methodName);
+//                     } else {
+//                             buf.append("super"); //$NON-NLS-1$
+//                     }
+//                     buf.append('(');
+//                     for (int i = 0; i < paramNames.length; i++) {
+//                             if (i > 0) {
+//                                     buf.append(", "); //$NON-NLS-1$
+//                             }
+//                             buf.append(paramNames[i]);
+//                     }
+//                     buf.append(");"); //$NON-NLS-1$
+//             } else {
+//                     if (retTypeSig != null && !retTypeSig.equals(Signature.SIG_VOID)) {
+//                             if (!isPrimitiveType(retTypeSig)
+//                                             || Signature.getArrayCount(retTypeSig) > 0) {
+//                                     buf.append("return null;"); //$NON-NLS-1$
+//                             } else if (retTypeSig.equals(Signature.SIG_BOOLEAN)) {
+//                                     buf.append("return false;"); //$NON-NLS-1$
+//                             } else {
+//                                     buf.append("return 0;"); //$NON-NLS-1$
+//                             }
+//                     }
+//             }
+//             return buf.toString();
+//     }
 
        public static String getMethodBodyContent(boolean isConstructor,
                        IJavaProject project, String destTypeName, String methodName,
@@ -383,25 +383,25 @@ public class StubUtility {
                return evaluateTemplate(context, template);
        }
 
-       public static String getCatchBodyContent(ICompilationUnit cu,
-                       String exceptionType, String variableName, String lineDelimiter)
-                       throws CoreException {
-               Template template = WebUI.getDefault()
-                               .getCodeTemplateStore().findTemplate(
-                                               CodeTemplateContextType.CATCHBLOCK);
-               if (template == null) {
-                       return null;
-               }
-
-               CodeTemplateContext context = new CodeTemplateContext(template
-                               .getContextTypeId(), cu.getJavaProject(), lineDelimiter);
-               context.setVariable(CodeTemplateContextType.EXCEPTION_TYPE,
-                               exceptionType);
-               context
-                               .setVariable(CodeTemplateContextType.EXCEPTION_VAR,
-                                               variableName); //$NON-NLS-1$
-               return evaluateTemplate(context, template);
-       }
+//     public static String getCatchBodyContent(ICompilationUnit cu,
+//                     String exceptionType, String variableName, String lineDelimiter)
+//                     throws CoreException {
+//             Template template = WebUI.getDefault()
+//                             .getCodeTemplateStore().findTemplate(
+//                                             CodeTemplateContextType.CATCHBLOCK);
+//             if (template == null) {
+//                     return null;
+//             }
+//
+//             CodeTemplateContext context = new CodeTemplateContext(template
+//                             .getContextTypeId(), cu.getJavaProject(), lineDelimiter);
+//             context.setVariable(CodeTemplateContextType.EXCEPTION_TYPE,
+//                             exceptionType);
+//             context
+//                             .setVariable(CodeTemplateContextType.EXCEPTION_VAR,
+//                                             variableName); //$NON-NLS-1$
+//             return evaluateTemplate(context, template);
+//     }
 
        /**
         * @see net.sourceforge.phpdt.ui.CodeGeneration#getTypeComment(ICompilationUnit,
@@ -467,23 +467,23 @@ public class StubUtility {
        // return result;
        // }
 
-       private static String getSeeTag(String declaringClassQualifiedName,
-                       String methodName, String[] parameterTypesQualifiedNames) {
-               StringBuffer buf = new StringBuffer();
-               buf.append("@see "); //$NON-NLS-1$
-               buf.append(declaringClassQualifiedName);
-               buf.append('#');
-               buf.append(methodName);
-               buf.append('(');
-               for (int i = 0; i < parameterTypesQualifiedNames.length; i++) {
-                       if (i > 0) {
-                               buf.append(", "); //$NON-NLS-1$
-                       }
-                       buf.append(parameterTypesQualifiedNames[i]);
-               }
-               buf.append(')');
-               return buf.toString();
-       }
+//     private static String getSeeTag(String declaringClassQualifiedName,
+//                     String methodName, String[] parameterTypesQualifiedNames) {
+//             StringBuffer buf = new StringBuffer();
+//             buf.append("@see "); //$NON-NLS-1$
+//             buf.append(declaringClassQualifiedName);
+//             buf.append('#');
+//             buf.append(methodName);
+//             buf.append('(');
+//             for (int i = 0; i < parameterTypesQualifiedNames.length; i++) {
+//                     if (i > 0) {
+//                             buf.append(", "); //$NON-NLS-1$
+//                     }
+//                     buf.append(parameterTypesQualifiedNames[i]);
+//             }
+//             buf.append(')');
+//             return buf.toString();
+//     }
 
        private static String getSeeTag(IMethod overridden)
                        throws JavaModelException {
@@ -884,52 +884,52 @@ public class StubUtility {
                textBuffer.replace(offset, length, buf.toString());
        }
 
-       private static boolean isPrimitiveType(String typeName) {
-               char first = Signature.getElementType(typeName).charAt(0);
-               return (first != Signature.C_RESOLVED && first != Signature.C_UNRESOLVED);
-       }
-
-       private static String resolveAndAdd(String refTypeSig, IType declaringType)
-                       throws JavaModelException {// , IImportsStructure imports) throws
-                                                                               // JavaModelException {
-               String resolvedTypeName = JavaModelUtil.getResolvedTypeName(refTypeSig,
-                               declaringType);
-               if (resolvedTypeName != null) {
-                       StringBuffer buf = new StringBuffer();
-                       // if (imports != null) {
-                       // buf.append(imports.addImport(resolvedTypeName));
-                       // } else {
-                       buf.append(resolvedTypeName);
-                       // }
-                       int arrayCount = Signature.getArrayCount(refTypeSig);
-                       for (int i = 0; i < arrayCount; i++) {
-                               buf.append("[]"); //$NON-NLS-1$
-                       }
-                       return buf.toString();
-               }
-               return Signature.toString(refTypeSig);
-       }
+//     private static boolean isPrimitiveType(String typeName) {
+//             char first = Signature.getElementType(typeName).charAt(0);
+//             return (first != Signature.C_RESOLVED && first != Signature.C_UNRESOLVED);
+//     }
+
+//     private static String resolveAndAdd(String refTypeSig, IType declaringType)
+//                     throws JavaModelException {// , IImportsStructure imports) throws
+//                                                                             // JavaModelException {
+//             String resolvedTypeName = JavaModelUtil.getResolvedTypeName(refTypeSig,
+//                             declaringType);
+//             if (resolvedTypeName != null) {
+//                     StringBuffer buf = new StringBuffer();
+//                     // if (imports != null) {
+//                     // buf.append(imports.addImport(resolvedTypeName));
+//                     // } else {
+//                     buf.append(resolvedTypeName);
+//                     // }
+//                     int arrayCount = Signature.getArrayCount(refTypeSig);
+//                     for (int i = 0; i < arrayCount; i++) {
+//                             buf.append("[]"); //$NON-NLS-1$
+//                     }
+//                     return buf.toString();
+//             }
+//             return Signature.toString(refTypeSig);
+//     }
 
        /**
         * Finds a method in a list of methods.
         * 
         * @return The found method or null, if nothing found
         */
-       private static IMethod findMethod(IMethod method, List allMethods)
-                       throws JavaModelException {
-               String name = method.getElementName();
-               String[] paramTypes = method.getParameterTypes();
-               boolean isConstructor = method.isConstructor();
-
-               for (int i = allMethods.size() - 1; i >= 0; i--) {
-                       IMethod curr = (IMethod) allMethods.get(i);
-                       if (JavaModelUtil.isSameMethodSignature(name, paramTypes,
-                                       isConstructor, curr)) {
-                               return curr;
-                       }
-               }
-               return null;
-       }
+//     private static IMethod findMethod(IMethod method, List allMethods)
+//                     throws JavaModelException {
+//             String name = method.getElementName();
+//             String[] paramTypes = method.getParameterTypes();
+//             boolean isConstructor = method.isConstructor();
+//
+//             for (int i = allMethods.size() - 1; i >= 0; i--) {
+//                     IMethod curr = (IMethod) allMethods.get(i);
+//                     if (JavaModelUtil.isSameMethodSignature(name, paramTypes,
+//                                     isConstructor, curr)) {
+//                             return curr;
+//                     }
+//             }
+//             return null;
+//     }
 
        /**
         * Creates needed constructors for a type.
@@ -1191,29 +1191,29 @@ public class StubUtility {
        /**
         * Examines a string and returns the first line delimiter found.
         */
-       public static String getLineDelimiterUsed(IJavaElement elem)
-                       throws JavaModelException {
-               ICompilationUnit cu = (ICompilationUnit) elem
-                               .getAncestor(IJavaElement.COMPILATION_UNIT);
-               if (cu != null && cu.exists()) {
-                       IBuffer buf = cu.getBuffer();
-                       int length = buf.getLength();
-                       for (int i = 0; i < length; i++) {
-                               char ch = buf.getChar(i);
-                               if (ch == SWT.CR) {
-                                       if (i + 1 < length) {
-                                               if (buf.getChar(i + 1) == SWT.LF) {
-                                                       return "\r\n"; //$NON-NLS-1$
-                                               }
-                                       }
-                                       return "\r"; //$NON-NLS-1$
-                               } else if (ch == SWT.LF) {
-                                       return "\n"; //$NON-NLS-1$
-                               }
-                       }
-               }
-               return System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
-       }
+//     public static String getLineDelimiterUsed(IJavaElement elem)
+//                     throws JavaModelException {
+//             ICompilationUnit cu = (ICompilationUnit) elem
+//                             .getAncestor(IJavaElement.COMPILATION_UNIT);
+//             if (cu != null && cu.exists()) {
+//                     IBuffer buf = cu.getBuffer();
+//                     int length = buf.getLength();
+//                     for (int i = 0; i < length; i++) {
+//                             char ch = buf.getChar(i);
+//                             if (ch == SWT.CR) {
+//                                     if (i + 1 < length) {
+//                                             if (buf.getChar(i + 1) == SWT.LF) {
+//                                                     return "\r\n"; //$NON-NLS-1$
+//                                             }
+//                                     }
+//                                     return "\r"; //$NON-NLS-1$
+//                             } else if (ch == SWT.LF) {
+//                                     return "\n"; //$NON-NLS-1$
+//                             }
+//                     }
+//             }
+//             return System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+//     }
 
        /**
         * Embodies the policy which line delimiter to use when inserting into a
@@ -1335,112 +1335,112 @@ public class StubUtility {
        // name, dimensions, excluded); //$NON-NLS-1$
        // return sortByLength(res); // longest first
        // }
-       private static String[] sortByLength(String[] proposals) {
-               Arrays.sort(proposals, new Comparator() {
-                       public int compare(Object o1, Object o2) {
-                               return ((String) o2).length() - ((String) o1).length();
-                       }
-               });
-               return proposals;
-       }
-
-       private static String workaround38111(String baseName) {
+//     private static String[] sortByLength(String[] proposals) {
+//             Arrays.sort(proposals, new Comparator() {
+//                     public int compare(Object o1, Object o2) {
+//                             return ((String) o2).length() - ((String) o1).length();
+//                     }
+//             });
+//             return proposals;
+//     }
+
+/*     private static String workaround38111(String baseName) {
                if (BASE_TYPES.contains(baseName))
                        return baseName;
                return Character.toUpperCase(baseName.charAt(0))
                                + baseName.substring(1);
        }
-
-       private static final List BASE_TYPES = Arrays
-                       .asList(new String[] {
-                                       "boolean", "byte", "char", "double", "float", "int", "long", "short" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
-
-       public static String suggestArgumentName(IJavaProject project,
-                       String baseName, String[] excluded) {
-               // String[] argnames= getArgumentNameSuggestions(project, baseName, 0,
-               // excluded);
-               // if (argnames.length > 0) {
-               // return argnames[0];
-               // }
-               return baseName;
-       }
-
-       public static String[] suggestArgumentNames(IJavaProject project,
-                       String[] paramNames) {
-               String prefixes = project.getOption(
-                               JavaCore.CODEASSIST_ARGUMENT_PREFIXES, true);
-               String suffixes = project.getOption(
-                               JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, true);
-               if (prefixes.length() + suffixes.length() == 0) {
-                       return paramNames;
-               }
-
-               String[] newNames = new String[paramNames.length];
-               // Ensure that the codegeneration preferences are respected
-               for (int i = 0; i < paramNames.length; i++) {
-                       String curr = paramNames[i];
-                       if (!hasPrefixOrSuffix(prefixes, suffixes, curr)) {
-                               newNames[i] = suggestArgumentName(project, paramNames[i], null);
-                       } else {
-                               newNames[i] = curr;
-                       }
-               }
-               return newNames;
-       }
-
-       public static boolean hasFieldName(IJavaProject project, String name) {
-               String prefixes = project.getOption(JavaCore.CODEASSIST_FIELD_PREFIXES,
-                               true);
-               String suffixes = project.getOption(JavaCore.CODEASSIST_FIELD_SUFFIXES,
-                               true);
-               String staticPrefixes = project.getOption(
-                               JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, true);
-               String staticSuffixes = project.getOption(
-                               JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, true);
-
-               return hasPrefixOrSuffix(prefixes, suffixes, name)
-                               || hasPrefixOrSuffix(staticPrefixes, staticSuffixes, name);
-       }
-
-       public static boolean hasParameterName(IJavaProject project, String name) {
-               String prefixes = project.getOption(
-                               JavaCore.CODEASSIST_ARGUMENT_PREFIXES, true);
-               String suffixes = project.getOption(
-                               JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, true);
-               return hasPrefixOrSuffix(prefixes, suffixes, name);
-       }
-
-       public static boolean hasLocalVariableName(IJavaProject project, String name) {
-               String prefixes = project.getOption(JavaCore.CODEASSIST_LOCAL_PREFIXES,
-                               true);
-               String suffixes = project.getOption(JavaCore.CODEASSIST_LOCAL_SUFFIXES,
-                               true);
-               return hasPrefixOrSuffix(prefixes, suffixes, name);
-       }
-
-       public static boolean hasConstantName(String name) {
-               return Character.isUpperCase(name.charAt(0));
-       }
-
-       private static boolean hasPrefixOrSuffix(String prefixes, String suffixes,
-                       String name) {
-               final String listSeparartor = ","; //$NON-NLS-1$
-
-               StringTokenizer tok = new StringTokenizer(prefixes, listSeparartor);
-               while (tok.hasMoreTokens()) {
-                       String curr = tok.nextToken();
-                       if (name.startsWith(curr)) {
-                               return true;
-                       }
-               }
-
-               tok = new StringTokenizer(suffixes, listSeparartor);
-               while (tok.hasMoreTokens()) {
-                       String curr = tok.nextToken();
-                       if (name.endsWith(curr)) {
-                               return true;
-                       }
-               }
-               return false;
-       }
+*/
+//     private static final List BASE_TYPES = Arrays
+//                     .asList(new String[] {
+//                                     "boolean", "byte", "char", "double", "float", "int", "long", "short" }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+
+//     public static String suggestArgumentName(IJavaProject project,
+//                     String baseName, String[] excluded) {
+//             // String[] argnames= getArgumentNameSuggestions(project, baseName, 0,
+//             // excluded);
+//             // if (argnames.length > 0) {
+//             // return argnames[0];
+//             // }
+//             return baseName;
+//     }
+
+//     public static String[] suggestArgumentNames(IJavaProject project,
+//                     String[] paramNames) {
+//             String prefixes = project.getOption(
+//                             JavaCore.CODEASSIST_ARGUMENT_PREFIXES, true);
+//             String suffixes = project.getOption(
+//                             JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, true);
+//             if (prefixes.length() + suffixes.length() == 0) {
+//                     return paramNames;
+//             }
+//
+//             String[] newNames = new String[paramNames.length];
+//             // Ensure that the codegeneration preferences are respected
+//             for (int i = 0; i < paramNames.length; i++) {
+//                     String curr = paramNames[i];
+//                     if (!hasPrefixOrSuffix(prefixes, suffixes, curr)) {
+//                             newNames[i] = suggestArgumentName(project, paramNames[i], null);
+//                     } else {
+//                             newNames[i] = curr;
+//                     }
+//             }
+//             return newNames;
+//     }
+
+//     public static boolean hasFieldName(IJavaProject project, String name) {
+//             String prefixes = project.getOption(JavaCore.CODEASSIST_FIELD_PREFIXES,
+//                             true);
+//             String suffixes = project.getOption(JavaCore.CODEASSIST_FIELD_SUFFIXES,
+//                             true);
+//             String staticPrefixes = project.getOption(
+//                             JavaCore.CODEASSIST_STATIC_FIELD_PREFIXES, true);
+//             String staticSuffixes = project.getOption(
+//                             JavaCore.CODEASSIST_STATIC_FIELD_SUFFIXES, true);
+//
+//             return hasPrefixOrSuffix(prefixes, suffixes, name)
+//                             || hasPrefixOrSuffix(staticPrefixes, staticSuffixes, name);
+//     }
+
+//     public static boolean hasParameterName(IJavaProject project, String name) {
+//             String prefixes = project.getOption(
+//                             JavaCore.CODEASSIST_ARGUMENT_PREFIXES, true);
+//             String suffixes = project.getOption(
+//                             JavaCore.CODEASSIST_ARGUMENT_SUFFIXES, true);
+//             return hasPrefixOrSuffix(prefixes, suffixes, name);
+//     }
+
+//     public static boolean hasLocalVariableName(IJavaProject project, String name) {
+//             String prefixes = project.getOption(JavaCore.CODEASSIST_LOCAL_PREFIXES,
+//                             true);
+//             String suffixes = project.getOption(JavaCore.CODEASSIST_LOCAL_SUFFIXES,
+//                             true);
+//             return hasPrefixOrSuffix(prefixes, suffixes, name);
+//     }
+
+//     public static boolean hasConstantName(String name) {
+//             return Character.isUpperCase(name.charAt(0));
+//     }
+
+//     private static boolean hasPrefixOrSuffix(String prefixes, String suffixes,
+//                     String name) {
+//             final String listSeparartor = ","; //$NON-NLS-1$
+//
+//             StringTokenizer tok = new StringTokenizer(prefixes, listSeparartor);
+//             while (tok.hasMoreTokens()) {
+//                     String curr = tok.nextToken();
+//                     if (name.startsWith(curr)) {
+//                             return true;
+//                     }
+//             }
+//
+//             tok = new StringTokenizer(suffixes, listSeparartor);
+//             while (tok.hasMoreTokens()) {
+//                     String curr = tok.nextToken();
+//                     if (name.endsWith(curr)) {
+//                             return true;
+//                     }
+//             }
+//             return false;
+//     }
 }