Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorAlan McGovern <alan@xamarin.com>2015-02-10 05:04:41 +0300
committerAlan McGovern <alan@xamarin.com>2015-02-10 05:04:41 +0300
commitbdf70cd8492aa9256014ceef12e93663e8ec1686 (patch)
tree08b4632eeedf7f119a657274304d8f1dc48e0df5 /main
parent003ffadf56093fc2dc6ad0d043b4e68699441611 (diff)
parente9399826164c87f458de423cfcbe60051c3f891a (diff)
Merge branch 'watchkit'
Diffstat (limited to 'main')
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkGestures.cs2
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/IExecutionHandler.cs11
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ExecutionContext.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/CustomExecutionMode.cs46
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs25
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/TargetedExecutionHandler.cs52
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj1
7 files changed, 127 insertions, 18 deletions
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkGestures.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkGestures.cs
index f0f6b1a569..2562cb456e 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkGestures.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/Gui/GtkGestures.cs
@@ -45,7 +45,7 @@ namespace Mono.TextEditor
{
if (Platform.IsMac) {
try {
- isSupported = gdk_quartz_supports_gesture_events ();
+ isSupported = gdk_quartz_supports_gesture_events () && Environment.GetEnvironmentVariable ("DISABLE_ZOOM_GESTURE") == null;
} catch (EntryPointNotFoundException) {
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/IExecutionHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/IExecutionHandler.cs
index a0a1c7b6d0..08a9201224 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/IExecutionHandler.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Execution/IExecutionHandler.cs
@@ -58,4 +58,15 @@ namespace MonoDevelop.Core.Execution
/// </param>
IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console);
}
+
+ /// <summary>
+ /// An execution handler that executes on a particular execution target.
+ /// </summary>
+ public interface ITargetedExecutionHandler : IExecutionHandler
+ {
+ /// <summary>
+ /// The execution target
+ /// </summary>
+ ExecutionTarget Target { get; }
+ }
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ExecutionContext.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ExecutionContext.cs
index 3c9207fe3e..90222b4342 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ExecutionContext.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ExecutionContext.cs
@@ -39,14 +39,16 @@ namespace MonoDevelop.Projects
ExecutionTarget executionTarget;
public ExecutionContext (IExecutionMode executionMode, IConsoleFactory consoleFactory, ExecutionTarget target)
+ : this (executionMode.ExecutionHandler, consoleFactory, target)
{
- this.executionHandler = executionMode.ExecutionHandler;
- this.consoleFactory = consoleFactory;
- this.executionTarget = target;
}
public ExecutionContext (IExecutionHandler executionHandler, IConsoleFactory consoleFactory, ExecutionTarget target)
{
+ var targetedHandler = executionHandler as ITargetedExecutionHandler;
+ if (targetedHandler != null)
+ target = targetedHandler.Target ?? target;
+
this.executionHandler = executionHandler;
this.consoleFactory = consoleFactory;
this.executionTarget = target;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/CustomExecutionMode.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/CustomExecutionMode.cs
index 5913bb7548..ef5b3e77c6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/CustomExecutionMode.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/CustomExecutionMode.cs
@@ -34,6 +34,7 @@ using MonoDevelop.Ide.Gui.Dialogs;
using MonoDevelop.Projects;
using MonoDevelop.Core.Serialization;
using Mono.Addins;
+using System.Linq;
namespace MonoDevelop.Ide.Execution
{
@@ -113,7 +114,8 @@ namespace MonoDevelop.Ide.Execution
public bool CanExecute (ExecutionCommand command)
{
if (Mode != null)
- return Mode.ExecutionHandler.CanExecute (command);
+ return Mode.ExecutionHandler.CanExecute (command)
+ && GetCachedCustomizers ().All (c => c.Item1.CanCustomize (command));
return false;
}
@@ -125,35 +127,51 @@ namespace MonoDevelop.Ide.Execution
public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console, bool allowPrompt, bool forcePrompt)
{
if ((PromptForParameters || forcePrompt) && allowPrompt) {
- CommandExecutionContext ctx = new CommandExecutionContext (Project, command);
+ var ctx = new CommandExecutionContext (Project, command);
CustomExecutionMode customMode = ExecutionModeCommandService.ShowParamtersDialog (ctx, Mode, this);
if (customMode == null)
return new CancelledProcessAsyncOperation ();
- else
- return customMode.Execute (command, console, false, false);
+ return customMode.Execute (command, console, false, false);
}
- if (commandData != null) {
- foreach (KeyValuePair<string,object> cmdData in commandData) {
- ExecutionCommandCustomizer cc = ExecutionModeCommandService.GetExecutionCommandCustomizer (cmdData.Key);
- if (cc != null)
- cc.Customize (command, cmdData.Value);
- }
+
+ foreach (var cc in GetCachedCustomizers ()) {
+ cc.Item1.Customize (command, cc.Item2);
}
- ParameterizedExecutionHandler cmode = Mode.ExecutionHandler as ParameterizedExecutionHandler;
+
+ var cmode = Mode.ExecutionHandler as ParameterizedExecutionHandler;
if (cmode != null) {
CommandExecutionContext ctx = new CommandExecutionContext (Project, command);
return cmode.Execute (command, console, ctx, Data);
- } else
- return Mode.ExecutionHandler.Execute (command, console);
+ }
+
+ return Mode.ExecutionHandler.Execute (command, console);
}
#endregion
+
+ IList<Tuple<ExecutionCommandCustomizer,object>> cachedCustomizers;
+
+ IList<Tuple<ExecutionCommandCustomizer,object>> GetCachedCustomizers ()
+ {
+ if (cachedCustomizers != null)
+ return cachedCustomizers;
+
+ if (commandData == null)
+ return cachedCustomizers = new Tuple<ExecutionCommandCustomizer,object>[0];
+
+ return cachedCustomizers = commandData
+ .Select (cmdData => Tuple.Create (
+ ExecutionModeCommandService.GetExecutionCommandCustomizer (cmdData.Key),
+ cmdData.Value))
+ .Where (cc => cc != null)
+ .ToList();
+ }
}
class UnknownModeData
{
}
- internal enum CustomModeScope
+ enum CustomModeScope
{
Project = 0,
Solution = 1,
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs
index a8a2955615..de62f8902e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/ExecutionModeCommandService.cs
@@ -88,11 +88,36 @@ namespace MonoDevelop.Ide.Execution
if (info.Count > 0)
info.AddSeparator ();
}
+
+ var targets = new List<ExecutionTarget> ();
+ FlattenExecutionTargets (targets, project.GetExecutionTargets (IdeApp.Workspace.ActiveConfiguration));
+
+ if (targets.Count > 1) {
+ foreach (var t in targets) {
+ var h = new TargetedExecutionHandler (Runtime.ProcessService.DefaultExecutionHandler, t);
+ CommandInfo ci = info.Add (t.FullName, new CommandItem (ctx, new ExecutionMode (t.Id, t.FullName, h)));
+ ci.Description = GettextCatalog.GetString ("Run With: {0}", ci.Text);
+ }
+ info.AddSeparator ();
+ }
+
if (supportsParameterization) {
info.AddSeparator ();
info.Add (GettextCatalog.GetString ("Edit Custom Modes..."), new CommandItem (ctx, null));
}
}
+
+ static void FlattenExecutionTargets (List<ExecutionTarget> addToList, IEnumerable<ExecutionTarget> targets)
+ {
+ foreach (var t in targets) {
+ var group = t as ExecutionTargetGroup;
+ if (group != null) {
+ FlattenExecutionTargets (addToList, group);
+ } else {
+ addToList.Add (t);
+ }
+ }
+ }
public static IExecutionHandler GetExecutionModeForCommand (object data)
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/TargetedExecutionHandler.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/TargetedExecutionHandler.cs
new file mode 100644
index 0000000000..63ba2161d0
--- /dev/null
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Execution/TargetedExecutionHandler.cs
@@ -0,0 +1,52 @@
+//
+// TargetedExecutionHandler.cs
+//
+// Author:
+// Michael Hutchinson <m.j.hutchinson@gmail.com>
+//
+// Copyright (c) 2015 Xamarin Inc.
+//
+// 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 MonoDevelop.Core.Execution;
+
+namespace MonoDevelop.Ide.Execution
+{
+ class TargetedExecutionHandler : ITargetedExecutionHandler
+ {
+ public ExecutionTarget Target { get; set; }
+ public IExecutionHandler Handler { get; set; }
+
+ public TargetedExecutionHandler (IExecutionHandler handler, ExecutionTarget target)
+ {
+ Target = target;
+ Handler = handler;
+ }
+
+ public bool CanExecute (ExecutionCommand command)
+ {
+ return Handler.CanExecute (command);
+ }
+
+ public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
+ {
+ return Handler.Execute (command, console);
+ }
+ }
+} \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index ac1dfd9341..49419b68f9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -3025,6 +3025,7 @@
<Compile Include="MonoDevelop.Ide.Projects\NewProjectConfiguration.cs" />
<Compile Include="MonoDevelop.Components\EventBoxTooltip.cs" />
<Compile Include="MonoDevelop.Ide.Templates\ProjectTemplateCreateInformation.cs" />
+ <Compile Include="MonoDevelop.Ide.Execution\TargetedExecutionHandler.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Makefile.am" />