|
From: <mir...@us...> - 2007-02-27 12:21:20
|
Revision: 2047
http://svn.sourceforge.net/rubyeclipse/?rev=2047&view=rev
Author: mirkostocker
Date: 2007-02-27 04:21:13 -0800 (Tue, 27 Feb 2007)
Log Message:
-----------
Add an open type dialog (ctrl+shift+t) like JDT has (ticket #6) and fix an off-by-one editor in the PositionBasedEditorOpener (the endposition included the newline).
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/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/util/PositionBasedEditorOpener.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.ui/icons/full/etool16/opentype.gif
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenTypeAction.java
Added: trunk/org.rubypeople.rdt.ui/icons/full/etool16/opentype.gif
===================================================================
(Binary files differ)
Property changes on: trunk/org.rubypeople.rdt.ui/icons/full/etool16/opentype.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/org.rubypeople.rdt.ui/plugin.properties
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.properties 2007-02-27 11:27:55 UTC (rev 2046)
+++ trunk/org.rubypeople.rdt.ui/plugin.properties 2007-02-27 12:21:13 UTC (rev 2047)
@@ -168,4 +168,6 @@
# Navigate Menu
##########################################################################
OpenAction.label=&Open
-OpenAction.tooltip=Open an Editor on the Selected Element
\ No newline at end of file
+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
Modified: trunk/org.rubypeople.rdt.ui/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.ui/plugin.xml 2007-02-27 11:27:55 UTC (rev 2046)
+++ trunk/org.rubypeople.rdt.ui/plugin.xml 2007-02-27 12:21:13 UTC (rev 2047)
@@ -454,6 +454,11 @@
contextId="org.rubypeople.rdt.ui.rubyEditorScope"
commandId="org.rubypeople.rdt.ui.edit.text.ruby.open.editor"
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"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/>
</extension>
<extension point="org.eclipse.ui.commands">
<category
@@ -527,12 +532,17 @@
name="%ActionDefinition.gotoMatchingBracket.name">
</command>
<command
- name="%ActionDefinition.openEditor.name"
+ categoryId="org.eclipse.ui.category.navigate"
description="%ActionDefinition.openEditor.description"
+ id="org.rubypeople.rdt.ui.edit.text.ruby.open.editor"
+ name="%ActionDefinition.openEditor.name">
+ </command>
+ <command
categoryId="org.eclipse.ui.category.navigate"
- id="org.rubypeople.rdt.ui.edit.text.ruby.open.editor">
+ id="org.rubypeople.rdt.ui.edit.text.ruby.open.type"
+ name="%OpenTypeAction.label">
</command>
- <command
+ <command
name="%ActionDefinition.toggleComment.name"
description="%ActionDefinition.toggleComment.description"
categoryId="org.rubypeople.rdt.ui.category.source"
@@ -654,6 +664,15 @@
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"
+ menubarPath="navigate/open.ext"
+ tooltip="%OpenTypeAction.tooltip">
+ </action>
</actionSet>
</extension>
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-02-27 11:27:55 UTC (rev 2046)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.java 2007-02-27 12:21:13 UTC (rev 2047)
@@ -48,6 +48,9 @@
public static String ActionUtil_notOnBuildPath_title;
public static String ActionUtil_notOnBuildPath_message;
public static String OpenWithMenu_label;
+ public static String OpenTypeAction_error_title;
+ public static String OpenTypeAction_error_messageProblems;
+ public static String OpenTypeAction_message;
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-02-27 11:27:55 UTC (rev 2046)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/actions/ActionMessages.properties 2007-02-27 12:21:13 UTC (rev 2047)
@@ -24,6 +24,10 @@
OpenAction_error_messageBadSelection=Current text selection does not resolve to a Ruby element
OpenAction_error_messageProblems=Problems Opening Editor
+OpenTypeAction_error_title=Open Type
+OpenTypeAction_error_messageProblems=Problems Opening Type
+OpenTypeAction_message=Select a type to open (? = any character, * = any string):
+
MemberFilterActionGroup_hide_fields_label=Hide Fiel&ds
MemberFilterActionGroup_hide_fields_tooltip=Hide Fields
MemberFilterActionGroup_hide_fields_description=Toggles the visibility of fields
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/PositionBasedEditorOpener.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/PositionBasedEditorOpener.java 2007-02-27 11:27:55 UTC (rev 2046)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/util/PositionBasedEditorOpener.java 2007-02-27 12:21:13 UTC (rev 2047)
@@ -28,7 +28,7 @@
IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
int start = position.getStartOffset();
int end = position.getEndOffset();
- editor.selectAndReveal(start, end-start+1);
+ editor.selectAndReveal(start, end-start);
}
}
Added: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenTypeAction.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenTypeAction.java (rev 0)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/actions/OpenTypeAction.java 2007-02-27 12:21:13 UTC (rev 2047)
@@ -0,0 +1,57 @@
+package org.rubypeople.rdt.ui.actions;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PartInitException;
+import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.internal.ui.actions.ActionMessages;
+import org.rubypeople.rdt.internal.ui.rubyeditor.EditorUtility;
+import org.rubypeople.rdt.ui.wizards.RubyTypeSelectionDialog;
+
+public class OpenTypeAction implements IWorkbenchWindowActionDelegate {
+
+ private IWorkbenchWindow window;
+
+ public void dispose() {
+ this.window = null;
+ }
+
+ public void init(IWorkbenchWindow window) {
+ this.window = window;
+ }
+
+ public void run(IAction action) {
+
+ RubyTypeSelectionDialog dialog = new RubyTypeSelectionDialog(window.getShell());
+ dialog.setMessage(ActionMessages.OpenTypeAction_message);
+
+ if (dialog.open() == Window.OK) {
+ IRubyElement selected = (IRubyElement) dialog.getFirstResult();
+ try {
+ IEditorPart editor = EditorUtility.openInEditor(selected, true);
+ EditorUtility.revealInEditor(editor, selected);
+ } catch (PartInitException e) {
+ showError(e);
+ } catch (RubyModelException e) {
+ showError(e);
+ }
+ }
+ }
+
+ private void showError(CoreException e) {
+ ErrorDialog.openError(window.getShell(),
+ ActionMessages.OpenTypeAction_error_title,
+ ActionMessages.OpenTypeAction_error_messageProblems,
+ e.getStatus());
+ }
+
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|