You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
Update of /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25606/src/org/rubypeople/eclipse/shams/resources Modified Files: ShamFile.java ShamFolder.java ShamResource.java ShamProject.java Added Files: ShamContainer.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: ShamFolder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/resources/ShamFolder.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ShamFolder.java 27 Jun 2004 11:43:13 -0000 1.5 --- ShamFolder.java 12 Nov 2005 19:16:08 -0000 1.6 *************** *** 1,20 **** package org.rubypeople.eclipse.shams.resources; ! import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; - import org.eclipse.core.resources.IMarker; - import org.eclipse.core.resources.IProject; - import org.eclipse.core.resources.IProjectDescription; - import org.eclipse.core.resources.IResource; - import org.eclipse.core.resources.IResourceVisitor; - import org.eclipse.core.resources.IWorkspace; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; - import org.eclipse.core.runtime.QualifiedName; ! public class ShamFolder extends ShamResource implements IFolder { public ShamFolder(String aPathString) { --- 1,13 ---- package org.rubypeople.eclipse.shams.resources; ! import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.Path; ! public class ShamFolder extends ShamContainer implements IFolder { public ShamFolder(String aPathString) { *************** *** 27,196 **** public void setDefaultCharset(String charset, IProgressMonitor monitor) ! throws CoreException { ! } ! ! public void create(boolean force, boolean local, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void create(int updateFlags, boolean local, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void delete(boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IFile getFile(String name) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IFolder getFolder(String name) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void move(IPath destination, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public boolean exists(IPath path) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IResource findMember(String name) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IResource findMember(String name, boolean includePhantoms) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IResource findMember(IPath path) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IResource findMember(IPath path, boolean includePhantoms) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IFile getFile(IPath path) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IFolder getFolder(IPath path) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IResource[] members() throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IResource[] members(boolean includePhantoms) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IResource[] members(int memberFlags) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IFile[] findDeletedMembersWithHistory(int depth, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public Object getAdapter(Class adapter) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void accept(IResourceVisitor visitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void accept(IResourceVisitor visitor, int depth, boolean includePhantoms) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void accept(IResourceVisitor visitor, int depth, int memberFlags) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void clearHistory(IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void copy(IProjectDescription description, boolean force, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void copy(IPath destination, boolean force, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void copy(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void copy(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IMarker createMarker(String type) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void delete(boolean force, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void delete(int updateFlags, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public void deleteMarkers(String type, boolean includeSubtypes, int depth) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public boolean exists() { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IMarker findMarker(long id) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IMarker[] findMarkers(String type, boolean includeSubtypes, int depth) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IPath getLocation() { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IMarker getMarker(long id) { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public long getModificationStamp() { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IContainer getParent() { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public String getPersistentProperty(QualifiedName key) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IProject getProject() { ! throw new RuntimeException("Need to implement on sham."); ! } ! ! public IPath getProjectRelativePath() { ! throw new RuntimeException("Need to implement on sham."); } - public Object getSessionProperty(QualifiedName key) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } public int getType() { --- 20,26 ---- public void setDefaultCharset(String charset, IProgressMonitor monitor) ! throws CoreException { } public int getType() { *************** *** 198,315 **** } - public IWorkspace getWorkspace() { - throw new RuntimeException("Need to implement on sham."); - } - - public boolean isAccessible() { - throw new RuntimeException("Need to implement on sham."); - } - - public boolean isLocal(int depth) { - throw new RuntimeException("Need to implement on sham."); - } - - public boolean isPhantom() { - throw new RuntimeException("Need to implement on sham."); - } - - public boolean isReadOnly() { - throw new RuntimeException("Need to implement on sham."); - } - - public boolean isSynchronized(int depth) { - throw new RuntimeException("Need to implement on sham."); - } - - public void move(IProjectDescription description, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public void move(IPath destination, boolean force, IProgressMonitor monitor) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public void move(IProjectDescription description, int updateFlags, IProgressMonitor monitor) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public void move(IPath destination, int updateFlags, IProgressMonitor monitor) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public void refreshLocal(int depth, IProgressMonitor monitor) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public void setLocal(boolean flag, int depth, IProgressMonitor monitor) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public void setPersistentProperty(QualifiedName key, String value) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public void setReadOnly(boolean readOnly) { - throw new RuntimeException("Need to implement on sham."); - } - - public void setSessionProperty(QualifiedName key, Object value) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public void touch(IProgressMonitor monitor) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public boolean isDerived() { - throw new RuntimeException("Need to implement on sham."); - } - - public void setDerived(boolean isDerived) throws CoreException { - throw new RuntimeException("Need to implement on sham."); - } - - public boolean isTeamPrivateMember() { - throw new RuntimeException("Need to implement on sham."); - } ! public void setTeamPrivateMember(boolean isTeamPrivate) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! public void createLink(IPath localLocation, int updateFlags, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); ! } ! public IPath getRawLocation() { ! throw new RuntimeException("Need to implement on sham."); ! } ! public boolean isLinked() { ! throw new RuntimeException("Need to implement on sham."); ! } ! /* (non-Javadoc) ! * @see org.eclipse.core.resources.IContainer#getDefaultCharset() ! */ ! public String getDefaultCharset() throws CoreException { ! // TODO Auto-generated method stub ! return null; ! } ! /* (non-Javadoc) ! * @see org.eclipse.core.resources.IContainer#setDefaultCharset(java.lang.String) ! */ ! public void setDefaultCharset(String charset) throws CoreException { ! // TODO Auto-generated method stub ! ! } ! /* (non-Javadoc) ! * @see org.eclipse.core.resources.IContainer#getDefaultCharset(boolean) ! */ ! public String getDefaultCharset(boolean checkImplicit) throws CoreException { ! // TODO Auto-generated method stub ! return null; ! } } --- 28,58 ---- } ! public void create(boolean force, boolean local, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Sham needs to implement"); ! } ! public void create(int updateFlags, boolean local, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Sham needs to implement"); ! } ! public void createLink(IPath localLocation, int updateFlags, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Sham needs to implement"); ! } ! public void delete(boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Sham needs to implement"); ! } ! public IFile getFile(String name) { ! throw new RuntimeException("Sham needs to implement"); ! } ! public IFolder getFolder(String name) { ! throw new RuntimeException("Sham needs to implement"); ! } ! public void move(IPath destination, boolean force, boolean keepHistory, IProgressMonitor monitor) throws CoreException { ! throw new RuntimeException("Sham needs to implement"); ! } } Index: ShamFile.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/resources/ShamFile.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ShamFile.java 1 Oct 2005 23:00:50 -0000 1.13 --- ShamFile.java 12 Nov 2005 19:16:08 -0000 1.14 *************** *** 28,34 **** --- 28,36 ---- public class ShamFile extends ShamResource implements IFile { + public static final String WORKSPACE_ROOT = "/test/workspaceRoot"; protected String contents = ""; protected boolean readContentFromFile; private InputStream inputStream; + private IProject project; public void setCharset(String newCharset, IProgressMonitor monitor) *************** *** 55,58 **** --- 57,61 ---- super(aPath); this.readContentFromFile = readContentFromFile; + project = new ShamProject("not specified"); } *************** *** 178,182 **** public IPath getLocation() { ! throw new RuntimeException("Unimplemented method in sham"); } --- 181,185 ---- public IPath getLocation() { ! return new Path(WORKSPACE_ROOT).append(getFullPath()); } *************** *** 198,202 **** public IProject getProject() { ! return new ShamProject("not specified"); } --- 201,205 ---- public IProject getProject() { ! return project; } *************** *** 340,343 **** --- 343,350 ---- } + public void setProject(IProject project) { + this.project = project; + } + private class MonitoredInputStream extends InputStream { *************** *** 357,359 **** --- 364,367 ---- } } + } --- NEW FILE: ShamContainer.java --- package org.rubypeople.eclipse.shams.resources; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceProxyVisitor; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; public class ShamContainer extends ShamResource implements IContainer { protected List childResources = new ArrayList(); public ShamContainer(IPath path) { super(path); } public void accept(IResourceProxyVisitor visitor, int flags) throws CoreException { for (Iterator iter = childResources.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); visitor.visit(new ShamResourceProxy(resource)); if (resource instanceof IContainer) { IContainer container = (IContainer) resource; container.accept(visitor, flags); } } } public boolean exists(IPath path) { throw new RuntimeException("Sham must implement"); } public IResource findMember(String name) { throw new RuntimeException("Sham must implement"); } public IResource findMember(String name, boolean includePhantoms) { throw new RuntimeException("Sham must implement"); } public IResource findMember(IPath path) { throw new RuntimeException("Sham must implement"); } public IResource findMember(IPath path, boolean includePhantoms) { throw new RuntimeException("Sham must implement"); } public String getDefaultCharset() throws CoreException { throw new RuntimeException("Sham must implement"); } public String getDefaultCharset(boolean checkImplicit) throws CoreException { throw new RuntimeException("Sham must implement"); } public IFile getFile(IPath path) { throw new RuntimeException("Sham must implement"); } public IFolder getFolder(IPath path) { throw new RuntimeException("Sham must implement"); } public IResource[] members() throws CoreException { return (IResource[]) childResources.toArray(new IResource[0]); } public IResource[] members(boolean includePhantoms) throws CoreException { throw new RuntimeException("Sham must implement"); } public IResource[] members(int memberFlags) throws CoreException { throw new RuntimeException("Sham must implement"); } public IFile[] findDeletedMembersWithHistory(int depth, IProgressMonitor monitor) throws CoreException { throw new RuntimeException("Sham must implement"); } public void setDefaultCharset(String charset) throws CoreException { throw new RuntimeException("Sham must implement"); } public void setDefaultCharset(String charset, IProgressMonitor monitor) throws CoreException { throw new RuntimeException("Sham must implement"); } public void addResource(IResource resource) { childResources.add(resource); } } Index: ShamProject.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/resources/ShamProject.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** ShamProject.java 19 Oct 2005 00:33:17 -0000 1.12 --- ShamProject.java 12 Nov 2005 19:16:08 -0000 1.13 *************** *** 34,43 **** import org.eclipse.core.runtime.content.IContentTypeMatcher; ! public class ShamProject extends ShamResource implements IProject { protected String projectName; protected List natures = new ArrayList(); ! ! public ShamProject(String theProjectName) { ! this(new Path("path to " + theProjectName), theProjectName); } --- 34,42 ---- import org.eclipse.core.runtime.content.IContentTypeMatcher; ! public class ShamProject extends ShamContainer implements IProject, IContainer { protected String projectName; protected List natures = new ArrayList(); ! public ShamProject(String theProjectName) { ! this(new Path("/" + theProjectName), theProjectName); } *************** *** 50,54 **** } ! public void build(int kind, String builderName, Map args, IProgressMonitor monitor) throws CoreException {} public void build(int kind, IProgressMonitor monitor) throws CoreException {} --- 49,53 ---- } ! public void build(int kind, String builderName, Map args, IProgressMonitor monitor) throws CoreException {} public void build(int kind, IProgressMonitor monitor) throws CoreException {} *************** *** 139,143 **** public IResource[] members() throws CoreException { ! throw new RuntimeException("Unimplemented method in sham"); } --- 138,142 ---- public IResource[] members() throws CoreException { ! return (IResource[]) childResources.toArray(new IResource[0]); } Index: ShamResource.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/resources/ShamResource.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ShamResource.java 19 Oct 2005 00:33:17 -0000 1.9 --- ShamResource.java 12 Nov 2005 19:16:08 -0000 1.10 *************** *** 11,19 **** package org.rubypeople.eclipse.shams.resources; - import java.util.Collection; - import java.util.Iterator; - - import junit.framework.Assert; - import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IMarker; --- 11,14 ---- *************** *** 33,46 **** public class ShamResource implements IResource { protected IPath path; - private boolean acceptCalled; - private IResourceProxyVisitor proxyVisitorArg; - private int flagsArg; - private Collection resourcesToVisit; public ShamResource(IPath aPath) { - super(); path = aPath; } public void accept(IResourceVisitor visitor) throws CoreException { throw new RuntimeException("Need to implement on sham."); --- 28,44 ---- public class ShamResource implements IResource { protected IPath path; public ShamResource(IPath aPath) { path = aPath; } + public boolean equals(Object obj) { + if (obj instanceof ShamResource) { + ShamResource that = (ShamResource) obj; + return path.equals(that.path); + } + return false; + } + public void accept(IResourceVisitor visitor) throws CoreException { throw new RuntimeException("Need to implement on sham."); *************** *** 245,267 **** } - public void setResourcesToVisit(Collection resourcesToVisit) { - this.resourcesToVisit = resourcesToVisit; - } - - public void assertAcceptCalled(IResourceProxyVisitor expectedVisitor, int expectedFlags) { - Assert.assertTrue("expected call to accept", acceptCalled); - Assert.assertEquals("visitor", expectedVisitor, proxyVisitorArg); - Assert.assertEquals("flags", expectedFlags, flagsArg); - } - public void accept(IResourceProxyVisitor visitor, int flags) throws CoreException { ! proxyVisitorArg = visitor; ! flagsArg = flags; ! for (Iterator iter = resourcesToVisit.iterator(); iter.hasNext();) { ! IResource resource = (IResource) iter.next(); ! visitor.visit(new ShamResourceProxy(resource)); ! ! } ! acceptCalled = true; } --- 243,248 ---- } public void accept(IResourceProxyVisitor visitor, int flags) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); } *************** *** 283,297 **** public ResourceAttributes getResourceAttributes() { ! // TODO Auto-generated method stub ! return null; } public void revertModificationStamp(long value) throws CoreException { ! // TODO Auto-generated method stub ! } public void setResourceAttributes(ResourceAttributes attributes) throws CoreException { ! // TODO Auto-generated method stub } --- 264,276 ---- public ResourceAttributes getResourceAttributes() { ! throw new RuntimeException("Need to implement on sham."); } public void revertModificationStamp(long value) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); } public void setResourceAttributes(ResourceAttributes attributes) throws CoreException { ! throw new RuntimeException("Need to implement on sham."); } |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:17
|
Update of /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/runtime In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25606/src/org/rubypeople/eclipse/shams/runtime Added Files: ShamMonitor.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. --- NEW FILE: ShamMonitor.java --- package org.rubypeople.eclipse.shams.runtime; import java.util.ArrayList; import java.util.List; import junit.framework.Assert; import org.eclipse.core.runtime.IProgressMonitor; public class ShamMonitor implements IProgressMonitor { private int worked; private int totalWorkArg; private String taskNameArg; private List subTasks = new ArrayList(); private int cancelAfterWork; private boolean cancel; private boolean done; public void beginTask(String name, int totalWork) { taskNameArg = name; totalWorkArg = totalWork; } public void done() { done = true; } public void internalWorked(double work) { } public boolean isCanceled() { return cancel; } public void setCanceled(boolean value) { } public void setTaskName(String name) { } public void subTask(String name) { subTasks.add(name); } public void worked(int work) { worked += work; if (worked >= cancelAfterWork && cancelAfterWork > 0) cancel = true; } public void assertDone(int expectedWorked) { Assert.assertEquals("Done", true, done); Assert.assertEquals("Work done", expectedWorked, worked); } public void assertTaskBegun(String expectedTaskName, int expectedTotalWork) { Assert.assertEquals("taskName", expectedTaskName, taskNameArg); Assert.assertEquals("totalWork", expectedTotalWork , totalWorkArg); } public void assertSubTasks(List expectedSubTasks) { Assert.assertEquals(expectedSubTasks, subTasks); } public void cancelAfter(int work) { cancelAfterWork = work; } } |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:10
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25567/src/org/rubypeople/rdt/internal/ui/search Modified Files: RubySearchResultPage.java GroupByPathStrategy.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: RubySearchResultPage.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchResultPage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubySearchResultPage.java 26 Oct 2005 21:55:50 -0000 1.2 --- RubySearchResultPage.java 12 Nov 2005 19:16:03 -0000 1.3 *************** *** 72,76 **** try { SearchResult result = (SearchResult) match.getElement(); ! IPath sourcePath = result.getLocation().getSourcePath(); IResource resource = RubyPlugin.getWorkspace().getRoot().findMember(sourcePath); --- 72,76 ---- try { SearchResult result = (SearchResult) match.getElement(); ! IPath sourcePath = result.getLocation().getSourceFile().getFullPath(); IResource resource = RubyPlugin.getWorkspace().getRoot().findMember(sourcePath); Index: GroupByPathStrategy.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/GroupByPathStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GroupByPathStrategy.java 26 Oct 2005 21:55:50 -0000 1.1 --- GroupByPathStrategy.java 12 Nov 2005 19:16:03 -0000 1.2 *************** *** 8,12 **** if (!(element instanceof SearchResult)) { return null; } SearchResult result = (SearchResult) element; ! return result.getLocation().getSourcePath(); } } --- 8,12 ---- if (!(element instanceof SearchResult)) { return null; } SearchResult result = (SearchResult) element; ! return result.getLocation().getSourceFile().getFullPath(); } } |
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25492/src/org/rubypeople/rdt/internal/core/builder Modified Files: RubyBuilder.java IndexUpdater.java SingleFileCompiler.java ProjectFileFinder.java IncrementalFileFinder.java Added Files: RubyCodeAnalyzer.java AbstractRdtCompiler.java IncrementalRdtCompiler.java CleanRdtCompiler.java IFileProvider.java Removed Files: RubyCompiler.java RdtCompiler.java IFileFinder.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: RubyBuilder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** RubyBuilder.java 23 Oct 2005 00:03:16 -0000 1.15 --- RubyBuilder.java 12 Nov 2005 19:15:58 -0000 1.16 *************** *** 13,17 **** import java.util.Date; - import java.util.List; import java.util.Map; --- 13,16 ---- *************** *** 21,29 **** import org.eclipse.core.runtime.IProgressMonitor; import org.rubypeople.rdt.core.RubyCore; public class RubyBuilder extends IncrementalProjectBuilder { - private static final int TOTAL_WORK = 10000; private static boolean verbose; --- 20,28 ---- import org.eclipse.core.runtime.IProgressMonitor; import org.rubypeople.rdt.core.RubyCore; + import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; public class RubyBuilder extends IncrementalProjectBuilder { private static boolean verbose; *************** *** 32,63 **** protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { this.currentProject = getProject(); - monitor.beginTask("build", TOTAL_WORK); - IProject[] returnProjects = new IProject[0]; if (currentProject == null || !currentProject.isAccessible()) ! return returnProjects; if (verbose) RubyCore.trace("Started " + buildType(kind) + " build of " + buildDescription()); //$NON-NLS-1$ ! MarkerManager rubyMarkerManager = new MarkerManager(); ! if (!isPartialBuild(kind)) ! rubyMarkerManager.removeProblemsAndTasksFor(currentProject); ! ! List files = createFileFinder(kind).findFiles(); ! doCompile(files, monitor); ! RubyCore.trace("Finished build of " + buildDescription()); //$NON-NLS-1$ ! return returnProjects; } private String buildType(int kind) { return isPartialBuild(kind) ? "Incremental" : "Full"; } - private IFileFinder createFileFinder(int kind) { - if (isPartialBuild(kind)) - return new IncrementalFileFinder(getDelta(currentProject)); - return new ProjectFileFinder(currentProject); - } - private String buildDescription() { return currentProject.getName() + " @ " + new Date(System.currentTimeMillis()); --- 31,59 ---- protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException { this.currentProject = getProject(); if (currentProject == null || !currentProject.isAccessible()) ! return null; if (verbose) RubyCore.trace("Started " + buildType(kind) + " build of " + buildDescription()); //$NON-NLS-1$ ! AbstractRdtCompiler compiler = createCompiler(kind); ! compiler.compile(monitor); ! if (verbose) ! RubyCore.trace("Finished build of " + buildDescription()); //$NON-NLS-1$ ! return null; } + + private AbstractRdtCompiler createCompiler(int kind) { + SymbolIndex symbolIndex = RubyCore.getPlugin().getSymbolIndex(); + if (isPartialBuild(kind)) + return new IncrementalRdtCompiler(currentProject, getDelta(currentProject), symbolIndex); + return new CleanRdtCompiler(currentProject, symbolIndex); + + } private String buildType(int kind) { return isPartialBuild(kind) ? "Incremental" : "Full"; } private String buildDescription() { return currentProject.getName() + " @ " + new Date(System.currentTimeMillis()); *************** *** 67,74 **** return kind == INCREMENTAL_BUILD || kind == AUTO_BUILD; } - - protected void doCompile(List files, IProgressMonitor monitor) { - new RubyCompiler(TOTAL_WORK/files.size()).compile(files, monitor); - } public static void setVerbose(boolean verbose) { --- 63,66 ---- Index: SingleFileCompiler.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/SingleFileCompiler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SingleFileCompiler.java 13 Oct 2005 23:56:06 -0000 1.2 --- SingleFileCompiler.java 12 Nov 2005 19:15:58 -0000 1.3 *************** *** 16,20 **** import org.eclipse.core.runtime.CoreException; ! interface SingleFileCompiler { public void compileFile(IFile file) throws CoreException; } \ No newline at end of file --- 16,20 ---- import org.eclipse.core.runtime.CoreException; ! public interface SingleFileCompiler { public void compileFile(IFile file) throws CoreException; } \ No newline at end of file --- NEW FILE: CleanRdtCompiler.java --- package org.rubypeople.rdt.internal.core.builder; import java.util.List; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; public class CleanRdtCompiler extends AbstractRdtCompiler { private List projectFiles; public CleanRdtCompiler(IProject project, SymbolIndex symbolIndex) { this(project, symbolIndex, new MarkerManager()); } public CleanRdtCompiler(IProject project, SymbolIndex symbolIndex, IMarkerManager markerManager, List singleCompilers) { super(project, symbolIndex, markerManager, singleCompilers); } private CleanRdtCompiler(IProject project, SymbolIndex symbolIndex, MarkerManager markerManager) { this(project,symbolIndex, markerManager, compilers(markerManager)); } protected void flushIndexEntries(SymbolIndex symbolIndex) { symbolIndex.flush(project); } protected void removeMarkers(IMarkerManager markerManager) { markerManager.removeProblemsAndTasksFor(project); } protected List getFilesToClear() { return projectFiles; } protected List getFilesToCompile() { return projectFiles; } protected void analyzeFiles() throws CoreException { ProjectFileFinder finder = new ProjectFileFinder(project); projectFiles = finder.findFiles(); } } --- NEW FILE: AbstractRdtCompiler.java --- package org.rubypeople.rdt.internal.core.builder; 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.eclipse.core.runtime.IProgressMonitor; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; import org.rubypeople.rdt.internal.core.util.ListUtil; public abstract class AbstractRdtCompiler { protected final IProject project; protected final IMarkerManager markerManager; protected final SymbolIndex symbolIndex; protected final List compilers; public AbstractRdtCompiler(IProject project, SymbolIndex symbolIndex, IMarkerManager markerManager, List singleCompilers) { this.project = project; this.symbolIndex = symbolIndex; this.markerManager = markerManager; this.compilers = singleCompilers; } protected abstract void removeMarkers(IMarkerManager markerManager); protected abstract void flushIndexEntries(SymbolIndex symbolIndex); protected abstract List getFilesToCompile(); protected abstract void analyzeFiles() throws CoreException; protected static List compilers(MarkerManager markerManager) { return ListUtil.create(new RubyCodeAnalyzer(markerManager), new TaskCompiler(markerManager)); } public void compile(IProgressMonitor monitor) throws CoreException { analyzeFiles(); List list = getFilesToCompile(); monitor.beginTask("Building "+project.getName() + "...", list.size() * compilers.size() + 2); monitor.subTask("Removing Markers..."); removeMarkers(markerManager); monitor.worked(1); flushIndexEntries(symbolIndex); monitor.worked(1); compileFiles(list, monitor); monitor.done(); } private void compileFiles(List list, IProgressMonitor monitor) throws CoreException { for (Iterator iter = list.iterator(); iter.hasNext();) { IFile file = (IFile) iter.next(); if (monitor.isCanceled()) break; monitor.subTask(file.getFullPath().toString()); compileFile(file, monitor); } } private void compileFile(IFile file, IProgressMonitor monitor) throws CoreException { for (Iterator cIter = compilers.iterator(); cIter.hasNext();) { SingleFileCompiler fileCompiler = (SingleFileCompiler) cIter.next(); fileCompiler.compileFile(file); monitor.worked(1); } } } --- NEW FILE: RubyCodeAnalyzer.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.io.InputStreamReader; import java.io.Reader; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.jruby.ast.Node; import org.jruby.lexer.yacc.SyntaxException; import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.core.parser.ImmediateWarnings; import org.rubypeople.rdt.internal.core.parser.RubyParser; public final class RubyCodeAnalyzer implements SingleFileCompiler { private final IMarkerManager markerManager; private RubyParser parser; private final IndexUpdater indexUpdater; public RubyCodeAnalyzer(IMarkerManager markerManager) { this(markerManager, new RubyParser(new ImmediateWarnings(markerManager)), new IndexUpdater(((RubyCore) RubyCore.getPlugin()).getSymbolIndex())); } public RubyCodeAnalyzer(IMarkerManager markerManager, RubyParser parser, IndexUpdater indexUpdater) { this.markerManager = markerManager; this.parser = parser; this.indexUpdater = indexUpdater; } public void compileFile(IFile file) throws CoreException { Reader reader = new InputStreamReader(file.getContents()); try { Node rootNode = parser.parse(file, reader); indexUpdater.update(file, rootNode); } catch (SyntaxException e) { markerManager.createSyntaxError(file, e); } finally { IoUtils.closeQuietly(reader); } } } Index: ProjectFileFinder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/ProjectFileFinder.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ProjectFileFinder.java 16 Oct 2005 17:29:21 -0000 1.3 --- ProjectFileFinder.java 12 Nov 2005 19:15:58 -0000 1.4 *************** *** 20,24 **** import org.eclipse.core.runtime.CoreException; ! final class ProjectFileFinder implements IFileFinder { private final IProject project; --- 20,24 ---- import org.eclipse.core.runtime.CoreException; ! final class ProjectFileFinder implements IFileProvider { private final IProject project; --- NEW FILE: IFileProvider.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.runtime.CoreException; interface IFileProvider { public List findFiles() throws CoreException; } --- RdtCompiler.java DELETED --- --- RubyCompiler.java DELETED --- --- IFileFinder.java DELETED --- Index: IndexUpdater.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IndexUpdater.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IndexUpdater.java 23 Oct 2005 22:24:27 -0000 1.7 --- IndexUpdater.java 12 Nov 2005 19:15:58 -0000 1.8 *************** *** 36,40 **** public void update(IFile file, Node rootNode) { ! index.flush(file.getFullPath()); processNode(file, rootNode); } --- 36,40 ---- public void update(IFile file, Node rootNode) { ! index.flush(file); processNode(file, rootNode); } Index: IncrementalFileFinder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IncrementalFileFinder.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IncrementalFileFinder.java 13 Oct 2005 23:56:07 -0000 1.2 --- IncrementalFileFinder.java 12 Nov 2005 19:15:58 -0000 1.3 *************** *** 19,23 **** import org.eclipse.core.resources.IResourceDelta; ! class IncrementalFileFinder implements IFileFinder { private final IResourceDelta delta; --- 19,23 ---- import org.eclipse.core.resources.IResourceDelta; ! class IncrementalFileFinder implements IFileProvider { private final IResourceDelta delta; --- NEW FILE: IncrementalRdtCompiler.java --- 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.resources.IResource; import org.eclipse.core.resources.IResourceDelta; import org.eclipse.core.resources.IResourceDeltaVisitor; import org.eclipse.core.runtime.CoreException; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; import org.rubypeople.rdt.internal.core.util.Util; public class IncrementalRdtCompiler extends AbstractRdtCompiler { private List filesToCompile; private List filesToClear; private final IResourceDelta rootDelta; public IncrementalRdtCompiler(IProject project, IResourceDelta delta, SymbolIndex symbolIndex, IMarkerManager markerManager, List singleCompilers) { super(project, symbolIndex, markerManager, singleCompilers); this.rootDelta = delta; } public IncrementalRdtCompiler(IProject project, IResourceDelta delta, SymbolIndex symbolIndex) { this(project, delta, symbolIndex, new MarkerManager()); } private IncrementalRdtCompiler(IProject project, IResourceDelta delta, SymbolIndex symbolIndex, MarkerManager manager) { this(project, delta, symbolIndex, manager, compilers(manager)); } protected void removeMarkers(IMarkerManager markerManager) { for (Iterator iter = filesToClear.iterator(); iter.hasNext();) { IFile file = (IFile) iter.next(); markerManager.removeProblemsAndTasksFor(file); } } protected void flushIndexEntries(SymbolIndex symbolIndex) { for (Iterator iter = filesToClear.iterator(); iter.hasNext();) { IFile file = (IFile) iter.next(); symbolIndex.flush(file); } } protected List getFilesToCompile() { return filesToCompile; } protected void analyzeFiles() throws CoreException { filesToClear = new ArrayList(); filesToCompile = new ArrayList(); rootDelta.accept(new IResourceDeltaVisitor() { public boolean visit(IResourceDelta delta) throws CoreException { IResource resource = delta.getResource(); if (isRubyFile(resource)) { if (delta.getKind() == IResourceDelta.REMOVED) { filesToClear.add(resource); } else if (delta.getKind() == IResourceDelta.ADDED || delta.getKind() == IResourceDelta.CHANGED) { filesToCompile.add(resource); } } return true; } private boolean isRubyFile(IResource resource) { return resource instanceof IFile && Util.isRubyLikeFileName(resource.getName()); }}); filesToClear.addAll(filesToCompile); } } |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:08
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25492/src/org/rubypeople/rdt/internal/core/symbols Modified Files: Location.java SymbolIndex.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: Location.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/Location.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Location.java 23 Oct 2005 19:43:34 -0000 1.4 --- Location.java 12 Nov 2005 19:15:59 -0000 1.5 *************** *** 12,35 **** package org.rubypeople.rdt.internal.core.symbols; ! import org.eclipse.core.runtime.IPath; ! import org.eclipse.core.runtime.Path; import org.jruby.lexer.yacc.ISourcePosition; public class Location { - private final IPath sourcePath; private final ISourcePosition position; ! public Location(IPath sourcePath, ISourcePosition position) { ! this.sourcePath = sourcePath; this.position = position; } public String toString() { ! return sourcePath+": " + position; } ! public boolean forSource(Path path) { ! return sourcePath.equals(path); } --- 12,34 ---- package org.rubypeople.rdt.internal.core.symbols; ! import org.eclipse.core.resources.IFile; import org.jruby.lexer.yacc.ISourcePosition; public class Location { private final ISourcePosition position; + private final IFile sourceFile; ! public Location(IFile sourceFile, ISourcePosition position) { ! this.sourceFile = sourceFile; this.position = position; } public String toString() { ! return sourceFile+": " + position; } ! public boolean forSource(IFile file) { ! return sourceFile.equals(file); } *************** *** 39,52 **** Location that = (Location) obj; ! return this.sourcePath.equals(that.sourcePath) && this.position.equals(that.position); } public int hashCode() { ! return sourcePath.hashCode() * position.hashCode(); } public String getFilename() { ! return sourcePath.toOSString(); } --- 38,51 ---- Location that = (Location) obj; ! return this.sourceFile.equals(that.sourceFile) && this.position.equals(that.position); } public int hashCode() { ! return sourceFile.hashCode() * position.hashCode(); } public String getFilename() { ! return sourceFile.getLocation().toOSString(); } *************** *** 55,61 **** } ! public IPath getSourcePath() { ! return sourcePath ; } } --- 54,60 ---- } ! public IFile getSourceFile() { ! return sourceFile; } } Index: SymbolIndex.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/SymbolIndex.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** SymbolIndex.java 23 Oct 2005 22:24:27 -0000 1.8 --- SymbolIndex.java 12 Nov 2005 19:15:59 -0000 1.9 *************** *** 22,45 **** import org.eclipse.core.resources.IFile; ! import org.eclipse.core.runtime.IPath; import org.jruby.lexer.yacc.ISourcePosition; public class SymbolIndex { private Map index = Collections.synchronizedMap(new HashMap()); private static boolean verbose; public void add(Symbol symbol, Location location) { ! Set locations = (Set) index.get(symbol); ! if (locations == null) { ! locations = new HashSet(); ! index.put(symbol, locations); } - locations.add(location); } public void add(Symbol symbol, IFile file, ISourcePosition position) { ! SymbolIndex.log("Adding Symbol: " + symbol) ; ! add(symbol, new Location(file.getFullPath(), position)); } --- 22,49 ---- import org.eclipse.core.resources.IFile; ! import org.eclipse.core.resources.IProject; import org.jruby.lexer.yacc.ISourcePosition; public class SymbolIndex { + private Map index = Collections.synchronizedMap(new HashMap()); private static boolean verbose; public void add(Symbol symbol, Location location) { ! if (verbose) ! log("Adding " + symbol + " at " + location); ! synchronized(index) { ! Set locations = (Set) index.get(symbol); ! if (locations == null) { ! locations = new HashSet(); ! index.put(symbol, locations); ! } ! locations.add(location); } } public void add(Symbol symbol, IFile file, ISourcePosition position) { ! add(symbol, new Location(file, position)); } *************** *** 76,82 **** } ! public void flush(IPath foo_path) { ! SymbolIndex.log("Flushing all Symbols with path: " + foo_path) ; synchronized (index) { for (Iterator indexIter = index.entrySet().iterator(); indexIter.hasNext();) { --- 80,114 ---- } ! public void flush(IFile fileToFlush) { ! if (verbose) ! log("Flushing all Symbols with path: " + fileToFlush) ; + flush(new PathEqualsPredicate(fileToFlush)); + } + + public static void setVerbose(boolean verbose) { + SymbolIndex.verbose = verbose; + } + + private static boolean isVerbose() { + return verbose; + } + + private static void log(String message) { + if (!SymbolIndex.isVerbose()) { + return ; + } + System.out.println(message) ; + } + + public void flush(IProject project) { + if (verbose) + log("Flushing all Symbols for project: " + project) ; + + flush(new ContainedByProject(project)); + + } + + private void flush(Predicate predicate) { synchronized (index) { for (Iterator indexIter = index.entrySet().iterator(); indexIter.hasNext();) { *************** *** 86,91 **** for (Iterator locationIter = locations.iterator(); locationIter.hasNext();) { Location location = (Location) locationIter.next(); ! if (location.getSourcePath() == foo_path) { ! locationIter.remove(); } } --- 118,126 ---- for (Iterator locationIter = locations.iterator(); locationIter.hasNext();) { Location location = (Location) locationIter.next(); ! if (predicate.evaluate(location.getSourceFile())) { ! locationIter.remove(); ! ! if (verbose) ! log("Removing " + location); } } *************** *** 97,115 **** } ! public static void setVerbose(boolean verbose) { ! SymbolIndex.verbose = verbose; ! } ! ! public static boolean isVerbose() { ! return verbose; } ! ! public static void log(String message) { ! if (!SymbolIndex.isVerbose()) { ! return ; ! } ! System.out.println(message) ; } } --- 132,164 ---- } ! ! private static class PathEqualsPredicate implements Predicate { ! private final IFile fileToFlush; ! ! public PathEqualsPredicate(IFile file) { ! this.fileToFlush = file; ! } ! ! public boolean evaluate(Object object) { ! return object.equals(fileToFlush); ! } } ! ! interface Predicate { ! boolean evaluate(Object object); } + private static class ContainedByProject implements Predicate { + + private final IProject project; + + public ContainedByProject(IProject project) { + this.project = project; + } + public boolean evaluate(Object object) { + IFile file = (IFile) object; + return file.getProject().equals(project); + } + } } |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:07
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25492/src/org/rubypeople/rdt/core Modified Files: RubyCore.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: RubyCore.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** RubyCore.java 23 Oct 2005 19:37:57 -0000 1.23 --- RubyCore.java 12 Nov 2005 19:15:59 -0000 1.24 *************** *** 13,17 **** import java.io.File; import java.util.ArrayList; - import java.util.Arrays; import java.util.List; --- 13,16 ---- |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:07
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25492/src/org/rubypeople/rdt/internal/core/util Modified Files: ListUtil.java Added Files: SetUtil.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. --- NEW FILE: SetUtil.java --- package org.rubypeople.rdt.internal.core.util; import java.util.HashSet; import java.util.Set; public class SetUtil { public static Set create(Object obj1, Object obj2) { HashSet Set = create(obj1); Set.add(obj2); return Set; } public static HashSet create(Object obj1) { HashSet Set = new HashSet(); Set.add(obj1); return Set; } public static Set create(Object obj1, Object obj2, Object obj3) { Set Set = create(obj1, obj2); Set.add(obj3); return Set; } } Index: ListUtil.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ListUtil.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ListUtil.java 16 Oct 2005 17:29:22 -0000 1.1 --- ListUtil.java 12 Nov 2005 19:15:59 -0000 1.2 *************** *** 28,30 **** --- 28,40 ---- } + public static List create(Object obj1, Object obj2, Object obj3) { + List list = create(obj1, obj2); + list.add(obj3); + return list; + } + + public static List create() { + return new ArrayList(); + } + } |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:07
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25492 Modified Files: .options Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: .options =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/.options,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** .options 7 Sep 2005 21:21:08 -0000 1.3 --- .options 12 Nov 2005 19:15:59 -0000 1.4 *************** *** 5,7 **** org.rubypeople.rdt.core/codeformatter=false org.rubypeople.rdt.core/rubyparser=false ! org.rubypeople.rdt.core/modelmanager=false \ No newline at end of file --- 5,9 ---- org.rubypeople.rdt.core/codeformatter=false org.rubypeople.rdt.core/rubyparser=false ! org.rubypeople.rdt.core/modelmanager=false ! org.rubypeople.rdt.core/symbolIndex=false ! org.rubypeople.rdt.core/rubyBuilder=false \ No newline at end of file |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:03
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25435/src/org/rubypeople/rdt/internal/core/builder Modified Files: ShamSymbolIndex.java TC_MassIndexUpdater.java TS_InternalCoreBuilder.java ShamMarkerManager.java TC_IndexUpdater.java Added Files: TC_CleanRdtCompiler.java AbstractRdtTestCase.java TC_IncrementalRdtCompiler.java TC_RubyCodeAnalyzer.java ShamSingleCompiler.java Removed Files: TC_RdtCompiler.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: ShamMarkerManager.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShamMarkerManager.java 1 Oct 2005 23:00:54 -0000 1.1 --- ShamMarkerManager.java 12 Nov 2005 19:15:53 -0000 1.2 *************** *** 4,7 **** --- 4,8 ---- package org.rubypeople.rdt.internal.core.builder; + import java.util.ArrayList; import java.util.List; *************** *** 13,16 **** --- 14,18 ---- import org.jruby.lexer.yacc.SyntaxException; import org.rubypeople.eclipse.shams.resources.ShamFile; + import org.rubypeople.rdt.internal.core.util.ListUtil; public class ShamMarkerManager implements IMarkerManager { *************** *** 23,30 **** --- 25,43 ---- private int endOffsetArg; private SyntaxException syntaxExceptionArg; + private List resourcesRemoved = new ArrayList(); public void removeProblemsAndTasksFor(IResource resource) { + resourcesRemoved.add(resource); + } + + public void assertMarkersRemovedFor(IResource expectedResource) { + assertMarkersRemovedFor(ListUtil.create(expectedResource)); } + + public void assertMarkersRemovedFor(List expectedFiles) { + Assert.assertEquals(expectedFiles, resourcesRemoved); + + } public void createSyntaxError(IFile file, SyntaxException syntaxException) { fileArg = file; *************** *** 73,75 **** --- 86,89 ---- } + } \ No newline at end of file --- TC_RdtCompiler.java DELETED --- --- NEW FILE: ShamSingleCompiler.java --- /** * */ package org.rubypeople.rdt.internal.core.builder; import java.util.HashSet; import java.util.Set; import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; class ShamSingleCompiler implements SingleFileCompiler { private Set compiledFiles = new HashSet(); public void compileFile(IFile file) throws CoreException { compiledFiles.add(file); } public void assertCompiled(Set expectedFiles) { TC_CleanRdtCompiler.assertEquals(expectedFiles, compiledFiles); } } Index: TS_InternalCoreBuilder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TS_InternalCoreBuilder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TS_InternalCoreBuilder.java 16 Oct 2005 23:52:44 -0000 1.1 --- TS_InternalCoreBuilder.java 12 Nov 2005 19:15:53 -0000 1.2 *************** *** 20,26 **** suite.addTestSuite(TC_TaskCompiler.class); ! suite.addTestSuite(TC_RdtCompiler.class); suite.addTestSuite(TC_MassIndexUpdater.class); suite.addTestSuite(TC_IndexUpdater.class); return suite; --- 20,28 ---- suite.addTestSuite(TC_TaskCompiler.class); ! suite.addTestSuite(TC_RubyCodeAnalyzer.class); suite.addTestSuite(TC_MassIndexUpdater.class); suite.addTestSuite(TC_IndexUpdater.class); + suite.addTestSuite(TC_CleanRdtCompiler.class); + suite.addTestSuite(TC_IncrementalRdtCompiler.class); return suite; --- NEW FILE: TC_RubyCodeAnalyzer.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.List; import junit.framework.TestCase; import org.eclipse.core.resources.IFile; import org.jruby.ast.Node; import org.jruby.ast.visitor.NodeVisitor; import org.jruby.lexer.yacc.SyntaxException; import org.rubypeople.eclipse.shams.resources.ShamFile; public class TC_RubyCodeAnalyzer extends TestCase { private static final String FILE_CONTENTS = "file Contents"; private static final String FILENAME = "testFile.rb"; private ShamFile file; private ShamMarkerManager markerManager; private ShamRubyParser parser; private RubyCodeAnalyzer compiler; private MockIndexUpdater indexUpdater; private Node rootNode; public void setUp() { file = new ShamFile(FILENAME); file.setContents(FILE_CONTENTS); rootNode = new Node(null) { public void accept(NodeVisitor visitor) { } public List childNodes() { return new ArrayList(); } }; markerManager = new ShamMarkerManager(); parser = new ShamRubyParser(); parser.addParseResult(file, rootNode); indexUpdater = new MockIndexUpdater(); compiler = new RubyCodeAnalyzer(markerManager, parser, indexUpdater); } public void testParserInvocation() throws Exception { compiler.compileFile(file); parser.assertParsed(file, FILE_CONTENTS); file.assertContentStreamClosed(); indexUpdater.assertUpdated(file, rootNode); } public void testSyntaxException() throws Exception { SyntaxException syntaxException = new SyntaxException(null, ""); parser.setExceptionToThrow(syntaxException); compiler.compileFile(file); file.assertContentStreamClosed(); markerManager.assertErrorCreated(file, syntaxException); } private static final class MockIndexUpdater extends IndexUpdater { public MockIndexUpdater() { super(null); } private Node rootNodeArg; private IFile fileArg; public void update(IFile file, Node rootNode) { fileArg = file; rootNodeArg = rootNode; } public void assertUpdated(IFile expectedFile, Node expectedRootNode) { assertEquals("File", expectedFile, fileArg); assertEquals("Node", expectedRootNode, rootNodeArg); } } } Index: TC_MassIndexUpdater.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_MassIndexUpdater.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TC_MassIndexUpdater.java 16 Oct 2005 23:52:44 -0000 1.2 --- TC_MassIndexUpdater.java 12 Nov 2005 19:15:53 -0000 1.3 *************** *** 23,27 **** import org.rubypeople.eclipse.shams.resources.ShamProject; import org.rubypeople.rdt.internal.core.parser.ShamNode; - import org.rubypeople.rdt.internal.core.util.ListUtil; public class TC_MassIndexUpdater extends TestCase { --- 23,26 ---- *************** *** 46,51 **** parser.addParseResult(file3, rootNode3); ! project1.setResourcesToVisit(ListUtil.create(file1, file2)); ! project2.setResourcesToVisit(ListUtil.create(file3)); List projects = new ArrayList(); --- 45,51 ---- parser.addParseResult(file3, rootNode3); ! project1.addResource(file1); ! project1.addResource(file2); ! project2.addResource(file3); List projects = new ArrayList(); *************** *** 56,61 **** RubySourceFileCollectingVisitor expectedVisitor = new RubySourceFileCollectingVisitor(new ArrayList()); - project1.assertAcceptCalled(expectedVisitor, 0); - project2.assertAcceptCalled(expectedVisitor, 0); parser.assertParsed(file1); --- 56,59 ---- --- NEW FILE: TC_IncrementalRdtCompiler.java --- package org.rubypeople.rdt.internal.core.builder; import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.List; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResourceDelta; import org.rubypeople.rdt.internal.core.ShamResourceDelta; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; import org.rubypeople.rdt.internal.core.util.ListUtil; public class TC_IncrementalRdtCompiler extends AbstractRdtTestCase { private ShamResourceDelta delta = new ShamResourceDelta(); public void testDeletedResource() throws Exception { delta.addChildren(createDelta(t1, IResourceDelta.REMOVED)); compiler.compile(monitor); List expectedFiles = ListUtil.create(t1); monitor.assertTaskBegun("Building test...", 2); monitor.assertDone(2); List subTasks = ListUtil.create(EXPECTED_TASK_NAME); monitor.assertSubTasks(subTasks); assertMarkersRemoved(ListUtil.create(t1)); assertIndexFlushed(ListUtil.create(t1)); singleCompiler1.assertCompiled(new HashSet()); singleCompiler2.assertCompiled(new HashSet()); } protected void assertMarkersRemoved(List expectedFiles) { markerManager.assertMarkersRemovedFor(expectedFiles); } protected void assertIndexFlushed(List expectedFiles) { symbolIndex.assertFlushed(expectedFiles); } protected void setFiles(List filesForTest) throws Exception { setFiles(delta, filesForTest); } private void setFiles(ShamResourceDelta delta, List filesForTest) throws Exception { for (Iterator iter = filesForTest.iterator(); iter.hasNext();) { IResource resource = (IResource) iter.next(); if (resource instanceof IFolder) { IFolder container = (IFolder) resource; ShamResourceDelta folderDelta = createDelta(container, IResourceDelta.CHANGED); delta.addChildren(folderDelta); setFiles(delta, Arrays.asList(container.members())); return; } IFile file = (IFile) resource; ShamResourceDelta childDelta = createDelta(file, IResourceDelta.ADDED); delta.addChildren(childDelta); } } private ShamResourceDelta createDelta(IResource file, int kind) { ShamResourceDelta childDelta = new ShamResourceDelta(); childDelta.setResource(file); childDelta.setKind(kind); childDelta.setFlags(IResourceDelta.CONTENT); return childDelta; } AbstractRdtCompiler createCompiler(SymbolIndex shamSymbolIndex, IMarkerManager markerManager, List singleCompilers) { delta.setResource(project); return new IncrementalRdtCompiler(project, delta, symbolIndex, markerManager, singleCompilers); } } --- NEW FILE: TC_CleanRdtCompiler.java --- package org.rubypeople.rdt.internal.core.builder; import java.util.List; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; public class TC_CleanRdtCompiler extends AbstractRdtTestCase { AbstractRdtCompiler createCompiler(SymbolIndex symbolIndex, IMarkerManager markerManager, List singleCompilers) { return new CleanRdtCompiler(project, symbolIndex, markerManager, singleCompilers); } protected void assertIndexFlushed(List expectedFiles) { symbolIndex.assertFlushed(project); } protected void assertMarkersRemoved(List expectedFiles) { markerManager.assertMarkersRemovedFor(project); } } Index: ShamSymbolIndex.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamSymbolIndex.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ShamSymbolIndex.java 23 Oct 2005 22:24:19 -0000 1.2 --- ShamSymbolIndex.java 12 Nov 2005 19:15:53 -0000 1.3 *************** *** 12,20 **** package org.rubypeople.rdt.internal.core.builder; import org.eclipse.core.resources.IFile; ! import org.eclipse.core.runtime.IPath; import org.jruby.lexer.yacc.ISourcePosition; import org.rubypeople.rdt.internal.core.symbols.Symbol; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; public class ShamSymbolIndex extends SymbolIndex { --- 12,27 ---- package org.rubypeople.rdt.internal.core.builder; + import java.util.ArrayList; + import java.util.List; + + import junit.framework.Assert; + import org.eclipse.core.resources.IFile; ! import org.eclipse.core.resources.IProject; import org.jruby.lexer.yacc.ISourcePosition; + import org.rubypeople.eclipse.shams.resources.ShamProject; import org.rubypeople.rdt.internal.core.symbols.Symbol; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; + import org.rubypeople.rdt.internal.core.util.ListUtil; public class ShamSymbolIndex extends SymbolIndex { *************** *** 23,43 **** private Symbol symbolArg; private ISourcePosition positionArg; ! private IPath flushedPathArg; ! public void flush(IPath path) { ! flushedPathArg = path; } ! public void assertFlushed(IPath expectedPath) { ! TC_IndexUpdater.assertEquals("Flushed path", expectedPath, flushedPathArg); } public void assertAddNotCalled() { ! TC_IndexUpdater.assertNull("Unexpected call to assertAddNotCalled()", fileArg); } public void assertAdded(Symbol expectedSymbol, IFile expectedFile, ISourcePosition expectedPosition) { ! TC_IndexUpdater.assertEquals("Symbol", expectedSymbol, symbolArg); ! TC_IndexUpdater.assertEquals("File", expectedFile, fileArg); ! TC_IndexUpdater.assertEquals("Position", expectedPosition, positionArg); } --- 30,52 ---- private Symbol symbolArg; private ISourcePosition positionArg; ! private List flushedFiles = new ArrayList(); ! private IProject flushedProjectArg; ! public void flush(IFile file) { ! flushedFiles.add(file); } ! ! public void assertFlushed(IFile expectedFile) { ! Assert.assertEquals("Flushed file", ListUtil.create(expectedFile), flushedFiles); } public void assertAddNotCalled() { ! Assert.assertNull("Unexpected call to assertAddNotCalled()", fileArg); } public void assertAdded(Symbol expectedSymbol, IFile expectedFile, ISourcePosition expectedPosition) { ! Assert.assertEquals("Symbol", expectedSymbol, symbolArg); ! Assert.assertEquals("File", expectedFile, fileArg); ! Assert.assertEquals("Position", expectedPosition, positionArg); } *************** *** 47,50 **** --- 56,72 ---- positionArg = position; } + + public void assertFlushed(ShamProject expectedProject) { + Assert.assertEquals("Flushed project", flushedProjectArg, expectedProject); + + } + + public void flush(IProject project) { + flushedProjectArg = project; + } + + public void assertFlushed(List expectedFiles) { + Assert.assertEquals(expectedFiles, flushedFiles); + } } \ No newline at end of file --- NEW FILE: AbstractRdtTestCase.java --- package org.rubypeople.rdt.internal.core.builder; import java.util.HashSet; import java.util.Iterator; import java.util.List; import junit.framework.TestCase; import org.eclipse.core.resources.IFile; import org.rubypeople.eclipse.shams.resources.ShamFile; import org.rubypeople.eclipse.shams.resources.ShamFolder; import org.rubypeople.eclipse.shams.resources.ShamProject; import org.rubypeople.eclipse.shams.runtime.ShamMonitor; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; import org.rubypeople.rdt.internal.core.util.ListUtil; public abstract class AbstractRdtTestCase extends TestCase { static protected final String EXPECTED_TASK_NAME = "Removing Markers..."; protected abstract void assertMarkersRemoved(List expectedFiles); protected abstract void assertIndexFlushed(List expectedFiles); abstract AbstractRdtCompiler createCompiler(SymbolIndex index, IMarkerManager markerManager, List singleCompilers); protected ShamMonitor monitor; protected ShamFile t1; protected ShamFile t2; protected ShamFile t3; protected ShamFolder f1; protected ShamProject project; protected ShamMarkerManager markerManager; protected ShamSymbolIndex symbolIndex; protected ShamSingleCompiler singleCompiler1; protected ShamSingleCompiler singleCompiler2; protected AbstractRdtCompiler compiler; private ShamFile nonRubyFile; public void setUp() { t1 = new ShamFile("/test/T1.rb"); t2 = new ShamFile("/test/T2.rb"); t3 = new ShamFile("/test/F1/T3.rb"); nonRubyFile = new ShamFile("/test/T3.txt"); f1 = new ShamFolder("/test/F1"); project = new ShamProject("test"); markerManager = new ShamMarkerManager(); symbolIndex = new ShamSymbolIndex(); singleCompiler1 = new ShamSingleCompiler(); singleCompiler2 = new ShamSingleCompiler(); List singleCompilers = ListUtil.create(singleCompiler1, singleCompiler2); compiler = createCompiler(symbolIndex, markerManager, singleCompilers); monitor = new ShamMonitor(); } public void testBasicCompile() throws Exception { project.addResource(t1); setFiles(ListUtil.create(t1)); compiler.compile(monitor); assertCompliationFor(ListUtil.create(t1), 4); } public void testNotARubyFile() throws Exception { project.addResource(nonRubyFile); setFiles(ListUtil.create(nonRubyFile)); compiler.compile(monitor); assertCompliationFor(ListUtil.create(), 2); } public void testCompileIncludesFolders() throws Exception { project.addResource(f1); f1.addResource(t3); setFiles(ListUtil.create(f1)); compiler.compile(monitor); assertCompliationFor(ListUtil.create(t3), 4); } public void testCompileMultipleFiles() throws Exception { project.addResource(t1); project.addResource(t2); setFiles(ListUtil.create(t1, t2)); compiler.compile(monitor); assertCompliationFor(ListUtil.create(t1, t2), 6); } public void testCancellation() throws Exception { monitor.cancelAfter(4); project.addResource(t1); project.addResource(t2); setFiles(ListUtil.create(t1, t2)); compiler.compile(monitor); List expectedFiles = ListUtil.create(t1); monitor.assertTaskBegun("Building test...", 6); monitor.assertDone(4); List subTasks = ListUtil.create(EXPECTED_TASK_NAME, t1.getFullPath().toString()); monitor.assertSubTasks(subTasks); assertMarkersRemoved(ListUtil.create(t1,t2)); assertIndexFlushed(ListUtil.create(t1,t2)); singleCompiler1.assertCompiled(new HashSet(expectedFiles)); singleCompiler2.assertCompiled(new HashSet(expectedFiles)); } public void testCompileSkipsNonRubyFiles() throws Exception { ShamFile x1 = new ShamFile("/test/x1"); project.addResource(t1); project.addResource(x1); setFiles(ListUtil.create(t1)); compiler.compile(monitor); assertCompliationFor(ListUtil.create(t1), 4); } protected void setFiles(List filesForTest) throws Exception { } protected void assertCompliationFor(List expectedFiles, int totalWork) { monitor.assertTaskBegun("Building test...", totalWork); monitor.assertDone(totalWork); List subTasks = ListUtil.create(EXPECTED_TASK_NAME); for (Iterator iter = expectedFiles.iterator(); iter.hasNext();) { IFile file = (IFile) iter.next(); subTasks.add(file.getFullPath().toString()); } monitor.assertSubTasks(subTasks); assertMarkersRemoved(expectedFiles); assertIndexFlushed(expectedFiles); singleCompiler1.assertCompiled(new HashSet(expectedFiles)); singleCompiler2.assertCompiled(new HashSet(expectedFiles)); } } Index: TC_IndexUpdater.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_IndexUpdater.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TC_IndexUpdater.java 23 Oct 2005 22:24:19 -0000 1.5 --- TC_IndexUpdater.java 12 Nov 2005 19:15:53 -0000 1.6 *************** *** 45,49 **** updater.update(file, node); ! symbolIndex.assertFlushed(file.getFullPath()); symbolIndex.assertAddNotCalled(); } --- 45,49 ---- updater.update(file, node); ! symbolIndex.assertFlushed(file); symbolIndex.assertAddNotCalled(); } *************** *** 54,58 **** updater.update(file, node); ! symbolIndex.assertFlushed(file.getFullPath()); symbolIndex.assertAdded(new ClassSymbol(TEST_CLASS_NAME), file, POSITION_1); } --- 54,58 ---- updater.update(file, node); ! symbolIndex.assertFlushed(file); symbolIndex.assertAdded(new ClassSymbol(TEST_CLASS_NAME), file, POSITION_1); } *************** *** 63,67 **** updater.update(file,node); ! symbolIndex.assertFlushed(file.getFullPath()); symbolIndex.assertAdded(new ClassSymbol("Foo"), file, new RdtPosition(1, 2, 14, 15)); } --- 63,67 ---- updater.update(file,node); ! symbolIndex.assertFlushed(file); symbolIndex.assertAdded(new ClassSymbol("Foo"), file, new RdtPosition(1, 2, 14, 15)); } *************** *** 72,76 **** updater.update(file,node); ! symbolIndex.assertFlushed(file.getFullPath()); symbolIndex.assertAdded(new ClassSymbol("Foo::Bar"), file, new RdtPosition(1, 2, 16, 20)); } --- 72,76 ---- updater.update(file,node); ! symbolIndex.assertFlushed(file); symbolIndex.assertAdded(new ClassSymbol("Foo::Bar"), file, new RdtPosition(1, 2, 16, 20)); } *************** *** 81,85 **** updater.update(file,node); ! symbolIndex.assertFlushed(file.getFullPath()); symbolIndex.assertAdded(new ClassSymbol("X::Foo::Bar"), file, new RdtPosition(1, 2, 19, 23)); } --- 81,85 ---- updater.update(file,node); ! symbolIndex.assertFlushed(file); symbolIndex.assertAdded(new ClassSymbol("X::Foo::Bar"), file, new RdtPosition(1, 2, 19, 23)); } *************** *** 90,94 **** updater.update(file,node); ! symbolIndex.assertFlushed(file.getFullPath()); symbolIndex.assertAdded(new ClassSymbol("Foo::Bar"), file, new RdtPosition(2, 3, 25, 26)); } --- 90,94 ---- updater.update(file,node); ! symbolIndex.assertFlushed(file); symbolIndex.assertAdded(new ClassSymbol("Foo::Bar"), file, new RdtPosition(2, 3, 25, 26)); } *************** *** 99,103 **** updater.update(file,node); ! symbolIndex.assertFlushed(file.getFullPath()); symbolIndex.assertAdded(new ClassSymbol("Foo::Bar::InnerBar"), file, new RdtPosition(2, 3, 35, 36)); } --- 99,103 ---- updater.update(file,node); ! symbolIndex.assertFlushed(file); symbolIndex.assertAdded(new ClassSymbol("Foo::Bar::InnerBar"), file, new RdtPosition(2, 3, 35, 36)); } |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:01
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/symbols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25435/src/org/rubypeople/rdt/internal/core/symbols Modified Files: TC_SymbolIndex.java TC_Location.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: TC_Location.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/symbols/TC_Location.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TC_Location.java 13 Oct 2005 23:56:02 -0000 1.3 --- TC_Location.java 12 Nov 2005 19:15:53 -0000 1.4 *************** *** 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.symbols; --- 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.symbols; *************** *** 14,25 **** import junit.framework.TestCase; ! import org.eclipse.core.runtime.Path; import org.rubypeople.rdt.internal.core.parser.RdtPosition; public class TC_Location extends TestCase { public void testForSource() { ! Location location = new Location(new Path("foo"), new RdtPosition(1, 2, 3)); ! assertEquals(true, location.forSource(new Path("foo"))); ! assertEquals(false, location.forSource(new Path("Foo"))); } } --- 14,26 ---- import junit.framework.TestCase; ! import org.rubypeople.eclipse.shams.resources.ShamFile; import org.rubypeople.rdt.internal.core.parser.RdtPosition; public class TC_Location extends TestCase { public void testForSource() { ! ShamFile fooFile = new ShamFile("foo"); ! Location location = new Location(fooFile, new RdtPosition(1, 2, 3)); ! assertEquals(true, location.forSource(fooFile)); ! assertEquals(false, location.forSource(new ShamFile("Foo"))); } } Index: TC_SymbolIndex.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/symbols/TC_SymbolIndex.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TC_SymbolIndex.java 23 Oct 2005 22:24:19 -0000 1.5 --- TC_SymbolIndex.java 12 Nov 2005 19:15:53 -0000 1.6 *************** *** 18,25 **** import junit.framework.TestCase; ! import org.eclipse.core.resources.IFile; ! import org.eclipse.core.runtime.Path; import org.jruby.lexer.yacc.ISourcePosition; import org.rubypeople.eclipse.shams.resources.ShamFile; import org.rubypeople.rdt.internal.core.parser.RdtPosition; --- 18,25 ---- import junit.framework.TestCase; ! import org.eclipse.core.resources.IProject; import org.jruby.lexer.yacc.ISourcePosition; import org.rubypeople.eclipse.shams.resources.ShamFile; + import org.rubypeople.eclipse.shams.resources.ShamProject; import org.rubypeople.rdt.internal.core.parser.RdtPosition; *************** *** 28,41 **** private static final ClassSymbol FOO_CLASS_SYMBOL = new ClassSymbol("Foo"); private static final ClassSymbol OTHER_FOO_CLASS_SYMBOL = new ClassSymbol("Foo2"); ! private static final Path FOO_PATH = new Path("/foo.rb"); ! private static final Path OTHER_FOO_PATH = new Path("/utils/foo.rb"); private static final ISourcePosition FOO_POSITION = new RdtPosition(10, 3, 7); private static final ISourcePosition OTHER_FOO_POSITION = new RdtPosition(12, 13, 17); ! private static final Location FOO_CLASS_LOCATION = new Location(FOO_PATH, FOO_POSITION); ! private static final Location OTHER_FOO_CLASS_LOCATION = new Location(OTHER_FOO_PATH, OTHER_FOO_POSITION); ! private static final IFile OTHER_FOO_FILE = new ShamFile(OTHER_FOO_PATH); private static final Set EMPTY_SET = Collections.EMPTY_SET; private SymbolIndex index; --- 28,48 ---- private static final ClassSymbol FOO_CLASS_SYMBOL = new ClassSymbol("Foo"); private static final ClassSymbol OTHER_FOO_CLASS_SYMBOL = new ClassSymbol("Foo2"); ! private static final IProject PROJECT1 = new ShamProject("project1"); ! private static final ShamFile FOO_FILE = new ShamFile("/project1/foo.rb"); ! private static final ShamFile FOO_FILE2 = new ShamFile("/project1/foo.rb"); ! private static final ShamFile OTHER_FOO_FILE = new ShamFile("/project1/utils/foo.rb"); ! private static final ShamFile PROJECT2_FILE = new ShamFile("/project2/bar.rb"); private static final ISourcePosition FOO_POSITION = new RdtPosition(10, 3, 7); private static final ISourcePosition OTHER_FOO_POSITION = new RdtPosition(12, 13, 17); ! private static final Location FOO_CLASS_LOCATION = new Location(FOO_FILE, FOO_POSITION); ! private static final Location OTHER_FOO_CLASS_LOCATION = new Location(OTHER_FOO_FILE, OTHER_FOO_POSITION); ! private static final Location PROJECT2_CLASS_LOCATION = new Location(PROJECT2_FILE, OTHER_FOO_POSITION); private static final Set EMPTY_SET = Collections.EMPTY_SET; + static { + FOO_FILE.setProject(PROJECT1); + } + private SymbolIndex index; *************** *** 55,61 **** public void testFlush() { index.add(FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION); ! index.flush(FOO_PATH); assertEquals(createSet(OTHER_FOO_CLASS_LOCATION), index.find(FOO_CLASS_SYMBOL)); ! index.flush(OTHER_FOO_PATH); assertEquals(EMPTY_SET, index.find(FOO_CLASS_SYMBOL)); } --- 62,76 ---- public void testFlush() { index.add(FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION); ! index.flush(FOO_FILE); assertEquals(createSet(OTHER_FOO_CLASS_LOCATION), index.find(FOO_CLASS_SYMBOL)); ! index.flush(OTHER_FOO_FILE); ! assertEquals(EMPTY_SET, index.find(FOO_CLASS_SYMBOL)); ! } ! ! public void testFlushUsesEquals() { ! index.add(FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION); ! index.flush(FOO_FILE2); ! assertEquals(createSet(OTHER_FOO_CLASS_LOCATION), index.find(FOO_CLASS_SYMBOL)); ! index.flush(OTHER_FOO_FILE); assertEquals(EMPTY_SET, index.find(FOO_CLASS_SYMBOL)); } *************** *** 100,103 **** --- 115,127 ---- } + public void testFlushByProject() { + index.add(FOO_CLASS_SYMBOL, FOO_CLASS_LOCATION); + ClassSymbol barClassSymbol = new ClassSymbol("Bar"); + index.add(barClassSymbol, PROJECT2_CLASS_LOCATION); + index.flush(PROJECT1); + assertEquals(EMPTY_SET, index.find(FOO_CLASS_SYMBOL)); + assertEquals(createSet(PROJECT2_CLASS_LOCATION), index.find(barClassSymbol)); + } + private Set createSet(Object obj1) { Set set = new HashSet(); |
|
From: David C. <dc...@us...> - 2005-11-12 19:16:01
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25435/src/org/rubypeople/rdt/internal/core Modified Files: TC_SymbolIndexResourceEventListener.java ShamResourceDelta.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: TC_SymbolIndexResourceEventListener.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/TC_SymbolIndexResourceEventListener.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TC_SymbolIndexResourceEventListener.java 23 Oct 2005 00:03:11 -0000 1.3 --- TC_SymbolIndexResourceEventListener.java 12 Nov 2005 19:15:53 -0000 1.4 *************** *** 110,114 **** private ShamResourceDelta createDelta(IResource resource) { ShamResourceDelta delta = new ShamResourceDelta(); ! delta.addResource(resource); delta.setKind(IResourceDelta.CHANGED); delta.setFlags(IResourceDelta.OPEN | IResourceDelta.MARKERS); --- 110,114 ---- private ShamResourceDelta createDelta(IResource resource) { ShamResourceDelta delta = new ShamResourceDelta(); ! delta.setResource(resource); delta.setKind(IResourceDelta.CHANGED); delta.setFlags(IResourceDelta.OPEN | IResourceDelta.MARKERS); Index: ShamResourceDelta.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/ShamResourceDelta.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShamResourceDelta.java 19 Oct 2005 00:33:05 -0000 1.1 --- ShamResourceDelta.java 12 Nov 2005 19:15:53 -0000 1.2 *************** *** 13,16 **** --- 13,17 ---- import java.util.ArrayList; + import java.util.Iterator; import java.util.List; *************** *** 22,26 **** import org.eclipse.core.runtime.IPath; ! class ShamResourceDelta implements IResourceDelta { private List children = new ArrayList(); --- 23,27 ---- import org.eclipse.core.runtime.IPath; ! public class ShamResourceDelta implements IResourceDelta { private List children = new ArrayList(); *************** *** 30,33 **** --- 31,40 ---- public void accept(IResourceDeltaVisitor visitor) throws CoreException { + if (visitor.visit(this)) { + for (Iterator iter = children.iterator(); iter.hasNext();) { + IResourceDelta delta = (IResourceDelta) iter.next(); + delta.accept(visitor); + } + } } *************** *** 59,63 **** public IPath getFullPath() { ! return null; } --- 66,70 ---- public IPath getFullPath() { ! return resource.getFullPath(); } *************** *** 90,94 **** } ! public void addResource(IResource resource) { this.resource = resource; } --- 97,101 ---- } ! public void setResource(IResource resource) { this.resource = resource; } |
|
From: Markus B. <mba...@us...> - 2005-10-26 21:56:06
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9905/src/org/rubypeople/rdt/internal/ui/search Modified Files: RubySearchResultPage.java RubySearchTreeContentProvider.java RubySearchLabelProvider.java Added Files: GroupByScopeStrategy.java GroupByAction.java Scope.java GroupByPathStrategy.java IGroupByStrategy.java Log Message: Search result page allows grouping by file and package (scope) Index: RubySearchLabelProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchLabelProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubySearchLabelProvider.java 23 Oct 2005 19:31:28 -0000 1.1 --- RubySearchLabelProvider.java 26 Oct 2005 21:55:50 -0000 1.2 *************** *** 25,28 **** --- 25,32 ---- return searchResult.getSymbol().toString() ; } + if (element instanceof Scope) { + Scope scope = (Scope) element ; + return scope.getName() ; + } return super.getText(element); } --- NEW FILE: GroupByScopeStrategy.java --- package org.rubypeople.rdt.internal.ui.search; import org.rubypeople.rdt.internal.core.symbols.SearchResult; public class GroupByScopeStrategy implements IGroupByStrategy { private Scope createScope(String qualifiedName) { int index = qualifiedName.lastIndexOf("::") ; if (index == -1) { return null ; } String packageName = qualifiedName.substring(0, index) ; return new Scope(packageName); } public Object getParent(Object element) { if (element instanceof SearchResult) { SearchResult result = (SearchResult) element ; return this.createScope(result.getSymbol().getName()) ; } if (element instanceof Scope) { Scope scope = (Scope) element ; return this.createScope(scope.getQualifiedName()) ; } return null ; } } --- NEW FILE: GroupByAction.java --- package org.rubypeople.rdt.internal.ui.search; import org.eclipse.jface.action.Action; import org.rubypeople.rdt.internal.ui.RubyPluginImages; public class GroupByAction extends Action { public GroupByAction(String label, String image) { super(label) ; this.setToolTipText(label) ; RubyPluginImages.setLocalImageDescriptors(this, image) ; } } Index: RubySearchTreeContentProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchTreeContentProvider.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubySearchTreeContentProvider.java 24 Oct 2005 22:56:56 -0000 1.2 --- RubySearchTreeContentProvider.java 26 Oct 2005 21:55:50 -0000 1.3 *************** *** 11,16 **** * This file is based on org.eclipse.search.internal.ui.text.FileTreeContentProvider * Copyright (c) 2000, 2005 IBM Corporation and others. ! */ ! package org.rubypeople.rdt.internal.ui.search; --- 11,16 ---- * This file is based on org.eclipse.search.internal.ui.text.FileTreeContentProvider * Copyright (c) 2000, 2005 IBM Corporation and others. ! */ ! package org.rubypeople.rdt.internal.ui.search; *************** *** 25,51 **** import org.eclipse.search.internal.ui.text.IFileSearchContentProvider; import org.eclipse.search.ui.text.AbstractTextSearchResult; - import org.rubypeople.rdt.internal.core.symbols.SearchResult; - public class RubySearchTreeContentProvider implements ITreeContentProvider, IFileSearchContentProvider { ! private final Object[] EMPTY_ARR= new Object[0]; private AbstractTextSearchResult fResult; private AbstractTreeViewer fTreeViewer; private Map fChildrenMap; ! public RubySearchTreeContentProvider(AbstractTreeViewer viewer) { ! fTreeViewer= viewer; } ! public Object[] getElements(Object inputElement) { return getChildren(inputElement); } ! public void dispose() { ! // nothing to do } ! public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (newInput instanceof RubySearchResult) { --- 25,61 ---- import org.eclipse.search.internal.ui.text.IFileSearchContentProvider; import org.eclipse.search.ui.text.AbstractTextSearchResult; public class RubySearchTreeContentProvider implements ITreeContentProvider, IFileSearchContentProvider { ! private final Object[] EMPTY_ARR = new Object[0]; private AbstractTextSearchResult fResult; private AbstractTreeViewer fTreeViewer; private Map fChildrenMap; ! private IGroupByStrategy groupByStrategy; ! public RubySearchTreeContentProvider(AbstractTreeViewer viewer) { ! fTreeViewer = viewer; ! this.setGroupByPath(); } ! ! public void setGroupByScope() { ! groupByStrategy = new GroupByScopeStrategy(); ! clear() ; ! } ! ! public void setGroupByPath() { ! groupByStrategy = new GroupByPathStrategy(); ! clear() ; ! } ! public Object[] getElements(Object inputElement) { return getChildren(inputElement); } ! public void dispose() { ! // nothing to do } ! public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { if (newInput instanceof RubySearchResult) { *************** *** 53,64 **** } } - public synchronized void initialize(AbstractTextSearchResult result) { ! fResult= result; ! fChildrenMap= new HashMap(); if (result != null) { ! Object[] elements= result.getElements(); ! for (int i= 0; i < elements.length; i++) { insert(elements[i], false); } --- 63,73 ---- } } public synchronized void initialize(AbstractTextSearchResult result) { ! fResult = result; ! fChildrenMap = new HashMap(); if (result != null) { ! Object[] elements = result.getElements(); ! for (int i = 0; i < elements.length; i++) { insert(elements[i], false); } *************** *** 67,86 **** protected void insert(Object child, boolean refreshViewer) { ! Object parent= getParent(child); while (parent != null) { if (insertChild(parent, child)) { ! if (refreshViewer) ! fTreeViewer.add(parent, child); } else { ! if (refreshViewer) ! fTreeViewer.refresh(parent); return; } ! child= parent; ! parent= getParent(child); } if (insertChild(fResult, child)) { ! if (refreshViewer) ! fTreeViewer.add(fResult, child); } } --- 76,92 ---- protected void insert(Object child, boolean refreshViewer) { ! Object parent = getParent(child); while (parent != null) { if (insertChild(parent, child)) { ! if (refreshViewer) fTreeViewer.add(parent, child); } else { ! if (refreshViewer) fTreeViewer.refresh(parent); return; } ! child = parent; ! parent = getParent(child); } if (insertChild(fResult, child)) { ! if (refreshViewer) fTreeViewer.add(fResult, child); } } *************** *** 94,100 **** */ private boolean insertChild(Object parent, Object child) { ! Set children= (Set) fChildrenMap.get(parent); if (children == null) { ! children= new HashSet(); fChildrenMap.put(parent, children); } --- 100,106 ---- */ private boolean insertChild(Object parent, Object child) { ! Set children = (Set) fChildrenMap.get(parent); if (children == null) { ! children = new HashSet(); fChildrenMap.put(parent, children); } *************** *** 103,115 **** protected void remove(Object element, boolean refreshViewer) { ! // precondition here: fResult.getMatchCount(child) <= 0 ! if (hasChildren(element)) { ! if (refreshViewer) ! fTreeViewer.refresh(element); } else { if (fResult.getMatchCount(element) == 0) { fChildrenMap.remove(element); ! Object parent= getParent(element); if (parent != null) { removeFromSiblings(element, parent); --- 109,120 ---- protected void remove(Object element, boolean refreshViewer) { ! // precondition here: fResult.getMatchCount(child) <= 0 ! if (hasChildren(element)) { ! if (refreshViewer) fTreeViewer.refresh(element); } else { if (fResult.getMatchCount(element) == 0) { fChildrenMap.remove(element); ! Object parent = getParent(element); if (parent != null) { removeFromSiblings(element, parent); *************** *** 117,122 **** } else { removeFromSiblings(element, fResult); ! if (refreshViewer) ! fTreeViewer.refresh(); } } else { --- 122,126 ---- } else { removeFromSiblings(element, fResult); ! if (refreshViewer) fTreeViewer.refresh(); } } else { *************** *** 129,133 **** private void removeFromSiblings(Object element, Object parent) { ! Set siblings= (Set) fChildrenMap.get(parent); if (siblings != null) { siblings.remove(element); --- 133,137 ---- private void removeFromSiblings(Object element, Object parent) { ! Set siblings = (Set) fChildrenMap.get(parent); if (siblings != null) { siblings.remove(element); *************** *** 136,142 **** public Object[] getChildren(Object parentElement) { ! Set children= (Set) fChildrenMap.get(parentElement); ! if (children == null) ! return EMPTY_ARR; return children.toArray(); } --- 140,145 ---- public Object[] getChildren(Object parentElement) { ! Set children = (Set) fChildrenMap.get(parentElement); ! if (children == null) return EMPTY_ARR; return children.toArray(); } *************** *** 147,151 **** public synchronized void elementsChanged(Object[] updatedElements) { ! for (int i= 0; i < updatedElements.length; i++) { if (fResult.getMatchCount(updatedElements[i]) > 0) insert(updatedElements[i], true); --- 150,154 ---- public synchronized void elementsChanged(Object[] updatedElements) { ! for (int i = 0; i < updatedElements.length; i++) { if (fResult.getMatchCount(updatedElements[i]) > 0) insert(updatedElements[i], true); *************** *** 162,174 **** /* * Group search results by the containing file. ! * */ public Object getParent(Object element) { ! if (element instanceof SearchResult) { ! SearchResult result = (SearchResult) element; ! return result.getLocation().getSourcePath(); ! } ! return null; } } - --- 165,172 ---- /* * Group search results by the containing file. ! * */ public Object getParent(Object element) { ! return groupByStrategy.getParent(element) ; } } --- NEW FILE: IGroupByStrategy.java --- package org.rubypeople.rdt.internal.ui.search; public interface IGroupByStrategy { public Object getParent(Object element) ; } --- NEW FILE: Scope.java --- package org.rubypeople.rdt.internal.ui.search; public class Scope { private String name ; private String qualifiedName ; public Scope(String qualifiedName) { this.qualifiedName = qualifiedName ; } public String getName() { if (name == null) { int index = qualifiedName.lastIndexOf("::") ; if (index == -1) { name = qualifiedName ; } else { name = qualifiedName.substring(index + 2) ; } } return name; } public boolean equals(Object other) { if (!(other instanceof Scope)) { return false ; } return this.qualifiedName.equals(((Scope) other).qualifiedName) ; } public String getQualifiedName() { return qualifiedName; } public String toString() { return qualifiedName; } public int hashCode() { return qualifiedName.hashCode(); } } Index: RubySearchResultPage.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchResultPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubySearchResultPage.java 23 Oct 2005 19:31:28 -0000 1.1 --- RubySearchResultPage.java 26 Oct 2005 21:55:50 -0000 1.2 *************** *** 15,18 **** --- 15,20 ---- import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; + import org.eclipse.jface.action.Action; + import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.viewers.DecoratingLabelProvider; import org.eclipse.jface.viewers.TableViewer; *************** *** 33,36 **** --- 35,40 ---- RubySearchTreeContentProvider fContentProvider; + GroupByAction fGroupByPackage; + GroupByAction fGroupByFile; public RubySearchResultPage() { *************** *** 45,49 **** protected void clear() { ! // TODO Auto-generated method stub } --- 49,53 ---- protected void clear() { ! // TODO Auto-generated method stub } *************** *** 59,63 **** protected void configureTableViewer(TableViewer viewer) { ! // TODO: When is a table viewer needed ? } --- 63,67 ---- protected void configureTableViewer(TableViewer viewer) { ! // TODO: When is a table viewer needed ? } *************** *** 94,96 **** --- 98,128 ---- } + protected void fillToolbar(IToolBarManager tbm) { + super.fillToolbar(tbm); + fGroupByFile = new GroupByAction("groupByFile", "file_mode.gif") { + + public void run() { + fContentProvider.setGroupByPath(); + getViewer().refresh(); + fGroupByPackage.setChecked(false); + fGroupByFile.setChecked(true); + } + }; + fGroupByFile.setChecked(true); + + fGroupByPackage = new GroupByAction("groupByPackage", "package_mode.gif") { + + public void run() { + fContentProvider.setGroupByScope(); + getViewer().refresh(); + fGroupByPackage.setChecked(true); + fGroupByFile.setChecked(false); + } + }; + fGroupByPackage.setChecked(false); + + tbm.add(fGroupByFile); + tbm.add(fGroupByPackage); + + } } --- NEW FILE: GroupByPathStrategy.java --- package org.rubypeople.rdt.internal.ui.search; import org.rubypeople.rdt.internal.core.symbols.SearchResult; public class GroupByPathStrategy implements IGroupByStrategy { public Object getParent(Object element) { if (!(element instanceof SearchResult)) { return null; } SearchResult result = (SearchResult) element; return result.getLocation().getSourcePath(); } } |
|
From: Markus B. <mba...@us...> - 2005-10-26 21:56:06
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9905/src/org/rubypeople/rdt/internal/ui Modified Files: RubyPluginImages.java Log Message: Search result page allows grouping by file and package (scope) Index: RubyPluginImages.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyPluginImages.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** RubyPluginImages.java 1 Oct 2005 23:10:44 -0000 1.11 --- RubyPluginImages.java 26 Oct 2005 21:55:50 -0000 1.12 *************** *** 124,132 **** } catch (MalformedURLException e) {} ! try { ! ImageDescriptor id = ImageDescriptor.createFromURL(makeIconFileURL("c" + type, relPath)); ! if (id != null) ! action.setHoverImageDescriptor(id); ! } catch (MalformedURLException e) {} action.setImageDescriptor(create("e" + type, relPath)); --- 124,130 ---- } catch (MalformedURLException e) {} ! // we don't use hover images. If we set it nonetheless it would be preferred to the "normal" image descriptor ! // see ActionContributionItem.updateImages ! // ImageDescriptor.createFromURL(makeIconFileURL("c" + type, relPath)); action.setImageDescriptor(create("e" + type, relPath)); |
|
From: Markus B. <mba...@us...> - 2005-10-26 21:56:06
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/icons/full/dlcl16 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9905/icons/full/dlcl16 Added Files: file_mode.gif package_mode.gif Log Message: Search result page allows grouping by file and package (scope) --- NEW FILE: file_mode.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: package_mode.gif --- (This appears to be a binary file; contents omitted.) |
|
From: Markus B. <mba...@us...> - 2005-10-26 21:56:06
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/icons/full/elcl16 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9905/icons/full/elcl16 Added Files: file_mode.gif package_mode.gif Log Message: Search result page allows grouping by file and package (scope) --- NEW FILE: file_mode.gif --- (This appears to be a binary file; contents omitted.) --- NEW FILE: package_mode.gif --- (This appears to be a binary file; contents omitted.) |
|
From: Markus B. <mba...@us...> - 2005-10-26 21:55:18
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9769 Modified Files: Changelog.txt Log Message: Search result page allows grouping by file and package (scope) Index: Changelog.txt =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt/Changelog.txt,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Changelog.txt 17 Oct 2005 04:24:29 -0000 1.17 --- Changelog.txt 26 Oct 2005 21:55:08 -0000 1.18 *************** *** 10,13 **** --- 10,14 ---- * Added outline support for aliasing methods using the format 'alias :new_method :old_method' * Fixed bug where current visibility was never reset when opening a new class + * Ruby Search Changes merged from SRB 0.6.1: |
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9741/src/org/rubypeople/rdt/internal/ui/search Modified Files: TS_InternalUiRubySearch.java TC_RubySearchTreeContentProvider.java Added Files: TC_GroupByScopeStrategy.java TC_Scope.java Log Message: Search result page allows grouping by file and package (scope) --- NEW FILE: TC_Scope.java --- package org.rubypeople.rdt.internal.ui.search; import junit.framework.Assert; import junit.framework.TestCase; public class TC_Scope extends TestCase { public void testNameSimple() { Assert.assertEquals("b", new Scope("b").getName()) ; } public void testNameQualified() { Assert.assertEquals("b", new Scope("a::b").getName()) ; } } Index: TC_RubySearchTreeContentProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search/TC_RubySearchTreeContentProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TC_RubySearchTreeContentProvider.java 24 Oct 2005 22:55:12 -0000 1.1 --- TC_RubySearchTreeContentProvider.java 26 Oct 2005 21:55:03 -0000 1.2 *************** *** 51,54 **** --- 51,75 ---- } + + public void testGroupByScope() { + // could be a MockSearchResult instead + RubySearchResult rubyUISearchResult = new RubySearchResult(null); + rubySearchTreeContentProvider.setGroupByScope() ; + // call initialize before the search starts + rubySearchTreeContentProvider.initialize(rubyUISearchResult) ; + // initialize does not refresh the viewer, therefore elementsChanges is called here + MethodSymbol methodSymbol = new MethodSymbol("myModule::myScope::myMethod") ; + Path path = new Path("test") ; + Location location = new Location(path,new RdtPosition(0,0,0,0)) ; + SearchResult searchResult = new SearchResult(methodSymbol, location) ; + rubyUISearchResult.addMatch(new Match(searchResult, Match.UNIT_CHARACTER, 0, 0)); + + rubySearchTreeContentProvider.elementsChanged(new Object[]{searchResult}) ; + Assert.assertTrue(mockTreeViewer.isParentAdded(new Scope("myModule::myScope"))) ; + Assert.assertTrue(mockTreeViewer.isParentAdded(new Scope("myModule"))) ; + Assert.assertEquals(new Scope("myModule::myScope"),mockTreeViewer.childFrom(new Scope("myModule"))) ; + Assert.assertEquals(searchResult,mockTreeViewer.childFrom(new Scope("myModule::myScope"))) ; + + } } --- NEW FILE: TC_GroupByScopeStrategy.java --- package org.rubypeople.rdt.internal.ui.search; import org.eclipse.core.runtime.Path; import org.rubypeople.rdt.internal.core.parser.RdtPosition; import org.rubypeople.rdt.internal.core.symbols.Location; import org.rubypeople.rdt.internal.core.symbols.MethodSymbol; import org.rubypeople.rdt.internal.core.symbols.SearchResult; import junit.framework.Assert; import junit.framework.TestCase; public class TC_GroupByScopeStrategy extends TestCase { private GroupByScopeStrategy groupByScopeStrategy ; public void setUp() { groupByScopeStrategy = new GroupByScopeStrategy() ; } public void testNoQualifiedName() { Assert.assertEquals(null, groupByScopeStrategy.getParent(new Scope("name"))) ; } public void testQualifiedName1() { Assert.assertEquals(new Scope("pckg"), groupByScopeStrategy.getParent(new Scope("pckg::name"))) ; } public void testQualifiedName2() { Assert.assertEquals(new Scope("pckg::class"), groupByScopeStrategy.getParent(new Scope("pckg::class::name"))) ; } public void testSearchResult() { MethodSymbol methodSymbol = new MethodSymbol("clazz::myMethod") ; SearchResult searchResult = new SearchResult(methodSymbol, new Location(new Path("test"), new RdtPosition(0,0,0,0))) ; Assert.assertEquals(new Scope("clazz"), groupByScopeStrategy.getParent(searchResult)) ; } public void testOtherClass() { Assert.assertEquals(null, groupByScopeStrategy.getParent(this)) ; } } Index: TS_InternalUiRubySearch.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search/TS_InternalUiRubySearch.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TS_InternalUiRubySearch.java 24 Oct 2005 22:55:12 -0000 1.1 --- TS_InternalUiRubySearch.java 26 Oct 2005 21:55:03 -0000 1.2 *************** *** 19,22 **** --- 19,24 ---- TestSuite suite = new TestSuite("org.rubypeople.rdt.internal.ui.search"); suite.addTestSuite(TC_RubySearchTreeContentProvider.class); + suite.addTestSuite(TC_Scope.class) ; + suite.addTestSuite(TC_GroupByScopeStrategy.class) ; return suite; } |
|
From: Markus B. <mba...@us...> - 2005-10-26 21:54:56
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/icons/full/dlcl16 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9694/icons/full/dlcl16 Log Message: Directory /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/icons/full/dlcl16 added to the repository |
|
From: Markus B. <mba...@us...> - 2005-10-24 23:00:01
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.debug.ui.tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7844 Modified Files: plugin.xml Log Message: removed typo Index: plugin.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.debug.ui.tests/plugin.xml,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** plugin.xml 16 Oct 2005 23:52:59 -0000 1.14 --- plugin.xml 24 Oct 2005 22:59:50 -0000 1.15 *************** *** 11,15 **** <library name="rdtdebuguitests.jar"> <export name="*"/> ! </library>sts </runtime> --- 11,15 ---- <library name="rdtdebuguitests.jar"> <export name="*"/> ! </library> </runtime> |
|
From: Markus B. <mba...@us...> - 2005-10-24 22:57:54
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7433/src/org/rubypeople/rdt/internal/ui/search Modified Files: RubySearchPage.java RubySearchQuery.java Log Message: updated search for Method Index: RubySearchQuery.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchQuery.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubySearchQuery.java 24 Oct 2005 11:08:11 -0000 1.2 --- RubySearchQuery.java 24 Oct 2005 22:57:42 -0000 1.3 *************** *** 27,30 **** --- 27,31 ---- import org.rubypeople.rdt.internal.core.symbols.ISymbolTypes; import org.rubypeople.rdt.internal.core.symbols.SearchResult; + import org.rubypeople.rdt.internal.ui.RubyUIMessages; public class RubySearchQuery implements ISearchQuery, ISymbolTypes { *************** *** 33,40 **** private SearchScope fScope; private RubySearchResult fResult; ! public RubySearchQuery(SearchScope scope, String searchString) { fScope = scope; fSearchString = searchString; } --- 34,43 ---- private SearchScope fScope; private RubySearchResult fResult; + private int fSymbolType ; ! public RubySearchQuery(SearchScope scope, String searchString, int symbolType) { fScope = scope; fSearchString = searchString; + fSymbolType = symbolType ; } *************** *** 49,54 **** public String getLabel() { ! // TODO Auto-generated method stub ! return "RubySearchJob"; } --- 52,56 ---- public String getLabel() { ! return toString() ; } *************** *** 63,67 **** public IStatus run(IProgressMonitor monitor) throws OperationCanceledException { ! Set entries = RubyCore.getPlugin().getSymbolIndex().find(fSearchString, CLASS_SYMBOL ); for (Iterator iter = entries.iterator(); iter.hasNext();) { --- 65,69 ---- public IStatus run(IProgressMonitor monitor) throws OperationCanceledException { ! Set entries = RubyCore.getPlugin().getSymbolIndex().find(fSearchString, fSymbolType ); for (Iterator iter = entries.iterator(); iter.hasNext();) { *************** *** 71,80 **** fResult.addMatch(new Match(searchResult, Match.UNIT_CHARACTER, startOffset, length)); } ! MultiStatus status = new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, "Alright", null); return status; } public String toString() { ! return "reg exp. query for " + fSearchString; } --- 73,94 ---- fResult.addMatch(new Match(searchResult, Match.UNIT_CHARACTER, startOffset, length)); } ! MultiStatus status = new MultiStatus(NewSearchUI.PLUGIN_ID, IStatus.OK, "Alright", null); //$NON-NLS-1$ return status; } public String toString() { ! String args[] = new String[2] ; ! switch (fSymbolType) { ! case METHOD_SYMBOL: ! args[0] = RubyUIMessages.getString("RubySearch.SearchForMethodSymbol") ; //$NON-NLS-1$ ! break; ! case CLASS_SYMBOL: ! args[0] = RubyUIMessages.getString("RubySearch.SearchForClassSymbol") ; //$NON-NLS-1$ ! break; ! default: ! break; ! } ! args[1] = fSearchString ; ! return RubyUIMessages.getFormattedString("RubySearch.ResultLabel", args) ; //$NON-NLS-1$ } Index: RubySearchPage.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchPage.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubySearchPage.java 23 Oct 2005 20:13:31 -0000 1.2 --- RubySearchPage.java 24 Oct 2005 22:57:42 -0000 1.3 *************** *** 42,53 **** import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.ui.IWorkingSet; import org.eclipse.ui.IWorkingSetManager; import org.eclipse.ui.PlatformUI; import org.rubypeople.rdt.core.IRubyElement; ! public class RubySearchPage extends DialogPage implements ISearchPage { // Shouldn't SearchPatternData be a public class in org.eclipse.search ? --- 42,57 ---- import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; + import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; + import org.eclipse.swt.widgets.Listener; import org.eclipse.ui.IWorkingSet; import org.eclipse.ui.IWorkingSetManager; import org.eclipse.ui.PlatformUI; import org.rubypeople.rdt.core.IRubyElement; + import org.rubypeople.rdt.internal.core.symbols.ISymbolTypes; + import org.rubypeople.rdt.internal.ui.RubyUIMessages; ! public class RubySearchPage extends DialogPage implements ISearchPage, ISymbolTypes { // Shouldn't SearchPatternData be a public class in org.eclipse.search ? *************** *** 58,70 **** private String pattern; private boolean isCaseSensitive; ! private IRubyElement rubyElement; private int scope; private IWorkingSet[] workingSets; ! public SearchPatternData(int searchFor, int limitTo, boolean isCaseSensitive, String pattern, IRubyElement element) { ! this(searchFor, limitTo, pattern, isCaseSensitive, element, ISearchPageContainer.WORKSPACE_SCOPE, null); } ! public SearchPatternData(int searchFor, int limitTo, String pattern, boolean isCaseSensitive, IRubyElement element, int scope, IWorkingSet[] workingSets) { this.searchFor = searchFor; this.limitTo = limitTo; --- 62,74 ---- private String pattern; private boolean isCaseSensitive; ! private int scope; private IWorkingSet[] workingSets; ! public SearchPatternData(int searchFor, int limitTo, boolean isCaseSensitive, String pattern) { ! this(searchFor, limitTo, pattern, isCaseSensitive, ISearchPageContainer.WORKSPACE_SCOPE, null); } ! public SearchPatternData(int searchFor, int limitTo, String pattern, boolean isCaseSensitive, int scope, IWorkingSet[] workingSets) { this.searchFor = searchFor; this.limitTo = limitTo; *************** *** 74,82 **** this.workingSets = workingSets; - setRubyElement(element); - } - - public void setRubyElement(IRubyElement element) { - this.rubyElement = element; } --- 78,81 ---- *************** *** 85,92 **** } - public IRubyElement getRubyElement() { - return rubyElement; - } - public int getLimitTo() { return limitTo; --- 84,87 ---- *************** *** 158,162 **** // TODO IRubyElement elem = null; // settings.get("rubyElement") ; ! return new SearchPatternData(searchFor, limitTo, pattern, isCaseSensitive, elem, scope, workingSets); } catch (NumberFormatException e) { return null; --- 153,157 ---- // TODO IRubyElement elem = null; // settings.get("rubyElement") ; ! return new SearchPatternData(searchFor, limitTo, pattern, isCaseSensitive, scope, workingSets); } catch (NumberFormatException e) { return null; *************** *** 177,181 **** private SearchPatternData fInitialData; - private IRubyElement fRubyElement; private boolean fFirstTime = true; private IDialogSettings fDialogSettings; --- 172,175 ---- *************** *** 186,201 **** private Button fCaseSensitive; - private Button[] fSearchFor; - // TODO: externalize strings - private String[] fSearchForText = { "class", "method" - /* - * SearchMessages.SearchPage_searchFor_type, - * SearchMessages.SearchPage_searchFor_method, - * SearchMessages.SearchPage_searchFor_module, - * SearchMessages.SearchPage_searchFor_field - */}; - private Button[] fLimitTo; ! private String[] fLimitToText = { "declarations" /* * SearchMessages.SearchPage_limitTo_declarations, --- 180,185 ---- private Button fCaseSensitive; private Button[] fLimitTo; ! private String[] fLimitToText = { "declarations" //$NON-NLS-1$ /* * SearchMessages.SearchPage_limitTo_declarations, *************** *** 208,211 **** --- 192,196 ---- private static final int INDEX_REFERENCES = 2; private static final int INDEX_ALL = 3; + private SearchForManager searchForManager = new SearchForManager(); /** *************** *** 246,256 **** NewSearchUI.activateSearchResultView(); ! return new RubySearchQuery(scope, patternData.getPattern()); } private int getLimitTo() { ! //for (int i = 0; i < fLimitTo.length; i++) { ! // if (fLimitTo[i].getSelection()) return i; ! //} return -1; } --- 231,241 ---- NewSearchUI.activateSearchResultView(); ! return new RubySearchQuery(scope, patternData.getPattern(), patternData.getSearchFor()); } private int getLimitTo() { ! // for (int i = 0; i < fLimitTo.length; i++) { ! // if (fLimitTo[i].getSelection()) return i; ! // } return -1; } *************** *** 285,296 **** } - private int getSearchFor() { - for (int i = 0; i < fSearchFor.length; i++) { - if (fSearchFor[i].getSelection()) return i; - } - Assert.isTrue(false, "shouldNeverHappen"); //$NON-NLS-1$ - return -1; - } - private String getPattern() { return fPattern.getText(); --- 270,273 ---- *************** *** 315,319 **** fPreviousSearchPatterns.remove(match); } ! match = new SearchPatternData(getSearchFor(), getLimitTo(), pattern, fCaseSensitive.getSelection(), fRubyElement, getContainer().getSelectedScope(), getContainer().getSelectedWorkingSets()); fPreviousSearchPatterns.add(0, match); // insert on top --- 292,296 ---- fPreviousSearchPatterns.remove(match); } ! match = new SearchPatternData(searchForManager.getSelectedSymbolType(), getLimitTo(), pattern, fCaseSensitive.getSelection(), getContainer().getSelectedScope(), getContainer().getSelectedWorkingSets()); fPreviousSearchPatterns.add(0, match); // insert on top *************** *** 366,370 **** separator.setLayoutData(data); ! Control searchFor = createSearchFor(result); searchFor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); --- 343,347 ---- separator.setLayoutData(data); ! Control searchFor = searchForManager.createSearchFor(result); searchFor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); *************** *** 374,395 **** // createParticipants(result); - SelectionAdapter javaElementInitializer = new SelectionAdapter() { - - public void widgetSelected(SelectionEvent event) { - if (getSearchFor() == fInitialData.getSearchFor()) - fRubyElement = fInitialData.getRubyElement(); - else - fRubyElement = null; - setLimitTo(getSearchFor(), getLimitTo()); - doPatternModified(); - } - }; - - // fSearchFor[TYPE].addSelectionListener(javaElementInitializer); - // fSearchFor[METHOD].addSelectionListener(javaElementInitializer); - // fSearchFor[FIELD].addSelectionListener(javaElementInitializer); - // fSearchFor[CONSTRUCTOR].addSelectionListener(javaElementInitializer); - // fSearchFor[PACKAGE].addSelectionListener(javaElementInitializer); - setControl(result); --- 351,354 ---- *************** *** 429,433 **** Label label = new Label(result, SWT.LEFT); // TODO ! label.setText("Expression"); // label.setText(SearchMessages.SearchPage_expression_label); label.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1)); --- 388,392 ---- Label label = new Label(result, SWT.LEFT); // TODO ! label.setText("Expression"); //$NON-NLS-1$ // label.setText(SearchMessages.SearchPage_expression_label); label.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1)); *************** *** 457,461 **** fCaseSensitive = new Button(result, SWT.CHECK); // TODO ! fCaseSensitive.setText("CaseSensitive"); fCaseSensitive.addSelectionListener(new SelectionAdapter() { --- 416,420 ---- fCaseSensitive = new Button(result, SWT.CHECK); // TODO ! fCaseSensitive.setText("CaseSensitive"); //$NON-NLS-1$ fCaseSensitive.addSelectionListener(new SelectionAdapter() { *************** *** 471,475 **** private boolean isValidSearchPattern() { if (getPattern().length() == 0) { return false; } - if (fRubyElement != null) { return true; } // TODO return true; --- 430,433 ---- *************** *** 500,533 **** } - private void setSearchFor(int searchFor) { - for (int i = 0; i < fSearchFor.length; i++) { - fSearchFor[i].setSelection(searchFor == i); - } - } - - private Control createSearchFor(Composite parent) { - Group result = new Group(parent, SWT.NONE); - // TODO - result.setText("searchfor"); - result.setLayout(new GridLayout(2, true)); - - fSearchFor = new Button[fSearchForText.length]; - for (int i = 0; i < fSearchForText.length; i++) { - Button button = new Button(result, SWT.RADIO); - button.setText(fSearchForText[i]); - - button.setSelection(i == 0); - button.setLayoutData(new GridData()); - fSearchFor[i] = button; - } - - // Fill with dummy radio buttons - Label filler = new Label(result, SWT.NONE); - filler.setVisible(false); - filler.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1)); - - return result; - } - private Control createLimitTo(Composite parent) { Group result = new Group(parent, SWT.NONE); --- 458,461 ---- *************** *** 564,566 **** --- 492,531 ---- } + class SearchForManager { + + private Button[] fSearchFor; + + private Button createButton(Group parent, String text, int symbolType) { + + Button button = new Button(parent, SWT.RADIO); + button.setText(text); + button.setData(new Integer(symbolType)); + button.setLayoutData(new GridData()); + return button; + } + + private Control createSearchFor(Composite parent) { + Group result = new Group(parent, SWT.NONE); + result.setText(RubyUIMessages.getString("RubySearchPage.SearchForGroupLabel")); //$NON-NLS-1$ + result.setLayout(new GridLayout(2, true)); + + fSearchFor = new Button[2]; + fSearchFor[0] = createButton(result, RubyUIMessages.getString("RubySearch.SearchForClassSymbol"), CLASS_SYMBOL); //$NON-NLS-1$ + fSearchFor[0].setSelection(true); + fSearchFor[1] = createButton(result, RubyUIMessages.getString("RubySearch.SearchForMethodSymbol"), METHOD_SYMBOL); //$NON-NLS-1$ + + return result; + } + + + public int getSelectedSymbolType() { + for (int i = 0; i < fSearchFor.length; i++) { + if (fSearchFor[i].getSelection()) { return ((Integer) fSearchFor[i].getData()).intValue(); } + } + Assert.isTrue(false, "Error in RubySearchPage: There should always be a selected symbol type to search for"); //$NON-NLS-1$ + return CLASS_SYMBOL; + } + + + } } |
|
From: Markus B. <mba...@us...> - 2005-10-24 22:57:54
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7433/src/org/rubypeople/rdt/internal/ui Modified Files: RubyUIMessages.properties Log Message: updated search for Method Index: RubyUIMessages.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RubyUIMessages.properties 4 Oct 2005 22:42:40 -0000 1.8 --- RubyUIMessages.properties 24 Oct 2005 22:57:42 -0000 1.9 *************** *** 96,99 **** --- 96,108 ---- ######################################### + # Ruby Search Page + ######################################### + RubySearch.SearchForClassSymbol=Class + RubySearch.SearchForMethodSymbol=Method + RubySearchPage.SearchForGroupLabel=Search for + RubySearch.ResultLabel=Search for {0} with pattern {1} + + + ######################################### # Wizards ######################################### *************** *** 127,129 **** RDocExecutionErrorAdditionalMessageWithStderr=The process was started with: {0}. The last line of stderr of the ruby process: {1}. RDocExecutionErrorAdditionalMessage=The process was started with: {0}. The process did not write any messages to stderr. ! ErrorRunningRdocTitle=Error running RDoc \ No newline at end of file --- 136,139 ---- RDocExecutionErrorAdditionalMessageWithStderr=The process was started with: {0}. The last line of stderr of the ruby process: {1}. RDocExecutionErrorAdditionalMessage=The process was started with: {0}. The process did not write any messages to stderr. ! ErrorRunningRdocTitle=Error running RDoc ! |
|
From: Markus B. <mba...@us...> - 2005-10-24 22:57:04
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7316/src/org/rubypeople/rdt/internal/ui/search Modified Files: RubySearchTreeContentProvider.java Log Message: constructor and initialize made public due to test Index: RubySearchTreeContentProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchTreeContentProvider.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubySearchTreeContentProvider.java 23 Oct 2005 19:31:28 -0000 1.1 --- RubySearchTreeContentProvider.java 24 Oct 2005 22:56:56 -0000 1.2 *************** *** 36,40 **** private Map fChildrenMap; ! RubySearchTreeContentProvider(AbstractTreeViewer viewer) { fTreeViewer= viewer; } --- 36,40 ---- private Map fChildrenMap; ! public RubySearchTreeContentProvider(AbstractTreeViewer viewer) { fTreeViewer= viewer; } *************** *** 55,59 **** ! protected synchronized void initialize(AbstractTextSearchResult result) { fResult= result; fChildrenMap= new HashMap(); --- 55,59 ---- ! public synchronized void initialize(AbstractTextSearchResult result) { fResult= result; fChildrenMap= new HashMap(); |
|
From: Markus B. <mba...@us...> - 2005-10-24 22:55:20
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7092/src/org/rubypeople/rdt/internal/ui/search Added Files: TS_InternalUiRubySearch.java MockTreeViewer.java TC_RubySearchTreeContentProvider.java Log Message: Added test for RubySearchTreeContentProvider --- NEW FILE: TC_RubySearchTreeContentProvider.java --- /* Copyright (c) 2005 RubyPeople. * * Author: Markus * * 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.ui.search; import org.eclipse.core.runtime.Path; import org.eclipse.search.ui.text.Match; import org.rubypeople.rdt.internal.core.parser.RdtPosition; import org.rubypeople.rdt.internal.core.symbols.Location; import org.rubypeople.rdt.internal.core.symbols.MethodSymbol; import org.rubypeople.rdt.internal.core.symbols.SearchResult; import junit.framework.Assert; import junit.framework.TestCase; public class TC_RubySearchTreeContentProvider extends TestCase { MockTreeViewer mockTreeViewer ; RubySearchTreeContentProvider rubySearchTreeContentProvider ; protected void setUp() throws Exception { mockTreeViewer = new MockTreeViewer() ; rubySearchTreeContentProvider = new RubySearchTreeContentProvider(mockTreeViewer) ; } public void testGroupByPath() { // could be a MockSearchResult instead RubySearchResult rubyUISearchResult = new RubySearchResult(null); // call initialize before the search starts rubySearchTreeContentProvider.initialize(rubyUISearchResult) ; // initialize does not refresh the viewer, therefore elementsChanges is called here MethodSymbol methodSymbol = new MethodSymbol("myMethod") ; Path path = new Path("test") ; Location location = new Location(path,new RdtPosition(0,0,0,0)) ; SearchResult searchResult = new SearchResult(methodSymbol, location) ; rubyUISearchResult.addMatch(new Match(searchResult, Match.UNIT_CHARACTER, 0, 0)); rubySearchTreeContentProvider.elementsChanged(new Object[]{searchResult}) ; Assert.assertTrue(mockTreeViewer.isParentAdded(path)) ; } } --- NEW FILE: MockTreeViewer.java --- /* Copyright (c) 2005 RubyPeople. * * Author: Markus * * 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.ui.search; import java.util.Hashtable; import java.util.List; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.swt.events.TreeListener; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Item; import org.eclipse.swt.widgets.Widget; public class MockTreeViewer extends AbstractTreeViewer { private Hashtable hashtable = new Hashtable() ; public void add(Object parentElement, Object childElement) { hashtable.put(parentElement, childElement) ; } public boolean isParentAdded(Object parentElement) { return hashtable.containsKey(parentElement) ; } public Object childFrom(Object parentElement) { return hashtable.get(parentElement) ; } protected void addTreeListener(Control control, TreeListener listener) { // TODO Auto-generated method stub } protected void doUpdateItem(Item item, Object element) { // TODO Auto-generated method stub } protected Item[] getChildren(Widget widget) { // TODO Auto-generated method stub return null; } protected boolean getExpanded(Item item) { // TODO Auto-generated method stub return false; } protected int getItemCount(Control control) { // TODO Auto-generated method stub return 0; } protected int getItemCount(Item item) { // TODO Auto-generated method stub return 0; } protected Item[] getItems(Item item) { // TODO Auto-generated method stub return null; } protected Item getParentItem(Item item) { // TODO Auto-generated method stub return null; } protected Item[] getSelection(Control control) { // TODO Auto-generated method stub return null; } protected Item newItem(Widget parent, int style, int index) { // TODO Auto-generated method stub return null; } protected void removeAll(Control control) { // TODO Auto-generated method stub } protected void setExpanded(Item item, boolean expand) { // TODO Auto-generated method stub } protected void setSelection(List items) { // TODO Auto-generated method stub } protected void showItem(Item item) { // TODO Auto-generated method stub } public Control getControl() { // TODO Auto-generated method stub return null; } } --- NEW FILE: TS_InternalUiRubySearch.java --- /* Copyright (c) 2005 RubyPeople. * * Author: Markus * * 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.ui.search; import junit.framework.TestSuite; public class TS_InternalUiRubySearch { public static TestSuite suite() { TestSuite suite = new TestSuite("org.rubypeople.rdt.internal.ui.search"); suite.addTestSuite(TC_RubySearchTreeContentProvider.class); return suite; } } |
|
From: Markus B. <mba...@us...> - 2005-10-24 22:55:20
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7092 Modified Files: plugin.xml Log Message: Added test for RubySearchTreeContentProvider Index: plugin.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/plugin.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** plugin.xml 12 Mar 2005 15:41:22 -0000 1.7 --- plugin.xml 24 Oct 2005 22:55:12 -0000 1.8 *************** *** 28,31 **** --- 28,32 ---- <import plugin="org.rubypeople.eclipse.testutils"/> <import plugin="org.eclipse.core.runtime"/> + <import plugin="org.eclipse.search"/> </requires> |
|
From: Markus B. <mba...@us...> - 2005-10-24 22:55:20
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/ui/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7092/src/org/rubypeople/rdt/ui/tests Modified Files: TS_Ui.java Log Message: Added test for RubySearchTreeContentProvider Index: TS_Ui.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/ui/tests/TS_Ui.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TS_Ui.java 16 Oct 2005 23:52:40 -0000 1.1 --- TS_Ui.java 24 Oct 2005 22:55:12 -0000 1.2 *************** *** 6,9 **** --- 6,10 ---- import org.rubypeople.rdt.internal.ui.TS_InternalUi; import org.rubypeople.rdt.internal.ui.rubyeditor.TS_InternalUiRubyEditor; + import org.rubypeople.rdt.internal.ui.search.TS_InternalUiRubySearch; import org.rubypeople.rdt.internal.ui.text.TS_InternalUiText; *************** *** 14,17 **** --- 15,19 ---- suite.addTest(TS_InternalUiRubyEditor.suite()); suite.addTest(TS_InternalUiText.suite()); + suite.addTest(TS_InternalUiRubySearch.suite()); return suite; } |