private static String createTypeQuery(final Object draggedElement) { final IType type = (IType) draggedElement; final ICompilationUnit cU = type.getCompilationUnit(); final IClassFile cF = type.getClassFile(); if (cU != null) { final String packagename = Resolver.resolveFullyQualifiedPackageName(cU); final String classname = Resolver.resolveClassName(type); return String.format("%s('%s','%s')", CLASS_WITH_MEMBERS, packagename, classname); } else { final String packagename = Resolver.resolveFullyQualifiedPackageName(cF); final String classname = Resolver.resolveClassName(type); return String.format("%s('%s','%s')", CLASS_WITH_MEMBERS, packagename, classname); } }
private static String createMethodQuery(final Object draggedElement) { final IMethod iMethod = (IMethod) draggedElement; final String packagename = Resolver.resolveFullyQualifiedPackageName(draggedElement); final String classname = Resolver.resolveClassName(draggedElement); final String methodname = Resolver.getMethodName(iMethod); final List<String> para = Resolver.getParameterTypesFromMethod(iMethod); final String returntype = Resolver.resolveReturnType(iMethod); final StringBuffer sbPara = new StringBuffer(); sbPara.append("["); final Iterator<String> it = para.iterator(); while (it.hasNext()) { final String s = it.next(); if (it.hasNext()) { sbPara.append("'" + s + "'" + ","); } else { sbPara.append("'" + s + "'"); } } sbPara.append("]"); return String.format( "%s('%s','%s','%s','%s',%s)", METHOD, packagename, classname, methodname, returntype, sbPara.toString()); }
private static String createFieldQuery(final Object draggedElement) { final IField iField = (IField) draggedElement; final String packagename = Resolver.resolveFullyQualifiedPackageName(draggedElement); final String classname = Resolver.resolveClassName(draggedElement); final String fieldname = iField.getElementName(); final String type = Resolver.getFullyQualifiedFieldTypeName(iField); return String.format("%s('%s','%s','%s','%s')", FIELD, packagename, classname, fieldname, type); }
private static String createClassQueryFromCompilationUnit(final Object draggedElement) { String classQuery; final String packagename = Resolver.resolveFullyQualifiedPackageName(draggedElement); final String classname = Resolver.resolveClassName(draggedElement); classQuery = String.format("%s('%s','%s')", CLASS_WITH_MEMBERS, packagename, classname); return classQuery; }