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
|
|
From: Markus B. <mba...@us...> - 2005-10-24 22:55:16
|
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-serv7066/src/org/rubypeople/rdt/internal/ui/search Log Message: Directory /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search added to the repository |
|
From: Markus B. <mba...@us...> - 2005-10-24 11:08:21
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16067/src/org/rubypeople/rdt/internal/ui/search Modified Files: RubySearchQuery.java Log Message: fixed compilation error Index: RubySearchQuery.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchQuery.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubySearchQuery.java 23 Oct 2005 19:31:28 -0000 1.1 --- RubySearchQuery.java 24 Oct 2005 11:08:11 -0000 1.2 *************** *** 25,31 **** import org.eclipse.search.ui.text.Match; import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.core.symbols.SearchResult; ! public class RubySearchQuery implements ISearchQuery { private String fSearchString; --- 25,32 ---- import org.eclipse.search.ui.text.Match; import org.rubypeople.rdt.core.RubyCore; + import org.rubypeople.rdt.internal.core.symbols.ISymbolTypes; import org.rubypeople.rdt.internal.core.symbols.SearchResult; ! public class RubySearchQuery implements ISearchQuery, ISymbolTypes { private String fSearchString; *************** *** 62,66 **** public IStatus run(IProgressMonitor monitor) throws OperationCanceledException { ! Set entries = RubyCore.getPlugin().getSymbolIndex().find(fSearchString); for (Iterator iter = entries.iterator(); iter.hasNext();) { --- 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();) { |
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3491/src/org/rubypeople/rdt/internal/core/symbols Modified Files: SymbolIndex.java ClassSymbol.java SearchResult.java Added Files: Symbol.java MethodSymbol.java ISymbolTypes.java Log Message: added indexing of method definitions Index: SearchResult.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/SearchResult.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SearchResult.java 23 Oct 2005 19:46:31 -0000 1.1 --- SearchResult.java 23 Oct 2005 22:24:27 -0000 1.2 *************** *** 15,22 **** public class SearchResult { private static final int ODD_PRIME_NUMBER = 37; ! private ClassSymbol symbol ; private Location location ; ! public SearchResult(ClassSymbol symbol, Location location) { this.location = location ; this.symbol = symbol ; --- 15,22 ---- public class SearchResult { private static final int ODD_PRIME_NUMBER = 37; ! private Symbol symbol ; private Location location ; ! public SearchResult(Symbol symbol, Location location) { this.location = location ; this.symbol = symbol ; *************** *** 27,31 **** } ! public ClassSymbol getSymbol() { return symbol; } --- 27,31 ---- } ! public Symbol getSymbol() { return symbol; } --- NEW FILE: Symbol.java --- package org.rubypeople.rdt.internal.core.symbols; public abstract class Symbol implements ISymbolTypes { private static int ODD_PRIME_NUMBER = 23 ; private int fType ; protected final String name; public Symbol(String name, int symbolType) { fType = symbolType ; this.name = name ; } public int getType() { return fType; } public String getName() { return this.name ; } public int hashCode() { return ODD_PRIME_NUMBER * name.hashCode() + fType ; } public boolean equals(Object obj) { if (!(obj instanceof Symbol)) return false; Symbol that = (Symbol) obj; return that.fType == this.fType && that.name.equals(this.name); } } --- NEW FILE: MethodSymbol.java --- package org.rubypeople.rdt.internal.core.symbols; public class MethodSymbol extends Symbol { public MethodSymbol(String name) { super(name, METHOD_SYMBOL); } public String toString() { return "Method [" + this.getName() + "]"; } } Index: ClassSymbol.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/ClassSymbol.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ClassSymbol.java 23 Oct 2005 19:42:58 -0000 1.4 --- ClassSymbol.java 23 Oct 2005 22:24:27 -0000 1.5 *************** *** 12,41 **** package org.rubypeople.rdt.internal.core.symbols; ! public class ClassSymbol { ! ! private final String className; public ClassSymbol(String className) { ! this.className = className; } - public boolean equals(Object obj) { - if (!(obj instanceof ClassSymbol)) - return false; - - ClassSymbol that = (ClassSymbol) obj; - return that.className.equals(this.className); - } - - public String getName() { - return this.className ; - } - - public int hashCode() { - return className.hashCode(); - } - public String toString() { ! return "Class [" + className + "]"; } } --- 12,23 ---- package org.rubypeople.rdt.internal.core.symbols; ! public class ClassSymbol extends Symbol { public ClassSymbol(String className) { ! super(className, CLASS_SYMBOL) ; } public String toString() { ! return "Class [" + this.getName() + "]"; } } Index: SymbolIndex.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/SymbolIndex.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SymbolIndex.java 23 Oct 2005 19:44:46 -0000 1.7 --- SymbolIndex.java 23 Oct 2005 22:24:27 -0000 1.8 *************** *** 30,34 **** private static boolean verbose; ! public void add(ClassSymbol symbol, Location location) { Set locations = (Set) index.get(symbol); if (locations == null) { --- 30,34 ---- private static boolean verbose; ! public void add(Symbol symbol, Location location) { Set locations = (Set) index.get(symbol); if (locations == null) { *************** *** 39,48 **** } ! public void add(ClassSymbol symbol, IFile file, ISourcePosition position) { SymbolIndex.log("Adding Symbol: " + symbol) ; add(symbol, new Location(file.getFullPath(), position)); } ! public Set find(ClassSymbol symbol) { Set locations = (Set) index.get(symbol); if (locations == null) --- 39,48 ---- } ! public void add(Symbol symbol, IFile file, ISourcePosition position) { SymbolIndex.log("Adding Symbol: " + symbol) ; add(symbol, new Location(file.getFullPath(), position)); } ! public Set find(Symbol symbol) { Set locations = (Set) index.get(symbol); if (locations == null) *************** *** 54,58 **** * returns a set of SearchResult instances as opposed to find(symbol), which returns locations */ ! public Set find(String regExp) throws PatternSyntaxException { Pattern pattern = Pattern.compile(regExp); Set searchResults = new HashSet() ; --- 54,58 ---- * returns a set of SearchResult instances as opposed to find(symbol), which returns locations */ ! public Set find(String regExp, int symbolType) throws PatternSyntaxException { Pattern pattern = Pattern.compile(regExp); Set searchResults = new HashSet() ; *************** *** 60,64 **** for (Iterator indexIter = index.entrySet().iterator(); indexIter.hasNext();) { Map.Entry entry = (Map.Entry) indexIter.next(); ! ClassSymbol symbol = (ClassSymbol) entry.getKey() ; if (pattern.matcher(symbol.getName()).find()) { Set foundLocations = (Set)entry.getValue() ; --- 60,67 ---- for (Iterator indexIter = index.entrySet().iterator(); indexIter.hasNext();) { Map.Entry entry = (Map.Entry) indexIter.next(); ! Symbol symbol = (Symbol) entry.getKey() ; ! if (symbol.getType() != symbolType) { ! continue ; ! } if (pattern.matcher(symbol.getName()).find()) { Set foundLocations = (Set)entry.getValue() ; --- NEW FILE: ISymbolTypes.java --- package org.rubypeople.rdt.internal.core.symbols; public interface ISymbolTypes { public static int CLASS_SYMBOL = 0 ; public static int METHOD_SYMBOL = 1 ; } |
|
From: Markus B. <mba...@us...> - 2005-10-23 22:24:35
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3491/src/org/rubypeople/rdt/internal/core/builder Modified Files: RdtCompiler.java MassIndexUpdater.java IndexUpdater.java Log Message: added indexing of method definitions Index: RdtCompiler.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RdtCompiler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** RdtCompiler.java 13 Oct 2005 23:56:06 -0000 1.3 --- RdtCompiler.java 23 Oct 2005 22:24:27 -0000 1.4 *************** *** 46,49 **** --- 46,52 ---- } catch (SyntaxException e) { markerManager.createSyntaxError(file, e); + } catch (Exception ex) { + // resume also on other compiler errors like ClassCastException + RubyCore.log(ex) ; } finally { IoUtils.closeQuietly(reader); Index: IndexUpdater.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IndexUpdater.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** IndexUpdater.java 23 Oct 2005 19:41:35 -0000 1.6 --- IndexUpdater.java 23 Oct 2005 22:24:27 -0000 1.7 *************** *** 18,25 **** --- 18,27 ---- import org.jruby.ast.ClassNode; import org.jruby.ast.Colon2Node; + import org.jruby.ast.DefnNode; import org.jruby.ast.IScopingNode; import org.jruby.ast.Node; import org.jruby.ast.types.INameNode; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; + import org.rubypeople.rdt.internal.core.symbols.MethodSymbol; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; *************** *** 50,57 **** scopeStack.push(classNode.getCPath().getName()); ! if (node instanceof ClassNode) index.add(new ClassSymbol(name), file, classNode.getCPath().getPosition()); } ! for (Iterator iter = node.childNodes().iterator(); iter.hasNext();) { --- 52,66 ---- scopeStack.push(classNode.getCPath().getName()); ! if (node instanceof ClassNode) { index.add(new ClassSymbol(name), file, classNode.getCPath().getPosition()); + } } ! ! if (node instanceof DefnNode) { ! DefnNode defnNode = (DefnNode) node ; ! String qualifiedName = this.getContext() + ((DefnNode) node).getName() ; ! index.add(new MethodSymbol(qualifiedName), file, defnNode.getPosition()) ; ! } ! for (Iterator iter = node.childNodes().iterator(); iter.hasNext();) { Index: MassIndexUpdater.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/MassIndexUpdater.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MassIndexUpdater.java 16 Oct 2005 23:53:03 -0000 1.2 --- MassIndexUpdater.java 23 Oct 2005 22:24:27 -0000 1.3 *************** *** 58,61 **** --- 58,64 ---- } catch (CoreException e) { RubyCore.log(e); + } catch (Exception ex) { + // e.g: the parser currently throws a ClassCastExcpetion when parsing xmldecl.rb + RubyCore.log(ex); } } |
|
From: Markus B. <mba...@us...> - 2005-10-23 22:24:27
|
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-serv3449/src/org/rubypeople/rdt/internal/core/builder Modified Files: ShamSymbolIndex.java TC_IndexUpdater.java Log Message: added indexing of method definitions 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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TC_IndexUpdater.java 23 Oct 2005 19:34:03 -0000 1.4 --- TC_IndexUpdater.java 23 Oct 2005 22:24:19 -0000 1.5 *************** *** 24,27 **** --- 24,28 ---- import org.rubypeople.rdt.internal.core.parser.RubyParser; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; + import org.rubypeople.rdt.internal.core.symbols.MethodSymbol; public class TC_IndexUpdater extends TestCase { *************** *** 101,105 **** --- 102,123 ---- symbolIndex.assertAdded(new ClassSymbol("Foo::Bar::InnerBar"), file, new RdtPosition(2, 3, 35, 36)); } + + public void testMethod() throws Exception { + Node node = parseCode("def method\nend") ; + + updater.update(file,node); + + symbolIndex.assertAdded(new MethodSymbol("method"), file, new RdtPosition(0, 1, 3, 12)); + } + public void testMethodWithNesting() throws Exception { + Node node = parseCode("class Foo\ndef method\nend\nend") ; + + updater.update(file,node); + + symbolIndex.assertAdded(new MethodSymbol("Foo::method"), file, new RdtPosition(1, 2, 13, 24)); + } + + private Node parseCode(String code) throws CoreException { file.setContents(code); 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.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShamSymbolIndex.java 19 Oct 2005 00:33:05 -0000 1.1 --- ShamSymbolIndex.java 23 Oct 2005 22:24:19 -0000 1.2 *************** *** 15,19 **** import org.eclipse.core.runtime.IPath; import org.jruby.lexer.yacc.ISourcePosition; ! import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; --- 15,19 ---- 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; *************** *** 21,25 **** private IFile fileArg; ! private ClassSymbol symbolArg; private ISourcePosition positionArg; private IPath flushedPathArg; --- 21,25 ---- private IFile fileArg; ! private Symbol symbolArg; private ISourcePosition positionArg; private IPath flushedPathArg; *************** *** 36,40 **** } ! public void assertAdded(ClassSymbol expectedSymbol, IFile expectedFile, ISourcePosition expectedPosition) { TC_IndexUpdater.assertEquals("Symbol", expectedSymbol, symbolArg); TC_IndexUpdater.assertEquals("File", expectedFile, fileArg); --- 36,40 ---- } ! public void assertAdded(Symbol expectedSymbol, IFile expectedFile, ISourcePosition expectedPosition) { TC_IndexUpdater.assertEquals("Symbol", expectedSymbol, symbolArg); TC_IndexUpdater.assertEquals("File", expectedFile, fileArg); *************** *** 42,46 **** } ! public void add(ClassSymbol symbol, IFile file, ISourcePosition position) { symbolArg = symbol; fileArg = file; --- 42,46 ---- } ! public void add(Symbol symbol, IFile file, ISourcePosition position) { symbolArg = symbol; fileArg = file; |
|
From: Markus B. <mba...@us...> - 2005-10-23 22:24:27
|
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-serv3449/src/org/rubypeople/rdt/internal/core/symbols Modified Files: TC_SymbolIndex.java Log Message: added indexing of method definitions 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.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TC_SymbolIndex.java 23 Oct 2005 19:34:51 -0000 1.4 --- TC_SymbolIndex.java 23 Oct 2005 22:24:19 -0000 1.5 *************** *** 24,28 **** import org.rubypeople.rdt.internal.core.parser.RdtPosition; ! public class TC_SymbolIndex extends TestCase { private static final ClassSymbol UNKNOWN_SYMBOL = new ClassSymbol("unknown"); private static final ClassSymbol FOO_CLASS_SYMBOL = new ClassSymbol("Foo"); --- 24,28 ---- import org.rubypeople.rdt.internal.core.parser.RdtPosition; ! public class TC_SymbolIndex extends TestCase implements ISymbolTypes { private static final ClassSymbol UNKNOWN_SYMBOL = new ClassSymbol("unknown"); private static final ClassSymbol FOO_CLASS_SYMBOL = new ClassSymbol("Foo"); *************** *** 78,88 **** } ! public void testRegExpFind() { index.add(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION); ! assertEquals(EMPTY_SET, index.find("^oo$")); ! assertEquals(createSet(new SearchResult(FOO_CLASS_SYMBOL, FOO_CLASS_LOCATION)), index.find("[o]+$")); ! assertEquals(createSet(new SearchResult(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION)), index.find("o.2")); ! assertEquals(createSet(new SearchResult(FOO_CLASS_SYMBOL, FOO_CLASS_LOCATION), new SearchResult(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION)), index.find("oo")); ! } --- 78,101 ---- } ! public void testClassRegExpFind() { index.add(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION); ! assertEquals(EMPTY_SET, index.find("^oo$", CLASS_SYMBOL)); ! assertEquals(createSet(new SearchResult(FOO_CLASS_SYMBOL, FOO_CLASS_LOCATION)), index.find("[o]+$", CLASS_SYMBOL)); ! assertEquals(createSet(new SearchResult(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION)), index.find("o.2", CLASS_SYMBOL)); ! assertEquals(createSet(new SearchResult(FOO_CLASS_SYMBOL, FOO_CLASS_LOCATION), new SearchResult(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION)), index.find("oo", CLASS_SYMBOL)); ! } ! ! public void testAddMethodWithSameNameAsClass() { ! MethodSymbol symbol = new MethodSymbol("Foo") ; ! index.add(symbol, OTHER_FOO_CLASS_LOCATION); ! assertEquals(createSet(OTHER_FOO_CLASS_LOCATION), index.find(symbol)) ; ! assertEquals(createSet(FOO_CLASS_LOCATION), index.find(FOO_CLASS_SYMBOL)) ; ! } ! ! public void testMethodRegExpFind() { ! MethodSymbol symbol = new MethodSymbol("aMethod") ; ! index.add(symbol, OTHER_FOO_CLASS_LOCATION); ! assertEquals(createSet(new SearchResult(symbol, OTHER_FOO_CLASS_LOCATION)), index.find("^a", METHOD_SYMBOL)) ; ! assertEquals(EMPTY_SET, index.find("^a", CLASS_SYMBOL)) ; } |
|
From: Markus B. <mba...@us...> - 2005-10-23 20:13:42
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8755/src/org/rubypeople/rdt/internal/ui/search Modified Files: RubySearchPage.java Log Message: disabled limitTo Index: RubySearchPage.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search/RubySearchPage.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** RubySearchPage.java 23 Oct 2005 19:31:28 -0000 1.1 --- RubySearchPage.java 23 Oct 2005 20:13:31 -0000 1.2 *************** *** 250,256 **** private int getLimitTo() { ! for (int i = 0; i < fLimitTo.length; i++) { ! if (fLimitTo[i].getSelection()) return i; ! } return -1; } --- 250,256 ---- private int getLimitTo() { ! //for (int i = 0; i < fLimitTo.length; i++) { ! // if (fLimitTo[i].getSelection()) return i; ! //} return -1; } |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:47:38
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3530 Modified Files: plugin.properties plugin.xml Log Message: very preliminary version of the Ruby Search UI, with lots of TODOs. Allows to search for Classes with regular expressions only. Index: plugin.properties =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.properties,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** plugin.properties 21 Sep 2005 20:23:28 -0000 1.22 --- plugin.properties 23 Oct 2005 19:47:24 -0000 1.23 *************** *** 90,91 **** --- 90,93 ---- ########################################################################## GenerateRdocAction.label= &Generate Rdoc... + + RubySearchPage.label=Ruby Search \ No newline at end of file Index: plugin.xml =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/plugin.xml,v retrieving revision 1.63 retrieving revision 1.64 diff -C2 -d -r1.63 -r1.64 *** plugin.xml 2 Oct 2005 23:31:11 -0000 1.63 --- plugin.xml 23 Oct 2005 19:47:24 -0000 1.64 *************** *** 30,33 **** --- 30,34 ---- <import plugin="org.eclipse.ui.forms"/> <import plugin="org.rubypeople.rdt.launching"/> + <import plugin="org.eclipse.search"/> </requires> <extension-point id="foldingStructureProviders" name="%foldingStructureProviders" schema="schema/foldingStructureProviders.exsd"/> *************** *** 521,523 **** --- 522,538 ---- </factory> </extension> + <extension + point="org.eclipse.search.searchPages"> + <page + class="org.rubypeople.rdt.internal.ui.search.RubySearchPage" + id="org.rubypeople.rdt.ui.RubySearchPage" + label="%RubySearchPage.label"/> + </extension> + <extension + point="org.eclipse.search.searchResultViewPages"> + <viewPage + class="org.rubypeople.rdt.internal.ui.search.RubySearchResultPage" + id="org.rubypeople.rdt.ui.search.RubySearchResultPage" + searchResultClass="org.rubypeople.rdt.internal.ui.search.RubySearchResult"/> + </extension> </plugin> |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:46:38
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3238/src/org/rubypeople/rdt/internal/core/symbols Added Files: SearchResult.java Log Message: this class bundles symbol and a location where the symbol occurs --- NEW FILE: SearchResult.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.core.symbols; public class SearchResult { private static final int ODD_PRIME_NUMBER = 37; private ClassSymbol symbol ; private Location location ; public SearchResult(ClassSymbol symbol, Location location) { this.location = location ; this.symbol = symbol ; } public Location getLocation() { return location; } public ClassSymbol getSymbol() { return symbol; } public boolean equals(Object obj) { if (!(obj instanceof SearchResult)) return false; SearchResult that = (SearchResult) obj; return that.symbol.equals(this.symbol) && that.location.equals(this.location); } public int hashCode() { return ODD_PRIME_NUMBER * symbol.hashCode() + location.hashCode() ; } public String toString() { return "Symbol [" + symbol.toString() + "] at Location ["+location.toString()+"]"; } } |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:44:54
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2741/src/org/rubypeople/rdt/internal/core/symbols Modified Files: SymbolIndex.java Log Message: added logging, more selective flushing, find with regular expression Index: SymbolIndex.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/SymbolIndex.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SymbolIndex.java 19 Oct 2005 00:33:11 -0000 1.6 --- SymbolIndex.java 23 Oct 2005 19:44:46 -0000 1.7 *************** *** 18,21 **** --- 18,23 ---- import java.util.Map; import java.util.Set; + import java.util.regex.Pattern; + import java.util.regex.PatternSyntaxException; import org.eclipse.core.resources.IFile; *************** *** 38,41 **** --- 40,44 ---- public void add(ClassSymbol symbol, IFile file, ISourcePosition position) { + SymbolIndex.log("Adding Symbol: " + symbol) ; add(symbol, new Location(file.getFullPath(), position)); } *************** *** 47,53 **** return Collections.unmodifiableSet(locations); } public void flush(IPath foo_path) { ! // flush only relevant bits synchronized (index) { for (Iterator indexIter = index.entrySet().iterator(); indexIter.hasNext();) { --- 50,79 ---- return Collections.unmodifiableSet(locations); } + + /* + * returns a set of SearchResult instances as opposed to find(symbol), which returns locations + */ + public Set find(String regExp) throws PatternSyntaxException { + Pattern pattern = Pattern.compile(regExp); + Set searchResults = new HashSet() ; + + for (Iterator indexIter = index.entrySet().iterator(); indexIter.hasNext();) { + Map.Entry entry = (Map.Entry) indexIter.next(); + ClassSymbol symbol = (ClassSymbol) entry.getKey() ; + if (pattern.matcher(symbol.getName()).find()) { + Set foundLocations = (Set)entry.getValue() ; + for (Iterator locationIter = foundLocations.iterator(); locationIter.hasNext(); ) { + Location location = (Location) locationIter.next() ; + searchResults.add(new SearchResult(symbol, location)) ; + } + } + } + + return searchResults ; + } 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();) { *************** *** 57,61 **** for (Iterator locationIter = locations.iterator(); locationIter.hasNext();) { Location location = (Location) locationIter.next(); ! locationIter.remove(); } --- 83,89 ---- for (Iterator locationIter = locations.iterator(); locationIter.hasNext();) { Location location = (Location) locationIter.next(); ! if (location.getSourcePath() == foo_path) { ! locationIter.remove(); ! } } *************** *** 73,76 **** --- 101,111 ---- return verbose; } + + public static void log(String message) { + if (!SymbolIndex.isVerbose()) { + return ; + } + System.out.println(message) ; + } |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:43:42
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2450/src/org/rubypeople/rdt/internal/core/symbols Modified Files: Location.java Log Message: added public accessor for SourcePath Index: Location.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/Location.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Location.java 13 Oct 2005 23:56:07 -0000 1.3 --- Location.java 23 Oct 2005 19:43:34 -0000 1.4 *************** *** 54,56 **** --- 54,61 ---- return position; } + + public IPath getSourcePath() + { + return sourcePath ; + } } |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:43:06
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2277/src/org/rubypeople/rdt/internal/core/symbols Modified Files: ClassSymbol.java Log Message: added public accessor for className Index: ClassSymbol.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/ClassSymbol.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ClassSymbol.java 13 Oct 2005 23:56:07 -0000 1.3 --- ClassSymbol.java 23 Oct 2005 19:42:58 -0000 1.4 *************** *** 28,31 **** --- 28,35 ---- } + public String getName() { + return this.className ; + } + public int hashCode() { return className.hashCode(); |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:41:43
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1991/src/org/rubypeople/rdt/internal/core/builder Modified Files: IndexUpdater.java Log Message: guard clause for processNode (node can be null), pushing name on scopeStack instead of qualified name (consider: module::class1::class2, if pushing the qualified name for class1 that results in module::module::class1::class2 as qualified class name for class2) Index: IndexUpdater.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/IndexUpdater.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** IndexUpdater.java 16 Oct 2005 17:29:21 -0000 1.5 --- IndexUpdater.java 23 Oct 2005 19:41:35 -0000 1.6 *************** *** 40,52 **** private void processNode(IFile file, Node node) { if (isScopingNode(node)) { IScopingNode classNode = (IScopingNode) node; String name = getFullyQualifiedName(classNode); ! scopeStack.push(name); if (node instanceof ClassNode) index.add(new ClassSymbol(name), file, classNode.getCPath().getPosition()); } for (Iterator iter = node.childNodes().iterator(); iter.hasNext();) { Node childNode = (Node) iter.next(); --- 40,58 ---- private void processNode(IFile file, Node node) { + // sgml-parser, line 35: InstAsgnNode contains DStrNode which returns null as child-node + if (node == null) + { + return ; + } if (isScopingNode(node)) { IScopingNode classNode = (IScopingNode) node; String name = getFullyQualifiedName(classNode); ! scopeStack.push(classNode.getCPath().getName()); if (node instanceof ClassNode) index.add(new ClassSymbol(name), file, classNode.getCPath().getPosition()); } + for (Iterator iter = node.childNodes().iterator(); iter.hasNext();) { Node childNode = (Node) iter.next(); |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:38:05
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1298/src/org/rubypeople/rdt/core Modified Files: RubyCore.java Log Message: stopped updateProjects in start method, because if there are syntax errors, that breaks RDT altogether (perspective can't open) it can also be long running, therefore we must search for a better place to call updateProjects (or start a background job here) Index: RubyCore.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** RubyCore.java 23 Oct 2005 00:03:16 -0000 1.22 --- RubyCore.java 23 Oct 2005 19:37:57 -0000 1.23 *************** *** 221,225 **** IndexUpdater indexUpdater = new IndexUpdater(symbolIndex); MassIndexUpdater massUpdater = new MassIndexUpdater(indexUpdater); ! massUpdater.updateProjects(Arrays.asList(getRubyProjects())); } --- 221,226 ---- IndexUpdater indexUpdater = new IndexUpdater(symbolIndex); MassIndexUpdater massUpdater = new MassIndexUpdater(indexUpdater); ! // TODO: move away from start method: long running, syntax errors can occur ! //massUpdater.updateProjects(Arrays.asList(getRubyProjects())); } |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:35: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-serv469/src/org/rubypeople/rdt/internal/core/symbols Modified Files: TC_SymbolIndex.java Log Message: added test case for reg exp, updated testcase for flush 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TC_SymbolIndex.java 13 Oct 2005 23:56:02 -0000 1.3 --- TC_SymbolIndex.java 23 Oct 2005 19:34:51 -0000 1.4 *************** *** 27,30 **** --- 27,31 ---- private static final ClassSymbol UNKNOWN_SYMBOL = new ClassSymbol("unknown"); 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"); *************** *** 52,57 **** } ! public void testFlush() { index.flush(FOO_PATH); assertEquals(EMPTY_SET, index.find(FOO_CLASS_SYMBOL)); } --- 53,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)); } *************** *** 68,71 **** --- 72,90 ---- assertEquals(createSet(OTHER_FOO_CLASS_LOCATION, FOO_CLASS_LOCATION), index.find(FOO_CLASS_SYMBOL)); } + + public void testAddingTwice() { + index.add(FOO_CLASS_SYMBOL, FOO_CLASS_LOCATION); + assertEquals(createSet(FOO_CLASS_LOCATION), index.find(FOO_CLASS_SYMBOL)); + } + + public void testRegExpFind() { + index.add(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION); + assertEquals(EMPTY_SET, index.find("^oo$")); + assertEquals(createSet(new SearchResult(FOO_CLASS_SYMBOL, FOO_CLASS_LOCATION)), index.find("[o]+$")); + assertEquals(createSet(new SearchResult(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION)), index.find("o.2")); + assertEquals(createSet(new SearchResult(FOO_CLASS_SYMBOL, FOO_CLASS_LOCATION), new SearchResult(OTHER_FOO_CLASS_SYMBOL, OTHER_FOO_CLASS_LOCATION)), index.find("oo")); + + } + private Set createSet(Object obj1) { Set set = new HashSet(); |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:34:10
|
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-serv32758/src/org/rubypeople/rdt/internal/core/builder Modified Files: TC_IndexUpdater.java Log Message: new test case for nested classes, like module::class1::class2 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.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** TC_IndexUpdater.java 19 Oct 2005 00:33:05 -0000 1.3 --- TC_IndexUpdater.java 23 Oct 2005 19:34:03 -0000 1.4 *************** *** 93,96 **** --- 93,104 ---- } + public void testTreeWithMoreNesting() throws Exception { + Node node = parseCode("module Foo\nclass Bar\nclass InnerBar\nend\nend\nend\n"); + + updater.update(file,node); + + symbolIndex.assertFlushed(file.getFullPath()); + symbolIndex.assertAdded(new ClassSymbol("Foo::Bar::InnerBar"), file, new RdtPosition(2, 3, 35, 36)); + } private Node parseCode(String code) throws CoreException { |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:31:39
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32277/src/org/rubypeople/rdt/internal/ui/search Added Files: RubySearchPage.java RubySearchTreeContentProvider.java RubySearchQuery.java RubySearchResultPage.java RubySearchResult.java RubySearchLabelProvider.java Log Message: very preliminary version of the Ruby Search UI, with lots of TODOs. Allows to search for Classes with regular expressions only. --- NEW FILE: RubySearchLabelProvider.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.jface.viewers.LabelProvider; import org.rubypeople.rdt.internal.core.symbols.SearchResult; public class RubySearchLabelProvider extends LabelProvider { public String getText(Object element) { if (element instanceof SearchResult) { SearchResult searchResult = (SearchResult) element ; return searchResult.getSymbol().toString() ; } return super.getText(element); } } --- NEW FILE: RubySearchPage.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. * * This file is based on * org.eclipse.jdt.internal.ui.search.JavaSearchPage * Copyright (c) 2000, 2005 IBM Corporation and others. */ package org.rubypeople.rdt.internal.ui.search; import java.util.ArrayList; import java.util.Iterator; import java.util.List; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.DialogPage; import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.util.Assert; import org.eclipse.search.internal.core.SearchScope; import org.eclipse.search.internal.ui.Messages; import org.eclipse.search.internal.ui.ScopePart; import org.eclipse.search.internal.ui.SearchMessages; import org.eclipse.search.ui.ISearchPage; import org.eclipse.search.ui.ISearchPageContainer; import org.eclipse.search.ui.ISearchQuery; import org.eclipse.search.ui.NewSearchUI; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; 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 ? private static class SearchPatternData { private int searchFor; private int limitTo; 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; this.pattern = pattern; this.isCaseSensitive = isCaseSensitive; this.scope = scope; this.workingSets = workingSets; setRubyElement(element); } public void setRubyElement(IRubyElement element) { this.rubyElement = element; } public boolean isCaseSensitive() { return isCaseSensitive; } public IRubyElement getRubyElement() { return rubyElement; } public int getLimitTo() { return limitTo; } public String getPattern() { return pattern; } public int getScope() { return scope; } public int getSearchFor() { return searchFor; } public IWorkingSet[] getWorkingSets() { return workingSets; } public void store(IDialogSettings settings) { settings.put("searchFor", searchFor); //$NON-NLS-1$ settings.put("scope", scope); //$NON-NLS-1$ settings.put("pattern", pattern); //$NON-NLS-1$ settings.put("limitTo", limitTo); //$NON-NLS-1$ // TODO // settings.put("rubyElement", rubyElement != null ? // rubyElement.getHandleIdentifier() : ""); //$NON-NLS-1$ // //$NON-NLS-2$ settings.put("isCaseSensitive", isCaseSensitive); //$NON-NLS-1$ if (workingSets != null) { String[] wsIds = new String[workingSets.length]; for (int i = 0; i < workingSets.length; i++) { wsIds[i] = workingSets[i].getId(); } settings.put("workingSets", wsIds); //$NON-NLS-1$ } else { settings.put("workingSets", new String[0]); //$NON-NLS-1$ } } public static SearchPatternData create(IDialogSettings settings) { String pattern = settings.get("pattern"); //$NON-NLS-1$ if (pattern.length() == 0) { return null; } // handle the RubyElement // this is copied from JavaSearchPage String[] wsIds = settings.getArray("workingSets"); //$NON-NLS-1$ IWorkingSet[] workingSets = null; if (wsIds != null && wsIds.length > 0) { IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); workingSets = new IWorkingSet[wsIds.length]; for (int i = 0; workingSets != null && i < wsIds.length; i++) { workingSets[i] = workingSetManager.getWorkingSet(wsIds[i]); if (workingSets[i] == null) { workingSets = null; } } } try { int searchFor = settings.getInt("searchFor"); //$NON-NLS-1$ int scope = settings.getInt("scope"); //$NON-NLS-1$ int limitTo = settings.getInt("limitTo"); //$NON-NLS-1$ boolean isCaseSensitive = settings.getBoolean("isCaseSensitive"); //$NON-NLS-1$ // TODO IRubyElement elem = null; // settings.get("rubyElement") ; return new SearchPatternData(searchFor, limitTo, pattern, isCaseSensitive, elem, scope, workingSets); } catch (NumberFormatException e) { return null; } } } private static final int HISTORY_SIZE = 12; // Dialog store id constants private final static String PAGE_NAME = "JavaSearchPage"; //$NON-NLS-1$ private final static String STORE_CASE_SENSITIVE = "CASE_SENSITIVE"; //$NON-NLS-1$ private final static String STORE_HISTORY = "HISTORY"; //$NON-NLS-1$ private final static String STORE_HISTORY_SIZE = "HISTORY_SIZE"; //$NON-NLS-1$ private final List fPreviousSearchPatterns; private SearchPatternData fInitialData; private IRubyElement fRubyElement; private boolean fFirstTime = true; private IDialogSettings fDialogSettings; private boolean fIsCaseSensitive; private Combo fPattern; private ISearchPageContainer fContainer; 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, * SearchMessages.SearchPage_limitTo_implementors, * SearchMessages.SearchPage_limitTo_references, * SearchMessages.SearchPage_limitTo_allOccurrences */}; private Button fSearchJRE; private static final int INDEX_REFERENCES = 2; private static final int INDEX_ALL = 3; /** * */ public RubySearchPage() { fPreviousSearchPatterns = new ArrayList(); } // ---- Action Handling ------------------------------------------------ public boolean performAction() { NewSearchUI.runQueryInBackground(getSearchQuery()); return true; } private ISearchQuery getSearchQuery() { SearchPatternData patternData = getPatternData(); // Setup search scope SearchScope scope = null; switch (getContainer().getSelectedScope()) { case ISearchPageContainer.WORKSPACE_SCOPE: scope = SearchScope.newWorkspaceScope(); break; /* * case ISearchPageContainer.SELECTION_SCOPE: scope= * getSelectedResourcesScope(false); break; case * ISearchPageContainer.SELECTED_PROJECTS_SCOPE: scope= * getSelectedResourcesScope(true); break; */ case ISearchPageContainer.WORKING_SET_SCOPE: IWorkingSet[] workingSets = getContainer().getSelectedWorkingSets(); String desc = Messages.format(SearchMessages.WorkingSetScope, ScopePart.toString(workingSets)); scope = SearchScope.newSearchScope(desc, workingSets); } 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; } private void setLimitTo(int searchFor, int limitTo) { /* * if (!(searchFor == TYPE || searchFor == INTERFACE) && limitTo == * IMPLEMENTORS) { limitTo= REFERENCES; } * * if (!(searchFor == FIELD) && (limitTo == READ_ACCESSES || limitTo == * WRITE_ACCESSES)) { limitTo= REFERENCES; } * * for (int i= 0; i < fLimitTo.length; i++) { * fLimitTo[i].setSelection(limitTo == i); } * * fLimitTo[DECLARATIONS].setEnabled(true); * fLimitTo[IMPLEMENTORS].setEnabled(searchFor == INTERFACE || searchFor == * TYPE); fLimitTo[REFERENCES].setEnabled(true); * fLimitTo[ALL_OCCURRENCES].setEnabled(true); * fLimitTo[READ_ACCESSES].setEnabled(searchFor == FIELD); * fLimitTo[WRITE_ACCESSES].setEnabled(searchFor == FIELD); */ } private String[] getPreviousSearchPatterns() { // Search results are not persistent int patternCount = fPreviousSearchPatterns.size(); String[] patterns = new String[patternCount]; for (int i = 0; i < patternCount; i++) patterns[i] = ((SearchPatternData) fPreviousSearchPatterns.get(i)).getPattern(); return patterns; } 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(); } private SearchPatternData findInPrevious(String pattern) { for (Iterator iter = fPreviousSearchPatterns.iterator(); iter.hasNext();) { SearchPatternData element = (SearchPatternData) iter.next(); if (pattern.equals(element.getPattern())) { return element; } } return null; } /** * Return search pattern data and update previous searches. An existing * entry will be updated. */ private SearchPatternData getPatternData() { String pattern = getPattern(); SearchPatternData match = findInPrevious(pattern); if (match != null) { fPreviousSearchPatterns.remove(match); } match = new SearchPatternData(getSearchFor(), getLimitTo(), pattern, fCaseSensitive.getSelection(), fRubyElement, getContainer().getSelectedScope(), getContainer().getSelectedWorkingSets()); fPreviousSearchPatterns.add(0, match); // insert on top return match; } /* * Implements method from IDialogPage */ public void setVisible(boolean visible) { if (visible && fPattern != null) { if (fFirstTime) { fFirstTime = false; // Set item and text here to prevent page from resizing fPattern.setItems(getPreviousSearchPatterns()); // initSelections(); } fPattern.setFocus(); } // updateOKStatus(); super.setVisible(visible); } public boolean isValid() { return true; } // ---- Widget creation ------------------------------------------------ /** * Creates the page's content. */ public void createControl(Composite parent) { initializeDialogUnits(parent); // readConfiguration(); Composite result = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.horizontalSpacing = 10; result.setLayout(layout); Control expressionComposite = createExpression(result); expressionComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1)); Label separator = new Label(result, SWT.NONE); separator.setVisible(false); GridData data = new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1); data.heightHint = convertHeightInCharsToPixels(1) / 3; separator.setLayoutData(data); Control searchFor = createSearchFor(result); searchFor.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); Control limitTo = createLimitTo(result); limitTo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1)); // 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); Dialog.applyDialogFont(result); // PlatformUI.getWorkbench().getHelpSystem().setHelp(result, // IJavaHelpContextIds.JAVA_SEARCH_PAGE); } /* * private Control createParticipants(Composite result) { if * (!SearchParticipantsExtensionPoint.hasAnyParticipants()) return new * Composite(result, SWT.NULL); Button selectParticipants= new * Button(result, SWT.PUSH); * selectParticipants.setText(SearchMessages.getString("SearchPage.select_participants.label")); * //$NON-NLS-1$ GridData gd= new GridData(); gd.verticalAlignment= * GridData.VERTICAL_ALIGN_BEGINNING; gd.horizontalAlignment= * GridData.HORIZONTAL_ALIGN_END; gd.grabExcessHorizontalSpace= false; * gd.horizontalAlignment= GridData.END; gd.horizontalSpan= 2; * selectParticipants.setLayoutData(gd); * selectParticipants.addSelectionListener(new SelectionAdapter() { public * void widgetSelected(SelectionEvent e) { * PreferencePageSupport.showPreferencePage(getShell(), * "org.eclipse.jdt.ui.preferences.SearchParticipantsExtensionPoint", new * SearchParticipantsExtensionPoint()); //$NON-NLS-1$ } * * }); return selectParticipants; } */ private Control createExpression(Composite parent) { Composite result = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; layout.marginHeight = 0; result.setLayout(layout); // Pattern text + info 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)); // Pattern combo fPattern = new Combo(result, SWT.SINGLE | SWT.BORDER); fPattern.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { // handlePatternSelected(); // updateOKStatus(); } }); fPattern.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { doPatternModified(); // updateOKStatus(); } }); GridData data = new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1); data.widthHint = convertWidthInCharsToPixels(50); fPattern.setLayoutData(data); // Ignore case checkbox fCaseSensitive = new Button(result, SWT.CHECK); // TODO fCaseSensitive.setText("CaseSensitive"); fCaseSensitive.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { fIsCaseSensitive = fCaseSensitive.getSelection(); } }); fCaseSensitive.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 1, 1)); return result; } private boolean isValidSearchPattern() { if (getPattern().length() == 0) { return false; } if (fRubyElement != null) { return true; } // TODO return true; // return SearchPattern.createPattern(getPattern(), getSearchFor(), // getLimitTo(), SearchPattern.R_EXACT_MATCH) != null; } /* * (non-Javadoc) * * @see org.eclipse.jface.dialogs.DialogPage#dispose() */ public void dispose() { // writeConfiguration(); super.dispose(); } private void doPatternModified() { /* * if (fInitialData != null && * getPattern().equals(fInitialData.getPattern()) && * fInitialData.getJavaElement() != null && fInitialData.getSearchFor() == * getSearchFor()) { fCaseSensitive.setEnabled(false); * fCaseSensitive.setSelection(true); fJavaElement= * fInitialData.getJavaElement(); } else { fCaseSensitive.setEnabled(true); * fCaseSensitive.setSelection(fIsCaseSensitive); fJavaElement= null; } */ } 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); /* * result.setText("Limit to") * ;//SearchMessages.SearchPage_limitTo_label); result.setLayout(new * GridLayout(2, true)); * * SelectionAdapter listener= new SelectionAdapter() { public void * widgetSelected(SelectionEvent e) { //updateUseJRE(); } }; * * fLimitTo= new Button[fLimitToText.length]; for (int i= 0; i < * fLimitToText.length; i++) { Button button= new Button(result, * SWT.RADIO); button.setText(fLimitToText[i]); fLimitTo[i]= button; * button.setSelection(i == REFERENCES); * button.addSelectionListener(listener); button.setLayoutData(new * GridData()); } */ return result; } /* * Implements method from ISearchPage */ public void setContainer(ISearchPageContainer container) { fContainer = container; } /** * Returns the search page's container. */ private ISearchPageContainer getContainer() { return fContainer; } } --- NEW FILE: RubySearchResult.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.jface.resource.ImageDescriptor; import org.eclipse.search.ui.ISearchQuery; import org.eclipse.search.ui.text.AbstractTextSearchResult; import org.eclipse.search.ui.text.IEditorMatchAdapter; import org.eclipse.search.ui.text.IFileMatchAdapter; public class RubySearchResult extends AbstractTextSearchResult { private RubySearchQuery fRubySearchQuery ; public RubySearchResult(RubySearchQuery rubySearchQuery) { fRubySearchQuery = rubySearchQuery ; } public IEditorMatchAdapter getEditorMatchAdapter() { // TODO Auto-generated method stub return null; } public IFileMatchAdapter getFileMatchAdapter() { // TODO Auto-generated method stub return null; } public String getLabel() { return "Ruby search result for " + fRubySearchQuery.toString(); } public String getTooltip() { // TODO Auto-generated method stub return null; } public ImageDescriptor getImageDescriptor() { // TODO Auto-generated method stub return null; } public ISearchQuery getQuery() { return fRubySearchQuery; } } --- NEW FILE: RubySearchTreeContentProvider.java --- /* * Author: Markus * * 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. * * 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; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; 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; 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) { initialize((RubySearchResult) newInput); } } protected 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); } } } 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); } } /** * returns true if the child already was a child of parent. * * @param parent * @param child * @return Returns <code>trye</code> if the child was added */ private boolean insertChild(Object parent, Object child) { Set children= (Set) fChildrenMap.get(parent); if (children == null) { children= new HashSet(); fChildrenMap.put(parent, children); } return children.add(child); } 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); remove(parent, refreshViewer); } else { removeFromSiblings(element, fResult); if (refreshViewer) fTreeViewer.refresh(); } } else { if (refreshViewer) { fTreeViewer.refresh(element); } } } } private void removeFromSiblings(Object element, Object parent) { Set siblings= (Set) fChildrenMap.get(parent); if (siblings != null) { siblings.remove(element); } } public Object[] getChildren(Object parentElement) { Set children= (Set) fChildrenMap.get(parentElement); if (children == null) return EMPTY_ARR; return children.toArray(); } public boolean hasChildren(Object element) { return getChildren(element).length > 0; } public synchronized void elementsChanged(Object[] updatedElements) { for (int i= 0; i < updatedElements.length; i++) { if (fResult.getMatchCount(updatedElements[i]) > 0) insert(updatedElements[i], true); else remove(updatedElements[i], true); } } public void clear() { initialize(fResult); fTreeViewer.refresh(); } /* * 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; } } --- NEW FILE: RubySearchResultPage.java --- /* * Author: Markus * * 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.ui.search; import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.IPath; import org.eclipse.jface.viewers.DecoratingLabelProvider; import org.eclipse.jface.viewers.TableViewer; import org.eclipse.jface.viewers.TreeViewer; import org.eclipse.search.internal.ui.text.FileSearchPage.DecoratorIgnoringViewerSorter; import org.eclipse.search.ui.text.AbstractTextSearchViewPage; import org.eclipse.search.ui.text.Match; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.ide.IDE; import org.eclipse.ui.texteditor.ITextEditor; import org.rubypeople.rdt.internal.core.symbols.SearchResult; import org.rubypeople.rdt.internal.ui.RubyPlugin; public class RubySearchResultPage extends AbstractTextSearchViewPage { RubySearchTreeContentProvider fContentProvider; public RubySearchResultPage() { } protected void elementsChanged(Object[] objects) { if (fContentProvider != null) { fContentProvider.elementsChanged(objects); } } protected void clear() { // TODO Auto-generated method stub } protected void configureTreeViewer(TreeViewer viewer) { viewer.setUseHashlookup(true); RubySearchLabelProvider innerLabelProvider = new RubySearchLabelProvider(); viewer.setLabelProvider(new DecoratingLabelProvider(innerLabelProvider, PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator())); fContentProvider = new RubySearchTreeContentProvider(viewer); viewer.setContentProvider(fContentProvider); viewer.setSorter(new DecoratorIgnoringViewerSorter(innerLabelProvider)); // TODO: addDragAdapters(viewer); } protected void configureTableViewer(TableViewer viewer) { // TODO: When is a table viewer needed ? } protected IEditorPart openEditor(Match match, boolean activate) { // TODO: like OpenEditor: consider NewSearchUI.reuseEditor() ? IWorkbenchPage page = RubyPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { SearchResult result = (SearchResult) match.getElement(); IPath sourcePath = result.getLocation().getSourcePath(); IResource resource = RubyPlugin.getWorkspace().getRoot().findMember(sourcePath); IFile file = (IFile) resource.getAdapter(org.eclipse.core.resources.IFile.class); if (file == null) { RubyPlugin.log("Couldn't convert search result to file: " + resource.getFullPath()); } else { return IDE.openEditor(page, file, activate); } } catch (PartInitException e) { RubyPlugin.log(e); } return null; } protected void showMatch(Match match, int offset, int length, boolean activate) throws PartInitException { // TODO: show search marker IEditorPart editor = openEditor(match, activate); if (offset != 0 && length != 0) { if (editor instanceof ITextEditor) { ITextEditor textEditor = (ITextEditor) editor; textEditor.selectAndReveal(offset, length); } } } } --- NEW FILE: RubySearchQuery.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.Iterator; import java.util.Set; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.search.internal.core.SearchScope; import org.eclipse.search.ui.ISearchQuery; import org.eclipse.search.ui.ISearchResult; import org.eclipse.search.ui.NewSearchUI; import org.eclipse.search.ui.text.Match; import org.rubypeople.rdt.core.RubyCore; import org.rubypeople.rdt.internal.core.symbols.SearchResult; public class RubySearchQuery implements ISearchQuery { private String fSearchString; private SearchScope fScope; private RubySearchResult fResult; public RubySearchQuery(SearchScope scope, String searchString) { fScope = scope; fSearchString = searchString; } public boolean canRerun() { // TODO Auto-generated method stub return false; } public boolean canRunInBackground() { return true; } public String getLabel() { // TODO Auto-generated method stub return "RubySearchJob"; } public ISearchResult getSearchResult() { if (fResult == null) { fResult = new RubySearchResult(this); // new SearchResultUpdater(fResult); } return fResult; } public IStatus run(IProgressMonitor monitor) throws OperationCanceledException { Set entries = RubyCore.getPlugin().getSymbolIndex().find(fSearchString); for (Iterator iter = entries.iterator(); iter.hasNext();) { SearchResult searchResult = (SearchResult) iter.next(); int startOffset = searchResult.getLocation().getPosition().getStartOffset(); int length = searchResult.getLocation().getPosition().getEndOffset() - startOffset; 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; } } |
|
From: Markus B. <mba...@us...> - 2005-10-23 19:31:28
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32235/src/org/rubypeople/rdt/internal/ui/search Log Message: Directory /cvsroot/rubyeclipse/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/search added to the repository |
|
From: David C. <dc...@us...> - 2005-10-23 00:03:28
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17009/src/org/rubypeople/rdt/internal/core/builder Modified Files: RubyCompiler.java RubyBuilder.java Added Files: ResourceDeltaFormatter.java Log Message: Minor clean up and analysis support. Index: RubyBuilder.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyBuilder.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** RubyBuilder.java 13 Oct 2005 23:56:06 -0000 1.14 --- RubyBuilder.java 23 Oct 2005 00:03:16 -0000 1.15 *************** *** 26,29 **** --- 26,30 ---- private static final int TOTAL_WORK = 10000; + private static boolean verbose; private IProject currentProject; *************** *** 36,40 **** return returnProjects; ! RubyCore.trace("Started " + buildType(kind) + " build of " + buildDescription()); //$NON-NLS-1$ MarkerManager rubyMarkerManager = new MarkerManager(); --- 37,42 ---- return returnProjects; ! if (verbose) ! RubyCore.trace("Started " + buildType(kind) + " build of " + buildDescription()); //$NON-NLS-1$ MarkerManager rubyMarkerManager = new MarkerManager(); *************** *** 68,70 **** protected void doCompile(List files, IProgressMonitor monitor) { new RubyCompiler(TOTAL_WORK/files.size()).compile(files, monitor); ! }} --- 70,77 ---- protected void doCompile(List files, IProgressMonitor monitor) { new RubyCompiler(TOTAL_WORK/files.size()).compile(files, monitor); ! } ! ! public static void setVerbose(boolean verbose) { ! RubyBuilder.verbose = verbose; ! } ! } Index: RubyCompiler.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/builder/RubyCompiler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RubyCompiler.java 13 Oct 2005 23:56:06 -0000 1.2 --- RubyCompiler.java 23 Oct 2005 00:03:16 -0000 1.3 *************** *** 1,12 **** /* ! ?* Author: Chris, David Corbin ! ?* ! ?* Copyright (c) 2005 RubyPeople. ! ?* ! ?* This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. ! ?*/ package org.rubypeople.rdt.internal.core.builder; --- 1,12 ---- /* ! * Author: Chris, 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; --- NEW FILE: ResourceDeltaFormatter.java --- package org.rubypeople.rdt.internal.core.builder; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import org.eclipse.core.resources.IResourceDelta; public class ResourceDeltaFormatter { public String format(IResourceDelta delta) { StringBuffer buffer = new StringBuffer(); buffer.append(kindAsString(delta.getKind())); buffer.append(flagsAsString(delta.getFlags())); buffer.append(delta.getFullPath()); buffer.append("\n"); IResourceDelta[] affectedChildren = delta. getAffectedChildren(); for (int i = 0; i < affectedChildren.length; i++) { IResourceDelta childDelta = affectedChildren[i]; buffer.append(format(childDelta)); } return buffer.toString(); } private String flagsAsString(int flags) { StringBuffer buffer = new StringBuffer(); for (Iterator iter = flagMap.keySet().iterator(); iter.hasNext();) { Integer flag = (Integer) iter.next(); if ((flags & flag.intValue()) != 0) buffer.append(flagMap.get(flag)+ " "); } return buffer.toString(); } private String kindAsString(int kind) { switch(kind) { case IResourceDelta.ADDED: return "Added "; case IResourceDelta.REMOVED: return "Removed"; case IResourceDelta.CHANGED: return "Changed"; case IResourceDelta.ADDED_PHANTOM: return "AddedPh"; case IResourceDelta.REMOVED_PHANTOM: return "RemovPh"; } return String.valueOf(kind); } static Map flagMap = new HashMap(); static { putFlag(IResourceDelta.CONTENT, "Content"); putFlag(IResourceDelta.ENCODING, "Encoding"); putFlag(IResourceDelta.DESCRIPTION, "Description"); putFlag(IResourceDelta.OPEN, "Open"); putFlag(IResourceDelta.TYPE, "Type"); putFlag(IResourceDelta.SYNC, "Sync"); putFlag(IResourceDelta.MARKERS, "Markers"); putFlag(IResourceDelta.MOVED_FROM, "Moved-from"); putFlag(IResourceDelta.MOVED_TO, "Moved-to"); } private static void putFlag(int flag, String description) { flagMap.put(new Integer(flag), description); } } |
|
From: David C. <dc...@us...> - 2005-10-23 00:03:28
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17009/src/org/rubypeople/rdt/internal/core Modified Files: SymbolIndexResourceChangeListener.java Log Message: Minor clean up and analysis support. Index: SymbolIndexResourceChangeListener.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SymbolIndexResourceChangeListener.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SymbolIndexResourceChangeListener.java 19 Oct 2005 00:33:12 -0000 1.1 --- SymbolIndexResourceChangeListener.java 23 Oct 2005 00:03:16 -0000 1.2 *************** *** 12,15 **** --- 12,18 ---- package org.rubypeople.rdt.internal.core; + import java.util.ArrayList; + import java.util.List; + import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; *************** *** 21,30 **** import org.rubypeople.rdt.internal.core.builder.MassIndexUpdater; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; - import org.rubypeople.rdt.internal.core.util.ListUtil; public final class SymbolIndexResourceChangeListener implements IResourceChangeListener { private final MassIndexUpdater updater; ! public static void register(SymbolIndex symbolIndex) { // DSC check constructors IndexUpdater indexUpdater = new IndexUpdater(symbolIndex); MassIndexUpdater massIndexUpdater = new MassIndexUpdater(indexUpdater); --- 24,32 ---- import org.rubypeople.rdt.internal.core.builder.MassIndexUpdater; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; public final class SymbolIndexResourceChangeListener implements IResourceChangeListener { private final MassIndexUpdater updater; ! public static void register(SymbolIndex symbolIndex) { IndexUpdater indexUpdater = new IndexUpdater(symbolIndex); MassIndexUpdater massIndexUpdater = new MassIndexUpdater(indexUpdater); *************** *** 44,47 **** --- 46,50 ---- private void handlePostChangeEvent(IResourceChangeEvent event) { + List projects = new ArrayList(); IResourceDelta[] deltas = event.getDelta().getAffectedChildren(); for (int i = 0; i < deltas.length; i++) { *************** *** 50,56 **** IResource resource = delta.getResource(); if (isProject(resource)) ! updater.updateProjects(ListUtil.create((IProject) resource.getAdapter(IProject.class))); } } } --- 53,61 ---- IResource resource = delta.getResource(); if (isProject(resource)) ! projects.add(resource.getAdapter(IProject.class)); } } + if (!projects.isEmpty()) + updater.updateProjects(projects); } |
|
From: David C. <dc...@us...> - 2005-10-23 00:03:28
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17009/src/org/rubypeople/rdt/core Modified Files: RubyCore.java Log Message: Minor clean up and analysis support. Index: RubyCore.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** RubyCore.java 19 Oct 2005 00:33:12 -0000 1.21 --- RubyCore.java 23 Oct 2005 00:03:16 -0000 1.22 *************** *** 46,49 **** --- 46,50 ---- import org.rubypeople.rdt.internal.core.builder.IndexUpdater; import org.rubypeople.rdt.internal.core.builder.MassIndexUpdater; + import org.rubypeople.rdt.internal.core.builder.RubyBuilder; import org.rubypeople.rdt.internal.core.parser.RubyParser; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; *************** *** 58,61 **** --- 59,64 ---- private static final String MODEL_MANAGER_VERBOSE_OPTION = RubyCore.PLUGIN_ID + "/modelmanager"; private static final String SYMBOL_INDEX_VERBOSE_OPTION = RubyCore.PLUGIN_ID + "/symbolIndex"; + private static final String BUILDER_VERBOSE_OPTION = RubyCore.PLUGIN_ID + "/rubyBuilder"; + public final static String NATURE_ID = PLUGIN_ID + ".rubynature"; *************** *** 213,216 **** --- 216,220 ---- RubyModelManager.setVerbose(isDebugOptionTrue(MODEL_MANAGER_VERBOSE_OPTION)); SymbolIndex.setVerbose(isDebugOptionTrue(SYMBOL_INDEX_VERBOSE_OPTION)); + RubyBuilder.setVerbose(isDebugOptionTrue(BUILDER_VERBOSE_OPTION)); SymbolIndexResourceChangeListener.register(symbolIndex); |
|
From: David C. <dc...@us...> - 2005-10-23 00:03:19
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16992/src/org/rubypeople/rdt/internal/core Modified Files: TC_SymbolIndexResourceEventListener.java Log Message: Minor clean up and analysis support. 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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TC_SymbolIndexResourceEventListener.java 19 Oct 2005 00:33:05 -0000 1.2 --- TC_SymbolIndexResourceEventListener.java 23 Oct 2005 00:03:11 -0000 1.3 *************** *** 22,27 **** public class TC_SymbolIndexResourceEventListener extends TestCase { - - private ShamMassIndexUpdater massIndexUpdater; private SymbolIndexResourceChangeListener listener; --- 22,25 ---- *************** *** 48,51 **** --- 46,62 ---- massIndexUpdater.assertProjectsUpdated(ListUtil.create(project)); } + + public void testMultipleProjectOpen() throws Exception { + ShamProject project2 = new ShamProject("test2"); + parentDelta.addChildren(createDelta(project)); + parentDelta.addChildren(createDelta(project2)); + + ShamResourceChangeEvent event = + new ShamResourceChangeEvent(IResourceChangeEvent.POST_CHANGE, parentDelta); + + listener.resourceChanged(event); + + massIndexUpdater.assertProjectsUpdated(ListUtil.create(project, project2)); + } public void testWithoutProject() throws Exception { |
|
From: David C. <dc...@us...> - 2005-10-19 00:33:26
|
Update of /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/resources In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24824/src/org/rubypeople/eclipse/shams/resources Modified Files: ShamResource.java ShamProject.java Log Message: Update SymbolIndex when a new project is opened. Index: ShamProject.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/resources/ShamProject.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ShamProject.java 16 Oct 2005 17:29:26 -0000 1.11 --- ShamProject.java 19 Oct 2005 00:33:17 -0000 1.12 *************** *** 1,4 **** /* ! * Author: David Corbin * * Copyright (c) 2005 RubyPeople. --- 1,4 ---- /* ! * Author: * * Copyright (c) 2005 RubyPeople. *************** *** 39,43 **** public ShamProject(String theProjectName) { ! this(new Path("undefined by sham creator"), theProjectName); } --- 39,43 ---- public ShamProject(String theProjectName) { ! this(new Path("path to " + theProjectName), theProjectName); } *************** *** 154,160 **** } - public Object getAdapter(Class adapter) { - throw new RuntimeException("Unimplemented method in sham"); - } public void accept(IResourceVisitor visitor) throws CoreException {} --- 154,157 ---- Index: ShamResource.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.eclipse.shams/src/org/rubypeople/eclipse/shams/resources/ShamResource.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ShamResource.java 16 Oct 2005 17:29:26 -0000 1.8 --- ShamResource.java 19 Oct 2005 00:33:17 -0000 1.9 *************** *** 1,4 **** /* ! * Author: David Corbin * * Copyright (c) 2005 RubyPeople. --- 1,4 ---- /* ! * Author: * * Copyright (c) 2005 RubyPeople. *************** *** 232,236 **** public Object getAdapter(Class adapter) { ! throw new RuntimeException("Need to implement on sham."); } --- 232,238 ---- public Object getAdapter(Class adapter) { ! if (adapter.isAssignableFrom(getClass())) ! return this; ! return null; } |
|
From: David C. <dc...@us...> - 2005-10-19 00:33:26
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24791/src/org/rubypeople/rdt/internal/core/symbols Modified Files: SymbolIndex.java Log Message: Update SymbolIndex when a new project is opened. Index: SymbolIndex.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/symbols/SymbolIndex.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SymbolIndex.java 16 Oct 2005 21:02:16 -0000 1.5 --- SymbolIndex.java 19 Oct 2005 00:33:11 -0000 1.6 *************** *** 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; *************** *** 58,62 **** Location location = (Location) locationIter.next(); locationIter.remove(); ! } if (locations.isEmpty()) --- 58,62 ---- Location location = (Location) locationIter.next(); locationIter.remove(); ! } if (locations.isEmpty()) |
|
From: David C. <dc...@us...> - 2005-10-19 00:33:24
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24791/src/org/rubypeople/rdt/core Modified Files: RubyCore.java Removed Files: SymbolIndexResourceChangeListener.java Log Message: Update SymbolIndex when a new project is opened. Index: RubyCore.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** RubyCore.java 16 Oct 2005 23:53:03 -0000 1.20 --- RubyCore.java 19 Oct 2005 00:33:12 -0000 1.21 *************** *** 43,46 **** --- 43,47 ---- import org.rubypeople.rdt.internal.core.RubyProject; import org.rubypeople.rdt.internal.core.RubyScript; + import org.rubypeople.rdt.internal.core.SymbolIndexResourceChangeListener; import org.rubypeople.rdt.internal.core.builder.IndexUpdater; import org.rubypeople.rdt.internal.core.builder.MassIndexUpdater; --- SymbolIndexResourceChangeListener.java DELETED --- |