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-07-23 19:30:39
|
Revision: 2822
http://svn.sourceforge.net/rubyeclipse/?rev=2822&view=rev
Author: cawilliams
Date: 2007-07-23 12:30:39 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
fix some of the plugin.xml stuff
Modified Paths:
--------------
trunk/org.rubypeople.rdt.refactoring/plugin.xml
Modified: trunk/org.rubypeople.rdt.refactoring/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.refactoring/plugin.xml 2007-07-23 19:30:33 UTC (rev 2821)
+++ trunk/org.rubypeople.rdt.refactoring/plugin.xml 2007-07-23 19:30:39 UTC (rev 2822)
@@ -298,7 +298,7 @@
<objectContribution
id="org.rubypeople.rdt.refactoring.refactoringContext"
- objectClass="org.rubypeople.rdt.internal.core.RubyLocalVar">
+ objectClass="org.rubypeople.rdt.internal.core.LocalVariable">
<action
class="org.rubypeople.rdt.refactoring.action.ConvertTempToFieldAction"
id="org.rubypeople.rdt.refactoring.action.ConvertTempToFieldAction"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-23 19:30:37
|
Revision: 2821
http://svn.sourceforge.net/rubyeclipse/?rev=2821&view=rev
Author: cawilliams
Date: 2007-07-23 12:30:33 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
fix some of the plugin.xml stuff
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.xml
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-07-23 18:53:51 UTC (rev 2820)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-07-23 19:30:33 UTC (rev 2821)
@@ -830,11 +830,11 @@
id="org.rubypeople.rdt.ui.actions.Open">
</action>
<action
- definitionId="org.eclipse.jdt.ui.edit.text.java.open.type.hierarchy"
+ definitionId="org.rubypeople.rdt.ui.edit.text.ruby.open.type.hierarchy"
label="%OpenTypeHierarchyAction.label"
retarget="true"
menubarPath="navigate/open.ext"
- id="org.eclipse.jdt.ui.actions.OpenTypeHierarchy">
+ id="org.rubypeople.rdt.ui.actions.OpenTypeHierarchy">
</action>
</actionSet>
</extension>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-23 18:53:52
|
Revision: 2820
http://svn.sourceforge.net/rubyeclipse/?rev=2820&view=rev
Author: cawilliams
Date: 2007-07-23 11:53:51 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
use more sensible T_CONTAINER_QUALIFIED when methods are fully qualified (not T_FULLY_QUALIFIED which adds the file path)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/RubyElementLabels.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/RubyElementLabels.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/RubyElementLabels.java 2007-07-23 18:33:00 UTC (rev 2819)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/RubyElementLabels.java 2007-07-23 18:53:51 UTC (rev 2820)
@@ -366,7 +366,7 @@
// qualification
if (getFlag(flags, M_FULLY_QUALIFIED)) {
if (method.getDeclaringType() != null) {
- getTypeLabel(method.getDeclaringType(), T_FULLY_QUALIFIED
+ getTypeLabel(method.getDeclaringType(), T_CONTAINER_QUALIFIED
| (flags & QUALIFIER_FLAGS), buf);
buf.append('.');
}
@@ -416,7 +416,7 @@
if (getFlag(flags, M_POST_QUALIFIED)) {
if (method.getDeclaringType() != null) {
buf.append(CONCAT_STRING);
- getTypeLabel(method.getDeclaringType(), T_FULLY_QUALIFIED
+ getTypeLabel(method.getDeclaringType(), T_CONTAINER_QUALIFIED
| (flags & QUALIFIER_FLAGS), buf);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-23 18:33:04
|
Revision: 2819
http://svn.sourceforge.net/rubyeclipse/?rev=2819&view=rev
Author: cawilliams
Date: 2007-07-23 11:33:00 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
make types "container" qualified in hierarchy view
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/HierarchyLabelProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/HierarchyLabelProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/HierarchyLabelProvider.java 2007-07-23 15:29:42 UTC (rev 2818)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/HierarchyLabelProvider.java 2007-07-23 18:33:00 UTC (rev 2819)
@@ -19,7 +19,6 @@
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display;
-import org.rubypeople.rdt.core.Flags;
import org.rubypeople.rdt.core.IMethod;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.core.IType;
@@ -75,7 +74,7 @@
private TypeHierarchyLifeCycle fHierarchy;
public HierarchyLabelProvider(TypeHierarchyLifeCycle lifeCycle) {
- super(DEFAULT_TEXTFLAGS | RubyElementLabels.USE_RESOLVED, DEFAULT_IMAGEFLAGS);
+ super(DEFAULT_TEXTFLAGS | RubyElementLabels.T_CONTAINER_QUALIFIED | RubyElementLabels.USE_RESOLVED, DEFAULT_IMAGEFLAGS);
fHierarchy= lifeCycle;
fFilter= null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-23 15:29:44
|
Revision: 2818
http://svn.sourceforge.net/rubyeclipse/?rev=2818&view=rev
Author: cawilliams
Date: 2007-07-23 08:29:42 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
add (failing) test for multiple heredocs starting on same line
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-07-23 15:29:11 UTC (rev 2817)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-07-23 15:29:42 UTC (rev 2818)
@@ -345,5 +345,23 @@
EndBraceFinder finder = new EndBraceFinder("$'}|\"\npp $~");
assertEquals(2, finder.find());
}
+
+ public void testNestedHeredocs() {
+ String code = "methods += <<-BEGIN + nn_element_def(element) + <<-END\n" +
+ " def #{element.downcase}(attributes = {})\n" +
+ "BEGIN\n" +
+ " end\n" +
+ "END";
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 1);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 11);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 18);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 20);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 46);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 48);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 62); // #'{'
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 63); // #{'e'lem
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 79); // case'}'
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 112); // EN'D'
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-23 15:29:13
|
Revision: 2817
http://svn.sourceforge.net/rubyeclipse/?rev=2817&view=rev
Author: cawilliams
Date: 2007-07-23 08:29:11 -0700 (Mon, 23 Jul 2007)
Log Message:
-----------
handle CGI.rb - multiple heredocs start on same line, but aren't separated by commas as when used as args in a method call. (concatenated together).
This doesn't properly color still, but at least it doesn't raise an exception that prevents the editor from opening like before.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-07-20 17:41:23 UTC (rev 2816)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-07-23 15:29:11 UTC (rev 2817)
@@ -161,7 +161,7 @@
return popTokenOffQueue();
} else if (lexerToken == Tokens.tSTRING_BEG) {
String opening = fContents.substring(fOffset - origOffset, lexerSource.getOffset());
- int index = opening.indexOf(",");
+ int index = indexOf(opening, ", +");
if (opening.trim().startsWith("<<") && index != -1) {
addHereDocStartToken(index);
addCommaToken(index);
@@ -203,6 +203,24 @@
return returnValue;
}
+ private int indexOf(String opening, String string) {
+ String trimmed = opening.trim();
+ int diff = opening.indexOf(trimmed.charAt(0)); // Count leading whitespace
+ int lowest = -1;
+ for (int i = 0; i < string.length(); i++) {
+ char c = string.charAt(i);
+ int value = trimmed.indexOf(c);
+ if (value == -1) continue;
+ value += diff;
+ if (lowest == -1) {
+ lowest = value;
+ continue;
+ }
+ if (value < lowest) lowest = value;
+ }
+ return lowest;
+ }
+
private void scanRestOfLine(String opening, int index) {
String possible = opening.substring(index + 1);
RubyPartitionScanner scanner = new RubyPartitionScanner();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 17:41:27
|
Revision: 2816
http://svn.sourceforge.net/rubyeclipse/?rev=2816&view=rev
Author: cawilliams
Date: 2007-07-20 10:41:23 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
trun debug flag off for type hierarchy and allow setting it when launching in development debug mode
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/TypeHierarchy.java
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-07-20 17:34:52 UTC (rev 2815)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-07-20 17:41:23 UTC (rev 2816)
@@ -90,6 +90,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.hierarchy.TypeHierarchy;
import org.rubypeople.rdt.internal.core.parser.MarkerUtility;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
import org.rubypeople.rdt.internal.core.search.RubyWorkspaceScope;
@@ -110,6 +111,7 @@
public class RubyModelManager implements IContentTypeChangeListener, ISaveParticipant {
private static final String BUFFER_MANAGER_DEBUG = RubyCore.PLUGIN_ID + "/debug/buffermanager"; //$NON-NLS-1$
+ private static final String TYPE_HIERARCHY_DEBUG = RubyCore.PLUGIN_ID + "/debug/typehierarchy"; //$NON-NLS-1$
private static final String RUBYMODEL_DEBUG = RubyCore.PLUGIN_ID + "/debug/rubymodel"; //$NON-NLS-1$
private static final String DELTA_DEBUG = RubyCore.PLUGIN_ID + "/debug/rubydelta"; //$NON-NLS-1$
private static final String DELTA_DEBUG_VERBOSE = RubyCore.PLUGIN_ID
@@ -1444,6 +1446,9 @@
String option = Platform.getDebugOption(BUFFER_MANAGER_DEBUG);
if (option != null) BufferManager.VERBOSE = option.equalsIgnoreCase("true"); //$NON-NLS-1$
+ option = Platform.getDebugOption(TYPE_HIERARCHY_DEBUG);
+ if (option != null) TypeHierarchy.DEBUG = option.equalsIgnoreCase("true"); //$NON-NLS-1$
+
option = Platform.getDebugOption(BUILDER_DEBUG);
if (option != null) RubyBuilder.DEBUG = option.equalsIgnoreCase("true"); //$NON-NLS-1$
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/TypeHierarchy.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/TypeHierarchy.java 2007-07-20 17:34:52 UTC (rev 2815)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/TypeHierarchy.java 2007-07-20 17:41:23 UTC (rev 2816)
@@ -61,7 +61,7 @@
*/
public class TypeHierarchy implements ITypeHierarchy, IElementChangedListener {
- public static boolean DEBUG = true;
+ public static boolean DEBUG = false;
static final byte VERSION = 0x0000;
// SEPARATOR
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 17:34:56
|
Revision: 2815
http://svn.sourceforge.net/rubyeclipse/?rev=2815&view=rev
Author: cawilliams
Date: 2007-07-20 10:34:52 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
avoid stack overflows
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/HierarchyResolver.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java 2007-07-20 16:30:47 UTC (rev 2814)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/RubyElementRequestor.java 2007-07-20 17:34:52 UTC (rev 2815)
@@ -38,6 +38,7 @@
List<SearchMatch> matches = requestor.getResults();
for (SearchMatch match : matches) {
IType type = (IType) match.getElement();
+ if (!type.getFullyQualifiedName().equals(fullyQualifiedName)) continue;
types.add(type);
}
return types.toArray(new IType[types.size()]);
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/HierarchyResolver.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/HierarchyResolver.java 2007-07-20 16:30:47 UTC (rev 2814)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/HierarchyResolver.java 2007-07-20 17:34:52 UTC (rev 2815)
@@ -52,6 +52,8 @@
// Grab the types from the script and then connect them up!
IType[] types = cu.getAllTypes();
for (int j = 0; j < types.length; j++) {
+ IType type = types[j];
+ if (!type.getFullyQualifiedName().equals(builder.focusQualifiedName)) continue;
try {
reportHierarchy(types[j]);
} catch (RubyModelException e) {
@@ -79,7 +81,7 @@
this.builder.connect(type, superclass, superinterfaces);
if (type.isClass() && superclass != null) {
reportHierarchy(superclass);
- } // FIXME What about Modules!? How do we recurse through those?
+ }
}
private IType[] findSuperInterfaces(IType type) throws RubyModelException {
@@ -99,7 +101,9 @@
private IType getLogicalType(IType type, String name) {
RubyElementRequestor requestor = new RubyElementRequestor(type.getRubyScript());
- return new LogicalType(requestor.findType(name));
+ IType[] types = requestor.findType(name);
+ if (types == null || types.length == 0) return null;
+ return new LogicalType(types);
}
private void reset() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 16:30:48
|
Revision: 2814
http://svn.sourceforge.net/rubyeclipse/?rev=2814&view=rev
Author: cawilliams
Date: 2007-07-20 09:30:47 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
make sure LogicalType holding modules says its a module, and that in the type hierarchy it uses the correct icon.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LogicalType.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LogicalType.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LogicalType.java 2007-07-20 16:30:43 UTC (rev 2813)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/LogicalType.java 2007-07-20 16:30:47 UTC (rev 2814)
@@ -36,4 +36,9 @@
return false;
}
+ @Override
+ public boolean isModule() {
+ return types[0].isModule();
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 16:30:44
|
Revision: 2813
http://svn.sourceforge.net/rubyeclipse/?rev=2813&view=rev
Author: cawilliams
Date: 2007-07-20 09:30:43 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
make sure LogicalType holding modules says its a module, and that in the type hierarchy it uses the correct icon.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/HierarchyLabelProvider.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/HierarchyLabelProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/HierarchyLabelProvider.java 2007-07-20 16:23:17 UTC (rev 2812)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/HierarchyLabelProvider.java 2007-07-20 16:30:43 UTC (rev 2813)
@@ -150,21 +150,12 @@
return new RubyElementImageDescriptor(RubyPluginImages.DESC_OBJS_CLASS, 0, RubyElementImageProvider.BIG_SIZE);
}
- int flags= hierarchy.getCachedFlags(type);
- if (flags == -1) {
- return new RubyElementImageDescriptor(RubyPluginImages.DESC_OBJS_CLASS, 0, RubyElementImageProvider.BIG_SIZE);
- }
-
- boolean isModule= Flags.isModule(flags);
+ boolean isModule= type.isModule();
boolean isInner= (type.getDeclaringType() != null);
ImageDescriptor desc= RubyElementImageProvider.getTypeImageDescriptor(isModule, isInner, isDifferentScope(type));
- int adornmentFlags= 0;
- if (Flags.isStatic(flags)) {
- adornmentFlags |= RubyElementImageDescriptor.STATIC;
- }
-
+ int adornmentFlags= 0;
return new RubyElementImageDescriptor(desc, adornmentFlags, RubyElementImageProvider.BIG_SIZE);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 16:23:18
|
Revision: 2812
http://svn.sourceforge.net/rubyeclipse/?rev=2812&view=rev
Author: cawilliams
Date: 2007-07-20 09:23:17 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
add missing string
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-07-20 16:20:53 UTC (rev 2811)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-07-20 16:23:17 UTC (rev 2812)
@@ -60,6 +60,8 @@
OpenNewRubyProjectWizardAction_description=Opens the new Ruby project wizard
OpenNewRubyProjectWizardAction_tooltip=Opens the new Ruby project wizard
+NewWizardsActionGroup_new=Ne&w
+
OpenTypeHierarchyAction_label=Ope&n Type Hierarchy
OpenTypeHierarchyAction_tooltip=Open a Type Hierarchy on the Selected Element
OpenTypeHierarchyAction_description=Open a type hierarchy on the selected element
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 16:20:56
|
Revision: 2811
http://svn.sourceforge.net/rubyeclipse/?rev=2811&view=rev
Author: cawilliams
Date: 2007-07-20 09:20:53 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
add some missing strings for hierarchy code
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties 2007-07-20 16:17:13 UTC (rev 2810)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties 2007-07-20 16:20:53 UTC (rev 2811)
@@ -9,9 +9,14 @@
# IBM Corporation - initial API and implementation
###############################################################################
-### RubyModel messages_
+### RubyModel messages.
-hierarchy_nullRegion= Region cannot be null
+### hierarchy
+hierarchy_nullProject = Project argument cannot be null
+hierarchy_nullRegion = Region cannot be null
+hierarchy_nullFocusType = Type focus cannot be null
+hierarchy_creating = Creating type hierarchy...
+hierarchy_creatingOnType = Creating type hierarchy on {0}...
### ruby element
element_doesNotExist = {0} does not exist
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 16:17:15
|
Revision: 2810
http://svn.sourceforge.net/rubyeclipse/?rev=2810&view=rev
Author: cawilliams
Date: 2007-07-20 09:17:13 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
fix the type hierarchy view a bit
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/HierarchyResolver.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/HierarchyResolver.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/HierarchyResolver.java 2007-07-20 16:17:09 UTC (rev 2809)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/hierarchy/HierarchyResolver.java 2007-07-20 16:17:13 UTC (rev 2810)
@@ -53,7 +53,7 @@
IType[] types = cu.getAllTypes();
for (int j = 0; j < types.length; j++) {
try {
- reportHierarchy(types[i]);
+ reportHierarchy(types[j]);
} catch (RubyModelException e) {
// ignore
}
@@ -69,7 +69,7 @@
private void reportHierarchy(IType type) throws RubyModelException {
IType superclass;
- if (type.isModule()){ // do not connect interfaces to Object
+ if (type.isModule()){ // do not connect modules to Object
superclass = null;
} else {
superclass = findSuperClass(type);
@@ -77,6 +77,9 @@
IType[] superinterfaces = findSuperInterfaces(type);
this.builder.connect(type, superclass, superinterfaces);
+ if (type.isClass() && superclass != null) {
+ reportHierarchy(superclass);
+ } // FIXME What about Modules!? How do we recurse through those?
}
private IType[] findSuperInterfaces(IType type) throws RubyModelException {
@@ -90,6 +93,7 @@
private IType findSuperClass(IType type) throws RubyModelException {
String name = type.getSuperclassName();
+ if (name == null) return null;
return getLogicalType(type, name);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 16:17:12
|
Revision: 2809
http://svn.sourceforge.net/rubyeclipse/?rev=2809&view=rev
Author: cawilliams
Date: 2007-07-20 09:17:09 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
fix the type hierarchy view a bit
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.xml
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/TypeInfoFactory.java
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-07-20 15:24:55 UTC (rev 2808)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-07-20 16:17:09 UTC (rev 2809)
@@ -489,6 +489,10 @@
commandId="org.rubypeople.rdt.ui.edit.text.ruby.open.editor"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
<key
+ sequence="F4"
+ commandId="org.rubypeople.rdt.ui.edit.text.ruby.open.type.hierarchy"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
sequence="M1+M2+T"
contextId="org.rubypeople.rdt.ui.rubyEditorScope"
commandId="org.rubypeople.rdt.ui.edit.text.ruby.open.type"
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/TypeInfoFactory.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/TypeInfoFactory.java 2007-07-20 15:24:55 UTC (rev 2808)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/corext/util/TypeInfoFactory.java 2007-07-20 16:17:09 UTC (rev 2809)
@@ -14,6 +14,7 @@
import java.util.Comparator;
import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
import org.rubypeople.rdt.core.IRubyModel;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.RubyCore;
@@ -37,6 +38,7 @@
}
public TypeInfo create(char[] packageName, char[] typeName, char[][] enclosingName, boolean isModule, String path) {
+ path = new Path(path).toPortableString();
String pn= getPackageName(packageName);
String tn= new String(typeName);
TypeInfo result= null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 15:24:58
|
Revision: 2808
http://svn.sourceforge.net/rubyeclipse/?rev=2808&view=rev
Author: cawilliams
Date: 2007-07-20 08:24:55 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
color Back Ref as a global?
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-07-20 15:24:38 UTC (rev 2807)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/RubyTokenScanner.java 2007-07-20 15:24:55 UTC (rev 2808)
@@ -146,6 +146,7 @@
isInSymbol = true;
return doGetToken(IRubyColorConstants.RUBY_SYMBOL);
case Tokens.tGVAR:
+ case Tokens.tBACK_REF:
return doGetToken(IRubyColorConstants.RUBY_GLOBAL);
case Tokens.tIVAR:
case Tokens.tCVAR: // FIXME Allow for unique coloring of class variables...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 15:24:41
|
Revision: 2807
http://svn.sourceforge.net/rubyeclipse/?rev=2807&view=rev
Author: cawilliams
Date: 2007-07-20 08:24:38 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
fix null pointer
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2007-07-20 13:52:02 UTC (rev 2806)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/codeassist/SelectionEngine.java 2007-07-20 15:24:38 UTC (rev 2807)
@@ -178,6 +178,7 @@
String typeName = ASTUtil.getNameReflectively(receiver);
+ if (typeName == null) typeName = "Object";
CollectingSearchRequestor requestor = new CollectingSearchRequestor();
SearchPattern pattern = SearchPattern.createPattern(
IRubyElement.TYPE, typeName,
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java 2007-07-20 13:52:02 UTC (rev 2806)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/ASTUtil.java 2007-07-20 15:24:38 UTC (rev 2807)
@@ -154,6 +154,7 @@
* @return name or null
*/
public static String getNameReflectively(Node node) {
+ if (node == null) return "";
if (node instanceof ClassNode) {
ClassNode classNode = (ClassNode) node;
return getNameReflectively(classNode.getCPath());
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 13:52:05
|
Revision: 2806
http://svn.sourceforge.net/rubyeclipse/?rev=2806&view=rev
Author: cawilliams
Date: 2007-07-20 06:52:02 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
add test and fix for #5254 - Syntax highlighting incorrect in supplied snippet
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-07-20 13:51:57 UTC (rev 2805)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-07-20 13:52:02 UTC (rev 2806)
@@ -9,6 +9,7 @@
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.rules.FastPartitioner;
+import org.rubypeople.rdt.internal.ui.text.RubyPartitionScanner.EndBraceFinder;
/**
* @author Chris
@@ -319,7 +320,30 @@
assertContentType(RubyPartitionScanner.RUBY_STRING, code, 177); // 'e'nd_sql
}
+ public void testScaryString() {
+ String code = "puts \"match|#{$`}<<#{$&}>>#{$'}|\"\n" +
+ "pp $~";
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 1); // p'u'ts
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 5); // '"'match
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 13); // #'{'$`
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 14); // $
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 15); // `
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 16); // }
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 20); // {
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 21); // $
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 22); // &
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 23); // }
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 27); // {
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 28); // $
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 29); // '
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 30); // }
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 34); // 'p'p $~
+ }
// TODO Handle yet even wackier heredoc syntax: http://blog.jayfields.com/2006/12/ruby-multiline-strings-here-doc-or.html
+ public void testBraceFinderHandlesWeirdGlobal() {
+ EndBraceFinder finder = new EndBraceFinder("$'}|\"\npp $~");
+ assertEquals(2, finder.find());
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-20 13:51:59
|
Revision: 2805
http://svn.sourceforge.net/rubyeclipse/?rev=2805&view=rev
Author: cawilliams
Date: 2007-07-20 06:51:57 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
add test and fix for #5254 - Syntax highlighting incorrect in supplied snippet
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-07-19 19:56:35 UTC (rev 2804)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-07-20 13:51:57 UTC (rev 2805)
@@ -255,7 +255,7 @@
}
private void scanTokensInsideDynamicPortion() {
- String possible = new String(fContents.substring(fOffset - origOffset));
+ String possible = new String(fContents.substring(fOffset - origOffset));
int end = findEnd(possible);
if (end != -1) {
possible = possible.substring(0, end);
@@ -417,7 +417,7 @@
setPartialRange(document, offset, length, null, -1);
}
- private static class EndBraceFinder {
+ public static class EndBraceFinder {
private String input;
private List<String> stack;
@@ -431,6 +431,7 @@
char c = input.charAt(i);
switch (c) {
case '\\':
+ case '$':
// skip next character
i++;
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-19 19:56:58
|
Revision: 2804
http://svn.sourceforge.net/rubyeclipse/?rev=2804&view=rev
Author: cawilliams
Date: 2007-07-19 12:56:35 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
fix test
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-07-19 19:07:17 UTC (rev 2803)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java 2007-07-19 19:56:35 UTC (rev 2804)
@@ -90,6 +90,9 @@
buffer.append(new Path(StandardVMDebugger.getDirectoryOfRubyDebuggerFile()).toOSString());
if (Platform.getOS().equals(Platform.OS_WIN32))
buffer.append("\"");
+ }
+ addSyncArgs(buffer);
+ if (debug) {
buffer.append(" -r");
buffer.append(debugFile);
buffer.append(" -rclassic-debug");
@@ -103,6 +106,16 @@
return buffer.toString();
}
+ private void addSyncArgs(StringBuffer buffer) {
+ buffer.append(" -I ");
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ buffer.append("\"");
+ buffer.append(LaunchingPlugin.getFileInPlugin(new Path("ruby/sync.rb")).getParent());
+ if (Platform.getOS().equals(Platform.OS_WIN32))
+ buffer.append("\"");
+ buffer.append(" -rsync.rb");
+ }
+
public void testDebugEnabled() throws Exception {
// check if debugging is enabled in plugin.xml
ILaunchConfigurationType launchConfigurationType = getLaunchManager().getLaunchConfigurationType(IRubyLaunchConfigurationConstants.ID_RUBY_APPLICATION);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-19 19:07:35
|
Revision: 2802
http://svn.sourceforge.net/rubyeclipse/?rev=2802&view=rev
Author: cawilliams
Date: 2007-07-19 12:07:12 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
add test and fix for some nasty heredoc syntax that was breaking editor
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/MergingPartitionScanner.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/MergingPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/MergingPartitionScanner.java 2007-07-19 16:41:35 UTC (rev 2801)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/MergingPartitionScanner.java 2007-07-19 19:07:12 UTC (rev 2802)
@@ -50,8 +50,6 @@
IToken token = null;
while(!(token = fScanner.nextToken()).isEOF()) {
if (lastToken != null && token.getData().equals(lastToken.getData())) {
-// fLength = (fScanner.getTokenOffset() - fOffset) + fScanner.getTokenLength();
-// Assert.isTrue(fLength >= 0);
} else if (lastToken == null) {
lastToken = token;
fOffset = fScanner.getTokenOffset();
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-07-19 16:41:35 UTC (rev 2801)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/RubyPartitionScanner.java 2007-07-19 19:07:12 UTC (rev 2802)
@@ -52,6 +52,11 @@
public IToken getToken() {
return token;
}
+
+ @Override
+ public String toString() {
+ return getToken().getData() + ": offset: " + getOffset() + ", length: " + getLength();
+ }
}
private RubyYaccLexer lexer;
@@ -154,6 +159,18 @@
addClosingBraceToken();
setLexerPastDynamicSectionOfString();
return popTokenOffQueue();
+ } else if (lexerToken == Tokens.tSTRING_BEG) {
+ String opening = fContents.substring(fOffset - origOffset, lexerSource.getOffset());
+ int index = opening.indexOf(",");
+ if (opening.trim().startsWith("<<") && index != -1) {
+ addHereDocStartToken(index);
+ addCommaToken(index);
+ scanRestOfLine(opening, index);
+ // set up state variables
+ fOpeningString = opening.substring(0, index).trim() + "\n";
+ fContentType = RUBY_STRING;
+ return popTokenOffQueue();
+ }
}
returnValue = getToken(lexerToken);
}
@@ -186,6 +203,26 @@
return returnValue;
}
+ private void scanRestOfLine(String opening, int index) {
+ String possible = opening.substring(index + 1);
+ RubyPartitionScanner scanner = new RubyPartitionScanner();
+ IDocument document = new Document(possible);
+ scanner.setRange(document, 0, possible.length());
+ IToken token;
+ while (!(token = scanner.nextToken()).isEOF()) {
+ push(new QueuedToken(token, scanner.getTokenOffset() + fOffset + index + 1, scanner.getTokenLength()));
+ }
+ setOffset(fOffset + index + 1 + possible.length());
+ }
+
+ private void addCommaToken(int index) {
+ push(new QueuedToken(new Token(RUBY_DEFAULT), fOffset + index, 1));
+ }
+
+ private void addHereDocStartToken(int index) {
+ push(new QueuedToken(new Token(RUBY_STRING), fOffset, index));
+ }
+
private void setOffset(int offset) {
fOffset = offset;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-19 19:07:35
|
Revision: 2803
http://svn.sourceforge.net/rubyeclipse/?rev=2803&view=rev
Author: cawilliams
Date: 2007-07-19 12:07:17 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
add test and fix for some nasty heredoc syntax that was breaking editor
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
Modified: trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java
===================================================================
--- trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-07-19 19:07:12 UTC (rev 2802)
+++ trunk/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/text/TC_RubyPartitionScanner.java 2007-07-19 19:07:17 UTC (rev 2803)
@@ -16,6 +16,10 @@
*/
public class TC_RubyPartitionScanner extends TestCase {
+ private void assertContentType(String contentType, String code, int offset) {
+ assertEquals("Content type doesn't match expectations for: " + code.charAt(offset), contentType, getContentType(code, offset));
+ }
+
private String getContentType(String content, int offset) {
IDocument doc = new Document(content);
FastPartitioner partitioner = new FastPartitioner(new MergingPartitionScanner(), RubyPartitionScanner.LEGAL_CONTENT_TYPES);
@@ -24,104 +28,103 @@
}
public void testUnclosedInterpolationDoesntInfinitelyLoop() {
- String source = "%[\"#{\"]";
- this.getContentType(source, 0);
+ getContentType("%[\"#{\"]", 0);
assert(true);
}
public void testPartitioningOfSingleLineComment() {
String source = "# This is a comment\n";
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 1));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 18));
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, source, 1);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, source, 18);
}
public void testRecognizeSpecialCase() {
String source = "a,b=?#,'This is not a comment!'\n";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 5));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 6));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 5);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 6);
}
public void testMultilineComment() {
String source = "=begin\nComment\n=end";
- assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, 10));
+ assertContentType(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, source, 10);
source = "=begin\n"+
" for multiline comments, the =begin and =end must\n" +
" appear in the first column\n" +
"=end";
- assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, source.length() / 2));
- assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, source.length() - 2));
+ assertContentType(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, source, source.length() / 2);
+ assertContentType(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, source, source.length() - 2);
}
public void testMultilineCommentNotOnFirstColumn() {
String source = " =begin\nComment\n=end";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 1));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 2));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 10));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 1);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 2);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 10);
}
public void testRecognizeDivision() {
String source = "1/3 #This is a comment\n";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 3));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 5));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 3);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, source, 5);
}
public void testRecognizeOddballCharacters() {
String source = "?\" #comment\n";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 2));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 5));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 2);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, source, 5);
source = "?' #comment\n";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 2));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 5));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 2);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, source, 5);
source = "?/ #comment\n";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 2));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, 5));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 2);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, source, 5);
}
public void testPoundCharacterIsntAComment() {
String source = "?#";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(source, 1));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, source, 1);
}
public void testSinglelineCommentJustAfterMultilineComment() {
String source = "=begin\nComment\n=end\n# this is a singleline comment\n";
- assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, 0));
- assertEquals(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, this.getContentType(source, 10));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(source, source.length() - 5));
+ assertContentType(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, source, 0);
+ assertContentType(RubyPartitionScanner.RUBY_MULTI_LINE_COMMENT, source, 10);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, source, source.length() - 5);
}
public void testMultipleCommentsInARow() {
String code = "# comment 1\n# comment 2\nclass Chris\nend\n";
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 6));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 17));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 26));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 29));
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 6);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 17);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 26);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 29);
}
public void testCommentAfterEnd() {
String code = "class Chris\nend # comment\n";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 12));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 17));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 12);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 17);
}
public void testCommentAfterEndWhileEditing() {
@@ -134,8 +137,8 @@
" def thing\r\n" +
" end #ocmm \r\n" +
"end";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 76));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 83));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 76);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 83);
}
public void testCommentAtEndOfLineWithStringAtBeginning() {
@@ -144,18 +147,18 @@
" 123\n" +
" }\n" +
"}";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 0));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 4));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 6));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 0);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 4);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 6);
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 8));
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 12));
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 18));
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 8);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 12);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 18);
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 19));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 22));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 19);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 22);
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 25));
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 25);
}
public void testLinesWithJustSpaceBeforeComment() {
@@ -164,125 +167,108 @@
" def method\n" +
" \n" +
" end";
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 5));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 14));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 20));
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 5);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 14);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 20);
}
public void testCommentsWithAlotOfPrecedingSpaces() {
String code = " # We \n" +
" # caller-requested until.\n" +
"return self\n";
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 16));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 63));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 70));
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 16);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 63);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 70);
}
public void testCodeWithinString() {
String code = "string = \"here's some code: #{1} there\"";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'{1...
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 30)); // '1'} t...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 31)); // '}' th...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 35)); // th'e're..
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 2); // st'r'...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 10); // "'h'er...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 28); // '#'{1...
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 30); // '1'} t...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 31); // '}' th...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 35); // th'e're..
}
public void testCodeWithinSingleQuoteString() {
String code = "string = 'here s some code: #{1} there'";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'{1...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 30)); // '1'} t...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 31)); // '}' th...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 35)); // th'e're..
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 2); // st'r'...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 10); // "'h'er...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 28); // '#'{1...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 30); // '1'} t...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 31); // '}' th...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 35); // th'e're..
}
public void testVariableSubstitutionWithinString() {
String code = "string = \"here's some code: #$global there\"";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'$glo...
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 29)); // '$'global
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 36));// ' 'there...
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 2); // st'r'...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 10); // "'h'er...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 28); // '#'$glo...
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 29); // '$'global
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 36);// ' 'there...
}
public void testStringWithinCodeWithinString() {
String code = "string = \"here's some code: #{var = 'string'} there\"";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'{var
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 30)); // 'v'ar =
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 36)); // '''string
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 46)); // 't'here
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 2); // st'r'...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 10); // "'h'er...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 28); // '#'{var
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 30); // 'v'ar =
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 36); // '''string
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 46); // 't'here
}
public void testStringWithEndBraceWithinCodeWithinString() {
String code = "string = \"here's some code: #{var = '}'; 1} there\"";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // st'r'...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 10)); // "'h'er...
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 28)); // '#'{var
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 30)); // 'v'ar =
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 37)); // '}';
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 39)); // ';' 1}
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 41)); // ; '1'}
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 42)); // 1'}' t
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 44)); // 't'here
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 2); // st'r'...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 10); // "'h'er...
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 28); // '#'{var
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 30); // 'v'ar =
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 37); // '}';
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 39); // ';' 1}
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 41); // ; '1'}
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 42); // 1'}' t
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 44); // 't'here
}
public void testRegex() {
String code = "regex = /hi there/";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 2)); // re'g'ex
- assertEquals(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, this.getContentType(code, 9)); // '/'hi the
- assertEquals(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, this.getContentType(code, 11)); // /h'i' the
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 2); // re'g'ex
+ assertContentType(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, code, 9); // '/'hi the
+ assertContentType(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, code, 11); // /h'i' the
}
public void testRegexWithDynamicCode() {
String code = "/\\.#{Regexp.escape(extension.to_s)}$/ # comment";
- assertEquals(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, this.getContentType(code, 3));
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 38)); // '#' co
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 40)); // # 'c'ommen
+ assertContentType(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, code, 3);
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 38); // '#' co
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 40); // # 'c'ommen
}
- public void testWronglyColoredHeredoc() {
- // FIXME Something is weird, this test passes, and it works in a normal editor, but is broken in ActiveRecord::Base externally
- String code = "def destroy\n" +
-" unless new_record?\n" +
-" connection.delete <<-end_sql, \"#{self.class.name} Destroy\"\n" +
-" DELETE FROM #{self.class.table_name}\n" +
-" WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}\n" +
-" end_sql\n" +
-" end\n" +
-" \n" +
-" freeze\n" +
-"end";
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 58)); // <<-'e'nd_sql
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, code.length() - 8)); // fr'e'eze
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, code.length() - 2)); // e'n'd
- }
-
public void testEscapedCharactersAndSingleQuoteInsideDoubleQuote() {
String code = "quoted_value = \"'#{quoted_value[1..-2].gsub(/\\'/, \"\\\\\\\\'\")}'\" if quoted_value.include?(\"\\\\\\'\") # (for ruby mode) \"\n" +
"quoted_value";
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 16)); //
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 19)); // #{'q'uoted
- assertEquals(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, this.getContentType(code, 44)); // /
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 51)); // "\
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 59)); // '" if
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 62)); // 'i'f quoted_
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 87)); // include?('"'
- assertEquals(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, this.getContentType(code, 95)); //'#' (for ruby mode)
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, code.length() - 3));
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 16); //
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 19); // #{'q'uoted
+ assertContentType(RubyPartitionScanner.RUBY_REGULAR_EXPRESSION, code, 44); // /
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 51); // "\
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 59); // '" if
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 62); // 'i'f quoted_
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 87); // include?('"'
+ assertContentType(RubyPartitionScanner.RUBY_SINGLE_LINE_COMMENT, code, 95); //'#' (for ruby mode)
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, code.length() - 3);
}
public void testSingleQuotedString() {
String code = "require 'commands/server'";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 1));
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 8));
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 9));
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 17));
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 18));
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 24));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 1);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 8);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 9);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 17);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 18);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 24);
}
public void testCommands() {
@@ -290,29 +276,50 @@
" `mongrel_rails #{parameters.join(\" \")} -d`\n" +
"else\n" +
" ENV[\"RAILS_ENV\"] = OPTIONS[:environment]";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 1));
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 22));
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 23));
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 38));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 50));
- assertEquals(RubyPartitionScanner.RUBY_STRING, this.getContentType(code, 55));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 58));
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 59));
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 63));
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 65));
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 1);
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 22);
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 23);
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 38);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 50);
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 55);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 58);
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 59);
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 63);
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 65);
}
public void testPercentXCommand() {
String code = "if (@options.do_it)\n" +
" %x{#{cmd}}\n" +
"end\n";
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 1)); // i'f'
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 22)); // '%'x
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 24)); // %x'{'
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 27)); //'c'md
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 30)); // cmd'}'
- assertEquals(RubyPartitionScanner.RUBY_COMMAND, this.getContentType(code, 31)); // cmd}'}'
- assertEquals(RubyPartitionScanner.RUBY_DEFAULT, this.getContentType(code, 33)); //'e'nd
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 1); // i'f'
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 22); // '%'x
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 24); // %x'{'
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 27); //'c'md
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 30); // cmd'}'
+ assertContentType(RubyPartitionScanner.RUBY_COMMAND, code, 31); // cmd}'}'
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 33); //'e'nd
}
+
+ public void testHeredocInArgumentList() {
+ String code = "connection.delete <<-end_sql, \"#{self.class.name} Destroy\"\n" +
+ " DELETE FROM #{self.class.table_name}\n" +
+ " WHERE #{connection.quote_column_name(self.class.primary_key)} = #{quoted_id}\n" +
+ "end_sql\n";
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 1); // c'o'nnection
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 18); // '<'<-end_sql
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 33); // 's'elf.class
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 48); // '}' Destroy
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 75); // 's'elf.class
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 96); // name'}'\n
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 108); // {'c'onnection
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 160); // '}' =
+ assertContentType(RubyPartitionScanner.RUBY_DEFAULT, code, 166); // {'q'uoted
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 175); // _id'}'\n
+ assertContentType(RubyPartitionScanner.RUBY_STRING, code, 177); // 'e'nd_sql
+ }
+
+ // TODO Handle yet even wackier heredoc syntax: http://blog.jayfields.com/2006/12/ruby-multiline-strings-here-doc-or.html
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-19 16:41:37
|
Revision: 2801
http://svn.sourceforge.net/rubyeclipse/?rev=2801&view=rev
Author: cawilliams
Date: 2007-07-19 09:41:35 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
add a script which forces STDOUT and STDERR to sync/auto-flush. Then add that script in secretly on command line for all ruby launches.
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/ruby/sync.rb
Added: trunk/org.rubypeople.rdt.launching/ruby/sync.rb
===================================================================
--- trunk/org.rubypeople.rdt.launching/ruby/sync.rb (rev 0)
+++ trunk/org.rubypeople.rdt.launching/ruby/sync.rb 2007-07-19 16:41:35 UTC (rev 2801)
@@ -0,0 +1,2 @@
+STDOUT.sync = true
+STDERR.sync = true
\ No newline at end of file
Property changes on: trunk/org.rubypeople.rdt.launching/ruby/sync.rb
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-07-19 16:22:06 UTC (rev 2800)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-07-19 16:41:35 UTC (rev 2801)
@@ -77,6 +77,7 @@
if (cp.length > 0) {
arguments.addAll(convertLoadPath(config, cp));
}
+ addStreamSync(arguments);
arguments.addAll(debugSpecificVMArgs(debugTarget));
arguments.add(StandardVMRunner.END_OF_OPTIONS_DELIMITER);
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-07-19 16:22:06 UTC (rev 2800)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-07-19 16:41:35 UTC (rev 2801)
@@ -22,6 +22,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.model.IProcess;
@@ -32,6 +33,8 @@
public class StandardVMRunner extends AbstractVMRunner {
+ private static final String LOADPATH_SWITCH = "-I";
+
protected static final String END_OF_OPTIONS_DELIMITER = "--";
protected IVMInstall fVMInstance;
@@ -180,7 +183,7 @@
String path = lp[i];
// Don't add project to loadpath if project is working directory
if (working != null && working.equals(path)) continue;
- strings.add("-I"); //$NON-NLS-1$
+ strings.add(LOADPATH_SWITCH); //$NON-NLS-1$
strings.add(path);
}
return strings;
@@ -212,6 +215,7 @@
if (lp.length > 0) {
arguments.addAll(convertLoadPath(config, lp));
}
+ addStreamSync(arguments);
arguments.add(END_OF_OPTIONS_DELIMITER);
arguments.add(config.getFileToLaunch());
@@ -251,4 +255,11 @@
subMonitor.done();
}
+ protected void addStreamSync(List<String> arguments) {
+ File sync = LaunchingPlugin.getFileInPlugin(new Path("ruby/sync.rb"));
+ arguments.add(LOADPATH_SWITCH);
+ arguments.add(sync.getParent());
+ arguments.add("-rsync.rb");
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-19 16:22:09
|
Revision: 2800
http://svn.sourceforge.net/rubyeclipse/?rev=2800&view=rev
Author: cawilliams
Date: 2007-07-19 09:22:06 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
check vmInstallLocation to see if "bin" is in it already. If so, don't add "bin" in path to ri/rdoc/irb
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-07-19 16:19:59 UTC (rev 2799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-07-19 16:22:06 UTC (rev 2800)
@@ -1670,7 +1670,11 @@
IVMInstall vm = RubyRuntime.getDefaultVMInstall();
if (vm == null) return null;
File installLocation = vm.getInstallLocation();
- String path = installLocation.getAbsolutePath() + File.separator + "bin" + File.separator + command;
+ String path = installLocation.getAbsolutePath();
+ if (!installLocation.getName().equals("bin")) {
+ path += File.separator + "bin";
+ }
+ path += File.separator + command;
if (Platform.getOS().equals(Platform.OS_WIN32)) {
path += ".bat";
}
@@ -1682,8 +1686,11 @@
String version = vm2.getRubyVersion();
if (version == null || version.length() < 3) return file;
version = version.substring(0, 3);
- path = installLocation.getAbsolutePath() + File.separator + "bin"
- + File.separator + command + version;
+ path = installLocation.getAbsolutePath();
+ if (!installLocation.getName().equals("bin")) {
+ path += File.separator + "bin";
+ }
+ path = File.separator + command + version;
if (Platform.getOS().equals(Platform.OS_WIN32)) {
path += ".bat";
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-19 16:20:08
|
Revision: 2799
http://svn.sourceforge.net/rubyeclipse/?rev=2799&view=rev
Author: cawilliams
Date: 2007-07-19 09:19:59 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
check vmInstallLocation to see if "bin" is in it already. If so, don't add "bin" in path to rdebug-ide
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-07-19 15:41:22 UTC (rev 2798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RDebugVMDebugger.java 2007-07-19 16:19:59 UTC (rev 2799)
@@ -53,7 +53,11 @@
}
public static String findRDebugExecutable(File vmInstallLocation) {
- return vmInstallLocation + File.separator + "bin" + File.separator + RDEBUG_EXECUTABLE;
+ String path = vmInstallLocation.getAbsolutePath();
+ if (!vmInstallLocation.getName().equals("bin")) {
+ path += File.separator + "bin";
+ }
+ return path + File.separator + RDEBUG_EXECUTABLE;
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-07-19 15:41:23
|
Revision: 2798
http://svn.sourceforge.net/rubyeclipse/?rev=2798&view=rev
Author: cawilliams
Date: 2007-07-19 08:41:22 -0700 (Thu, 19 Jul 2007)
Log Message:
-----------
first working prototype of type hierarchy
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/plugin.properties
trunk/org.rubypeople.rdt.ui/plugin.xml
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditorActionContributor.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/IContextMenuConstants.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/RubyUI.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/IRubyEditorActionDefinitionIds.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/OpenTypeInHierarchyAction.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/RubyElementReferenceConverter.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/ShowElementInTypeHierarchyViewHandler.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/TypeHierarchyViewPart.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/OpenTypeHierarchyUtil.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/workingsets/WorkingSetMessages.properties
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2007-07-19 15:40:45 UTC (rev 2797)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2007-07-19 15:41:22 UTC (rev 2798)
@@ -31,6 +31,7 @@
PreferencePage.rdtDebuggerPreferences=Debugger
viewCategoryName=Ruby
+hierarchyViewName=Hierarchy
appearancePrefName=Appearance
problemSeveritiesPrefName=Errors/Warnings
@@ -137,6 +138,12 @@
ActionDefinition.open.structure.name= Open Structure
ActionDefinition.open.structure.description= Show the structure of the selected element
+ActionDefinition.open.hierarchy.name= Quick Hierarchy
+ActionDefinition.open.hierarchy.description= Show the quick hierarchy of the selected element
+
+ActionDefinition.openTypeInHierarchy.name= Open Type in Hierarchy
+ActionDefinition.openTypeInHierarchy.description= Open a type in the type hierarchy view
+
scope.rubyEditor.name=Ruby Editor
scope.rubyEditor.description=Ruby Editor
@@ -181,4 +188,9 @@
OpenAction.label=&Open
OpenAction.tooltip=Open an Editor on the Selected Element
OpenTypeAction.label=Open &Type...
-OpenTypeAction.tooltip=Open an Editor on a Type
\ No newline at end of file
+OpenTypeAction.tooltip=Open an Editor on a Type
+
+OpenTypeHierarchyAction.label=Ope&n Type Hierarchy
+
+OpenTypeInHierarchyAction.label=Open Type in Hierarch&y...
+OpenTypeInHierarchyAction.tooltip=Opens a Type in a Type Hierarchy
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-07-19 15:40:45 UTC (rev 2797)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-07-19 15:41:22 UTC (rev 2798)
@@ -385,6 +385,13 @@
class="org.rubypeople.rdt.internal.ui.infoviews.RIView"
id="org.rubypeople.rdt.ui.views.RIView">
</view>
+ <view
+ name="%hierarchyViewName"
+ icon="$nl$/icons/full/eview16/class_hi.gif"
+ category="org.rubypeople.rdt.ui.ruby"
+ class="org.rubypeople.rdt.internal.ui.typehierarchy.TypeHierarchyViewPart"
+ id="org.rubypeople.rdt.ui.TypeHierarchy">
+ </view>
</extension>
<extension point="org.eclipse.ui.editors">
<editor
@@ -473,6 +480,10 @@
commandId="org.rubypeople.rdt.ui.edit.text.ruby.goto.matching.bracket"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
<key
+ sequence="M1+M2+H"
+ commandId="org.rubypeople.rdt.ui.navigate.open.type.in.hierarchy"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
sequence="F3"
contextId="org.rubypeople.rdt.ui.rubyEditorScope"
commandId="org.rubypeople.rdt.ui.edit.text.ruby.open.editor"
@@ -488,6 +499,11 @@
commandId="org.rubypeople.rdt.ui.edit.text.ruby.show.outline"
schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
<key
+ sequence="M1+T"
+ contextId="org.rubypeople.rdt.ui.rubyEditorScope"
+ commandId="org.rubypeople.rdt.ui.edit.text.ruby.open.hierarchy"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
+ <key
sequence="M1+F3"
contextId="org.rubypeople.rdt.ui.rubyEditorScope"
commandId="org.rubypeople.rdt.ui.navigate.ruby.open.structure"
@@ -581,13 +597,25 @@
id="org.rubypeople.rdt.ui.edit.text.ruby.open.type"
name="%OpenTypeAction.label">
</command>
- <command
+ <command
+ name="%ActionDefinition.openTypeInHierarchy.name"
+ description="%ActionDefinition.openTypeInHierarchy.description"
+ categoryId="org.eclipse.ui.category.navigate"
+ id="org.rubypeople.rdt.ui.navigate.open.type.in.hierarchy">
+ </command>
+ <command
name="%ActionDefinition.show.outline.name"
description="%ActionDefinition.show.outline.description"
categoryId="org.eclipse.ui.category.navigate"
id="org.rubypeople.rdt.ui.edit.text.ruby.show.outline">
</command>
<command
+ name="%ActionDefinition.open.hierarchy.name"
+ description="%ActionDefinition.open.hierarchy.description"
+ categoryId="org.eclipse.ui.category.navigate"
+ id="org.rubypeople.rdt.ui.edit.text.ruby.open.hierarchy">
+ </command>
+ <command
name="%ActionDefinition.open.structure.name"
description="%ActionDefinition.open.structure.description"
categoryId="org.eclipse.ui.category.navigate"
@@ -654,8 +682,29 @@
categoryId="org.eclipse.search.ui.category.search"
id="org.rubypeople.rdt.ui.edit.text.ruby.search.read.access.in.working.set">
</command>
+
</extension>
<extension
+ point="org.eclipse.ui.commands">
+ <commandParameterType
+ converter="org.rubypeople.rdt.internal.ui.commands.RubyElementReferenceConverter"
+ id="org.rubypeople.rdt.ui.commands.rubyElementReference"
+ type="org.rubypeople.rdt.core.IRubyElement"/>
+ <command
+ categoryId="org.eclipse.ui.category.navigate"
+ defaultHandler="org.rubypeople.rdt.internal.ui.commands.ShowElementInTypeHierarchyViewHandler"
+ description="%command.showElementInTypeHierarchyView.desc"
+ id="org.rubypeople.rdt.ui.commands.showElementInTypeHierarchyView"
+ name="%command.showElementInTypeHierarchyView.name">
+ <commandParameter
+ id="elementRef"
+ name="%commandParameter.showElementInTypeHierarchyView.elementRef.name"
+ optional="false"
+ typeId="org.rubypeople.rdt.ui.commands.rubyElementReference"/>
+ </command>
+ </extension>
+
+ <extension
point="org.eclipse.ui.actionSets">
<actionSet
label="%RubyActionSet.label"
@@ -669,8 +718,25 @@
name="editGroup">
</separator>
</menu>
-
<action
+ class="org.rubypeople.rdt.ui.actions.OpenTypeAction"
+ definitionId="org.rubypeople.rdt.ui.edit.text.ruby.open.type"
+ id="org.rubypeople.rdt.ui.actions.OpenType"
+ label="%OpenTypeAction.label"
+ icon="icons/full/etool16/opentype.gif"
+ menubarPath="navigate/open.ext"
+ tooltip="%OpenTypeAction.tooltip">
+ </action>
+ <action
+ definitionId="org.rubypeople.rdt.ui.navigate.open.type.in.hierarchy"
+ label="%OpenTypeInHierarchyAction.label"
+ helpContextId="org.rubypeople.rdt.ui.open_type_in_hierarchy_action"
+ tooltip="%OpenTypeInHierarchyAction.tooltip"
+ class="org.rubypeople.rdt.internal.ui.actions.OpenTypeInHierarchyAction"
+ menubarPath="navigate/open.ext2"
+ id="openTypeInHierarchy">
+ </action>
+ <action
definitionId="org.rubypeople.rdt.ui.generate.rdoc"
label="%GenerateRdocAction.label"
helpContextId="org.rubypeople.rdt.ui.generate_rdoc_action"
@@ -759,14 +825,12 @@
allowLabelUpdate="true"
id="org.rubypeople.rdt.ui.actions.Open">
</action>
- <action
- class="org.rubypeople.rdt.ui.actions.OpenTypeAction"
- definitionId="org.rubypeople.rdt.ui.edit.text.ruby.open.type"
- id="org.rubypeople.rdt.ui.actions.OpenType"
- label="%OpenTypeAction.label"
- icon="icons/full/etool16/opentype.gif"
+ <action
+ definitionId="org.eclipse.jdt.ui.edit.text.java.open.type.hierarchy"
+ label="%OpenTypeHierarchyAction.label"
+ retarget="true"
menubarPath="navigate/open.ext"
- tooltip="%OpenTypeAction.tooltip">
+ id="org.eclipse.jdt.ui.actions.OpenTypeHierarchy">
</action>
</actionSet>
</extension>
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java 2007-07-19 15:40:45 UTC (rev 2797)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.java 2007-07-19 15:41:22 UTC (rev 2798)
@@ -89,6 +89,11 @@
public static String OpenTypeAction_errorMessage;
public static String RubyOutlineControl_statusFieldText_hideInheritedMembers;
public static String RubyOutlineControl_statusFieldText_showInheritedMembers;
+ public static String OpenTypeHierarchyUtil_selectionDialog_title;
+ public static String OpenTypeHierarchyUtil_selectionDialog_message;
+ public static String OpenTypeHierarchyUtil_error_open_perspective;
+ public static String OpenTypeHierarchyUtil_error_open_editor;
+ public static String OpenTypeHierarchyUtil_error_open_view;
private RubyUIMessages() {
}
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties 2007-07-19 15:40:45 UTC (rev 2797)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/RubyUIMessages.properties 2007-07-19 15:41:22 UTC (rev 2798)
@@ -120,6 +120,15 @@
RubyElementLabels_declseparator_string=\ :\
RubyElementLabels_import_container=require/load declarations
+HistoryListAction_remove=&Remove
+HistoryListAction_remove_all=Remove &All
+HistoryListAction_max_entries_constraint=Please enter a positive integer smaller than {0}.
+OpenTypeHierarchyUtil_error_open_view=Problems opening Type Hierarchy View
+OpenTypeHierarchyUtil_error_open_perspective=Problems opening Type Hierarchy Perspective
+OpenTypeHierarchyUtil_error_open_editor=Problems opening Ruby Editor
+OpenTypeHierarchyUtil_selectionDialog_title=Open In Type Hierarchy
+OpenTypeHierarchyUtil_selectionDialog_message=&Select the type to be shown in the Type Hierarchy:
+
#########
# misc
#########
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-07-19 15:40:45 UTC (rev 2797)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-07-19 15:41:22 UTC (rev 2798)
@@ -63,6 +63,11 @@
public static String SelectAllAction_label;
public static String SelectAllAction_tooltip;
public static String NewWizardsActionGroup_new;
+ public static String OpenTypeInHierarchyAction_label;
+ public static String OpenTypeInHierarchyAction_description;
+ public static String OpenTypeInHierarchyAction_tooltip;
+ public static String OpenTypeInHierarchyAction_dialogTitle;
+ public static String OpenTypeInHierarchyAction_dialogMessage;
static {
NLS.initializeMessages(BUNDLE_NAME, ActionMessages.class);
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-07-19 15:40:45 UTC (rev 2797)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-07-19 15:41:22 UTC (rev 2798)
@@ -60,3 +60,20 @@
OpenNewRubyProjectWizardAction_description=Opens the new Ruby project wizard
OpenNewRubyProjectWizardAction_tooltip=Opens the new Ruby project wizard
+OpenTypeHierarchyAction_label=Ope&n Type Hierarchy
+OpenTypeHierarchyAction_tooltip=Open a Type Hierarchy on the Selected Element
+OpenTypeHierarchyAction_description=Open a type hierarchy on the selected element
+OpenTypeHierarchyAction_dialog_title=Open Type Hierarchy
+OpenTypeHierarchyAction_messages_title=Cannot create type hierarchy
+OpenTypeHierarchyAction_messages_no_java_element=A Ruby element must be selected.
+OpenTypeHierarchyAction_messages_no_java_resources=The selected package does not contain any Ruby resource.
+OpenTypeHierarchyAction_messages_no_types=The selected compilation unit does not contain a type.
+OpenTypeHierarchyAction_messages_no_valid_java_element=A valid Ruby element must be selected.
+OpenTypeHierarchyAction_messages_unknown_import_decl=The selected import declaration can not be resolved.
+
+OpenTypeInHierarchyAction_label=Open Type in Hierarchy...
+OpenTypeInHierarchyAction_description=Open a type in a type hierarchy
+
+OpenTypeInHierarchyAction_tooltip=Open a Type in a Type Hierarchy
+OpenTypeInHierarchyAction_dialogMessage=&Choose a type (? = any character, * = any string):
+OpenTypeInHierarchyAction_dialogTitle=Open Type in Hierarchy
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/OpenTypeInHierarchyAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/OpenTypeInHierarchyAction.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/OpenTypeInHierarchyAction.java 2007-07-19 15:41:22 UTC (rev 2798)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 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.internal.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.search.IRubySearchConstants;
+import org.rubypeople.rdt.core.search.SearchEngine;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.dialogs.OpenTypeSelectionDialog2;
+import org.rubypeople.rdt.internal.ui.util.OpenTypeHierarchyUtil;
+
+public class OpenTypeInHierarchyAction extends Action implements IWorkbenchWindowActionDelegate {
+
+ private IWorkbenchWindow fWindow;
+
+ public OpenTypeInHierarchyAction() {
+ super();
+ setText(ActionMessages.OpenTypeInHierarchyAction_label);
+ setDescription(ActionMessages.OpenTypeInHierarchyAction_description);
+ setToolTipText(ActionMessages.OpenTypeInHierarchyAction_tooltip);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IRubyHelpContextIds.OPEN_TYPE_IN_HIERARCHY_ACTION);
+ }
+
+ public void run() {
+ Shell parent= RubyPlugin.getActiveWorkbenchShell();
+ OpenTypeSelectionDialog2 dialog= new OpenTypeSelectionDialog2(parent, false,
+ PlatformUI.getWorkbench().getProgressService(),
+ SearchEngine.createWorkspaceScope(), IRubySearchConstants.TYPE);
+
+ dialog.setTitle(ActionMessages.OpenTypeInHierarchyAction_dialogTitle);
+ dialog.setMessage(ActionMessages.OpenTypeInHierarchyAction_dialogMessage);
+ int result= dialog.open();
+ if (result != IDialogConstants.OK_ID)
+ return;
+
+ Object[] types= dialog.getResult();
+ if (types != null && types.length > 0) {
+ IType type= (IType)types[0];
+ OpenTypeHierarchyUtil.open(new IType[] { type }, fWindow);
+ }
+ }
+
+ //---- IWorkbenchWindowActionDelegate ------------------------------------------------
+
+ public void run(IAction action) {
+ run();
+ }
+
+ public void dispose() {
+ fWindow= null;
+ }
+
+ public void init(IWorkbenchWindow window) {
+ fWindow= window;
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ // do nothing. Action doesn't depend on selection.
+ }
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/OpenTypeInHierarchyAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/RubyElementReferenceConverter.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/RubyElementReferenceConverter.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/RubyElementReferenceConverter.java 2007-07-19 15:41:22 UTC (rev 2798)
@@ -0,0 +1,197 @@
+/*******************************************************************************
+ * 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.internal.ui.commands;
+
+import org.eclipse.core.commands.AbstractParameterValueConverter;
+import org.eclipse.core.commands.ParameterValueConversionException;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.rubypeople.rdt.core.IField;
+import org.rubypeople.rdt.core.IMethod;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyModel;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
+
+/**
+ * A command parameter value converter to convert between Ruby elements and
+ * String references that identify them.
+ * <p>
+ * References can be made to Ruby types, methods and fields. The reference
+ * identifies the project to use as a search scope as well as the java element
+ * information. Note that non-source elements may be referenced (such as
+ * java.lang.Object), but they must be resolved within the scope of some
+ * project.
+ * </p>
+ * <p>
+ * References take the form:
+ *
+ * <pre>
+ * elementRef := typeRef | fieldRef | methodRef
+ * typeRef := projectName '/' fullyQualifiedTypeName
+ * fieldRef := typeRef '#' fieldName
+ * methodRef := typeRef '#' methodName '(' parameterSignatures ')'
+ * </pre>
+ *
+ * where <code>parameterSignatures</code> uses the signature format documented
+ * in the {@link org.eclipse.jdt.core.Signature Signature} class.
+ * </p>
+ *
+ * @since 3.2
+ */
+public class RubyElementReferenceConverter extends AbstractParameterValueConverter {
+
+ private static final char PROJECT_END_CHAR= '/';
+
+ private static final char TYPE_END_CHAR= '#';
+
+
+ public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
+
+ assertWellFormed(parameterValue != null);
+
+ final int projectEndPosition= parameterValue.indexOf(PROJECT_END_CHAR);
+ assertWellFormed(projectEndPosition != -1);
+
+ String projectName= parameterValue.substring(0, projectEndPosition);
+ String javaElementRef= parameterValue.substring(projectEndPosition + 1);
+
+ IRubyModel javaModel= RubyCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ assertExists(javaModel);
+
+ IRubyProject javaProject= javaModel.getRubyProject(projectName);
+ assertExists(javaProject);
+
+ final int typeEndPosition= javaElementRef.indexOf(TYPE_END_CHAR);
+ String typeName;
+ if (typeEndPosition == -1) {
+ typeName= javaElementRef;
+ } else {
+ typeName= javaElementRef.substring(0, typeEndPosition);
+ }
+
+ IType type= null;
+ try {
+ type= javaProject.findType(typeName);
+ } catch (RubyModelException ex) {
+ // type == null
+ }
+ assertExists(type);
+
+ if (typeEndPosition == -1) {
+ return type;
+ }
+
+ String memberRef= javaElementRef.substring(typeEndPosition + 1);
+
+// final int paramStartPosition= memberRef.indexOf(PARAM_START_CHAR);
+// if (paramStartPosition == -1) {
+ IField field= type.getField(memberRef);
+ if (field != null && field.exists()){
+// assertExists(field);
+ return field;
+ }
+// }
+// String methodName= memberRef.substring(0, paramStartPosition);
+// String signature= memberRef.substring(paramStartPosition);
+ String[] parameterTypes= null;
+// try {
+// parameterTypes= Signature.getParameterTypes(signature);
+// } catch (IllegalArgumentException ex) {
+// // parameterTypes == null
+// }
+// assertWellFormed(parameterTypes != null);
+ IMethod method= type.getMethod(memberRef, parameterTypes);
+ assertExists(method);
+ return method;
+ }
+
+ /**
+ * Throws a <code>ParameterValueConversionException</code> if the java
+ * element reference string does not meet some well-formedness condition.
+ *
+ * @param assertion
+ * a boolean check for well-formedness
+ * @throws ParameterValueConversionException
+ */
+ private void assertWellFormed(boolean assertion) throws ParameterValueConversionException {
+ if (!assertion) {
+ throw new ParameterValueConversionException("Malformed parameterValue"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Throws a <code>ParameterValueConversionException</code> if the java
+ * element reference string identifies an element that does not exist.
+ *
+ * @param javaElement
+ * an element to check for existence
+ * @throws ParameterValueConversionException
+ */
+ private void assertExists(IRubyElement javaElement) throws ParameterValueConversionException {
+ if ((javaElement == null) || (!javaElement.exists())) {
+ throw new ParameterValueConversionException("parameterValue must reference an existing IRubyElement"); //$NON-NLS-1$
+ }
+ }
+
+ public String convertToString(Object parameterValue) throws ParameterValueConversionException {
+
+ if (!(parameterValue instanceof IRubyElement)) {
+ throw new ParameterValueConversionException("parameterValue must be an IRubyElement"); //$NON-NLS-1$
+ }
+
+ IRubyElement javaElement= (IRubyElement) parameterValue;
+
+ IRubyProject javaProject= javaElement.getRubyProject();
+ if (javaProject == null) {
+ throw new ParameterValueConversionException("Could not get IRubyProject for element"); //$NON-NLS-1$
+ }
+
+ StringBuffer buffer;
+
+ if (javaElement instanceof IType) {
+ IType type= (IType) javaElement;
+ buffer= composeTypeReference(type);
+ } else
+ if (javaElement instanceof IMethod) {
+ IMethod method= (IMethod) javaElement;
+ buffer= composeTypeReference(method.getDeclaringType());
+ buffer.append(TYPE_END_CHAR);
+ buffer.append(method.getElementName());
+// String[] parameterTypes= method.getParameterTypes();
+// buffer.append(PARAM_START_CHAR);
+// for (int i= 0; i < parameterTypes.length; i++) {
+// buffer.append(parameterTypes[i]);
+// }
+// buffer.append(PARAM_END_CHAR);
+ } else
+ if (javaElement instanceof IField) {
+ IField field= (IField) javaElement;
+ buffer= composeTypeReference(field.getDeclaringType());
+ buffer.append(TYPE_END_CHAR);
+ buffer.append(field.getElementName());
+ } else {
+ throw new ParameterValueConversionException("Unsupported IRubyElement type"); //$NON-NLS-1$
+ }
+
+ return buffer.toString();
+ }
+
+ private StringBuffer composeTypeReference(IType type) {
+ StringBuffer buffer= new StringBuffer();
+ buffer.append(type.getRubyProject().getElementName());
+ buffer.append(PROJECT_END_CHAR);
+ buffer.append(type.getFullyQualifiedName());
+ return buffer;
+ }
+
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/RubyElementReferenceConverter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/ShowElementInTypeHierarchyViewHandler.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/ShowElementInTypeHierarchyViewHandler.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/ShowElementInTypeHierarchyViewHandler.java 2007-07-19 15:41:22 UTC (rev 2798)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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.internal.ui.commands;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.util.OpenTypeHierarchyUtil;
+
+/**
+ * A command handler to show a ruby element in the type hierarchy view.
+ *
+ * @since 1.0
+ */
+public class ShowElementInTypeHierarchyViewHandler extends AbstractHandler {
+
+ private static final String PARAM_ID_ELEMENT_REF= "elementRef"; //$NON-NLS-1$
+
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ IWorkbenchWindow window= RubyPlugin.getActiveWorkbenchWindow();
+ if (window == null)
+ return null;
+
+ IRubyElement rubyElement= (IRubyElement) event.getObjectParameterForExecution(PARAM_ID_ELEMENT_REF);
+
+ OpenTypeHierarchyUtil.open(rubyElement, window);
+
+ return null;
+ }
+}
Property changes on: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/commands/ShowElementInTypeHierarchyViewHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditorActionContributor.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditorActionContributor.java 2007-07-19 15:40:45 UTC (rev 2797)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rubyeditor/RubyEditorActionContributor.java 2007-07-19 15:41:22 UTC (rev 2798)
@@ -32,6 +32,7 @@
protected RetargetTextEditorAction contentAssistProposal;
private RetargetTextEditorAction fGotoMatchingBracket;
private RetargetTextEditorAction fShowOutline;
+ private RetargetTextEditorAction fOpenHierarchy;
private RetargetTextEditorAction fQuickAssistAction;
private RetargetAction fRetargetShowRubyDoc;
@@ -48,6 +49,9 @@
fShowOutline= new RetargetTextEditorAction(RubyEditorMessages.getBundleForConstructedKeys(), "ShowOutline."); //$NON-NLS-1$
fShowOutline.setActionDefinitionId(IRubyEditorActionDefinitionIds.SHOW_OUTLINE);
+ fOpenHierarchy= new RetargetTextEditorAction(RubyEditorMessages.getBundleForConstructedKeys(), "OpenHierarchy."); //$NON-NLS-1$
+ fOpenHierarchy.setActionDefinitionId(IRubyEditorActionDefinitionIds.OPEN_HIERARCHY);
+
contentAssistProposal = new RetargetTextEditorAction(RubyUIMessages.getResourceBundle(),
"ContentAssistProposal.");
fGotoMatchingBracket = new RetargetTextEditorAction(b, "GotoMatchingBracket."); //$NON-NLS-1$
@@ -76,15 +80,14 @@
IMenuManager navigateMenu= menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
if (navigateMenu != null) {
navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fShowOutline);
+ navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fOpenHierarchy);
}
IMenuManager gotoMenu= menu.findMenuUsingPath("navigate/goTo"); //$NON-NLS-1$
if (gotoMenu != null) {
gotoMenu.add(new Separator("additions2")); //$NON-NLS-1$
gotoMenu.appendToGroup("additions2", fGotoMatchingBracket); //$NON-NLS-1$
- }
-
-
+ }
}
public void setActiveEditor(IEditorPart part) {
@@ -98,6 +101,7 @@
GotoMatchingBracketAction.GOTO_MATCHING_BRACKET));
fQuickAssistAction.setAction(getAction(textEditor, ITextEditorActionConstants.QUICK_ASSIST));
fShowOutline.setAction(getAction(textEditor, IRubyEditorActionDefinitionIds.SHOW_OUTLINE));
+ fOpenHierarchy.setAction(getAction(textEditor, IRubyEditorActionDefinitionIds.OPEN_HIERARCHY));
fShowRubyDoc.setAction(getAction(textEditor, "ShowRDoc")); //$NON-NLS-1$
if (part instanceof RubyEditor) {
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/TypeHierarchyViewPart.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/TypeHierarchyViewPart.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/typehierarchy/TypeHierarchyViewPart.java 2007-07-19 15:41:22 UTC (rev 2798)
@@ -0,0 +1,1633 @@
+/*******************************************************************************
+ * 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.internal.ui.typehierarchy;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IStatusLineManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.util.Assert;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.util.TransferDragSourceListener;
+import org.eclipse.jface.viewers.AbstractTreeViewer;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.search.internal.ui.text.ResourceTransferDragAdapter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ViewForm;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.DropTargetAdapter;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.ToolBar;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartReference;
+import org.eclipse.ui.IWorkingSet;
+import org.eclipse.ui.IWorkingSetManager;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionContext;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.ActionGroup;
+import org.eclipse.ui.part.IShowInSource;
+import org.eclipse.ui.part.IShowInTargetList;
+import org.eclipse.ui.part.PageBook;
+import org.eclipse.ui.part.ResourceTransfer;
+import org.eclipse.ui.part.ShowInContext;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.ui.views.navigator.LocalSelectionTransfer;
+import org.rubypeople.rdt.core.IMember;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyScript;
+import org.rubypeople.rdt.core.IType;
+import org.rubypeople.rdt.core.ITypeHierarchy;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.core.util.Messages;
+import org.rubypeople.rdt.internal.ui.IRubyHelpContextIds;
+import org.rubypeople.rdt.internal.ui.RubyPlugin;
+import org.rubypeople.rdt.internal.ui.actions.CompositeActionGroup;
+import org.rubypeople.rdt.internal.ui.actions.NewWizardsActionGroup;
+import org.rubypeople.rdt.internal.ui.actions.SelectAllAction;
+import org.rubypeople.rdt.internal.ui.dnd.RdtViewerDragAdapter;
+import org.rubypeople.rdt.internal.ui.packageview.SelectionTransferDragAdapter;
+import org.rubypeople.rdt.internal.ui.preferences.MembersOrderPreferenceCache;
+import org.rubypeople.rdt.internal.ui.rubyeditor.EditorUtility;
+import org.rubypeople.rdt.internal.ui.util.ExceptionHandler;
+import org.rubypeople.rdt.internal.ui.viewsupport.IViewPartInputProvider;
+import org.rubypeople.rdt.internal.ui.viewsupport.RubyUILabelProvider;
+import org.rubypeople.rdt.internal.ui.viewsupport.SelectionProviderMediator;
+import org.rubypeople.rdt.internal.ui.viewsupport.StatusBarUpdater;
+import org.rubypeople.rdt.internal.ui.workingsets.WorkingSetFilterActionGroup;
+import org.rubypeople.rdt.ui.IContextMenuConstants;
+import org.rubypeople.rdt.ui.ITypeHierarchyViewPart;
+import org.rubypeople.rdt.ui.PreferenceConstants;
+import org.rubypeople.rdt.ui.RubyElementLabels;
+import org.rubypeople.rdt.ui.RubyUI;
+import org.rubypeople.rdt.ui.actions.OpenEditorActionGroup;
+import org.rubypeople.rdt.ui.actions.RubySearchActionGroup;
+
+/**
+ * view showing the super types/sub types of its input.
+ */
+public class TypeHierarchyViewPart extends ViewPart implements ITypeHierarchyViewPart, IViewPartInputProvider {
+
+ public static final int VIEW_ID_TYPE= 2;
+ public static final int VIEW_ID_SUPER= 0;
+ public static final int VIEW_ID_SUB= 1;
+
+ public static final int VIEW_ORIENTATION_VERTICAL= 0;
+ public static final int VIEW_ORIENTATION_HORIZONTAL= 1;
+ public static final int VIEW_ORIENTATION_SINGLE= 2;
+ public static final int VIEW_ORIENTATION_AUTOMATIC= 3;
+
+ private static final String DIALOGSTORE_HIERARCHYVIEW= "TypeHierarchyViewPart.hierarchyview"; //$NON-NLS-1$
+ private static final String DIALOGSTORE_VIEWORIENTATION= "TypeHierarchyViewPart.orientation"; //$NON-NLS-1$
+
+ private static final String TAG_INPUT= "input"; //$NON-NLS-1$
+ private static final String TAG_VIEW= "view"; //$NON-NLS-1$
+ private static final String TAG_ORIENTATION= "orientation"; //$NON-NLS-1$
+ private static final String TAG_RATIO= "ratio"; //$NON-NLS-1$
+ private static final String TAG_SELECTION= "selection"; //$NON-NLS-1$
+ private static final String TAG_VERTICAL_SCROLL= "vertical_scroll"; //$NON-NLS-1$
+
+ private static final String GROUP_FOCUS= "group.focus"; //$NON-NLS-1$
+
+
+ // the selected type in the hierarchy view
+ private IType fSelectedType;
+ // input element or null
+ private IRubyElement fInputElement;
+
+ // history of input elements. No duplicates
+ private ArrayList fInputHistory;
+
+ private IMemento fMemento;
+ private IDialogSettings fDialogSettings;
+
+ private TypeHierarchyLifeCycle fHierarchyLifeCycle;
+ private ITypeHierarchyLifeCycleListener fTypeHierarchyLifeCycleListener;
+
+ private IPropertyChangeListener fPropertyChangeListener;
+
+ private SelectionProviderMediator fSelectionProviderMediator;
+ private ISelectionChangedListener fSelectionChangedListener;
+ private IPartListener2 fPartListener;
+
+ private int fCurrentOrientation;
+ int fOrientation= VIEW_ORIENTATION_AUTOMATIC;
+ boolean fInComputeOrientation= false;
+
+ private boolean fLinkingEnabled;
+ private boolean fSelectInEditor;
+
+ private boolean fIsVisible;
+ private boolean fNeedRefresh;
+ private boolean fIsEnableMemberFilter;
+ private boolean fIsRefreshRunnablePosted;
+
+ private int fCurrentViewerIndex;
+ private TypeHierarchyViewer[] fAllViewers;
+
+ private MethodsViewer fMethodsViewer;
+
+ private SashForm fTypeMethodsSplitter;
+ private PageBook fViewerbook;
+ private PageBook fPagebook;
+
+ private Label fNoHierarchyShownLabel;
+ private Label fEmptyTypesViewer;
+
+ private ViewForm fTypeViewerViewForm;
+ private ViewForm fMethodViewerViewForm;
+
+ private CLabel fMethodViewerPaneLabel;
+ private RubyUILabelProvider fPaneLabelProvider;
+ private Composite fParent;
+
+ private ToggleViewAction[] fViewActions;
+ private ToggleLinkingAction fToggleLinkingAction;
+ private HistoryDropDownAction fHistoryDropDownAction;
+ private ToggleOrientationAction[] fToggleOrientationActions;
+ private EnableMemberFilterAction fEnableMemberFilterAction;
+ private ShowQualifiedTypeNamesAction fShowQualifiedTypeNamesAction;
+ private FocusOnTypeAction fFocusOnTypeAction;
+ private FocusOnSelectionAction fFocusOnSelectionAction;
+ private CompositeActionGroup fActionGroups;
+ private SelectAllAction fSelectAllAction;
+
+ private WorkingSetFilterActionGroup fWorkingSetActionGroup;
+ private Job fRestoreStateJob;
+
+ public TypeHierarchyViewPart() {
+ fSelectedType= null;
+ fInputElement= null;
+ fIsVisible= false;
+ fIsRefreshRunnablePosted= false;
+ fSelectInEditor= true;
+ fRestoreStateJob= null;
+
+ fHierarchyLifeCycle= new TypeHierarchyLifeCycle();
+ fTypeHierarchyLifeCycleListener= new ITypeHierarchyLifeCycleListener() {
+ public void typeHierarchyChanged(TypeHierarchyLifeCycle typeHierarchy, IType[] changedTypes) {
+ doTypeHierarchyChanged(typeHierarchy, changedTypes);
+ }
+ };
+ fHierarchyLifeCycle.addChangedListener(fTypeHierarchyLifeCycleListener);
+
+ fPropertyChangeListener= new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ doPropertyChange(event);
+ }
+ };
+ PreferenceConstants.getPreferenceStore().addPropertyChangeListener(fPropertyChangeListener);
+
+ fIsEnableMemberFilter= false;
+
+ fInputHistory= new ArrayList();
+ fAllViewers= null;
+
+ fViewActions= new ToggleViewAction[] {
+ new ToggleViewAction(this, VIEW_ID_TYPE),
+ new ToggleViewAction(this, VIEW_ID_SUPER),
+ new ToggleViewAction(this, VIEW_ID_SUB)
+ };
+
+ fDialogSettings= RubyPlugin.getDefault().getDialogSettings();
+
+ fHistoryDropDownAction= new HistoryDropDownAction(this);
+ fHistoryDropDownAction.setEnabled(false);
+
+ fToggleOrientationActions= new ToggleOrientationAction[] {
+ new ToggleOrientationAction(this, VIEW_ORIENTATION_VERTICAL),
+ new ToggleOrientationAction(this, VIEW_ORIENTATION_HORIZONTAL),
+ new ToggleOrientationAction(this, VIEW_ORIENTATION_AUTOMATIC),
+ new ToggleOrientationAction(this, VIEW_ORIENTATION_SINGLE)
+ };
+
+ fEnableMemberFilterAction= new EnableMemberFilterAction(this, false);
+ fShowQualifiedTypeNamesAction= new ShowQualifiedTypeNamesAction(this, false);
+
+ fFocusOnTypeAction= new FocusOnTypeAction(this);
+
+ fPaneLabelProvider= new RubyUILabelProvider();
+
+ fFocusOnSelectionAction= new FocusOnSelectionAction(this);
+
+ fPartListener= new IPartListener2() {
+ public void partVisible(IWorkbenchPartReference ref) {
+ IWorkbenchPart part= ref.getPart(false);
+ if (part == TypeHierarchyViewPart.this) {
+ visibilityChanged(true);
+ }
+ }
+
+ public void partHidden(IWorkbenchPartReference ref) {
+ IWorkbenchPart part= ref.getPart(false);
+ if (part == TypeHierarchyViewPart.this) {
+ visibilityChanged(false);
+ }
+ }
+
+ public void partActivated(IWorkbenchPartReference ref) {
+ IWorkbenchPart part= ref.getPart(false);
+ if (part instanceof IEditorPart)
+ editorActivated((IEditorPart) part);
+ }
+
+ public void partInputChanged(IWorkbenchPartReference ref) {
+ IWorkbenchPart part= ref.getPart(false);
+ if (part instanceof IEditorPart)
+ editorActivated((IEditorPart) part);
+ }
+
+ public void partBroughtToTop(IWorkbenchPartReference ref) {}
+ public void partClosed(IWorkbenchPartReference ref) {}
+ public void partDeactivated(IWorkbenchPartReference ref) {}
+ public void partOpened(IWorkbenchPartReference ref) {}
+ };
+
+ fSelectionChangedListener= new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ doSelectionChanged(event);
+ }
+ };
+
+ fLinkingEnabled= PreferenceConstants.getPreferenceStore().getBoolean(PreferenceConstants.LINK_TYPEHIERARCHY_TO_EDITOR);
+ }
+
+ /**
+ * Method doPropertyChange.
+ * @param event
+ */
+ protected void doPropertyChange(PropertyChangeEvent event) {
+ String property= event.getProperty();
+ if (fMethodsViewer != null) {
+ if (MembersOrderPreferenceCache.isMemberOrderProperty(event.getProperty())) {
+ fMethodsViewer.refresh();
+ }
+ }
+ if (IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)) {
+ updateHierarchyViewer(true);
+ updateTitle();
+ }
+ }
+
+ /**
+ * Adds the entry if new. Inserted at the beginning of the history entries list.
+ * @param entry The new entry
+ */
+ private void addHistoryEntry(IRubyElement entry) {
+ if (fInputHistory.contains(entry)) {
+ fInputHistory.remove(entry);
+ }
+ fInputHistory.add(0, entry);
+ fHistoryDropDownAction.setEnabled(true);
+ }
+
+ private void updateHistoryEntries() {
+ for (int i= fInputHistory.size() - 1; i >= 0; i--) {
+ IRubyElement type= (IRubyElement) fInputHistory.get(i);
+ if (!type.exists()) {
+ fInputHistory.remove(i);
+ }
+ }
+ fHistoryDropDownAction.setEnabled(!fInputHistory.isEmpty());
+ }
+
+ /**
+ * Goes to the selected entry, without updating the order of history entries.
+ * @param entry The entry to open
+ */
+ public void gotoHistoryEntry(IRubyElement entry) {
+ if (fInputHistory.contains(entry)) {
+ updateInput(entry);
+ }
+ }
+
+ /**
+ * Gets all history entries.
+ * @return All history entries
+ */
+ public IRubyElement[] getHistoryEntries() {
+ if (fInputHistory.size() > 0) {
+ updateHistoryEntries();
+ }
+ return (IRubyElement[]) fInputHistory.toArray(new IRubyElement[fInputHistory.size()]);
+ }
+
+ /**
+ * Sets the history entries
+ * @param elems The history elements to set
+ */
+ public void setHistoryEntries(IRubyElement[] elems) {
+ fInputHistory.clear();
+ for (int i= 0; i < elems.length; i++) {
+ fInputHistory.add(elems[i]);
+ }
+ updateHistoryEntries();
+ }
+
+ /**
+ * Selects an member in the methods list or in the current hierarchy.
+ * @param member The member to select
+ */
+ public void selectMember(IMember member) {
+ fSelectInEditor= false;
+ if (member.getElementType() != IRubyElement.TYPE) {
+ Control methodControl= fMethodsViewer.getControl();
+ if (methodControl != null && !methodControl.isDisposed()) {
+ methodControl.setFocus();
+ }
+
+ fMethodsViewer.setSelection(new StructuredSelection(member), true);
+ } else {
+ Control viewerControl= getCurrentViewer().getControl();
+ if (viewerControl != null && !viewerControl.isDisposed()) {
+ viewerControl.setFocus();
+ }
+
+ if (!member.equals(fSelectedType)) {
+ getCurrentViewer().setSelection(new StructuredSelection(member), true);
+ }
+ }
+ fSelectInEditor= true;
+ }
+
+ /**
+ * @return The input type
+ * @deprecated
+ */
+ public IType getInput() {
+ if (fInputElement instanceof IType) {
+ return (IType) fInputElement;
+ }
+ return null;
+ }
+
+ /**
+ * Sets the input to a new type
+ * @param type The new input type
+ * @deprecated
+ */
+ public void setInput(IType type) {
+ setInputElement(type);
+ }
+
+ /**
+ * Returns the input element of the type hierarchy.
+ * Can be of type <code>IType</code> or <code>IPackageFragment</code>
+ * @return the input element
+ */
+ public IRubyElement getInputElement() {
+ return fInputElement;
+ }
+
+
+ /**
+ * Sets the input to a new element.
+ * @param element the input element
+ */
+ public void setInputElement(IRubyElement element) {
+ IMember memberToSelect= null;
+ if (element != null) {
+ if (element instanceof IMember) {
+ if (element.getElementType() != IRubyElement.TYPE) {
+ memberToSelect= (IMember) element;
+ element= memberToSelect.getDeclaringType();
+
+ }
+ if (!element.exists()) {
+ MessageDialog.openError(getSite().getShell(), TypeHierarchyMessages.TypeHierarchyViewPart_error_title, TypeHierarchyMessages.TypeHierarchyViewPart_error_message);
+ return;
+ }
+ } else {
+ int kind= element.getElementType();
+ if (kind != IRubyElement.RUBY_PROJECT && kind != IRubyElement.SOURCE_FOLDER_ROOT && kind != IRubyElement.SOURCE_FOLDER) {
+ element= null;
+ RubyPlugin.logErrorMessage("Invalid type hierarchy input type.");//$NON-NLS-1$
+ }
+ }
+ }
+ if (element != null && !element.equals(fInputElement)) {
+ addHistoryEntry(element);
+ }
+
+ updateInput(element);
+ if (memberToSelect != null) {
+ selectMember(memberToSelect);
+ }
+ }
+
+ /*
+ * Changes the input to a new type
+ * @param inputElement
+ */
+ private void updateInput(IRubyElement inputElement) {
+ IRubyElement prevInput= fInputElement;
+
+ synchronized (this) {
+ if (fRestoreStateJob != null) {
+ fRestoreStateJob.cancel();
+ try {
+ fRestoreStateJob.join();
+ } catch (InterruptedException e) {
+ // ignore
+ } finally {
+ fRestoreStateJob= null;
+ }
+ }
+ }
+
+ // Make sure the UI got repainted before we execute a long running
+ // operation. This can be removed if we refresh the hierarchy in a
+ // separate thread.
+ // Work-araound for http://dev.eclipse.org/bugs/show_bug.cgi?id=30881
+ processOutstandingEvents();
+ if (inputElement == null) {
+ clearInput();
+ } else {
+ fInputElement= inputElement;
+ try {
+ fHierarchyLifeCycle.ensureRefreshedTypeHierarchy(inputElement, RubyPlugin.getActiveWorkbenchWindow());
+ // fHierarchyLifeCycle.ensureRefreshedTypeHierarchy(inputElement, getSite().getWorkbenchWindow());
+ } catch (InvocationTargetException e) {
+ ExceptionHandler.handle(e, getSite().getShell(), TypeHierarchyMessages.TypeHierarchyViewPart_exception_title, TypeHierarchyMessages.TypeHierarchyViewPart_exception_message);
+ clearInput();
+ return;
+ } catch (InterruptedException e) {
+ return;
+ }
+
+ if (inputElement.getElementType() != IRubyElement.TYPE) {
+ setView(VIEW_ID_TYPE);
+ }
+ // turn off member filtering
+ fSelectInEditor= false;
+ setMemberFilter(null);
+ internalSelectType(null, false); // clear selection
+ fIsEnableMemberFilter= false;
+ if (!inputElement.equals(prevInput)) {
+ updateHierarchyViewer(true);
+ }
+ IType root= getSelectableType(inputElement);
+ internalSelectType(root, true);
+ updateMethodViewer(root);
+ updateToolbarButtons();
+ updateTitle();
+ enableMemberFilter(false);
+ fPagebook.showPage(fTypeMethodsSplitter);
+ fSelectInEditor= true;
+ }
+ }
+
+ private void processOutstandingEvents() {
+ Display display= getDisplay();
+ if (display != null && !display.isDisposed())
+ display.update();
+ }
+
+ private void clearInput() {
+ fInputElement= null;
+ fHierarchyLifeCycle.freeHierarchy();
+
+ updateHierarchyViewer(false);
+ updateToolbarButtons();
+ }
+
+ /*
+ * @see IWorbenchPart#setFocus
+ */
+ public void setFocus() {
+ fPagebook.setFocus();
+ }
+
+ /*
+ * @see IWorkbenchPart#dispose
+ */
+ public void dispose() {
+ fHierarchyLifeCycle.freeHierarchy();
+ fHierarchyLifeCycle.removeChangedListener(fTypeHierarchyLifeCycleListener);
+ fPaneLabelProvider.dispose();
+
+ if (fMethodsViewer != null) {
+ fMethodsViewer.dispose();
+ }
+
+ if (fPropertyChangeListener != null) {
+ RubyPlugin.getDefault().getPreferenceStore().removePropertyChangeListener(fPropertyChangeListener);
+ fPropertyChangeListener= null;
+ }
+
+ getSite().getPage().removePartListener(fPartListener);
+
+ if (fActionGroups != null)
+ fActionGroups.dispose();
+
+ if (fWorkingSetActionGroup != null) {
+ fWorkingSetActionGroup.dispose();
+ }
+
+ super.dispose();
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class key) {
+ if (key == IShowInSource.class) {
+ return getShowInSource();
+ }
+ if (key == IShowInTargetList.class) {
+ return new IShowInTargetList() {
+ public String[] getShowInTargetIds() {
+ return new String[] { RubyUI.ID_RUBY_RESOURCE_VIEW, IPageLayout.ID_RES_NAV };
+ }
+
+ };
+ }
+// if (key == IContextProvider.class) {
+// return RubyUIHelp.getHelpContextProvider(this, IRubyHelpContextIds.TYPE_HIERARCHY_VIEW);
+// }
+ return super.getAdapter(key);
+ }
+
+ private Control createTypeViewerControl(Composite parent) {
+ fViewerbook= new PageBook(parent, SWT.NULL);
+
+ KeyListener keyListener= createKeyListener();
+
+ // Create the viewers
+ TypeHierarchyViewer superTypesViewer= new SuperTypeHierarchyViewer(fViewerbook, fHierarchyLifeCycle, this);
+ initializeTypesViewer(superTypesViewer, keyListener, IContextMenuConstants.TARGET_ID_SUPERTYPES_VIEW);
+
+ TypeHierarchyViewer subTypesViewer= new SubTypeHierarchyViewer(fViewerbook, fHierarchyLifeCycle, this);
+ initializeTypesViewer(subTypesViewer, keyListener, IContextMenuConstants.TARGET_ID_SUBTYPES_VIEW);
+
+ TypeHierarchyViewer vajViewer= new TraditionalHierarchyViewer(fViewerbook, fHierarchyLifeCycle, this);
+ initializeTypesViewer(vajViewer, keyListener, IContextMenuConstants.TARGET_ID_HIERARCHY_VIEW);
+
+ fAllViewers= new TypeHierarchyViewer[3];
+ fAllViewers[VIEW_ID_SUPER]= superTypesViewer;
+ fAllViewers[VIEW_ID_SUB]= subTypesViewer;
+ fAllViewers[VIEW_ID_TYPE]= vajViewer;
+
+ int currViewerIndex;
+ try {
+ currViewerIndex= fDialogSettings.getInt(DIALOGSTORE_HIERARCHYVIEW);
+ if (currViewerIndex < 0 || currViewerIndex > 2) {
+ currViewerIndex= VIEW_ID_TYPE;
+ }
+ } catch (NumberFormatException e) {
+ currViewerIndex= VIEW_ID_TYPE;
+ }
+
+ fEmptyTypesViewer= new Label(fViewerbook, SWT.TOP | SWT.LEFT | SWT.WRAP);
+
+ for (int i= 0; i < fAllViewers.length; i++) {
+ fAllViewers[i].setInput(fAllViewers[i]);
+ }
+
+ // force the update
+ fCurrentViewerIndex= -1;
+ setView(currViewerIndex);
+
+ return fViewerbook;
+ }
+
+ private KeyListener createKeyListener() {
+ return new KeyAdapter() {
+ public void keyReleased(KeyEvent event) {
+ if (event.stateMask == 0) {
+ if (event.keyCode == SWT.F5) {
+ ITypeHierarchy hierarchy= fHierarchyLifeCycle.getHierarchy();
+ if (hierarchy != null) {
+ fHierarchyLifeCycle.typeHierarchyChanged(hierarchy);
+ doTypeHierarchyChangedOnViewers(null);
+ }
+ updateHierarchyViewer(false);
+ return;
+ }
+ }
+ }
+ };
+ }
+
+
+ private void initializeTypesViewer(final TypeHierarchyViewer typesViewer, KeyListener keyListener, String cotextHelpId) {
+ typesViewer.getControl().setVisible(false);
+ typesViewer.getControl().addKeyListener(keyListener);
+ typesViewer.initContextMenu(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menu) {
+ fillTypesViewerContextMenu(typesViewer, menu);
+ }
+ }, cotextHelpId, getSite());
+ typesViewer.addPostSelectionChangedListener(fSelectionChangedListener);
+ typesViewer.setQualifiedTypeName(isShowQualifiedTypeNames());
+ typesViewer.setWorkingSetFilter(fWorkingSetActionGroup.getWorkingSetFilter());
+ }
+
+ private Control createMethodViewerControl(Composite parent) {
+ fMethodsViewer= new MethodsViewer(parent, fHierarchyLifeCycle, this);
+ fMethodsViewer.initContextMenu(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager menu) {
+ fillMethodsViewerContextMenu(menu);
+ }
+ }, IContextMenuConstants.TARGET_ID_MEMBERS_VIEW, getSite());
+ fMethodsViewer.addPostSelectionChangedListener(fSelectionChangedListener);
+
+ Control control= fMethodsViewer.getTable();
+ control.addKeyListener(createKeyListener());
+ control.addFocusListener(new FocusListener() {
+ public void focusGained(FocusEvent e) {
+ fSelectAllAction.setEnabled(true);
+ }
+
+ public void focusLost(FocusEvent e) {
+ fSelectAllAction.setEnabled(false);
+ }
+ });
+
+ return control;
+ }
+
+ private void initDragAndDrop() {
+ for (int i= 0; i < fAllViewers.length; i++) {
+ addDragAdapters(fAllViewers[i]);
+ addDropAdapters(fAllViewers[i]);
+ }
+ addDragAdapters(fMethodsViewer);
+ fMethodsViewer.addDropSupport(DND.DROP_NONE, new Transfer[0], new DropTargetAdapter());
+
+ //DND on empty hierarchy
+ DropTarget dropTarget = new DropTarget(fPagebook, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT);
+ dropTarget.setTransfer(new Transfer[] { LocalSelectionTransfer.getInstance() });
+// dropTarget.addDropListener(new TypeHierarchyTransferDropAdapter(this, fAllViewers[0]));
+ }
+
+ private void addDropAdapters(AbstractTreeViewer viewer) {
+// Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance() };
+// int ops= DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK | DND.DROP_DEFAULT;
+//
+// TransferDropTargetListener[] dropListeners= new TransferDropTargetListener[] {
+// new TypeHierarchyTransferDropAdapter(this, viewer)
+// };
+// viewer.addDropSupport(ops, transfers, new DelegatingDropAdapter(dropListeners));
+ }
+
+ private void addDragAdapters(StructuredViewer viewer) {
+ int ops= DND.DROP_COPY | DND.DROP_LINK;
+ Transfer[] transfers= new Transfer[] { LocalSelectionTransfer.getInstance(), ResourceTransfer.getInstance()};
+
+ TransferDragSourceListener[] dragListeners= new TransferDragSourceListener[] {
+ new SelectionTransferDragAdapter(viewer),
+ new ResourceTransferDragAdapter(viewer)
+ };
+ viewer.addDragSupport(ops, transfers, new RdtViewerDragAdapter(viewer, dragListeners));
+ }
+
+ /**
+ * Returns the inner component in a workbench part.
+ * @see IWorkbenchPart#createPartControl(Composite)
+ */
+ public void createPartControl(Composite container) {
+ fParent= container;
+ addResizeListener(container);
+
+ fPagebook= new PageBook(container, SWT.NONE);
+ fWorkingSetActionGroup= new WorkingSetFilterActionGroup(getSite(), fPropertyChangeListener);
+
+ // page 1 of page book (no hierarchy label)
+
+ fNoHierarchyShownLabel= new Label(fPagebook, SWT.TOP + SWT.LEFT + SWT.WRAP);
+ fNoHierarchyShownLabel.setText(TypeHierarchyMessages.TypeHierarchyViewPart_empty);
+
+ // page 2 of page book (viewers)
+
+ fTypeMethodsSplitter= new SashForm(fPagebook, SWT.VERTICAL);
+ fTypeMethodsSplitter.setVisible(false);
+
+ fTypeViewerViewForm= new ViewForm(fTypeMethodsSplitter, SWT.NONE);
+
+ Control typeViewerControl= createTypeViewerControl(fTypeViewerViewForm);
+ fTypeViewerViewForm.setContent(typeViewerControl);
+
+ fMethodViewerViewForm= new ViewForm(fTypeMethodsSplitter, SWT.NONE);
+ fTypeMethodsSplitter.setWeights(new int[] {35, 65});
+
+ Control methodViewerPart= createMethodViewerControl(fMethodViewerViewForm);
+ fMethodViewerViewForm.setContent(methodViewerPart);
+
+ fMethodViewerPaneLabel= new CLabel(fMethodViewerViewForm, SWT.NONE);
+ fMethodViewerViewForm.setTopLeft(fMethodViewerPaneLabel);
+
+ ToolBar methodViewerToolBar= new ToolBar(fMethodViewerViewForm, SWT.FLAT | SWT.WRAP);
+ fMethodViewerViewForm.setTopCenter(methodViewerToolBar);
+
+ initDragAndDrop();
+
+ MenuManager menu= new MenuManager();
+ menu.add(fFocusOnTypeAction);
+ fNoHierarchyShownLabel.setMenu(menu.createContextMenu(fNoHierarchyShownLabel));
+
+ fPagebook.showPage(fNoHierarchyShownLabel);
+
+ try {
+ fOrientation= fDialogSettings.getInt(DIALOGSTORE_VIEWORIENTATION);
+ if (fOrientation < 0 || fOrientation > 3) {
+ fOrientation= VIEW_ORIENTATION_VERTICAL;
+ }
+ } catch (NumberFormatException e) {
+ fOrientation= VIEW_ORIENTATION_AUTOMATIC;
+ }
+ // force the update
+ fCurrentOrientation= -1;
+ // will fill the main tool bar
+ setOrientation(fOrientation);
+
+ if (fMemento != null) { // restore state before creating action
+ restoreLinkingEnabled(fMemento);
+ }
+ fToggleLinkingAction= new ToggleLinkingAction(this);
+
+ // set the filter menu items
+ IActionBars actionBars= getViewSite().getActionBars();
+ IMenuManager viewMenu= actionBars.getMenuManager();
+ for (int i= 0; i < fViewActions.length; i++) {
+ ToggleViewAction action= f...
[truncated message content] |