diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
index 05333620cd..8f20aeb189 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/CSharpBinding.addin
@@ -6,6 +6,8 @@
+
+
@@ -116,6 +118,14 @@
class = "CSharpBinding.CSharpProjectBinding" />
+
+
+
+
+
+
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs
index 5e05e65704..c00ba7a696 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/ExtensionMethods.cs
@@ -32,7 +32,7 @@ namespace CSharpBinding
var parseInfo = (await ec.GetParseInformationAsync().ConfigureAwait(false)) as CSharpFullParseInformation;
var compilation = await ec.GetCompilationAsync().ConfigureAwait(false);
if (parseInfo != null)
- return new CSharpAstResolver(compilation, parseInfo.CompilationUnit, parseInfo.ParsedFile);
+ return parseInfo.GetResolver(compilation);
else
return new CSharpAstResolver(compilation, new CompilationUnit(), new CSharpParsedFile(ec.FileName));
});
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeActionProviderDoozer.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeActionProviderDoozer.cs
index 7b203cace3..92ac010efe 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeActionProviderDoozer.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeActionProviderDoozer.cs
@@ -76,7 +76,8 @@ namespace CSharpBinding.Refactoring
}
public string Category {
- get { return attribute.Category; }
+ get { return string.IsNullOrEmpty(attribute.Category) ? attribute.Title[0].ToString() : attribute.Category; }
+ // get { return attribute.Category ?? string.Empty; }
}
public bool AllowHiding {
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin
index 75f8361b56..17ff4cdd7a 100755
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin
@@ -11,6 +11,7 @@
+
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
index ffb5b9e4b1..fad33ab8b8 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.csproj
@@ -72,6 +72,11 @@
+
+
+ ContextActionOptions.xaml
+ Code
+
ContextActionsBulbControl.xaml
@@ -199,6 +204,7 @@
+
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptionPanelDoozer.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptionPanelDoozer.cs
new file mode 100644
index 0000000000..580fdcdd6e
--- /dev/null
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptionPanelDoozer.cs
@@ -0,0 +1,86 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
+// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using ICSharpCode.Core;
+using ICSharpCode.NRefactory;
+using ICSharpCode.SharpDevelop;
+using ICSharpCode.SharpDevelop.Refactoring;
+
+namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
+{
+ ///
+ /// Creates IOptionPanelDescriptor objects that are used in option dialogs.
+ ///
+ ///
+ /// AddInTree-path that contains the IContextActionProviders.
+ ///
+ ///
+ /// Caption of the dialog panel.
+ ///
+ ///
+ /// In the SharpDevelop options, option pages can have subpages by specifying them
+ /// as children in the AddInTree.
+ ///
+ /// In /SharpDevelop/BackendBindings/ProjectOptions/ and /SharpDevelop/Dialogs/OptionsDialog
+ ///
+ /// IOptionPanelDescriptor object.
+ ///
+ public class ContextActionOptionPanelDoozer : IDoozer
+ {
+ public bool HandleConditions {
+ get { return false; }
+ }
+
+ public object BuildItem(BuildItemArgs args)
+ {
+ return new ContextActionOptionPanelDescriptor(args.Codon);
+ }
+
+ sealed class ContextActionOptionPanelDescriptor : IOptionPanelDescriptor
+ {
+ readonly string id;
+ readonly string label;
+ readonly string path;
+
+ public ContextActionOptionPanelDescriptor(Codon codon)
+ {
+ this.id = codon.Id;
+ this.path = codon.Properties["path"];
+ this.label = codon.Properties["label"];
+ if (string.IsNullOrEmpty(label))
+ label = "Context Actions"; // TODO: Translate
+ }
+
+ public string ID {
+ get { return this.id; }
+ }
+
+ public string Label {
+ get { return this.label; }
+ }
+
+ public IEnumerable ChildOptionPanelDescriptors {
+ get { return EmptyList.Instance; }
+ }
+
+ IOptionPanel optionPanel;
+
+ public IOptionPanel OptionPanel {
+ get {
+ if (optionPanel == null) {
+ var providers = AddInTree.BuildItems(path, null, false);
+ optionPanel = new ContextActionOptions(providers.Where(p => p.AllowHiding));
+ }
+ return optionPanel;
+ }
+ }
+
+ public bool HasOptionPanel {
+ get { return true; }
+ }
+ }
+ }
+}
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptions.xaml b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptions.xaml
new file mode 100644
index 0000000000..db24cbdec8
--- /dev/null
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptions.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptions.xaml.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptions.xaml.cs
new file mode 100644
index 0000000000..af838b5706
--- /dev/null
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/ContextActionOptions.xaml.cs
@@ -0,0 +1,56 @@
+// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
+// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using ICSharpCode.SharpDevelop.Gui;
+using ICSharpCode.SharpDevelop.Refactoring;
+
+namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
+{
+ ///
+ /// Interaction logic for ContextActionOptions.xaml
+ ///
+ public partial class ContextActionOptions : OptionPanel
+ {
+ readonly IContextActionProvider[] providers;
+
+ public ContextActionOptions(IEnumerable providers)
+ {
+ InitializeComponent();
+ this.providers = providers.ToArray();
+ listBox.ItemsSource = this.providers;
+ }
+
+ public override void LoadOptions()
+ {
+ base.LoadOptions();
+ EditorActionsProvider.LoadProviderVisibilities(providers);
+ listBox.UnselectAll();
+ foreach (var provider in providers) {
+ if (provider.IsVisible)
+ listBox.SelectedItems.Add(provider);
+ }
+ }
+
+ public override bool SaveOptions()
+ {
+ foreach (var provider in providers) {
+ provider.IsVisible = false;
+ }
+ foreach (IContextActionProvider provider in listBox.SelectedItems) {
+ provider.IsVisible = true;
+ }
+ EditorActionsProvider.SaveProviderVisibilities(providers);
+ return base.SaveOptions();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/EditorActionsProvider.cs b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/EditorActionsProvider.cs
index c3bbc9faca..a21526b708 100644
--- a/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/EditorActionsProvider.cs
+++ b/src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/EditorActionsProvider.cs
@@ -24,12 +24,16 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
///
const string PropertyServiceKey = "DisabledContextActionProviders";
- static List LoadProviderVisibilities()
+ internal static void LoadProviderVisibilities(IEnumerable providers)
{
- return PropertyService.Get(PropertyServiceKey, new List());
+ var list = PropertyService.Get(PropertyServiceKey, new List());
+ var disabledActions = new HashSet(list);
+ foreach (var provider in providers) {
+ provider.IsVisible = !(provider.AllowHiding && disabledActions.Contains(provider.ID));
+ }
}
- static void SaveProviderVisibilities(IEnumerable providers)
+ internal static void SaveProviderVisibilities(IEnumerable providers)
{
List disabledProviders = providers.Where(p => !p.IsVisible).Select(p => p.ID).ToList();
PropertyService.Set(PropertyServiceKey, disabledProviders);
@@ -50,11 +54,6 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
throw new ArgumentNullException("providers");
this.providers = providers;
this.editorContext = editorContext;
-
- var disabledActions = new HashSet(LoadProviderVisibilities());
- foreach (var provider in providers) {
- provider.IsVisible = !disabledActions.Contains(provider.ID);
- }
}
public Task> GetVisibleActionsAsync(CancellationToken cancellationToken)
diff --git a/src/Main/Base/Project/Src/Internal/Doozers/IOptionPanelDescriptor.cs b/src/Main/Base/Project/Src/Internal/Doozers/IOptionPanelDescriptor.cs
index f2b3e5cd3f..508441edf6 100644
--- a/src/Main/Base/Project/Src/Internal/Doozers/IOptionPanelDescriptor.cs
+++ b/src/Main/Base/Project/Src/Internal/Doozers/IOptionPanelDescriptor.cs
@@ -18,10 +18,7 @@ namespace ICSharpCode.SharpDevelop
///
/// Returns the label of the dialog panel
///
- string Label {
- get;
- set;
- }
+ string Label { get; }
///
/// The child dialog panels (e.g. for treeviews)
diff --git a/src/Main/Base/Project/Src/Project/IProject.cs b/src/Main/Base/Project/Src/Project/IProject.cs
index d6a7a4826b..496ef876ae 100644
--- a/src/Main/Base/Project/Src/Project/IProject.cs
+++ b/src/Main/Base/Project/Src/Project/IProject.cs
@@ -213,12 +213,10 @@ namespace ICSharpCode.SharpDevelop.Project
///
bool IsStartable { get; }
- /*
///
/// Gets project specific properties.
///
Properties ProjectSpecificProperties { get; }
- */
///
/// Starts the project.