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));
 }
Exemplo n.º 2
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);
  }