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-04-20 17:18:21
|
Revision: 2347
http://svn.sourceforge.net/rubyeclipse/?rev=2347&view=rev
Author: cawilliams
Date: 2007-04-20 10:18:15 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
handle getting occurences for BlockArgNode
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2007-04-20 16:52:46 UTC (rev 2346)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultOccurrencesFinder.java 2007-04-20 17:18:15 UTC (rev 2347)
@@ -6,6 +6,7 @@
import org.eclipse.jface.text.Position;
import org.jruby.ast.ArgumentNode;
+import org.jruby.ast.BlockArgNode;
import org.jruby.ast.BlockNode;
import org.jruby.ast.ClassNode;
import org.jruby.ast.ClassVarAsgnNode;
@@ -591,7 +592,7 @@
// TODO refactor the getting-of-name
String name = null;
- if (isLocalVarRef(node) || isDVarRef(node) || isInstanceVarRef(node) || isGlobalVarRef(node) || isClassVarRef(node) || isConstRef(node)) {
+ if (isLocalVarRef(node) || isDVarRef(node) || isInstanceVarRef(node) || isGlobalVarRef(node) || isClassVarRef(node) || isConstRef(node) || node instanceof BlockArgNode) {
name = ASTUtil.getNameReflectively(node);
} else if (node instanceof ClassNode) {
name = getClassNodeName((ClassNode) node);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-20 16:53:09
|
Revision: 2346
http://svn.sourceforge.net/rubyeclipse/?rev=2346&view=rev
Author: cawilliams
Date: 2007-04-20 09:52:46 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/InOrderVisitor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/MarkerUtility.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RdtWarnings.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-04-20 13:18:24 UTC (rev 2345)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-04-20 16:52:46 UTC (rev 2346)
@@ -56,7 +56,6 @@
import org.rubypeople.rdt.internal.core.builder.MassIndexUpdaterJob;
import org.rubypeople.rdt.internal.core.builder.RubyBuilder;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
-import org.rubypeople.rdt.internal.core.search.indexing.IndexManager;
import org.rubypeople.rdt.internal.core.symbols.ISymbolFinder;
import org.rubypeople.rdt.internal.core.symbols.SymbolIndex;
import org.rubypeople.rdt.internal.core.util.MementoTokenizer;
@@ -245,6 +244,13 @@
* @see #getDefaultOptions()
* @since 0.9.0
*/
+ public static final String COMPILER_PB_UNREACHABLE_CODE = PLUGIN_ID + ".compiler.problem.unreachableCode"; //$NON-NLS-1$
+
+ /**
+ * Possible configurable option ID.
+ * @see #getDefaultOptions()
+ * @since 0.9.0
+ */
public static final String CODEASSIST_CAMEL_CASE_MATCH = PLUGIN_ID + ".codeComplete.camelCaseMatch"; //$NON-NLS-1$
// FIXME Rename to CORE_INCOMPLETE_LOADPATH
@@ -1331,39 +1337,76 @@
return newContainerEntry(path, LoadpathEntry.NO_EXTRA_ATTRIBUTES, isExported);
}
+ /**
+ * Returns the Ruby model element corresponding to the given handle identifier
+ * generated by <code>IRubyElement.getHandleIdentifier()</code>, or
+ * <code>null</code> if unable to create the associated element.
+ *
+ * @param handleIdentifier the given handle identifier
+ * @return the Ruby element corresponding to the handle identifier
+ */
+ public static IRubyElement create(String handleIdentifier) {
+ return create(handleIdentifier, DefaultWorkingCopyOwner.PRIMARY);
+ }
+
+ /**
+ * Returns the Ruby model element corresponding to the given handle identifier
+ * generated by <code>IRubyElement.getHandleIdentifier()</code>, or
+ * <code>null</code> if unable to create the associated element.
+ * If the returned Ruby element is an <code>ICompilationUnit</code>, its owner
+ * is the given owner if such a working copy exists, otherwise the compilation unit
+ * is a primary compilation unit.
+ *
+ * @param handleIdentifier the given handle identifier
+ * @param owner the owner of the returned compilation unit, ignored if the returned
+ * element is not a compilation unit
+ * @return the Ruby element corresponding to the handle identifier
+ * @since 3.0
+ */
+ public static IRubyElement create(String handleIdentifier, WorkingCopyOwner owner) {
+ if (handleIdentifier == null) {
+ return null;
+ }
+ MementoTokenizer memento = new MementoTokenizer(handleIdentifier);
+ RubyModel model = RubyModelManager.getRubyModelManager().getRubyModel();
+ return model.getHandleFromMemento(memento, owner);
+ }
+
/**
- * Returns the Ruby model element corresponding to the given handle identifier
- * generated by <code>IRubyElement.getHandleIdentifier()</code>, or
- * <code>null</code> if unable to create the associated element.
- *
- * @param handleIdentifier the given handle identifier
- * @return the Ruby element corresponding to the handle identifier
+ * Creates and returns a new loadpath entry of kind <code>CPE_SOURCE</code>
+ * for the project's source folder identified by the given absolute
+ * workspace-relative path but excluding all source files with paths
+ * matching any of the given patterns.
+ * <p>
+ * The convenience method is fully equivalent to:
+ * <pre>
+ * newSourceEntry(path, new IPath[] {}, exclusionPatterns, null);
+ * </pre>
+ * </p>
+ *
+ * @param path the absolute workspace-relative path of a source folder
+ * @param exclusionPatterns the possibly empty list of exclusion patterns
+ * represented as relative paths
+ * @return a new source loadpath entry
+ * @see #newSourceEntry(IPath, IPath[], IPath[], IPath)
+ * @since 2.1
*/
- public static IRubyElement create(String handleIdentifier) {
- return create(handleIdentifier, DefaultWorkingCopyOwner.PRIMARY);
+ public static ILoadpathEntry newSourceEntry(IPath path, IPath[] exclusionPatterns) {
+ return newSourceEntry(path, LoadpathEntry.INCLUDE_ALL, exclusionPatterns, LoadpathEntry.NO_EXTRA_ATTRIBUTES);
}
/**
- * Returns the Ruby model element corresponding to the given handle identifier
- * generated by <code>IRubyElement.getHandleIdentifier()</code>, or
- * <code>null</code> if unable to create the associated element.
- * If the returned Ruby element is an <code>ICompilationUnit</code>, its owner
- * is the given owner if such a working copy exists, otherwise the compilation unit
- * is a primary compilation unit.
+ * Creates and returns a compilation unit element for
+ * the given source file (i.e. a file with one of the {@link RubyCore#getRubyLikeExtensions()
+ * Java-like extensions}). Returns <code>null</code> if unable
+ * to recognize the compilation unit.
*
- * @param handleIdentifier the given handle identifier
- * @param owner the owner of the returned compilation unit, ignored if the returned
- * element is not a compilation unit
- * @return the Ruby element corresponding to the handle identifier
- * @since 3.0
+ * @param file the given source file
+ * @return a compilation unit element for the given source file, or <code>null</code> if unable
+ * to recognize the compilation unit
*/
- public static IRubyElement create(String handleIdentifier, WorkingCopyOwner owner) {
- if (handleIdentifier == null) {
- return null;
- }
- MementoTokenizer memento = new MementoTokenizer(handleIdentifier);
- RubyModel model = RubyModelManager.getRubyModelManager().getRubyModel();
- return model.getHandleFromMemento(memento, owner);
+ public static IRubyScript createRubyScriptFrom(IFile file) {
+ return RubyModelManager.createRubyScriptFrom(file, null/*unknown ruby project*/);
}
-}
\ No newline at end of file
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-04-20 13:18:24 UTC (rev 2345)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-04-20 16:52:46 UTC (rev 2346)
@@ -30,6 +30,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceChangeEvent;
@@ -72,6 +73,7 @@
import org.rubypeople.rdt.core.IProblemRequestor;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyModel;
+import org.rubypeople.rdt.core.IRubyModelMarker;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.ISourceFolder;
@@ -87,6 +89,7 @@
import org.rubypeople.rdt.internal.compiler.util.HashtableOfObjectToInt;
import org.rubypeople.rdt.internal.core.buffer.BufferManager;
import org.rubypeople.rdt.internal.core.builder.RubyBuilder;
+import org.rubypeople.rdt.internal.core.parser.MarkerUtility;
import org.rubypeople.rdt.internal.core.search.RubyWorkspaceScope;
import org.rubypeople.rdt.internal.core.search.indexing.IndexManager;
import org.rubypeople.rdt.internal.core.util.Messages;
@@ -604,7 +607,17 @@
}
public void acceptProblem(IProblem problem) {
- if (this.problemRequestor == null) return;
+ // Don't accept the problem if a marker already exists for this same problem...
+ try {
+ IResource resource = workingCopy.getUnderlyingResource();
+ IMarker marker = MarkerUtility.markerExists(resource, problem.getMessage(), problem.getSourceLineNumber(), IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER);
+ if (marker != null) return;
+ } catch (RubyModelException e) {
+ // ignore
+ } catch (CoreException e) {
+ // ignore
+ }
+ if (this.problemRequestor == null) return;
this.problemRequestor.acceptProblem(problem);
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/InOrderVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/InOrderVisitor.java 2007-04-20 13:18:24 UTC (rev 2345)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/InOrderVisitor.java 2007-04-20 16:52:46 UTC (rev 2346)
@@ -1153,7 +1153,7 @@
}
protected Instruction handleNode(Node visited) {
- return null;
+ return visitNode(visited);
}
/* (non-Javadoc)
@@ -1188,7 +1188,6 @@
@Override
protected Instruction visitNode(Node iVisited) {
- // TODO Auto-generated method stub
return null;
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/MarkerUtility.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/MarkerUtility.java 2007-04-20 13:18:24 UTC (rev 2345)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/MarkerUtility.java 2007-04-20 16:52:46 UTC (rev 2346)
@@ -70,12 +70,14 @@
public static void createProblemMarker(IResource underlyingResource, IProblem problem) {
try {
- IMarker marker = underlyingResource.createMarker(IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER);
+ IMarker marker = markerExists(underlyingResource, problem.getMessage(), problem.getSourceLineNumber(), IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER);
+ if (marker != null) return;
Map<String, Comparable> map = new HashMap<String, Comparable>();
int severity;
if(problem.isWarning()) severity = IMarker.SEVERITY_WARNING;
else if(problem.isError()) severity = IMarker.SEVERITY_ERROR;
else severity = IMarker.SEVERITY_INFO;
+ marker = underlyingResource.createMarker(IRubyModelMarker.RUBY_MODEL_PROBLEM_MARKER);
map.put(IMarker.SEVERITY, new Integer(severity));
map.put(IMarker.MESSAGE, problem.getMessage());
map.put(IMarker.USER_EDITABLE, Boolean.FALSE);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RdtWarnings.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RdtWarnings.java 2007-04-20 13:18:24 UTC (rev 2345)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RdtWarnings.java 2007-04-20 16:52:46 UTC (rev 2346)
@@ -9,19 +9,21 @@
import org.eclipse.core.resources.IFile;
import org.jruby.lexer.yacc.ISourcePosition;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.compiler.CategorizedProblem;
/**
* @author Chris
*/
public class RdtWarnings implements IRdtWarnings {
- private List<Warning> warnings;
+ private List<CategorizedProblem> warnings;
public RdtWarnings() {
- warnings = new ArrayList<Warning>();
+ warnings = new ArrayList<CategorizedProblem>();
}
- public List<Warning> getWarnings() {
+ public List<CategorizedProblem> getWarnings() {
return Collections.unmodifiableList(warnings);
}
@@ -54,6 +56,16 @@
if (message.startsWith("Useless")) {
return ;
}
+ if (message.equals("Statement not reached.")) { // TODO Categorize problems that JRuby provides in one place
+ String value = RubyCore.getOption(RubyCore.COMPILER_PB_UNREACHABLE_CODE);
+ if (value == null || value.equals(RubyCore.WARNING)) {
+ warnings.add(new Warning(position, message));
+ }
+ if (value != null && value.equals(RubyCore.ERROR)) {
+ warnings.add(new Error(position, message));
+ }
+ return;
+ }
warnings.add(new Warning(position, message));
}
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-04-20 13:18:24 UTC (rev 2345)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/BasicSearchEngine.java 2007-04-20 16:52:46 UTC (rev 2346)
@@ -13,6 +13,7 @@
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.core.RubyModelException;
import org.rubypeople.rdt.core.WorkingCopyOwner;
import org.rubypeople.rdt.core.search.IRubySearchConstants;
@@ -239,18 +240,23 @@
return RubyModelManager.getRubyModelManager().getWorkspaceScope();
}
- public static Collection<? extends IType> findType(String typeName) {
- SearchPattern pattern = SearchPattern.createPattern(IRubyElement.TYPE, typeName, IRubySearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH);
+ public static Collection<? extends IType> findType(String simpleTypeName) {
+ SearchPattern pattern = SearchPattern.createPattern(IRubyElement.TYPE, "*", IRubySearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH);
SearchParticipant[] participants = new SearchParticipant[] {getDefaultSearchParticipant()};
IRubySearchScope scope = createWorkspaceScope();
TypeRequestor requestor = new TypeRequestor();
try {
new BasicSearchEngine().search(pattern, participants, scope, requestor, null);
} catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ RubyCore.log(e);
}
- return requestor.getTypes();
+ List<IType> types = new ArrayList<IType>();
+ List<IType> matches = requestor.getTypes();
+ for (IType type : matches) {
+ if (Util.getSimpleName(type.getElementName()).equals(simpleTypeName))
+ types.add(type);
+ }
+ return types;
}
private static class TypeRequestor extends SearchRequestor {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-20 13:18:27
|
Revision: 2345
http://svn.sourceforge.net/rubyeclipse/?rev=2345&view=rev
Author: mirkostocker
Date: 2007-04-20 06:18:24 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
refactor the tests and remove some code..
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/FileTestData.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/RefactoringTestCase.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TreeProviderTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TwoLayerTreeEditProviderTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/convertlocaltofield/LocalToFieldTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/encapsulatefield/EncapsulateFieldTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateaccessors/GenerateAccessorTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateaccessors/TC_AccessorsGeneratorTreeTest.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateconstructor/ConstructorGeneratorTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlineclass/ClassInlinerTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlinelocal/LocalInlinerTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/mergeclasspartsinfile/ClassPartSelectorTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/mergewithexternalclassparts/MergeWithExternalClassPartsTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/movefield/MoveFieldTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/movemethod/MoveMethodTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/overridemethod/OverrideMethodTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/overridemethod/TC_OverridenMethodEditTest.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/pushdown/PushDownTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamefield/FieldRenamerTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemethod/MethodRenamerTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemethod/selection/RenameMethodSelectionTester.java
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/FileTestData.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/FileTestData.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/FileTestData.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -58,7 +58,7 @@
return fileName;
}
- public FileTestData(String fileName, Class<?> resourceProvier) throws FileNotFoundException, IOException {
+ public FileTestData(String fileName) throws FileNotFoundException, IOException {
this(fileName, ".test_source", ".test_result");
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/RefactoringTestCase.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/RefactoringTestCase.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/RefactoringTestCase.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -45,10 +45,6 @@
public RefactoringTestCase(String name) {
super(name);
}
-
- public RefactoringTestCase() {
- super(RefactoringTestCase.class.getSimpleName());
- }
protected void createEditAndCompareResult(String document, String expectedDocument, IEditProvider editProvider) throws BadLocationException {
String result;
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TreeProviderTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TreeProviderTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TreeProviderTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -33,8 +33,14 @@
import org.eclipse.jface.viewers.ITreeContentProvider;
-public abstract class TreeProviderTester extends RefactoringTestCase
-{
+public abstract class TreeProviderTester extends RefactoringTestCase {
+ public TreeProviderTester() {
+ this("Tree Provider Tester");
+ }
+
+ public TreeProviderTester(String fileName) {
+ super(fileName);
+ }
private Map<String, Entry> elements;
@@ -45,8 +51,7 @@
elements = new HashMap<String, Entry>();
}
- public void addContent(String[] content)
- {
+ public void addContent(String[] content) {
Map<String, Entry> aktMap = elements;
for (String str : content)
{
@@ -58,15 +63,12 @@
}
}
- public void validate(ITreeContentProvider provider)
- {
+ public void validate(ITreeContentProvider provider) {
this.provider = provider;
checkElements(elements, provider.getElements(null));
}
- private void checkElements(Map<String, Entry> expectedElements,
- Object[] elements)
- {
+ private void checkElements(Map<String, Entry> expectedElements, Object[] elements) {
assertNotNull(elements);
assertEquals(expectedElements.size(), elements.length);
@@ -85,30 +87,25 @@
}
}
- static class Entry
- {
+ static class Entry {
private String name;
private Map<String, Entry> childs;
- public Entry(String name)
- {
+ public Entry(String name) {
this.name = name;
childs = new HashMap<String, Entry>();
}
- public String getName()
- {
+ public String getName() {
return name;
}
- public void addChild(Entry child)
- {
+ public void addChild(Entry child) {
childs.put(child.getName(), child);
}
- public Map<String, Entry> getChilds()
- {
+ public Map<String, Entry> getChilds() {
return childs;
}
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TwoLayerTreeEditProviderTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TwoLayerTreeEditProviderTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TwoLayerTreeEditProviderTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -48,7 +48,8 @@
private boolean autoCheckChildrenOnParentCheck;
- public TwoLayerTreeEditProviderTester(boolean autoCheckChildrenOnParentCheck) {
+ public TwoLayerTreeEditProviderTester(String fileName, boolean autoCheckChildrenOnParentCheck) {
+ super(fileName);
this.autoCheckChildrenOnParentCheck = autoCheckChildrenOnParentCheck;
selections = new ArrayList<ItemSelection>();
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/convertlocaltofield/LocalToFieldTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/convertlocaltofield/LocalToFieldTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/convertlocaltofield/LocalToFieldTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -37,16 +37,13 @@
import org.rubypeople.rdt.refactoring.core.convertlocaltofield.LocalToFieldConditionChecker;
import org.rubypeople.rdt.refactoring.core.convertlocaltofield.LocalToFieldConfig;
import org.rubypeople.rdt.refactoring.core.convertlocaltofield.LocalToFieldConverter;
-import org.rubypeople.rdt.refactoring.tests.FilePropertyData;
import org.rubypeople.rdt.refactoring.tests.FileTestData;
import org.rubypeople.rdt.refactoring.tests.RefactoringTestCase;
public class LocalToFieldTester extends RefactoringTestCase {
- private String fileName;
-
public LocalToFieldTester(String fileName) {
- this.fileName = fileName;
+ super(fileName);
}
protected int getInitPlace(String initPlace) {
@@ -55,40 +52,25 @@
} else if (initPlace.equalsIgnoreCase("TempToFieldConverter.INIT_IN_CONSTRUCTOR")) {
return LocalToFieldConverter.INIT_IN_CONSTRUCTOR;
} else {
- assertTrue(false);
+ fail();
return 0;
}
-
}
- protected void runTempToFieldTest(FilePropertyData data, String sourceDocument, String expectedDocument, String newName, boolean isClassField, int initPlace,
- int cursorPosition) throws BadLocationException {
- LocalToFieldConfig config = new LocalToFieldConfig(data, cursorPosition);
+ @Override
+ public void runTest() throws FileNotFoundException, IOException, BadLocationException {
+ FileTestData data = new FileTestData(getName());
+ LocalToFieldConfig config = new LocalToFieldConfig(data, data.getIntProperty("cursorPosition"));
LocalToFieldConditionChecker checker = new LocalToFieldConditionChecker(config);
+
if (!checker.shouldPerform()) {
fail();
}
+
LocalToFieldConverter converter = new LocalToFieldConverter(config);
- converter.setInitPlace(initPlace);
- converter.setIsClassField(isClassField);
- converter.setNewName(newName);
- createEditAndCompareResult(sourceDocument, expectedDocument, converter);
+ converter.setInitPlace(getInitPlace(data.getProperty("initPlace")));
+ converter.setIsClassField(data.getBoolProperty("isClassField"));
+ converter.setNewName(data.getProperty("newName"));
+ createEditAndCompareResult(data.getSource(), data.getExpectedResult(), converter);
}
-
- @Override
- public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- FileTestData data = new FileTestData(fileName, getClass());
- String source = data.getSource();
- String expected = data.getExpectedResult();
- String newName = data.getProperty("newName");
- boolean isClassField = data.getBoolProperty("isClassField");
- int initPlace = getInitPlace(data.getProperty("initPlace"));
- int cursorPos = data.getIntProperty("cursorPosition");
- runTempToFieldTest(data, source, expected, newName, isClassField, initPlace, cursorPos);
- }
-
- @Override
- public String getName() {
- return fileName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/encapsulatefield/EncapsulateFieldTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/encapsulatefield/EncapsulateFieldTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/encapsulatefield/EncapsulateFieldTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -43,15 +43,13 @@
public class EncapsulateFieldTester extends RefactoringTestCase {
- private String testName;
-
public EncapsulateFieldTester(String fileName) {
- testName = fileName;
+ super(fileName);
}
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- FileTestData testData = new FileTestData(testName, getClass());
+ FileTestData testData = new FileTestData(getName());
EncapsulateFieldConfig config = new EncapsulateFieldConfig(testData, testData.getIntProperty("cursorPosition"));
EncapsulateFieldConditionChecker checker = new EncapsulateFieldConditionChecker(config);
@@ -87,10 +85,4 @@
fail();
return METHOD_VISIBILITY.NONE;
}
-
- @Override
- public String getName() {
- return testName;
- }
-
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateaccessors/GenerateAccessorTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateaccessors/GenerateAccessorTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateaccessors/GenerateAccessorTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -47,21 +47,18 @@
public class GenerateAccessorTester extends RefactoringTestCase {
- private String testName;
-
private AccessorsGenerator accessorsGenerator;
- private Collection<AccessorSelection> selections;
+ private Collection<AccessorSelection> selections = new ArrayList<AccessorSelection>();
public GenerateAccessorTester(String fileName) {
- testName = fileName;
- selections = new ArrayList<AccessorSelection>();
+ super(fileName);
}
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException {
FileTestData testData;
- testData = new FileTestData(testName, getClass());
+ testData = new FileTestData(getName());
int type = getAccessorType(testData);
accessorsGenerator = new AccessorsGenerator(testData, type);
Collection<String> strSelections = testData.getNumberedProperty("selection");
@@ -84,11 +81,6 @@
return -1;
}
- @Override
- public String getName() {
- return testName;
- }
-
protected void addSelection(String name, String attributeName, boolean readerSelected, boolean writerSelected) {
selections.add(new AccessorSelection(name, attributeName, readerSelected, writerSelected));
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateaccessors/TC_AccessorsGeneratorTreeTest.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateaccessors/TC_AccessorsGeneratorTreeTest.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateaccessors/TC_AccessorsGeneratorTreeTest.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -38,7 +38,7 @@
import org.rubypeople.rdt.refactoring.documentprovider.StringDocumentProvider;
import org.rubypeople.rdt.refactoring.tests.TreeProviderTester;
-public class TC_AccessorsGeneratorTreeTest extends TreeProviderTester{
+public class TC_AccessorsGeneratorTreeTest extends TreeProviderTester {
private final static String TEST_DOCUMENT_SIMPLE = "#ClassComment\n" +
"class X\n" +
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateconstructor/ConstructorGeneratorTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateconstructor/ConstructorGeneratorTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/generateconstructor/ConstructorGeneratorTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -43,16 +43,13 @@
public class ConstructorGeneratorTester extends TwoLayerTreeEditProviderTester {
- private String testName;
-
public ConstructorGeneratorTester(String fileName) {
- super(true);
- testName = fileName;
+ super(fileName, true);
}
@Override
public void runTest() throws FileNotFoundException, IOException, MalformedTreeException, BadLocationException {
- FileTestData testData = new FileTestData(testName, getClass());
+ FileTestData testData = new FileTestData(getName());
ConstructorsGenerator generator = new ConstructorsGenerator(testData);
Collection<String> strSelections = testData.getNumberedProperty("selection");
for (String aktSelection : strSelections) {
@@ -67,9 +64,4 @@
}
createEditAndCompareResult(testData.getSource(), testData.getExpectedResult(), generator);
}
-
- @Override
- public String getName() {
- return testName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlineclass/ClassInlinerTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlineclass/ClassInlinerTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlineclass/ClassInlinerTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -46,12 +46,10 @@
public class ClassInlinerTester extends RefactoringTestCase {
- private String fileName;
-
private MultiFileTestData testData;
public ClassInlinerTester(String fileName) {
- this.fileName = fileName;
+ super(fileName);
}
private PartialClassNodeWrapper getTargetClassPart(String fileName, int classPos) {
@@ -67,7 +65,7 @@
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- testData = new MultiFileTestData(fileName);
+ testData = new MultiFileTestData(getName());
int caretPosition = testData.getIntProperty("caretPosition");
InlineClassConfig config = new InlineClassConfig(testData, caretPosition);
@@ -82,9 +80,4 @@
checkMultiFileEdits(inliner, testData);
}
-
- @Override
- public String getName() {
- return fileName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlinelocal/LocalInlinerTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlinelocal/LocalInlinerTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/inlinelocal/LocalInlinerTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -42,16 +42,13 @@
public class LocalInlinerTester extends RefactoringTestCase {
- private String fileName;
-
- private FileTestData testData;
-
public LocalInlinerTester(String fileName) {
- this.fileName = fileName;
+ super(fileName);
}
- private void runInlineTempTest(FileTestData data) throws BadLocationException {
-
+ @Override
+ public void runTest() throws FileNotFoundException, IOException, BadLocationException {
+ FileTestData data = new FileTestData(getName());
InlineLocalConfig config = new InlineLocalConfig(data, data.getIntProperty("caretPosition"));
InlineLocalConditionChecker checker = new InlineLocalConditionChecker(config);
if (!checker.shouldPerform()) {
@@ -60,18 +57,7 @@
LocalVariableInliner inliner = new LocalVariableInliner(config);
config.setReplaceTempWithQuery(data.getBoolProperty("replaceWithQuery"));
config.setNewMethodName(data.getProperty("newMethodName"));
-
+
createEditAndCompareResult(data.getActiveFileContent(), data.getExpectedResult(), inliner);
}
-
- @Override
- public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- testData = new FileTestData(fileName, getClass());
- runInlineTempTest(testData);
- }
-
- @Override
- public String getName() {
- return fileName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/mergeclasspartsinfile/ClassPartSelectorTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/mergeclasspartsinfile/ClassPartSelectorTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/mergeclasspartsinfile/ClassPartSelectorTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -48,14 +48,12 @@
public class ClassPartSelectorTester extends RefactoringTestCase {
- private String fileName;
-
private FileTestData testData;
private ClassNodeWrapper selectedClass;
public ClassPartSelectorTester(String fileName) {
- this.fileName = fileName;
+ super(fileName);
}
private Collection<Integer> getCheckedPartNumbers() {
@@ -114,12 +112,8 @@
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- testData = new FileTestData(fileName, getClass());
+ testData = new FileTestData(getName());
runMergeClassPartsInFileTest(testData);
}
- @Override
- public String getName() {
- return fileName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/mergewithexternalclassparts/MergeWithExternalClassPartsTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/mergewithexternalclassparts/MergeWithExternalClassPartsTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/mergewithexternalclassparts/MergeWithExternalClassPartsTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -48,17 +48,14 @@
public class MergeWithExternalClassPartsTester extends RefactoringTestCase{
- private String testName;
-
- public MergeWithExternalClassPartsTester(String testName)
- {
- this.testName = testName;
+ public MergeWithExternalClassPartsTester(String testName) {
+ super(testName);
}
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException
{
- MultiFileTestData testData = new MultiFileTestData(testName);
+ MultiFileTestData testData = new MultiFileTestData(getName());
MergeWithExternalClassPartConfig config = new MergeWithExternalClassPartConfig(testData);
MergeWithExternalClassPartsConditionChecker checker = new MergeWithExternalClassPartsConditionChecker(config);
@@ -125,10 +122,4 @@
return partNumbers.get(0).intValue();
}
-
- @Override
- public String getName()
- {
- return testName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/movefield/MoveFieldTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/movefield/MoveFieldTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/movefield/MoveFieldTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -41,15 +41,13 @@
public class MoveFieldTester extends RefactoringTestCase {
- private String testName;
-
public MoveFieldTester(String testName) {
- this.testName = testName;
+ super(testName);
}
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- MultiFileTestData testData = new MultiFileTestData(testName + ".", ".source.rb", ".result.rb", testName + ".test_properties");
+ MultiFileTestData testData = new MultiFileTestData(getName() + ".", ".source.rb", ".result.rb", getName() + ".test_properties");
MoveFieldConfig config = new MoveFieldConfig(new DocumentWithIncluding(testData), testData.getIntProperty("caretPosition"));
new MoveFieldConditionChecker(config);
@@ -60,10 +58,4 @@
MoveFieldEditProvider editProvider = new MoveFieldEditProvider(config);
checkMultiFileEdits(editProvider, testData);
}
-
-
- @Override
- public String getName() {
- return testName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/movemethod/MoveMethodTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/movemethod/MoveMethodTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/movemethod/MoveMethodTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -42,17 +42,14 @@
public class MoveMethodTester extends RefactoringTestCase {
- private String testName;
-
- public MoveMethodTester(String testName)
- {
- this.testName = testName;
+ public MoveMethodTester(String testName) {
+ super(testName);
}
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException
{
- MultiFileTestData testData = new MultiFileTestData(testName);
+ MultiFileTestData testData = new MultiFileTestData(getName());
MoveMethodConfig config = new MoveMethodConfig(testData, testData.getIntProperty("caretPosition"));
MoveMethodConditionChecker checker = new MoveMethodConditionChecker(config);
@@ -80,11 +77,4 @@
checkMultiFileEdits(mover, testData);
}
-
-
- @Override
- public String getName()
- {
- return testName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/overridemethod/OverrideMethodTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/overridemethod/OverrideMethodTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/overridemethod/OverrideMethodTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -44,22 +44,20 @@
public class OverrideMethodTester extends TwoLayerTreeEditProviderTester {
- private String testName;
-
public OverrideMethodTester(String fileName) {
- super(true);
- testName = fileName;
+ super(fileName, true);
}
@Override
public void runTest() throws FileNotFoundException, IOException, MalformedTreeException, BadLocationException {
FileTestData testData;
- testData = new FileTestData(testName, getClass());
+ testData = new FileTestData(getName());
StringDocumentProvider docProvider = new StringDocumentProvider(testData.getFileName(), testData.getActiveFileContent());
String superClassFileName = testData.getProperty("superclassfilename");
docProvider.addFile(superClassFileName, testData.getFileContent(superClassFileName));
MethodsOverrider overrider = new MethodsOverrider(docProvider);
Collection<String> strSelections = testData.getNumberedProperty("selection");
+
for (String aktSelection : strSelections) {
String[] selection = FilePropertyData.seperateString(aktSelection);
if (selection.length == 2) {
@@ -72,9 +70,4 @@
}
createEditAndCompareResult(testData.getSource(), testData.getExpectedResult(), overrider);
}
-
- @Override
- public String getName() {
- return testName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/overridemethod/TC_OverridenMethodEditTest.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/overridemethod/TC_OverridenMethodEditTest.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/overridemethod/TC_OverridenMethodEditTest.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -32,16 +32,12 @@
import org.rubypeople.rdt.refactoring.documentprovider.StringDocumentProvider;
import org.rubypeople.rdt.refactoring.tests.TwoLayerTreeEditProviderTester;
-public class TC_OverridenMethodEditTest extends TwoLayerTreeEditProviderTester
-{
+public class TC_OverridenMethodEditTest extends TwoLayerTreeEditProviderTester {
private static int test_count = 0;
-
-
- public TC_OverridenMethodEditTest()
- {
- super(true);
+ public TC_OverridenMethodEditTest() {
+ super("Overriden Method Edit Test", true);
}
private final static String BASE_DOCUMENT_SIMPLE = "class A < X\n" +
@@ -57,12 +53,6 @@
" attr_accessor :b\n" +
"end";
-// Support for JRubyBuilt in Classes disabled (uncommented Code) because the Arity of the methods
-// cannot propperly be evaluated.
-
-// private final static String BASE_DOCUMENT_EXTENDS_DIR = "class A < Dir\n" +
-// "end";
-
private final static String SUPER_CLASS_EMPTY = "class X\n" +
"end";
@@ -183,15 +173,6 @@
"end");
}
-// Support for JRubyBuilt in Classes disabled (uncommented Code) because the Arity of the methods
-// cannot propperly be evaluated.
-
-// public void testDirSuperClass()
-// {
-// addSelection("A", "initialize");
-// check(BASE_DOCUMENT_EXTENDS_DIR, null, "class A < Dir\n\ndef initialize arg0\nsuper arg0\nend\n\nend");
-// }
-
private void check(String classDocument, String superClassDocument, String expectedDocument) {
StringDocumentProvider docProvider = new StringDocumentProvider("override_method_edit_test_nr_" + ++test_count, classDocument);
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/pushdown/PushDownTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/pushdown/PushDownTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/pushdown/PushDownTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -44,17 +44,14 @@
public class PushDownTester extends TwoLayerTreeEditProviderTester {
- private String testName;
-
public PushDownTester(String fileName) {
- super(true);
- testName = fileName;
+ super(fileName, true);
}
@Override
public void runTest() throws FileNotFoundException, IOException, MalformedTreeException, BadLocationException {
FileTestData testData;
- testData = new FileTestData(testName, getClass());
+ testData = new FileTestData(getName());
StringDocumentProvider docProvider = new StringDocumentProvider(testData.getFileName(), testData.getActiveFileContent());
Collection<String> projectFileNames = testData.getNumberedProperty("projectfilename");
for (String projectFileName : projectFileNames) {
@@ -74,9 +71,4 @@
}
createEditAndCompareResult(testData.getSource(), testData.getExpectedResult(), downPusher);
}
-
- @Override
- public String getName() {
- return testName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamefield/FieldRenamerTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamefield/FieldRenamerTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamefield/FieldRenamerTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -42,18 +42,13 @@
import org.rubypeople.rdt.refactoring.tests.RefactoringTestCase;
public class FieldRenamerTester extends RefactoringTestCase {
-
- private String fileName;
-
- private MultiFileTestData testData;
-
public FieldRenamerTester(String fileName) {
- this.fileName = fileName;
+ super(fileName);
}
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- testData = new MultiFileTestData(fileName);
+ MultiFileTestData testData = new MultiFileTestData(getName());
int caretPosition = testData.getIntProperty("caretPosition");
RenameFieldConfig config = new RenameFieldConfig(testData, caretPosition);
@@ -66,9 +61,4 @@
config.setDoRenameAccessorMethods(testData.getBoolProperty("replaceMethodAccessors"));
checkMultiFileEdits(renamer, testData);
}
-
- @Override
- public String getName() {
- return fileName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemethod/MethodRenamerTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemethod/MethodRenamerTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemethod/MethodRenamerTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -46,16 +46,13 @@
public class MethodRenamerTester extends RefactoringTestCase {
- private String fileName;
-
-
public MethodRenamerTester(String fileName) {
- this.fileName = fileName;
+ super(fileName);
}
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- MultiFileTestData testData = new MultiFileTestData(fileName);
+ MultiFileTestData testData = new MultiFileTestData(getName());
int caretPosition = testData.getIntProperty("caretPosition");
RenameMethodConfig config = new RenameMethodConfig(testData, caretPosition);
@@ -80,9 +77,4 @@
checkMultiFileEdits(renamer, testData);
}
-
- @Override
- public String getName() {
- return fileName;
- }
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemethod/selection/RenameMethodSelectionTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemethod/selection/RenameMethodSelectionTester.java 2007-04-20 08:37:24 UTC (rev 2344)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemethod/selection/RenameMethodSelectionTester.java 2007-04-20 13:18:24 UTC (rev 2345)
@@ -45,17 +45,13 @@
public class RenameMethodSelectionTester extends RefactoringTestCase {
- private String fileName;
-
- private MultiFileTestData testData;
-
public RenameMethodSelectionTester(String fileName) {
- this.fileName = fileName;
+ super(fileName);
}
@Override
public void runTest() throws FileNotFoundException, IOException, BadLocationException {
- testData = new MultiFileTestData(fileName);
+ MultiFileTestData testData = new MultiFileTestData(getName());
int caretPosition = testData.getIntProperty("caretPosition");
RenameMethodConfig config = new RenameMethodConfig(testData, caretPosition);
@@ -73,9 +69,4 @@
checkMultiFileEdits(renamer, testData);
}
-
- @Override
- public String getName() {
- return fileName;
- }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-20 08:37:29
|
Revision: 2344
http://svn.sourceforge.net/rubyeclipse/?rev=2344&view=rev
Author: mirkostocker
Date: 2007-04-20 01:37:24 -0700 (Fri, 20 Apr 2007)
Log Message:
-----------
create the extract constant test-infrastructure
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TS_All.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/extract_constant_checker_test_1.source.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/extract_constant_checker_test_1.test_properties
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.result.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.source.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.test_properties
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/ExtractConstantTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/TS_ExtractConstant.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/ExtractConstantConditionTester.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/TS_ExtractConstantChecks.java
Modified: trunk/org.rubypeople.rdt.refactoring/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/META-INF/MANIFEST.MF 2007-04-19 23:54:02 UTC (rev 2343)
+++ trunk/org.rubypeople.rdt.refactoring/META-INF/MANIFEST.MF 2007-04-20 08:37:24 UTC (rev 2344)
@@ -12,6 +12,7 @@
org.rubypeople.rdt.refactoring.core,
org.rubypeople.rdt.refactoring.core.convertlocaltofield,
org.rubypeople.rdt.refactoring.core.encapsulatefield,
+ org.rubypeople.rdt.refactoring.core.extractconstant,
org.rubypeople.rdt.refactoring.core.extractmethod,
org.rubypeople.rdt.refactoring.core.formatsource,
org.rubypeople.rdt.refactoring.core.generateaccessors,
@@ -24,6 +25,7 @@
org.rubypeople.rdt.refactoring.core.movefield,
org.rubypeople.rdt.refactoring.core.movemethod,
org.rubypeople.rdt.refactoring.core.overridemethod,
+ org.rubypeople.rdt.refactoring.core.pullup,
org.rubypeople.rdt.refactoring.core.pushdown,
org.rubypeople.rdt.refactoring.core.rename,
org.rubypeople.rdt.refactoring.core.renameclass,
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java 2007-04-19 23:54:02 UTC (rev 2343)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java 2007-04-20 08:37:24 UTC (rev 2344)
@@ -26,8 +26,8 @@
private ExtractConstantConfig config;
- public ExtractConstantConditionChecker(ExtractConstantConfig config) {
- super(config);
+ public ExtractConstantConditionChecker(IRefactoringConfig config2) {
+ super(config2);
}
protected void checkInitialConditions() {
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/extract_constant_checker_test_1.source.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/extract_constant_checker_test_1.source.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/extract_constant_checker_test_1.source.rb 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1,5 @@
+class Test
+ def method param
+ puts param
+ end
+end
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/extract_constant_checker_test_1.test_properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/extract_constant_checker_test_1.test_properties (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/conditionchecks/extract_constant_checker_test_1.test_properties 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1,4 @@
+start=39
+end=44
+name=Test
+initialError0=Extracting constant not possible on things other than strings, numbers, hashes or arrays.
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.result.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.result.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.result.rb 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1,2 @@
+Name = "Mirko"
+puts "Hello " + Name
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.source.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.source.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.source.rb 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1 @@
+puts "Hello " + "Mirko"
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.test_properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.test_properties (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractconstant/extract_constant_test_1.test_properties 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1,3 @@
+start=18
+end=20
+name=Name
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TS_All.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TS_All.java 2007-04-19 23:54:02 UTC (rev 2343)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/TS_All.java 2007-04-20 08:37:24 UTC (rev 2344)
@@ -35,6 +35,7 @@
import org.rubypeople.rdt.refactoring.tests.core.TS_Core;
import org.rubypeople.rdt.refactoring.tests.core.convertlocaltofield.TS_LocalToField;
import org.rubypeople.rdt.refactoring.tests.core.encapsulatefield.TS_EncapsulateField;
+import org.rubypeople.rdt.refactoring.tests.core.extractconstant.TS_ExtractConstant;
import org.rubypeople.rdt.refactoring.tests.core.extractmethod.TS_ExtractMethod;
import org.rubypeople.rdt.refactoring.tests.core.formatsource.TS_FormatSource;
import org.rubypeople.rdt.refactoring.tests.core.generateaccessors.TS_GenerateAccessors;
@@ -75,6 +76,7 @@
suite.addTest(TS_LocalToField.suite());
suite.addTest(TS_Core.suite());
suite.addTest(TS_ExtractMethod.suite());
+ suite.addTest(TS_ExtractConstant.suite());
suite.addTest(TS_MergeWithExternalClassParts.suite());
suite.addTest(TS_MergeClassPartsInFile.suite());
suite.addTest(TS_InlineLocal.suite());
Added: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/ExtractConstantTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/ExtractConstantTester.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/ExtractConstantTester.java 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1,64 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.tests.core.extractconstant;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.rubypeople.rdt.refactoring.core.SelectionInformation;
+import org.rubypeople.rdt.refactoring.core.extractconstant.ConstantExtractor;
+import org.rubypeople.rdt.refactoring.core.extractconstant.ExtractConstantConditionChecker;
+import org.rubypeople.rdt.refactoring.core.extractconstant.ExtractConstantConfig;
+import org.rubypeople.rdt.refactoring.tests.FileTestCase;
+import org.rubypeople.rdt.refactoring.tests.FileTestData;
+
+public class ExtractConstantTester extends FileTestCase {
+
+ public ExtractConstantTester(String fileName) {
+ super(fileName);
+ }
+
+ @Override
+ public void runTest() throws FileNotFoundException, IOException, BadLocationException {
+
+ FileTestData testData = new FileTestData(getName(), ".source.rb", ".result.rb");
+
+ SelectionInformation selection = new SelectionInformation(testData.getIntProperty("start"), testData.getIntProperty("end"), "");
+
+ ExtractConstantConfig renameModuleConfig = new ExtractConstantConfig(testData, selection);
+ new ExtractConstantConditionChecker(renameModuleConfig);
+
+ renameModuleConfig.setConstantName(testData.getProperty("name"));
+
+ ConstantExtractor editProvider = new ConstantExtractor(renameModuleConfig);
+
+ createEditAndCompareResult(testData.getSource(), testData.getExpectedResult(), editProvider);
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/TS_ExtractConstant.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/TS_ExtractConstant.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/TS_ExtractConstant.java 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1,42 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.tests.core.extractconstant;
+
+import junit.framework.TestSuite;
+
+import org.rubypeople.rdt.refactoring.tests.FileTestSuite;
+import org.rubypeople.rdt.refactoring.tests.core.extractconstant.conditionchecks.TS_ExtractConstantChecks;
+
+public class TS_ExtractConstant extends FileTestSuite {
+ public static TestSuite suite() {
+ TestSuite suite = createSuite("Extract Constant", "extract_constant_test_*.source.rb", ExtractConstantTester.class);
+ suite.addTest(TS_ExtractConstantChecks.suite());
+ return suite;
+ }
+}
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/ExtractConstantConditionTester.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/ExtractConstantConditionTester.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/ExtractConstantConditionTester.java 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1,66 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.tests.core.extractconstant.conditionchecks;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import org.rubypeople.rdt.refactoring.core.SelectionInformation;
+import org.rubypeople.rdt.refactoring.core.extractconstant.ConstantExtractor;
+import org.rubypeople.rdt.refactoring.core.extractconstant.ExtractConstantConditionChecker;
+import org.rubypeople.rdt.refactoring.core.extractconstant.ExtractConstantConfig;
+import org.rubypeople.rdt.refactoring.tests.FilePropertyData;
+import org.rubypeople.rdt.refactoring.tests.FileTestData;
+import org.rubypeople.rdt.refactoring.tests.RefactoringConditionTestCase;
+
+public class ExtractConstantConditionTester extends RefactoringConditionTestCase {
+
+ private FilePropertyData testData;
+ private ExtractConstantConfig config;
+
+ public ExtractConstantConditionTester(String fileName) {
+ super(fileName);
+ }
+
+ @Override
+ public void runTest() throws FileNotFoundException, IOException {
+ testData = new FileTestData(getName(), ".source.rb", ".source.rb");
+
+ SelectionInformation selection = new SelectionInformation(testData.getIntProperty("start"), testData.getIntProperty("end"), "");
+ config = new ExtractConstantConfig(testData , selection);
+ ExtractConstantConditionChecker checker = new ExtractConstantConditionChecker(config);
+ checkConditions(checker, testData);
+ }
+
+ @Override
+ protected void createEditProviderAndSetUserInput() {
+ new ConstantExtractor(config);
+ config.setConstantName(testData.getProperty("name"));
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/TS_ExtractConstantChecks.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/TS_ExtractConstantChecks.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/extractconstant/conditionchecks/TS_ExtractConstantChecks.java 2007-04-20 08:37:24 UTC (rev 2344)
@@ -0,0 +1,41 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.tests.core.extractconstant.conditionchecks;
+
+import junit.framework.Test;
+
+import org.rubypeople.rdt.refactoring.tests.FileTestSuite;
+
+public class TS_ExtractConstantChecks extends FileTestSuite {
+
+ public static Test suite() {
+ return createSuite("Extract Constant Conditionchecks", "extract_constant_checker_test_*.source.rb", ExtractConstantConditionTester.class);
+ }
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-19 23:54:04
|
Revision: 2343
http://svn.sourceforge.net/rubyeclipse/?rev=2343&view=rev
Author: cawilliams
Date: 2007-04-19 16:54:02 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-04-19 23:10:00 UTC (rev 2342)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-04-19 23:54:02 UTC (rev 2343)
@@ -19,6 +19,7 @@
import java.util.HashSet;
import java.util.Hashtable;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
@@ -257,31 +258,33 @@
return null;
int length = participants.length;
- CompilationParticipant[] result = new CompilationParticipant[length];
- int index = 0;
+ final List<CompilationParticipant> result = new ArrayList<CompilationParticipant>();
for (int i = 0; i < length; i++) {
if (participants[i] instanceof IConfigurationElement) {
final IConfigurationElement configElement = (IConfigurationElement) participants[i];
- final int participantIndex = i;
SafeRunner.run(new ISafeRunnable() {
public void handleException(Throwable exception) {
Util.log(exception, "Exception occurred while creating compilation participant"); //$NON-NLS-1$
}
public void run() throws Exception {
Object executableExtension = configElement.createExecutableExtension("class"); //$NON-NLS-1$
- participants[participantIndex] = executableExtension;
+ CompilationParticipant participant = (CompilationParticipant) executableExtension;
+ result.add(participant);
}
});
- }
- CompilationParticipant participant = (CompilationParticipant) participants[i];
+ } else {
+ CompilationParticipant participant = (CompilationParticipant) participants[i];
+ result.add(participant);
+ }
+ }
+ if (result.isEmpty())
+ return null;
+ List<CompilationParticipant> finalResult = new ArrayList<CompilationParticipant>();
+ for (CompilationParticipant participant : result) {
if (participant != null && participant.isActive(project))
- result[index++] = participant;
+ finalResult.add(participant);
}
- if (index == 0)
- return null;
- if (index < length)
- System.arraycopy(result, 0, result = new CompilationParticipant[index], 0, index);
- return result;
+ return finalResult.toArray(new CompilationParticipant[finalResult.size()]);
}
public HashSet managedMarkerTypes() {
Modified: trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF 2007-04-19 23:10:00 UTC (rev 2342)
+++ trunk/org.rubypeople.rdt.ui/META-INF/MANIFEST.MF 2007-04-19 23:54:02 UTC (rev 2343)
@@ -36,6 +36,7 @@
org.rubypeople.rdt.ui.text,
org.rubypeople.rdt.ui.text.folding,
org.rubypeople.rdt.ui.text.hyperlinks,
+ org.rubypeople.rdt.ui.text.ruby,
org.rubypeople.rdt.ui.text.ruby.hover,
org.rubypeople.rdt.ui.wizards
Require-Bundle: org.eclipse.ui.ide,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-19 23:10:02
|
Revision: 2342
http://svn.sourceforge.net/rubyeclipse/?rev=2342&view=rev
Author: cawilliams
Date: 2007-04-19 16:10:00 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
little bit of cleanup
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java 2007-04-19 15:01:32 UTC (rev 2341)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java 2007-04-19 23:10:00 UTC (rev 2342)
@@ -17,6 +17,11 @@
public class RDebugVMDebugger extends StandardVMDebugger {
+ private static final String PORT_SWITCH = "--port";
+ private static final String VERBOSE_FLAG = "-d";
+ private static final String RDEBUG_EXECUTABLE_WINDOWS = "rdebug-ide.cmd";
+ private static final String RDEBUG_EXECUTABLE = "rdebug-ide";
+
public RDebugVMDebugger(IVMInstall vmInstance) {
super(vmInstance);
}
@@ -33,7 +38,7 @@
// Set it up to use rdebug executable
Map map = config.getVMSpecificAttributesMap();
if (map == null) map = new HashMap();
- String executable = findRDebugExecutable(fVMInstance.getInstallLocation()) ;
+ String executable = findRDebugExecutable(fVMInstance.getInstallLocation());
map.put(IRubyLaunchConfigurationConstants.ATTR_RUBY_COMMAND, executable);
config.setVMSpecificAttributesMap(map);
@@ -42,10 +47,10 @@
protected List<String> debugSpecificVMArgs(RubyDebugTarget debugTarget) {
List<String> arguments = new ArrayList<String>();
- arguments.add("--port");
+ arguments.add(PORT_SWITCH);
arguments.add(Integer.toString(debugTarget.getPort()));
if (isDebuggerVerbose()) {
- arguments.add("-d");
+ arguments.add(VERBOSE_FLAG);
}
return arguments;
}
@@ -56,13 +61,12 @@
public static String findRDebugExecutable(File vmInstallLocation) {
// see StandardVMRunner.constructProgramString
- String cmd = "rdebug-ide" ;
- String cmdWin = "rdebug-ide.cmd";
+ String cmdWin = RDEBUG_EXECUTABLE_WINDOWS;
String path = vmInstallLocation + File.separator + "bin" + File.separator + cmdWin;
if (new File(path).exists()) {
- cmd = cmdWin ;
+ return cmdWin;
}
- return cmd ;
+ return RDEBUG_EXECUTABLE;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-19 15:01:35
|
Revision: 2341
http://svn.sourceforge.net/rubyeclipse/?rev=2341&view=rev
Author: mirkostocker
Date: 2007-04-19 08:01:32 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
rename aliases for methods
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.activeFile.rb.result
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.activeFile.rb.source
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.test_properties
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java 2007-04-19 09:32:56 UTC (rev 2340)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java 2007-04-19 15:01:32 UTC (rev 2341)
@@ -252,7 +252,7 @@
FCallNode currentFCall = (FCallNode)currentCall;
String callName = currentFCall.getName();
- if(VisibilityNodeWrapper.isVisibilityString(callName)){
+ if(VisibilityNodeWrapper.isVisibilityString(callName) || "alias_method".equals(callName)){
Collection<Node> symbolNodes = NodeProvider.getSubNodes(currentFCall, SymbolNode.class);
for(Node currentItem : symbolNodes){
SymbolNode currentSymbol = (SymbolNode)currentItem;
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.activeFile.rb.result
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.activeFile.rb.result (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.activeFile.rb.result 2007-04-19 15:01:32 UTC (rev 2341)
@@ -0,0 +1,6 @@
+class Klass
+ def new_name
+ end
+
+ alias_method :old_method, :new_name
+end
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.activeFile.rb.source
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.activeFile.rb.source (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.activeFile.rb.source 2007-04-19 15:01:32 UTC (rev 2341)
@@ -0,0 +1,6 @@
+class Klass
+ def method
+ end
+
+ alias_method :old_method, :method
+end
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.test_properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.test_properties (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemethod/rename_method_test_19.test_properties 2007-04-19 15:01:32 UTC (rev 2341)
@@ -0,0 +1,4 @@
+activeFile=activeFile.rb
+destinationFiles=
+caretPosition=21
+newName=new_name
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-19 09:33:00
|
Revision: 2340
http://svn.sourceforge.net/rubyeclipse/?rev=2340&view=rev
Author: mirkostocker
Date: 2007-04-19 02:32:56 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
fix a bug when using self.method_name to define methods in modules
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ModuleNodeWrapper.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.activeFile.rb.result
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.activeFile.rb.source
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.test_properties
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ModuleNodeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ModuleNodeWrapper.java 2007-04-19 08:56:37 UTC (rev 2339)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ModuleNodeWrapper.java 2007-04-19 09:32:56 UTC (rev 2340)
@@ -47,9 +47,12 @@
private void initModuleMethodConstNodes() {
for (Node node : NodeProvider.getSubNodes(getWrappedNode(), DefsNode.class)) {
- ConstNode constNode = (ConstNode) ((DefsNode) node).getReceiverNode();
- if(constNode.getName().equals(getName())) {
- moduleMethodNodes.add(constNode);
+ DefsNode defsNode = (DefsNode) node;
+ if(defsNode.getReceiverNode() instanceof ConstNode) {
+ ConstNode constNode = (ConstNode) defsNode.getReceiverNode();
+ if(constNode.getName().equals(getName())) {
+ moduleMethodNodes.add(constNode);
+ }
}
}
}
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.activeFile.rb.result
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.activeFile.rb.result (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.activeFile.rb.result 2007-04-19 09:32:56 UTC (rev 2340)
@@ -0,0 +1,6 @@
+module OtherModule
+ def self.test
+ end
+ def OtherModule.another_test
+ end
+end
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.activeFile.rb.source
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.activeFile.rb.source (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.activeFile.rb.source 2007-04-19 09:32:56 UTC (rev 2340)
@@ -0,0 +1,6 @@
+module Module
+ def self.test
+ end
+ def Module.another_test
+ end
+end
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.test_properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.test_properties (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_8.test_properties 2007-04-19 09:32:56 UTC (rev 2340)
@@ -0,0 +1,3 @@
+name=OtherModule
+pos=10
+activeFile=activeFile.rb
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-19 08:56:45
|
Revision: 2339
http://svn.sourceforge.net/rubyeclipse/?rev=2339&view=rev
Author: mirkostocker
Date: 2007-04-19 01:56:37 -0700 (Thu, 19 Apr 2007)
Log Message:
-----------
rename module is complete
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/ClassFinder.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassConditionChecker.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/IncludeRenameEditProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeFinder.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ClassNodeWrapper.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/RealClassNodeWrapper.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NameHelper.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TC_ModuleInclusionFinder.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/util/TC_NameHelper.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleSpecifierWrapper.java
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.result.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.source.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.test_properties
trunk/org.rubypeople.rdt.refactoring.tests/resources/util/
trunk/org.rubypeople.rdt.refactoring.tests/resources/util/TC_NameHelper_ModulePrefix.rb
Removed Paths:
-------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/ClassFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/ClassFinder.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/ClassFinder.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -39,7 +39,7 @@
public class ClassFinder implements IClassFinder {
private final String name;
private Collection<ClassNodeWrapper> classNodes;
- private final String modulePrefix;
+ private String modulePrefix;
private interface INodeAcceptor {
boolean accept(PartialClassNodeWrapper node);
@@ -77,8 +77,14 @@
public Collection<ClassNode> findChildren() {
return find(new INodeAcceptor(){
public boolean accept(PartialClassNodeWrapper node) {
- return (node.getModulePrefix() + node.getSuperClassName()).equals(modulePrefix + name);
+ String fullName = node.getModulePrefix();
+ if(!"".equals(fullName)) {
+ fullName += "::";
+ }
+ fullName += node.getSuperClassName();
+ return (fullName).equals(modulePrefix + name);
+
}});
}
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassConditionChecker.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassConditionChecker.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renameclass/RenameClassConditionChecker.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -58,7 +58,12 @@
}
} catch (NoClassNodeException e) {return;}
- config.setModulePrefix(classNode.getFirstPartialClassNode().getModulePrefix());
+ String modulePrefix = classNode.getFirstPartialClassNode().getModulePrefix();
+ if("".equals(modulePrefix)) {
+ config.setModulePrefix("");
+ } else {
+ config.setModulePrefix(modulePrefix + "::");
+ }
config.setSelectedNode((ClassNode) classNode.getFirstPartialClassNode().getWrappedNode());
config.setNewName(classNode.getName());
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/IncludeRenameEditProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/IncludeRenameEditProvider.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/IncludeRenameEditProvider.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -45,9 +45,12 @@
public Collection<FileEditProvider> getEditProviders() {
Collection<FileEditProvider> edits = new ArrayList<FileEditProvider>();
- for(ModuleIncludeWrapper include : new ModuleIncludeFinder(config.getDocumentProvider()).find(config.getOriginalFullName())) {
- include.setNewName(config.getOriginalName(), config.getNewName());
- edits.add(new FileEditProvider(include.getWrappedNode().getPosition().getFile(), new SimpleNodeEditProvider(include.getWrappedNode())));
+ Collection<ModuleSpecifierWrapper> wrappers = config.getIncludes();
+ wrappers.addAll(config.getSelectedCalls());
+
+ for(ModuleSpecifierWrapper node : wrappers) {
+ node.setNewName(config.getOriginalName(), config.getNewName());
+ edits.add(new FileEditProvider(node.getWrappedNode().getPosition().getFile(), new SimpleNodeEditProvider(node.getWrappedNode())));
}
return edits;
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeFinder.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeFinder.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -42,11 +42,11 @@
this.document = document;
}
- public Collection<ModuleIncludeWrapper> find(String name) {
- ArrayList<ModuleIncludeWrapper> includes = new ArrayList<ModuleIncludeWrapper>();
+ public Collection<ModuleSpecifierWrapper> find(String name) {
+ ArrayList<ModuleSpecifierWrapper> includes = new ArrayList<ModuleSpecifierWrapper>();
- for (ModuleIncludeWrapper includeWrapper : findAllIncludes()) {
- if(includeWrapper.getFullName().startsWith(name)) {
+ for (ModuleSpecifierWrapper includeWrapper : findAllIncludes()) {
+ if(includeWrapper.getFullName().equals(name)) {
includes.add(includeWrapper);
}
}
@@ -54,8 +54,8 @@
return includes;
}
- private ArrayList<ModuleIncludeWrapper> findAllIncludes() {
- ArrayList<ModuleIncludeWrapper> includes = new ArrayList<ModuleIncludeWrapper>();
+ private ArrayList<ModuleSpecifierWrapper> findAllIncludes() {
+ ArrayList<ModuleSpecifierWrapper> includes = new ArrayList<ModuleSpecifierWrapper>();
for(ClassNodeWrapper classNodeWrapper : document.getIncludedClassNodeProvider().getAllClassNodes()) {
includes.addAll(classNodeWrapper.getIncludes());
Deleted: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -1,121 +0,0 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2007 Mirko Stocker <me...@mi...>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-
-package org.rubypeople.rdt.refactoring.core.renamemodule;
-
-import org.jruby.ast.Colon2Node;
-import org.jruby.ast.ConstNode;
-import org.jruby.ast.Node;
-import org.jruby.ast.types.INameNode;
-import org.rubypeople.rdt.refactoring.core.NodeProvider;
-import org.rubypeople.rdt.refactoring.nodewrapper.INodeWrapper;
-import org.rubypeople.rdt.refactoring.util.NameHelper;
-
-public abstract class ModuleIncludeWrapper implements INodeWrapper {
-
- protected String modulePrefix;
-
- private static class Colon2IncludeWrapper extends ModuleIncludeWrapper {
- protected Colon2Node node;
-
- public Colon2IncludeWrapper(Colon2Node node, String modulePrefix) {
- this.node = node;
- this.modulePrefix = modulePrefix;
- }
-
- @Override
- public String getIncludeName() {
- return NameHelper.getFullyQualifiedName(node);
- }
-
- @Override
- public Node getWrappedNode() {
- return node;
- }
-
- @Override
- public void setNewName(String oldName, String newName) {
- for (Node node : NodeProvider.getSubNodes(this.node, Colon2Node.class, ConstNode.class)) {
- INameNode nameNode = (INameNode) node;
- if(!nameNode.getName().equals(oldName)) {
- continue;
- }
-
- if(node instanceof Colon2Node) {
- ((Colon2Node) node).setName(newName);
- return;
- } else {
- ((ConstNode) node).setName(newName);
- return;
- }
- }
- }
- }
-
- private static class ConstIncludeWrapper extends ModuleIncludeWrapper {
- protected ConstNode node;
-
- public ConstIncludeWrapper(ConstNode node, String modulePrefix) {
- this.node = node;
- this.modulePrefix = modulePrefix;
- }
-
- @Override
- public String getIncludeName() {
- return node.getName();
- }
-
- @Override
- public Node getWrappedNode() {
- return node;
- }
-
- @Override
- public void setNewName(String oldName, String newName) {
- node.setName(newName);
- }
- }
-
- public static ModuleIncludeWrapper create(Node node, String modulePrefix) {
-
- if(node instanceof Colon2Node) {
- return new Colon2IncludeWrapper((Colon2Node) node, modulePrefix);
- } else {
- return new ConstIncludeWrapper((ConstNode) node, modulePrefix);
- }
- }
-
- public abstract Node getWrappedNode();
-
- public abstract String getIncludeName();
-
- public String getFullName() {
- return modulePrefix + getIncludeName();
- }
- public abstract void setNewName(String oldName, String newName);
-}
Copied: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleSpecifierWrapper.java (from rev 2325, trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java)
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleSpecifierWrapper.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleSpecifierWrapper.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -0,0 +1,124 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.core.renamemodule;
+
+import org.jruby.ast.Colon2Node;
+import org.jruby.ast.ConstNode;
+import org.jruby.ast.Node;
+import org.jruby.ast.types.INameNode;
+import org.rubypeople.rdt.refactoring.core.NodeProvider;
+import org.rubypeople.rdt.refactoring.nodewrapper.INodeWrapper;
+import org.rubypeople.rdt.refactoring.util.NameHelper;
+
+public abstract class ModuleSpecifierWrapper implements INodeWrapper {
+
+ protected String modulePrefix;
+
+ private static class Colon2IncludeWrapper extends ModuleSpecifierWrapper {
+ protected Colon2Node node;
+
+ public Colon2IncludeWrapper(Colon2Node node, String modulePrefix) {
+ this.node = node;
+ this.modulePrefix = modulePrefix;
+ }
+
+ @Override
+ public String getIncludeName() {
+ return NameHelper.getFullyQualifiedName(node);
+ }
+
+ @Override
+ public Node getWrappedNode() {
+ return node;
+ }
+
+ @Override
+ public void setNewName(String oldName, String newName) {
+ for (Node node : NodeProvider.getSubNodes(this.node, Colon2Node.class, ConstNode.class)) {
+ INameNode nameNode = (INameNode) node;
+ if(!nameNode.getName().equals(oldName)) {
+ continue;
+ }
+
+ if(node instanceof Colon2Node) {
+ ((Colon2Node) node).setName(newName);
+ return;
+ } else {
+ ((ConstNode) node).setName(newName);
+ return;
+ }
+ }
+ }
+ }
+
+ private static class ConstIncludeWrapper extends ModuleSpecifierWrapper {
+ protected ConstNode node;
+
+ public ConstIncludeWrapper(ConstNode node, String modulePrefix) {
+ this.node = node;
+ this.modulePrefix = modulePrefix;
+ }
+
+ @Override
+ public String getIncludeName() {
+ return node.getName();
+ }
+
+ @Override
+ public Node getWrappedNode() {
+ return node;
+ }
+
+ @Override
+ public void setNewName(String oldName, String newName) {
+ node.setName(newName);
+ }
+ }
+
+ public static ModuleSpecifierWrapper create(Node node, String modulePrefix) {
+
+ if(node instanceof Colon2Node) {
+ return new Colon2IncludeWrapper((Colon2Node) node, modulePrefix);
+ } else {
+ return new ConstIncludeWrapper((ConstNode) node, modulePrefix);
+ }
+ }
+
+ public abstract Node getWrappedNode();
+
+ public abstract String getIncludeName();
+
+ public String getFullName() {
+ if("".equals(modulePrefix)) {
+ return getIncludeName();
+ }
+ return modulePrefix + "::" + getIncludeName();
+ }
+ public abstract void setNewName(String oldName, String newName);
+}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -28,10 +28,20 @@
package org.rubypeople.rdt.refactoring.core.renamemodule;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+
+import org.jruby.ast.Colon2Node;
+import org.jruby.ast.ConstNode;
+import org.jruby.ast.Node;
+import org.jruby.ast.RootNode;
import org.rubypeople.rdt.refactoring.core.IRefactoringConfig;
import org.rubypeople.rdt.refactoring.core.ModuleNodeProvider;
+import org.rubypeople.rdt.refactoring.core.NodeProvider;
import org.rubypeople.rdt.refactoring.core.RefactoringConditionChecker;
import org.rubypeople.rdt.refactoring.nodewrapper.ModuleNodeWrapper;
+import org.rubypeople.rdt.refactoring.util.NameHelper;
import org.rubypeople.rdt.refactoring.util.NodeUtil;
public class RenameModuleConditionChecker extends RefactoringConditionChecker {
@@ -60,10 +70,48 @@
return;
}
config.setSelectedModule(selectedModule);
- config.setNewName(selectedModule.getName());
config.setModuleParts(ModuleNodeProvider.findOtherParts(config.getDocumentProvider(), config.getSelectedModule()));
+
+ config.setIncludes(new ModuleIncludeFinder(config.getDocumentProvider()).find(config.getOriginalFullName()));
+
+ config.setPossibleCalls(findPossibleCalls());
+ config.setSelectedCalls(config.getPossibleCalls());
}
+ private ArrayList<ModuleSpecifierWrapper> findPossibleCalls() {
+ ArrayList<ModuleSpecifierWrapper> calls = new ArrayList<ModuleSpecifierWrapper>();
+
+ Collection<Node> toSkip = collectAllModulePartsAndIncludeNameNodes();
+
+ for(String file : config.getDocumentProvider().getFileNames()) {
+ RootNode rootNode = config.getDocumentProvider().getRootNode(file);
+ for (final Node node : NodeProvider.getSubNodes(rootNode, ConstNode.class, Colon2Node.class)) {
+ if(toSkip.contains(node)) {
+ continue;
+ }
+ ModuleSpecifierWrapper module = ModuleSpecifierWrapper.create(node, NameHelper.getEncosingModulePrefix(rootNode, node));
+
+ if(module.getFullName().equals(config.getOriginalFullName())) {
+ calls.add(module);
+ }
+ }
+ }
+
+ return calls;
+ }
+
+ private Collection<Node> collectAllModulePartsAndIncludeNameNodes() {
+ Collection<Node> toSkip = new HashSet<Node>();
+
+ for(ModuleNodeWrapper part : config.getModuleParts()) {
+ toSkip.add(part.getWrappedNode().getCPath());
+ }
+ for(ModuleSpecifierWrapper include : config.getIncludes()) {
+ toSkip.add(include.getWrappedNode());
+ }
+ return toSkip;
+ }
+
private boolean caretIsNotOnModuleName(ModuleNodeWrapper selectedModule) {
return !NodeUtil.positionIsInNode(config.getCarretPosition(), selectedModule.getWrappedNode().getCPath());
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -31,12 +31,14 @@
import java.util.Collection;
import org.rubypeople.rdt.refactoring.core.IRefactoringConfig;
+import org.rubypeople.rdt.refactoring.core.renamemethod.NodeSelector;
import org.rubypeople.rdt.refactoring.documentprovider.DocumentWithIncluding;
import org.rubypeople.rdt.refactoring.documentprovider.IDocumentProvider;
+import org.rubypeople.rdt.refactoring.nodewrapper.INodeWrapper;
import org.rubypeople.rdt.refactoring.nodewrapper.ModuleNodeWrapper;
import org.rubypeople.rdt.refactoring.ui.INewNameReceiver;
-public class RenameModuleConfig implements IRefactoringConfig, INewNameReceiver {
+public class RenameModuleConfig implements IRefactoringConfig, INewNameReceiver, NodeSelector {
private IDocumentProvider doc;
private final int carretPosition;
@@ -45,6 +47,9 @@
private Collection<ModuleNodeWrapper> moduleParts;
private String originalFullName;
private String originalName;
+ private Collection<? extends INodeWrapper> possibleCalls;
+ private Collection<? extends INodeWrapper> selectedCalls;
+ private Collection<ModuleSpecifierWrapper> includes;
public RenameModuleConfig(IDocumentProvider doc, int carretPosition) {
this.doc = doc;
@@ -63,10 +68,6 @@
this.newName = newName;
}
- public String getSelectedModuleName() {
- return selectedModule != null ? selectedModule.getName() : null;
- }
-
public int getCarretPosition() {
return carretPosition;
}
@@ -77,8 +78,8 @@
public void setSelectedModule(ModuleNodeWrapper selectedModule) {
this.selectedModule = selectedModule;
- this.originalFullName = selectedModule.getFullName();
- this.originalName = selectedModule.getName();
+ originalFullName = selectedModule.getFullName();
+ originalName = selectedModule.getName();
}
public String getNewName() {
@@ -100,4 +101,28 @@
public String getOriginalName() {
return originalName;
}
+
+ public Collection<? extends INodeWrapper> getPossibleCalls() {
+ return possibleCalls;
+ }
+
+ public Collection<ModuleSpecifierWrapper> getSelectedCalls() {
+ return (Collection<ModuleSpecifierWrapper>) selectedCalls;
+ }
+
+ public void setPossibleCalls(Collection<? extends INodeWrapper> possibleCalls) {
+ this.possibleCalls = possibleCalls;
+ }
+
+ public void setSelectedCalls(Collection<? extends INodeWrapper> selectedCalls) {
+ this.selectedCalls = selectedCalls;
+ }
+
+ public void setIncludes(Collection<ModuleSpecifierWrapper> includes) {
+ this.includes = includes;
+ }
+
+ public Collection<ModuleSpecifierWrapper> getIncludes() {
+ return includes;
+ }
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleRefactoring.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleRefactoring.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -11,7 +11,7 @@
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
- * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
@@ -34,6 +34,7 @@
import org.rubypeople.rdt.refactoring.core.RubyRefactoring;
import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
import org.rubypeople.rdt.refactoring.ui.NewNameListener;
+import org.rubypeople.rdt.refactoring.ui.pages.OccurenceReplaceSelectionPage;
import org.rubypeople.rdt.refactoring.ui.pages.RenamePage;
public class RenameModuleRefactoring extends RubyRefactoring {
@@ -49,9 +50,11 @@
RenameModuleEditProvider editProvider = new RenameModuleEditProvider(renameModuleConfig);
setEditProvider(editProvider);
- pages.add(new RenamePage(NAME, renameModuleConfig.getSelectedModuleName(),
+ pages.add(new RenamePage(NAME, renameModuleConfig.getOriginalName(),
new NewNameListener(renameModuleConfig, new ConstNameValidator(), new ArrayList<String>())));
-
+ if(!renameModuleConfig.getPossibleCalls().isEmpty()){
+ pages.add(new OccurenceReplaceSelectionPage(renameModuleConfig, renameModuleConfig.getDocumentProvider()));
+ }
}
}
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ClassNodeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ClassNodeWrapper.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ClassNodeWrapper.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -37,7 +37,7 @@
import org.jruby.ast.Node;
import org.jruby.ast.SymbolNode;
import org.rubypeople.rdt.refactoring.core.NodeFactory;
-import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleIncludeWrapper;
+import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleSpecifierWrapper;
import org.rubypeople.rdt.refactoring.nodewrapper.VisibilityNodeWrapper.METHOD_VISIBILITY;
public class ClassNodeWrapper implements INodeWrapper {
@@ -62,8 +62,8 @@
return fields;
}
- public Collection<ModuleIncludeWrapper> getIncludes() {
- ArrayList<ModuleIncludeWrapper> fields = new ArrayList<ModuleIncludeWrapper>();
+ public Collection<ModuleSpecifierWrapper> getIncludes() {
+ ArrayList<ModuleSpecifierWrapper> fields = new ArrayList<ModuleSpecifierWrapper>();
for (PartialClassNodeWrapper partialClassNode : partialClassNodes) {
fields.addAll(partialClassNode.getIncludeCalls());
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Iterator;
import org.jruby.ast.ArrayNode;
import org.jruby.ast.BlockNode;
@@ -45,7 +46,7 @@
import org.jruby.ast.SymbolNode;
import org.jruby.ast.VCallNode;
import org.rubypeople.rdt.refactoring.core.NodeProvider;
-import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleIncludeWrapper;
+import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleSpecifierWrapper;
import org.rubypeople.rdt.refactoring.exception.NoClassNodeException;
import org.rubypeople.rdt.refactoring.nodewrapper.VisibilityNodeWrapper.METHOD_VISIBILITY;
import org.rubypeople.rdt.refactoring.util.NodeUtil;
@@ -192,13 +193,18 @@
}
StringBuilder modulePrefix = new StringBuilder();
- for (ModuleNode currentModule : enclosingModules) {
+ Iterator<ModuleNode> it = enclosingModules.iterator();
+ while (it.hasNext()) {
+ ModuleNode currentModule = it.next();
Node cPath = currentModule.getCPath();
if (cPath instanceof Colon2Node) {
- String moduleName = ((Colon2Node) cPath).getName();
- modulePrefix.append(moduleName).append("::"); //$NON-NLS-1$
+ modulePrefix.append(((Colon2Node) cPath).getName());
+ if(it.hasNext()) {
+ modulePrefix.append("::"); //$NON-NLS-1$
+ }
}
}
+
return modulePrefix.toString();
}
@@ -210,13 +216,13 @@
return NodeProvider.getClassFieldOccurences(wrappedNode);
}
- public Collection<ModuleIncludeWrapper> getIncludeCalls() {
- Collection<ModuleIncludeWrapper> includes = new ArrayList<ModuleIncludeWrapper>();
+ public Collection<ModuleSpecifierWrapper> getIncludeCalls() {
+ Collection<ModuleSpecifierWrapper> includes = new ArrayList<ModuleSpecifierWrapper>();
for (Node node : NodeProvider.getSubNodes(wrappedNode, FCallNode.class)) {
FCallNode call = (FCallNode) node;
if("include".equals(call.getName())) { //$NON-NLS-1$
- includes.add(ModuleIncludeWrapper.create(((ArrayNode) call.getArgsNode()).get(0), getModulePrefix()));
+ includes.add(ModuleSpecifierWrapper.create(((ArrayNode) call.getArgsNode()).get(0), getModulePrefix()));
}
}
return includes;
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/RealClassNodeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/RealClassNodeWrapper.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/RealClassNodeWrapper.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -56,7 +56,10 @@
@Override
public String getClassName() {
- return getModulePrefix() + ((INameNode) classNode.getCPath()).getName();
+ if("".equals(getModulePrefix())) {
+ return classNode.getCPath().getName();
+ }
+ return getModulePrefix() + "::" + classNode.getCPath().getName();
}
@Override
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NameHelper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NameHelper.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/util/NameHelper.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -31,11 +31,15 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Iterator;
+import java.util.Vector;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jruby.ast.Colon2Node;
+import org.jruby.ast.Colon3Node;
import org.jruby.ast.ConstNode;
+import org.jruby.ast.ModuleNode;
import org.jruby.ast.Node;
import org.jruby.ast.types.INameNode;
import org.rubypeople.rdt.refactoring.core.NodeProvider;
@@ -124,7 +128,37 @@
}
return newName;
}
+
+ public static String getEncosingModulePrefix(Node rootNode, Node node) {
+ Vector<String> nameParts = new Vector<String>();
+
+ while(true) {
+ Node parent = NodeProvider.findParentNode(rootNode, node, ModuleNode.class);
+ if(parent == null) {
+ break;
+ }
+ Colon3Node path = ((ModuleNode) parent).getCPath();
+ if(path != node) {
+ nameParts.insertElementAt(getFullyQualifiedName(path), 0);
+ }
+ node = parent;
+ }
+
+ StringBuilder prefix = new StringBuilder();
+ Iterator<String> it = nameParts.iterator();
+ while (it.hasNext()) {
+ String name = it.next();
+ prefix.append(name);
+
+ if(it.hasNext()) {
+ prefix.append("::");
+ }
+ }
+
+ return prefix.toString();
+ }
+
public static String getFullyQualifiedName(Node n) {
assert n instanceof ConstNode || n instanceof Colon2Node;
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.result.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.result.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.result.rb 2007-04-19 08:56:37 UTC (rev 2339)
@@ -0,0 +1,5 @@
+def test_unit_name
+ 'test/unit'
+end
+
+require test_unit_name
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.source.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.source.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.source.rb 2007-04-19 08:56:37 UTC (rev 2339)
@@ -0,0 +1 @@
+require 'test/unit'
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.test_properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.test_properties (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/extractmethod/extract_method_test_29.test_properties 2007-04-19 08:56:37 UTC (rev 2339)
@@ -0,0 +1,4 @@
+start=15
+end=15
+name=test_unit_name
+visibility=none
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/util/TC_NameHelper_ModulePrefix.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/util/TC_NameHelper_ModulePrefix.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/util/TC_NameHelper_ModulePrefix.rb 2007-04-19 08:56:37 UTC (rev 2339)
@@ -0,0 +1,23 @@
+module M1
+ var = 5
+end
+
+var = 5
+
+module M1
+ module M3
+ M1.test
+ end
+end
+
+
+module OuterModule
+ module Module
+ end
+end
+
+module OuterModule
+ class Test
+ include Module
+ end
+end
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TC_ModuleInclusionFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TC_ModuleInclusionFinder.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TC_ModuleInclusionFinder.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -29,7 +29,7 @@
package org.rubypeople.rdt.refactoring.tests.core.renamemodule;
import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleIncludeFinder;
-import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleIncludeWrapper;
+import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleSpecifierWrapper;
import org.rubypeople.rdt.refactoring.documentprovider.IDocumentProvider;
import org.rubypeople.rdt.refactoring.documentprovider.StringDocumentProvider;
import org.rubypeople.rdt.refactoring.tests.FileTestCase;
@@ -43,7 +43,7 @@
public void testSingleDirectInclude() {
IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_SingleDirectInclude.rb");
- ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleIncludeWrapper[]{});
+ ModuleSpecifierWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleSpecifierWrapper[]{});
assertEquals(1, includes.length);
assertNotNull(includes[0].getWrappedNode());
@@ -53,7 +53,7 @@
public void testMultipleDirectIncludes() {
IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_MultipleDirectIncludes.rb");
- ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleIncludeWrapper[]{});
+ ModuleSpecifierWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleSpecifierWrapper[]{});
assertEquals(2, includes.length);
assertEquals("M1", includes[0].getFullName());
@@ -63,7 +63,7 @@
public void testIncludeWithNamespace() {
IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_IncludeWithNamespace.rb");
- ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("Namespace::M1").toArray(new ModuleIncludeWrapper[]{});
+ ModuleSpecifierWrapper[] includes = new ModuleIncludeFinder(document).find("Namespace::M1").toArray(new ModuleSpecifierWrapper[]{});
assertEquals(1, includes.length);
assertEquals("Namespace::M1", includes[0].getFullName());
@@ -72,7 +72,7 @@
public void testIncludeFromWithinSameNamespace() {
IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_IncludeFromWithinSameNamespace.rb");
- ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("Modul::M").toArray(new ModuleIncludeWrapper[]{});
+ ModuleSpecifierWrapper[] includes = new ModuleIncludeFinder(document).find("Modul::M").toArray(new ModuleSpecifierWrapper[]{});
assertEquals(2, includes.length);
assertEquals("Modul::M", includes[0].getFullName());
@@ -82,7 +82,7 @@
public void testModulesWithEqualNamesInDifferentNamespaces() {
IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_ModulesWithEqualNamesInDifferentNamespaces.rb");
- ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("Module::InnerModule").toArray(new ModuleIncludeWrapper[]{});
+ ModuleSpecifierWrapper[] includes = new ModuleIncludeFinder(document).find("Module::InnerModule").toArray(new ModuleSpecifierWrapper[]{});
assertEquals(1, includes.length);
assertEquals("Module::InnerModule", includes[0].getFullName());
@@ -91,7 +91,7 @@
public void testNoIncludes() {
IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_NoIncludes.rb");
- ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleIncludeWrapper[]{});
+ ModuleSpecifierWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleSpecifierWrapper[]{});
assertEquals(0, includes.length);
}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/util/TC_NameHelper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/util/TC_NameHelper.java 2007-04-18 20:31:12 UTC (rev 2338)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/util/TC_NameHelper.java 2007-04-19 08:56:37 UTC (rev 2339)
@@ -30,11 +30,17 @@
import java.util.ArrayList;
+import org.jruby.ast.Node;
+import org.jruby.ast.RootNode;
+import org.rubypeople.rdt.refactoring.core.SelectionNodeProvider;
+import org.rubypeople.rdt.refactoring.tests.FileTestCase;
import org.rubypeople.rdt.refactoring.util.NameHelper;
-import junit.framework.TestCase;
+public class TC_NameHelper extends FileTestCase {
-public class TC_NameHelper extends TestCase {
+ public TC_NameHelper() {
+ super("Name Helper");
+ }
public void testCreateName() {
assertEquals("string1", NameHelper.createName("string"));
@@ -74,4 +80,29 @@
assertEquals(first[i], name.get(i));
}
}
+
+ public void testModulePrefix() {
+ final RootNode rootNode = getRootNode("TC_NameHelper_ModulePrefix.rb");
+
+ Node node = getLastNode(14, rootNode);
+ assertEquals("M1", NameHelper.getEncosingModulePrefix(rootNode, node));
+
+ node = getLastNode(27, rootNode);
+
+ assertEquals("", NameHelper.getEncosingModulePrefix(rootNode, node));
+
+ node = getLastNode(62, rootNode);
+
+ assertEquals("M1::M3", NameHelper.getEncosingModulePrefix(rootNode, node));
+
+ node = getLastNode(173, rootNode);
+
+ assertEquals("OuterModule", NameHelper.getEncosingModulePrefix(rootNode, node));
+ }
+
+ private Node getLastNode(int pos, RootNode rootNode) {
+ Node[] nodes = SelectionNodeProvider.getSelectedNodesOfType(rootNode, pos, Node.class).toArray(new Node[]{});
+ assertTrue(nodes.length > 0);
+ return nodes[nodes.length - 1];
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-18 20:31:13
|
Revision: 2338
http://svn.sourceforge.net/rubyeclipse/?rev=2338&view=rev
Author: cawilliams
Date: 2007-04-18 13:31:12 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java 2007-04-18 20:20:44 UTC (rev 2337)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/StandardRubyElementContentProvider.java 2007-04-18 20:31:12 UTC (rev 2338)
@@ -230,7 +230,7 @@
}
private Object[] getFoldersAndRubyScripts(ISourceFolder folder) throws RubyModelException {
- return folder.getChildren();
+ return concatenate(folder.getRubyScripts(), folder.getNonRubyResources());
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-18 20:20:45
|
Revision: 2337
http://svn.sourceforge.net/rubyeclipse/?rev=2337&view=rev
Author: cawilliams
Date: 2007-04-18 13:20:44 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
don't show import containers at same level as types in types view
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingContentProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingContentProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingContentProvider.java 2007-04-18 19:31:08 UTC (rev 2336)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/browsing/RubyBrowsingContentProvider.java 2007-04-18 20:20:44 UTC (rev 2337)
@@ -82,7 +82,7 @@
if (fProvideMembers && element instanceof IType)
return getChildren((IType)element);
if (fProvideMembers && element instanceof ISourceReference && element instanceof IParent)
- return super.getChildren(element);
+ return removeImportDeclarations(super.getChildren(element));
if (element instanceof IRubyProject)
return getSourceFolderRoots((IRubyProject)element);
return super.getChildren(element);
@@ -93,6 +93,14 @@
}
}
+ private Object[] removeImportDeclarations(Object[] members) {
+ ArrayList tempResult= new ArrayList(members.length);
+ for (int i= 0; i < members.length; i++)
+ if (!(members[i] instanceof IImportContainer))
+ tempResult.add(members[i]);
+ return tempResult.toArray();
+ }
+
private Object[] getFolderContents(ISourceFolder fragment) throws RubyModelException {
ISourceReference[] sourceRefs= fragment.getRubyScripts();
Object[] result= new Object[0];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-18 19:31:09
|
Revision: 2336
http://svn.sourceforge.net/rubyeclipse/?rev=2336&view=rev
Author: cawilliams
Date: 2007-04-18 12:31:08 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Removed Paths:
-------------
trunk/org.rubypeople.rdt.core/lib/README.txt
trunk/org.rubypeople.rdt.core/lib/generateJrubyJar.jardesc
Deleted: trunk/org.rubypeople.rdt.core/lib/README.txt
===================================================================
--- trunk/org.rubypeople.rdt.core/lib/README.txt 2007-04-18 19:29:39 UTC (rev 2335)
+++ trunk/org.rubypeople.rdt.core/lib/README.txt 2007-04-18 19:31:08 UTC (rev 2336)
@@ -1,5 +0,0 @@
-Create the jruby.jar:
-1) Checkout the Branch TOM_RDT_POSITION from :pserver:ano...@cv...:/cvsroot/jruby
-2) Open JAR Packager on generateJrubyJar.jardesc, adapt the target path and create the jruby.jar file
-
-
Deleted: trunk/org.rubypeople.rdt.core/lib/generateJrubyJar.jardesc
===================================================================
--- trunk/org.rubypeople.rdt.core/lib/generateJrubyJar.jardesc 2007-04-18 19:29:39 UTC (rev 2335)
+++ trunk/org.rubypeople.rdt.core/lib/generateJrubyJar.jardesc 2007-04-18 19:31:08 UTC (rev 2336)
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<jardesc>
-<jar path="org.rubypeople.rdt.core/lib/jruby.jar"/>
-<options buildIfNeeded="true" compress="true" descriptionLocation="/org.rubypeople.rdt.core/generateJrubyJar.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" useSourceFolders="false"/>
-<manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
-<sealing sealJar="false">
-<packagesToSeal/>
-<packagesToUnSeal/>
-</sealing>
-</manifest>
-<selectedElements exportClassFiles="true" exportJavaFiles="true" exportOutputFolder="false">
-<javaElement handleIdentifier="=jruby/src"/>
-</selectedElements>
-</jardesc>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-18 19:29:40
|
Revision: 2335
http://svn.sourceforge.net/rubyeclipse/?rev=2335&view=rev
Author: cawilliams
Date: 2007-04-18 12:29:39 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Removed Paths:
-------------
trunk/org.rubypeople.rdt.core/ruby/lib/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-18 19:16:09
|
Revision: 2334
http://svn.sourceforge.net/rubyeclipse/?rev=2334&view=rev
Author: cawilliams
Date: 2007-04-18 12:16:07 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
add copyright headers
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ConstantExtractor.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConfig.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantCall.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantDef.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ConstantExtractor.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ConstantExtractor.java 2007-04-18 19:15:23 UTC (rev 2333)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ConstantExtractor.java 2007-04-18 19:16:07 UTC (rev 2334)
@@ -1,3 +1,12 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
package org.rubypeople.rdt.refactoring.core.extractconstant;
import java.util.ArrayList;
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java 2007-04-18 19:15:23 UTC (rev 2333)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java 2007-04-18 19:16:07 UTC (rev 2334)
@@ -1,3 +1,12 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
package org.rubypeople.rdt.refactoring.core.extractconstant;
import org.jruby.ast.ArrayNode;
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConfig.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConfig.java 2007-04-18 19:15:23 UTC (rev 2333)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConfig.java 2007-04-18 19:16:07 UTC (rev 2334)
@@ -1,3 +1,12 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
package org.rubypeople.rdt.refactoring.core.extractconstant;
import org.jruby.ast.Node;
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantRefactoring.java 2007-04-18 19:15:23 UTC (rev 2333)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantRefactoring.java 2007-04-18 19:16:07 UTC (rev 2334)
@@ -1,3 +1,12 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
package org.rubypeople.rdt.refactoring.core.extractconstant;
import org.eclipse.ltk.ui.refactoring.UserInputWizardPage;
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantCall.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantCall.java 2007-04-18 19:15:23 UTC (rev 2333)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantCall.java 2007-04-18 19:16:07 UTC (rev 2334)
@@ -1,3 +1,12 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
package org.rubypeople.rdt.refactoring.core.extractconstant;
import org.jruby.ast.Node;
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantDef.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantDef.java 2007-04-18 19:15:23 UTC (rev 2333)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantDef.java 2007-04-18 19:16:07 UTC (rev 2334)
@@ -1,3 +1,12 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
package org.rubypeople.rdt.refactoring.core.extractconstant;
import org.jruby.ast.BlockNode;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-18 19:15:24
|
Revision: 2333
http://svn.sourceforge.net/rubyeclipse/?rev=2333&view=rev
Author: cawilliams
Date: 2007-04-18 12:15:23 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
pull up method refactoring
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/MethodUpPuller.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/PullUpRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethods.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethodsClass.java
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/MethodUpPuller.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/MethodUpPuller.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/MethodUpPuller.java 2007-04-18 19:15:23 UTC (rev 2333)
@@ -0,0 +1,180 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
+package org.rubypeople.rdt.refactoring.core.pullup;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.rubypeople.rdt.refactoring.classnodeprovider.ClassNodeProvider;
+import org.rubypeople.rdt.refactoring.documentprovider.DocumentProvider;
+import org.rubypeople.rdt.refactoring.editprovider.DeleteEditProvider;
+import org.rubypeople.rdt.refactoring.editprovider.EditAndTreeContentProvider;
+import org.rubypeople.rdt.refactoring.editprovider.EditProvider;
+import org.rubypeople.rdt.refactoring.editprovider.EditProviderGroups;
+import org.rubypeople.rdt.refactoring.editprovider.ITreeClass;
+import org.rubypeople.rdt.refactoring.nodewrapper.ClassNodeWrapper;
+import org.rubypeople.rdt.refactoring.nodewrapper.MethodNodeWrapper;
+import org.rubypeople.rdt.refactoring.ui.IItemSelectionReceiver;
+import org.rubypeople.rdt.refactoring.ui.IParentProvider;
+
+public class MethodUpPuller extends EditAndTreeContentProvider implements IItemSelectionReceiver {
+
+
+ private Object[] selectedTreeItems;
+
+ private ClassNodeProvider projectClassNodeProvider;
+
+ private ClassNodeProvider classNodeProvider;
+
+ public MethodUpPuller(DocumentProvider documentProvider) {
+ this.projectClassNodeProvider = documentProvider.getProjectClassNodeProvider();
+ this.classNodeProvider = documentProvider.getClassNodeProvider();
+
+ initTreeClasses(classNodeProvider);
+ }
+
+ @Override
+ protected ITreeClass createTreeClass(ClassNodeWrapper classNode) {
+ return new TreeClass(classNode);
+ }
+
+ @Override
+ public Collection<EditProvider> getEditProviders() {
+ EditProviderGroups editProviderGroups = new EditProviderGroups();
+ if (selectedTreeItems != null) {
+ for (Object o : selectedTreeItems) {
+ if (o instanceof TreeClass) {
+ TreeClass treeClass = (TreeClass) o;
+ treeClass.addUpPulledMethods(editProviderGroups);
+ }
+ }
+ }
+ return editProviderGroups.getAllEditProviders();
+ }
+
+ public void setSelectedItems(Object[] checkedElements) {
+ selectedTreeItems = checkedElements.clone();
+ }
+
+ public class TreeClass implements org.rubypeople.rdt.refactoring.ui.IChildrenProvider, ITreeClass {
+ private ClassNodeWrapper classNode;
+ private Collection<DownPushableMethod> downPushableMethods;
+ private ClassNodeWrapper superClass;
+
+ public TreeClass(ClassNodeWrapper classNode) {
+ this.classNode = classNode;
+ downPushableMethods = new ArrayList<DownPushableMethod>();
+ superClass = projectClassNodeProvider.getSuperClassOf(classNode.getSuperClassName());
+
+ if (superClass != null) {
+ for (MethodNodeWrapper methodNode : classNode.getMethods()) {
+ downPushableMethods.add(new DownPushableMethod(methodNode));
+ }
+ }
+ }
+
+ public void addUpPulledMethods(EditProviderGroups editProviderGroups) {
+ Collection<MethodNodeWrapper> checkedMethods = getCheckedMethods();
+
+ String childClassName = superClass.getName();
+ if (classNodeProvider.hasClassNode(childClassName)) {
+ ClassNodeWrapper classNode = classNodeProvider.getClassNode(childClassName);
+ addUpPulledMethods(classNode, checkedMethods, editProviderGroups);
+ } else {
+ addUpPulledMethodsClass(childClassName, checkedMethods, editProviderGroups);
+ }
+
+ addRemoveEdits(checkedMethods, editProviderGroups);
+ }
+
+ private void addRemoveEdits(Collection<MethodNodeWrapper> checkedMethods, EditProviderGroups editProviderGroups) {
+ for (MethodNodeWrapper methodNode : checkedMethods) {
+ editProviderGroups.add("removeOldMethods", new DeleteEditProvider(methodNode.getWrappedNode()));
+ }
+ }
+
+ private void addUpPulledMethods(ClassNodeWrapper childClassNode, Collection<MethodNodeWrapper> checkedMethods,
+ EditProviderGroups editProviderGroups) {
+ Collection<MethodNodeWrapper> constructorNodes = new ArrayList<MethodNodeWrapper>();
+ Collection<MethodNodeWrapper> methodNodes = new ArrayList<MethodNodeWrapper>();
+ separateConstructors(checkedMethods, methodNodes, constructorNodes);
+ if (!constructorNodes.isEmpty()) {
+ UpPulledMethods constructors = new UpPulledMethods(constructorNodes, childClassNode, true);
+ editProviderGroups.add("constructors_" + childClassNode.getName(), constructors);
+ }
+ if (!methodNodes.isEmpty()) {
+ UpPulledMethods methods = new UpPulledMethods(methodNodes, childClassNode, false);
+ editProviderGroups.add("methods_" + childClassNode.getName(), methods);
+ }
+ }
+
+ private void separateConstructors(Collection<MethodNodeWrapper> nodes, Collection<MethodNodeWrapper> methodNodes,
+ Collection<MethodNodeWrapper> constructorNodes) {
+ for (MethodNodeWrapper method : nodes) {
+ if (method.getSignature().isConstructor())
+ constructorNodes.add(method);
+ else
+ methodNodes.add(method);
+ }
+ }
+
+ private Collection<MethodNodeWrapper> getCheckedMethods() {
+ Collection<Object> allCheckedItems = Arrays.asList(selectedTreeItems);
+ Collection<MethodNodeWrapper> checkedMethods = new ArrayList<MethodNodeWrapper>();
+ for (DownPushableMethod method : downPushableMethods) {
+ if (allCheckedItems.contains(method))
+ checkedMethods.add(method.getMethodNode());
+ }
+ return checkedMethods;
+ }
+
+ private void addUpPulledMethodsClass(String className, Collection<MethodNodeWrapper> checkedMethods, EditProviderGroups editProviderGroups) {
+ UpPulledMethodsClass methodsClass = new UpPulledMethodsClass(className, checkedMethods);
+ editProviderGroups.add("newClasses_", methodsClass);
+ }
+
+ public String toString() {
+ return classNode.getName();
+ }
+
+ public Object[] getChildren() {
+ return downPushableMethods.toArray();
+ }
+
+ public boolean hasChildren() {
+ return !downPushableMethods.isEmpty();
+ }
+
+ public class DownPushableMethod implements IParentProvider {
+ private MethodNodeWrapper methodNode;
+
+ public DownPushableMethod(MethodNodeWrapper methodNode) {
+ this.methodNode = methodNode;
+ }
+
+ public String toString() {
+ return methodNode.getName();
+ }
+
+ public Object getParent() {
+ return TreeClass.this;
+ }
+
+ public TreeClass getTreeClass() {
+ return TreeClass.this;
+ }
+
+ public MethodNodeWrapper getMethodNode() {
+ return methodNode;
+ }
+ }
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/PullUpRefactoring.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/PullUpRefactoring.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/PullUpRefactoring.java 2007-04-18 19:15:23 UTC (rev 2333)
@@ -0,0 +1,25 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
+package org.rubypeople.rdt.refactoring.core.pullup;
+
+import org.rubypeople.rdt.refactoring.core.RubyRefactoring;
+import org.rubypeople.rdt.refactoring.ui.pages.MethodUpPullerSelectionPage;
+
+public class PullUpRefactoring extends RubyRefactoring {
+
+ public static final String NAME = "Pull up";
+
+ public PullUpRefactoring() {
+ super(NAME);
+ MethodUpPuller upPuller = new MethodUpPuller(getDocumentProvider());
+ setEditProvider(upPuller);
+ pages.add(new MethodUpPullerSelectionPage(upPuller));
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethods.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethods.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethods.java 2007-04-18 19:15:23 UTC (rev 2333)
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
+package org.rubypeople.rdt.refactoring.core.pullup;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jruby.ast.BlockNode;
+import org.jruby.ast.Node;
+import org.rubypeople.rdt.refactoring.core.NodeFactory;
+import org.rubypeople.rdt.refactoring.editprovider.InsertEditProvider;
+import org.rubypeople.rdt.refactoring.nodewrapper.ClassNodeWrapper;
+import org.rubypeople.rdt.refactoring.nodewrapper.MethodNodeWrapper;
+import org.rubypeople.rdt.refactoring.offsetprovider.ConstructorOffsetProvider;
+import org.rubypeople.rdt.refactoring.offsetprovider.IOffsetProvider;
+import org.rubypeople.rdt.refactoring.offsetprovider.MethodOffsetProvider;
+
+public class UpPulledMethods extends InsertEditProvider {
+
+ private Collection<MethodNodeWrapper> methodNodes;
+
+ private boolean constructors;
+
+ private ClassNodeWrapper classNode;
+
+ public UpPulledMethods(Collection<MethodNodeWrapper> methodNodes, ClassNodeWrapper classNode, boolean constructors) {
+ super(true);
+ this.methodNodes = methodNodes;
+ this.constructors = constructors;
+ this.classNode = classNode;
+ }
+
+ @Override
+ protected BlockNode getInsertNode(int offset, String document) {
+ boolean needsNewLineAtEndOfBlock = lastEditInGroup && !isNextLineEmpty(offset, document);
+ return NodeFactory.createBlockNode(needsNewLineAtEndOfBlock, getMethodNodes(methodNodes));
+ }
+
+ private Node[] getMethodNodes(Collection<MethodNodeWrapper> nodeCollection) {
+ Collection<Node> nodes = new ArrayList<Node>();
+ boolean first = true;
+ for (MethodNodeWrapper methodNode : nodeCollection) {
+ if (first) {
+ first = false;
+ } else {
+ nodes.add(NodeFactory.createNewLineNode(null));
+ }
+ nodes.add(NodeFactory.createNewLineNode(methodNode.getWrappedNode()));
+ }
+ return nodes.toArray(new Node[nodes.size()]);
+ }
+
+ @Override
+ protected int getOffset(String document) {
+ IOffsetProvider offsetProvider;
+ if (constructors) {
+ offsetProvider = new ConstructorOffsetProvider(classNode, document);
+ } else {
+ offsetProvider = new MethodOffsetProvider(classNode, document);
+ }
+ return offsetProvider.getOffset();
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethodsClass.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethodsClass.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/UpPulledMethodsClass.java 2007-04-18 19:15:23 UTC (rev 2333)
@@ -0,0 +1,87 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
+package org.rubypeople.rdt.refactoring.core.pullup;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.jruby.ast.BlockNode;
+import org.jruby.ast.Node;
+import org.jruby.lexer.yacc.SourcePosition;
+import org.rubypeople.rdt.refactoring.core.NodeFactory;
+import org.rubypeople.rdt.refactoring.core.pushdown.NewClassOffsetProvier;
+import org.rubypeople.rdt.refactoring.editprovider.InsertEditProvider;
+import org.rubypeople.rdt.refactoring.nodewrapper.MethodNodeWrapper;
+import org.rubypeople.rdt.refactoring.offsetprovider.IOffsetProvider;
+
+public class UpPulledMethodsClass extends InsertEditProvider {
+ private Collection<MethodNodeWrapper> methodNodes;
+
+ private Collection<MethodNodeWrapper> constructorNodes;
+
+ private String className;
+
+ public UpPulledMethodsClass(String className, Collection<MethodNodeWrapper> allMethodNodes) {
+ super(true);
+ this.className = className;
+ initConstrucorAndMethodNodes(allMethodNodes);
+ }
+
+ private void initConstrucorAndMethodNodes(Collection<MethodNodeWrapper> allMethodNodes) {
+ methodNodes = new ArrayList<MethodNodeWrapper>();
+ constructorNodes = new ArrayList<MethodNodeWrapper>();
+ for (MethodNodeWrapper node : allMethodNodes) {
+ if (node.getSignature().isConstructor())
+ constructorNodes.add(node);
+ else
+ methodNodes.add(node);
+ }
+ }
+
+ @Override
+ protected BlockNode getInsertNode(int offset, String document) {
+ if (firstEditInGroup) {
+ setInsertType(INSERT_AT_BEGIN_OF_LINE);
+ }
+ boolean needsNewLineAtEndOfBlock = lastEditInGroup && !isNextLineEmpty(offset, document);
+ Node classNode = getClassNode();
+
+ BlockNode blockNode = NodeFactory.createBlockNode();
+ blockNode.add(classNode);
+ if (!firstEditInGroup)
+ blockNode.add(NodeFactory.createNewLineNode(null));
+ if (needsNewLineAtEndOfBlock)
+ blockNode.add(NodeFactory.createNewLineNode(null));
+ return blockNode;
+ }
+
+ private Node getClassNode() {
+ return NodeFactory.createNewLineNode(NodeFactory.createClassNode(className, getBody()));
+ }
+
+ private Node getBody() {
+ BlockNode body = new BlockNode(new SourcePosition());
+ body.add(NodeFactory.createNewLineNode(null));
+ for (MethodNodeWrapper constructor : constructorNodes) {
+ body.add(NodeFactory.createNewLineNode(constructor.getWrappedNode()));
+ }
+ for (MethodNodeWrapper method : methodNodes) {
+ body.add(NodeFactory.createNewLineNode(method.getWrappedNode()));
+ }
+ body.add(NodeFactory.createNewLineNode(null));
+ return body;
+ }
+
+ @Override
+ protected int getOffset(String document) {
+ IOffsetProvider offsetProvider = new NewClassOffsetProvier();
+ return offsetProvider.getOffset();
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-18 19:14:41
|
Revision: 2332
http://svn.sourceforge.net/rubyeclipse/?rev=2332&view=rev
Author: cawilliams
Date: 2007-04-18 12:14:40 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
include two new refactorings - Extract Constant and Pull Up method
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/plugin.xml
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/classnodeprovider/ClassNodeProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractmethod/ExtractedMethodDef.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/RefactoringMessages.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/RefactoringMessages.properties
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/ExtractConstantAction.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/PullUpAction.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ConstantExtractor.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConditionChecker.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantConfig.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractConstantRefactoring.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantCall.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/extractconstant/ExtractedConstantDef.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/pullup/
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/ExtractConstantPage.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/ui/pages/MethodUpPullerSelectionPage.java
Modified: trunk/org.rubypeople.rdt.refactoring/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/plugin.xml 2007-04-18 17:10:10 UTC (rev 2331)
+++ trunk/org.rubypeople.rdt.refactoring/plugin.xml 2007-04-18 19:14:40 UTC (rev 2332)
@@ -1,385 +1,401 @@
-<plugin>
- <extension
- point="org.rubypeople.rdt.ui.editorPopupExtender">
- <rubyEditorPopupMenuExtension
- class="org.rubypeople.rdt.refactoring.action.RefactoringActionGroup">
- </rubyEditorPopupMenuExtension>
- </extension>
-<extension
- point="org.eclipse.ui.editorActions">
-
-
-
- <editorContribution
- id="org.rubypeople.rdt.refactoring.refactoringEditorActions"
- targetID="org.rubypeople.rdt.ui.EditorRubyFile">
- <menu
- id="org.rubypeople.rdt.refactoring.refactoringMenu"
- label="%rubyRefactoring.refactoringMenuLabel"
- path="edit">
- <separator name="org.rubypeople.rdt.refactoring.refactoringGroup"/>
- </menu>
- <menu
- id="org.rubypeople.rdt.refactoring.sourceMenu"
- label="%rubyRefactoring.sourceMenuLabel"
- path="edit">
- <separator name="org.rubypeople.rdt.refactoring.sourceGeneratorGroup"/>
- </menu>
-<!-- Source: -->
- <action
- class="org.rubypeople.rdt.refactoring.action.OverrideMethodAction"
- definitionId="org.rubypeople.rdt.refactoring.command.OverrideMethod"
- id="org.rubypeople.rdt.refactoring.overrideMethodAction"
- label="%rubyRefactoring.OverrideMethodLabel"
- menubarPath="org.rubypeople.rdt.refactoring.sourceMenu/org.rubypeople.rdt.refactoring.sourceGeneratorGroup"
- tooltip="Add Constructor from Superclass"/>
- <action
- class="org.rubypeople.rdt.refactoring.action.GenerateConstructorAction"
- definitionId="org.rubypeople.rdt.refactoring.command.GenerateConstructor"
- id="org.rubypeople.rdt.refactoring.generateConstructorAction"
- label="%rubyRefactoring.GenerateConstructorLabel"
- menubarPath="org.rubypeople.rdt.refactoring.sourceMenu/org.rubypeople.rdt.refactoring.sourceGeneratorGroup"
- tooltip="Generate Constructor"/>
- <action
- class="org.rubypeople.rdt.refactoring.action.GenerateAccessorsAction"
- definitionId="org.rubypeople.rdt.refactoring.command.GenerateAccessors"
- id="org.rubypeople.rdt.refactoring.generateaccessors"
- label="%rubyRefactoring.GenerateAccessorLabel"
- menubarPath="org.rubypeople.rdt.refactoring.sourceMenu/org.rubypeople.rdt.refactoring.sourceGeneratorGroup"
- tooltip="Generate Accessors"/>
-<!-- experimental
- <action
- class="org.rubypeople.rdt.refactoring.action.FormatSourceAction"
- enablesFor="*"
- id="org.rubypeople.rdt.refactoring.renameFormatSourceAction"
- label="%rubyRefactoring.FormatSourceLabel"
- menubarPath="org.rubypeople.rdt.refactoring.sourceMenu/org.rubypeople.rdt.refactoring.sourceGeneratorGroup"
- style="push"
- tooltip="Formats the Sourcecode"/> -->
-<!-- Refactorings: -->
- <action
- class="org.rubypeople.rdt.refactoring.action.SplitTempAction"
- definitionId="org.rubypeople.rdt.refactoring.command.SplitTemp"
- id="org.rubypeople.rdt.refactoring.splitTempAction"
- label="%rubyRefactoring.SplitTempLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- tooltip="Split Temporary Variable"/>
- <action
- class="org.rubypeople.rdt.refactoring.action.RenameAction"
- definitionId="org.rubypeople.rdt.refactoring.command.Rename"
- id="org.rubypeople.rdt.refactoring.renameAction"
- label="%rubyRefactoring.RenameLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- tooltip="Renames the selected element..."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.PushDownAction"
- definitionId="org.rubypeople.rdt.refactoring.command.PushDown"
- id="org.rubypeople.rdt.refactoring.pushDownAction"
- label="%rubyRefactoring.PushDownLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Pushes down a method"/>
- <action
- class="org.rubypeople.rdt.refactoring.action.MoveMethodAction"
- definitionId="org.rubypeople.rdt.refactoring.command.MoveMethod"
- id="org.rubypeople.rdt.refactoring.MoveMethod"
- label="%rubyRefactoring.MoveMethodLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Moves the selected method into another class."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
- definitionId="org.rubypeople.rdt.refactoring.command.MoveField"
- id="org.rubypeople.rdt.refactoring.MoveField"
- label="%rubyRefactoring.MoveFieldLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Moves the selected field into another class."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.MergeWithExternalClassPartsAction"
- definitionId="org.rubypeople.rdt.refactoring.command.MergeWithExternalClassParts"
- id="org.rubypeople.rdt.refactoring.mergeWithExternalClassParts"
- label="%rubyRefactoring.MergeWithExternalClassPartsLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Merges different class parts of the same class in different files."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.MergeClassPartsInFileAction"
- definitionId="org.rubypeople.rdt.refactoring.command.MergeClassPartsInFile"
- id="org.rubypeople.rdt.refactoring.mergeClassPartsInFile"
- label="%rubyRefactoring.MergeClassPartsInFileLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Merges different class parts of the same class in the current file."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.InlineMethodAction"
- definitionId="org.rubypeople.rdt.refactoring.command.InlineMethod"
- id="org.rubypeople.rdt.refactoring.inlineMethod"
- label="%rubyRefactoring.InlineMethodLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Replaces the selected method call with the methods body."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.InlineTempAction"
- definitionId="org.rubypeople.rdt.refactoring.command.InlineTemp"
- id="org.rubypeople.rdt.refactoring.inlineTemp"
- label="%rubyRefactoring.InlineTempLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Replaces the occurences fo a local variable with its value."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.InlineClassAction"
- definitionId="org.rubypeople.rdt.refactoring.command.InlineClass"
- id="org.rubypeople.rdt.refactoring.inlineClassAction"
- label="%rubyRefactoring.InlineClassLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Inlines the selected class into another one."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.ExtractMethodAction"
- definitionId="org.rubypeople.rdt.refactoring.command.ExtractMethod"
- id="org.rubypeople.rdt.refactoring.extractMethodAction"
- label="%rubyRefactoring.ExtractMethodLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Extracts the selected code into a new method."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
- definitionId="org.rubypeople.rdt.refactoring.command.EncapsulateField"
- id="org.rubypeople.rdt.refactoring.extractMethod"
- label="%rubyRefactoring.EncapsulateField"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Encapsulates a field. A field (accessor) will be removed and getter and setter methods will be added."/>
- <action
- class="org.rubypeople.rdt.refactoring.action.ConvertTempToFieldAction"
- definitionId="org.rubypeople.rdt.refactoring.command.ConvertTempToField"
- id="org.rubypeople.rdt.refactoring.convertTempToFieldAction"
- label="%rubyRefactoring.ConvertTempToFieldLabel"
- menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
- style="push"
- tooltip="Converts a local variable to a field."/>
- </editorContribution>
-</extension>
-<extension
- point="org.eclipse.ui.commands">
- <category
- description="Refactorings"
- id="org.rubypeople.rdt.refactoring.commands.refactoring"
- name="Refactor - Ruby"/>
- <category
- description="Source Generators"
- id="org.rubypeople.rdt.refactoring.commands.source"
- name="Source - Ruby"/>
-<!-- Source: -->
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.source"
- id="org.rubypeople.rdt.refactoring.command.GenerateAccessors"
- name="%rubyRefactoring.GenerateAccessorLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.source"
- id="org.rubypeople.rdt.refactoring.command.GenerateConstructor"
- name="%rubyRefactoring.GenerateConstructorLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.source"
- id="org.rubypeople.rdt.refactoring.command.OverrideMethod"
- name="%rubyRefactoring.OverrideMethodLabel"/>
-<!-- Refactorings: -->
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.Rename"
- name="%rubyRefactoring.RenameLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.SplitTemp"
- name="%rubyRefactoring.SplitTempLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.MergeClassPartsInFile"
- name="%rubyRefactoring.MergeClassPartsInFileLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.ConvertTempToField"
- name="%rubyRefactoring.ConvertTempToFieldLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.PushDown"
- name="%rubyRefactoring.PushDownLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.ExtractMethod"
- name="%rubyRefactoring.ExtractMethodLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.InlineMethod"
- name="%rubyRefactoring.InlineMethodLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.EncapsulateField"
- name="%rubyRefactoring.EncapsulateField"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.MergeWithExternalClassParts"
- name="%rubyRefactoring.MergeWithExternalClassPartsLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.InlineTemp"
- name="%rubyRefactoring.InlineTempLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.MoveMethod"
- name="%rubyRefactoring.MoveMethodLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.MoveField"
- name="%rubyRefactoring.MoveFieldLabel"/>
- <command
- categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
- id="org.rubypeople.rdt.refactoring.command.InlineClass"
- name="%rubyRefactoring.InlineClassLabel"/>
-</extension>
-
-<extension
- point="org.eclipse.ui.bindings"> <!-- M1 == Ctrl, M2 == Shift M3 == Alt -->
- <key
- commandId="org.rubypeople.rdt.refactoring.command.ExtractMethod"
- contextId="org.rubypeople.rdt.ui.rubyEditorScope"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M2+M3+M "/>
- <key
- commandId="org.rubypeople.rdt.refactoring.command.MoveField"
- contextId="org.rubypeople.rdt.ui.rubyEditorScope"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M2+M3+V F"/>
- <key
- commandId="org.rubypeople.rdt.refactoring.command.MoveMethod"
- contextId="org.rubypeople.rdt.ui.rubyEditorScope"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M2+M3+V M"/>
- <key
- commandId="org.rubypeople.rdt.refactoring.command.InlineClass"
- contextId="org.rubypeople.rdt.ui.rubyEditorScope"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M2+M3+I C"/>
- <key
- commandId="org.rubypeople.rdt.refactoring.command.InlineTemp"
- contextId="org.rubypeople.rdt.ui.rubyEditorScope"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M2+M3+I L"/>
- <key
- commandId="org.rubypeople.rdt.refactoring.command.InlineMethod"
- contextId="org.rubypeople.rdt.ui.rubyEditorScope"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M2+M3+I M"/>
- <key
- commandId="org.rubypeople.rdt.refactoring.command.Rename"
- contextId="org.rubypeople.rdt.ui.rubyEditorScope"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="M2+M3+R"/>
-</extension>
-<extension
- point="org.eclipse.ui.popupMenus">
-
- <objectContribution
- id="org.rubypeople.rdt.refactoring.refactoringContext"
- objectClass="org.rubypeople.rdt.internal.core.RubyLocalVar">
- <action
- class="org.rubypeople.rdt.refactoring.action.ConvertTempToFieldAction"
- id="org.rubypeople.rdt.refactoring.action.ConvertTempToFieldAction"
- label="%rubyRefactoring.ConvertTempToFieldLabel"
- menubarPath="additions" />
- <action
- class="org.rubypeople.rdt.refactoring.action.InlineTempAction"
- id="org.rubypeople.rdt.refactoring.action.InlineTempAction"
- label="%rubyRefactoring.InlineTempLabel"
- menubarPath="additions" />
- <action
- class="org.rubypeople.rdt.refactoring.action.SplitTempAction"
- id="org.rubypeople.rdt.refactoring.action.SplitTempAction"
- label="%rubyRefactoring.SplitTempLabel"
- menubarPath="additions" />
- <action
- class="org.rubypeople.rdt.refactoring.action.RenameAction"
- id="org.rubypeople.rdt.refactoring.action.RenameAction"
- label="%rubyRefactoring.RenameLabel"
- menubarPath="additions" />
- </objectContribution>
-
- <objectContribution
- id="org.rubypeople.rdt.refactoring.refactoringContext"
- objectClass="org.rubypeople.rdt.internal.core.RubyType">
- <action
- class="org.rubypeople.rdt.refactoring.action.RenameAction"
- id="org.rubypeople.rdt.refactoring.action.RenameAction"
- label="%rubyRefactoring.RenameLabel"
- menubarPath="additions" />
- </objectContribution>
-
- <objectContribution
- id="org.rubypeople.rdt.refactoring.refactoringContext"
- objectClass="org.rubypeople.rdt.internal.core.RubyInstVar">
- <action
- class="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
- id="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
- label="%rubyRefactoring.EncapsulateField"
- menubarPath="additions" />
- <action
- class="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
- id="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
- label="%rubyRefactoring.MoveFieldLabel"
- menubarPath="additions" />
- <action
- class="org.rubypeople.rdt.refactoring.action.RenameAction"
- id="org.rubypeople.rdt.refactoring.action.RenameAction"
- label="%rubyRefactoring.RenameLabel"
- menubarPath="additions" />
- </objectContribution>
-
- <objectContribution
- id="org.rubypeople.rdt.refactoring.refactoringContext"
- objectClass="org.rubypeople.rdt.internal.core.RubyClassVar">
- <action
- class="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
- id="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
- label="%rubyRefactoring.EncapsulateField"
- menubarPath="additions" />
- <action
- class="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
- id="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
- label="%rubyRefactoring.MoveFieldLabel"
- menubarPath="additions" />
- <action
- class="org.rubypeople.rdt.refactoring.action.RenameAction"
- id="org.rubypeople.rdt.refactoring.action.RenameAction"
- label="%rubyRefactoring.RenameLabel"
- menubarPath="additions" />
- </objectContribution>
-
- <objectContribution
- id="org.rubypeople.rdt.refactoring.refactoringContext"
- objectClass="org.rubypeople.rdt.internal.core.RubyMethod">
- <action
- class="org.rubypeople.rdt.refactoring.action.MoveMethodAction"
- id="org.rubypeople.rdt.refactoring.action.MoveMethodAction"
- label="%rubyRefactoring.MoveMethodLabel"
- menubarPath="additions" />
- <action
- class="org.rubypeople.rdt.refactoring.action.RenameAction"
- id="org.rubypeople.rdt.refactoring.action.RenameAction"
- label="%rubyRefactoring.RenameLabel"
- menubarPath="additions" />
- </objectContribution>
-
-</extension>
-
-<extension
- point="org.eclipse.ltk.ui.refactoring.changePreviewViewers">
- <changePreviewViewer
- class="org.rubypeople.rdt.refactoring.preview.RubyTextEditChangePreviewViewer"
- id="org.rubypeople.rdt.refactoring.preview.RubyTextEditChangePreviewViewer">
- <enablement>
- <instanceof value="org.rubypeople.rdt.refactoring.preview.RubyTextFileChange"/>
- </enablement>
- </changePreviewViewer>
- </extension>
-</plugin>
+<plugin>
+ <extension
+ point="org.rubypeople.rdt.ui.editorPopupExtender">
+ <rubyEditorPopupMenuExtension
+ class="org.rubypeople.rdt.refactoring.action.RefactoringActionGroup">
+ </rubyEditorPopupMenuExtension>
+ </extension>
+<extension
+ point="org.eclipse.ui.editorActions">
+
+
+
+ <editorContribution
+ id="org.rubypeople.rdt.refactoring.refactoringEditorActions"
+ targetID="org.rubypeople.rdt.ui.EditorRubyFile">
+ <menu
+ id="org.rubypeople.rdt.refactoring.refactoringMenu"
+ label="%rubyRefactoring.refactoringMenuLabel"
+ path="edit">
+ <separator name="org.rubypeople.rdt.refactoring.refactoringGroup"/>
+ </menu>
+ <menu
+ id="org.rubypeople.rdt.refactoring.sourceMenu"
+ label="%rubyRefactoring.sourceMenuLabel"
+ path="edit">
+ <separator name="org.rubypeople.rdt.refactoring.sourceGeneratorGroup"/>
+ </menu>
+<!-- Source: -->
+ <action
+ class="org.rubypeople.rdt.refactoring.action.OverrideMethodAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.OverrideMethod"
+ id="org.rubypeople.rdt.refactoring.overrideMethodAction"
+ label="%rubyRefactoring.OverrideMethodLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.sourceMenu/org.rubypeople.rdt.refactoring.sourceGeneratorGroup"
+ tooltip="Add Constructor from Superclass"/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.GenerateConstructorAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.GenerateConstructor"
+ id="org.rubypeople.rdt.refactoring.generateConstructorAction"
+ label="%rubyRefactoring.GenerateConstructorLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.sourceMenu/org.rubypeople.rdt.refactoring.sourceGeneratorGroup"
+ tooltip="Generate Constructor"/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.GenerateAccessorsAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.GenerateAccessors"
+ id="org.rubypeople.rdt.refactoring.generateaccessors"
+ label="%rubyRefactoring.GenerateAccessorLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.sourceMenu/org.rubypeople.rdt.refactoring.sourceGeneratorGroup"
+ tooltip="Generate Accessors"/>
+<!-- experimental
+ <action
+ class="org.rubypeople.rdt.refactoring.action.FormatSourceAction"
+ enablesFor="*"
+ id="org.rubypeople.rdt.refactoring.renameFormatSourceAction"
+ label="%rubyRefactoring.FormatSourceLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.sourceMenu/org.rubypeople.rdt.refactoring.sourceGeneratorGroup"
+ style="push"
+ tooltip="Formats the Sourcecode"/> -->
+<!-- Refactorings: -->
+ <action
+ class="org.rubypeople.rdt.refactoring.action.SplitTempAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.SplitTemp"
+ id="org.rubypeople.rdt.refactoring.splitTempAction"
+ label="%rubyRefactoring.SplitTempLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ tooltip="Split Temporary Variable"/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.RenameAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.Rename"
+ id="org.rubypeople.rdt.refactoring.renameAction"
+ label="%rubyRefactoring.RenameLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ tooltip="Renames the selected element..."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.PushDownAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.PushDown"
+ id="org.rubypeople.rdt.refactoring.pushDownAction"
+ label="%rubyRefactoring.PushDownLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Pushes down a method"/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.PullUpAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.PullUp"
+ id="org.rubypeople.rdt.refactoring.pullUpAction"
+ label="%rubyRefactoring.PullUpLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Pulls up a method into it's supperclass"/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.MoveMethodAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.MoveMethod"
+ id="org.rubypeople.rdt.refactoring.MoveMethod"
+ label="%rubyRefactoring.MoveMethodLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Moves the selected method into another class."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.MoveField"
+ id="org.rubypeople.rdt.refactoring.MoveField"
+ label="%rubyRefactoring.MoveFieldLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Moves the selected field into another class."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.MergeWithExternalClassPartsAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.MergeWithExternalClassParts"
+ id="org.rubypeople.rdt.refactoring.mergeWithExternalClassParts"
+ label="%rubyRefactoring.MergeWithExternalClassPartsLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Merges different class parts of the same class in different files."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.MergeClassPartsInFileAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.MergeClassPartsInFile"
+ id="org.rubypeople.rdt.refactoring.mergeClassPartsInFile"
+ label="%rubyRefactoring.MergeClassPartsInFileLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Merges different class parts of the same class in the current file."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.InlineMethodAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.InlineMethod"
+ id="org.rubypeople.rdt.refactoring.inlineMethod"
+ label="%rubyRefactoring.InlineMethodLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Replaces the selected method call with the methods body."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.InlineTempAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.InlineTemp"
+ id="org.rubypeople.rdt.refactoring.inlineTemp"
+ label="%rubyRefactoring.InlineTempLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Replaces the occurences fo a local variable with its value."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.InlineClassAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.InlineClass"
+ id="org.rubypeople.rdt.refactoring.inlineClassAction"
+ label="%rubyRefactoring.InlineClassLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Inlines the selected class into another one."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.ExtractMethodAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.ExtractMethod"
+ id="org.rubypeople.rdt.refactoring.extractMethodAction"
+ label="%rubyRefactoring.ExtractMethodLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Extracts the selected code into a new method."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.ExtractConstantAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.ExtractConstant"
+ id="org.rubypeople.rdt.refactoring.extractConstantAction"
+ label="%rubyRefactoring.ExtractConstantLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Extracts the selected value into a new constant."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.EncapsulateField"
+ id="org.rubypeople.rdt.refactoring.extractMethod"
+ label="%rubyRefactoring.EncapsulateField"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Encapsulates a field. A field (accessor) will be removed and getter and setter methods will be added."/>
+ <action
+ class="org.rubypeople.rdt.refactoring.action.ConvertTempToFieldAction"
+ definitionId="org.rubypeople.rdt.refactoring.command.ConvertTempToField"
+ id="org.rubypeople.rdt.refactoring.convertTempToFieldAction"
+ label="%rubyRefactoring.ConvertTempToFieldLabel"
+ menubarPath="org.rubypeople.rdt.refactoring.refactoringMenu/org.rubypeople.rdt.refactoring.refactoringGroup"
+ style="push"
+ tooltip="Converts a local variable to a field."/>
+ </editorContribution>
+</extension>
+<extension
+ point="org.eclipse.ui.commands">
+ <category
+ description="Refactorings"
+ id="org.rubypeople.rdt.refactoring.commands.refactoring"
+ name="Refactor - Ruby"/>
+ <category
+ description="Source Generators"
+ id="org.rubypeople.rdt.refactoring.commands.source"
+ name="Source - Ruby"/>
+<!-- Source: -->
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.source"
+ id="org.rubypeople.rdt.refactoring.command.GenerateAccessors"
+ name="%rubyRefactoring.GenerateAccessorLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.source"
+ id="org.rubypeople.rdt.refactoring.command.GenerateConstructor"
+ name="%rubyRefactoring.GenerateConstructorLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.source"
+ id="org.rubypeople.rdt.refactoring.command.OverrideMethod"
+ name="%rubyRefactoring.OverrideMethodLabel"/>
+<!-- Refactorings: -->
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.Rename"
+ name="%rubyRefactoring.RenameLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.SplitTemp"
+ name="%rubyRefactoring.SplitTempLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.MergeClassPartsInFile"
+ name="%rubyRefactoring.MergeClassPartsInFileLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.ConvertTempToField"
+ name="%rubyRefactoring.ConvertTempToFieldLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.PushDown"
+ name="%rubyRefactoring.PushDownLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.ExtractMethod"
+ name="%rubyRefactoring.ExtractMethodLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.InlineMethod"
+ name="%rubyRefactoring.InlineMethodLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.EncapsulateField"
+ name="%rubyRefactoring.EncapsulateField"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.MergeWithExternalClassParts"
+ name="%rubyRefactoring.MergeWithExternalClassPartsLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.InlineTemp"
+ name="%rubyRefactoring.InlineTempLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.MoveMethod"
+ name="%rubyRefactoring.MoveMethodLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.MoveField"
+ name="%rubyRefactoring.MoveFieldLabel"/>
+ <command
+ categoryId="org.rubypeople.rdt.refactoring.commands.refactoring"
+ id="org.rubypeople.rdt.refactoring.command.InlineClass"
+ name="%rubyRefactoring.InlineClassLabel"/>
+</extension>
+
+<extension
+ point="org.eclipse.ui.bindings"> <!-- M1 == Ctrl, M2 == Shift M3 == Alt -->
+ <key
+ commandId="org.rubypeople.rdt.refactoring.command.ExtractMethod"
+ contextId="org.rubypeople.rdt.ui.rubyEditorScope"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M2+M3+M "/>
+ <key
+ commandId="org.rubypeople.rdt.refactoring.command.MoveField"
+ contextId="org.rubypeople.rdt.ui.rubyEditorScope"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M2+M3+V F"/>
+ <key
+ commandId="org.rubypeople.rdt.refactoring.command.MoveMethod"
+ contextId="org.rubypeople.rdt.ui.rubyEditorScope"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M2+M3+V M"/>
+ <key
+ commandId="org.rubypeople.rdt.refactoring.command.InlineClass"
+ contextId="org.rubypeople.rdt.ui.rubyEditorScope"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M2+M3+I C"/>
+ <key
+ commandId="org.rubypeople.rdt.refactoring.command.InlineTemp"
+ contextId="org.rubypeople.rdt.ui.rubyEditorScope"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M2+M3+I L"/>
+ <key
+ commandId="org.rubypeople.rdt.refactoring.command.InlineMethod"
+ contextId="org.rubypeople.rdt.ui.rubyEditorScope"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M2+M3+I M"/>
+ <key
+ commandId="org.rubypeople.rdt.refactoring.command.Rename"
+ contextId="org.rubypeople.rdt.ui.rubyEditorScope"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M2+M3+R"/>
+</extension>
+<extension
+ point="org.eclipse.ui.popupMenus">
+
+ <objectContribution
+ id="org.rubypeople.rdt.refactoring.refactoringContext"
+ objectClass="org.rubypeople.rdt.internal.core.RubyLocalVar">
+ <action
+ class="org.rubypeople.rdt.refactoring.action.ConvertTempToFieldAction"
+ id="org.rubypeople.rdt.refactoring.action.ConvertTempToFieldAction"
+ label="%rubyRefactoring.ConvertTempToFieldLabel"
+ menubarPath="additions" />
+ <action
+ class="org.rubypeople.rdt.refactoring.action.InlineTempAction"
+ id="org.rubypeople.rdt.refactoring.action.InlineTempAction"
+ label="%rubyRefactoring.InlineTempLabel"
+ menubarPath="additions" />
+ <action
+ class="org.rubypeople.rdt.refactoring.action.SplitTempAction"
+ id="org.rubypeople.rdt.refactoring.action.SplitTempAction"
+ label="%rubyRefactoring.SplitTempLabel"
+ menubarPath="additions" />
+ <action
+ class="org.rubypeople.rdt.refactoring.action.RenameAction"
+ id="org.rubypeople.rdt.refactoring.action.RenameAction"
+ label="%rubyRefactoring.RenameLabel"
+ menubarPath="additions" />
+ </objectContribution>
+
+ <objectContribution
+ id="org.rubypeople.rdt.refactoring.refactoringContext"
+ objectClass="org.rubypeople.rdt.internal.core.RubyType">
+ <action
+ class="org.rubypeople.rdt.refactoring.action.RenameAction"
+ id="org.rubypeople.rdt.refactoring.action.RenameAction"
+ label="%rubyRefactoring.RenameLabel"
+ menubarPath="additions" />
+ </objectContribution>
+
+ <objectContribution
+ id="org.rubypeople.rdt.refactoring.refactoringContext"
+ objectClass="org.rubypeople.rdt.internal.core.RubyInstVar">
+ <action
+ class="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
+ id="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
+ label="%rubyRefactoring.EncapsulateField"
+ menubarPath="additions" />
+ <action
+ class="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
+ id="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
+ label="%rubyRefactoring.MoveFieldLabel"
+ menubarPath="additions" />
+ <action
+ class="org.rubypeople.rdt.refactoring.action.RenameAction"
+ id="org.rubypeople.rdt.refactoring.action.RenameAction"
+ label="%rubyRefactoring.RenameLabel"
+ menubarPath="additions" />
+ </objectContribution>
+
+ <objectContribution
+ id="org.rubypeople.rdt.refactoring.refactoringContext"
+ objectClass="org.rubypeople.rdt.internal.core.RubyClassVar">
+ <action
+ class="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
+ id="org.rubypeople.rdt.refactoring.action.EncapsulateFieldAction"
+ label="%rubyRefactoring.EncapsulateField"
+ menubarPath="additions" />
+ <action
+ class="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
+ id="org.rubypeople.rdt.refactoring.action.MoveFieldAction"
+ label="%rubyRefactoring.MoveFieldLabel"
+ menubarPath="additions" />
+ <action
+ class="org.rubypeople.rdt.refactoring.action.RenameAction"
+ id="org.rubypeople.rdt.refactoring.action.RenameAction"
+ label="%rubyRefactoring.RenameLabel"
+ menubarPath="additions" />
+ </objectContribution>
+
+ <objectContribution
+ id="org.rubypeople.rdt.refactoring.refactoringContext"
+ objectClass="org.rubypeople.rdt.internal.core.RubyMethod">
+ <action
+ class="org.rubypeople.rdt.refactoring.action.MoveMethodAction"
+ id="org.rubypeople.rdt.refactoring.action.MoveMethodAction"
+ label="%rubyRefactoring.MoveMethodLabel"
+ menubarPath="additions" />
+ <action
+ class="org.rubypeople.rdt.refactoring.action.RenameAction"
+ id="org.rubypeople.rdt.refactoring.action.RenameAction"
+ label="%rubyRefactoring.RenameLabel"
+ menubarPath="additions" />
+ </objectContribution>
+
+</extension>
+
+<extension
+ point="org.eclipse.ltk.ui.refactoring.changePreviewViewers">
+ <changePreviewViewer
+ class="org.rubypeople.rdt.refactoring.preview.RubyTextEditChangePreviewViewer"
+ id="org.rubypeople.rdt.refactoring.preview.RubyTextEditChangePreviewViewer">
+ <enablement>
+ <instanceof value="org.rubypeople.rdt.refactoring.preview.RubyTextFileChange"/>
+ </enablement>
+ </changePreviewViewer>
+ </extension>
+</plugin>
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/RefactoringMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/RefactoringMessages.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/RefactoringMessages.java 2007-04-18 19:14:40 UTC (rev 2332)
@@ -0,0 +1,29 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
+package org.rubypeople.rdt.internal.refactoring;
+
+import org.eclipse.osgi.util.NLS;
+
+public class RefactoringMessages extends NLS {
+
+ private static final String BUNDLE_NAME = RefactoringMessages.class.getName();
+
+ public static String Refactor;
+ public static String ExtractConstantAction_extract_constant;
+ public static String ExtractConstantAction_label;
+ public static String ExtractConstantInputPage_constant_name;
+ public static String ExtractConstantWizard_defaultPageTitle;
+
+ private RefactoringMessages() {}
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, RefactoringMessages.class);
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/RefactoringMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/RefactoringMessages.properties (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/internal/refactoring/RefactoringMessages.properties 2007-04-18 19:14:40 UTC (rev 2332)
@@ -0,0 +1,15 @@
+#########################################
+# (c) Copyright Aptana, Inc. 2007.
+# All Rights Reserved.
+#########################################
+Refactor=Refactor
+
+ExtractConstantAction_label=Extr&act Constant...
+ExtractConstantAction_extract_constant=Extract Constant
+
+ExtractConstantInputPage_enter_name=Enter a name for the new constant
+ExtractConstantInputPage_constant_name=&Constant name:
+ExtractConstantInputPage_signature_preview=Signature Preview:
+ExtractConstantInputPage_exception=An unexpected exception occurred. See the error log for more details
+
+ExtractConstantWizard_defaultPageTitle=Extract Constant
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/ExtractConstantAction.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/ExtractConstantAction.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/ExtractConstantAction.java 2007-04-18 19:14:40 UTC (rev 2332)
@@ -0,0 +1,21 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
+package org.rubypeople.rdt.refactoring.action;
+
+import org.rubypeople.rdt.internal.refactoring.RefactoringMessages;
+import org.rubypeople.rdt.refactoring.core.extractconstant.ExtractConstantRefactoring;
+
+public class ExtractConstantAction extends WorkbenchWindowActionDelegate {
+
+ @Override
+ public void run() {
+ run(ExtractConstantRefactoring.class, RefactoringMessages.ExtractConstantAction_label);
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/PullUpAction.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/PullUpAction.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/PullUpAction.java 2007-04-18 19:14:40 UTC (rev 2332)
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
+package org.rubypeople.rdt.refactoring.action;
+
+import org.rubypeople.rdt.refactoring.core.pullup.PullUpRefactoring;
+
+public class PullUpAction extends WorkbenchWindowActionDelegate {
+
+ public void run() {
+ run(PullUpRefactoring.class, PullUpRefactoring.NAME);
+ }
+}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java 2007-04-18 17:10:10 UTC (rev 2331)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/action/RefactoringActionGroup.java 2007-04-18 19:14:40 UTC (rev 2332)
@@ -1,91 +1,76 @@
-/***** BEGIN LICENSE BLOCK *****
- * Version: CPL 1.0/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Common Public
- * License Version 1.0 (the "License"); you may not use this file
- * except in compliance with the License. You may obtain a copy of
- * the License at http://www.eclipse.org/legal/cpl-v10.html
- *
- * Software distributed under the License is distributed on an "AS
- * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * rights and limitations under the License.
- *
- * Copyright (C) 2006 Lukas Felber <lf...@hs...>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the CPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the CPL, the GPL or the LGPL.
- ***** END LICENSE BLOCK *****/
-
-package org.rubypeople.rdt.refactoring.action;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.ui.actions.ActionGroup;
-import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
-import org.rubypeople.rdt.refactoring.core.convertlocaltofield.ConvertLocalToFieldRefactoring;
-import org.rubypeople.rdt.refactoring.core.encapsulatefield.EncapsulateFieldRefactoring;
-import org.rubypeople.rdt.refactoring.core.extractmethod.ExtractMethodRefactoring;
-import org.rubypeople.rdt.refactoring.core.generateaccessors.GenerateAccessorsRefactoring;
-import org.rubypeople.rdt.refactoring.core.generateconstructor.GenerateConstructorRefactoring;
-import org.rubypeople.rdt.refactoring.core.inlineclass.InlineClassRefactoring;
-import org.rubypeople.rdt.refactoring.core.inlinelocal.InlineLocalRefactoring;
-import org.rubypeople.rdt.refactoring.core.inlinemethod.InlineMethodRefactoring;
-import org.rubypeople.rdt.refactoring.core.mergeclasspartsinfile.MergeClassPartsInFileRefactoring;
-import org.rubypeople.rdt.refactoring.core.mergewithexternalclassparts.MergeWithExternalClassPartsRefactoring;
-import org.rubypeople.rdt.refactoring.core.movefield.MoveFieldRefactoring;
-import org.rubypeople.rdt.refactoring.core.movemethod.MoveMethodRefactoring;
-import org.rubypeople.rdt.refactoring.core.overridemethod.OverrideMethodRefactoring;
-import org.rubypeople.rdt.refactoring.core.pushdown.PushDownRefactoring;
-import org.rubypeople.rdt.refactoring.core.rename.RenameRefactoring;
-import org.rubypeople.rdt.refactoring.core.splitlocal.SplitTempRefactoring;
-import org.rubypeople.rdt.ui.actions.RubyActionGroup;
-
-public class RefactoringActionGroup extends ActionGroup {
-
- private static final String INSERT_AFTER_GROUP_NAME = "group.edit"; //$NON-NLS-1$
-
- public void fillContextMenu(IMenuManager menu) {
- TextSelectionProvider selectionProvider = new TextSelectionProvider(null);
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, new Separator());
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, getSourceMenu(menu, selectionProvider));
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, getRefactorMenu(selectionProvider));
- menu.insertAfter(INSERT_AFTER_GROUP_NAME, new Separator());
- }
-
- private IMenuManager getRefactorMenu(TextSelectionProvider selectionProvider) {
- IMenuManager submenu = new MenuManager(Messages.RefactoringActionGroup);
- submenu.add(new RefactoringAction(ConvertLocalToFieldRefactoring.class, ConvertLocalToFieldRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(EncapsulateFieldRefactoring.class, EncapsulateFieldRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(ExtractMethodRefactoring.class, ExtractMethodRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(InlineClassRefactoring.class, InlineClassRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(InlineLocalRefactoring.class, InlineLocalRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(InlineMethodRefactoring.class, InlineMethodRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(MergeClassPartsInFileRefactoring.class, MergeClassPartsInFileRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(MergeWithExternalClassPartsRefactoring.class, MergeWithExternalClassPartsRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(MoveFieldRefactoring.class, MoveFieldRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(MoveMethodRefactoring.class, MoveMethodRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(PushDownRefactoring.class, PushDownRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(RenameRefactoring.class, RenameRefactoring.NAME, selectionProvider));
- submenu.add(new RefactoringAction(SplitTempRefactoring.class, SplitTempRefactoring.NAME, selectionProvider));
- return submenu;
- }
-
- private IMenuManager getSourceMenu(IMenuManager menu, TextSelectionProvider selectionProvider) {
- IMenuManager submenu = RubyActionGroup.getRubySourceMenu(menu) ;
- submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(GenerateAccessorsRefactoring.class, GenerateAccessorsRefactoring.NAME, selectionProvider));
- submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(GenerateConstructorRefactoring.class, GenerateConstructorRefactoring.NAME, selectionProvider));
- submenu.insertAfter(RubyActionGroup.RUBY_SOURCE_SEPARATOR, new RefactoringAction(OverrideMethodRefactoring.class, OverrideMethodRefactoring.NAME, selectionProvider));
- return submenu;
- }
-}
+/**
+ * Copyright (c) 2007 Aptana, Inc.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl -v10.html. If redistributing this code,
+ * this entire header must remain intact.
+ */
+package org.rubypeople.rdt.refactoring.action;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.actions.ActionGroup;
+import org.rubypeople.rdt.refactoring.core.TextSelectionProvider;
+import org.rubypeople.rdt.refactoring.core.convertlocaltofield.ConvertLocalToFieldRefactoring;
+import org.rubypeople.rdt.refactoring.core.encapsulatefield.EncapsulateFieldRefactoring;
+import org.rubypeople.rdt.refactoring.core.extractconstant.ExtractConstantRefactoring;
+import org.rubypeople.rdt.refactoring.core.extractmethod.ExtractMethodRefactoring;
+import org.rubypeople.rdt.refactoring.core.generateaccessors.GenerateAccessorsRefactoring;
+import org.rubypeople.rdt.refactoring.core.generateconstructor.GenerateConstructorRefactoring;
+import org.rubypeople.rdt.refactoring.core.inlineclass.InlineClassRefactoring;
+import org.rubypeople.rdt.refactoring.core.inlinelocal.InlineLocalRefactoring;
+import org.rubypeople.rdt.refactoring.core.inlinemethod.InlineMethodRefactoring;
+import org.rubypeople.rdt.refactoring.core.mergeclasspartsinfile.MergeClassPartsInFileRefactoring;
+import org.rubypeople.rdt.refactoring.core.mergewithexternalclassparts.MergeWithExternalClassPartsRefactoring;
+import org.rubypeople.rdt.refactoring.core.movefield.MoveFieldRefactoring;
+import org.rubypeople.rdt.refactoring.core.movemethod.MoveMethodRefactoring;
+import org.rubypeople.rdt.refactoring.core.overridemethod.OverrideMethodRefactoring;
+import org.rubypeople.rdt.refactoring.core.pullup.PullUpRefactoring;
+import org.rubypeople.rdt.refactoring.core.pushdown.PushDownRefactoring;
+import org.rubypeople.rdt.refactoring.core.rename.RenameRefactoring;
+import org.rubypeople.rdt.refactoring.core.splitlocal.SplitTempRefactoring;
+import org.rubypeople.rdt.ui.actions.RubyActionGroup;
+
+public class RefactoringActionGroup extends ActionGroup {
+
+ private static final String INSERT_AFTER_GROUP_NAME = "group.edit"; //$NON-NLS-1$
+
+ public void fillContextMenu(IMenuManager menu) {
+ TextSelectionProvider selectionProvider = new TextSelectionProvider(null);
+ menu.insertAfter(INSERT_AFTER_GROUP_NAME, new Separator());
+ menu.insertAfter(INSERT_AFTER_GROUP_NAME, getSourceMenu(menu, selectionProvider));
+ menu.insertAfter(INSERT_AFTER_GROUP_NAME, getRefactorMenu(selectionProvider));
+ menu.insertAfter(INSERT_AFTER_GROUP_NAME, new Separator());
+ }
+
+ private IMenuManager getRefactorMenu(TextSelectionProvider selectionProvider) {
+ IMenuManager submenu = new MenuManager(Messages.RefactoringActionGroup);
+ submenu.add(new RefactoringAction(ConvertLocalToFieldRefactoring.class, ConvertLocalToFieldRefactoring.NAME, selectionProvider));
+ submenu.add(new RefactoringAction(EncapsulateFieldRefactoring.class, EncapsulateFieldRefactoring.NAME, selectionProvider));
+ submenu.add(new RefactoringAction(ExtractMethodRefactoring.class, ExtractMethodRefactoring.NAME, selectionProvider));
+ submenu.add(new RefactoringAction(ExtractConstantRefactoring.class, ExtractConstantRefactoring.NAME, selectionProvider));
+ submenu.add(new RefactoringAction(InlineClassRefactoring.class, InlineClassRefactoring.NAME, selectionProvider));
+ submenu.add(new RefactoringAction(InlineLocalRefactoring.class, InlineLocalRefactoring.NAME, selectionProvider));
+ submenu.add(new RefactoringAction(InlineMethodRefactoring.class, InlineMethodRefactoring.NAME, selec...
[truncated message content] |
|
From: <caw...@us...> - 2007-04-18 17:10:16
|
Revision: 2331
http://svn.sourceforge.net/rubyeclipse/?rev=2331&view=rev
Author: cawilliams
Date: 2007-04-18 10:10:10 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt/Changelog.txt
Modified: trunk/org.rubypeople.rdt/Changelog.txt
===================================================================
--- trunk/org.rubypeople.rdt/Changelog.txt 2007-04-18 12:32:07 UTC (rev 2330)
+++ trunk/org.rubypeople.rdt/Changelog.txt 2007-04-18 17:10:10 UTC (rev 2331)
@@ -1,4 +1,4 @@
-Since 0.8.0 Release:
+Release 0.9.0:
* Initial Refactoring support
* Adds an initial catalog of refactorings
* Also adds some basic source manipulation
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-18 12:32:10
|
Revision: 2330
http://svn.sourceforge.net/rubyeclipse/?rev=2330&view=rev
Author: mbarchfe
Date: 2007-04-18 05:32:07 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
updated ssh id file name
Modified Paths:
--------------
trunk/org.rubypeople.rdt.pluginbuilder/build.xml
Modified: trunk/org.rubypeople.rdt.pluginbuilder/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.pluginbuilder/build.xml 2007-04-18 12:31:04 UTC (rev 2329)
+++ trunk/org.rubypeople.rdt.pluginbuilder/build.xml 2007-04-18 12:32:07 UTC (rev 2330)
@@ -158,17 +158,17 @@
<echo message="Copying ${buildResultsDirectory} to ${downloadUser}@${downloadHost}:${downloadDirectory}"/>
<sshexec host="${downloadHost}"
username="${downloadUser}"
- keyfile="${user.home}/.ssh/id_download"
+ keyfile="${user.home}/.ssh/id_rdt_download"
command="mkdir --parents ${downloadDirectory}"/>
<scp todir="${downloadUser}:usekeyinsteadofpw@${downloadHost}:${downloadDirectory}"
- keyfile="${user.home}/.ssh/id_download"
+ keyfile="${user.home}/.ssh/id_rdt_download"
passphrase="">
<fileset dir="${buildResultsDirectory}"/>
</scp>
<echo message="Copying files to updatesite: ${downloadUser}@${downloadHost}:${downloadDirectory}"/>
<property name="updateSiteScpUrl" value="${downloadUser}@${downloadHost}:${updateSiteDirectory}"/>
<scp todir="${updateSiteScpUrl}"
- keyfile="${user.home}/.ssh/id_download"
+ keyfile="${user.home}/.ssh/id_rdt_download"
passphrase="">
<fileset dir="${buildResultsDirectory}/updateSite">
<exclude name="site.xml"/>
@@ -178,12 +178,12 @@
<property name="siteXmlFile" value="/tmp/site.xml"/>
<scp file="${updateSiteScpUrl}/site.xml"
localTofile="${siteXmlFile}"
- keyfile="${user.home}/.ssh/id_download"
+ keyfile="${user.home}/.ssh/id_rdt_download"
passphrase=""/>
<antcall target="-updateSiteXml"/>
<scp file="${siteXmlFile}"
todir="${updateSiteScpUrl}"
- keyfile="${user.home}/.ssh/id_download"
+ keyfile="${user.home}/.ssh/id_rdt_download"
passphrase=""/>
</target>
@@ -195,4 +195,4 @@
</ftp>
</target>
-</project>
\ No newline at end of file
+</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-18 12:31:13
|
Revision: 2329
http://svn.sourceforge.net/rubyeclipse/?rev=2329&view=rev
Author: mbarchfe
Date: 2007-04-18 05:31:04 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
copy doc to results
Modified Paths:
--------------
trunk/org.rubypeople.rdt.pluginbuilder/build-files/postBuild.xml
Modified: trunk/org.rubypeople.rdt.pluginbuilder/build-files/postBuild.xml
===================================================================
--- trunk/org.rubypeople.rdt.pluginbuilder/build-files/postBuild.xml 2007-04-18 11:33:48 UTC (rev 2328)
+++ trunk/org.rubypeople.rdt.pluginbuilder/build-files/postBuild.xml 2007-04-18 12:31:04 UTC (rev 2329)
@@ -63,14 +63,13 @@
tofile="${buildResultsDirectory}/logs/testsWorkspace.log" failonerror="false"/>
-->
- <!--
- <mkdir dir="${buildResultsDirectory}/doc"/>
- <copy todir="${buildResultsDirectory}/doc">
+
+ <mkdir dir="${buildResultsDirectory}/doc"/>
+ <copy todir="${buildResultsDirectory}/doc">
<fileset dir="${buildDirectory}/plugins/org.rubypeople.rdt.doc.user">
<include name="html/**/*"/>
<include name="images/**/*"/>
</fileset>
- </copy>
- -->
+ </copy>
</target>
</project>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-18 11:33:48
|
Revision: 2328
http://svn.sourceforge.net/rubyeclipse/?rev=2328&view=rev
Author: mbarchfe
Date: 2007-04-18 04:33:48 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
fixed typo
Modified Paths:
--------------
trunk/org.rubypeople.rdt.pluginbuilder/build.xml
Modified: trunk/org.rubypeople.rdt.pluginbuilder/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.pluginbuilder/build.xml 2007-04-18 11:31:21 UTC (rev 2327)
+++ trunk/org.rubypeople.rdt.pluginbuilder/build.xml 2007-04-18 11:33:48 UTC (rev 2328)
@@ -127,7 +127,7 @@
<property name="buildResultsDirectory" value="${buildDirectory}/results"/>
</target>
- <target name="release" if="build.version" depends="-releaseproperties"/>
+ <target name="release" if="build.version" depends="-releaseproperties">
<antcall target="main"/>
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mba...@us...> - 2007-04-18 11:31:23
|
Revision: 2327
http://svn.sourceforge.net/rubyeclipse/?rev=2327&view=rev
Author: mbarchfe
Date: 2007-04-18 04:31:21 -0700 (Wed, 18 Apr 2007)
Log Message:
-----------
added deploy targets from old script
Modified Paths:
--------------
trunk/org.rubypeople.rdt.pluginbuilder/build.xml
Modified: trunk/org.rubypeople.rdt.pluginbuilder/build.xml
===================================================================
--- trunk/org.rubypeople.rdt.pluginbuilder/build.xml 2007-04-18 06:53:15 UTC (rev 2326)
+++ trunk/org.rubypeople.rdt.pluginbuilder/build.xml 2007-04-18 11:31:21 UTC (rev 2327)
@@ -121,5 +121,78 @@
<property name="buildTarget" value="postBuild"/>
<antcall target="-build"/>
</target>
+
+ <target name="-releaseproperties">
+ <property name="buildDirectory" value="/home/rdt/release-${build.version}"/>
+ <property name="buildResultsDirectory" value="${buildDirectory}/results"/>
+ </target>
+
+ <target name="release" if="build.version" depends="-releaseproperties"/>
+ <antcall target="main"/>
+ </target>
+
+ <target name="-updateSiteXml">
+ <property name="siteXmlFile" value="site.xml"/>
+ <property name="placeHolder" value="<!--AddNewFeatureElementHere-->"/>
+ <property name="featureUrl" value="features/org.rubypeople.rdt_${version.full}.jar"/>
+ <!-- replacevalue nested element does not support variable replacement. Therefore a two step approach:
+ 1. add a feature element
+ 2. add newline -->
+ <echo message="Adding feature version ${version.full} to ${siteXmlFile}"/>
+ <replace file="${siteXmlFile}" token="${placeHolder}" value="<feature url="${featureUrl}" id="org.rubypeople.rdt" version="${version.full}"> <category name="RubyEclipseIntegrationBuilds"/> </feature> ${placeHolder}"/>
+ <replace file="${siteXmlFile}" token="${placeHolder}">
+ <replacevalue>
+ <!--AddNewFeatureElementHere--></replacevalue>
+ </replace>
+ </target>
+ <target name="deploy" if="build.version" depends="-releaseproperties,-properties">
+ <!-- This target is used for manually deploying integration and release builds
+ Nightly builds are deployed using cruise controls config.xml file -->
+ <property name="downloadUser" value="rubypeople"/>
+ <property name="downloadHost" value="download.rubypeople.org"/>
+ <property name="buildTypeDirectory" value="integration"/>
+ <property name="downloadDirectory" value="~/subdomains/download/httpdocs/${buildTypeDirectory}/${version.full}"/>
+ <property name="updateSiteDirectory" value="~/subdomains/updatesite/httpdocs/${buildTypeDirectory}"/>
+ <property name="buildResultsDirectory" value="${buildDirectory}/results"/>
+ <echo message="Copying ${buildResultsDirectory} to ${downloadUser}@${downloadHost}:${downloadDirectory}"/>
+ <sshexec host="${downloadHost}"
+ username="${downloadUser}"
+ keyfile="${user.home}/.ssh/id_download"
+ command="mkdir --parents ${downloadDirectory}"/>
+ <scp todir="${downloadUser}:usekeyinsteadofpw@${downloadHost}:${downloadDirectory}"
+ keyfile="${user.home}/.ssh/id_download"
+ passphrase="">
+ <fileset dir="${buildResultsDirectory}"/>
+ </scp>
+ <echo message="Copying files to updatesite: ${downloadUser}@${downloadHost}:${downloadDirectory}"/>
+ <property name="updateSiteScpUrl" value="${downloadUser}@${downloadHost}:${updateSiteDirectory}"/>
+ <scp todir="${updateSiteScpUrl}"
+ keyfile="${user.home}/.ssh/id_download"
+ passphrase="">
+ <fileset dir="${buildResultsDirectory}/updateSite">
+ <exclude name="site.xml"/>
+ </fileset>
+ </scp>
+ <echo message="Updating site.xml"/>
+ <property name="siteXmlFile" value="/tmp/site.xml"/>
+ <scp file="${updateSiteScpUrl}/site.xml"
+ localTofile="${siteXmlFile}"
+ keyfile="${user.home}/.ssh/id_download"
+ passphrase=""/>
+ <antcall target="-updateSiteXml"/>
+ <scp file="${siteXmlFile}"
+ todir="${updateSiteScpUrl}"
+ keyfile="${user.home}/.ssh/id_download"
+ passphrase=""/>
+ </target>
+
+ <target name="deploy-sourceforge" if="build.version" depends="-releaseproperties,-properties">
+ <ftp server="upload.sf.net" remotedir="incoming" userid="anonymous" password="mba...@us...">
+ <fileset dir="${buildResultsDirectory}">
+ <include name="org.rubypeople.rdt-${version.full}.zip"/>
+ </fileset>
+ </ftp>
+ </target>
+
</project>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mir...@us...> - 2007-04-18 06:53:19
|
Revision: 2326
http://svn.sourceforge.net/rubyeclipse/?rev=2326&view=rev
Author: mirkostocker
Date: 2007-04-17 23:53:15 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
remove the ugly white background around the icon
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/icons/full/obj16/module_obj.gif
Modified: trunk/org.rubypeople.rdt.ui/icons/full/obj16/module_obj.gif
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-17 13:03:15
|
Revision: 2325
http://svn.sourceforge.net/rubyeclipse/?rev=2325&view=rev
Author: cawilliams
Date: 2007-04-17 06:03:10 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
remove branch that's been merged into trunk...
Removed Paths:
-------------
branches/search_engine/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-04-17 13:01:26
|
Revision: 2324
http://svn.sourceforge.net/rubyeclipse/?rev=2324&view=rev
Author: cawilliams
Date: 2007-04-17 06:01:24 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
Merged changes from r2302:2323 in search_engine branch over to trunk
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/Flags.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchDocument.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/CompletionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/SimpleLookupTable.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/DeltaProcessor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolder.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceFolderRoot.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/SourceParser.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/indexing/IndexManager.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/InternalSearchDocument.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/CharOperation.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/Messages.java
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/messages.properties
Added Paths:
-----------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/FieldDeclarationMatch.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchConstants.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchScope.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/MethodDeclarationMatch.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchMatch.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchParticipant.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchRequestor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/TypeDeclarationMatch.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/HashtableOfLong.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/CollectingSearchRequestor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexQueryRequestor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/IndexSelector.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/PathCollector.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/PatternSearchJob.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchDocument.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/RubySearchParticipant.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/RubyWorkspaceScope.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/AddExternalFolderToIndex.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexAllProject.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexRequest.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/RemoveFromIndex.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/SaveIndex.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/SourceIndexer.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/SourceIndexerRequestor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/AndPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/ConstructorPattern.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/FieldPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/InternalSearchPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/MatchLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/MatchingNodeSet.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/MethodLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/MethodPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/OrPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/PatternLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/PossibleMatch.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/PossibleMatchSet.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/RubySearchPattern.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/search/matching/TypeDeclarationPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/TypeReferencePattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/VariablePattern.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/indexing/IndexAllJob.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/AndPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/ConstructorPattern.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/FieldPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/InternalSearchPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/MatchLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/MatchingNodeSet.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/MethodLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/MethodPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/OrPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/PatternLocator.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/PossibleMatch.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/PossibleMatchSet.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/QualifiedTypeDeclarationPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/RubySearchPattern.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/search/matching/TypeDeclarationPattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/TypeReferencePattern.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/search/matching/VariablePattern.java
Modified: trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF 2007-04-17 11:42:39 UTC (rev 2323)
+++ trunk/org.rubypeople.rdt.core/META-INF/MANIFEST.MF 2007-04-17 13:01:24 UTC (rev 2324)
@@ -11,12 +11,14 @@
org.rubypeople.rdt.core,
org.rubypeople.rdt.core.compiler,
org.rubypeople.rdt.core.formatter,
+ org.rubypeople.rdt.core.search,
org.rubypeople.rdt.internal.compiler,
org.rubypeople.rdt.internal.core,
org.rubypeople.rdt.internal.core.buffer,
org.rubypeople.rdt.internal.core.builder,
org.rubypeople.rdt.internal.core.parser,
org.rubypeople.rdt.internal.core.parser.warnings,
+ org.rubypeople.rdt.internal.core.search,
org.rubypeople.rdt.internal.core.symbols,
org.rubypeople.rdt.internal.core.util,
org.rubypeople.rdt.internal.formatter,
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/Flags.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/Flags.java 2007-04-17 11:42:39 UTC (rev 2323)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/Flags.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -16,6 +16,8 @@
* @since 3.0
*/
public static final int AccDefault = 0;
+
+ public static final int AccModule = 0x0001;
/**
* Returns whether the given integer includes the <code>private</code> modifier.
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-04-17 11:42:39 UTC (rev 2323)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -321,8 +321,6 @@
List rubyProjects = Arrays.asList(getRubyProjects());
MassIndexUpdaterJob massUpdater = new MassIndexUpdaterJob(indexUpdater, rubyProjects);
massUpdater.schedule();
- addElementChangedListener(IndexManager.instance());
- IndexManager.start();
}
/*
@@ -334,7 +332,6 @@
public void stop(BundleContext context) throws Exception {
try {
RubyModelManager.getRubyModelManager().shutdown();
- removeElementChangedListener(IndexManager.instance());
} finally {
// ensure we call super.stop as the last thing
super.stop(context);
Copied: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/FieldDeclarationMatch.java (from rev 2323, branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/FieldDeclarationMatch.java)
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/FieldDeclarationMatch.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/FieldDeclarationMatch.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.core.search;
+
+import org.eclipse.core.resources.IResource;
+import org.rubypeople.rdt.core.IRubyElement;
+
+/**
+ * A Java search match that represents a field declaration.
+ * The element is an <code>IField</code>.
+ * <p>
+ * This class is intended to be instantiated and subclassed by clients.
+ * </p>
+ *
+ * @since 3.0
+ */
+public class FieldDeclarationMatch extends SearchMatch {
+
+ /**
+ * Creates a new field declaration match.
+ *
+ * @param element the field declaration
+ * @param accuracy one of A_ACCURATE or A_INACCURATE
+ * @param offset the offset the match starts at, or -1 if unknown
+ * @param length the length of the match, or -1 if unknown
+ * @param participant the search participant that created the match
+ * @param resource the resource of the element
+ */
+ public FieldDeclarationMatch(IRubyElement element, int accuracy, int offset, int length, SearchParticipant participant, IResource resource) {
+ super(element, accuracy, offset, length, participant, resource);
+ }
+}
Copied: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchConstants.java (from rev 2323, branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchConstants.java)
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchConstants.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchConstants.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -0,0 +1,53 @@
+package org.rubypeople.rdt.core.search;
+
+import org.rubypeople.rdt.internal.core.search.processing.IJob;
+
+public interface IRubySearchConstants {
+ /**
+ * The search operation waits for the underlying indexer to finish indexing
+ * the workspace before starting the search.
+ */
+ int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
+
+ /**
+ * The search result is a declaration.
+ * Can be used in conjunction with any of the nature of searched elements
+ * so as to better narrow down the search.
+ */
+ int DECLARATIONS= 0;
+
+ /**
+ * The search result is a reference.
+ * Can be used in conjunction with any of the nature of searched elements
+ * so as to better narrow down the search.
+ * References can contain implementers since they are more generic kind
+ * of matches.
+ */
+ int REFERENCES= 2;
+
+ /**
+ * The search result is a declaration, a reference, or an implementer
+ * of an interface.
+ * Can be used in conjunction with any of the nature of searched elements
+ * so as to better narrow down the search.
+ */
+ int ALL_OCCURRENCES= 3;
+
+ /**
+ * When searching for field matches, it will exclusively find read accesses, as
+ * opposed to write accesses. Note that some expressions are considered both
+ * as field read/write accesses: for example, x++; x+= 1;
+ *
+ * @since 2.0
+ */
+ int READ_ACCESSES = 4;
+
+ /**
+ * When searching for field matches, it will exclusively find write accesses, as
+ * opposed to read accesses. Note that some expressions are considered both
+ * as field read/write accesses: for example, x++; x+= 1;
+ *
+ * @since 2.0
+ */
+ int WRITE_ACCESSES = 5;
+}
Copied: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchScope.java (from rev 2323, branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchScope.java)
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchScope.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/IRubySearchScope.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -0,0 +1,71 @@
+package org.rubypeople.rdt.core.search;
+
+import org.eclipse.core.runtime.IPath;
+
+public interface IRubySearchScope {
+
+ /**
+ * Include type constant (bit mask) indicating that source folders should be
+ * considered in the search scope.
+ *
+ * @since 0.9.0
+ */
+ int SOURCES = 1;
+ /**
+ * Include type constant (bit mask) indicating that application libraries
+ * should be considered in the search scope.
+ *
+ * @since 0.9.0
+ */
+ int APPLICATION_LIBRARIES = 2;
+ /**
+ * Include type constant (bit mask) indicating that system libraries should
+ * be considered in the search scope.
+ *
+ * @since 0.9.0
+ */
+ int SYSTEM_LIBRARIES = 4;
+ /**
+ * Include type constant (bit mask) indicating that referenced projects
+ * should be considered in the search scope.
+ *
+ * @since 0.9.0
+ */
+ int REFERENCED_PROJECTS = 8;
+
+ /**
+ * Returns the paths to the enclosing projects and JARs for this search
+ * scope.
+ * <ul>
+ * <li> If the path is a project path, this is the full path of the project
+ * (see <code>IResource.getFullPath()</code>). For example, /MyProject
+ * </li>
+ * <li> If the path is a JAR path and this JAR is internal to the workspace,
+ * this is the full path of the JAR file (see
+ * <code>IResource.getFullPath()</code>). For example,
+ * /MyProject/mylib.jar </li>
+ * <li> If the path is a JAR path and this JAR is external to the workspace,
+ * this is the full OS path to the JAR file on the file system. For example,
+ * d:\libs\mylib.jar </li>
+ * </ul>
+ *
+ * @return an array of paths to the enclosing projects and JARS.
+ */
+ IPath[] enclosingProjectsAndJars();
+
+ /**
+ * Checks whether the resource at the given path is enclosed by this scope.
+ *
+ * @param resourcePath
+ * if the resource is contained in a JAR file, the path is
+ * composed of 2 paths separated by
+ * <code>JAR_FILE_ENTRY_SEPARATOR</code>: the first path is
+ * the full OS path to the JAR (if it is an external JAR), or the
+ * workspace relative <code>IPath</code> to the JAR (if it is
+ * an internal JAR), the second path is the path to the resource
+ * inside the JAR.
+ * @return whether the resource is enclosed by this scope
+ */
+ public boolean encloses(String resourcePath);
+
+}
Copied: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/MethodDeclarationMatch.java (from rev 2323, branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/MethodDeclarationMatch.java)
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/MethodDeclarationMatch.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/MethodDeclarationMatch.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.core.search;
+
+import org.eclipse.core.resources.IResource;
+import org.rubypeople.rdt.core.IRubyElement;
+
+/**
+ * A Java search match that represents a method declaration.
+ * The element is an <code>IMethod</code>.
+ * <p>
+ * This class is intended to be instantiated and subclassed by clients.
+ * </p>
+ *
+ * @since 3.0
+ */
+public class MethodDeclarationMatch extends SearchMatch {
+
+ /**
+ * Creates a new method declaration match.
+ *
+ * @param element the method declaration
+ * @param accuracy one of A_ACCURATE or A_INACCURATE
+ * @param offset the offset the match starts at, or -1 if unknown
+ * @param length the length of the match, or -1 if unknown
+ * @param participant the search participant that created the match
+ * @param resource the resource of the element
+ */
+ public MethodDeclarationMatch(IRubyElement element, int accuracy, int offset, int length, SearchParticipant participant, IResource resource) {
+ super(element, accuracy, offset, length, participant, resource);
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchDocument.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchDocument.java 2007-04-17 11:42:39 UTC (rev 2323)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchDocument.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -1,135 +1,177 @@
-package org.rubypeople.rdt.core.search;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.rubypeople.rdt.core.IParent;
-import org.rubypeople.rdt.core.IRubyElement;
-import org.rubypeople.rdt.core.IRubyScript;
-import org.rubypeople.rdt.core.IType;
-import org.rubypeople.rdt.core.RubyModelException;
-import org.rubypeople.rdt.internal.core.Openable;
-import org.rubypeople.rdt.internal.core.search.HandleFactory;
-import org.rubypeople.rdt.internal.core.search.indexing.InternalSearchDocument;
-
-public class SearchDocument extends InternalSearchDocument {
-
- private static HandleFactory factory = new HandleFactory();
- private IRubyScript script;
-
- private static final String SEPARATOR = "/";
-
- private List<String> indices = new ArrayList<String>();
-
- private String documentPath;
-
- public SearchDocument(String documentPath) {
- this.documentPath = documentPath;
- }
-
- public void addIndexEntry(char[] category, char[] key) {
- super.addIndexEntry(category, key);
- }
-
- /**
- * Removes all index entries from the index for the given document.
- * This method must be called from
- * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}.
- */
- public void removeAllIndexEntries() {
- super.removeAllIndexEntries();
- }
-
- public Set<String> getElementNamesOfType(int type) {
- Set<String> names = new HashSet<String>();
- for (String indexKey : indices) {
- if (getTypeFromKey(indexKey) != type) continue;
- names.add(getNameFromKey(indexKey));
- }
- return names;
- }
-
- public List<IRubyElement> getElementsOfType(int type) {
- IRubyScript script = getScript();
- return getChildrenOfType(script, type);
- }
-
- private IRubyScript getScript() {
- if (this.script == null) {
- Openable openable = factory.createOpenable(documentPath);
- this.script = (IRubyScript) openable;
- }
- return this.script;
- }
-
- private List<IRubyElement> getChildrenOfType(IParent parent, int type) {
- List<IRubyElement> elements = new ArrayList<IRubyElement>();
- if (parent == null) return elements;
- try {
- IRubyElement[] children = parent.getChildren();
- if (children == null)
- return elements;
- for (int i = 0; i < children.length; i++) {
- if (children[i].isType(type))
- elements.add(children[i]);
- if (children[i] instanceof IParent) {
- IParent childParent = (IParent) children[i];
- elements.addAll(getChildrenOfType(childParent, type));
- }
- }
- } catch (RubyModelException e) {
- // ignore
- }
- return elements;
- }
-
- public boolean isEmpty() {
- return indices.isEmpty();
- }
-
- public void removeElement(IRubyElement element) {
- indices.remove(createKey(element));
- }
-
- private String createKey(IRubyElement element) {
- return createKey(element.getElementType(), element.getElementName());
- }
-
- private String createKey(int type, String name) {
- return type + SEPARATOR + name;
- }
-
- public void addElement(IRubyElement element) {
- indices.add(createKey(element));
- }
-
- public IType findType(String name) {
- return (IType) findElement(createKey(IRubyElement.TYPE, name));
- }
-
- private IRubyElement findElement(String key) {
- for (String indexKey : indices) {
- if (!indexKey.equals(key))
- continue;
- IRubyScript script = getScript();
- List<IRubyElement> children = getChildrenOfType(script, getTypeFromKey(key));
- for (IRubyElement element : children) {
- if (element.getElementName().equals(getNameFromKey(key)))
- return element;
- }
- }
- return null;
- }
-
- private String getNameFromKey(String key) {
- String[] parts = key.split(SEPARATOR);
- return parts[1];
- }
-
- private int getTypeFromKey(String key) {
- String[] parts = key.split(SEPARATOR);
- return Integer.parseInt(parts[0]);
- }
-}
+package org.rubypeople.rdt.core.search;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.rubypeople.rdt.core.IParent;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.Openable;
+import org.rubypeople.rdt.internal.core.index.EntryResult;
+import org.rubypeople.rdt.internal.core.search.HandleFactory;
+import org.rubypeople.rdt.internal.core.search.indexing.IIndexConstants;
+import org.rubypeople.rdt.internal.core.search.indexing.InternalSearchDocument;
+
+public abstract class SearchDocument extends InternalSearchDocument {
+
+ private static HandleFactory factory = new HandleFactory();
+ private IRubyScript script;
+
+ private String documentPath;
+ private SearchParticipant participant;
+
+ public SearchDocument(String documentPath, SearchParticipant participant) {
+ this.documentPath = documentPath;
+ this.participant = participant;
+ }
+
+ public void addIndexEntry(char[] category, char[] key) {
+ super.addIndexEntry(category, key);
+ }
+
+ /**
+ * Removes all index entries from the index for the given document.
+ * This method must be called from
+ * {@link SearchParticipant#indexDocument(SearchDocument document, org.eclipse.core.runtime.IPath indexPath)}.
+ */
+ public void removeAllIndexEntries() {
+ super.removeAllIndexEntries();
+ }
+
+ public Set<String> getElementNamesOfType(int type) {
+ Set<String> names = new HashSet<String>();
+ try {
+ EntryResult[] results = index.query(new char[][] {getCategory(type)}, new char[] {'*'}, SearchPattern.R_PATTERN_MATCH);
+ for (int i = 0; i < results.length; i++) {
+ String name = new String(results[i].getWord());
+ names.add(name);
+ }
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return names;
+ }
+
+ public List<IRubyElement> getElementsOfType(int type) {
+ IRubyScript script = getScript();
+ return getChildrenOfType(script, type);
+ }
+
+ private IRubyScript getScript() {
+ if (this.script == null) {
+ Openable openable = factory.createOpenable(documentPath);
+ this.script = (IRubyScript) openable;
+ }
+ return this.script;
+ }
+
+ /**
+ * Returns the path to the original document to publicly mention in index
+ * or search results. This path is a string that uniquely identifies the document.
+ * Most of the time it is a workspace-relative path, but it can also be a file system path,
+ * or a path inside a zip file.
+ *
+ * @return the path to the document
+ */
+ public final String getPath() {
+ return this.documentPath;
+ }
+
+ private List<IRubyElement> getChildrenOfType(IParent parent, int type) {
+ List<IRubyElement> elements = new ArrayList<IRubyElement>();
+ if (parent == null) return elements;
+ try {
+ IRubyElement[] children = parent.getChildren();
+ if (children == null)
+ return elements;
+ for (int i = 0; i < children.length; i++) {
+ if (children[i].isType(type))
+ elements.add(children[i]);
+ if (children[i] instanceof IParent) {
+ IParent childParent = (IParent) children[i];
+ elements.addAll(getChildrenOfType(childParent, type));
+ }
+ }
+ } catch (RubyModelException e) {
+ // ignore
+ }
+ return elements;
+ }
+
+ public void removeElement(IRubyElement element) {
+ // FIXME Rebuild the index?!
+ }
+
+ public void addElement(IRubyElement element) {
+ addIndexEntry(getCategory(element), element.getElementName().toCharArray());
+ }
+
+ private char[] getCategory(IRubyElement element) {
+ return getCategory(element.getElementType());
+ }
+
+ private char[] getCategory(int elementType) {
+ switch (elementType) {
+ case IRubyElement.TYPE:
+ return IIndexConstants.TYPE_DECL;
+ case IRubyElement.METHOD:
+ return IIndexConstants.METHOD_DECL;
+ case IRubyElement.CONSTANT:
+ case IRubyElement.GLOBAL:
+ case IRubyElement.CLASS_VAR:
+ case IRubyElement.INSTANCE_VAR:
+ case IRubyElement.LOCAL_VARIABLE:
+ return IIndexConstants.FIELD_DECL;
+ default:
+ return new char[0];
+ }
+ }
+
+ public IType findType(String name) {
+ return (IType) findElement(IRubyElement.TYPE, name);
+ }
+
+ private IRubyElement findElement(int type, String name) {
+ IRubyScript script = getScript();
+ List<IRubyElement> children = getChildrenOfType(script, type);
+ for (IRubyElement element : children) {
+ if (element.getElementName().equals(name))
+ return element;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the contents of this document.
+ * Contents may be different from actual resource at corresponding document
+ * path due to preprocessing.
+ * <p>
+ * This method must be implemented in subclasses.
+ * </p><p>
+ * Note: some implementation may choose to cache the contents directly on the
+ * document for performance reason. However, this could induce scalability issues due
+ * to the fact that collections of documents are manipulated throughout the search
+ * operation, and cached contents would then consume lots of memory until they are
+ * all released at once in the end.
+ * </p>
+ *
+ * @return the contents of this document,
+ * or <code>null</code> if none
+ */
+ public abstract char[] getCharContents();
+
+ /**
+ * Returns the participant that created this document.
+ *
+ * @return the participant that created this document
+ */
+ public final SearchParticipant getParticipant() {
+ return this.participant;
+ }
+}
Copied: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchMatch.java (from rev 2323, branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchMatch.java)
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchMatch.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchMatch.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -0,0 +1,376 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.core.search;
+
+import org.eclipse.core.resources.IResource;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.internal.core.RubyElement;
+
+/**
+ * A search match represents the result of a search query.
+ *
+ * Search matches may be accurate (<code>A_ACCURATE</code>) or they might be
+ * merely potential matches (<code>A_INACCURATE</code>). The latter occurs when
+ * a compile-time problem prevents the search engine from completely resolving
+ * the match.
+ * <p>
+ * This class is intended to be instantiated and subclassed by clients.
+ * </p>
+ *
+ * @see SearchEngine#search(SearchPattern, SearchParticipant[], IJavaSearchScope, SearchRequestor, org.eclipse.core.runtime.IProgressMonitor)
+ * @since 3.0
+ */
+public class SearchMatch {
+
+ /**
+ * The search result corresponds an exact match of the search pattern.
+ *
+ * @see #getAccuracy()
+ */
+ public static final int A_ACCURATE = 0;
+
+ /**
+ * The search result is potentially a match for the search pattern,
+ * but the search engine is unable to fully check it (for example, because
+ * there are errors in the code or the classpath are not correctly set).
+ *
+ * @see #getAccuracy()
+ */
+ public static final int A_INACCURATE = 1;
+
+ private Object element;
+ private int length;
+ private int offset;
+
+ private int accuracy;
+ private SearchParticipant participant;
+ private IResource resource;
+
+ private boolean insideDocComment = false;
+
+ // store the rule used while reporting the match
+ private final static int ALL_GENERIC_FLAVORS = SearchPattern.R_FULL_MATCH |
+ SearchPattern.R_EQUIVALENT_MATCH |
+ SearchPattern.R_ERASURE_MATCH;
+ private int rule = ALL_GENERIC_FLAVORS;
+
+ // store other necessary information
+ private boolean raw = false;
+ private boolean implicit = false;
+
+ /**
+ * Creates a new search match.
+ * <p>
+ * Note that <code>isInsideDocComment()</code> defaults to false.
+ * </p>
+ *
+ * @param element the element that encloses or corresponds to the match,
+ * or <code>null</code> if none
+ * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE}
+ * @param offset the offset the match starts at, or -1 if unknown
+ * @param length the length of the match, or -1 if unknown
+ * @param participant the search participant that created the match
+ * @param resource the resource of the element, or <code>null</code> if none
+ */
+ public SearchMatch(
+ IRubyElement element,
+ int accuracy,
+ int offset,
+ int length,
+ SearchParticipant participant,
+ IResource resource) {
+ this.element = element;
+ this.offset = offset;
+ this.length = length;
+ this.accuracy = accuracy & A_INACCURATE;
+ if (accuracy > A_INACCURATE) {
+ int genericFlavors = accuracy & ALL_GENERIC_FLAVORS;
+ if (genericFlavors > 0) {
+ this.rule &= ~ALL_GENERIC_FLAVORS; // reset generic flavors
+ }
+ this.rule |= accuracy & ~A_INACCURATE; // accuracy may have also some rule information
+ }
+ this.participant = participant;
+ this.resource = resource;
+ }
+
+ /**
+ * Returns the accuracy of this search match.
+ *
+ * @return one of {@link #A_ACCURATE} or {@link #A_INACCURATE}
+ */
+ public final int getAccuracy() {
+ return this.accuracy;
+ }
+
+ /**
+ * Returns the element of this search match.
+ * In case of a reference match, this is the inner-most enclosing element of the reference.
+ * In case of a declaration match, this is the declaration.
+ *
+ * @return the element of the search match, or <code>null</code> if none
+ */
+ public final Object getElement() {
+ return this.element;
+ }
+
+ /**
+ * Returns the length of this search match.
+ *
+ * @return the length of this search match, or -1 if unknown
+ */
+ public final int getLength() {
+ return this.length;
+ }
+
+ /**
+ * Returns the offset of this search match.
+ *
+ * @return the offset of this search match, or -1 if unknown
+ */
+ public final int getOffset() {
+ return this.offset;
+ }
+
+ /**
+ * Returns the search participant which issued this search match.
+ *
+ * @return the participant which issued this search match
+ */
+ public final SearchParticipant getParticipant() {
+ return this.participant;
+ }
+
+ /**
+ * Returns the resource containing this search match.
+ *
+ * @return the resource of the match, or <code>null</code> if none
+ */
+ public final IResource getResource() {
+ return this.resource;
+ }
+
+ /**
+ * Returns the rule used while creating the match.
+ *
+ * @return one of {@link SearchPattern#R_FULL_MATCH}, {@link SearchPattern#R_EQUIVALENT_MATCH}
+ * or {@link SearchPattern#R_ERASURE_MATCH}
+ * @since 3.1
+ */
+ public final int getRule() {
+ return this.rule;
+ }
+
+ /**
+ * Returns whether match element is compatible with searched pattern or not.
+ * Note that equivalent matches are also erasure ones.
+ *
+ * @return <code>true</code> if match element is compatible
+ * <code>false</code> otherwise
+ * @since 3.1
+ */
+ public final boolean isEquivalent() {
+ return isErasure() && (this.rule & SearchPattern.R_EQUIVALENT_MATCH) != 0;
+ }
+
+ /**
+ * Returns whether match element only has same erasure than searched pattern or not.
+ * Note that this is always true for both generic and non-generic element as soon
+ * as the accuracy is accurate.
+ *
+ * @return <code>true</code> if match element has same erasure
+ * <code>false</code> otherwise
+ * @since 3.1
+ */
+ public final boolean isErasure() {
+ return (this.rule & SearchPattern.R_ERASURE_MATCH) != 0;
+ }
+
+ /**
+ * Returns whether element matches exactly searched pattern or not.
+ * Note that exact matches are also erasure and equivalent ones.
+ *
+ * @return <code>true</code> if match is exact
+ * <code>false</code> otherwise
+ * @since 3.1
+ */
+ public final boolean isExact() {
+ return isEquivalent() && (this.rule & SearchPattern.R_FULL_MATCH) != 0;
+ }
+
+ /**
+ * Returns whether the associated element is implicit or not.
+ *
+ * Note that this piece of information is currently only implemented
+ * for implicit member pair value in annotation.
+ *
+ * @return <code>true</code> if this match is associated to an implicit
+ * element and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public final boolean isImplicit() {
+ return this.implicit;
+ }
+
+ /**
+ * Returns whether the associated element is a raw type/method or not.
+ *
+ * @return <code>true</code> if this match is associated to a raw
+ * type or method and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public final boolean isRaw() {
+ return this.raw;
+ }
+
+ /**
+ * Returns whether this search match is inside a doc comment of a Java
+ * source file.
+ *
+ * @return <code>true</code> if this search match is inside a doc
+ * comment, and <code>false</code> otherwise
+ */
+ public final boolean isInsideDocComment() {
+ // default is outside a doc comment
+ return this.insideDocComment;
+ }
+
+ /**
+ * Sets the accuracy of this match.
+ *
+ * @param accuracy one of {@link #A_ACCURATE} or {@link #A_INACCURATE}
+ */
+ public final void setAccuracy (int accuracy) {
+ this.accuracy = accuracy;
+ }
+
+ /**
+ * Sets the element of this search match.
+ *
+ * @param element the element that encloses or corresponds to the match,
+ * or <code>null</code> if none
+ */
+ public final void setElement (Object element) {
+ this.element = element;
+ }
+
+ /**
+ * Sets whether this search match is inside a doc comment of a Java
+ * source file.
+ *
+ * @param insideDoc <code>true</code> if this search match is inside a doc
+ * comment, and <code>false</code> otherwise
+ */
+ public final void setInsideDocComment (boolean insideDoc) {
+ this.insideDocComment = insideDoc;
+ }
+
+ /**
+ * Sets whether the associated element is implicit or not.
+ * Typically, this is the case when match is on an implicit constructor
+ * or an implicit member pair value in annotation.
+ *
+ * @param implicit <code>true</code> if this match is associated to an implicit
+ * element and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public final void setImplicit(boolean implicit) {
+ this.implicit = implicit;
+ }
+
+ /**
+ * Sets the length of this search match.
+ *
+ * @param length the length of the match, or -1 if unknown
+ */
+ public final void setLength(int length) {
+ this.length = length;
+ }
+
+ /**
+ * Sets the offset of this search match.
+ *
+ * @param offset the offset the match starts at, or -1 if unknown
+ */
+ public final void setOffset(int offset) {
+ this.offset = offset;
+ }
+
+ /**
+ * Sets the participant of this match.
+ *
+ * @param participant the search participant that created this match
+ */
+ public final void setParticipant (SearchParticipant participant) {
+ this.participant = participant;
+ }
+
+ /**
+ * Sets the resource of this match.
+ *
+ * @param resource the resource of the match, or <code>null</code> if none
+ */
+ public final void setResource (IResource resource) {
+ this.resource = resource;
+ }
+
+ /**
+ * Set the rule used while reporting the match.
+ *
+ * @param rule one of {@link SearchPattern#R_FULL_MATCH}, {@link SearchPattern#R_EQUIVALENT_MATCH}
+ * or {@link SearchPattern#R_ERASURE_MATCH}
+ * @since 3.1
+ */
+ public final void setRule(int rule) {
+ this.rule = rule;
+ }
+
+ /**
+ * Set whether the associated element is a raw type/method or not.
+ *
+ * @param raw <code>true</code> if this search match is associated to a raw
+ * type or method and <code>false</code> otherwise
+ * @since 3.1
+ */
+ public final void setRaw(boolean raw) {
+ this.raw = raw;
+ }
+
+ /* (non-javadoc)
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("Search match"); //$NON-NLS-1$
+ buffer.append("\n accuracy="); //$NON-NLS-1$
+ buffer.append(this.accuracy == A_ACCURATE ? "ACCURATE" : "INACCURATE"); //$NON-NLS-1$ //$NON-NLS-2$
+ buffer.append("\n rule="); //$NON-NLS-1$
+ if ((this.rule & SearchPattern.R_FULL_MATCH) != 0) {
+ buffer.append("EXACT"); //$NON-NLS-1$
+ } else if ((this.rule & SearchPattern.R_EQUIVALENT_MATCH) != 0) {
+ buffer.append("EQUIVALENT"); //$NON-NLS-1$
+ } else if ((this.rule & SearchPattern.R_ERASURE_MATCH) != 0) {
+ buffer.append("ERASURE"); //$NON-NLS-1$
+ }
+ buffer.append("\n raw="); //$NON-NLS-1$
+ buffer.append(this.raw);
+ buffer.append("\n offset="); //$NON-NLS-1$
+ buffer.append(this.offset);
+ buffer.append("\n length="); //$NON-NLS-1$
+ buffer.append(this.length);
+ if (this.element != null) {
+ buffer.append("\n element="); //$NON-NLS-1$
+ buffer.append(((RubyElement)getElement()).toStringWithAncestors());
+ }
+ buffer.append("\n"); //$NON-NLS-1$
+ return buffer.toString();
+ }
+}
Copied: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchParticipant.java (from rev 2323, branches/search_engine/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchParticipant.java)
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchParticipant.java (rev 0)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchParticipant.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -0,0 +1,127 @@
+package org.rubypeople.rdt.core.search;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+public abstract class SearchParticipant {
+
+ /**
+ * Indexes the given document in the given index. A search participant
+ * asked to index a document should parse it and call
+ * {@link SearchDocument#addIndexEntry(char[], char[])} as many times as
+ * needed to add index entries to the index. If delegating to another
+ * participant, it should use the original index location (and not the
+ * delegatee's one). In the particular case of delegating to the default
+ * search participant (see {@link SearchEngine#getDefaultSearchParticipant()}),
+ * the provided document's path must be a path ending with one of the
+ * {@link org.eclipse.jdt.core.JavaCore#getJavaLikeExtensions() Java-like extensions}
+ * or with '.class'.
+ * <p>
+ * The given index location must represent a path in the file system to a file that
+ * either already exists or is going to be created. If it exists, it must be an index file,
+ * otherwise its data might be overwritten.
+ * </p><p>
+ * Clients are not expected to call this method.
+ * </p>
+ *
+ * @param document the document to index
+ * @param indexLocation the location in the file system to the index
+ */
+ public abstract void indexDocument(SearchDocument document, IPath indexLocation);
+
+ /**
+ * Returns a search document for the given path.
+ * The given document path is a string that uniquely identifies the document.
+ * Most of the time it is a workspace-relative path, but it can also be a file system path, or a path inside a zip file.
+ * <p>
+ * Implementors of this method can either create an instance of their own subclass of
+ * {@link SearchDocument} or return an existing instance of such a subclass.
+ * </p>
+ *
+ * @param documentPath the path of the document.
+ * @return a search document
+ */
+ public abstract SearchDocument getDocument(String documentPath);
+
+ /**
+ * Returns the collection of index locations to consider when performing the
+ * given search query in the given scope. The search engine calls this
+ * method before locating matches.
+ * <p>
+ * An index location represents a path in the file system to a file that holds index information.
+ * </p><p>
+ * Clients are not expected to call this method.
+ * </p>
+ *
+ * @param query the search pattern to consider
+ * @param scope the given search scope
+ * @return the collection of index paths to consider
+ */
+ public abstract IPath[] selectIndexes(SearchPattern pattern, IRubySearchScope scope);
+
+ /**
+ * Locates the matches in the given documents using the given search pattern
+ * and search scope, and reports them to the givenn search requestor. This
+ * method is called by the search engine once it has search documents
+ * matching the given pattern in the given search scope.
+ * <p>
+ * Note that a participant (e.g. a JSP participant) can pre-process the contents of the given documents,
+ * create its own documents whose contents are Java compilation units and delegate the match location
+ * to the default participant (see {@link SearchEngine#getDefaultSearchParticipant()}). Passing its own
+ * {@link SearchRequestor} this particpant can then map the match positions back to the original
+ * contents, create its own matches and report them to the original requestor.
+ * </p><p>
+ * Implementors of this method should check the progress monitor
+ * for cancelation when it is safe and appropriate to do so. The cancelation
+ * request should be propagated to the caller by throwing
+ * <code>OperationCanceledException</code>.
+ * </p>
+ *
+ * @param documents the documents to locate matches in
+ * @param pattern the search pattern to use when locating matches
+ * @param scope the scope to limit the search to
+ * @param requestor the requestor to report matches to
+ * @param monitor the progress monitor to report progress to,
+ * or <code>null</code> if no progress should be reported
+ * @throws CoreException if the requestor had problem accepting one of the matches
+ */
+ public abstract void locateMatches(SearchDocument[] documents, SearchPattern pattern, IRubySearchScope scope, SearchRequestor requestor, IProgressMonitor monitor) throws CoreException;
+
+
+ /**
+ * Notification that this participant's help is needed in a search.
+ * <p>
+ * This method should be re-implemented in subclasses that need to do something
+ * when the participant is needed in a search.
+ * </p>
+ */
+ public void beginSearching() {
+ // do nothing
+ }
+
+ /**
+ * Notification that this participant's help is no longer needed.
+ * <p>
+ * This method should be re-implemented in subclasses that need to do something
+ * when the participant is no longer needed in a search.
+ * </p>
+ */
+ public void doneSearching() {
+ // do nothing
+ }
+
+ /**
+ * Returns a displayable name of this search participant.
+ * <p>
+ * This method should be re-implemented in subclasses that need to
+ * display a meaningfull name.
+ * </p>
+ *
+ * @return the displayable name of this search participant
+ */
+ public String getDescription() {
+ return "Search participant"; //$NON-NLS-1$
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchPattern.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchPattern.java 2007-04-17 11:42:39 UTC (rev 2323)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/search/SearchPattern.java 2007-04-17 13:01:24 UTC (rev 2324)
@@ -1,132 +1,470 @@
-package org.rubypeople.rdt.core.search;
-
-import org.rubypeople.rdt.internal.core.util.CharOperation;
-
-public class SearchPattern {
-// Rules for pattern matching: (exact, prefix, pattern) [ | case sensitive]
- /**
- * Match rule: The search pattern matches exactly the search result,
- * that is, the source of the search result equals the search pattern.
- */
- public static final int R_EXACT_MATCH = 0;
-
- /**
- * Match rule: The search pattern is a prefix of the search result.
- */
- public static final int R_PREFIX_MATCH = 0x0001;
-
- /**
- * Match rule: The search pattern contains one or more wild cards ('*' or '?').
- * A '*' wild-card can replace 0 or more characters in the search result.
- * A '?' wild-card replaces exactly 1 character in the search result.
- */
- public static final int R_PATTERN_MATCH = 0x0002;
-
- /**
- * Match rule: The search pattern contains a regular expression.
- */
- public static final int R_REGEXP_MATCH = 0x0004;
-
- /**
- * Match rule: The search pattern matches the search result only if cases are the same.
- * Can be combined to previous rules, e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE}
- */
- public static final int R_CASE_SENSITIVE = 0x0008;
-
- /**
- * Match rule: The search pattern matches search results as raw/parameterized types/methods with same erasure.
- * This mode has no effect on other java elements search.<br>
- * Type search example:
- * <ul>
- * <li>pattern: <code>List<Exception></code></li>
- * <li>match: <code>List<Object></code></li>
- * </ul>
- * Method search example:
- * <ul>
- * <li>declaration: <code><T>foo(T t)</code></li>
- * <li>pattern: <code><Exception>foo(new Exception())</code></li>
- * <li>match: <code><Object>foo(new Object())</code></li>
- * </ul>
- * Can be combined to all other match rules, e.g. {@link #R_CASE_SENSITIVE} | {@link #R_ERASURE_MATCH}
- * This rule is not activated by default, so raw types or parameterized types with same erasure will not be found
- * for pattern List<String>,
- * Note that with this pattern, the match selection will be only on the erasure even for parameterized types.
- * @since 3.1
- */
- public static final int R_ERASURE_MATCH = 0x0010;
-
- /**
- * Match rule: The search pattern matches search results as raw/parameterized types/methods with equivalent type parameters.
- * This mode has no effect on other java elements search.<br>
- * Type search example:
- * <ul>
- * <li>pattern: <code>List<Exception></code></li>
- * <li>match:
- * <ul>
- * <li><code>List<? extends Throwable></code></li>
- * <li><code>List<? super RuntimeException></code></li>
- * <li><code>List<?></code></li>
- * </ul>
- * </li>
- * </ul>
- * Method search example:
- * <ul>
- * <li>declaration: <code><T>foo(T t)</code></li>
- * <li>pattern: <code><Exception>foo(new Exception())</code></li>
- * <li>match:
- * <ul>
- * <li><code><? extends Throwable>foo(new Exception())</code></li>
- * <li><code><? super RuntimeException>foo(new Exception())</code></li>
- * <li><code>foo(new Exception())</code></li>
- * </ul>
- * </ul>
- * Can be combined to all other match rules, e.g. {@link #R_CASE_SENSITIVE} | {@link #R_EQUIVALENT_MATCH}
- * This rule is not activated by default, so raw types or equivalent parameterized types will not be found
- * for pattern List<String>,
- * This mode is overridden by {@link #R_ERASURE_MATCH} as erasure matches obviously include equivalent ones.
- * That means that pattern with rule set to {@link #R_EQUIVALENT_MATCH} | {@link #R_ERASURE_MATCH}
- * will return same results than rule only set with {@link #R_ERASURE_MATCH}.
- * @since 3.1
- */
- public static final int R_EQUIVALENT_MATCH = 0x0020;
-
- /**
- * Match rule: The search pattern matches exactly the search result,
- * that is, the source of the search result equals the search pattern.
- * @since 3.1
- */
- public static final int R_FULL_MATCH = 0x0040;
-
- /**
- * Match rule: The search pattern contains a Camel Case expression.
- * <br>
- * Examples:
- * <ul>
- * <li><code>NPE</code> type string pattern will match
- * <code>NullPointerException</code> and <code>NpPermissionException</code> types,</li>
- * <li><code>NuPoEx</code> type string pattern will only match
- * <code>NullPointerException</code> type.</li>
- * </ul>
- * @see CharOperation#camelCaseMatch(char[], char[]) for a detailed explanation
- * of Camel Case matching.
- *<br>
- * Can be combined to {@link #R_PREFIX_MATCH} match rule. For example,
- * when prefix match rule is combined with Camel Case match rule,
- * <code>"nPE"</code> pattern will match <code>nPException</code>.
- *<br>
- * Match rule {@link #R_PATTERN_MATCH} may also be combined but both rules
- * will not be used simultaneously as they are mutually exclusive.
- * Used match rule depends on whether string pattern contains specific pattern
- * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule
- * will be used, otherwise only Camel Case match will be used.
- * For example, with <code>"NPE"</code> string pattern, search will only use
- * Camel Case match rule, but with <code>N*P*E*</code> string pattern, it will
- * use only Pattern match rule.
- *
- * @since 3.2
- */
- public static final int R_CAMELCASE_MATCH = 0x0080;
-
- private static final int MODE_MASK = R_EXACT_MATCH | R_PREFIX_MATCH | R_PATTERN_MATCH | R_REGEXP_MATCH;
-
-}
+package org.rubypeople.rdt.core.search;
+
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.internal.core.search.indexing.IIndexConstants;
+import org.rubypeople.rdt.internal.core.search.matching.ConstructorPattern;
+import org.rubypeople.rdt.internal.core.search.matching.FieldPattern;
+import org.rubypeople.rdt.internal.core.search.matching.InternalSearchPattern;
+import org.rubypeople.rdt.internal.core.search.matching.MethodPattern;
+import org.rubypeople.rdt.internal.core.search.matching.OrPattern;
+import org.rubypeople.rdt.internal.core.search.matching.QualifiedTypeDeclarationPattern;
+import org.rubypeople.rdt.internal.core.search.matching.TypeReferencePattern;
+import org.rubypeople.rdt.internal.core.util.CharOperation;
+
+public abstract class SearchPattern extends InternalSearchPattern {
+// Rules for pattern matching: (exact, prefix, pattern) [ | case sensitive]
+ /**
+ * Match rule: The search pattern matches exactly the search result,
+ * that is, the source of the search result equals the search pattern.
+ */
+ public static final int R_EXACT_MATCH = 0;
+
+ /**
+ * Match rule: The search pattern is a prefix of the search result.
+ */
+ public static final int R_PREFIX_MATCH = 0x0001;
+
+ /**
+ * Match rule: The search pattern contains one or more wild cards ('*' or '?').
+ * A '*' wild-card can replace 0 or more characters in the search result.
+ * A '?' wild-card replaces exactly 1 character in the search result.
+ */
+ public static final int R_PATTERN_MATCH = 0x0002;
+
+ /**
+ * Match rule: The search pattern contains a regular expression.
+ */
+ public static final int R_REGEXP_MATCH = 0x0004;
+
+ /**
+ * Match rule: The search pattern matches the search result only if cases are the same.
+ * Can be combined to previous rules, e.g. {@link #R_EXACT_MATCH} | {@link #R_CASE_SENSITIVE}
+ */
+ public static final int R_CASE_SENSITIVE = 0x0008;
+
+ /**
+ * Match rule: The search pattern matches search results as raw/parameterized types/methods with same erasure.
+ * This mode has no effect on other java elements search.<br>
+ * Type search example:
+ * <ul>
+ * <li>pattern: <code>List<Exception></code></li>
+ * <li>match: <code>List<Object></code></li>
+ * </ul>
+ * Method search example:
+ * <ul>
+ * <li>declaration: <code><T>foo(T t)</code></li>
+ * <li>pattern: <code><Exception>foo(new Exception())</code></li>
+ * <li>match: <code><Object>foo(new Object())</code></li>
+ * </ul>
+ * Can be combined to all other match rules, e.g. {@link #R_CASE_SENSITIVE} | {@link #R_ERASURE_MATCH}
+ * This rule is not activated by default, so raw types or parameterized types with same erasure will not be found
+ * for pattern List<String>,
+ * Note that with this pattern, the match selection will be only on the erasure even for parameterized types.
+ * @since 3.1
+ */
+ public static final int R_ERASURE_MATCH = 0x0010;
+
+ /**
+ * Match rule: The search pattern matches search results as raw/parameterized types/methods with equivalent type parameters.
+ * This mode has no effect on other java elements search.<br>
+ * Type search example:
+ * <ul>
+ * <li>pattern: <code>List<Exception></code></li>
+ * <li>match:
+ * <ul>
+ * <li><code>List<? extends Throwable></code></li>
+ * <li><code>List<? super RuntimeException></code></li>
+ * <li><code>List<?></code></li>
+ * </ul>
+ * </li>
+ * </ul>
+ * Method search example:
+ * <ul>
+ * <li>declaration: <code><T>foo(T t)</code></li>
+ * <li>pattern: <code><Exception>foo(new Exception())</code></li>
+ * <li>match:
+ * <ul>
+ * <li><code><? extends Throwable>foo(new Exception())</code></li>
+ * <li><code><? super RuntimeException>foo(new Exception())</code></li>
+ * <li><code>foo(new Exception())</code></li>
+ * </ul>
+ * </ul>
+ * Can be combined to all other match rules, e.g. {@link #R_CASE_SENSITIVE} | {@link #R_EQUIVALENT_MATCH}
+ * This rule is not activated by default, so raw types or equivalent parameterized types will not be found
+ * for pattern List<String>,
+ * This mode is overridden by {@link #R_ERASURE_MATCH} as erasure matches obviously include equivalent ones.
+ * That means that pattern with rule set to {@link #R_EQUIVALENT_MATCH} | {@link #R_ERASURE_MATCH}
+ * will return same results than rule only set with {@link #R_ERASURE_MATCH}.
+ * @since 3.1
+ */
+ public static final int R_EQUIVALENT_MATCH = 0x0020;
+
+ /**
+ * Match rule: The search pattern matches exactly the search result,
+ * that is, the source of the search result equals the search pattern.
+ * @since 3.1
+ */
+ public static final int R_FULL_MATCH = 0x0040;
+
+ /**
+ * Match rule: The search pattern contains a Camel Case expression.
+ * <br>
+ * Examples:
+ * <ul>
+ * <li><code>NPE</code> type string pattern will match
+ * <code>NullPointerException</code> and <code>NpPermissionException</code> types,</li>
+ * <li><code>NuPoEx</code> type string pattern will only match
+ * <code>NullPointerException</code> type.</li>
+ * </ul>
+ * @see CharOperation#camelCaseMatch(char[], char[]) for a detailed explanation
+ * of Camel Case matching.
+ *<br>
+ * Can be combined to {@link #R_PREFIX_MATCH} match rule. For example,
+ * when prefix match rule is combined with Camel Case match rule,
+ * <code>"nPE"</code> pattern will match <code>nPException</code>.
+ *<br>
+ * Match rule {@link #R_PATTERN_MATCH} may also be combined but both rules
+ * will not be used simultaneously as they are mutually exclusive.
+ * Used match rule depends on whether string pattern contains specific pattern
+ * characters (e.g. '*' or '?') or not. If it does, then only Pattern match rule
+ * will be used, otherwise only Camel Case match will be used.
+ * For example, with <code>"NPE"</code> string pattern, se...
[truncated message content] |
|
From: <mir...@us...> - 2007-04-17 11:42:44
|
Revision: 2323
http://svn.sourceforge.net/rubyeclipse/?rev=2323&view=rev
Author: mirkostocker
Date: 2007-04-17 04:42:39 -0700 (Tue, 17 Apr 2007)
Log Message:
-----------
rename method almost completed
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/ModuleNodeProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleEditProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ClassNodeWrapper.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TS_RenameModule.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/IncludeRenameEditProvider.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeFinder.java
trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_IncludeFromWithinSameNamespace.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_IncludeWithNamespace.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_ModulesWithEqualNamesInDifferentNamespaces.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_MultipleDirectIncludes.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_NoIncludes.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_SingleDirectInclude.rb
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.activeFile.rb.result
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.activeFile.rb.source
trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.test_properties
trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TC_ModuleInclusionFinder.java
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/ModuleNodeProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/ModuleNodeProvider.java 2007-04-16 09:07:25 UTC (rev 2322)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/ModuleNodeProvider.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -46,7 +46,7 @@
return null;
}
return createModuleNodeWrapper(root, module);
- }
+ }
public static Collection<ModuleNodeWrapper> findOtherParts(IDocumentProvider doc, ModuleNodeWrapper module) {
ArrayList<ModuleNodeWrapper> modules = new ArrayList<ModuleNodeWrapper>();
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/IncludeRenameEditProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/IncludeRenameEditProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/IncludeRenameEditProvider.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,55 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2006 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.core.renamemodule;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.rubypeople.rdt.refactoring.editprovider.FileEditProvider;
+import org.rubypeople.rdt.refactoring.editprovider.SimpleNodeEditProvider;
+
+public class IncludeRenameEditProvider {
+
+ private RenameModuleConfig config;
+
+ public IncludeRenameEditProvider(RenameModuleConfig config) {
+ this.config = config;
+ }
+
+ public Collection<FileEditProvider> getEditProviders() {
+ Collection<FileEditProvider> edits = new ArrayList<FileEditProvider>();
+
+ for(ModuleIncludeWrapper include : new ModuleIncludeFinder(config.getDocumentProvider()).find(config.getOriginalFullName())) {
+ include.setNewName(config.getOriginalName(), config.getNewName());
+ edits.add(new FileEditProvider(include.getWrappedNode().getPosition().getFile(), new SimpleNodeEditProvider(include.getWrappedNode())));
+ }
+
+ return edits;
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeFinder.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeFinder.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,66 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.core.renamemodule;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.rubypeople.rdt.refactoring.documentprovider.IDocumentProvider;
+import org.rubypeople.rdt.refactoring.nodewrapper.ClassNodeWrapper;
+
+public class ModuleIncludeFinder {
+
+ private final IDocumentProvider document;
+
+ public ModuleIncludeFinder(IDocumentProvider document) {
+ this.document = document;
+ }
+
+ public Collection<ModuleIncludeWrapper> find(String name) {
+ ArrayList<ModuleIncludeWrapper> includes = new ArrayList<ModuleIncludeWrapper>();
+
+ for (ModuleIncludeWrapper includeWrapper : findAllIncludes()) {
+ if(includeWrapper.getFullName().startsWith(name)) {
+ includes.add(includeWrapper);
+ }
+ }
+
+ return includes;
+ }
+
+ private ArrayList<ModuleIncludeWrapper> findAllIncludes() {
+ ArrayList<ModuleIncludeWrapper> includes = new ArrayList<ModuleIncludeWrapper>();
+
+ for(ClassNodeWrapper classNodeWrapper : document.getIncludedClassNodeProvider().getAllClassNodes()) {
+ includes.addAll(classNodeWrapper.getIncludes());
+ }
+
+ return includes;
+ }
+}
Added: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/ModuleIncludeWrapper.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,121 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.core.renamemodule;
+
+import org.jruby.ast.Colon2Node;
+import org.jruby.ast.ConstNode;
+import org.jruby.ast.Node;
+import org.jruby.ast.types.INameNode;
+import org.rubypeople.rdt.refactoring.core.NodeProvider;
+import org.rubypeople.rdt.refactoring.nodewrapper.INodeWrapper;
+import org.rubypeople.rdt.refactoring.util.NameHelper;
+
+public abstract class ModuleIncludeWrapper implements INodeWrapper {
+
+ protected String modulePrefix;
+
+ private static class Colon2IncludeWrapper extends ModuleIncludeWrapper {
+ protected Colon2Node node;
+
+ public Colon2IncludeWrapper(Colon2Node node, String modulePrefix) {
+ this.node = node;
+ this.modulePrefix = modulePrefix;
+ }
+
+ @Override
+ public String getIncludeName() {
+ return NameHelper.getFullyQualifiedName(node);
+ }
+
+ @Override
+ public Node getWrappedNode() {
+ return node;
+ }
+
+ @Override
+ public void setNewName(String oldName, String newName) {
+ for (Node node : NodeProvider.getSubNodes(this.node, Colon2Node.class, ConstNode.class)) {
+ INameNode nameNode = (INameNode) node;
+ if(!nameNode.getName().equals(oldName)) {
+ continue;
+ }
+
+ if(node instanceof Colon2Node) {
+ ((Colon2Node) node).setName(newName);
+ return;
+ } else {
+ ((ConstNode) node).setName(newName);
+ return;
+ }
+ }
+ }
+ }
+
+ private static class ConstIncludeWrapper extends ModuleIncludeWrapper {
+ protected ConstNode node;
+
+ public ConstIncludeWrapper(ConstNode node, String modulePrefix) {
+ this.node = node;
+ this.modulePrefix = modulePrefix;
+ }
+
+ @Override
+ public String getIncludeName() {
+ return node.getName();
+ }
+
+ @Override
+ public Node getWrappedNode() {
+ return node;
+ }
+
+ @Override
+ public void setNewName(String oldName, String newName) {
+ node.setName(newName);
+ }
+ }
+
+ public static ModuleIncludeWrapper create(Node node, String modulePrefix) {
+
+ if(node instanceof Colon2Node) {
+ return new Colon2IncludeWrapper((Colon2Node) node, modulePrefix);
+ } else {
+ return new ConstIncludeWrapper((ConstNode) node, modulePrefix);
+ }
+ }
+
+ public abstract Node getWrappedNode();
+
+ public abstract String getIncludeName();
+
+ public String getFullName() {
+ return modulePrefix + getIncludeName();
+ }
+ public abstract void setNewName(String oldName, String newName);
+}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java 2007-04-16 09:07:25 UTC (rev 2322)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConditionChecker.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -56,10 +56,10 @@
config = (RenameModuleConfig) configObj;
ModuleNodeWrapper selectedModule = ModuleNodeProvider.getSelectedModuleNode(config.getDocumentProvider().getActiveFileRootNode(), config.getCarretPosition());
- config.setSelectedModule(selectedModule);
- if(config.getSelectedModule() == null || caretIsNotOnModuleName(selectedModule)) {
+ if(selectedModule == null || caretIsNotOnModuleName(selectedModule)) {
return;
}
+ config.setSelectedModule(selectedModule);
config.setNewName(selectedModule.getName());
config.setModuleParts(ModuleNodeProvider.findOtherParts(config.getDocumentProvider(), config.getSelectedModule()));
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java 2007-04-16 09:07:25 UTC (rev 2322)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleConfig.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -43,6 +43,8 @@
private ModuleNodeWrapper selectedModule;
private String newName;
private Collection<ModuleNodeWrapper> moduleParts;
+ private String originalFullName;
+ private String originalName;
public RenameModuleConfig(IDocumentProvider doc, int carretPosition) {
this.doc = doc;
@@ -75,6 +77,8 @@
public void setSelectedModule(ModuleNodeWrapper selectedModule) {
this.selectedModule = selectedModule;
+ this.originalFullName = selectedModule.getFullName();
+ this.originalName = selectedModule.getName();
}
public String getNewName() {
@@ -88,4 +92,12 @@
public Collection<ModuleNodeWrapper> getModuleParts() {
return moduleParts;
}
+
+ public String getOriginalFullName() {
+ return originalFullName;
+ }
+
+ public String getOriginalName() {
+ return originalName;
+ }
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleEditProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleEditProvider.java 2007-04-16 09:07:25 UTC (rev 2322)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/core/renamemodule/RenameModuleEditProvider.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -26,7 +26,6 @@
* the terms of any one of the CPL, the GPL or the LGPL.
***** END LICENSE BLOCK *****/
-
package org.rubypeople.rdt.refactoring.core.renamemodule;
import java.util.ArrayList;
@@ -57,16 +56,21 @@
return new ScopingNodeRenameEditProvider(modules, config.getNewName());
}
-
+
private ModuleMethodDefRenameEditProvider getModuleModuleMethodDefEditProvider() {
return new ModuleMethodDefRenameEditProvider(ModuleNodeProvider.getAllModuleMethodDefinitions(config.getModuleParts()), config.getNewName());
}
+
+ private IncludeRenameEditProvider getIncludeRenameEditProvider() {
+ return new IncludeRenameEditProvider(config);
+ }
public Collection<FileMultiEditProvider> getFileEditProviders() {
MultiFileEditProvider fileEdits = new MultiFileEditProvider();
fileEdits.addEditProviders(getModuleEditProvider().getEditProviders());
fileEdits.addEditProviders(getModuleModuleMethodDefEditProvider().getEditProviders());
+ fileEdits.addEditProviders(getIncludeRenameEditProvider().getEditProviders());
return fileEdits.getFileEditProviders();
}
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ClassNodeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ClassNodeWrapper.java 2007-04-16 09:07:25 UTC (rev 2322)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/ClassNodeWrapper.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -37,6 +37,7 @@
import org.jruby.ast.Node;
import org.jruby.ast.SymbolNode;
import org.rubypeople.rdt.refactoring.core.NodeFactory;
+import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleIncludeWrapper;
import org.rubypeople.rdt.refactoring.nodewrapper.VisibilityNodeWrapper.METHOD_VISIBILITY;
public class ClassNodeWrapper implements INodeWrapper {
@@ -60,7 +61,16 @@
}
return fields;
}
+
+ public Collection<ModuleIncludeWrapper> getIncludes() {
+ ArrayList<ModuleIncludeWrapper> fields = new ArrayList<ModuleIncludeWrapper>();
+ for (PartialClassNodeWrapper partialClassNode : partialClassNodes) {
+ fields.addAll(partialClassNode.getIncludeCalls());
+ }
+ return fields;
+ }
+
public Collection<MethodNodeWrapper> getMethods() {
Collection<MethodNodeWrapper> methodNodes = new ArrayList<MethodNodeWrapper>();
for (PartialClassNodeWrapper partialClassNode : partialClassNodes) {
Modified: trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java 2007-04-16 09:07:25 UTC (rev 2322)
+++ trunk/org.rubypeople.rdt.refactoring/src/org/rubypeople/rdt/refactoring/nodewrapper/PartialClassNodeWrapper.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -45,6 +45,7 @@
import org.jruby.ast.SymbolNode;
import org.jruby.ast.VCallNode;
import org.rubypeople.rdt.refactoring.core.NodeProvider;
+import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleIncludeWrapper;
import org.rubypeople.rdt.refactoring.exception.NoClassNodeException;
import org.rubypeople.rdt.refactoring.nodewrapper.VisibilityNodeWrapper.METHOD_VISIBILITY;
import org.rubypeople.rdt.refactoring.util.NodeUtil;
@@ -202,25 +203,23 @@
}
public Collection<Node> getInstFieldOccurences() {
- Collection<Node> allOccurences = NodeProvider.getInstFieldOccurences(wrappedNode);
-
- for (Node node : allOccurences) {
- if (isDirectChild(node)){
- allOccurences.remove(node);
- }
- }
- return allOccurences;
+ return NodeProvider.getInstFieldOccurences(wrappedNode);
}
public Collection<Node> getClassFieldOccurences() {
- Collection<Node> classFieldOccurences = NodeProvider.getClassFieldOccurences(wrappedNode);
+ return NodeProvider.getClassFieldOccurences(wrappedNode);
+ }
+
+ public Collection<ModuleIncludeWrapper> getIncludeCalls() {
+ Collection<ModuleIncludeWrapper> includes = new ArrayList<ModuleIncludeWrapper>();
- for (Node node : classFieldOccurences) {
- if (isDirectChild(node)){
- classFieldOccurences.remove(node);
+ for (Node node : NodeProvider.getSubNodes(wrappedNode, FCallNode.class)) {
+ FCallNode call = (FCallNode) node;
+ if("include".equals(call.getName())) { //$NON-NLS-1$
+ includes.add(ModuleIncludeWrapper.create(((ArrayNode) call.getArgsNode()).get(0), getModulePrefix()));
}
}
- return classFieldOccurences;
+ return includes;
}
public Collection<MethodCallNodeWrapper> getMethodCalls(MethodDefNode decoratedMethod) {
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_IncludeFromWithinSameNamespace.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_IncludeFromWithinSameNamespace.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_IncludeFromWithinSameNamespace.rb 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,11 @@
+module Modul
+ module M
+ end
+ class Klass
+ include M
+ end
+end
+
+class Klasse
+ include Modul::M
+end
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_IncludeWithNamespace.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_IncludeWithNamespace.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_IncludeWithNamespace.rb 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,8 @@
+module Namespace
+ module M1
+ end
+end
+
+class C1
+ include Namespace::M1
+end
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_ModulesWithEqualNamesInDifferentNamespaces.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_ModulesWithEqualNamesInDifferentNamespaces.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_ModulesWithEqualNamesInDifferentNamespaces.rb 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,5 @@
+class ModulTest
+ include OuterModule::Module::InnerModule
+ include Module::InnerModule
+ include InnerModule
+end
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_MultipleDirectIncludes.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_MultipleDirectIncludes.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_MultipleDirectIncludes.rb 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,10 @@
+module M1
+end
+
+class C1
+ include M1
+end
+
+class C2
+ include M1
+end
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_NoIncludes.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_NoIncludes.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_NoIncludes.rb 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,8 @@
+module M1
+end
+
+class C1
+end
+
+class C2
+end
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_SingleDirectInclude.rb
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_SingleDirectInclude.rb (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/TC_ModuleInclusionFinder_SingleDirectInclude.rb 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,6 @@
+module M1
+end
+
+class C1
+ include M1
+end
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.activeFile.rb.result
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.activeFile.rb.result (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.activeFile.rb.result 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,13 @@
+module NewModule
+ module Module
+ module CentralModule
+ end
+ end
+end
+
+class ModulTest
+ include NewModule::Module::CentralModule
+ include Module::InnerModule
+ include InnerModule
+ include NewModule
+end
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.activeFile.rb.source
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.activeFile.rb.source (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.activeFile.rb.source 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,13 @@
+module OuterModule
+ module Module
+ module CentralModule
+ end
+ end
+end
+
+class ModulTest
+ include OuterModule::Module::CentralModule
+ include Module::InnerModule
+ include InnerModule
+ include OuterModule
+end
Added: trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.test_properties
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.test_properties (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/resources/core/renamemodule/rename_module_test_7.test_properties 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,3 @@
+name=NewModule
+pos=12
+activeFile=activeFile.rb
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TC_ModuleInclusionFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TC_ModuleInclusionFinder.java (rev 0)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TC_ModuleInclusionFinder.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -0,0 +1,102 @@
+/***** BEGIN LICENSE BLOCK *****
+ * Version: CPL 1.0/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Common Public
+ * License Version 1.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * Copyright (C) 2007 Mirko Stocker <me...@mi...>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either of the GNU General Public License Version 2 or later (the "GPL"),
+ * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the CPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the CPL, the GPL or the LGPL.
+ ***** END LICENSE BLOCK *****/
+
+package org.rubypeople.rdt.refactoring.tests.core.renamemodule;
+
+import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleIncludeFinder;
+import org.rubypeople.rdt.refactoring.core.renamemodule.ModuleIncludeWrapper;
+import org.rubypeople.rdt.refactoring.documentprovider.IDocumentProvider;
+import org.rubypeople.rdt.refactoring.documentprovider.StringDocumentProvider;
+import org.rubypeople.rdt.refactoring.tests.FileTestCase;
+
+public class TC_ModuleInclusionFinder extends FileTestCase {
+
+ public TC_ModuleInclusionFinder() {
+ super("ModuleInclusionFinder");
+ }
+
+ public void testSingleDirectInclude() {
+ IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_SingleDirectInclude.rb");
+
+ ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleIncludeWrapper[]{});
+
+ assertEquals(1, includes.length);
+ assertNotNull(includes[0].getWrappedNode());
+ assertEquals("M1", includes[0].getFullName());
+ }
+
+ public void testMultipleDirectIncludes() {
+ IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_MultipleDirectIncludes.rb");
+
+ ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleIncludeWrapper[]{});
+
+ assertEquals(2, includes.length);
+ assertEquals("M1", includes[0].getFullName());
+ assertEquals("M1", includes[1].getFullName());
+ }
+
+ public void testIncludeWithNamespace() {
+ IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_IncludeWithNamespace.rb");
+
+ ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("Namespace::M1").toArray(new ModuleIncludeWrapper[]{});
+
+ assertEquals(1, includes.length);
+ assertEquals("Namespace::M1", includes[0].getFullName());
+ }
+
+ public void testIncludeFromWithinSameNamespace() {
+ IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_IncludeFromWithinSameNamespace.rb");
+
+ ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("Modul::M").toArray(new ModuleIncludeWrapper[]{});
+
+ assertEquals(2, includes.length);
+ assertEquals("Modul::M", includes[0].getFullName());
+ assertEquals("Modul::M", includes[1].getFullName());
+ }
+
+ public void testModulesWithEqualNamesInDifferentNamespaces() {
+ IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_ModulesWithEqualNamesInDifferentNamespaces.rb");
+
+ ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("Module::InnerModule").toArray(new ModuleIncludeWrapper[]{});
+
+ assertEquals(1, includes.length);
+ assertEquals("Module::InnerModule", includes[0].getFullName());
+ }
+
+ public void testNoIncludes() {
+ IDocumentProvider document = getDocument("TC_ModuleInclusionFinder_NoIncludes.rb");
+
+ ModuleIncludeWrapper[] includes = new ModuleIncludeFinder(document).find("M1").toArray(new ModuleIncludeWrapper[]{});
+
+ assertEquals(0, includes.length);
+ }
+
+ private IDocumentProvider getDocument(String name) {
+ return new StringDocumentProvider(name, getSource(name));
+ }
+}
Modified: trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TS_RenameModule.java
===================================================================
--- trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TS_RenameModule.java 2007-04-16 09:07:25 UTC (rev 2322)
+++ trunk/org.rubypeople.rdt.refactoring.tests/src/org/rubypeople/rdt/refactoring/tests/core/renamemodule/TS_RenameModule.java 2007-04-17 11:42:39 UTC (rev 2323)
@@ -36,7 +36,7 @@
public class TS_RenameModule extends FileTestSuite {
public static TestSuite suite() {
TestSuite suite = createSuite("Rename Module", "rename_module_test_*active*source", ModuleRenameTester.class);
-
+ suite.addTestSuite(TC_ModuleInclusionFinder.class);
suite.addTest(TS_RenameModuleChecks.suite());
return suite;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|