Browse Source

Context actions - some cleanup.

pull/16/merge
mkonicek 14 years ago
parent
commit
245d09dfa8
  1. 9
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraphControl.xaml.cs
  2. 16
      src/AddIns/Debugger/Debugger.AddIn/Visualizers/GridVisualizer/GridVisualizerWindow.xaml.cs
  3. 5
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextAction.cs
  4. 5
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsHelper.cs
  5. 2
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsPopup.cs
  6. 1
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsService.cs
  7. 2
      src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/IContextActionsProvider.cs

9
src/AddIns/Debugger/Debugger.AddIn/Visualizers/Graph/ObjectGraphControl.xaml.cs

@ -38,7 +38,7 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -38,7 +38,7 @@ namespace Debugger.AddIn.Visualizers.Graph
static double mouseWheelZoomSpeed = 0.05;
/// <summary> Long-lived map telling which graph nodes and content nodes the user expanded. </summary>
/// <summary> Tells which graph nodes and content nodes the user expanded. </summary>
static Expanded expanded = new Expanded();
public ObjectGraphControl()
@ -62,10 +62,6 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -62,10 +62,6 @@ namespace Debugger.AddIn.Visualizers.Graph
public void Refresh()
{
// Almost all of the blocking is done ContentPropertyNode.Evaluate,
// which is being called by WPF for all the properties.
// It would be better if we were filling the node texts ourselves in a loop,
// so that we could cancel any time. UI would redraw gradually thanks to INotifyPropertyChanged.
try {
Debugger.AddIn.TreeModel.Utils.DoEvents(debuggerService.DebuggedProcess);
} catch(AbortedBecauseDebuggeeResumedException) {
@ -80,7 +76,6 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -80,7 +76,6 @@ namespace Debugger.AddIn.Visualizers.Graph
return;
}
if (debuggerService.IsProcessRunning) {
// "Process not paused" exception still occurs
ErrorMessage("Cannot inspect when the process is running.");
return;
}
@ -166,7 +161,6 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -166,7 +161,6 @@ namespace Debugger.AddIn.Visualizers.Graph
{
this.txtError.Text = message;
this.pnlError.Visibility = Visibility.Visible;
//MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Error);
}
void RegisterExpandCollapseEvents(PositionedGraph posGraph)
@ -197,7 +191,6 @@ namespace Debugger.AddIn.Visualizers.Graph @@ -197,7 +191,6 @@ namespace Debugger.AddIn.Visualizers.Graph
expanded.Expressions.SetExpanded(e.Property.Expression);
// add edge (+ possibly nodes) to underlying object graph (no need to fully rebuild)
// TODO can add more nodes if they are expanded - now this adds always one node
e.Property.ObjectGraphProperty.TargetNode = this.objectGraphBuilder.ObtainNodeForExpression(e.Property.Expression);
LayoutGraph(this.objectGraph);
}

16
src/AddIns/Debugger/Debugger.AddIn/Visualizers/GridVisualizer/GridVisualizerWindow.xaml.cs

@ -13,11 +13,11 @@ using System.Windows.Data; @@ -13,11 +13,11 @@ using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using Debugger.AddIn.TreeModel;
using Debugger.AddIn.Visualizers.PresentationBindings;
using Debugger.AddIn.Visualizers.Utils;
using Debugger.MetaData;
using ICSharpCode.Core;
using ICSharpCode.NRefactory.Ast;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Debugging;
@ -117,8 +117,8 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer @@ -117,8 +117,8 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer
try {
shownExpr = debuggerService.GetExpression(txtExpression.Text);
shownValue = shownExpr.Evaluate(debuggerService.DebuggedProcess);
} catch(GetValueException) {
// display ex.Message
} catch(GetValueException e) {
MessageService.ShowMessage(e.Message);
}
if (shownValue != null && !shownValue.IsNull) {
GridValuesProvider gridValuesProvider;
@ -134,7 +134,7 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer @@ -134,7 +134,7 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer
var debugListExpression = DebuggerHelpers.CreateDebugListExpression(shownExpr, itemType, out debugListType);
gridValuesProvider = CreateListValuesProvider(debugListExpression, itemType);
} else {
// Value cannot be displayed in GridVisualizer
// Not IList or IEnumerable<T> - can't be displayed in GridVisualizer
return;
}
}
@ -144,10 +144,10 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer @@ -144,10 +144,10 @@ namespace Debugger.AddIn.Visualizers.GridVisualizer
this.columnHider = new GridViewColumnHider((GridView)this.listView.View);
cmbColumns.ItemsSource = this.columnHider.HideableColumns;
}
} catch (GetValueException) {
// display ex msg
} catch (DebuggerVisualizerException) {
// display ex msg
} catch (GetValueException e) {
MessageService.ShowMessage(e.Message);
} catch (DebuggerVisualizerException e) {
MessageService.ShowMessage(e.Message);
}
}

5
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextAction.cs

@ -7,7 +7,8 @@ using System.Collections.Generic; @@ -7,7 +7,8 @@ using System.Collections.Generic;
namespace ICSharpCode.SharpDevelop.Refactoring
{
/// <summary>
/// Base class for implementing custom context actions.
/// Base class for implementing one context action.
/// Useful for implementing <see cref="IContextActionsProvider" /> that provides just one action - common scenario.
/// </summary>
public abstract class ContextAction : IContextActionsProvider, IContextAction
{
@ -23,7 +24,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -23,7 +24,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring
public IEnumerable<IContextAction> GetAvailableActions(EditorContext context)
{
// re-initialize the context
this.Context = context;
if (this.IsAvailable(context))
yield return this;
@ -31,7 +31,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -31,7 +31,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring
public void Execute()
{
// context was re-initialized in GetAvailableActions
Execute(this.Context);
}
}

5
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsHelper.cs

@ -13,10 +13,7 @@ using ICSharpCode.SharpDevelop.Refactoring; @@ -13,10 +13,7 @@ using ICSharpCode.SharpDevelop.Refactoring;
namespace ICSharpCode.SharpDevelop.Refactoring
{
/// <summary>
/// Description of ContextCommandsHelper.
/// </summary>
public class ContextActionsHelper
public class ContextActionsPopupHelper
{
public static ContextActionsPopup MakePopupWithDerivedClasses(IClass baseClass)
{

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

@ -57,8 +57,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -57,8 +57,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring
OpenAtMousePosition();
return;
}
// Should look if symbol under caret is the same as this.Symbol, so that when opened from class browser, popup opens at mouse pos
//var rr = ParserService.Resolve(currentEditor.Caret.Offset, currentEditor.Document, currentEditor.FileName);
OpenAtPosition(currentEditor, currentEditor.Caret.Line, currentEditor.Caret.Column, true);
this.Focus();
}

1
src/Main/Base/Project/Src/Services/RefactoringService/ContextActions/ContextActionsService.cs

@ -113,7 +113,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring @@ -113,7 +113,6 @@ namespace ICSharpCode.SharpDevelop.Refactoring
{
if (ParserService.LoadSolutionProjectsThreadRunning)
yield break;
// could run providers in parallel
foreach (var provider in providers) {
foreach (var action in provider.GetAvailableActions(this.EditorContext)) {

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

@ -9,7 +9,7 @@ using ICSharpCode.SharpDevelop.Refactoring; @@ -9,7 +9,7 @@ using ICSharpCode.SharpDevelop.Refactoring;
namespace ICSharpCode.SharpDevelop.Refactoring
{
/// <summary>
/// Provides <see cref="ContextAction" />s to appear in a popup on the left side of the editor.
/// Provides a set of refactoring <see cref="ContextAction" />s.
/// </summary>
public interface IContextActionsProvider
{

Loading…
Cancel
Save