diff options
author | Alan McGovern <alan@xamarin.com> | 2015-10-16 18:02:57 +0300 |
---|---|---|
committer | Alan McGovern <alan@xamarin.com> | 2015-10-16 18:02:57 +0300 |
commit | 42569d8b5eff3cfa5320279df55f0ddcd3176b65 (patch) | |
tree | d298279d14b5768f6851520fdeaca15016cc3407 | |
parent | da1fca40fa03f46a063f7133e341f2ff3f945a03 (diff) | |
parent | 0d8cdea26b79533b2ea277880a10f4707bae5007 (diff) |
Merge remote-tracking branch 'origin/monodevelop-5.9-branch' into monodevelop-5.9-branch-c5sr5
9 files changed, 94 insertions, 45 deletions
@@ -1,6 +1,6 @@ **MonoDevelop** is a full-featured integrated development environment (IDE) for mono using Gtk#. -See http://www.monodevelop.com for more info. +See http://www.monodevelop.com for more info. [![Build Status](http://jenkins.mono-project.com/job/test-monodevelop-mainline/badge/icon)](http://jenkins.mono-project.com/job/test-monodevelop-mainline/) diff --git a/main/build/MacOSX/Makefile.am b/main/build/MacOSX/Makefile.am index 06edb3d6d1..247cd739a2 100644 --- a/main/build/MacOSX/Makefile.am +++ b/main/build/MacOSX/Makefile.am @@ -7,7 +7,7 @@ ADDINS=$(MAC_APP_LIB_DIR)/AddIns EXTRAS=$(top_srcdir)/../extras ARTIFACTS=$(top_srcdir)/../../artifacts MD_CONFIGURE=$(top_srcdir)/../scripts/configure.sh -SDK_PATH=$(shell xcrun --sdk macosx10.8 --show-sdk-path) +SDK_PATH=$(shell /Applications/Xcode511.app/Contents/Developer/usr/bin/xcrun --sdk macosx10.8 --show-sdk-path) PACKAGE_UPDATE_ID=$(shell $(MD_CONFIGURE) get-releaseid) BUNDLE_VERSION=$(shell $(MD_CONFIGURE) get-version) diff --git a/main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs b/main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs index 87c62c87c9..fb0e5fe557 100644 --- a/main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs +++ b/main/src/addins/MacPlatform/Dialogs/MacAddFileDialogHandler.cs @@ -60,7 +60,8 @@ namespace MonoDevelop.MacIntegration }; box.Layout (); panel.AccessoryView = box.View; - box.Layout (box.View.Superview.Frame.Size); + if (box.View.Superview != null) + box.Layout (box.View.Superview.Frame.Size); } else { dropdownBox.Layout (); panel.AccessoryView = dropdownBox.View; diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs index 392aacd522..be459eabbd 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.AnalysisCore/AnalysisCommands.cs @@ -120,6 +120,8 @@ namespace MonoDevelop.AnalysisCore ((System.Action)dataItem) (); return; } + if (!RefactoringService.CheckUserSettings ()) + return; var action = dataItem as IAnalysisFixAction; if (action != null) { action.Fix (); diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs index 8cbdfbf6dc..fc93c8dc00 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.CodeActions/CodeActionEditorExtension.cs @@ -429,6 +429,8 @@ namespace MonoDevelop.CodeActions void PopulateFixes (FixMenuDescriptor menu, ref int items) { + if (!RefactoringService.ShowFixes) + return; int mnemonic = 1; bool gotImportantFix = false, addedSeparator = false; var fixesAdded = new List<string> (); diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml index 2e73bcaa20..7e868c9ecf 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring.addin.xml @@ -99,7 +99,7 @@ defaultHandler = "MonoDevelop.Refactoring.ResolveCommandHandler" type="array" _label = "Resolve"/> - + <Command id = "MonoDevelop.Refactoring.RefactoryCommands.CurrentRefactoryOperations" defaultHandler = "MonoDevelop.Refactoring.CurrentRefactoryOperationsHandler" type="array" @@ -186,7 +186,7 @@ func="MonoDevelop.AnalysisCore.Rules.NamingConventions.ClassNaming" />--> </Category> </Extension> - + <Extension path = "/MonoDevelop/AnalysisCore/FixHandlers"> <Handler fixName="RenameMember" class = "MonoDevelop.AnalysisCore.Fixes.RenameMemberHandler" /> <Handler fixName="Generic" class = "MonoDevelop.AnalysisCore.Fixes.GenericFixHandler" /> diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs index 64096e8329..9e18efff67 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoringService.cs @@ -42,6 +42,7 @@ using Mono.TextEditor; using MonoDevelop.Ide.TypeSystem; using System.Diagnostics; using MonoDevelop.Core.Instrumentation; +using MonoDevelop.Ide; namespace MonoDevelop.Refactoring { @@ -293,10 +294,53 @@ namespace MonoDevelop.Refactoring return RunAll (allFixes, refactoringContext, script); } } - + + const string EnableRefactorings = "RefactoringSettings.EnableRefactorings"; + + internal static bool CheckUserSettings() + { + var hasRefactoringSettings = IdeApp.ProjectOperations.CurrentSelectedSolution == null || + IdeApp.ProjectOperations.CurrentSelectedSolution.UserProperties.HasValue (EnableRefactorings); + if (!hasRefactoringSettings) { + var useRefactoringsButton = new AlertButton (GettextCatalog.GetString("Use refactorings on this solution")); + var text = GettextCatalog.GetString ( +@"WARNING: The Xamarin Studio refactoring operations do not yet support C# 6. + +You may continue to use refactoring operations with C# 6, however you should check the results carefully to make sure that they have not made incorrect changes to your code. In particular, the ""?."" null propagating dereference will be changed to ""."", a simple dereference, which can cause unexpected NullReferenceExceptions at runtime."); + var message = new QuestionMessage (text); + message.Buttons.Add (useRefactoringsButton); + message.Buttons.Add (AlertButton.Cancel); + message.Icon = Gtk.Stock.DialogWarning; + message.DefaultButton = 1; + + var result = MessageService.AskQuestion (message); + if (result == AlertButton.Cancel) + return false; + ShowFixes = result == useRefactoringsButton; + } + return ShowFixes; + } + + internal static bool ShowFixes { + get { + if (Ide.IdeApp.ProjectOperations.CurrentSelectedSolution != null) { + var hasRefactoringSettings = IdeApp.ProjectOperations.CurrentSelectedSolution.UserProperties.HasValue (EnableRefactorings); + return !hasRefactoringSettings || IdeApp.ProjectOperations.CurrentSelectedSolution.UserProperties.GetValue<bool> (EnableRefactorings); + } + return true; + } + set { + IdeApp.ProjectOperations.CurrentSelectedSolution.UserProperties.SetValue (EnableRefactorings, value); + IdeApp.ProjectOperations.CurrentSelectedSolution.SaveUserProperties (); + } + } + + public static void ApplyFix (CodeAction action, IRefactoringContext context) { - using(var script = context.CreateScript ()) { + if (!CheckUserSettings ()) + return; + using (var script = context.CreateScript ()) { action.Run (context, script); } } diff --git a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs index 1dd79118c7..d89a7c4081 100644 --- a/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs +++ b/main/src/addins/MonoDevelop.Refactoring/MonoDevelop.Refactoring/RefactoryCommands.cs @@ -269,49 +269,49 @@ namespace MonoDevelop.Refactoring })); added = true; } - - foreach (var refactoring in RefactoringService.Refactorings) { - if (refactoring.IsValid (options)) { - CommandInfo info = new CommandInfo (refactoring.GetMenuDescription (options)); - info.AccelKey = refactoring.AccelKey; - ciset.CommandInfos.Add (info, new Action (new RefactoringOperationWrapper (refactoring, options).Operation)); + if (RefactoringService.ShowFixes) { + foreach (var refactoring in RefactoringService.Refactorings) { + if (refactoring.IsValid (options)) { + CommandInfo info = new CommandInfo (refactoring.GetMenuDescription (options)); + info.AccelKey = refactoring.AccelKey; + ciset.CommandInfos.Add (info, new Action (new RefactoringOperationWrapper (refactoring, options).Operation)); + } } - } - var refactoringInfo = doc.Annotation<RefactoringDocumentInfo> (); - if (refactoringInfo == null) { - refactoringInfo = new RefactoringDocumentInfo (); - doc.AddAnnotation (refactoringInfo); - } - var loc = doc.Editor.Caret.Location; - bool first = true; - if (refactoringInfo.lastDocument != doc.ParsedDocument || loc != lastLocation) { - try { - refactoringInfo.validActions = RefactoringService.GetValidActions (doc, loc, new CancellationTokenSource (500).Token); - } catch (TaskCanceledException) { - } catch (AggregateException ae) { - ae.Flatten ().Handle (x => x is TaskCanceledException); + var refactoringInfo = doc.Annotation<RefactoringDocumentInfo> (); + if (refactoringInfo == null) { + refactoringInfo = new RefactoringDocumentInfo (); + doc.AddAnnotation (refactoringInfo); } + var loc = doc.Editor.Caret.Location; + bool first = true; + if (refactoringInfo.lastDocument != doc.ParsedDocument || loc != lastLocation) { + try { + refactoringInfo.validActions = RefactoringService.GetValidActions (doc, loc, new CancellationTokenSource (500).Token); + } catch (TaskCanceledException) { + } catch (AggregateException ae) { + ae.Flatten ().Handle (x => x is TaskCanceledException); + } - lastLocation = loc; - refactoringInfo.lastDocument = doc.ParsedDocument; - } - if (refactoringInfo.validActions != null && refactoringInfo.lastDocument != null && refactoringInfo.lastDocument.CreateRefactoringContext != null) { - var context = refactoringInfo.lastDocument.CreateRefactoringContext (doc, CancellationToken.None); + lastLocation = loc; + refactoringInfo.lastDocument = doc.ParsedDocument; + } + if (refactoringInfo.validActions != null && refactoringInfo.lastDocument != null && refactoringInfo.lastDocument.CreateRefactoringContext != null) { + var context = refactoringInfo.lastDocument.CreateRefactoringContext (doc, CancellationToken.None); - foreach (var fix_ in refactoringInfo.validActions.OrderByDescending (i => Tuple.Create (CodeActionEditorExtension.IsAnalysisOrErrorFix(i), (int)i.Severity, CodeActionEditorExtension.GetUsage (i.IdString)))) { - if (CodeActionEditorExtension.IsAnalysisOrErrorFix (fix_)) - continue; - var fix = fix_; - if (first) { - first = false; - if (ciset.CommandInfos.Count > 0) - ciset.CommandInfos.AddSeparator (); - } + foreach (var fix_ in refactoringInfo.validActions.OrderByDescending (i => Tuple.Create (CodeActionEditorExtension.IsAnalysisOrErrorFix(i), (int)i.Severity, CodeActionEditorExtension.GetUsage (i.IdString)))) { + if (CodeActionEditorExtension.IsAnalysisOrErrorFix (fix_)) + continue; + var fix = fix_; + if (first) { + first = false; + if (ciset.CommandInfos.Count > 0) + ciset.CommandInfos.AddSeparator (); + } - ciset.CommandInfos.Add (fix.Title, new Action (() => RefactoringService.ApplyFix (fix, context))); + ciset.CommandInfos.Add (fix.Title, new Action (() => RefactoringService.ApplyFix (fix, context))); + } } } - if (ciset.CommandInfos.Count > 0) { ainfo.Add (ciset, null); added = true; diff --git a/version.config b/version.config index 8d1e28b863..1958f9fd72 100644 --- a/version.config +++ b/version.config @@ -1,3 +1,3 @@ -Version=5.9.6 -Label=5.9.6 +Version=5.9.7 +Label=5.9.7 CompatVersion=5.0 |