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/src
diff options
context:
space:
mode:
authorMike Krüger <mkrueger@xamarin.com>2011-11-23 16:23:33 +0400
committerMike Krüger <mkrueger@xamarin.com>2011-11-23 16:23:33 +0400
commit9c472fca08b0e4de8d31b29c754d2fe0169d2fb8 (patch)
tree2fcb0fffd13d02bec5230b20180ba9fc6c22792d /main/src
parent2bd1ac28879660f0a6ad2ec39cf7f816ff286a76 (diff)
parentd823430f7f983497176c5677e284c88ec41e0304 (diff)
Merge branch 'master' into newresolver
Diffstat (limited to 'main/src')
-rw-r--r--main/src/addins/CSharpBinding/CSharpBinding.csproj11
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs68
-rw-r--r--main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerStartInfo.cs46
-rw-r--r--main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs86
-rw-r--r--main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs3
-rw-r--r--main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs2
-rw-r--r--main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs4
-rw-r--r--main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Dialogs/WebReferenceDialog.cs8
-rw-r--r--main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj3
-rw-r--r--main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.csproj1
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs55
-rw-r--r--main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs33
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs55
-rw-r--r--main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs23
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj2
16 files changed, 301 insertions, 110 deletions
diff --git a/main/src/addins/CSharpBinding/CSharpBinding.csproj b/main/src/addins/CSharpBinding/CSharpBinding.csproj
index 4a51d9772d..9c71dd7841 100644
--- a/main/src/addins/CSharpBinding/CSharpBinding.csproj
+++ b/main/src/addins/CSharpBinding/CSharpBinding.csproj
@@ -289,18 +289,7 @@
<Folder Include="MonoDevelop.CSharp.Refactoring\DeclareLocal\" />
<Folder Include="MonoDevelop.CSharp.ContextAction\" />
<Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
<Folder Include="MonoDevelop.CSharp.Inspection\NamingInspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
- <Folder Include="MonoDevelop.CSharp.Inspection\" />
<Folder Include="MonoDevelop.CSharp.Inspection\Inspectors\" />
<Folder Include="MonoDevelop.CSharp.ContextAction\Actions\" />
<Folder Include="MonoDevelop.CSharp.Refactoring\RefactorImports\" />
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs
index e405b71a3d..a15bfd771c 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -71,6 +71,7 @@ namespace Mono.Debugging.Soft
Thread errorReader;
IAsyncResult connectionHandle;
+ SoftDebuggerStartArgs startArgs;
LinkedList<List<Event>> queuedEventSets = new LinkedList<List<Event>> ();
@@ -107,11 +108,58 @@ namespace Mono.Debugging.Soft
StartConnecting (dsi);
} else if (dsi.StartArgs is SoftDebuggerListenArgs) {
StartListening (dsi);
+ } else if (dsi.StartArgs.ConnectionProvider != null) {
+ StartConnection (dsi);
} else {
- throw new Exception (string.Format ("Unknown args: {0}", dsi.StartArgs));
+ throw new ArgumentException ("StartArgs has no ConnectionProvider");
}
}
+ void StartConnection (SoftDebuggerStartInfo dsi)
+ {
+ this.startArgs = dsi.StartArgs;
+
+ RegisterUserAssemblies (dsi.UserAssemblyNames);
+
+ if (!String.IsNullOrEmpty (dsi.LogMessage))
+ LogWriter (false, dsi.LogMessage + "\n");
+
+
+ AsyncCallback callback = null;
+ int attemptNumber = 0;
+ int maxAttempts = startArgs.MaxConnectionAttempts;
+ int timeBetweenAttempts = startArgs.TimeBetweenConnectionAttempts;
+ callback = delegate (IAsyncResult ar) {
+ try {
+ string appName;
+ VirtualMachine vm;
+ startArgs.ConnectionProvider.EndConnect (ar, out vm, out appName);
+ this.remoteProcessName = appName;
+ ConnectionStarted (vm);
+ return;
+ } catch (Exception ex) {
+ attemptNumber++;
+ if (!ShouldRetryConnection (ex, attemptNumber)
+ || !startArgs.ConnectionProvider.ShouldRetryConnection (ex)
+ || attemptNumber == maxAttempts
+ || Exited)
+ {
+ OnConnectionError (ex);
+ return;
+ }
+ }
+ try {
+ if (timeBetweenAttempts > 0)
+ System.Threading.Thread.Sleep (timeBetweenAttempts);
+ ConnectionStarting (startArgs.ConnectionProvider.BeginConnect (dsi, callback), dsi, false, 0);
+ } catch (Exception ex2) {
+ OnConnectionError (ex2);
+ }
+ };
+ //the "listening" value is never used, pass a dummy value
+ ConnectionStarting (startArgs.ConnectionProvider.BeginConnect (dsi, callback), dsi, false, 0);
+ }
+
void StartLaunching (SoftDebuggerStartInfo dsi)
{
var args = (SoftDebuggerLaunchArgs) dsi.StartArgs;
@@ -198,8 +246,7 @@ namespace Mono.Debugging.Soft
protected void StartConnecting (SoftDebuggerStartInfo dsi)
{
- var args = (SoftDebuggerConnectArgs) dsi.StartArgs;
- StartConnecting (dsi, args.MaxConnectionAttempts, args.TimeBetweenConnectionAttempts);
+ StartConnecting (dsi, dsi.StartArgs.MaxConnectionAttempts, dsi.StartArgs.TimeBetweenConnectionAttempts);
}
/// <summary>Starts the debugger connecting to a remote IP</summary>
@@ -246,8 +293,6 @@ namespace Mono.Debugging.Soft
var args = (SoftDebuggerRemoteArgs) dsi.StartArgs;
remoteProcessName = args.AppName;
- if (string.IsNullOrEmpty (remoteProcessName))
- remoteProcessName = "mono";
RegisterUserAssemblies (dsi.UserAssemblyNames);
@@ -277,7 +322,7 @@ namespace Mono.Debugging.Soft
protected virtual void OnConnectionError (Exception ex)
{
//if the exception was caused by cancelling the session
- if (Exited && ex is SocketException)
+ if (Exited)
return;
if (!HandleException (ex)) {
@@ -312,7 +357,12 @@ namespace Mono.Debugging.Soft
{
HideConnectionDialog ();
if (connectionHandle != null) {
- VirtualMachineManager.CancelConnection (connectionHandle);
+ if (startArgs != null && startArgs.ConnectionProvider != null) {
+ startArgs.ConnectionProvider.CancelConnect (connectionHandle);
+ startArgs = null;
+ } else {
+ VirtualMachineManager.CancelConnection (connectionHandle);
+ }
connectionHandle = null;
}
}
@@ -596,8 +646,8 @@ namespace Mono.Debugging.Soft
protected override ProcessInfo[] OnGetProcesses ()
{
if (procs == null) {
- if (remoteProcessName != null) {
- procs = new ProcessInfo[] { new ProcessInfo (0, remoteProcessName) };
+ if (remoteProcessName != null || vm.TargetProcess == null) {
+ procs = new ProcessInfo[] { new ProcessInfo (0, remoteProcessName ?? "mono") };
} else {
try {
procs = new ProcessInfo[] { new ProcessInfo (vm.TargetProcess.Id, vm.TargetProcess.ProcessName) };
diff --git a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerStartInfo.cs b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerStartInfo.cs
index 8bbc895b25..06db05aedc 100644
--- a/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerStartInfo.cs
+++ b/main/src/addins/MonoDevelop.Debugger.Soft/Mono.Debugging.Soft/SoftDebuggerStartInfo.cs
@@ -29,6 +29,7 @@ using System.Collections.Generic;
using System.Reflection;
using System.IO;
using System.Net;
+using Mono.Debugger.Soft;
namespace Mono.Debugging.Soft
{
@@ -63,8 +64,33 @@ namespace Mono.Debugging.Soft
public SoftDebuggerStartArgs StartArgs { get; set; }
}
+ public interface ISoftDebuggerConnectionProvider
+ {
+ IAsyncResult BeginConnect (DebuggerStartInfo dsi, AsyncCallback callback);
+ void EndConnect (IAsyncResult result, out VirtualMachine vm, out string appName);
+ void CancelConnect (IAsyncResult result);
+ bool ShouldRetryConnection (Exception ex);
+ }
+
public abstract class SoftDebuggerStartArgs
{
+ public SoftDebuggerStartArgs ()
+ {
+ MaxConnectionAttempts = 1;
+ TimeBetweenConnectionAttempts = 500;
+ }
+
+ public abstract ISoftDebuggerConnectionProvider ConnectionProvider { get; }
+
+ /// <summary>
+ /// Maximum number of connection attempts. Zero or less means infinite attempts. Default is 1.
+ /// </summary>
+ public int MaxConnectionAttempts { get; set; }
+
+ /// <summary>
+ /// The time between connection attempts, in milliseconds. Default is 500.
+ /// </summary>
+ public int TimeBetweenConnectionAttempts { get; set; }
}
public abstract class SoftDebuggerRemoteArgs : SoftDebuggerStartArgs
@@ -117,6 +143,8 @@ namespace Mono.Debugging.Soft
: base (appName, address, debugPort, outputPort)
{
}
+
+ public override ISoftDebuggerConnectionProvider ConnectionProvider { get { return null; } }
}
/// <summary>
@@ -134,20 +162,9 @@ namespace Mono.Debugging.Soft
throw new ArgumentException ("Debug port cannot be zero when connecting", "debugPort");
if (outputPort == 0)
throw new ArgumentException ("Output port cannot be zero when connecting", "outputPort");
-
- MaxConnectionAttempts = 1;
- TimeBetweenConnectionAttempts = 500;
}
- /// <summary>
- /// Maximum number of connection attempts. Zero or less means infinite attempts.
- /// </summary>
- public int MaxConnectionAttempts { get; set; }
-
- /// <summary>
- /// Tthe time between connection attempts, in milliseconds.
- /// </summary>
- public int TimeBetweenConnectionAttempts { get; set; }
+ public override ISoftDebuggerConnectionProvider ConnectionProvider { get { return null; } }
}
/// <summary>
@@ -178,6 +195,7 @@ namespace Mono.Debugging.Soft
/// Launcher for the external console. May be null if the app does not run on an external console.
/// </summary>
public Mono.Debugger.Soft.LaunchOptions.TargetProcessLauncher ExternalConsoleLauncher { get; set; }
+
+ public override ISoftDebuggerConnectionProvider ConnectionProvider { get { return null; } }
}
-}
-
+} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs
index 5271cf1908..ee52421f36 100644
--- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs
+++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeMonitor.cs
@@ -46,7 +46,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing
class XcodeMonitor
{
FilePath originalProjectDir;
- int nextHackDir = 0;
+ static int nextHackDir = 0;
string name;
FilePath xcproj, projectDir;
@@ -124,6 +124,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing
if (removedOldProject) {
HackRelocateProject ();
+ ctx.ProjectDir = projectDir;
}
foreach (var item in items) {
@@ -142,6 +143,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing
pendingProjectWrite = emptyProject;
}
+ OpenProject ();
monitor.EndTask ();
monitor.ReportSuccess (GettextCatalog.GetString ("Xcode project updated."));
}
@@ -275,12 +277,6 @@ namespace MonoDevelop.MacDev.XcodeSyncing
}
}
- public void OpenProject ()
- {
- SyncProject ();
- AppleScript.Run (XCODE_OPEN_PROJECT, AppleSdkSettings.XcodePath, xcproj);
- }
-
public void OpenFile (string relativeName)
{
XC4Debug.Log ("Opening file in Xcode: {0}", relativeName);
@@ -341,6 +337,14 @@ namespace MonoDevelop.MacDev.XcodeSyncing
return success;
}
+ public bool OpenProject ()
+ {
+ SyncProject ();
+ var success = AppleScript.Run (XCODE_OPEN_PROJECT, AppleSdkSettings.XcodePath, projectDir) == "true";
+ XC4Debug.Log ("Opening project: {0}", success);
+ return success;
+ }
+
public bool CloseFile (string fileName)
{
if (!CheckRunning ())
@@ -350,8 +354,8 @@ namespace MonoDevelop.MacDev.XcodeSyncing
XC4Debug.Log ("Closing file {0}: {1}", fileName, success);
return success;
}
-
- const string XCODE_OPEN_PROJECT =
+
+ const string XCODE_OPEN_PROJECT =
@"tell application ""{0}""
activate
open ""{1}""
@@ -366,45 +370,51 @@ end tell";
const string XCODE_SAVE_IN_PATH =
@"tell application ""{0}""
- set pp to ""{1}""
- set ext to {{ "".storyboard"", "".xib"", "".h"", "".m"" }}
- repeat with d in documents
- if d is modified then
- set f to path of d
- if f starts with pp then
- repeat with e in ext
- if f ends with e then
- save d
- exit repeat
- end if
- end repeat
+ if it is running then
+ set pp to ""{1}""
+ set ext to {{ "".storyboard"", "".xib"", "".h"", "".m"" }}
+ repeat with d in documents
+ if d is modified then
+ set f to path of d
+ if f starts with pp then
+ repeat with e in ext
+ if f ends with e then
+ save d
+ exit repeat
+ end if
+ end repeat
+ end if
end if
- end if
- end repeat
+ end repeat
+ end if
end tell";
const string XCODE_CLOSE_IN_PATH =
@"tell application ""{0}""
- set pp to ""{1}""
- repeat with d in documents
- set f to path of d
- if f starts with pp then
- close d
- return true
- end if
- end repeat
+ if it is running then
+ set pp to ""{1}""
+ repeat with d in documents
+ set f to path of d
+ if f starts with pp then
+ close d
+ return true
+ end if
+ end repeat
+ end if
return false
end tell";
const string XCODE_CHECK_PROJECT_OPEN =
@"tell application ""{0}""
- set pp to ""{1}""
- repeat with p in projects
- if real path of p is pp then
- return true
- exit repeat
- end if
- end repeat
+ if it is running then
+ set pp to ""{1}""
+ repeat with p in projects
+ if real path of p is pp then
+ return true
+ exit repeat
+ end if
+ end repeat
+ end if
return false
end tell";
}
diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs
index 02c06f5294..2592587be4 100644
--- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs
+++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeProjectTracker.cs
@@ -249,7 +249,6 @@ namespace MonoDevelop.MacDev.XcodeSyncing
continue;
if (finf.ProjectFile.BuildAction == BuildAction.Compile) {
updateTypes = true;
- break;
} else if (IncludeInSyncedProject (finf.ProjectFile)) {
updateProject = true;
}
@@ -259,7 +258,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing
using (var monitor = GetStatusMonitor (GettextCatalog.GetString ("Syncing to Xcode..."))) {
//FIXME: make this async (and safely async)
//FIXME: only update the project if obj-c types change
- updateProject = UpdateTypes (monitor, true);
+ updateProject |= UpdateTypes (monitor, true);
}
}
diff --git a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs
index a39fe1227c..6303d0457c 100644
--- a/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs
+++ b/main/src/addins/MonoDevelop.MacDev/XcodeSyncing/XcodeSyncContext.cs
@@ -47,7 +47,7 @@ namespace MonoDevelop.MacDev.XcodeSyncing
this.syncTimes = syncTimes;
}
- public FilePath ProjectDir { get; private set; }
+ public FilePath ProjectDir { get; set; }
public DateTime GetSyncTime (string relativeFilename)
{
diff --git a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs
index c1b7f245ee..cf20314209 100644
--- a/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs
+++ b/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/DebugValueWindow.cs
@@ -45,7 +45,9 @@ namespace MonoDevelop.SourceEditor
this.SkipTaskbarHint = true;
this.Decorated = false;
this.BorderWidth = 2;
- this.TypeHint = WindowTypeHint.Tooltip;
+ //HACK: this should be WindowTypeHint.Tooltip, but GTK on mac is buggy and doesn't allow keyboard
+ //input to WindowType.Toplevel windows with WindowTypeHint.Tooltip hint
+ this.TypeHint = WindowTypeHint.PopupMenu;
this.AllowShrink = false;
this.AllowGrow = false;
}
diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Dialogs/WebReferenceDialog.cs b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Dialogs/WebReferenceDialog.cs
index 9bb69b8e89..af90278afb 100644
--- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Dialogs/WebReferenceDialog.cs
+++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.Dialogs/WebReferenceDialog.cs
@@ -12,6 +12,7 @@ using MonoDevelop.Ide.WebBrowser;
using MonoDevelop.WebReferences;
using MonoDevelop.Ide;
using MonoDevelop.Projects;
+using MonoDevelop.WebReferences.WS;
namespace MonoDevelop.WebReferences.Dialogs
{
@@ -401,6 +402,13 @@ namespace MonoDevelop.WebReferences.Dialogs
MessageService.ShowError (GettextCatalog.GetString ("Web reference already exists"), GettextCatalog.GetString ("A web service reference with the name '{0}' already exists in the project. Please use a different name.", this.tbxReferenceName.Text));
return;
}
+
+ var webref = project.Items.GetAll <WebReferenceUrl> ().FirstOrDefault (r => r.Include == ServiceUrl);
+ if (webref != null) {
+ MessageService.ShowError (GettextCatalog.GetString ("Web reference already exists"), GettextCatalog.GetString ("The web service '{0}' already exists with the name '{1}'", ServiceUrl, webref.RelPath.FileName));
+ return;
+ }
+
Respond (Gtk.ResponseType.Ok);
}
diff --git a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj
index a453195c89..868f29ffec 100644
--- a/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj
+++ b/main/src/addins/MonoDevelop.WebReferences/MonoDevelop.WebReferences.csproj
@@ -152,9 +152,6 @@
<ItemGroup>
<Folder Include="MonoDevelop.WebReferences.WCF\" />
<Folder Include="MonoDevelop.WebReferences\" />
- <Folder Include="MonoDevelop.WebReferences\" />
<Folder Include="MonoDevelop.WebReferences.WS\" />
- <Folder Include="MonoDevelop.WebReferences\" />
- <Folder Include="MonoDevelop.WebReferences.WCF\" />
</ItemGroup>
</Project>
diff --git a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.csproj b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.csproj
index 89a0a31790..942e832d01 100644
--- a/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.csproj
+++ b/main/src/addins/VersionControl/MonoDevelop.VersionControl.Subversion/MonoDevelop.VersionControl.Subversion.csproj
@@ -128,6 +128,5 @@
</ProjectExtensions>
<ItemGroup>
<Folder Include="MonoDevelop.VersionControl.Subversion\" />
- <Folder Include="MonoDevelop.VersionControl.Subversion\" />
</ItemGroup>
</Project>
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs
index a97c0d31fb..892902ce5e 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/GtkWorkarounds.cs
@@ -94,8 +94,14 @@ namespace Mono.TextEditor
}
}
- //TODO: opt into the fixes on GTK+ >= 2.24.8
- oldMacKeyHacks = true;
+ //opt into the fixes on GTK+ >= 2.24.8
+ if (Platform.IsMac) {
+ try {
+ gdk_quartz_set_fix_modifiers (true);
+ } catch (EntryPointNotFoundException) {
+ oldMacKeyHacks = true;
+ }
+ }
keymap.KeysChanged += delegate {
mappedKeys.Clear ();
@@ -301,11 +307,27 @@ namespace Mono.TextEditor
var screen = parent.Screen;
Gdk.Rectangle geometry = GetUsableMonitorGeometry (screen, screen.GetMonitorAtPoint (x, y));
- if (x + request.Width > geometry.Right) {
- x -= request.Width;
+ //whether to push or flip menus that would extend offscreen
+ //FIXME: this is the correct behaviour for mac, check other platforms
+ bool flip_left = true;
+ bool flip_up = false;
+
+ int x_over = x + request.Width - geometry.Right;
+ if (x_over > 0) {
+ if (flip_left) {
+ x -= request.Width;
+ } else {
+ x -= x_over;
+ }
}
- if (y + request.Height > geometry.Bottom) {
- y -= request.Height;
+
+ int y_over = y + request.Height - geometry.Bottom;
+ if (y_over > 0) {
+ if (flip_up) {
+ y -= request.Height;
+ } else {
+ y -= y_over;
+ }
}
y = System.Math.Max (geometry.Top, System.Math.Min (y, geometry.Bottom - request.Height));
x = System.Math.Max (geometry.Left, System.Math.Min (x, geometry.Right - request.Width));
@@ -314,11 +336,24 @@ namespace Mono.TextEditor
};
}
+ uint time;
+ uint button;
+
if (evt == null) {
- menu.Popup (null, null, posFunc, 0, Gtk.Global.CurrentEventTime);
+ time = Gtk.Global.CurrentEventTime;
+ button = 0;
} else {
- menu.Popup (null, null, posFunc, evt.Button, evt.Time);
+ time = evt.Time;
+ button = evt.Button;
+ }
+
+ //HACK: work around GTK menu issues on mac when passing button to menu.Popup
+ //some menus appear and immediately hide, and submenus don't activate
+ if (Platform.IsMac) {
+ button = 0;
}
+
+ menu.Popup (null, null, posFunc, button, time);
}
public static void ShowContextMenu (Gtk.Menu menu, Gtk.Widget parent, Gdk.EventButton evt)
@@ -342,6 +377,10 @@ namespace Mono.TextEditor
[DllImport (PangoUtil.LIBGDK)]
extern static bool gdk_keymap_add_virtual_modifiers (IntPtr keymap, ref Gdk.ModifierType state);
+ //Custom patch in Mono Mac w/GTK+ 2.24.8+
+ [DllImport (PangoUtil.LIBGDK)]
+ extern static bool gdk_quartz_set_fix_modifiers (bool fix);
+
static Gdk.Keymap keymap = Gdk.Keymap.Default;
static Dictionary<long,MappedKeys> mappedKeys = new Dictionary<long,MappedKeys> ();
diff --git a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
index c495a689f3..0919b06eec 100644
--- a/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
+++ b/main/src/core/Mono.Texteditor/Mono.TextEditor/TextEditor.cs
@@ -945,15 +945,8 @@ namespace Mono.TextEditor
//main context menu
if (DoPopupMenu != null && e.TriggersContextMenu ()) {
- double tmOffset = e.X - textViewMargin.XOffset;
- if (tmOffset >= 0) {
- DocumentLocation loc = PointToLocation (tmOffset, e.Y);
- if (!this.IsSomethingSelected || !this.SelectionRange.Contains (Document.LocationToOffset (loc)))
- Caret.Location = loc;
- DoPopupMenu (e);
- this.ResetMouseState ();
+ if (!workaroundBug2157 && DoClickedPopupMenu (e))
return true;
- }
}
if (lastTime != e.Time) {// filter double clicks
@@ -971,6 +964,23 @@ namespace Mono.TextEditor
return base.OnButtonPressEvent (e);
}
+ //HACK: work around "Bug 2157 - Context menus flaky near left edge of screen" by triggering on ButtonRelease
+ static bool workaroundBug2157 = Platform.IsMac;
+
+ bool DoClickedPopupMenu (Gdk.EventButton e)
+ {
+ double tmOffset = e.X - textViewMargin.XOffset;
+ if (tmOffset >= 0) {
+ DocumentLocation loc = PointToLocation (tmOffset, e.Y);
+ if (!this.IsSomethingSelected || !this.SelectionRange.Contains (Document.LocationToOffset (loc)))
+ Caret.Location = loc;
+ DoPopupMenu (e);
+ this.ResetMouseState ();
+ return true;
+ }
+ return false;
+ }
+
public Action<Gdk.EventButton> DoPopupMenu { get; set; }
protected override bool OnPopupMenu ()
@@ -1013,6 +1023,13 @@ namespace Mono.TextEditor
protected override bool OnButtonReleaseEvent (EventButton e)
{
RemoveScrollWindowTimer ();
+
+ //main context menu
+ if (DoPopupMenu != null && e.IsContextMenuButton ()) {
+ if (workaroundBug2157 && DoClickedPopupMenu (e))
+ return true;
+ }
+
double startPos;
Margin margin = GetMarginAtX (e.X, out startPos);
if (margin != null)
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
index ef2037fb88..9332db2781 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects.Formats.MSBuild/MSBuildProjectHandler.cs
@@ -288,7 +288,9 @@ namespace MonoDevelop.Projects.Formats.MSBuild
it.FileName = fileName;
it.Name = System.IO.Path.GetFileNameWithoutExtension (fileName);
-
+
+ RemoveDuplicateItems (p, fileName);
+
Load (monitor, p);
return it;
@@ -397,6 +399,54 @@ namespace MonoDevelop.Projects.Formats.MSBuild
return new FileFormat (TargetFormat, TargetFormat.Id, TargetFormat.Name);
}
+ void RemoveDuplicateItems (MSBuildProject msproject, string fileName)
+ {
+ timer.Trace ("Checking for duplicate items");
+
+ var uniqueIncludes = new Dictionary<string,object> ();
+ var toRemove = new List<MSBuildItem> ();
+ foreach (MSBuildItem bi in msproject.GetAllItems ()) {
+ object existing;
+ string key = bi.Name + "<" + bi.Include;
+ if (!uniqueIncludes.TryGetValue (key, out existing)) {
+ uniqueIncludes[key] = bi;
+ continue;
+ }
+ var exBi = existing as MSBuildItem;
+ if (exBi != null) {
+ if (exBi.Condition != bi.Condition || exBi.Element.InnerXml != bi.Element.InnerXml) {
+ uniqueIncludes[key] = new List<MSBuildItem> { exBi, bi };
+ } else {
+ toRemove.Add (bi);
+ }
+ continue;
+ }
+
+ var exList = (List<MSBuildItem>)existing;
+ bool found = false;
+ foreach (var m in (exList)) {
+ if (m.Condition == bi.Condition && m.Element.InnerXml == bi.Element.InnerXml) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ exList.Add (bi);
+ } else {
+ toRemove.Add (bi);
+ }
+ }
+ if (toRemove.Count == 0)
+ return;
+
+ timer.Trace ("Removing duplicate items");
+
+ foreach (var t in toRemove)
+ msproject.RemoveItem (t);
+ fileContent = msproject.Save ();
+ MonoDevelop.Projects.Text.TextFile.WriteFile (fileName, fileContent, "UTF-8");
+ }
+
void Load (IProgressMonitor monitor, MSBuildProject msproject)
{
timer.Trace ("Initialize serialization");
@@ -419,9 +469,6 @@ namespace MonoDevelop.Projects.Formats.MSBuild
ProjectItem it = ReadItem (ser, buildItem);
if (it != null) {
EntityItem.Items.Add (it);
- int i = EntityItem.Items.IndexOf (it);
- if (i != -1 && EntityItem.Items [i] != it && EntityItem.Items [i].Condition == it.Condition)
- EntityItem.Items.RemoveAt (i); // Remove duplicates
}
}
diff --git a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs
index 12c15aa760..4ca6a5bab1 100644
--- a/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs
+++ b/main/src/core/MonoDevelop.Core/MonoDevelop.Projects/ProjectReference.cs
@@ -436,12 +436,27 @@ namespace MonoDevelop.Projects
return MemberwiseClone();
}
+ public override bool Equals (object obj)
+ {
+ return Equals (obj as ProjectReference);
+ }
+
public bool Equals (ProjectReference other)
{
- ProjectReference oref = other as ProjectReference;
- if (oref == null) return false;
-
- return StoredReference == oref.StoredReference && referenceType == oref.referenceType && package == oref.package;
+ return other != null
+ && StoredReference == other.StoredReference
+ && referenceType == other.referenceType
+ && package == other.package;
+ }
+
+ public override int GetHashCode ()
+ {
+ int result = 0;
+ if (StoredReference != null)
+ result ^= StoredReference.GetHashCode ();
+ if (package != null)
+ result ^= package.GetHashCode ();
+ return result;
}
internal void NotifyStatusChanged ()
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs
index 83c8aadb07..873461db4b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components/ContextMenuTreeView.cs
@@ -45,6 +45,9 @@ namespace MonoDevelop.Components
public Action<Gdk.EventButton> DoPopupMenu { get; set; }
+ //HACK: work around "Bug 2157 - Context menus flaky near left edge of screen" by triggering on ButtonRelease
+ static bool workaroundBug2157 = MonoDevelop.Core.Platform.IsMac;
+
protected override bool OnButtonPressEvent (Gdk.EventButton evnt)
{
bool res = false;
@@ -56,9 +59,9 @@ namespace MonoDevelop.Components
if (!res)
res = base.OnButtonPressEvent (evnt);
- //HACK: show context menu in release event instead of show event to work around gtk bug
if (DoPopupMenu != null && evnt.TriggersContextMenu ()) {
- // DoPopupMenu (evnt);
+ if (!workaroundBug2157)
+ DoPopupMenu (evnt);
return true;
}
@@ -69,9 +72,9 @@ namespace MonoDevelop.Components
{
bool res = base.OnButtonReleaseEvent (evnt);
- //HACK: show context menu in release event instead of show event to work around gtk bug
if (DoPopupMenu != null && evnt.IsContextMenuButton ()) {
- DoPopupMenu (evnt);
+ if (workaroundBug2157)
+ DoPopupMenu (evnt);
return true;
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
index ed8aa926b5..ba281a0b1d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.csproj
@@ -1564,7 +1564,6 @@
<Folder Include="MonoDevelop.Ide.Projects\" />
<Folder Include="MonoDevelop.Ide\" />
<Folder Include="MonoDevelop.Ide.Gui.Dialogs\" />
- <Folder Include="MonoDevelop.Ide.Projects\" />
<Folder Include="MonoDevelop.Ide.Projects.OptionPanels\" />
<Folder Include="MonoDevelop.Ide.NavigateToDialog\" />
<Folder Include="MonoDevelop.Ide.Navigation\" />
@@ -1573,7 +1572,6 @@
<Folder Include="MonoDevelop.Ide.Codons\" />
<Folder Include="ExtensionModel\" />
<Folder Include="icons\" />
- <Folder Include="icons\" />
<Folder Include="MonoDevelop.Ide.WelcomePage\" />
<Folder Include="branding\" />
</ItemGroup>