Package org.objectstyle.wolips.core.resources.types

Examples of org.objectstyle.wolips.core.resources.types.TypeNameCollector


    setAllowDuplicates(false);
  }

  public int open() {
    try {
      final TypeNameCollector typeNameCollector = new TypeNameCollector(_javaProject, false);

      IRunnableWithProgress runnable = new IRunnableWithProgress() {
        public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
          try {
            BindingReflectionUtils.findMatchingElementClassNames("", SearchPattern.R_PREFIX_MATCH, typeNameCollector, monitor);
          } catch (Exception e) {
            e.printStackTrace();
            throw new InvocationTargetException(e);
          }
          if (monitor.isCanceled()) {
            throw new InterruptedException();
          }
        }
      };

      _context.run(true, true, runnable);

      if (typeNameCollector.isEmpty()) {
        String title = "None";
        String message = "None";
        MessageDialog.openInformation(getShell(), title, message);
        return CANCEL;
      }

      setElements(typeNameCollector.getTypeNames().toArray());
    } catch (Exception e) {
      return CANCEL;
    }

    return super.open();
View Full Code Here


    Set<String> superclasses = new HashSet<String>();
    try {
      IProject actualProject = ResourcesPlugin.getWorkspace().getRoot().getProject(getContainerFullPath().segment(0));
      IJavaProject javaProject = JavaModelManager.getJavaModelManager().getJavaModel().getJavaProject(actualProject);

      TypeNameCollector typeNameCollector = new TypeNameCollector(javaProject, false);
      BindingReflectionUtils.findMatchingElementClassNames("", SearchPattern.R_PREFIX_MATCH, typeNameCollector, new NullProgressMonitor());
      for (String typeName : typeNameCollector.getTypeNames()) {
        // int dotIndex = typeName.lastIndexOf('.');
        // if (dotIndex != -1) {
        // typeName = typeName.substring(dotIndex + 1);
        // }
        // validValues.add("\"" + typeName + "\"");
View Full Code Here

      }
      else {
        SearchEngine searchEngine = new SearchEngine();
        IJavaSearchScope searchScope = JavaSearchScopeFactory.getInstance().createJavaProjectSearchScope(javaProject, JavaSearchScopeFactory.ALL);
        NullProgressMonitor progressMonitor = new NullProgressMonitor();
        TypeNameCollector typeNameCollector = new TypeNameCollector(javaProject, false);
        searchEngine.searchAllTypeNames(null, SearchPattern.R_EXACT_MATCH, shortClassName.toCharArray(), IJavaSearchConstants.TYPE, IJavaSearchConstants.TYPE, searchScope, typeNameCollector, IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH, progressMonitor);
        Set<String> typeNames = typeNameCollector.getTypeNames();
        if (typeNames.size() == 1) {
          expandedClassName = typeNames.iterator().next();
        }
        else if (typeNames.size() == 0) {
          System.out.println("BindingReflectionUtils.getFullClassName: Unknown type name " + shortClassName);
View Full Code Here

      type = javaProject.findType(typeName);
    }
    else {
      //long a = System.currentTimeMillis();
      NullProgressMonitor progressMonitor = new NullProgressMonitor();
      TypeNameCollector typeNameCollector = new TypeNameCollector(javaProject, requireTypeInProject);
      //System.out.println("BindingReflectionUtils.findElementType: start " + System.currentTimeMillis());
      BindingReflectionUtils.findMatchingElementClassNames(elementTypeName, SearchPattern.R_EXACT_MATCH, typeNameCollector, progressMonitor);
      //System.out.println("BindingReflectionUtils.findElementType: " + (System.currentTimeMillis() - a));
      if (typeNameCollector.isExactMatch()) {
        String matchingElementClassName = typeNameCollector.firstTypeName();
        type = typeNameCollector.getTypeForClassName(matchingElementClassName);
      }
      else if (!typeNameCollector.isEmpty()) {
        // there was more than one matching class! crap!
        String matchingElementClassName = typeNameCollector.firstTypeName();
        type = typeNameCollector.getTypeForClassName(matchingElementClassName);
      }
      if (type != null) {
        cache.getApiCache(javaProject).setElementTypeForName(type, elementTypeName);
      }
    }
View Full Code Here

  public static void fillInElementTypeCompletionProposals(IJavaProject project, String token, int tokenOffset, int offset, Set<WodCompletionProposal> completionProposalsSet, boolean guessed, IProgressMonitor progressMonitor) throws JavaModelException {
    // Lookup type names that extend WOElement based on the current partial
    // token
    String partialToken = partialToken(token, tokenOffset, offset);
    if (partialToken.length() > 0) {
      TypeNameCollector typeNameCollector = new TypeNameCollector(project, false);
      BindingReflectionUtils.findMatchingElementClassNames(partialToken, SearchPattern.R_PREFIX_MATCH, typeNameCollector, progressMonitor);
      boolean includePackageName = token.indexOf('.') != -1;
      Iterator<String> matchingElementClassNamesIter = typeNameCollector.typeNames();
      while (matchingElementClassNamesIter.hasNext()) {
        String matchingElementTypeName = matchingElementClassNamesIter.next();
        String elementTypeName;
        if (includePackageName) {
          elementTypeName = matchingElementTypeName;
        }
        else {
          elementTypeName = BindingReflectionUtils.getShortClassName(matchingElementTypeName);
        }
        WodCompletionProposal completionProposal;
        IType type = typeNameCollector.getTypeForClassName(matchingElementTypeName);
        if (WodCompletionUtils.shouldSmartInsert() && guessed) {
          if (BindingReflectionUtils.memberIsDeprecated(type)) {
            completionProposal = new WodDeprecatedCompletionProposal(token, tokenOffset, offset, elementTypeName + " {\n\t\n}", elementTypeName, elementTypeName.length() + 4);
          } else {
            completionProposal = new WodCompletionProposal(token, tokenOffset, offset, elementTypeName + " {\n\t\n}", elementTypeName, elementTypeName.length() + 4);
View Full Code Here

    IJavaProject javaProject = JavaCore.create(_file.getProject());
    String typeName = typeCache.getApiCache(javaProject).getElementTypeNamed(className);
    if (typeName != null) {
      classType = javaProject.findType(typeName);
    } else {
      TypeNameCollector typeNameCollector = new TypeNameCollector("com.webobjects.appserver.WODisplayGroup", javaProject, true);
      BindingReflectionUtils.findMatchingElementClassNames(className, SearchPattern.R_EXACT_MATCH, typeNameCollector, null);
      if (!typeNameCollector.isEmpty()) {
        String matchingElementClassName = typeNameCollector.firstTypeName();
        classType = typeNameCollector.getTypeForClassName(matchingElementClassName);
      }
      if (classType != null) {
        typeCache.getApiCache(javaProject).setElementTypeForName(classType, className);
      }
    }
View Full Code Here

      validValues.add("\"image/jpeg\"");
      validValues.add("\"image/png\"");
    }
    else if ("Direct Actions".equals(defaultsName)) {
      if (partialValue != null && partialValue.startsWith("\"")) {
        TypeNameCollector typeNameCollector = new TypeNameCollector("com.webobjects.appserver.WODirectAction", javaProject, false);
        BindingReflectionUtils.findMatchingElementClassNames("", SearchPattern.R_PREFIX_MATCH, typeNameCollector, new NullProgressMonitor());
        for (IType type : typeNameCollector.types()) {
          IMethod[] methods = type.getMethods();
          for (IMethod method : methods) {
            String name = method.getElementName();
            if (name.endsWith("Action") && method.getParameterNames().length == 0) {
              validValues.add("\"" + name.substring(0, name.length() - "Action".length()) + "\"");
            }
          }
        }
      }
    }
    else if ("Direct Action Classes".equals(defaultsName)) {
      if (partialValue != null && partialValue.startsWith("\"")) {
        TypeNameCollector typeNameCollector = new TypeNameCollector("com.webobjects.appserver.WODirectAction", javaProject, false);
        BindingReflectionUtils.findMatchingElementClassNames(partialValue.substring(1), SearchPattern.R_PREFIX_MATCH, typeNameCollector, new NullProgressMonitor());
        for (String typeName : typeNameCollector.getTypeNames()) {
          int dotIndex = typeName.lastIndexOf('.');
          if (dotIndex != -1) {
            typeName = typeName.substring(dotIndex + 1);
          }
          validValues.add("\"" + typeName + "\"");
        }
      }
    }
    else if ("Page Names".equals(defaultsName)) {
      if (partialValue != null && partialValue.startsWith("\"")) {
        TypeNameCollector typeNameCollector = new TypeNameCollector(javaProject, false);
        BindingReflectionUtils.findMatchingElementClassNames(partialValue.substring(1), SearchPattern.R_PREFIX_MATCH, typeNameCollector, new NullProgressMonitor());
        for (String typeName : typeNameCollector.getTypeNames()) {
          int dotIndex = typeName.lastIndexOf('.');
          if (dotIndex != -1) {
            typeName = typeName.substring(dotIndex + 1);
          }
          validValues.add("\"" + typeName + "\"");
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.core.resources.types.TypeNameCollector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.