Author: mkrueger
Date: 2008-02-14 16:20:31 -0500 (Thu, 14 Feb 2008)
New Revision: 95703
Added:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MarkerOperationsHandler.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorCommands.cs
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.mdp
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtendibleTextEditor.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
Log:
* MonoDevelop.SourceEditor.addin.xml,
MonoDevelop.SourceEditor/ExtendibleTextEditor.cs,
MonoDevelop.SourceEditor/SourceEditorView.cs,
MonoDevelop.SourceEditor/SourceEditorOptions.cs,
MonoDevelop.SourceEditor/MarkerOperationsHandler.cs,
MonoDevelop.SourceEditor/SourceEditorCommands.cs: Urls inside the
text editor can now be opened using the context menu.
Modified: trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
2008-02-14 21:20:05 UTC (rev 95702)
+++ trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/ChangeLog
2008-02-14 21:20:31 UTC (rev 95703)
@@ -1,5 +1,15 @@
2008-02-14 Mike Krüger <[EMAIL PROTECTED]>
+ * MonoDevelop.SourceEditor.addin.xml,
+ MonoDevelop.SourceEditor/ExtendibleTextEditor.cs,
+ MonoDevelop.SourceEditor/SourceEditorView.cs,
+ MonoDevelop.SourceEditor/SourceEditorOptions.cs,
+ MonoDevelop.SourceEditor/MarkerOperationsHandler.cs,
+ MonoDevelop.SourceEditor/SourceEditorCommands.cs: Urls inside the text
+ editor can now be opened using the context menu.
+
+2008-02-14 Mike Krüger <[EMAIL PROTECTED]>
+
* MonoDevelop.SourceEditor/ExtendibleTextEditor.cs: Fixed warning.
2008-02-14 Mike Krüger <[EMAIL PROTECTED]>
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am
===================================================================
--- trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am
2008-02-14 21:20:05 UTC (rev 95702)
+++ trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/Makefile.am
2008-02-14 21:20:31 UTC (rev 95703)
@@ -35,6 +35,8 @@
MonoDevelop.SourceEditor/ExtendibleTextEditor.cs \
MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs \
MonoDevelop.SourceEditor/LanguageItemWindow.cs \
+ MonoDevelop.SourceEditor/MarkerOperationsHandler.cs \
+ MonoDevelop.SourceEditor/SourceEditorCommands.cs \
MonoDevelop.SourceEditor/SourceEditorDisplayBinding.cs \
MonoDevelop.SourceEditor/SourceEditorOptions.cs \
MonoDevelop.SourceEditor/SourceEditorView.cs \
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtendibleTextEditor.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtendibleTextEditor.cs
2008-02-14 21:20:05 UTC (rev 95702)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtendibleTextEditor.cs
2008-02-14 21:20:31 UTC (rev 95703)
@@ -52,7 +52,14 @@
bool showTipScheduled;
int langTipX, langTipY;
uint tipTimeoutId;
+ DocumentLocation menuPopupLocation;
+ public DocumentLocation MenuPopupLocation {
+ get {
+ return menuPopupLocation;
+ }
+ }
+
public ITextEditorExtension Extension {
get {
return extension;
@@ -89,10 +96,15 @@
keyBindings [GetKeyCode (Gdk.Key.Tab)] = new TabAction
(this);
keyBindings [GetKeyCode (Gdk.Key.BackSpace)] = new
AdvancedBackspaceAction ();
this.PopupMenu += delegate {
+ menuPopupLocation =
TextEditorData.Caret.Location;
this.ShowPopup ();
};
this.ButtonPressEvent += delegate(object sender,
Gtk.ButtonPressEventArgs args) {
if (args.Event.Button == 3) {
+ int textEditorXOffset =
(int)args.Event.X - this.TextViewMargin.XOffset;
+ if (textEditorXOffset < 0)
+ return;
+ menuPopupLocation =
this.TextViewMargin.VisualToDocumentLocation (textEditorXOffset,
(int)args.Event.Y);
this.ShowPopup ();
}
};
@@ -116,6 +128,11 @@
{
bool result = true;
char ch = (char)evnt.Key;
+ if (evnt.Key == Gdk.Key.Menu) {
+ this.menuPopupLocation = Caret.Location;
+ this.ShowPopup ();
+ return true;
+ }
bool inStringOrComment = false;
if
(SourceEditorOptions.Options.AutoInsertMatchingBracket && (ch == '{' || ch ==
'[' || ch == '(' || ch == '"' || ch == '\'' )) {
Added:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MarkerOperationsHandler.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MarkerOperationsHandler.cs
2008-02-14 21:20:05 UTC (rev 95702)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/MarkerOperationsHandler.cs
2008-02-14 21:20:31 UTC (rev 95703)
@@ -0,0 +1,81 @@
+//
+// MarkerOperationsHandler.cs
+//
+// Author:
+// Mike Krüger <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using MonoDevelop.Components.Commands;
+using MonoDevelop.Core;
+using MonoDevelop.Ide.Gui;
+
+using Mono.TextEditor;
+
+namespace MonoDevelop.SourceEditor
+{
+ public class MarkerOperationsHandler : CommandHandler
+ {
+ protected override void Run (object data)
+ {
+ UrlMarker urlMarker = data as UrlMarker;
+ if (data == null)
+ return;
+ try {
+ if (urlMarker.UrlType == UrlType.Email) {
+ System.Diagnostics.Process.Start
("mailto:" + urlMarker.Url);
+ } else {
+ System.Diagnostics.Process.Start
(urlMarker.Url);
+ }
+ } catch (Exception) {
+ IdeApp.Services.MessageService.ShowError
(GettextCatalog.GetString ("Could not open the url {0}", urlMarker.Url));
+ }
+ }
+
+ protected override void Update (CommandArrayInfo ainfo)
+ {
+ MonoDevelop.Ide.Gui.Document doc =
IdeApp.Workbench.ActiveDocument;
+ if (doc != null) {
+ SourceEditorView view =
IdeApp.Workbench.ActiveDocument.GetContent <SourceEditorView>();
+ if (view != null) {
+ DocumentLocation location =
view.TextEditor.MenuPopupLocation;
+ if (location == null)
+ return;
+ LineSegment line =
view.TextEditorData.Document.GetLine (location.Line);
+ if (line == null || line.Markers ==
null)
+ return;
+ foreach (TextMarker marker in
line.Markers) {
+ UrlMarker urlMarker = marker as
UrlMarker;
+ if (urlMarker != null) {
+ if
(urlMarker.StartColumn <= location.Column && location.Column <
urlMarker.EndColumn) {
+ ainfo.Add
(urlMarker.UrlType == UrlType.Email ? GettextCatalog.GetString ("_Write an
e-mail to...") : GettextCatalog.GetString ("_Open URL..."), urlMarker);
+
ainfo.AddSeparator ();
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
Added:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorCommands.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorCommands.cs
2008-02-14 21:20:05 UTC (rev 95702)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorCommands.cs
2008-02-14 21:20:31 UTC (rev 95703)
@@ -0,0 +1,37 @@
+//
+// MarkerOperations.cs
+//
+// Author:
+// Mike Krüger <[EMAIL PROTECTED]>
+//
+// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace MonoDevelop.SourceEditor
+{
+ public enum SourceEditorCommands
+ {
+ MarkerOperations
+ }
+}
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
2008-02-14 21:20:05 UTC (rev 95702)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorOptions.cs
2008-02-14 21:20:31 UTC (rev 95703)
@@ -52,6 +52,7 @@
UserSpecified
}
+
public class SourceEditorOptions : TextEditorOptions
{
public new static SourceEditorOptions Options {
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
2008-02-14 21:20:05 UTC (rev 95702)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs
2008-02-14 21:20:31 UTC (rev 95703)
@@ -60,6 +60,11 @@
return widget.TextEditor.TextEditorData;
}
}
+ public ExtendibleTextEditor TextEditor {
+ get {
+ return widget.TextEditor;
+ }
+ }
public override Gtk.Widget Control {
get {
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml
2008-02-14 21:20:05 UTC (rev 95702)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.addin.xml
2008-02-14 21:20:31 UTC (rev 95703)
@@ -14,9 +14,17 @@
<Dependencies>
<Addin id="Core" version="0.19.0"/>
+ <Addin id="Components" version="0.19.0"/>
<Addin id="Ide" version="0.19.0"/>
</Dependencies>
-
+
+ <Extension path = "/MonoDevelop/Ide/Commands">
+ <Command id =
"MonoDevelop.SourceEditor.SourceEditorCommands.MarkerOperations"
+ defaultHandler =
"MonoDevelop.SourceEditor.MarkerOperationsHandler"
+ _label = ""
+ type = "array"/>
+ </Extension>
+
<!-- Extension points -->
<ExtensionPoint path = "/MonoDevelop/SourceEditor2/ContextMenu/Editor"
name = "Editor context menu">
<Description>Context menu for the editor.</Description>
@@ -43,6 +51,7 @@
</Extension>
<Extension path = "/MonoDevelop/SourceEditor2/ContextMenu/Editor">
+ <CommandItem id =
"MonoDevelop.SourceEditor.SourceEditorCommands.MarkerOperations" />
<CommandItem id =
"MonoDevelop.Ide.Commands.RefactoryCommands.CurrentRefactoryOperations" />
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Undo"
/>
<CommandItem id = "MonoDevelop.Ide.Commands.EditCommands.Redo"
/>
Modified:
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.mdp
===================================================================
---
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.mdp
2008-02-14 21:20:05 UTC (rev 95702)
+++
trunk/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor.mdp
2008-02-14 21:20:31 UTC (rev 95703)
@@ -40,6 +40,8 @@
<File name="MonoDevelop.SourceEditor.OptionPanels/MarkerPanel.cs"
subtype="Code" buildaction="Compile" />
<File name="MonoDevelop.SourceEditor.addin.xml" subtype="Code"
buildaction="EmbedAsResource" />
<File name="MonoDevelop.SourceEditor/HighlightPropertiesSemanticRule.cs"
subtype="Code" buildaction="Compile" />
+ <File name="MonoDevelop.SourceEditor/SourceEditorCommands.cs"
subtype="Code" buildaction="Compile" />
+ <File name="MonoDevelop.SourceEditor/MarkerOperationsHandler.cs"
subtype="Code" buildaction="Compile" />
</Contents>
<References>
<ProjectReference type="Project" localcopy="False" refto="Mono.TextEditor"
/>
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches