Esempio n. 1
0
  /**
   * Trigger addition of the entire content of a project Note: the actual operation is performed in
   * background
   */
  public void indexAll(IProject project) {
    if (RubyCore.getPlugin() == null) return;

    // Also request indexing of binaries on the classpath
    // determine the new children
    try {
      RubyModel model = RubyModelManager.getRubyModelManager().getRubyModel();
      RubyProject javaProject = (RubyProject) model.getRubyProject(project);
      // only consider immediate libraries - each project will do the same
      // NOTE: force to resolve CP variables before calling indexer - 19303, so that initializers
      // will be run in the current thread.
      ILoadpathEntry[] entries =
          javaProject.getResolvedLoadpath(
              true /* ignoreUnresolvedEntry */, false /* don't generateMarkerOnError */, false /*
																													 * don't
																													 * returnResolutionInProgress
																													 */);
      for (int i = 0; i < entries.length; i++) {
        ILoadpathEntry entry = entries[i];
        if (entry.getEntryKind() == ILoadpathEntry.CPE_LIBRARY)
          this.indexLibrary(entry.getPath(), project);
      }
    } catch (RubyModelException e) { // cannot retrieve classpath info
    }

    // check if the same request is not already in the queue
    IndexRequest request = new IndexAllProject(project, this);
    if (!isJobWaiting(request)) this.request(request);
  }
 private boolean needsToDelegateGetChildren(Object element) {
   int type = -1;
   if (element instanceof IFolder) {
     IFolder folder = (IFolder) element;
     if (RubyProject.hasRubyNature(folder.getProject())) return true;
     return false;
   }
   if (element instanceof IRubyElement) type = ((IRubyElement) element).getElementType();
   return (!fIsFlatLayout
       && (type == IRubyElement.SOURCE_FOLDER
           || type == IRubyElement.SOURCE_FOLDER_ROOT
           || type == IRubyElement.RUBY_PROJECT));
 }
Esempio n. 3
0
 /** Index the content of the given source folder. */
 public void indexSourceFolder(
     RubyProject javaProject,
     IPath sourceFolder,
     char[][] inclusionPatterns,
     char[][] exclusionPatterns) {
   IProject project = javaProject.getProject();
   if (this.jobEnd > this.jobStart) {
     // skip it if a job to index the project is already in the queue
     IndexRequest request = new IndexAllProject(project, this);
     if (isJobWaiting(request)) return;
   }
   this.request(
       new AddFolderToIndex(sourceFolder, project, inclusionPatterns, exclusionPatterns, this));
 }
Esempio n. 4
0
  private void rebuildIndex(IPath indexLocation, IPath containerPath) {
    Object target = RubyModel.getTarget(containerPath, true);
    if (target == null) return;

    if (VERBOSE)
      Util.verbose(
          "-> request to rebuild index: "
              + indexLocation
              + " path: "
              + containerPath); //$NON-NLS-1$ //$NON-NLS-2$

    updateIndexState(indexLocation, REBUILDING_STATE);
    IndexRequest request = null;
    if (target instanceof IProject) {
      IProject p = (IProject) target;
      if (RubyProject.hasRubyNature(p)) request = new IndexAllProject(p, this);
    } else if (target instanceof File) {
      request = new AddExternalFolderToIndex(containerPath, this);
    }
    if (request != null) request(request);
  }