コード例 #1
0
  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());
  }
コード例 #2
0
  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);
  }
コード例 #3
0
  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;
  }
コード例 #4
0
 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);
   }
 }
コード例 #5
0
 private static List<String> createJARQuery(final Object draggedElement) {
   final LinkedList<String> queryList = new LinkedList<String>();
   final List<String> packages =
       Resolver.getPackagesFromPFR((IPackageFragmentRoot) draggedElement);
   for (final String s : packages) {
     final String jarQuery = String.format("%s('%s')", PACKAGE, s);
     queryList.add(jarQuery);
   }
   return queryList;
 }
コード例 #6
0
  /**
   * Getting the first known object name, else return {@link #STANDARD_SHAPENAME}.
   *
   * @param extendedData
   * @return name as string
   * @author BenjaminL
   */
  public static String createNameforNewEnsemble(final Map<?, ?> extendedData) {
    // getting the first known object name
    for (final Object key : extendedData.keySet()) {
      final Object o = extendedData.get(key);

      final String name = Resolver.getElementNameFromObject(o);
      if (!name.equals("")) {
        return name;
      }
    }
    return STANDARD_SHAPENAME;
  }
コード例 #7
0
 private static String createPackageQuery(final Object draggedElement) {
   return String.format(
       "%s('%s')", PACKAGE, Resolver.resolveFullyQualifiedPackageName(draggedElement));
 }