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: <caw...@us...> - 2007-06-25 19:16:48
|
Revision: 2672
http://svn.sourceforge.net/rubyeclipse/?rev=2672&view=rev
Author: cawilliams
Date: 2007-06-25 12:16:42 -0700 (Mon, 25 Jun 2007)
Log Message:
-----------
fix some bugs and add more behavior to do completions for nested types, constants, class level methods on compeltiosn after '::'
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionProposalComparator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchScope.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/FieldLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/TypeDeclarationLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-06-25 17:59:10 UTC (rev 2671)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java 2007-06-25 19:16:42 UTC (rev 2672)
@@ -58,6 +58,7 @@
import org.rubypeople.rdt.internal.core.search.BasicSearchEngine;
import org.rubypeople.rdt.internal.core.search.CollectingSearchRequestor;
import org.rubypeople.rdt.internal.core.util.ASTUtil;
+import org.rubypeople.rdt.internal.core.util.Util;
import org.rubypeople.rdt.internal.ti.BasicTypeGuess;
import org.rubypeople.rdt.internal.ti.DefaultTypeInferrer;
import org.rubypeople.rdt.internal.ti.ITypeGuess;
@@ -67,6 +68,8 @@
import org.rubypeople.rdt.internal.ti.util.INodeAcceptor;
import org.rubypeople.rdt.internal.ti.util.ScopedNodeLocator;
+import sun.security.action.PutAllAction;
+
public class CompletionEngine {
private static final String OBJECT = "Object";
private static final String CONSTRUCTOR_INVOKE_NAME = "new";
@@ -91,18 +94,20 @@
prefix = prefix.substring(0, prefix.length() - 2);
RubyElementRequestor requestor = new RubyElementRequestor(script);
IType[] types = requestor.findType(prefix);
+ Map<String, CompletionProposal> proposals = new HashMap<String, CompletionProposal>();
for (int i = 0; i < types.length; i++) {
IType type = types[i];
- suggestTypesConstants(type);
+ proposals.putAll(suggestTypesConstants(type));
// Suggest nested types
- suggestNestedTypes(type);
+ proposals.putAll(suggestNestedTypes(type));
// Suggest class level methods
- Map<String, CompletionProposal> map = suggestMethods(100, type, false);
- for (CompletionProposal proposal : map.values()) {
- fRequestor.accept(proposal);
- }
+ proposals.putAll(suggestMethods(100, type, false));
}
-
+ List<CompletionProposal> list = new ArrayList<CompletionProposal>(proposals.values());
+ Collections.sort(list, new CompletionProposalComparator());
+ for (CompletionProposal proposal : list) {
+ fRequestor.accept(proposal);
+ }
this.fRequestor.endReporting();
fContext = null;
return;
@@ -176,7 +181,8 @@
fContext = null;
}
- private void suggestTypesConstants(IType type) throws RubyModelException {
+ private Map<String, CompletionProposal> suggestTypesConstants(IType type) throws RubyModelException {
+ Map<String, CompletionProposal> proposals = new HashMap<String, CompletionProposal>();
SearchPattern pattern = SearchPattern.createPattern(IRubyElement.CONSTANT, "*", IRubySearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH);
IRubySearchScope scope = BasicSearchEngine.createRubySearchScope(new IRubyElement[] {type});
List<SearchMatch> results = search(pattern, scope);
@@ -186,22 +192,32 @@
// Add proposal
CompletionProposal proposal = createProposal(fContext.getReplaceStart(), CompletionProposal.FIELD_REF, element.getElementName());
proposal.setType(type.getFullyQualifiedName());
- fRequestor.accept(proposal);
+ proposal.setName(element.getElementName());
+ proposals.put(element.getElementName(), proposal);
}
+ return proposals;
}
- private void suggestNestedTypes(IType type) throws RubyModelException {
+ private Map<String, CompletionProposal> suggestNestedTypes(IType type) throws RubyModelException {
+ Map<String, CompletionProposal> proposals = new HashMap<String, CompletionProposal>();
SearchPattern pattern = SearchPattern.createPattern(IRubyElement.TYPE, "*", IRubySearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH);
IRubySearchScope scope = BasicSearchEngine.createRubySearchScope(new IRubyElement[] {type});
List<SearchMatch> results = search(pattern, scope);
for (SearchMatch match: results) {
IType aType = (IType) match.getElement();
- if (!aType.getFullyQualifiedName().startsWith(type.getFullyQualifiedName()) || aType.getFullyQualifiedName().equals(type.getFullyQualifiedName())) continue;
- // Add proposal
+ String fullname = aType.getFullyQualifiedName();
+ if (fullname.equals(type.getFullyQualifiedName())) continue; // don't return exact match to prefix
+ if (!fullname.startsWith(type.getFullyQualifiedName())) continue; // only return those nested underneath prefix
+ String[] parts = Util.getTypeNameParts(fullname);
+// Don't add if it's not the directly nested child (and is instead the grandchild)
+ if (parts.length != Util.getTypeNameParts(type.getFullyQualifiedName()).length + 1) continue;
+ // Add proposal
CompletionProposal proposal = createProposal(fContext.getReplaceStart(), CompletionProposal.TYPE_REF, aType.getElementName());
proposal.setType(aType.getFullyQualifiedName());
- fRequestor.accept(proposal);
+ proposal.setName(aType.getElementName());
+ proposals.put(aType.getElementName(), proposal);
}
+ return proposals;
}
private List<CompletionProposal> suggestAllMethodsMatchingPrefix(IRubyScript script) {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionProposalComparator.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionProposalComparator.java 2007-06-25 17:59:10 UTC (rev 2671)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionProposalComparator.java 2007-06-25 19:16:42 UTC (rev 2672)
@@ -6,6 +6,7 @@
public class CompletionProposalComparator implements Comparator<CompletionProposal> {
+ // FIXME Also take type of proposal into account! (type, constant, global, instance var, local, etc.)
public int compare(CompletionProposal o1, CompletionProposal o2) {
if (o1.getRelevance() == o2.getRelevance())
return o1.getName().compareTo(o2.getName());
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java 2007-06-25 17:59:10 UTC (rev 2671)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java 2007-06-25 19:16:42 UTC (rev 2672)
@@ -341,9 +341,6 @@
case IRubySearchConstants.CLASS :
typeSuffix = IIndexConstants.CLASS_SUFFIX;
break;
-// case IRubySearchConstants.CLASS_AND_MODULE :
-// typeSuffix = IIndexConstants.CLASS_AND_MODULE_SUFFIX; FIXME Converge the TYPE_SUFFIX and CLASS_AND_MODULE_SUFFIX
-// break;
case IRubySearchConstants.MODULE :
typeSuffix = IIndexConstants.MODULE_SUFFIX;
break;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchScope.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchScope.java 2007-06-25 17:59:10 UTC (rev 2671)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchScope.java 2007-06-25 19:16:42 UTC (rev 2672)
@@ -385,8 +385,8 @@
root = (ISourceFolderRoot) element.getAncestor(IRubyElement.SOURCE_FOLDER_ROOT);
String relativePath;
- containerPath = root.getParent().getPath();
- relativePath = Util.relativePath(getPath(element, false/*full path*/), 1/*remove project segmet*/);
+ containerPath = root.getPath();
+ relativePath = Util.relativePath(getPath(element, true/*full path*/), 0/*remove project segment*/);
containerPathToString = containerPath.getDevice() == null ? containerPath.toString() : containerPath.toOSString();
add(relativePath, containerPathToString, false/*not a package*/);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/FieldLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/FieldLocator.java 2007-06-25 17:59:10 UTC (rev 2671)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/FieldLocator.java 2007-06-25 19:16:42 UTC (rev 2672)
@@ -34,7 +34,7 @@
@Override
public void reportMatches(final RubyScript script, final MatchLocator locator) {
if (!this.pattern.findReferences) { // just traverse our own model
- reportMatches((IParent) script, locator);
+ reportMatches((IParent) script, locator);
} else { // they want references too, so we need to traverse the AST
reportASTMatches(script, locator);
}
@@ -130,11 +130,11 @@
IRubyElement[] children = parent.getChildren();
for (int i = 0; i < children.length; i++) {
IRubyElement child = children[i];
- if (child.isType(IRubyElement.FIELD) ||
+ if ((child.isType(IRubyElement.FIELD) ||
child.isType(IRubyElement.GLOBAL) ||
child.isType(IRubyElement.CONSTANT) ||
child.isType(IRubyElement.CLASS_VAR) ||
- child.isType(IRubyElement.INSTANCE_VAR)) {
+ child.isType(IRubyElement.INSTANCE_VAR)) && (locator.encloses(child))) {
int accuracy = getAccuracy(child.getElementName());
if (accuracy != IMPOSSIBLE_MATCH) {
IMember member = (IMember) child;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/TypeDeclarationLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/TypeDeclarationLocator.java 2007-06-25 17:59:10 UTC (rev 2671)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/TypeDeclarationLocator.java 2007-06-25 19:16:42 UTC (rev 2672)
@@ -28,7 +28,7 @@
IRubyElement[] children = parent.getChildren();
for (int i = 0; i < children.length; i++) {
IRubyElement child = children[i];
- if (child.isType(IRubyElement.TYPE)) {
+ if (child.isType(IRubyElement.TYPE) && locator.encloses(child)) {
int accuracy = getAccuracy((IType) child);
if (accuracy != IMPOSSIBLE_MATCH) {
IMember member = (IMember) child;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java 2007-06-25 17:59:10 UTC (rev 2671)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Util.java 2007-06-25 19:16:42 UTC (rev 2672)
@@ -794,7 +794,7 @@
return true;
}
- private static String[] getTypeNameParts(String fullyQualifiedName) {
+ public static String[] getTypeNameParts(String fullyQualifiedName) {
return fullyQualifiedName.split(NAMESPACE_DELIMETER);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-25 17:59:11
|
Revision: 2671
http://svn.sourceforge.net/rubyeclipse/?rev=2671&view=rev
Author: cawilliams
Date: 2007-06-25 10:59:10 -0700 (Mon, 25 Jun 2007)
Log Message:
-----------
close #4913 - Listen for end of launches created by updates in GemManager and refresh the GemsView
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-06-25 16:32:00 UTC (rev 2670)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-06-25 17:59:10 UTC (rev 2671)
@@ -335,11 +335,24 @@
*
* @see com.aptana.rdt.internal.gems.IGemManager#update(com.aptana.rdt.internal.gems.Gem)
*/
- public boolean update(Gem gem) {
+ public boolean update(final Gem gem) {
try {
String command = UPDATE_COMMAND + " " + gem.getName();
ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
- config.launch(ILaunchManager.RUN_MODE, null);
+ final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
+ Job job = new Job("Notify gem listeners of uninstalled gem") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ while (!launch.isTerminated()) {
+ Thread.yield();
+ }
+ refresh();
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
} catch (CoreException e) {
AptanaRDTPlugin.log(e);
return false;
@@ -418,7 +431,7 @@
*
* @see com.aptana.rdt.internal.gems.IGemManager#installGem(com.aptana.rdt.internal.gems.Gem)
*/
- public boolean installGem(Gem gem) {
+ public boolean installGem(final Gem gem) {
try {
String command = INSTALL_COMMAND + " " + gem.getName();
if (gem.getVersion() != null
@@ -426,8 +439,24 @@
command += " " + VERSION_SWITCH + " " + gem.getVersion();
}
ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
- config.launch(ILaunchManager.RUN_MODE, null);
- // FIXME Listen for end of launch and then notify listeners
+ final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
+ Job job = new Job("Notify gem listeners of uninstalled gem") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ while (!launch.isTerminated()) {
+ Thread.yield();
+ }
+ refresh();
+ // Need to wait until uninstall is finished
+ for (GemListener listener : listeners) {
+ listener.gemAdded(gem);
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
} catch (CoreException e) {
AptanaRDTPlugin.log(e);
return false;
@@ -638,7 +667,20 @@
public boolean updateAll() {
try {
ILaunchConfiguration config = createGemLaunchConfiguration(UPDATE_COMMAND, true);
- config.launch(ILaunchManager.RUN_MODE, null);
+ final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
+ Job job = new Job("Notify gem listeners of uninstalled gem") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ while (!launch.isTerminated()) {
+ Thread.yield();
+ }
+ refresh();
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
} catch (CoreException e) {
AptanaRDTPlugin.log(e);
return false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-25 16:32:04
|
Revision: 2670
http://svn.sourceforge.net/rubyeclipse/?rev=2670&view=rev
Author: cawilliams
Date: 2007-06-25 09:32:00 -0700 (Mon, 25 Jun 2007)
Log Message:
-----------
fix all sorts of problems with not adhering to user preferences with the errors/warnings
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/AccidentalBooleanAssignmentVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/ComparableInclusionVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/EnumerableInclusionVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LocalsMaskingMethodsVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SimilarVariableNameVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SubclassCallsSuper.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyArgumentsVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyBranchesVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyLinesVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyLocalsVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyReturnsVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnecessaryElseVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnusedParameterVisitor.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnusedPrivateMethodVisitor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/AccidentalBooleanAssignmentVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/AccidentalBooleanAssignmentVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/AccidentalBooleanAssignmentVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -14,7 +14,7 @@
public class AccidentalBooleanAssignmentVisitor extends RubyLintVisitor {
public AccidentalBooleanAssignmentVisitor(String contents) {
- super(contents);
+ super(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/ComparableInclusionVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/ComparableInclusionVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/ComparableInclusionVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -23,7 +23,7 @@
private ISourcePosition pos;
public ComparableInclusionVisitor(String code) {
- super(code);
+ super(AptanaRDTPlugin.getDefault().getOptions(), code);
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/EnumerableInclusionVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/EnumerableInclusionVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/EnumerableInclusionVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -23,7 +23,7 @@
private ISourcePosition pos;
public EnumerableInclusionVisitor(String code) {
- super(code);
+ super(AptanaRDTPlugin.getDefault().getOptions(), code);
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LocalsMaskingMethodsVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LocalsMaskingMethodsVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/LocalsMaskingMethodsVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -17,7 +17,7 @@
private HashSet<String> methods;
public LocalsMaskingMethodsVisitor(String contents) {
- super(contents);
+ super(AptanaRDTPlugin.getDefault().getOptions(), contents);
locals = new ArrayList<LocalAsgnNode>();
methods = new HashSet<String>();
}
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/MisspelledConstructorVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -9,7 +9,7 @@
public class MisspelledConstructorVisitor extends RubyLintVisitor {
public MisspelledConstructorVisitor(String contents) {
- super(contents);
+ super(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
public Instruction visitDefnNode(DefnNode iVisited) {
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SimilarVariableNameVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SimilarVariableNameVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SimilarVariableNameVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -31,7 +31,7 @@
private List<Map<String, Node>> stack;
public SimilarVariableNameVisitor(String contents) {
- super(contents);
+ super(AptanaRDTPlugin.getDefault().getOptions(), contents);
stack = new ArrayList<Map<String, Node>>();
}
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SubclassCallsSuper.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SubclassCallsSuper.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/SubclassCallsSuper.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -17,7 +17,7 @@
private boolean isSubClass;
public SubclassCallsSuper(String contents) {
- super(contents);
+ super(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyArgumentsVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyArgumentsVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyArgumentsVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -13,15 +13,13 @@
public class TooManyArgumentsVisitor extends RubyLintVisitor {
private int maxArgLength;
- private Map fOptions;
public TooManyArgumentsVisitor(String contents) {
this(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
public TooManyArgumentsVisitor(Map options, String contents) {
- super(contents);
- fOptions = options;
+ super(options, contents);
maxArgLength = getInt(AptanaRDTPlugin.COMPILER_PB_MAX_ARGUMENTS, 5);
}
private int getInt(String key, int defaultValue) {
@@ -34,7 +32,7 @@
@Override
protected String getOptionKey() {
- return AptanaRDTPlugin.COMPILER_PB_MAX_ARGUMENTS;
+ return AptanaRDTPlugin.COMPILER_PB_CODE_COMPLEXITY_ARGUMENTS;
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyBranchesVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyBranchesVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyBranchesVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -6,7 +6,6 @@
import org.jruby.ast.DefnNode;
import org.jruby.ast.DefsNode;
import org.jruby.ast.IfNode;
-import org.jruby.ast.NewlineNode;
import org.jruby.ast.Node;
import org.jruby.ast.WhenNode;
import org.jruby.evaluator.Instruction;
@@ -18,15 +17,13 @@
private int maxBranches;
private int branchCount;
- private Map fOptions;
public TooManyBranchesVisitor(String contents) {
this(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
public TooManyBranchesVisitor(Map options, String contents) {
- super(contents);
- fOptions = options;
+ super(options, contents);
maxBranches = getInt(AptanaRDTPlugin.COMPILER_PB_MAX_BRANCHES, 5);
branchCount = 0;
}
@@ -40,7 +37,7 @@
@Override
protected String getOptionKey() {
- return AptanaRDTPlugin.COMPILER_PB_MAX_BRANCHES;
+ return AptanaRDTPlugin.COMPILER_PB_CODE_COMPLEXITY_BRANCHES;
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyLinesVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyLinesVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyLinesVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -13,15 +13,13 @@
public class TooManyLinesVisitor extends RubyLintVisitor {
private int maxLines;
- private Map fOptions;
public TooManyLinesVisitor(String contents) {
this(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
public TooManyLinesVisitor(Map options, String contents) {
- super(contents);
- fOptions = options;
+ super(options, contents);
maxLines = getInt(AptanaRDTPlugin.COMPILER_PB_MAX_LINES, 20);
}
private int getInt(String key, int defaultValue) {
@@ -34,7 +32,7 @@
@Override
protected String getOptionKey() {
- return AptanaRDTPlugin.COMPILER_PB_MAX_LINES;
+ return AptanaRDTPlugin.COMPILER_PB_CODE_COMPLEXITY_LINES;
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyLocalsVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyLocalsVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyLocalsVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -15,18 +15,15 @@
public class TooManyLocalsVisitor extends RubyLintVisitor {
-
private int maxLocals;
private Set locals;
- private Map fOptions;
public TooManyLocalsVisitor(String contents) {
this(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
public TooManyLocalsVisitor(Map options, String contents) {
- super(contents);
- fOptions = options;
+ super(options, contents);
maxLocals = getInt(AptanaRDTPlugin.COMPILER_PB_MAX_LOCALS, 4);
}
private int getInt(String key, int defaultValue) {
@@ -39,7 +36,7 @@
@Override
protected String getOptionKey() {
- return AptanaRDTPlugin.COMPILER_PB_MAX_LOCALS;
+ return AptanaRDTPlugin.COMPILER_PB_CODE_COMPLEXITY_LOCALS;
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyReturnsVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyReturnsVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/TooManyReturnsVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -14,15 +14,13 @@
private int maxReturns;
private int returnCount;
- private Map fOptions;
public TooManyReturnsVisitor(String contents) {
this(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
public TooManyReturnsVisitor(Map options, String contents) {
- super(contents);
- fOptions = options;
+ super(options, contents);
maxReturns = getInt(AptanaRDTPlugin.COMPILER_PB_MAX_RETURNS, 5);
returnCount = 0;
}
@@ -36,7 +34,7 @@
@Override
protected String getOptionKey() {
- return AptanaRDTPlugin.COMPILER_PB_MAX_RETURNS;
+ return AptanaRDTPlugin.COMPILER_PB_CODE_COMPLEXITY_RETURNS;
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnecessaryElseVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnecessaryElseVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnecessaryElseVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -19,7 +19,7 @@
public class UnecessaryElseVisitor extends RubyLintVisitor {
public UnecessaryElseVisitor(String contents) {
- super(contents);
+ super(AptanaRDTPlugin.getDefault().getOptions(), contents);
}
@Override
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnusedParameterVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnusedParameterVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnusedParameterVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -22,7 +22,7 @@
private Map<String, Node> declared;
public UnusedParameterVisitor(String contents) {
- super(contents);
+ super(AptanaRDTPlugin.getDefault().getOptions(), contents);
declared = new HashMap<String, Node>();
}
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnusedPrivateMethodVisitor.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnusedPrivateMethodVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/parser/warnings/UnusedPrivateMethodVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -23,7 +23,7 @@
private Visibility visibility;
public UnusedPrivateMethodVisitor(String contents) {
- super(contents);
+ super(AptanaRDTPlugin.getDefault().getOptions(), contents);
visibility = Visibility.PUBLIC;
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java 2007-06-22 19:27:56 UTC (rev 2669)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/warnings/RubyLintVisitor.java 2007-06-25 16:32:00 UTC (rev 2670)
@@ -2,6 +2,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import org.jruby.ast.BlockNode;
import org.jruby.ast.ClassNode;
@@ -25,11 +26,17 @@
public abstract class RubyLintVisitor extends AbstractVisitor {
private String contents;
+ protected Map fOptions;
private List<CategorizedProblem> problems;
public RubyLintVisitor(String contents) {
+ this(RubyCore.getOptions(), contents);
+ }
+
+ public RubyLintVisitor(Map options, String contents) {
this.problems = new ArrayList<CategorizedProblem>();
this.contents = contents;
+ this.fOptions = options;
}
protected String getSource(Node node) {
@@ -53,7 +60,7 @@
}
protected String getSeverity() {
- return RubyCore.getOption(getOptionKey());
+ return (String) fOptions.get(getOptionKey());
}
@Override
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-22 19:27:57
|
Revision: 2669
http://svn.sourceforge.net/rubyeclipse/?rev=2669&view=rev
Author: cawilliams
Date: 2007-06-22 12:27:56 -0700 (Fri, 22 Jun 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java 2007-06-22 16:24:36 UTC (rev 2668)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/comment/RubyCommentAutoIndentStrategy.java 2007-06-22 19:27:56 UTC (rev 2669)
@@ -8,14 +8,25 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.TextUtilities;
+import org.eclipse.ui.texteditor.ITextEditor;
+import org.rubypeople.rdt.core.IMethod;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.rubyeditor.WorkingCopyManager;
public class RubyCommentAutoIndentStrategy extends
DefaultIndentLineAutoEditStrategy {
private String fPartitioning;
+ private ITextEditor fEditor;
+ private WorkingCopyManager fManager;
- public RubyCommentAutoIndentStrategy(String partitioning) {
+ public RubyCommentAutoIndentStrategy(ITextEditor textEditor, String partitioning) {
fPartitioning = partitioning;
+ fEditor = textEditor;
+ fManager = RubyPlugin.getDefault().getWorkingCopyManager();
}
public void customizeDocumentCommand(IDocument document,
@@ -78,7 +89,9 @@
.getLength());
buf.append(indentation.substring(0, lengthToAdd));
-
+
+ String src = getRDoc(d, c.text, lineNumber + 1);
+ if (src != null) buf.append(src);
// move the caret behind the prefix, even if we do not have to
// insert it.
if (lengthToAdd < prefix.getLength())
@@ -90,6 +103,47 @@
}
}
+ private String getRDoc(IDocument d, String newLine, int line) {
+ IRubyScript script = fManager.getWorkingCopy(fEditor.getEditorInput());
+ int pos;
+ try {
+ IRegion region = d.getLineInformation(line);
+ pos = findEndOfWhiteSpace(d, region.getOffset(), region.getOffset() + region.getLength());
+ } catch (BadLocationException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return null;
+ }
+ IRubyElement element = null;
+ try {
+ element = script.getElementAt(pos);
+
+ if (element == null)
+ return null;
+ StringBuffer buffer = new StringBuffer();
+ if (element instanceof IMethod) {
+ IMethod method = (IMethod) element;
+ String[] names = method.getParameterNames();
+ for (int i = 0; i < names.length; i++) {
+ String name = names[i];
+ int end = name.indexOf(' ');
+ if (end != -1) {
+ name = name.substring(0, end);
+ }
+ buffer.append("+");
+ buffer.append(name);
+ buffer.append("+");
+ buffer.append(newLine);
+ }
+ }
+ return buffer.toString();
+ } catch (RubyModelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ return null;
+ }
+ }
+
private boolean isComment(String nextLineText) {
return nextLineText.matches("^\\s*#.*");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-22 16:24:38
|
Revision: 2668
http://svn.sourceforge.net/rubyeclipse/?rev=2668&view=rev
Author: cawilliams
Date: 2007-06-22 09:24:36 -0700 (Fri, 22 Jun 2007)
Log Message:
-----------
open confirmation dialog when user hits del key to delete a gem
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java 2007-06-22 16:22:12 UTC (rev 2667)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java 2007-06-22 16:24:36 UTC (rev 2668)
@@ -6,6 +6,7 @@
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent;
@@ -50,7 +51,9 @@
if (e.keyCode == SWT.DEL) {
TableItem item = gemTable.getItem(gemTable.getSelectionIndex());
Gem gem = (Gem) item.getData();
- GemManager.getInstance().removeGem(gem);
+ if (MessageDialog.openConfirm(gemTable.getShell(), null, GemsMessages.bind(GemsMessages.RemoveGemDialog_msg, gem.getName()))) {
+ GemManager.getInstance().removeGem(gem);
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-22 16:22:22
|
Revision: 2667
http://svn.sourceforge.net/rubyeclipse/?rev=2667&view=rev
Author: cawilliams
Date: 2007-06-22 09:22:12 -0700 (Fri, 22 Jun 2007)
Log Message:
-----------
listen for user hitting delete key on local gems listing, if they do, remove the selected gem
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java 2007-06-22 16:12:05 UTC (rev 2666)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java 2007-06-22 16:22:12 UTC (rev 2667)
@@ -8,6 +8,8 @@
import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
@@ -15,6 +17,7 @@
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.part.ViewPart;
import org.rubypeople.rdt.ui.TableViewerSorter;
@@ -32,20 +35,36 @@
parent.setLayout(new GridLayout());
gemViewer = new TableViewer(parent, SWT.SINGLE | SWT.FULL_SELECTION);
- Table serverTable = gemViewer.getTable();
- serverTable.setHeaderVisible(true);
- serverTable.setLinesVisible(false);
- serverTable.setLayoutData(new GridData(GridData.FILL_BOTH));
+ final Table gemTable = gemViewer.getTable();
+ gemTable.setHeaderVisible(true);
+ gemTable.setLinesVisible(false);
+ gemTable.setLayoutData(new GridData(GridData.FILL_BOTH));
- TableColumn nameColumn = new TableColumn(serverTable, SWT.LEFT);
+ gemTable.addKeyListener(new KeyListener() {
+
+ public void keyReleased(KeyEvent e) {
+ // ignore
+ }
+
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == SWT.DEL) {
+ TableItem item = gemTable.getItem(gemTable.getSelectionIndex());
+ Gem gem = (Gem) item.getData();
+ GemManager.getInstance().removeGem(gem);
+ }
+ }
+
+ });
+
+ TableColumn nameColumn = new TableColumn(gemTable, SWT.LEFT);
nameColumn.setText(GemsMessages.GemsView_NameColumn_label);
nameColumn.setWidth(150);
- TableColumn versionColumn = new TableColumn(serverTable, SWT.LEFT);
+ TableColumn versionColumn = new TableColumn(gemTable, SWT.LEFT);
versionColumn.setText(GemsMessages.GemsView_VersionColumn_label);
versionColumn.setWidth(75);
- TableColumn descriptionColumn = new TableColumn(serverTable, SWT.LEFT);
+ TableColumn descriptionColumn = new TableColumn(gemTable, SWT.LEFT);
descriptionColumn
.setText(GemsMessages.GemsView_DescriptionColumn_label);
descriptionColumn.setWidth(275);
@@ -55,6 +74,7 @@
TableViewerSorter.bind(gemViewer);
getSite().setSelectionProvider(gemViewer);
+
gemViewer.setInput(GemManager.getInstance().getGems());
createPopupMenu();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-22 16:12:10
|
Revision: 2666
http://svn.sourceforge.net/rubyeclipse/?rev=2666&view=rev
Author: cawilliams
Date: 2007-06-22 09:12:05 -0700 (Fri, 22 Jun 2007)
Log Message:
-----------
when gem has multiple versions, ask user which they'd like to uninstall. Listen to end of uninstall, and then refresh the gem listing and notify listeners
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/Gem.java
trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/IGemManager.java
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.java
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.properties
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java
Added Paths:
-----------
trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/RemoveGemDialog.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/Gem.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/Gem.java 2007-06-22 15:54:13 UTC (rev 2665)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/Gem.java 2007-06-22 16:12:05 UTC (rev 2666)
@@ -1,5 +1,9 @@
package com.aptana.rdt.core.gems;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
public class Gem implements Comparable {
private String name;
@@ -63,4 +67,18 @@
return getName().toLowerCase() + " " + getVersion() + " " + getPlatform();
}
+ public boolean hasMultipleVersions() {
+ return version != null && version.indexOf(",") != -1;
+ }
+
+ public List<String> versions() {
+ List<String> versions = new ArrayList<String>();
+ if (version == null) return versions;
+ StringTokenizer tokenizer = new StringTokenizer(version, ",");
+ while (tokenizer.hasMoreTokens()) {
+ versions.add(tokenizer.nextToken().trim());
+ }
+ return versions;
+ }
+
}
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/IGemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/IGemManager.java 2007-06-22 15:54:13 UTC (rev 2665)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/core/gems/IGemManager.java 2007-06-22 16:12:05 UTC (rev 2666)
@@ -31,5 +31,7 @@
public abstract IPath getGemPath(String gemName, String version);
public abstract boolean updateAll();
+
+ public abstract boolean isInitialized();
}
\ No newline at end of file
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-06-22 15:54:13 UTC (rev 2665)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemManager.java 2007-06-22 16:12:05 UTC (rev 2666)
@@ -44,6 +44,8 @@
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.IProcess;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.widgets.Display;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.launching.IVMInstall;
import org.rubypeople.rdt.launching.RubyRuntime;
@@ -56,6 +58,7 @@
import com.aptana.rdt.core.gems.GemListener;
import com.aptana.rdt.core.gems.IGemManager;
import com.aptana.rdt.ui.gems.GemsMessages;
+import com.aptana.rdt.ui.gems.RemoveGemDialog;
public class GemManager implements IGemManager {
@@ -80,6 +83,8 @@
private Set<Gem> remoteGems;
private Set<GemListener> listeners;
private IPath fGemInstallPath;
+
+ protected boolean isInitialized;
private GemManager() {
gems = new HashSet<Gem>();
@@ -111,6 +116,7 @@
gems = loadLocalGems();
storeGemCache(gems, getConfigFile(LOCAL_GEMS_CACHE_FILE));
}
+ isInitialized = true;
synchronized (listeners) {
for (GemListener listener : listeners) {
listener.gemsRefreshed();
@@ -122,6 +128,10 @@
};
job2.schedule();
}
+
+ public boolean isInitialized() {
+ return isInitialized;
+ }
protected Set<Gem> loadLocalCache(File file) {
FileReader fileReader = null;
@@ -417,6 +427,7 @@
}
ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
config.launch(ILaunchManager.RUN_MODE, null);
+ // FIXME Listen for end of launch and then notify listeners
} catch (CoreException e) {
AptanaRDTPlugin.log(e);
return false;
@@ -432,22 +443,45 @@
*
* @see com.aptana.rdt.internal.gems.IGemManager#removeGem(com.aptana.rdt.internal.gems.Gem)
*/
- public boolean removeGem(Gem gem) {
+ public boolean removeGem(final Gem gem) {
+ if (gem.hasMultipleVersions()) {
+ RemoveGemDialog dialog = new RemoveGemDialog(Display.getDefault().getActiveShell(), gem.versions());
+ if (dialog.open() == Dialog.OK) {
+ return removeGem(new Gem(gem.getName(), dialog.getVersion(), null));
+ } else {
+ return false;
+ }
+ }
try {
- String command = UNINSTALL_COMMAND + " " + gem.getName();
+ String command = UNINSTALL_COMMAND + " " + gem.getName();
if (gem.getVersion() != null
&& gem.getVersion().trim().length() > 0) {
command += " " + VERSION_SWITCH + " " + gem.getVersion();
}
ILaunchConfiguration config = createGemLaunchConfiguration(command, true);
- config.launch(ILaunchManager.RUN_MODE, null);
+ final ILaunch launch = config.launch(ILaunchManager.RUN_MODE, null);
+ Job job = new Job("Notify gem listeners of uninstalled gem") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ while (!launch.isTerminated()) {
+ Thread.yield();
+ }
+ refresh();
+ // Need to wait until uninstall is finished
+ for (GemListener listener : listeners) {
+ listener.gemRemoved(gem);
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
} catch (CoreException e) {
AptanaRDTPlugin.log(e);
return false;
}
- for (GemListener listener : listeners) {
- listener.gemRemoved(gem);
- } // FIXME Need to wait until uninstall is finished!
+
return true;
}
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.java 2007-06-22 15:54:13 UTC (rev 2665)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.java 2007-06-22 16:12:05 UTC (rev 2666)
@@ -15,6 +15,8 @@
public static String GemManager_loading_local_gems;
public static String GemManager_loading_remote_gems;
public static String RemoveGemDialog_msg;
+ public static String RemoveGemDialog_dialog_title;
+ public static String RemoveGemDialog_version_label;
static {
NLS.initializeMessages(BUNDLE_NAME, GemsMessages.class);
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.properties
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.properties 2007-06-22 15:54:13 UTC (rev 2665)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsMessages.properties 2007-06-22 16:12:05 UTC (rev 2666)
@@ -9,4 +9,7 @@
GemManager_loading_local_gems=Loading local gem information
GemManager_loading_remote_gems=Loading remote gem information
-RemoveGemDialog_msg=Are you sure you want to remove the gem {0}?
\ No newline at end of file
+RemoveGemDialog_msg=Are you sure you want to remove the gem {0}?
+
+RemoveGemDialog_version_label=Version:
+RemoveGemDialog_dialog_title=Which Version?
\ No newline at end of file
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java 2007-06-22 15:54:13 UTC (rev 2665)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/GemsView.java 2007-06-22 16:12:05 UTC (rev 2666)
@@ -112,7 +112,7 @@
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- gemViewer.add(gem);
+ gemViewer.setInput(GemManager.getInstance().getGems());
}
});
@@ -122,7 +122,7 @@
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- gemViewer.remove(gem);
+ gemViewer.setInput(GemManager.getInstance().getGems());
}
});
Added: trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/RemoveGemDialog.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/RemoveGemDialog.java (rev 0)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/ui/gems/RemoveGemDialog.java 2007-06-22 16:12:05 UTC (rev 2666)
@@ -0,0 +1,70 @@
+package com.aptana.rdt.ui.gems;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+public class RemoveGemDialog extends Dialog {
+
+ private Combo versionCombo;
+ private String version;
+ private List<String> versions;
+
+ public RemoveGemDialog(Shell parentShell, List<String> versions) {
+ super(parentShell);
+ this.versions = versions;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ getShell().setText(GemsMessages.RemoveGemDialog_dialog_title);
+
+ Composite control = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ control.setLayout(layout);
+
+ Label versionLabel = new Label(control, SWT.LEFT);
+ versionLabel.setText(GemsMessages.RemoveGemDialog_version_label);
+
+ versionCombo = new Combo(control, SWT.DROP_DOWN);
+ GridData versionComboData = new GridData();
+ versionComboData.widthHint = 100;
+ versionCombo.setLayoutData(versionComboData);
+
+ for (String version : versions) {
+ versionCombo.add(version);
+ }
+ // Set the oldest version as default option
+ if (versions != null && !versions.isEmpty()) {
+ versionCombo.select(versions.size() - 1);
+ }
+ return control;
+ }
+
+ /**
+ * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
+ */
+ public void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ version = versionCombo.getText();
+ okPressed();
+ } else if (buttonId == IDialogConstants.CANCEL_ID) {
+ cancelPressed();
+ }
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-22 15:54:15
|
Revision: 2665
http://svn.sourceforge.net/rubyeclipse/?rev=2665&view=rev
Author: cawilliams
Date: 2007-06-22 08:54:13 -0700 (Fri, 22 Jun 2007)
Log Message:
-----------
handle when version has more/less than 3 parts
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/LogicalGem.java
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/LogicalGem.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/LogicalGem.java 2007-06-21 18:55:17 UTC (rev 2664)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/LogicalGem.java 2007-06-22 15:54:13 UTC (rev 2665)
@@ -50,12 +50,19 @@
List<Integer> v1Parts = getParts(v1);
List<Integer> v2Parts = getParts(v2);
- for (int i = 0; i <= 3; i++) {
+ int blah = Math.min(v1Parts.size(), v2Parts.size());
+ for (int i = 0; i < blah; i++) {
Integer one = v1Parts.get(i);
Integer two = v2Parts.get(i);
int result = one.compareTo(two);
if (result != 0) return result;
}
+ // if parts sizes aren't equal, the one with more parts is newer.
+ if (v1Parts.size() > v2Parts.size()) {
+ return 1;
+ } else if (v2Parts.size() > v1Parts.size()) {
+ return -1;
+ }
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-21 18:55:18
|
Revision: 2664
http://svn.sourceforge.net/rubyeclipse/?rev=2664&view=rev
Author: cawilliams
Date: 2007-06-21 11:55:17 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java 2007-06-21 18:55:10 UTC (rev 2663)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyAutoIndentStrategy.java 2007-06-21 18:55:17 UTC (rev 2664)
@@ -99,7 +99,11 @@
IRegion previousLineRegion = d.getLineInformation(line - 1);
String previousIndent= indenter.computeIndentation(previousLineRegion.getOffset()).toString();
// FIXME This all assumes spaces!
- String unindented = previousIndent.substring(0, previousIndent.length() - CodeFormatterUtil.createIndentString(1, fProject).length());
+ int length = previousIndent.length() - CodeFormatterUtil.createIndentString(1, fProject).length();
+ String unindented = previousIndent;
+ if (length > 0) {
+ unindented = previousIndent.substring(0, length);
+ }
if (!unindented.equals(indent.toString())) {
d.replace(start, c.offset - start, unindented + trimmed);
int shift = previousIndent.length() - unindented.length();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-21 18:55:14
|
Revision: 2663
http://svn.sourceforge.net/rubyeclipse/?rev=2663&view=rev
Author: cawilliams
Date: 2007-06-21 11:55:10 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-06-21 18:00:26 UTC (rev 2662)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/ExternalRubyScript.java 2007-06-21 18:55:10 UTC (rev 2663)
@@ -36,11 +36,9 @@
}
final char[] contents = buffer == null ? null : buffer.getCharacters();
try {
- RubyParser parser = new RubyParser();
- Node node = parser.parse(null, new CharArrayReader(contents));
RubyScriptStructureBuilder visitor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
SourceElementParser sp = new SourceElementParser(visitor);
- if (node != null) node.accept(sp);
+ sp.parse(contents, null);
unitInfo.setIsStructureKnown(true);
} catch (SyntaxException e) {
unitInfo.setIsStructureKnown(false);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-06-21 18:00:26 UTC (rev 2662)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyScript.java 2007-06-21 18:55:10 UTC (rev 2663)
@@ -39,6 +39,7 @@
import org.eclipse.core.runtime.Path;
import org.jruby.ast.Node;
import org.jruby.ast.RootNode;
+import org.jruby.evaluator.Instruction;
import org.jruby.lexer.yacc.SyntaxException;
import org.rubypeople.rdt.core.CompletionRequestor;
import org.rubypeople.rdt.core.IBuffer;
@@ -133,12 +134,17 @@
Node ast = null;
try {
- RubyParser parser = new RubyParser();
- ast = parser.parse((IFile) getResource(), new CharArrayReader(contents));
- lastGoodAST = ast;
ISourceElementRequestor requestor = new RubyScriptStructureBuilder(this, unitInfo, newElements);
- SourceElementParser sp = new SourceElementParser(requestor);
- if (ast != null) ast.accept(sp);
+ SourceElementParser sp = new SourceElementParser(requestor){
+
+ @Override
+ public Instruction visitRootNode(RootNode iVisited) {
+ lastGoodAST = iVisited;
+ return super.visitRootNode(iVisited);
+ }
+ };
+ sp.parse(contents, null);
+ ast = lastGoodAST;
unitInfo.setIsStructureKnown(true);
} catch (SyntaxException e) {
unitInfo.setIsStructureKnown(false);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-21 18:00:26 UTC (rev 2662)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-21 18:55:10 UTC (rev 2663)
@@ -92,6 +92,7 @@
private boolean inSingletonClass;
public ISourceElementRequestor requestor;
private boolean inModuleFunction;
+ private char[] source;
/**
*
@@ -529,6 +530,7 @@
public void parse(char[] source, char[] name) {
RubyParser p = new RubyParser();
+ this.source = source;
Node ast = p.parse(new String(source));
acceptNode(ast);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-21 18:00:32
|
Revision: 2662
http://svn.sourceforge.net/rubyeclipse/?rev=2662&view=rev
Author: cawilliams
Date: 2007-06-21 11:00:26 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
when folding region hits EOF, handle it (rather than quietly eat a BadLocationException) so we can still fold a type/method that ends at EOF
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java 2007-06-21 17:21:19 UTC (rev 2661)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java 2007-06-21 18:00:26 UTC (rev 2662)
@@ -273,7 +273,12 @@
int end = fCachedDocument.getLineOfOffset(region.getOffset() + region.getLength());
if (start != end) {
int offset = fCachedDocument.getLineOffset(start);
- int endOffset = fCachedDocument.getLineOffset(end + 1);
+ int endOffset = -1;
+ if ((end + 1) == fCachedDocument.getNumberOfLines()) {
+ endOffset = fCachedDocument.getLength();
+ } else {
+ endOffset = fCachedDocument.getLineOffset(end + 1);
+ }
return new Position(offset, endOffset - offset);
}
} catch (BadLocationException x) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-21 17:21:23
|
Revision: 2661
http://svn.sourceforge.net/rubyeclipse/?rev=2661&view=rev
Author: cawilliams
Date: 2007-06-21 10:21:19 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
allow folding of comments that immediately preced the definition of a type or method
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/util/RDocUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/util/RDocUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/util/RDocUtil.java 2007-06-21 16:45:35 UTC (rev 2660)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/util/RDocUtil.java 2007-06-21 17:21:19 UTC (rev 2661)
@@ -7,6 +7,8 @@
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
import org.jruby.Ruby;
import org.jruby.ast.CommentNode;
import org.jruby.exceptions.RaiseException;
@@ -178,4 +180,41 @@
}
return fgRdocScriptPath;
}
+
+ public static IRegion getDocumentationRegion(IRubyElement element) {
+ IMember member = (IMember) element;
+ String src = "";
+ int elementOffset = -1;
+ try {
+ src = member.getRubyScript().getSource();
+ elementOffset = member.getSourceRange().getOffset();
+ } catch (RubyModelException e) {
+ return null;
+ }
+ RubyParser parser = new RubyParser();
+ parser.parse(src); // parse so we can grab the comment nodes
+ Collection<CommentNode> comments = parser.getComments();
+ if (member.isType(IRubyElement.TYPE) || member.isType(IRubyElement.METHOD)) {
+ return getPrecedingCommentRegion(comments, elementOffset, src);
+ }
+ return null;
+ }
+
+ private static IRegion getPrecedingCommentRegion(Collection<CommentNode> comments, int elementStart, String src) {
+ for (CommentNode comment : comments) {
+ ISourcePosition pos = comment.getPosition();
+ if (pos.getEndOffset() > elementStart) continue;
+ String between = src.substring(pos.getEndOffset(), elementStart);
+ if (between.trim().length() > 0)
+ continue; // if there's anything but whitespace between (\n\r\t ), move to next comment
+ IRegion preceding = getPrecedingCommentRegion(comments, pos.getStartOffset(), src);
+ if (preceding == null) {
+ preceding = new Region(pos.getStartOffset(), pos.getEndOffset() - pos.getStartOffset());
+ } else {
+ preceding = new Region(preceding.getOffset(), pos.getEndOffset() - preceding.getOffset());
+ }
+ return preceding;
+ }
+ return null;
+ }
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java 2007-06-21 16:45:35 UTC (rev 2660)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java 2007-06-21 17:21:19 UTC (rev 2661)
@@ -44,6 +44,7 @@
import org.rubypeople.rdt.core.IType;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.core.util.RDocUtil;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyAbstractEditor;
import org.rubypeople.rdt.internal.ui.rubyeditor.RubyEditor;
@@ -246,7 +247,10 @@
List regions = new ArrayList();
int shift = range.getOffset();
int start = shift;
-
+
+ IRegion region = RDocUtil.getDocumentationRegion(element);
+ if (region != null)
+ regions.add(region);
regions.add(new Region(start, range.getOffset() + range.getLength() - start));
if (regions.size() > 0) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-21 16:45:37
|
Revision: 2660
http://svn.sourceforge.net/rubyeclipse/?rev=2660&view=rev
Author: cawilliams
Date: 2007-06-21 09:45:35 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
add proper support for regex partitions
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-06-21 16:44:58 UTC (rev 2659)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-06-21 16:45:35 UTC (rev 2660)
@@ -243,7 +243,7 @@
}
private void addStringToken(int length) {
- push(new QueuedToken(new Token(RUBY_STRING), fOffset, length));
+ push(new QueuedToken(new Token(fContentType), fOffset, length));
setOffset(fOffset + length); // move past token
}
@@ -258,7 +258,11 @@
for (int i = 0; i < start; i++) {
fakeContents.append(" ");
}
- fakeContents.append('"');
+ if (fContentType.equals(RUBY_REGULAR_EXPRESSION)) {
+ fakeContents.append('/');
+ } else {
+ fakeContents.append('"');
+ }
if ((fOffset - origOffset) < origLength) {
fakeContents.append(new String(fContents.substring((fOffset - origOffset)))); // BLAH removed + 1 from end here
}
@@ -297,12 +301,13 @@
}
switch (i) {
case Tokens.tSTRING_CONTENT:
- return new Token(RUBY_STRING);
+ return new Token(fContentType);
case Tokens.tSTRING_BEG:
- String token = fContents.substring(fOffset, getOffset());
+ String token = fContents.substring(fOffset - origOffset, lexerSource.getOffset());
if (token.trim().equals("'")) {
inSingleQuote = true;
}
+ fContentType = RUBY_STRING;
return new Token(RUBY_STRING);
case Tokens.tQWORDS_BEG:
fContentType = RUBY_STRING;
@@ -312,8 +317,10 @@
inSingleQuote = false;
return new Token(RUBY_STRING);
case Tokens.tREGEXP_BEG:
+ fContentType = RUBY_REGULAR_EXPRESSION;
return new Token(RUBY_REGULAR_EXPRESSION);
case Tokens.tREGEXP_END:
+ fContentType = RUBY_DEFAULT;
return new Token(RUBY_REGULAR_EXPRESSION);
default:
return new Token(RUBY_DEFAULT);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java 2007-06-21 16:44:58 UTC (rev 2659)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/text/RubySourceViewerConfiguration.java 2007-06-21 16:45:35 UTC (rev 2660)
@@ -90,7 +90,7 @@
protected AbstractRubyTokenScanner fCodeScanner;
- protected AbstractRubyScanner fMultilineCommentScanner, fSinglelineCommentScanner, fStringScanner;
+ protected AbstractRubyScanner fMultilineCommentScanner, fSinglelineCommentScanner, fStringScanner, fRegexScanner;
private RubyDoubleClickSelector fRubyDoubleClickSelector;
private RubyCompletionProcessor fRubyCp;
@@ -169,7 +169,8 @@
*/
public boolean affectsTextPresentation(PropertyChangeEvent event) {
return fCodeScanner.affectsBehavior(event) || fMultilineCommentScanner.affectsBehavior(event)
- || fSinglelineCommentScanner.affectsBehavior(event) || fStringScanner.affectsBehavior(event);
+ || fSinglelineCommentScanner.affectsBehavior(event) || fStringScanner.affectsBehavior(event)
+ || fRegexScanner.affectsBehavior(event);
}
/**
@@ -196,6 +197,8 @@
fSinglelineCommentScanner.adaptToPreferenceChange(event);
if (fStringScanner.affectsBehavior(event))
fStringScanner.adaptToPreferenceChange(event);
+ if (fRegexScanner.affectsBehavior(event))
+ fRegexScanner.adaptToPreferenceChange(event);
}
/**
@@ -209,6 +212,7 @@
fMultilineCommentScanner = new RubyCommentScanner(getColorManager(), fPreferenceStore, IRubyColorConstants.RUBY_MULTI_LINE_COMMENT);
fSinglelineCommentScanner = new RubyCommentScanner(getColorManager(), fPreferenceStore, IRubyColorConstants.RUBY_SINGLE_LINE_COMMENT);
fStringScanner = new SingleTokenRubyScanner(getColorManager(), fPreferenceStore, IRubyColorConstants.RUBY_STRING);
+ fRegexScanner = new SingleTokenRubyScanner(getColorManager(), fPreferenceStore, IRubyColorConstants.RUBY_REGEXP);
}
/**
@@ -249,6 +253,10 @@
dr = new DefaultDamagerRepairer(getStringScanner());
reconciler.setDamager(dr, RubyPartitionScanner.RUBY_STRING);
reconciler.setRepairer(dr, RubyPartitionScanner.RUBY_STRING);
+
+ dr = new DefaultDamagerRepairer(getRegexScanner());
+ reconciler.setDamager(dr, RubyPartitionScanner.RUBY_REGULAR_EXPRESSION);
+ reconciler.setRepairer(dr, RubyPartitionScanner.RUBY_REGULAR_EXPRESSION);
return reconciler;
}
@@ -267,9 +275,13 @@
protected ITokenScanner getStringScanner() {
return fStringScanner;
}
+
+ protected ITokenScanner getRegexScanner() {
+ return fRegexScanner;
+ }
public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
- return new String[] { IDocument.DEFAULT_CONTENT_TYPE, RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, RubyPartitionScanner.RUBY_STRING };
+ return new String[] { IDocument.DEFAULT_CONTENT_TYPE, RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, RubyPartitionScanner.RUBY_STRING, RubyPartitionScanner.RUBY_REGULAR_EXPRESSION };
}
/*
@@ -305,7 +317,7 @@
public IAutoEditStrategy[] getAutoEditStrategies(ISourceViewer sourceViewer, String contentType) {
String partitioning = getConfiguredDocumentPartitioning(sourceViewer);
if (IRubyPartitions.RUBY_SINGLE_LINE_COMMENT.equals(contentType)) {
- return new IAutoEditStrategy[] { new RubyCommentAutoIndentStrategy(partitioning) };
+ return new IAutoEditStrategy[] { new RubyCommentAutoIndentStrategy(fTextEditor, partitioning) };
} else if (IDocument.DEFAULT_CONTENT_TYPE.equals(contentType)) {
return new IAutoEditStrategy[] { new RubyAutoIndentStrategy(partitioning, getProject()) };
} else {
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-06-21 16:44:58 UTC (rev 2659)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-06-21 16:45:35 UTC (rev 2660)
@@ -229,4 +229,20 @@
assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 42)); // 1'}' t
assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 44)); // 't'here
}
+
+ public void testRegex() {
+ String code = "regex = /hi there/";
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // re'g'ex
+ assertEquals(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, this.getContentType(code, 9)); // '/'hi the
+ assertEquals(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, this.getContentType(code, 11)); // /h'i' the
+ }
+
+ public void testRegexWithDynamicCode() {
+ String code = "/\\.#{Regexp.escape(extension.to_s)}$/ # comment";
+ assertEquals(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, this.getContentType(code, 3));
+ assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 38)); // '#' co
+ assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 40)); // # 'c'ommen
+ }
+
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-21 16:45:03
|
Revision: 2659
http://svn.sourceforge.net/rubyeclipse/?rev=2659&view=rev
Author: cawilliams
Date: 2007-06-21 09:44:58 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
oops, body node may be null somtimes. so just take end and subtract two (we used to subtract one, subtract another for the newline)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-21 15:29:32 UTC (rev 2658)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-21 16:44:58 UTC (rev 2659)
@@ -127,7 +127,7 @@
requestor.enterType(typeInfo);
Instruction ins = super.visitClassNode(iVisited);
- requestor.exitType(iVisited.getBodyNode().getPosition().getEndOffset() + 3); //'end'.length()
+ requestor.exitType(iVisited.getPosition().getEndOffset() - 2);
return ins;
}
@@ -153,7 +153,7 @@
Instruction ins = super.visitModuleNode(iVisited);
- requestor.exitType(iVisited.getBodyNode().getPosition().getEndOffset() + 3); //'end'.length()
+ requestor.exitType(iVisited.getPosition().getEndOffset() - 2);
inModuleFunction = false;
return ins;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-21 15:29:35
|
Revision: 2658
http://svn.sourceforge.net/rubyeclipse/?rev=2658&view=rev
Author: cawilliams
Date: 2007-06-21 08:29:32 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
fix #4315 - Code Folding too much
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-21 14:43:48 UTC (rev 2657)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-21 15:29:32 UTC (rev 2658)
@@ -122,13 +122,12 @@
typeInfo.superclass = superClass;
}
typeInfo.isModule = false;
- typeInfo.modules = new String[0]; // FIXME Set up the modules as we go, or proactively dive into AST to grab these?
+ typeInfo.modules = new String[0];
typeInfo.secondary = false; // TODO Set secondary to true if we're enclosed by another type?
requestor.enterType(typeInfo);
Instruction ins = super.visitClassNode(iVisited);
-
- requestor.exitType(iVisited.getPosition().getEndOffset() - 1);
+ requestor.exitType(iVisited.getBodyNode().getPosition().getEndOffset() + 3); //'end'.length()
return ins;
}
@@ -154,7 +153,7 @@
Instruction ins = super.visitModuleNode(iVisited);
- requestor.exitType(iVisited.getPosition().getEndOffset() - 1);
+ requestor.exitType(iVisited.getBodyNode().getPosition().getEndOffset() + 3); //'end'.length()
inModuleFunction = false;
return ins;
}
@@ -184,11 +183,11 @@
}
Instruction ins = super.visitDefnNode(iVisited); // now traverse it's body
-
+ int end = iVisited.getPosition().getEndOffset() - 2;
if (methodInfo.isConstructor) {
- requestor.exitConstructor(iVisited.getPosition().getEndOffset());
+ requestor.exitConstructor(end);
} else {
- requestor.exitMethod(iVisited.getPosition().getEndOffset());
+ requestor.exitMethod(end);
}
return ins;
}
@@ -208,7 +207,7 @@
Instruction ins = super.visitDefsNode(iVisited); // now traverse it's body
- requestor.exitMethod(iVisited.getPosition().getEndOffset());
+ requestor.exitMethod(iVisited.getPosition().getEndOffset() - 2);
return ins;
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java 2007-06-21 14:43:48 UTC (rev 2657)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/folding/DefaultRubyFoldingStructureProvider.java 2007-06-21 15:29:32 UTC (rev 2658)
@@ -239,9 +239,9 @@
if (element instanceof ISourceReference) {
ISourceReference reference = (ISourceReference) element;
ISourceRange range = reference.getSourceRange();
- // TODO Uncomment when getSource is set up right!
- // String contents = reference.getSource();
- // if (contents == null) return null;
+
+ String contents = reference.getSource();
+ if (contents == null) return null;
List regions = new ArrayList();
int shift = range.getOffset();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-21 14:43:50
|
Revision: 2657
http://svn.sourceforge.net/rubyeclipse/?rev=2657&view=rev
Author: cawilliams
Date: 2007-06-21 07:43:48 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
add tests and fixes for more advanced code/string substitution scenarios
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-06-20 21:12:15 UTC (rev 2656)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-06-21 14:43:48 UTC (rev 2657)
@@ -66,6 +66,7 @@
private List<QueuedToken> fQueue = new ArrayList<QueuedToken>();
private String fContentType;
+ private boolean inSingleQuote;
// XXX Also do regex partitions!
public final static String RUBY_MULTI_LINE_COMMENT = IRubyPartitions.RUBY_MULTI_LINE_COMMENT;
@@ -115,6 +116,7 @@
lexer.setState(LexState.EXPR_BEG);
parserSupport.initTopLocalVariables();
fQueue.clear();
+ inSingleQuote = false;
}
public int getTokenLength() {
@@ -139,12 +141,12 @@
returnValue = Token.EOF;
} else {
int lexerToken = lexer.token();
- if (lexerToken == Tokens.tSTRING_DVAR) { // we hit a single dynamic variable
+ if (!inSingleQuote && lexerToken == Tokens.tSTRING_DVAR) { // we hit a single dynamic variable
addPoundToken();
scanDynamicVariable();
setLexerPastDynamicSectionOfString();
return popTokenOffQueue();
- } else if (lexerToken == Tokens.tSTRING_DBEG) { // if we hit dynamic code inside a string
+ } else if (!inSingleQuote && lexerToken == Tokens.tSTRING_DBEG) { // if we hit dynamic code inside a string
addPoundBraceToken();
scanTokensInsideDynamicPortion();
addClosingBraceToken();
@@ -216,7 +218,7 @@
private void scanTokensInsideDynamicPortion() {
String possible = new String(fContents.substring(fOffset - origOffset));
- int end = possible.indexOf('}');// TODO Find the end brace '}' in a proper way!
+ int end = findEnd(possible);
if (end != -1) {
possible = possible.substring(0, end);
} else {
@@ -232,6 +234,10 @@
setOffset(fOffset + possible.length());
}
+ private int findEnd(String possible) {
+ return new EndBraceFinder(possible).find();
+ }
+
private void addPoundBraceToken() {
addStringToken(2); // add token for the #{
}
@@ -293,12 +299,17 @@
case Tokens.tSTRING_CONTENT:
return new Token(RUBY_STRING);
case Tokens.tSTRING_BEG:
+ String token = fContents.substring(fOffset, getOffset());
+ if (token.trim().equals("'")) {
+ inSingleQuote = true;
+ }
return new Token(RUBY_STRING);
case Tokens.tQWORDS_BEG:
fContentType = RUBY_STRING;
return new Token(RUBY_STRING);
case Tokens.tSTRING_END:
fContentType = RUBY_DEFAULT;
+ inSingleQuote = false;
return new Token(RUBY_STRING);
case Tokens.tREGEXP_BEG:
return new Token(RUBY_REGULAR_EXPRESSION);
@@ -310,15 +321,6 @@
}
/**
- * Grabs the end of the comment
- * @param comments
- * @return
- */
- private int getEndOfComment(CommentNode comment) {
- return origOffset + comment.getPosition().getEndOffset();
- }
-
- /**
* correct start offset, since when a line with nothing but spaces on it appears before comment,
* we get messed up positions
*/
@@ -365,4 +367,73 @@
setPartialRange(document, offset, length, null, -1);
}
+ private static class EndBraceFinder {
+ private String input;
+ private List<String> stack;
+
+ public EndBraceFinder(String possible) {
+ this.input = possible;
+ stack = new ArrayList<String>();
+ }
+
+ public int find() {
+ for (int i = 0; i < input.length(); i++) {
+ char c = input.charAt(i);
+ switch (c) {
+ case '"':
+ if (topEquals("\"")) {
+ pop();
+ } else {
+ push("\"");
+ }
+ break;
+ case '\'':
+ if (topEquals("'")) {
+ pop();
+ } else {
+ push("'");
+ }
+ break;
+ case '#':
+ // Only add if we're inside a double quote string
+ if (topEquals("\"")) {
+ c = input.charAt(i + 1);
+ if (c == '{')
+ push("#{");
+ }
+ break;
+ case '}':
+ if (stack.isEmpty()) { // if not in open state
+ return i;
+ }
+ if (topEquals("#{")) {
+ pop();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return -1;
+ }
+
+ private boolean topEquals(String string) {
+ String open = peek();
+ return open != null && open.equals(string);
+ }
+
+ private boolean push(String string) {
+ return stack.add(string);
+ }
+
+ private String pop() {
+ return stack.remove(stack.size() - 1);
+ }
+
+ private String peek() {
+ if (stack.isEmpty())
+ return null;
+ return stack.get(stack.size() - 1);
+ }
+ }
}
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-06-20 21:12:15 UTC (rev 2656)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-06-21 14:43:48 UTC (rev 2657)
@@ -40,8 +40,8 @@
public void testRecognizeSpecialCase() {
String source = "a,b=?#,'This is not a comment!'\n";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 5));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 6));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 5));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 6));
}
public void testMultilineComment() {
@@ -62,43 +62,43 @@
public void testMultilineCommentNotOnFirstColumn() {
String source = " =begin\nComment\n=end";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 0));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 1));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 2));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 10));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 1));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 2));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 10));
}
public void testRecognizeDivision() {
String source = "1/3 #This is a comment\n";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 0));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 3));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 3));
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 5));
}
public void testRecognizeOddballCharacters() {
String source = "?\" #comment\n";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 0));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 2));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 2));
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 5));
source = "?' #comment\n";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 0));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 2));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 2));
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 5));
source = "?/ #comment\n";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 0));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 2));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 2));
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 5));
}
public void testPoundCharacterIsntAComment() {
String source = "?#";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(source, 1));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 1));
}
public void testSinglelineCommentJustAfterMultilineComment() {
@@ -114,13 +114,13 @@
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 6));
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 17));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 26));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 29));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 26));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 29));
}
public void testCommentAfterEnd() {
String code = "class Chris\nend # comment\n";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 12));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 12));
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 17));
}
@@ -134,7 +134,7 @@
" def thing\r\n" +
" end #ocmm \r\n" +
"end";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 76));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 76));
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 83));
}
@@ -144,16 +144,16 @@
" 123\n" +
" }\n" +
"}";
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 0));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 4));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 6));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 0));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 4));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 6));
assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 8));
assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 12));
assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 18));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 19));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 22));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 19));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 22));
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 25));
}
@@ -165,8 +165,8 @@
" \n" +
" end";
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 5));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 14));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 20));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 14));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 20));
}
public void testCommentsWithAlotOfPrecedingSpaces() {
@@ -174,7 +174,59 @@
" # caller-requested until.\n" +
"return self\n";
assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 16));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 63));
- assertEquals(IDocument.DEFAULT_CONTENT_TYPE, this.getContentType(code, 70));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 63));
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 70));
}
+
+ public void testCodeWithinString() {
+ String code = "string = \"here's some code: #{1} there\"";
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'{1...
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 30)); // '1'} t...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 31)); // '}' th...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 35)); // th'e're..
+ }
+
+ public void testCodeWithinSingleQuoteString() {
+ String code = "string = 'here s some code: #{1} there'";
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'{1...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 30)); // '1'} t...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 31)); // '}' th...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 35)); // th'e're..
+ }
+
+ public void testVariableSubstitutionWithinString() {
+ String code = "string = \"here's some code: #$global there\"";
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'$glo...
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 29)); // '$'global
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 36));// ' 'there...
+ }
+
+ public void testStringWithinCodeWithinString() {
+ String code = "string = \"here's some code: #{var = 'string'} there\"";
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'{var
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 30)); // 'v'ar =
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 36)); // '''string
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 46)); // 't'here
+ }
+
+ public void testStringWithEndBraceWithinCodeWithinString() {
+ String code = "string = \"here's some code: #{var = '}'; 1} there\"";
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'{var
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 30)); // 'v'ar =
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 37)); // '}';
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 39)); // ';' 1}
+ assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 41)); // ; '1'}
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 42)); // 1'}' t
+ assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 44)); // 't'here
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 21:12:17
|
Revision: 2656
http://svn.sourceforge.net/rubyeclipse/?rev=2656&view=rev
Author: cawilliams
Date: 2007-06-20 14:12:15 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
clean up some warnings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java 2007-06-20 21:10:46 UTC (rev 2655)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java 2007-06-20 21:12:15 UTC (rev 2656)
@@ -1,6 +1,5 @@
package org.rubypeople.rdt.internal.debug.ui.launcher;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -25,10 +24,10 @@
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
public class RubyArgumentsTab extends AbstractLaunchConfigurationTab {
+
protected Text interpreterArgsText, programArgsText;
protected DirectorySelector workingDirectorySelector;
protected Button useDefaultWorkingDirectoryButton;
- private IProject rubyProject ;
public RubyArgumentsTab() {
super();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 21:10:47
|
Revision: 2655
http://svn.sourceforge.net/rubyeclipse/?rev=2655&view=rev
Author: cawilliams
Date: 2007-06-20 14:10:46 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
clean up some warnings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAction.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAction.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAction.java 2007-06-20 21:09:40 UTC (rev 2654)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/OpenEditorAction.java 2007-06-20 21:10:46 UTC (rev 2655)
@@ -87,10 +87,10 @@
protected abstract void reveal(ITextEditor editor);
protected IType findType(IRubyProject project, String className) throws RubyModelException {
- return internalFindType(project, className, new HashSet());
+ return internalFindType(project, className, new HashSet<IRubyProject>());
}
- private IType internalFindType(IRubyProject project, String className, Set/*<IRubyProject>*/ visitedProjects) throws RubyModelException {
+ private IType internalFindType(IRubyProject project, String className, Set<IRubyProject> visitedProjects) throws RubyModelException {
if (visitedProjects.contains(project))
return null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 21:09:42
|
Revision: 2654
http://svn.sourceforge.net/rubyeclipse/?rev=2654&view=rev
Author: cawilliams
Date: 2007-06-20 14:09:40 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
clean up some warnings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search/MockTreeViewer.java
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search/MockTreeViewer.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search/MockTreeViewer.java 2007-06-20 21:01:14 UTC (rev 2653)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search/MockTreeViewer.java 2007-06-20 21:09:40 UTC (rev 2654)
@@ -13,6 +13,7 @@
import java.util.Hashtable;
import java.util.List;
+import java.util.Map;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.swt.events.TreeListener;
@@ -20,19 +21,18 @@
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Widget;
-
public class MockTreeViewer extends AbstractTreeViewer {
- private Hashtable hashtable = new Hashtable() ;
+ private Map<Object, Object> hashtable = new Hashtable<Object, Object>();
public void add(Object parentElement, Object childElement) {
- hashtable.put(parentElement, childElement) ;
+ hashtable.put(parentElement, childElement);
}
public boolean isParentAdded(Object parentElement) {
- return hashtable.containsKey(parentElement) ;
+ return hashtable.containsKey(parentElement);
}
public Object childFrom(Object parentElement) {
- return hashtable.get(parentElement) ;
+ return hashtable.get(parentElement);
}
protected void addTreeListener(Control control, TreeListener listener) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 21:01:16
|
Revision: 2653
http://svn.sourceforge.net/rubyeclipse/?rev=2653&view=rev
Author: cawilliams
Date: 2007-06-20 14:01:14 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
clean up some warnings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java 2007-06-20 21:00:22 UTC (rev 2652)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamMarkerManager.java 2007-06-20 21:01:14 UTC (rev 2653)
@@ -11,11 +11,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
-import org.jruby.lexer.yacc.ISourcePosition;
import org.jruby.lexer.yacc.SyntaxException;
-import org.rubypeople.eclipse.shams.resources.ShamFile;
import org.rubypeople.rdt.core.compiler.IProblem;
-import org.rubypeople.rdt.internal.core.parser.RdtPosition;
import org.rubypeople.rdt.internal.core.parser.TaskTag;
import org.rubypeople.rdt.internal.core.util.ListUtil;
@@ -27,8 +24,7 @@
private int lineArg;
private int startOffsetArg;
private int endOffsetArg;
- private SyntaxException syntaxExceptionArg;
- private List resourcesRemoved = new ArrayList();
+ private List<IResource> resourcesRemoved = new ArrayList<IResource>();
public void removeProblemsAndTasksFor(IResource resource) {
resourcesRemoved.add(resource);
@@ -45,7 +41,6 @@
}
public void createSyntaxError(IFile file, SyntaxException syntaxException) {
fileArg = file;
- syntaxExceptionArg = syntaxException;
}
public void createTasks(IFile file, List<TaskTag> tasks) throws CoreException {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 21:00:23
|
Revision: 2652
http://svn.sourceforge.net/rubyeclipse/?rev=2652&view=rev
Author: cawilliams
Date: 2007-06-20 14:00:22 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
clean up some warnings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerProxyTest.java
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/TestRubyDebugTarget.java
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyArgumentsTab.java
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerProxyTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerProxyTest.java 2007-06-20 20:58:42 UTC (rev 2651)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerProxyTest.java 2007-06-20 21:00:22 UTC (rev 2652)
@@ -13,7 +13,6 @@
import org.eclipse.core.runtime.CoreException;
import org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy;
import org.rubypeople.rdt.internal.debug.core.RubyExceptionBreakpoint;
-import org.rubypeople.rdt.internal.debug.core.model.ThreadInfo;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserFactory;
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/TestRubyDebugTarget.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/TestRubyDebugTarget.java 2007-06-20 20:58:42 UTC (rev 2651)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/TestRubyDebugTarget.java 2007-06-20 21:00:22 UTC (rev 2652)
@@ -1,6 +1,7 @@
package org.rubypeople.rdt.debug.core.tests;
import java.util.ArrayList;
+import java.util.List;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.debug.core.DebugException;
@@ -15,13 +16,13 @@
import org.rubypeople.rdt.internal.debug.core.model.IRubyDebugTarget;
public class TestRubyDebugTarget implements IRubyDebugTarget {
- private ArrayList suspensionPoints = new ArrayList() ;
+ private List<SuspensionPoint> suspensionPoints = new ArrayList<SuspensionPoint>();
public SuspensionPoint getLastSuspensionPoint() {
- if (suspensionPoints.size() == 0) {
- return null ;
+ if (suspensionPoints.isEmpty()) {
+ return null;
}
- return (SuspensionPoint) suspensionPoints.get(suspensionPoints.size()-1);
+ return suspensionPoints.get(suspensionPoints.size()-1);
}
@@ -29,7 +30,7 @@
}
public void suspensionOccurred(SuspensionPoint suspensionPoint) {
- suspensionPoints.add(suspensionPoint) ;
+ suspensionPoints.add(suspensionPoint);
}
public void terminate() {
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyArgumentsTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyArgumentsTab.java 2007-06-20 20:58:42 UTC (rev 2651)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyArgumentsTab.java 2007-06-20 21:00:22 UTC (rev 2652)
@@ -5,8 +5,6 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.rubypeople.eclipse.shams.debug.core.ShamLaunchConfigurationWorkingCopy;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
-import org.rubypeople.rdt.internal.debug.ui.launcher.RubyArgumentsTab;
-import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
public class TC_RubyArgumentsTab extends TestCase {
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java 2007-06-20 20:58:42 UTC (rev 2651)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyEntryPointTab.java 2007-06-20 21:00:22 UTC (rev 2652)
@@ -5,8 +5,6 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.rubypeople.eclipse.shams.debug.core.ShamLaunchConfigurationWorkingCopy;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
-import org.rubypeople.rdt.internal.debug.ui.launcher.RubyEntryPointTab;
-import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
public class TC_RubyEntryPointTab extends TestCase {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 20:58:43
|
Revision: 2651
http://svn.sourceforge.net/rubyeclipse/?rev=2651&view=rev
Author: cawilliams
Date: 2007-06-20 13:58:42 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
clean up some warnings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/ArgumentSplitter.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_ArgumentSplitter.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/ArgumentSplitter.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/ArgumentSplitter.java 2007-06-20 20:56:30 UTC (rev 2650)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/ArgumentSplitter.java 2007-06-20 20:58:42 UTC (rev 2651)
@@ -6,20 +6,20 @@
public class ArgumentSplitter {
- private List args;
+ private List<String> args;
private StringBuffer currentArg;
private boolean inQuotedArg;
private char expectedCloseQuote;
- public static List split(String input) {
+ public static List<String> split(String input) {
return new ArgumentSplitter().internalSplit(input);
}
private ArgumentSplitter() {}
- private List internalSplit(String input) {
+ private List<String> internalSplit(String input) {
currentArg = new StringBuffer();
- args = new ArrayList();
+ args = new ArrayList<String>();
for (int i=0; i< input.length(); i++) {
char c = input.charAt(i);
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_ArgumentSplitter.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_ArgumentSplitter.java 2007-06-20 20:56:30 UTC (rev 2650)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_ArgumentSplitter.java 2007-06-20 20:58:42 UTC (rev 2651)
@@ -43,7 +43,7 @@
}
private void verifySplit(String[] expected, String input) {
- List args = ArgumentSplitter.split(input);
- assertEquals("For input: "+input, new ArrayList(Arrays.asList(expected)), args);
+ List<String> args = ArgumentSplitter.split(input);
+ assertEquals("For input: "+input, new ArrayList<String>(Arrays.asList(expected)), args);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 20:56:32
|
Revision: 2650
http://svn.sourceforge.net/rubyeclipse/?rev=2650&view=rev
Author: cawilliams
Date: 2007-06-20 13:56:30 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
clean up some warnings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java
Modified: trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java 2007-06-20 20:55:15 UTC (rev 2649)
+++ trunk/org.rubypeople.rdt.debug.core/src/org/rubypeople/rdt/internal/debug/core/model/RubyDebugTarget.java 2007-06-20 20:56:30 UTC (rev 2650)
@@ -5,12 +5,10 @@
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
-import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
-import org.eclipse.core.internal.runtime.FindSupport;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.PlatformObject;
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java 2007-06-20 20:55:15 UTC (rev 2649)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/RubySourceLocator.java 2007-06-20 20:56:30 UTC (rev 2650)
@@ -14,7 +14,6 @@
import org.eclipse.ui.part.FileEditorInput;
import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
import org.rubypeople.rdt.internal.debug.core.model.RubyStackFrame;
-import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
import org.rubypeople.rdt.internal.ui.rubyeditor.ExternalRubyFileEditorInput;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.ui.IRubyConstants;
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java 2007-06-20 20:55:15 UTC (rev 2649)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java 2007-06-20 20:56:30 UTC (rev 2650)
@@ -25,7 +25,6 @@
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
-import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.launching.RubyRuntime;
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java 2007-06-20 20:55:15 UTC (rev 2649)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java 2007-06-20 20:56:30 UTC (rev 2650)
@@ -19,9 +19,8 @@
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
-import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
-import org.rubypeople.rdt.internal.ui.RubyPluginImages;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.RubyPluginImages;
import org.rubypeople.rdt.internal.ui.util.RubyFileSelector;
import org.rubypeople.rdt.internal.ui.util.RubyProjectSelector;
import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 20:55:16
|
Revision: 2649
http://svn.sourceforge.net/rubyeclipse/?rev=2649&view=rev
Author: cawilliams
Date: 2007-06-20 13:55:15 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
remove unused imports
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/FieldPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/LocalVariablePattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-20 20:53:28 UTC (rev 2648)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceElementParser.java 2007-06-20 20:55:15 UTC (rev 2649)
@@ -24,7 +24,6 @@
*/
package org.rubypeople.rdt.internal.core;
-import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -47,14 +46,11 @@
import org.jruby.ast.FCallNode;
import org.jruby.ast.GlobalAsgnNode;
import org.jruby.ast.GlobalVarNode;
-import org.jruby.ast.IArgumentNode;
import org.jruby.ast.InstAsgnNode;
import org.jruby.ast.InstVarNode;
import org.jruby.ast.IterNode;
-import org.jruby.ast.ListNode;
import org.jruby.ast.LocalAsgnNode;
import org.jruby.ast.ModuleNode;
-import org.jruby.ast.MultipleAsgnNode;
import org.jruby.ast.Node;
import org.jruby.ast.RootNode;
import org.jruby.ast.SClassNode;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/FieldPattern.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/FieldPattern.java 2007-06-20 20:53:28 UTC (rev 2648)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/FieldPattern.java 2007-06-20 20:55:15 UTC (rev 2649)
@@ -13,7 +13,6 @@
import org.rubypeople.rdt.core.search.SearchPattern;
import org.rubypeople.rdt.internal.core.search.indexing.IIndexConstants;
import org.rubypeople.rdt.internal.core.util.CharOperation;
-import org.rubypeople.rdt.internal.core.util.Util;
public class FieldPattern extends VariablePattern implements IIndexConstants {
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/LocalVariablePattern.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/LocalVariablePattern.java 2007-06-20 20:53:28 UTC (rev 2648)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/LocalVariablePattern.java 2007-06-20 20:55:15 UTC (rev 2649)
@@ -15,7 +15,6 @@
import org.eclipse.core.runtime.OperationCanceledException;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.ISourceFolderRoot;
-import org.rubypeople.rdt.core.IType;
import org.rubypeople.rdt.core.search.IRubySearchScope;
import org.rubypeople.rdt.core.search.SearchParticipant;
import org.rubypeople.rdt.internal.core.LocalVariable;
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java 2007-06-20 20:53:28 UTC (rev 2648)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/formatter/OldCodeFormatter.java 2007-06-20 20:55:15 UTC (rev 2649)
@@ -8,7 +8,6 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.text.edits.ReplaceEdit;
import org.eclipse.text.edits.TextEdit;
-import org.jruby.ast.NextNode;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.formatter.CodeFormatter;
import org.rubypeople.rdt.core.formatter.DefaultCodeFormatterConstants;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-06-20 20:53:31
|
Revision: 2648
http://svn.sourceforge.net/rubyeclipse/?rev=2648&view=rev
Author: cawilliams
Date: 2007-06-20 13:53:28 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
clean up some warnings
Modified Paths:
--------------
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java 2007-06-20 20:47:59 UTC (rev 2647)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/ui/FailureTab.java 2007-06-20 20:53:28 UTC (rev 2648)
@@ -34,7 +34,6 @@
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.rubypeople.rdt.testunit.ITestRunListener;
@@ -273,10 +272,6 @@
new OpenTestAction(fRunnerViewPart, getClassName(), getMethodName(), true).run();
}
- private Shell getShell() {
- return fTable.getShell();
- }
-
/*
* @see ITestRunView#testStatusChanged(TestRunInfo)
*/
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java 2007-06-20 20:47:59 UTC (rev 2647)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/wizards/RubyNewTestCaseWizardPage.java 2007-06-20 20:53:28 UTC (rev 2648)
@@ -383,6 +383,9 @@
IRubyElement jelem= getInitialRubyElement(selection);
initContainerPage(jelem);
initTypePage(jelem);
+
+ restoreWidgetValues();
+
doStatusUpdate();
// boolean createConstructors= false;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|