Browse Source

Merge branch 'master' of github.com:icsharpcode/SharpDevelop

pull/567/head
Peter Forstmeier 11 years ago
parent
commit
93cdccbca4
  1. 12
      data/resources/StringResources.resx
  2. 11
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs
  3. 24
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpEventBindingService.cs
  4. 1
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/ICSharpDesignerLoaderContext.cs
  5. 7
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeGenerator.cs
  6. 5
      src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj
  7. 45
      src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml
  8. 49
      src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml.cs
  9. 5
      src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptions.cs
  10. 5
      src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptionsPanel.xaml
  11. 22
      src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptionsPanel.xaml.cs
  12. 51
      src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs
  13. 53
      src/AddIns/Debugger/Debugger.Core/Options.cs
  14. 1
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin
  15. 7
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeCompletionEditorAdapter.cs
  16. 14
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/FindBaseClasses.cs
  17. 12
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/FindDerivedClassesOrOverrides.cs
  18. 13
      src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopInsightWindow.cs
  19. 2
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  20. 15
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelSelectionHandler.cs
  21. 108
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PartialPanelSelectionHandler.cs
  22. 1
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj
  23. 6
      src/Main/Base/Project/Debugging/IDebuggerService.cs
  24. 46
      src/Main/Base/Project/Src/Gui/Dialogs/TreeViewOptionsDialog.xaml.cs

12
data/resources/StringResources.resx

@ -8204,4 +8204,16 @@ a line break</value> @@ -8204,4 +8204,16 @@ a line break</value>
<data name="Dialog.Options.IDEOptions.CodeCompletion.CommitOnTabEnterOnly" xml:space="preserve">
<value>Only insert selected code completion entry by typing &lt;Tab&gt; or &lt;Enter&gt;.</value>
</data>
<data name="Dialog.Options.IDEOptions.Debugging.ExceptionFilterTitle" xml:space="preserve">
<value>Choose exceptions you want the debugger to break on</value>
</data>
<data name="Dialog.Options.IDEOptions.Debugging.ExceptionFilter.ColumnIsActive" xml:space="preserve">
<value>Break on</value>
</data>
<data name="Dialog.Options.IDEOptions.Debugging.ExceptionFilter.ColumnExpression" xml:space="preserve">
<value>Exception name expression (wildcards are allowed)</value>
</data>
<data name="Dialog.Options.IDEOptions.Debugging.ChooseExceptions" xml:space="preserve">
<value>Choose exceptions</value>
</data>
</root>

11
src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpDesignerGenerator.cs

@ -297,9 +297,14 @@ namespace CSharpBinding.FormsDesigner @@ -297,9 +297,14 @@ namespace CSharpBinding.FormsDesigner
void CreateField(CodeMemberField newField)
{
// insert new field below InitializeComponents()
var bodyRegion = initializeComponents.BodyRegion;
// insert new field below the last field or InitializeComponents()
IField field = null;
if (formClass != null) {
field = formClass.Fields.LastOrDefault(f => string.Equals(f.Region.FileName,
initializeComponents.Region.FileName,
StringComparison.OrdinalIgnoreCase));
}
var bodyRegion = field != null ? field.BodyRegion : initializeComponents.BodyRegion;
DocumentScript script = GetScript(bodyRegion.FileName);
string newline = DocumentUtilities.GetLineTerminator(script.OriginalDocument, bodyRegion.BeginLine);
string indentation = DocumentUtilities.GetIndentation(script.OriginalDocument, bodyRegion.BeginLine);

24
src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/CSharpEventBindingService.cs

@ -24,10 +24,13 @@ using System.Reflection; @@ -24,10 +24,13 @@ using System.Reflection;
using System.Windows.Threading;
using ICSharpCode.Core;
using ICSharpCode.FormsDesigner.Gui.OptionPanels;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Project;
using CSharpBinding.Refactoring;
namespace CSharpBinding.FormsDesigner
@ -145,17 +148,26 @@ namespace CSharpBinding.FormsDesigner @@ -145,17 +148,26 @@ namespace CSharpBinding.FormsDesigner
var evtHandler = primary.GetMethods(m => m.Name == methodName, GetMemberOptions.IgnoreInheritedMembers).FirstOrDefault();
if (evtHandler == null) {
generator.InsertEventHandler(primary, methodName, evt, true);
}
else {
} else {
CSharpBinding.Parser.CSharpFullParseInformation parseInfo;
var node = evtHandler.GetDeclaration(out parseInfo) as MethodDeclaration;
var fileName = new FileName(evtHandler.Region.FileName);
var fileContentFinder = new ParseableFileContentFinder();
if (node != null && !node.Body.IsNull) {
var location = node.Body.FirstChild.StartLocation;
var firstStatement = node.Body.Children.OfType<Statement>().FirstOrDefault();
if (firstStatement != null)
if (firstStatement == null) {
var fileContent = fileContentFinder.Create(fileName);
var document = new ReadOnlyDocument(fileContent);
var offset = document.GetOffset(new TextLocation(location.Line + 1, 1));
var length = DocumentUtilities.GetWhitespaceAfter(fileContent, offset).Length;
location = new TextLocation(location.Line + 1, length + 1);
} else {
location = firstStatement.StartLocation;
// TODO : does not jump correctly...
SD.FileService.JumpToFilePosition(new FileName(evtHandler.Region.FileName), location.Line, location.Column);
}
SD.FileService.JumpToFilePosition(fileName, location.Line, location.Column);
}
}
}

1
src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormsDesigner/ICSharpDesignerLoaderContext.cs

@ -31,6 +31,7 @@ namespace CSharpBinding.FormsDesigner @@ -31,6 +31,7 @@ namespace CSharpBinding.FormsDesigner
CSharpFullParseInformation GetPrimaryFileParseInformation();
ICompilation GetCompilation();
IDocument GetDocument(FileName fileName);
/// <remarks>if lineNumber = 0 no jump is performed, but the active view content changes.</remarks>
void ShowSourceCode(int lineNumber = 0);
}
}

7
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeGenerator.cs

@ -105,13 +105,10 @@ namespace CSharpBinding.Refactoring @@ -105,13 +105,10 @@ namespace CSharpBinding.Refactoring
using (Script script = context.StartScript()) {
// FIXME : will not work properly if there are no members.
if (last == match) {
throw new NotImplementedException();
// TODO InsertWithCursor not implemented!
//script.InsertWithCursor("Insert event handler", Script.InsertPosition.End, decl).RunSynchronously();
script.InsertWithCursor("Insert event handler", Script.InsertPosition.End, decl).FireAndForget();
} else {
// TODO does not jump correctly...
script.InsertAfter(node, decl);
editor.JumpTo(throwStmt.StartLocation.Line, throwStmt.StartLocation.Column);
script.Select(throwStmt);
}
}
}

5
src/AddIns/Debugger/Debugger.AddIn/Debugger.AddIn.csproj

@ -105,6 +105,10 @@ @@ -105,6 +105,10 @@
<Compile Include="Breakpoints\CurrentLineBookmark.cs" />
<Compile Include="NRefactory\ExpressionEvaluationVisitor.cs" />
<Compile Include="NRefactory\ExpressionExtensionMethods.cs" />
<Compile Include="Options\ChooseExceptionsDialog.xaml.cs">
<DependentUpon>ChooseExceptionsDialog.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Options\DebuggingOptionsPanel.xaml.cs">
<DependentUpon>DebuggingOptionsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
@ -319,6 +323,7 @@ @@ -319,6 +323,7 @@
<Folder Include="Visualizers\TextVisualizer" />
<Folder Include="Visualizers\Utils" />
<Page Include="Breakpoints\BreakpointEditorPopup.xaml" />
<Page Include="Options\ChooseExceptionsDialog.xaml" />
<Page Include="Options\DebuggingOptionsPanel.xaml" />
<Page Include="Options\DebuggingSymbolsPanel.xaml" />
<Page Include="Pads\CommonResources.xaml" />

45
src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
<Window x:Class="Debugger.AddIn.Options.ChooseExceptionsDialog"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:AvalonEdit="http://icsharpcode.net/sharpdevelop/avalonedit"
Title="{core:Localize Dialog.Options.IDEOptions.Debugging.ExceptionFilterTitle}" Height="400" Width="600"
Style="{x:Static core:GlobalStyles.DialogWindowStyle}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="70"/>
<ColumnDefinition Width="70"/>
</Grid.ColumnDefinitions>
<core:RestrictDesiredSize Grid.ColumnSpan="3">
<DataGrid
x:Name="dataGrid"
SelectionMode="Single"
CanUserAddRows="True"
CanUserDeleteRows="True"
SelectionUnit="FullRow"
HeadersVisibility="Column"
CanUserResizeRows="False"
AutoGenerateColumns="False">
<DataGrid.Columns>
<DataGridCheckBoxColumn
Header="{core:Localize Dialog.Options.IDEOptions.Debugging.ExceptionFilter.ColumnIsActive}"
Binding="{Binding IsActive}" />
<DataGridTextColumn
Header="{core:Localize Dialog.Options.IDEOptions.Debugging.ExceptionFilter.ColumnExpression}"
Width="*"
Binding="{Binding Expression}" />
</DataGrid.Columns>
</DataGrid>
</core:RestrictDesiredSize>
<Button Margin="0,3,5,3" Grid.Row="1" Grid.Column="1" IsDefault="True" Click="Button_Click" Content="{core:Localize Global.OKButtonText}"></Button>
<Button Margin="0,3,5,3" Grid.Row="1" Grid.Column="2" IsCancel="True" Content="{core:Localize Global.CancelButtonText}"></Button>
</Grid>
</Window>

49
src/AddIns/Debugger/Debugger.AddIn/Options/ChooseExceptionsDialog.xaml.cs

@ -0,0 +1,49 @@ @@ -0,0 +1,49 @@
// Copyright (c) 2014 AlphaSierraPapa for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows;
using ICSharpCode.SharpDevelop.Gui;
namespace Debugger.AddIn.Options
{
/// <summary>
/// Interaction logic for ChooseExceptionsDialog.xaml
/// </summary>
public partial class ChooseExceptionsDialog : Window
{
public ChooseExceptionsDialog(IEnumerable<ExceptionFilterEntry> entries)
{
InitializeComponent();
FormLocationHelper.ApplyWindow(this, "Debugger.ChooseExceptionsDialog", true);
ExceptionFilterList = new ObservableCollection<ExceptionFilterEntry>(entries);
dataGrid.ItemsSource = ExceptionFilterList;
}
public IList<ExceptionFilterEntry> ExceptionFilterList { get; set; }
void Button_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
}
}
}

5
src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptions.cs

@ -85,6 +85,11 @@ namespace ICSharpCode.SharpDevelop.Services @@ -85,6 +85,11 @@ namespace ICSharpCode.SharpDevelop.Services
set { PS.Set<bool>("Debugger.PauseOnHandledExceptions", value); }
}
public override IEnumerable<ExceptionFilterEntry> ExceptionFilterList {
get { return PS.GetList<ExceptionFilterEntry>("Debugger.ExceptionFilterList"); }
set { PS.SetList<ExceptionFilterEntry>("Debugger.ExceptionFilterList", value); }
}
public bool AskForArguments {
get { return PS.Get<bool>("Debugger.AskForArguments", false); }
set { PS.Set<bool>("Debugger.AskForArguments", value); }

5
src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptionsPanel.xaml

@ -19,7 +19,12 @@ @@ -19,7 +19,12 @@
<GroupBox Margin="5" Header="{sd:Localize Dialog.Options.IDEOptions.Debugging.Exceptions}">
<widgets:StackPanelWithSpacing SpaceBetweenItems="5">
<CheckBox Content="{sd:Localize Dialog.Options.IDEOptions.Debugging.PauseOnHandledExceptions}"
x:Name="checkPauseOnHandled"
IsChecked="{sd:OptionBinding debugger:DebuggingOptions.PauseOnHandledExceptions}" />
<Button Content="{sd:Localize Dialog.Options.IDEOptions.Debugging.ChooseExceptions}"
Click="ChooseExceptionsClick"
HorizontalAlignment="Left"
IsEnabled="{Binding IsChecked, ElementName=checkPauseOnHandled}" />
</widgets:StackPanelWithSpacing>
</GroupBox>
<GroupBox Margin="5" Header="{sd:Localize Global.Advanced}">

22
src/AddIns/Debugger/Debugger.AddIn/Options/DebuggingOptionsPanel.xaml.cs

@ -27,6 +27,7 @@ using System.Windows.Documents; @@ -27,6 +27,7 @@ using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Services;
@ -37,6 +38,8 @@ namespace Debugger.AddIn.Options @@ -37,6 +38,8 @@ namespace Debugger.AddIn.Options
/// </summary>
public partial class DebuggingOptionsPanel : OptionPanel
{
IList<ExceptionFilterEntry> exceptionFilterList;
public DebuggingOptionsPanel()
{
InitializeComponent();
@ -47,7 +50,26 @@ namespace Debugger.AddIn.Options @@ -47,7 +50,26 @@ namespace Debugger.AddIn.Options
bool result = base.SaveOptions();
if (WindowsDebugger.CurrentDebugger != null)
WindowsDebugger.CurrentDebugger.ReloadOptions();
DebuggingOptions.Instance.ExceptionFilterList = exceptionFilterList;
return result;
}
public override void LoadOptions()
{
base.LoadOptions();
exceptionFilterList = DebuggingOptions.Instance.ExceptionFilterList.ToList();
if (exceptionFilterList.Count == 0) {
exceptionFilterList.Add(new ExceptionFilterEntry("*"));
}
}
void ChooseExceptionsClick(object sender, RoutedEventArgs e)
{
var dialog = new ChooseExceptionsDialog(exceptionFilterList);
if (dialog.ShowDialog() == true) {
exceptionFilterList = dialog.ExceptionFilterList;
}
}
}
}

51
src/AddIns/Debugger/Debugger.Core/ManagedCallback.cs

@ -19,7 +19,11 @@ @@ -19,7 +19,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using ICSharpCode.NRefactory.TypeSystem;
using Debugger.Interop;
using Debugger.Interop.CorDebug;
@ -540,19 +544,62 @@ namespace Debugger @@ -540,19 +544,62 @@ namespace Debugger
ExceptionType exceptionType = (ExceptionType)_exceptionType;
bool pauseOnHandled = !process.Evaluating && process.Options != null && process.Options.PauseOnHandledExceptions;
Thread thread = process.GetThread(pThread);
if (exceptionType == ExceptionType.Unhandled || (pauseOnHandled && exceptionType == ExceptionType.CatchHandlerFound)) {
if (exceptionType == ExceptionType.Unhandled || (pauseOnHandled && exceptionType == ExceptionType.CatchHandlerFound && BreakOnException(thread))) {
// Multiple exceptions can happen at the same time on multiple threads
// (I have managed to create a test application to trigger it)
Thread thread = process.GetThread(pThread);
thread.CurrentExceptionType = exceptionType;
RequestPause(thread).ExceptionsThrown.Add(thread);
}
ExitCallback();
}
Regex filterRegex;
static string ConvertWildcardsToRegex(string searchPattern)
{
if (string.IsNullOrEmpty(searchPattern))
return "";
StringBuilder builder = new StringBuilder();
foreach (char ch in searchPattern) {
switch (ch) {
case '?':
builder.Append(".");
break;
case '*':
builder.Append(".*");
break;
default:
builder.Append(Regex.Escape(ch.ToString()));
break;
}
}
return builder.ToString();
}
bool BreakOnException(Thread thread)
{
IType exceptionType = thread.CurrentException.Type;
if (filterRegex == null) {
var exceptionFilterList = thread.Process.Options.ExceptionFilterList.Where(i => i.IsActive).Select(s => "(" + ConvertWildcardsToRegex(s.Expression) + ")");
filterRegex = new Regex(string.Join("|", exceptionFilterList), RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.ExplicitCapture);
}
foreach (var baseType in exceptionType.GetNonInterfaceBaseTypes()) {
if (filterRegex.IsMatch(baseType.ReflectionName))
return true;
}
return false;
}
public void ExceptionUnwind(ICorDebugAppDomain pAppDomain, ICorDebugThread pThread, CorDebugExceptionUnwindCallbackType dwEventType, uint dwFlags)
{
EnterCallback("ExceptionUnwind", pThread);

53
src/AddIns/Debugger/Debugger.Core/Options.cs

@ -18,6 +18,7 @@ @@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
namespace Debugger
{
@ -32,5 +33,57 @@ namespace Debugger @@ -32,5 +33,57 @@ namespace Debugger
public virtual bool StepOverFieldAccessProperties { get; set; }
public virtual IEnumerable<string> SymbolsSearchPaths { get; set; }
public virtual bool PauseOnHandledExceptions { get; set; }
public virtual IEnumerable<ExceptionFilterEntry> ExceptionFilterList { get; set; }
}
[Serializable]
public class ExceptionFilterEntry : INotifyPropertyChanged
{
string expression;
bool isActive;
public ExceptionFilterEntry()
{
this.IsActive = true;
}
public ExceptionFilterEntry(string expression)
{
this.IsActive = true;
this.Expression = expression;
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
var propertyChanged = PropertyChanged;
if (propertyChanged != null)
propertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
public string Expression {
get {
return expression;
}
set {
if (expression != value) {
expression = value;
OnPropertyChanged("Expression");
}
}
}
public bool IsActive {
get {
return isActive;
}
set {
if (isActive != value) {
isActive = value;
OnPropertyChanged("IsActive");
}
}
}
}
}

1
src/AddIns/DisplayBindings/AvalonEdit.AddIn/AvalonEdit.AddIn.addin

@ -151,6 +151,7 @@ @@ -151,6 +151,7 @@
<MenuItem id = "FindBaseClassesOrMembers"
label = "${res:SharpDevelop.Refactoring.FindBaseClassesOrMembersCommand}"
shortcut="Control+F6"
icon="Icons.16x16.Interface"
class = "ICSharpCode.AvalonEdit.AddIn.ContextActions.FindBaseClassesOrMembers"/>
</Path>

7
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/CodeCompletionEditorAdapter.cs

@ -78,7 +78,12 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -78,7 +78,12 @@ namespace ICSharpCode.AvalonEdit.AddIn
}
public override IInsightWindow ActiveInsightWindow {
get { return textEditor.ActiveInsightWindow.activeAdapter; }
get {
if (textEditor.ActiveInsightWindow != null)
return textEditor.ActiveInsightWindow.activeAdapter;
else
return null;
}
}
public override ICompletionListWindow ActiveCompletionWindow {

14
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/FindBaseClasses.cs

@ -40,8 +40,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions @@ -40,8 +40,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
MakePopupWithBaseClasses((ITypeDefinition)entityUnderCaret).OpenAtCaretAndFocus();
return;
}
if (entityUnderCaret is IMember) {
MakePopupWithBaseMembers((IMember)entityUnderCaret).OpenAtCaretAndFocus();
var member = entityUnderCaret as IMember;
if (member != null) {
if ((member.SymbolKind == SymbolKind.Constructor) || (member.SymbolKind == SymbolKind.Destructor)) {
MakePopupWithBaseClasses(member.DeclaringTypeDefinition).OpenAtCaretAndFocus();
} else {
MakePopupWithBaseMembers(member).OpenAtCaretAndFocus();
}
return;
}
MessageService.ShowError("${res:ICSharpCode.Refactoring.NoClassOrMemberUnderCursorError}");
@ -67,12 +72,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions @@ -67,12 +72,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
static ContextActionsPopup MakePopupWithBaseMembers(IMember member)
{
var baseClassList = member.DeclaringTypeDefinition.GetAllBaseTypeDefinitions().Where(
baseClass => baseClass != member.DeclaringTypeDefinition).ToList();
baseClass => baseClass != member.DeclaringTypeDefinition).ToList();
var popupViewModel = new ContextActionsPopupViewModel {
Title = MenuService.ConvertLabel(StringParser.Parse(
"${res:SharpDevelop.Refactoring.BaseMembersOf}",
new StringTagPair("Name", member.FullName))
)};
)
};
popupViewModel.Actions = BuildBaseMemberListViewModel(member);
return new ContextActionsPopup { Actions = popupViewModel };
}

12
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/ContextActions/FindDerivedClassesOrOverrides.cs

@ -40,8 +40,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions @@ -40,8 +40,13 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
MakePopupWithDerivedClasses((ITypeDefinition)entityUnderCaret).OpenAtCaretAndFocus();
return;
}
if (entityUnderCaret is IMember && ((IMember)entityUnderCaret).IsOverridable) {
MakePopupWithOverrides((IMember)entityUnderCaret).OpenAtCaretAndFocus();
var member = entityUnderCaret as IMember;
if (member != null) {
if ((member.SymbolKind == SymbolKind.Constructor) || (member.SymbolKind == SymbolKind.Destructor)) {
MakePopupWithDerivedClasses(member.DeclaringTypeDefinition).OpenAtCaretAndFocus();
} else if (member.IsOverridable) {
MakePopupWithOverrides(member).OpenAtCaretAndFocus();
}
return;
}
MessageService.ShowError("${res:ICSharpCode.Refactoring.NoClassOrOverridableSymbolUnderCursorError}");
@ -80,7 +85,8 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions @@ -80,7 +85,8 @@ namespace ICSharpCode.AvalonEdit.AddIn.ContextActions
Title = MenuService.ConvertLabel(StringParser.Parse(
"${res:SharpDevelop.Refactoring.OverridesOf}",
new StringTagPair("Name", member.FullName))
)};
)
};
popupViewModel.Actions = new OverridesPopupTreeViewModelBuilder(member).BuildTreeViewModel(derivedClassesTree.Children);
return new ContextActionsPopup { Actions = popupViewModel };
}

13
src/AddIns/DisplayBindings/AvalonEdit.AddIn/Src/SharpDevelopInsightWindow.cs

@ -94,17 +94,24 @@ namespace ICSharpCode.AvalonEdit.AddIn @@ -94,17 +94,24 @@ namespace ICSharpCode.AvalonEdit.AddIn
void OnClosed(object sender, EventArgs e)
{
activeAdapter.OnClosed();
if (activeAdapter != null)
activeAdapter.OnClosed();
}
void caret_PositionChanged(object sender, EventArgs e)
{
activeAdapter.OnCaretPositionChanged(e);
// It is possible that the insight window is not initialized correctly
// due to an exception, and then caret_PositionChanged is called in a finally block
// during exception handling.
// Check for a null adapter to avoid a NullReferenceException that hides the first exception.
if (activeAdapter != null)
activeAdapter.OnCaretPositionChanged(e);
}
void document_Changed(object sender, DocumentChangeEventArgs e)
{
activeAdapter.OnDocumentChanged(e);
if (activeAdapter != null)
activeAdapter.OnDocumentChanged(e);
}
}

2
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs

@ -662,9 +662,11 @@ namespace ICSharpCode.FormsDesigner @@ -662,9 +662,11 @@ namespace ICSharpCode.FormsDesigner
this.DesignerCodeFile.IsDirty = isDirty;
}
/// <remarks>if lineNumber = 0 no jump is performed, but the active view content changes.</remarks>
public void ShowSourceCode(int lineNumber = 0)
{
this.WorkbenchWindow.ActiveViewContent = this.PrimaryViewContent;
if (lineNumber <= 0) return;
ITextEditor editor = this.primaryViewContent.GetService<ITextEditor>();
if (editor != null) {
editor.JumpTo(lineNumber, 1);

15
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PanelSelectionHandler.cs

@ -52,13 +52,13 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -52,13 +52,13 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
}
}
sealed class RangeSelectionGesture : ClickOrDragMouseGesture
internal class RangeSelectionGesture : ClickOrDragMouseGesture
{
DesignItem container;
AdornerPanel adornerPanel;
SelectionFrame selectionFrame;
protected DesignItem container;
protected AdornerPanel adornerPanel;
protected SelectionFrame selectionFrame;
GrayOutDesignerExceptActiveArea grayOut;
protected GrayOutDesignerExceptActiveArea grayOut;
public RangeSelectionGesture(DesignItem container)
{
@ -100,7 +100,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -100,7 +100,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
Math.Abs(startPoint.Y - endPoint.Y)
);
ICollection<DesignItem> items = GetChildDesignItemsInContainer(container, new RectangleGeometry(frameRect));
ICollection<DesignItem> items = GetChildDesignItemsInContainer(new RectangleGeometry(frameRect));
if (items.Count == 0) {
items.Add(container);
}
@ -109,8 +109,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions @@ -109,8 +109,7 @@ namespace ICSharpCode.WpfDesign.Designer.Extensions
Stop();
}
static ICollection<DesignItem> GetChildDesignItemsInContainer(
DesignItem container, Geometry geometry)
protected virtual ICollection<DesignItem> GetChildDesignItemsInContainer(Geometry geometry)
{
HashSet<DesignItem> resultItems = new HashSet<DesignItem>();
ViewService viewService = container.Services.View;

108
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/Extensions/PartialPanelSelectionHandler.cs

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
/*
* Created by SharpDevelop.
* User: trubra
* Date: 2014-08-06
* Time: 14:13
*
* To change this template use Tools | Options | Coding | Edit Standard Headers.
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.WpfDesign.Adorners;
using ICSharpCode.WpfDesign.Designer.Controls;
using ICSharpCode.WpfDesign.Designer.Services;
using ICSharpCode.WpfDesign.Extensions;
namespace ICSharpCode.WpfDesign.Designer.Extensions
{
public class PartialPanelSelectionHandler : BehaviorExtension, IHandlePointerToolMouseDown
{
protected override void OnInitialized()
{
base.OnInitialized();
this.ExtendedItem.AddBehavior(typeof(IHandlePointerToolMouseDown), this);
}
public new void HandleSelectionMouseDown(IDesignPanel designPanel, MouseButtonEventArgs e, DesignPanelHitTestResult result)
{
if (e.ChangedButton == MouseButton.Left && MouseGestureBase.IsOnlyButtonPressed(e, MouseButton.Left))
{
e.Handled = true;
new PartialRangeSelectionGesture(result.ModelHit).Start(designPanel, e);
}
}
}
/// <summary>
///
/// </summary>
internal class PartialRangeSelectionGesture : RangeSelectionGesture
{
public PartialRangeSelectionGesture(DesignItem container)
: base(container)
{
}
protected override ICollection<DesignItem> GetChildDesignItemsInContainer(Geometry geometry)
{
HashSet<DesignItem> resultItems = new HashSet<DesignItem>();
ViewService viewService = container.Services.View;
HitTestFilterCallback filterCallback = delegate(DependencyObject potentialHitTestTarget)
{
FrameworkElement element = potentialHitTestTarget as FrameworkElement;
if (element != null)
{
// ensure we are able to select elements with width/height=0
if (element.ActualWidth == 0 || element.ActualHeight == 0)
{
DependencyObject tmp = element;
DesignItem model = null;
while (tmp != null)
{
model = viewService.GetModel(tmp);
if (model != null) break;
tmp = VisualTreeHelper.GetParent(tmp);
}
if (model != container)
{
resultItems.Add(model);
return HitTestFilterBehavior.ContinueSkipChildren;
}
}
}
return HitTestFilterBehavior.Continue;
};
HitTestResultCallback resultCallback = delegate(HitTestResult result)
{
if (((GeometryHitTestResult)result).IntersectionDetail == IntersectionDetail.FullyInside || (Mouse.RightButton== MouseButtonState.Pressed && ((GeometryHitTestResult)result).IntersectionDetail == IntersectionDetail.Intersects))
{
// find the model for the visual contained in the selection area
DependencyObject tmp = result.VisualHit;
DesignItem model = null;
while (tmp != null)
{
model = viewService.GetModel(tmp);
if (model != null) break;
tmp = VisualTreeHelper.GetParent(tmp);
}
if (model != container)
{
resultItems.Add(model);
}
}
return HitTestResultBehavior.Continue;
};
VisualTreeHelper.HitTest(container.View, filterCallback, resultCallback, new GeometryHitTestParameters(geometry));
return resultItems;
}
}
}

1
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj

@ -84,6 +84,7 @@ @@ -84,6 +84,7 @@
<Link>Configuration\GlobalAssemblyInfo.cs</Link>
</Compile>
<Compile Include="Controls\RenderTransformOriginThumb.cs" />
<Compile Include="Extensions\PartialPanelSelectionHandler.cs" />
<Compile Include="Extensions\RightClickContextMenu.xaml.cs">
<DependentUpon>RightClickContextMenu.xaml</DependentUpon>
<SubType>Code</SubType>

6
src/Main/Base/Project/Debugging/IDebuggerService.cs

@ -20,6 +20,7 @@ using System.Collections.Generic; @@ -20,6 +20,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using ICSharpCode.Core;
using ICSharpCode.NRefactory;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
@ -217,11 +218,14 @@ namespace ICSharpCode.SharpDevelop.Debugging @@ -217,11 +218,14 @@ namespace ICSharpCode.SharpDevelop.Debugging
get { return false; }
}
public IEnumerable<string> SymbolsSearchPaths {
get { return Enumerable.Empty<string>(); }
get { return EmptyList<string>.Instance; }
}
public bool PauseOnHandledExceptions {
get { return false; }
}
public IEnumerable<string> ExceptionFilterList {
get { return EmptyList<string>.Instance; }
}
public static readonly DummyDebuggerOptions Instance = new DummyDebuggerOptions();
}

46
src/Main/Base/Project/Src/Gui/Dialogs/TreeViewOptionsDialog.xaml.cs

@ -46,13 +46,10 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -46,13 +46,10 @@ namespace ICSharpCode.SharpDevelop.Gui
throw new ArgumentNullException("optionPanels");
InitializeComponent();
ICSharpCode.SharpDevelop.Gui.FormLocationHelper.ApplyWindow(this, "TreeViewOptionsDialog.WindowBounds", true);
FormLocationHelper.ApplyWindow(this, "TreeViewOptionsDialog.WindowBounds", true);
var list = optionPanels.Select(op => new OptionPanelNode(op, this)).ToList();
treeView.ItemsSource = list;
if (list.Count > 0) {
list[0].IsSelected = true;
}
}
void okButtonClick(object sender, RoutedEventArgs e)
@ -71,9 +68,42 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -71,9 +68,42 @@ namespace ICSharpCode.SharpDevelop.Gui
Close();
}
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);
string[] lastOpenedPanelID = SD.PropertyService.Get("TreeViewOptionsDialog.LastOpenedPanelID", "UIOptions/SelectCulture").Split('/');
OptionPanelNode lastOpenedPanelNode = null;
for (int i = 0; i < lastOpenedPanelID.Length; i++) {
IEnumerable<OptionPanelNode> currentList;
if (lastOpenedPanelNode == null) {
currentList = (IEnumerable<OptionPanelNode>)treeView.ItemsSource;
} else {
currentList = lastOpenedPanelNode.Children;
}
var nextNode = currentList.FirstOrDefault(op => lastOpenedPanelID[i].Equals(op.ID, StringComparison.Ordinal));
if (nextNode == null)
break;
lastOpenedPanelNode = nextNode;
}
if (lastOpenedPanelNode != null)
lastOpenedPanelNode.IsSelected = true;
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
var selectedPanelNode = treeView.SelectedItem as OptionPanelNode;
string openedPanelID = "";
while (selectedPanelNode != null) {
if (openedPanelID.Length > 0)
openedPanelID = "/" + openedPanelID;
openedPanelID = selectedPanelNode.ID + openedPanelID;
selectedPanelNode = selectedPanelNode.Parent;
}
if (openedPanelID == "")
openedPanelID = "UIOptions/SelectCulture";
SD.PropertyService.Set("TreeViewOptionsDialog.LastOpenedPanelID", openedPanelID);
foreach (IDisposable op in optionPanels.OfType<IDisposable>()) {
op.Dispose();
}
@ -128,10 +158,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -128,10 +158,12 @@ namespace ICSharpCode.SharpDevelop.Gui
this.dialog = parent.dialog;
}
public string ID {
get { return OptionPanelDescriptor.ID; }
}
public string Title {
get {
return OptionPanelDescriptor.Label;
}
get { return OptionPanelDescriptor.Label; }
}
IOptionPanel optionPanel;

Loading…
Cancel
Save