Browse Source

Make DisplayBindingService public.

Change keyboard shortcut for debug-mode code completion to Ctrl+Space+Alt+Dot (debug builds only).

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3813 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 17 years ago
parent
commit
aa5981c5c8
  1. 4
      src/Libraries/NRefactory/Project/Src/OperatorPrecedence.cs
  2. 11
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/DerivedTypesNode.cs
  3. 9
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs
  4. 16
      src/Main/Base/Project/Src/Services/DisplayBinding/DisplayBindingService.cs
  5. 2
      src/Main/Base/Project/Src/Services/DisplayBinding/ExternalProcessDisplayBinding.cs
  6. 2
      src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs
  7. 2
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs
  8. 8
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs

4
src/Libraries/NRefactory/Project/Src/OperatorPrecedence.cs

@ -73,8 +73,8 @@ namespace ICSharpCode.NRefactory
public static int ComparePrecedenceCSharp(BinaryOperatorType op1, BinaryOperatorType op2) public static int ComparePrecedenceCSharp(BinaryOperatorType op1, BinaryOperatorType op2)
{ {
int p1 = GetOperatorPrecedence(vbDict, op1); int p1 = GetOperatorPrecedence(csharpDict, op1);
int p2 = GetOperatorPrecedence(vbDict, op2); int p2 = GetOperatorPrecedence(csharpDict, op2);
return p1.CompareTo(p2); return p1.CompareTo(p2);
} }

11
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/DerivedTypesNode.cs

@ -57,19 +57,18 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
base.Initialize(); base.Initialize();
Nodes.Clear(); Nodes.Clear();
List<IProjectContent> contentList = new List<IProjectContent>(1); List<IProjectContent> contentList = new List<IProjectContent>();
contentList.Add(null);
if (ProjectService.OpenSolution != null) { if (ProjectService.OpenSolution != null) {
foreach (IProject project in ProjectService.OpenSolution.Projects) { foreach (IProject project in ProjectService.OpenSolution.Projects) {
IProjectContent projectContent = ParserService.GetProjectContent(project); IProjectContent projectContent = ParserService.GetProjectContent(project);
if (projectContent != null) { if (projectContent != null) {
contentList[0] = projectContent; contentList.Add(projectContent);
foreach (IClass derivedClass in RefactoringService.FindDerivedClasses(c, contentList, true)) {
new ClassNode(project, derivedClass).AddTo(this);
}
} }
} }
} }
foreach (IClass derivedClass in RefactoringService.FindDerivedClasses(c, contentList, true)) {
new ClassNode(project, derivedClass).AddTo(this);
}
if (Nodes.Count == 0) { if (Nodes.Count == 0) {
SetIcon(ClosedIcon); SetIcon(ClosedIcon);

9
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -329,7 +329,14 @@ namespace ICSharpCode.SharpDevelop.Gui
public void ShowView(IViewContent content, bool switchToOpenedView) public void ShowView(IViewContent content, bool switchToOpenedView)
{ {
System.Diagnostics.Debug.Assert(layout != null); if (content == null)
throw new ArgumentNullException("content");
if (content.WorkbenchWindow != null)
throw new ArgumentException("Cannot show view content that is already visible in another workbench window");
if (layout == null)
throw new InvalidOperationException("No layout is attached.");
primaryViewContentCollection.Add(content); primaryViewContentCollection.Add(content);
if (PropertyService.Get("SharpDevelop.LoadDocumentProperties", true) && content is IMementoCapable) { if (PropertyService.Get("SharpDevelop.LoadDocumentProperties", true) && content is IMementoCapable) {
try { try {

16
src/Main/Base/Project/Src/Services/DisplayBinding/DisplayBindingService.cs

@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop
/// This class handles the installed display bindings /// This class handles the installed display bindings
/// and provides a simple access point to these bindings. /// and provides a simple access point to these bindings.
/// </summary> /// </summary>
internal static class DisplayBindingService public static class DisplayBindingService
{ {
const string displayBindingPath = "/SharpDevelop/Workbench/DisplayBindings"; const string displayBindingPath = "/SharpDevelop/Workbench/DisplayBindings";
@ -39,6 +39,7 @@ namespace ICSharpCode.SharpDevelop
public static DisplayBindingDescriptor AddExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding) public static DisplayBindingDescriptor AddExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
{ {
WorkbenchSingleton.AssertMainThread();
if (binding == null) if (binding == null)
throw new ArgumentNullException("binding"); throw new ArgumentNullException("binding");
DisplayBindingDescriptor descriptor = AddExternalProcessDisplayBindingInternal(binding); DisplayBindingDescriptor descriptor = AddExternalProcessDisplayBindingInternal(binding);
@ -64,6 +65,7 @@ namespace ICSharpCode.SharpDevelop
public static void RemoveExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding) public static void RemoveExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
{ {
WorkbenchSingleton.AssertMainThread();
if (binding == null) if (binding == null)
throw new ArgumentNullException("binding"); throw new ArgumentNullException("binding");
if (!externalProcessDisplayBindings.Remove(binding)) if (!externalProcessDisplayBindings.Remove(binding))
@ -83,6 +85,7 @@ namespace ICSharpCode.SharpDevelop
/// </summary> /// </summary>
public static IDisplayBinding GetBindingPerFileName(string filename) public static IDisplayBinding GetBindingPerFileName(string filename)
{ {
WorkbenchSingleton.AssertMainThread();
DisplayBindingDescriptor codon = GetDefaultCodonPerFileName(filename); DisplayBindingDescriptor codon = GetDefaultCodonPerFileName(filename);
return codon == null ? null : codon.Binding; return codon == null ? null : codon.Binding;
} }
@ -92,6 +95,8 @@ namespace ICSharpCode.SharpDevelop
/// </summary> /// </summary>
public static DisplayBindingDescriptor GetDefaultCodonPerFileName(string filename) public static DisplayBindingDescriptor GetDefaultCodonPerFileName(string filename)
{ {
WorkbenchSingleton.AssertMainThread();
string defaultCommandID = displayBindingServiceProperties.Get("Default" + Path.GetExtension(filename).ToLowerInvariant()) as string; string defaultCommandID = displayBindingServiceProperties.Get("Default" + Path.GetExtension(filename).ToLowerInvariant()) as string;
if (!string.IsNullOrEmpty(defaultCommandID)) { if (!string.IsNullOrEmpty(defaultCommandID)) {
foreach (DisplayBindingDescriptor binding in bindings) { foreach (DisplayBindingDescriptor binding in bindings) {
@ -113,11 +118,12 @@ namespace ICSharpCode.SharpDevelop
public static void SetDefaultCodon(string extension, DisplayBindingDescriptor bindingDescriptor) public static void SetDefaultCodon(string extension, DisplayBindingDescriptor bindingDescriptor)
{ {
WorkbenchSingleton.AssertMainThread();
if (bindingDescriptor == null) if (bindingDescriptor == null)
throw new ArgumentNullException("bindingDescriptor"); throw new ArgumentNullException("bindingDescriptor");
if (extension == null) if (extension == null)
throw new ArgumentNullException("extension"); throw new ArgumentNullException("extension");
if (!extension.StartsWith(".")) if (!extension.StartsWith(".", StringComparison.Ordinal))
throw new ArgumentException("extension must start with '.'"); throw new ArgumentException("extension must start with '.'");
displayBindingServiceProperties.Set("Default" + extension.ToLowerInvariant(), bindingDescriptor.Id); displayBindingServiceProperties.Set("Default" + extension.ToLowerInvariant(), bindingDescriptor.Id);
@ -128,6 +134,8 @@ namespace ICSharpCode.SharpDevelop
/// </summary> /// </summary>
public static IList<DisplayBindingDescriptor> GetCodonsPerFileName(string filename) public static IList<DisplayBindingDescriptor> GetCodonsPerFileName(string filename)
{ {
WorkbenchSingleton.AssertMainThread();
List<DisplayBindingDescriptor> list = new List<DisplayBindingDescriptor>(); List<DisplayBindingDescriptor> list = new List<DisplayBindingDescriptor>();
foreach (DisplayBindingDescriptor binding in bindings) { foreach (DisplayBindingDescriptor binding in bindings) {
if (IsPrimaryBindingValidForFileName(binding, filename)) { if (IsPrimaryBindingValidForFileName(binding, filename)) {
@ -154,6 +162,10 @@ namespace ICSharpCode.SharpDevelop
/// <param name="isReattaching">This is a reattaching pass</param> /// <param name="isReattaching">This is a reattaching pass</param>
public static void AttachSubWindows(IViewContent viewContent, bool isReattaching) public static void AttachSubWindows(IViewContent viewContent, bool isReattaching)
{ {
WorkbenchSingleton.AssertMainThread();
if (viewContent == null)
throw new ArgumentNullException("viewContent");
foreach (DisplayBindingDescriptor binding in bindings) { foreach (DisplayBindingDescriptor binding in bindings) {
if (binding.IsSecondary && binding.CanOpenFile(viewContent.PrimaryFileName)) { if (binding.IsSecondary && binding.CanOpenFile(viewContent.PrimaryFileName)) {
ISecondaryDisplayBinding displayBinding = binding.SecondaryBinding; ISecondaryDisplayBinding displayBinding = binding.SecondaryBinding;

2
src/Main/Base/Project/Src/Services/DisplayBinding/ExternalProcessDisplayBinding.cs

@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop
/// Display binding for opening a file in an external process. /// Display binding for opening a file in an external process.
/// </summary> /// </summary>
[TypeConverter(typeof(ExternalProcessDisplayBindingConverter))] [TypeConverter(typeof(ExternalProcessDisplayBindingConverter))]
sealed class ExternalProcessDisplayBinding : IDisplayBinding public sealed class ExternalProcessDisplayBinding : IDisplayBinding
{ {
public string FileExtension { get; set; } public string FileExtension { get; set; }
public string CommandLine { get; set; } public string CommandLine { get; set; }

2
src/Main/Base/Project/Src/Services/RefactoringService/RefactoringService.cs

@ -159,7 +159,7 @@ namespace ICSharpCode.SharpDevelop.Refactoring
progressMonitor.BeginTask("${res:SharpDevelop.Refactoring.FindingReferences}", files.Count, true); progressMonitor.BeginTask("${res:SharpDevelop.Refactoring.FindingReferences}", files.Count, true);
} }
#if DEBUG #if DEBUG
if (System.Windows.Forms.Control.ModifierKeys == System.Windows.Forms.Keys.Control) { if (System.Windows.Forms.Control.ModifierKeys == DefaultEditor.Gui.Editor.SharpDevelopTextAreaControl.DebugBreakModifiers) {
System.Diagnostics.Debugger.Break(); System.Diagnostics.Debugger.Break();
} }
#endif #endif

2
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/CodeCompletionDataProvider.cs

@ -50,7 +50,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
} }
#if DEBUG #if DEBUG
public bool DebugMode = false; internal bool DebugMode = false;
#endif #endif
protected void GenerateCompletionData(TextArea textArea, ExpressionResult expressionResult) protected void GenerateCompletionData(TextArea textArea, ExpressionResult expressionResult)

8
src/Main/Base/Project/Src/TextEditor/Gui/Editor/SharpDevelopTextAreaControl.cs

@ -208,11 +208,15 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
} }
} }
#if DEBUG
internal const Keys DebugBreakModifiers = Keys.Control | Keys.Shift | Keys.Alt;
#endif
void GenerateEditActions() void GenerateEditActions()
{ {
#if DEBUG #if DEBUG
editactions[Keys.Control | Keys.OemPeriod] = new DebugDotCompletionAction(); editactions[DebugBreakModifiers | Keys.OemPeriod] = new DebugDotCompletionAction();
editactions[Keys.Control | Keys.Shift | Keys.Space] = new DebugCtrlSpaceCodeCompletionAction(); editactions[DebugBreakModifiers | Keys.Space] = new DebugCtrlSpaceCodeCompletionAction();
#endif #endif
try { try {
IEditAction[] actions = (IEditAction[])(AddInTree.GetTreeNode(editActionsPath).BuildChildItems(this)).ToArray(typeof(IEditAction)); IEditAction[] actions = (IEditAction[])(AddInTree.GetTreeNode(editActionsPath).BuildChildItems(this)).ToArray(typeof(IEditAction));

Loading…
Cancel
Save