Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12800/src/org/rubypeople/rdt/internal/core/builder Modified Files: ProjectFileFinder.java IndexUpdater.java IoUtils.java Added Files: MassIndexUpdater.java RubySourceFileCollectingVisitor.java Log Message: Index all projects on plugin (eclipse) start. Index: IoUtils.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IoUtils.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IoUtils.java 13 Oct 2005 23:56:07 -0000 1.2 --- IoUtils.java 16 Oct 2005 17:29:21 -0000 1.3 *************** *** 1,12 **** /* ! ?* Author: David Corbin ! ?* ! ?* Copyright (c) 2005 RubyPeople. ! ?* ! ?* This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. ! ?*/ package org.rubypeople.rdt.internal.core.builder; --- 1,12 ---- /* ! * Author: David Corbin ! * ! * Copyright (c) 2005 RubyPeople. ! * ! * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. ! */ package org.rubypeople.rdt.internal.core.builder; *************** *** 28,32 **** } ! static void closeQuietly(InputStream contents) { try { contents.close(); --- 28,32 ---- } ! public static void closeQuietly(InputStream contents) { try { contents.close(); Index: IndexUpdater.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IndexUpdater.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** IndexUpdater.java 13 Oct 2005 23:56:06 -0000 1.4 --- IndexUpdater.java 16 Oct 2005 17:29:21 -0000 1.5 *************** *** 1,12 **** /* ! ?* Author: David Corbin ! ?* ! ?* Copyright (c) 2005 RubyPeople. ! ?* ! ?* This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. ! ?*/ package org.rubypeople.rdt.internal.core.builder; --- 1,12 ---- /* ! * Author: David Corbin ! * ! * Copyright (c) 2005 RubyPeople. ! * ! * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. ! */ package org.rubypeople.rdt.internal.core.builder; Index: ProjectFileFinder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProjectFileFinder.java 13 Oct 2005 23:56:07 -0000 1.2 --- ProjectFileFinder.java 16 Oct 2005 17:29:21 -0000 1.3 *************** *** 1,12 **** /* ! ?* Author: David Corbin ! ?* ! ?* Copyright (c) 2005 RubyPeople. ! ?* ! ?* This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. ! ?*/ --- 1,12 ---- /* ! * Author: David Corbin ! * ! * Copyright (c) 2005 RubyPeople. ! * ! * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. ! */ *************** *** 18,23 **** import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; - import org.eclipse.core.resources.IResourceProxy; - import org.eclipse.core.resources.IResourceProxyVisitor; import org.eclipse.core.runtime.CoreException; --- 18,21 ---- *************** *** 36,54 **** protected void addAllSourceFiles(final List sourceFiles) throws CoreException { ! project.accept(new IResourceProxyVisitor() { ! ! public boolean visit(IResourceProxy proxy) throws CoreException { ! IResource resource = null; ! switch (proxy.getType()) { ! case IResource.FILE: ! if (org.rubypeople.rdt.internal.core.util.Util.isRubyLikeFileName(proxy.getName())) { ! if (resource == null) resource = proxy.requestResource(); ! sourceFiles.add(resource); ! } ! return false; ! } ! return true; ! } ! }, IResource.NONE); } --- 34,38 ---- protected void addAllSourceFiles(final List sourceFiles) throws CoreException { ! project.accept(new RubySourceFileCollectingVisitor(sourceFiles), IResource.NONE); } --- NEW FILE: MassIndexUpdater.java --- /* * Author: David Corbin * * Copyright (c) 2005 RubyPeople. * * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. */ package org.rubypeople.rdt.internal.core.builder; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.jruby.ast.Node; import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.core.parser.RubyParser; public class MassIndexUpdater { private final IndexUpdater updater; private final RubyParser parser; public MassIndexUpdater(IndexUpdater updater, RubyParser parser) { this.updater = updater; this.parser = parser; } public MassIndexUpdater(IndexUpdater indexUpdater) { this(indexUpdater, new RubyParser()); } public void update(List projects) { try { List files = findFiles(projects); processFiles(files); } catch (CoreException e) { RubyCore.log(e); } } private void processFiles(List files) { for (Iterator iter = files.iterator(); iter.hasNext();) { IFile file = (IFile) iter.next(); processFile(file); } } private void processFile(IFile file) { try { Node node = parser.parse(file); updater.update(file, node); } catch (CoreException e) { RubyCore.log(e); } } private List findFiles(List projects) throws CoreException { List files = new ArrayList(); RubySourceFileCollectingVisitor visitor = new RubySourceFileCollectingVisitor(files); for (Iterator iter = projects.iterator(); iter.hasNext();) { IProject project = (IProject) iter.next(); project.accept(visitor, 0); } return files; } } --- NEW FILE: RubySourceFileCollectingVisitor.java --- /* * Author: David Corbin * * Copyright (c) 2005 RubyPeople. * * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. */ package org.rubypeople.rdt.internal.core.builder; import java.util.List; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceProxy; import org.eclipse.core.resources.IResourceProxyVisitor; import org.eclipse.core.runtime.CoreException; public final class RubySourceFileCollectingVisitor implements IResourceProxyVisitor { private final List files; public RubySourceFileCollectingVisitor(List files) { this.files = files; } public boolean visit(IResourceProxy proxy) throws CoreException { IResource resource = null; switch (proxy.getType()) { case IResource.FILE: if (org.rubypeople.rdt.internal.core.util.Util.isRubyLikeFileName(proxy.getName())) { if (resource == null) resource = proxy.requestResource(); files.add(resource); } return false; } return true; } public boolean equals(Object obj) { return obj.getClass().equals(getClass()); } public int hashCode() { return 0; } } |