69 changed files with 1434 additions and 570 deletions
@ -0,0 +1,149 @@ |
|||||||
|
// 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.IO; |
||||||
|
using Debugger; |
||||||
|
using ICSharpCode.NRefactory; |
||||||
|
using ICSharpCode.NRefactory.TypeSystem; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
using ICSharpCode.SharpDevelop.Dom.ClassBrowser; |
||||||
|
using System.Linq; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Gui.Pads |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of ClassBrowserSupport.
|
||||||
|
/// </summary>
|
||||||
|
public static class ClassBrowserSupport |
||||||
|
{ |
||||||
|
public static void Attach(Debugger.Process process) |
||||||
|
{ |
||||||
|
var classBrowser = SD.GetService<IClassBrowser>(); |
||||||
|
classBrowser.SpecialNodes.Add(new DebuggerProcessTreeNode(process)); |
||||||
|
} |
||||||
|
|
||||||
|
public static void Detach(Debugger.Process process) |
||||||
|
{ |
||||||
|
var classBrowser = SD.GetService<IClassBrowser>(); |
||||||
|
var nodes = classBrowser.SpecialNodes |
||||||
|
.Where(n => n.Model == process) |
||||||
|
.ToArray(); |
||||||
|
foreach (var node in nodes) { |
||||||
|
classBrowser.SpecialNodes.Remove(node); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class DebuggerTreeNodesFactory : ITreeNodeFactory |
||||||
|
{ |
||||||
|
public Type GetSupportedType(object model) |
||||||
|
{ |
||||||
|
if (model is Debugger.Process) |
||||||
|
return typeof(Debugger.Process); |
||||||
|
if (model is Debugger.Module) |
||||||
|
return typeof(Debugger.Module); |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
public ICSharpCode.TreeView.SharpTreeNode CreateTreeNode(object model) |
||||||
|
{ |
||||||
|
if (model is Debugger.Process) |
||||||
|
return new DebuggerProcessTreeNode((Debugger.Process)model); |
||||||
|
if (model is Debugger.Module) |
||||||
|
return new DebuggerModuleTreeNode((Debugger.Module)model); |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class DebuggerProcessTreeNode : ModelCollectionTreeNode |
||||||
|
{ |
||||||
|
Debugger.Process process; |
||||||
|
IMutableModelCollection<Debugger.Module> modules; |
||||||
|
|
||||||
|
public DebuggerProcessTreeNode(Debugger.Process process) |
||||||
|
{ |
||||||
|
if (process == null) |
||||||
|
throw new ArgumentNullException("process"); |
||||||
|
this.process = process; |
||||||
|
this.modules = new SimpleModelCollection<Debugger.Module>(this.process.Modules); |
||||||
|
this.process.ModuleLoaded += ModuleLoaded; |
||||||
|
this.process.ModuleUnloaded += ModuleUnloaded; |
||||||
|
} |
||||||
|
|
||||||
|
void ModuleLoaded(object sender, ModuleEventArgs e) |
||||||
|
{ |
||||||
|
modules.Add(e.Module); |
||||||
|
} |
||||||
|
|
||||||
|
void ModuleUnloaded(object sender, ModuleEventArgs e) |
||||||
|
{ |
||||||
|
modules.Remove(e.Module); |
||||||
|
} |
||||||
|
|
||||||
|
protected override object GetModel() |
||||||
|
{ |
||||||
|
return process; |
||||||
|
} |
||||||
|
|
||||||
|
protected override IModelCollection<object> ModelChildren { |
||||||
|
get { |
||||||
|
return modules; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override System.Collections.Generic.IComparer<ICSharpCode.TreeView.SharpTreeNode> NodeComparer { |
||||||
|
get { |
||||||
|
return NodeTextComparer; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text { |
||||||
|
get { |
||||||
|
return Path.GetFileName(process.Filename); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Icon { |
||||||
|
get { |
||||||
|
return IconService.GetImageSource("Icons.16x16.Debug.Start"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
class DebuggerModuleTreeNode : AssemblyTreeNode |
||||||
|
{ |
||||||
|
Debugger.Module module; |
||||||
|
|
||||||
|
public DebuggerModuleTreeNode(Module module) |
||||||
|
: base(CreateAssemblyModel(module)) |
||||||
|
{ |
||||||
|
if (module == null) |
||||||
|
throw new ArgumentNullException("module"); |
||||||
|
this.module = module; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Icon { |
||||||
|
get { |
||||||
|
return IconService.GetImageSource("PadIcons.LoadedModules"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text { |
||||||
|
get { |
||||||
|
return module.Name; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
static IAssemblyModel CreateAssemblyModel(Module module) |
||||||
|
{ |
||||||
|
// references??
|
||||||
|
IEntityModelContext context = new AssemblyEntityModelContext(module.Assembly.UnresolvedAssembly); |
||||||
|
IAssemblyModel model = SD.GetRequiredService<IModelFactory>().CreateAssemblyModel(context); |
||||||
|
if (model is IUpdateableAssemblyModel) { |
||||||
|
((IUpdateableAssemblyModel)model).Update(EmptyList<IUnresolvedTypeDefinition>.Instance, module.Assembly.TopLevelTypeDefinitions.SelectMany(td => td.Parts).ToList()); |
||||||
|
} |
||||||
|
return model; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,113 @@ |
|||||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||||
|
<Window |
||||||
|
x:Class="ICSharpCode.SharpDevelop.Services.ExecuteProcessWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||||
|
Title="Select process to debug..." |
||||||
|
WindowStartupLocation="CenterOwner" |
||||||
|
WindowState="Normal" |
||||||
|
WindowStyle="ToolWindow" |
||||||
|
ShowInTaskbar="False" |
||||||
|
Height="250" |
||||||
|
Width="596"> |
||||||
|
<Grid |
||||||
|
Height="217"> |
||||||
|
<Grid.RowDefinitions> |
||||||
|
<RowDefinition |
||||||
|
Height="1.4*" /> |
||||||
|
<RowDefinition |
||||||
|
Height="0.2*" /> |
||||||
|
</Grid.RowDefinitions> |
||||||
|
<Label |
||||||
|
Content="Executable" |
||||||
|
Grid.Column="0" |
||||||
|
Grid.Row="0" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
VerticalAlignment="Top" |
||||||
|
Margin="19.5,28.5,0,0" |
||||||
|
Width="92" |
||||||
|
Height="25" /> |
||||||
|
<TextBox |
||||||
|
Grid.Column="0" |
||||||
|
Grid.Row="0" |
||||||
|
HorizontalAlignment="Right" |
||||||
|
VerticalAlignment="Top" |
||||||
|
Margin="0,28.5,84.5,0" |
||||||
|
Width="368" |
||||||
|
Height="25" |
||||||
|
Name="pathTextBox" /> |
||||||
|
<Button |
||||||
|
Grid.Column="0" |
||||||
|
Grid.Row="0" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
VerticalAlignment="Top" |
||||||
|
Margin="502.5,28.5,0,0" |
||||||
|
Width="25" |
||||||
|
Height="25" |
||||||
|
Content="..." |
||||||
|
Name="pathButton" |
||||||
|
Click="pathButton_Click" /> |
||||||
|
<TextBox |
||||||
|
Grid.Column="0" |
||||||
|
Grid.Row="0" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
VerticalAlignment="Top" |
||||||
|
Margin="133.5,81,0,0" |
||||||
|
Width="368" |
||||||
|
Height="25" |
||||||
|
Name="argumentsTextBox" /> |
||||||
|
<Label |
||||||
|
Content="Arguments" |
||||||
|
Grid.Column="0" |
||||||
|
Grid.Row="0" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
VerticalAlignment="Top" |
||||||
|
Margin="19.5,81,0,0" |
||||||
|
Width="92" |
||||||
|
Height="31" /> |
||||||
|
<Button |
||||||
|
Content="..." |
||||||
|
Grid.Column="0" |
||||||
|
Grid.Row="0" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
Width="25" |
||||||
|
Click="workingDirectoryButton_Click" |
||||||
|
Height="25" |
||||||
|
VerticalAlignment="Bottom" |
||||||
|
Margin="502.5,0,0,30.875" |
||||||
|
Name="workingDirectoryButton" /> |
||||||
|
<TextBox |
||||||
|
Grid.Column="0" |
||||||
|
Grid.Row="0" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
VerticalAlignment="Top" |
||||||
|
Margin="133.5,134,0,0" |
||||||
|
Width="368" |
||||||
|
Height="25" |
||||||
|
Name="workingDirectoryTextBox" /> |
||||||
|
<Label |
||||||
|
Content="Working directory" |
||||||
|
Grid.Column="0" |
||||||
|
Grid.Row="0" |
||||||
|
HorizontalAlignment="Left" |
||||||
|
VerticalAlignment="Top" |
||||||
|
Margin="19.5,134,0,0" |
||||||
|
Width="113" |
||||||
|
Height="31" /> |
||||||
|
<DockPanel |
||||||
|
Grid.Row="1" |
||||||
|
LastChildFill="False"> |
||||||
|
<Button |
||||||
|
DockPanel.Dock="Left" |
||||||
|
HorizontalAlignment="Center" |
||||||
|
x:Name="ExecuteButton" |
||||||
|
Click="ExecuteButton_Click" |
||||||
|
Content="Execute" |
||||||
|
Width="100" /> |
||||||
|
<Button |
||||||
|
DockPanel.Dock="Right" |
||||||
|
x:Name="CancelButton" |
||||||
|
Content="Cancel" |
||||||
|
Click="CancelButton_Click" |
||||||
|
Width="100" /> |
||||||
|
</DockPanel> |
||||||
|
</Grid> |
||||||
|
</Window> |
@ -0,0 +1,84 @@ |
|||||||
|
// 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.IO; |
||||||
|
using System.Text; |
||||||
|
using System.Windows; |
||||||
|
using System.Windows.Forms; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Services |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ExecuteProcessWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ExecuteProcessWindow : Window |
||||||
|
{ |
||||||
|
public ExecuteProcessWindow() |
||||||
|
{ |
||||||
|
InitializeComponent(); |
||||||
|
} |
||||||
|
|
||||||
|
public string SelectedExecutable { |
||||||
|
get { |
||||||
|
return pathTextBox.Text; |
||||||
|
} |
||||||
|
set { |
||||||
|
pathTextBox.Text = value; |
||||||
|
workingDirectoryTextBox.Text = Path.GetDirectoryName(value); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string WorkingDirectory { |
||||||
|
get { |
||||||
|
return workingDirectoryTextBox.Text; |
||||||
|
} |
||||||
|
set { |
||||||
|
workingDirectoryTextBox.Text = value; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public string Arguments { |
||||||
|
get { |
||||||
|
return argumentsTextBox.Text; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void pathButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
OpenFileDialog dialog = new OpenFileDialog() { |
||||||
|
Filter = ".NET Executable (*.exe) | *.exe", |
||||||
|
InitialDirectory = workingDirectoryTextBox.Text, |
||||||
|
RestoreDirectory = true, |
||||||
|
DefaultExt = "exe" |
||||||
|
}; |
||||||
|
|
||||||
|
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { |
||||||
|
SelectedExecutable = dialog.FileName; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void ExecuteButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
if (string.IsNullOrEmpty(SelectedExecutable)) |
||||||
|
return; |
||||||
|
this.DialogResult = true; |
||||||
|
} |
||||||
|
|
||||||
|
void CancelButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
this.Close(); |
||||||
|
} |
||||||
|
|
||||||
|
void workingDirectoryButton_Click(object sender, RoutedEventArgs e) |
||||||
|
{ |
||||||
|
FolderBrowserDialog dialog = new FolderBrowserDialog() { |
||||||
|
SelectedPath = workingDirectoryTextBox.Text |
||||||
|
}; |
||||||
|
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { |
||||||
|
workingDirectoryTextBox.Text = dialog.SelectedPath; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
// 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 ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
public class AssemblyTreeNode : ModelCollectionTreeNode |
||||||
|
{ |
||||||
|
IAssemblyModel model; |
||||||
|
|
||||||
|
public AssemblyTreeNode(IAssemblyModel model) |
||||||
|
{ |
||||||
|
if (model == null) |
||||||
|
throw new ArgumentNullException("model"); |
||||||
|
this.model = model; |
||||||
|
} |
||||||
|
|
||||||
|
protected override object GetModel() |
||||||
|
{ |
||||||
|
return model; |
||||||
|
} |
||||||
|
|
||||||
|
protected override IComparer<SharpTreeNode> NodeComparer { |
||||||
|
get { |
||||||
|
return NodeTextComparer; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override IModelCollection<object> ModelChildren { |
||||||
|
get { |
||||||
|
return model.Namespaces; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text { |
||||||
|
get { |
||||||
|
return model.AssemblyName; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Icon { |
||||||
|
get { |
||||||
|
return base.Icon; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -1,84 +0,0 @@ |
|||||||
// 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.NRefactory.TypeSystem; |
|
||||||
using ICSharpCode.NRefactory.TypeSystem.Implementation; |
|
||||||
using ICSharpCode.SharpDevelop.Project; |
|
||||||
|
|
||||||
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
|
||||||
{ |
|
||||||
/// <summary>
|
|
||||||
/// Description of ClassBrowserWorkspace.
|
|
||||||
/// </summary>
|
|
||||||
public class ClassBrowserWorkspace |
|
||||||
{ |
|
||||||
ISolution assignedSolution; |
|
||||||
IModelCollection<IUnresolvedAssembly> loadedAssemblies; |
|
||||||
string workspaceName; |
|
||||||
|
|
||||||
public ClassBrowserWorkspace(ISolution assignedSolution, IEnumerable<IUnresolvedAssembly> assemblies = null) |
|
||||||
: this(assignedSolution.FileName, assemblies) |
|
||||||
{ |
|
||||||
this.assignedSolution = assignedSolution; |
|
||||||
} |
|
||||||
|
|
||||||
public ClassBrowserWorkspace(string workspaceName, IEnumerable<IUnresolvedAssembly> assemblies = null) |
|
||||||
{ |
|
||||||
this.workspaceName = workspaceName; |
|
||||||
this.loadedAssemblies = new SimpleModelCollection<IUnresolvedAssembly>(assemblies ?? EmptyList<IUnresolvedAssembly>.Instance); |
|
||||||
} |
|
||||||
|
|
||||||
public bool IsAssigned { |
|
||||||
get { return assignedSolution != null; } |
|
||||||
} |
|
||||||
|
|
||||||
public ISolution AssignedSolution { |
|
||||||
get { return assignedSolution; } |
|
||||||
} |
|
||||||
|
|
||||||
public string Name { |
|
||||||
get { return workspaceName; } |
|
||||||
} |
|
||||||
|
|
||||||
public IModelCollection<IUnresolvedAssembly> LoadedAssemblies { |
|
||||||
get { return loadedAssemblies; } |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static class ClassBrowserSettings |
|
||||||
{ |
|
||||||
static IUnresolvedAssembly[] LoadAssemblyList(string name) |
|
||||||
{ |
|
||||||
var assemblyNames = Container.GetList<string>("AssemblyList." + name); |
|
||||||
CecilLoader loader = new CecilLoader(); |
|
||||||
return assemblyNames.Select(loader.LoadAssemblyFile).ToArray(); |
|
||||||
} |
|
||||||
|
|
||||||
static readonly Properties Container = SD.PropertyService.NestedProperties(typeof(ClassBrowserSettings).FullName); |
|
||||||
|
|
||||||
public static ClassBrowserWorkspace LoadDefaultWorkspace() |
|
||||||
{ |
|
||||||
return LoadWorkspace("<default>"); |
|
||||||
} |
|
||||||
|
|
||||||
public static ClassBrowserWorkspace LoadWorkspace(string name) |
|
||||||
{ |
|
||||||
return new ClassBrowserWorkspace(name, LoadAssemblyList(name)); |
|
||||||
} |
|
||||||
|
|
||||||
public static ClassBrowserWorkspace LoadForSolution(ISolution solution) |
|
||||||
{ |
|
||||||
return new ClassBrowserWorkspace(solution, LoadAssemblyList(solution.FileName)); |
|
||||||
} |
|
||||||
|
|
||||||
public static void SaveWorkspace(ClassBrowserWorkspace workspace) |
|
||||||
{ |
|
||||||
|
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,27 @@ |
|||||||
|
// 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 ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
public interface IClassBrowser |
||||||
|
{ |
||||||
|
ICollection<SharpTreeNode> SpecialNodes { get; } |
||||||
|
AssemblyList AssemblyList { get; set; } |
||||||
|
} |
||||||
|
|
||||||
|
public class AssemblyList |
||||||
|
{ |
||||||
|
public string Name { get; set; } |
||||||
|
public IMutableModelCollection<IAssemblyModel> Assemblies { get; set; } |
||||||
|
|
||||||
|
public AssemblyList() |
||||||
|
{ |
||||||
|
Name = "<default>"; |
||||||
|
Assemblies = new SimpleModelCollection<IAssemblyModel>(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,82 @@ |
|||||||
|
// 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 ICSharpCode.Core.Presentation; |
||||||
|
using ICSharpCode.NRefactory.TypeSystem; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
public class MemberTreeNode : ModelCollectionTreeNode |
||||||
|
{ |
||||||
|
IMemberModel model; |
||||||
|
|
||||||
|
public MemberTreeNode(IMemberModel model) |
||||||
|
{ |
||||||
|
if (model == null) |
||||||
|
throw new ArgumentNullException("model"); |
||||||
|
this.model = model; |
||||||
|
// disable lazy loading to avoid showing a useless + sign in the tree.
|
||||||
|
// remove this line if you add child nodes
|
||||||
|
LazyLoading = false; |
||||||
|
} |
||||||
|
|
||||||
|
protected override object GetModel() |
||||||
|
{ |
||||||
|
return model; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Icon { |
||||||
|
// TODO why do I have to resolve this?
|
||||||
|
get { |
||||||
|
return ClassBrowserIconService.GetIcon(model.Resolve()).ImageSource; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
object cachedText; |
||||||
|
|
||||||
|
public override object Text { |
||||||
|
get { |
||||||
|
if (cachedText == null) |
||||||
|
cachedText = GetText(); |
||||||
|
return cachedText; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
object GetText() |
||||||
|
{ |
||||||
|
var member = model.Resolve(); |
||||||
|
if (member == null) |
||||||
|
return model.Name; |
||||||
|
IAmbience ambience = AmbienceService.GetCurrentAmbience(); |
||||||
|
ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList | ConversionFlags.ShowParameterList | ConversionFlags.ShowParameterNames; |
||||||
|
return ambience.ConvertEntity(member); |
||||||
|
} |
||||||
|
|
||||||
|
protected override IModelCollection<object> ModelChildren { |
||||||
|
get { return ImmutableModelCollection<object>.Empty; } |
||||||
|
} |
||||||
|
|
||||||
|
protected override System.Collections.Generic.IComparer<SharpTreeNode> NodeComparer { |
||||||
|
get { return NodeTextComparer; } |
||||||
|
} |
||||||
|
|
||||||
|
public override void ActivateItem(System.Windows.RoutedEventArgs e) |
||||||
|
{ |
||||||
|
var target = model.Resolve(); |
||||||
|
if (target != null) |
||||||
|
NavigationService.NavigateTo(target); |
||||||
|
} |
||||||
|
|
||||||
|
public override void ShowContextMenu() |
||||||
|
{ |
||||||
|
var entityModel = this.Model as IEntityModel; |
||||||
|
if ((entityModel != null) && (entityModel.ParentProject != null)) { |
||||||
|
var ctx = MenuService.ShowContextMenu(null, entityModel, "/SharpDevelop/EntityContextMenu"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -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.Windows.Media; |
||||||
|
using ICSharpCode.NRefactory.TypeSystem; |
||||||
|
using ICSharpCode.NRefactory.Utils; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
public class NamespaceTreeNode : ModelCollectionTreeNode |
||||||
|
{ |
||||||
|
INamespaceModel model; |
||||||
|
|
||||||
|
public NamespaceTreeNode(INamespaceModel model) |
||||||
|
{ |
||||||
|
if (model == null) |
||||||
|
throw new ArgumentNullException("model"); |
||||||
|
this.model = model; |
||||||
|
} |
||||||
|
|
||||||
|
protected override object GetModel() |
||||||
|
{ |
||||||
|
return model; |
||||||
|
} |
||||||
|
|
||||||
|
protected override IComparer<SharpTreeNode> NodeComparer { |
||||||
|
get { |
||||||
|
return NodeTextComparer; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override IModelCollection<object> ModelChildren { |
||||||
|
get { |
||||||
|
return model.Types; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Icon { |
||||||
|
get { |
||||||
|
return ClassBrowserIconService.Namespace.ImageSource; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text { |
||||||
|
get { |
||||||
|
return model.FullName; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -0,0 +1,53 @@ |
|||||||
|
// 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 ICSharpCode.TreeView; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
public class ProjectTreeNode : ModelCollectionTreeNode |
||||||
|
{ |
||||||
|
IProject project; |
||||||
|
|
||||||
|
public ProjectTreeNode(IProject project) |
||||||
|
{ |
||||||
|
if (project == null) |
||||||
|
throw new ArgumentNullException("project"); |
||||||
|
this.project = project; |
||||||
|
} |
||||||
|
|
||||||
|
protected override object GetModel() |
||||||
|
{ |
||||||
|
return project; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text { |
||||||
|
get { |
||||||
|
return project.Name; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Icon { |
||||||
|
get { |
||||||
|
return IconService.GetImageSource(IconService.GetImageForProjectType(project.Language)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override IComparer<SharpTreeNode> NodeComparer { |
||||||
|
get { |
||||||
|
return NodeTextComparer; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override IModelCollection<object> ModelChildren { |
||||||
|
get { |
||||||
|
return project.AssemblyModel.Namespaces; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -0,0 +1,53 @@ |
|||||||
|
// 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 ICSharpCode.TreeView; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
public class SolutionTreeNode : ModelCollectionTreeNode |
||||||
|
{ |
||||||
|
ISolution solution; |
||||||
|
|
||||||
|
public SolutionTreeNode(ISolution solution) |
||||||
|
{ |
||||||
|
if (solution == null) |
||||||
|
throw new ArgumentNullException("solution"); |
||||||
|
this.solution = solution; |
||||||
|
} |
||||||
|
|
||||||
|
protected override object GetModel() |
||||||
|
{ |
||||||
|
return solution; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text { |
||||||
|
get { |
||||||
|
return "Solution " + solution.Name; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Icon { |
||||||
|
get { |
||||||
|
return IconService.GetImageSource("Icons.16x16.SolutionIcon"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override IComparer<SharpTreeNode> NodeComparer { |
||||||
|
get { |
||||||
|
return NodeTextComparer; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override IModelCollection<object> ModelChildren { |
||||||
|
get { |
||||||
|
return solution.Projects; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -0,0 +1,70 @@ |
|||||||
|
// 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 ICSharpCode.Core.Presentation; |
||||||
|
using ICSharpCode.NRefactory.TypeSystem; |
||||||
|
using ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
public class TypeDefinitionTreeNode : ModelCollectionTreeNode |
||||||
|
{ |
||||||
|
ITypeDefinitionModel definition; |
||||||
|
|
||||||
|
public TypeDefinitionTreeNode(ITypeDefinitionModel definition) |
||||||
|
{ |
||||||
|
if (definition == null) |
||||||
|
throw new ArgumentNullException("definition"); |
||||||
|
this.definition = definition; |
||||||
|
} |
||||||
|
|
||||||
|
protected override object GetModel() |
||||||
|
{ |
||||||
|
return definition; |
||||||
|
} |
||||||
|
|
||||||
|
public override object Icon { |
||||||
|
// TODO why do I have to resolve this?
|
||||||
|
get { |
||||||
|
return ClassBrowserIconService.GetIcon(definition.Resolve()).ImageSource; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override object Text { |
||||||
|
get { |
||||||
|
return definition.Name; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override IComparer<SharpTreeNode> NodeComparer { |
||||||
|
get { |
||||||
|
return NodeTextComparer; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
protected override IModelCollection<object> ModelChildren { |
||||||
|
get { |
||||||
|
return definition.Members; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public override void ActivateItem(System.Windows.RoutedEventArgs e) |
||||||
|
{ |
||||||
|
var target = definition.Resolve(); |
||||||
|
if (target != null) |
||||||
|
NavigationService.NavigateTo(target); |
||||||
|
} |
||||||
|
|
||||||
|
public override void ShowContextMenu() |
||||||
|
{ |
||||||
|
var entityModel = this.Model as IEntityModel; |
||||||
|
if ((entityModel != null) && (entityModel.ParentProject != null)) { |
||||||
|
var ctx = MenuService.ShowContextMenu(null, entityModel, "/SharpDevelop/EntityContextMenu"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
@ -0,0 +1,48 @@ |
|||||||
|
// 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 ICSharpCode.TreeView; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of WorkspaceModel.
|
||||||
|
/// </summary>
|
||||||
|
public class WorkspaceModel : System.ComponentModel.INotifyPropertyChanged |
||||||
|
{ |
||||||
|
IMutableModelCollection<SharpTreeNode> specialNodes; |
||||||
|
public IMutableModelCollection<SharpTreeNode> SpecialNodes { |
||||||
|
get { return specialNodes; } |
||||||
|
} |
||||||
|
|
||||||
|
AssemblyList assemblyList; |
||||||
|
|
||||||
|
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; |
||||||
|
|
||||||
|
protected virtual void OnPropertyChanged(string propertyName) |
||||||
|
{ |
||||||
|
if (PropertyChanged != null) { |
||||||
|
PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
public AssemblyList AssemblyList { |
||||||
|
get { |
||||||
|
return assemblyList; |
||||||
|
} |
||||||
|
set { |
||||||
|
if (assemblyList != value) { |
||||||
|
assemblyList = value; |
||||||
|
OnPropertyChanged("AssemblyList"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
public WorkspaceModel() |
||||||
|
{ |
||||||
|
this.specialNodes = new SimpleModelCollection<SharpTreeNode>(); |
||||||
|
this.AssemblyList = new AssemblyList(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
// 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 Microsoft.Win32; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop.Dom.ClassBrowser |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Description of OpenAssemblyCommand.
|
||||||
|
/// </summary>
|
||||||
|
class OpenAssemblyCommand : SimpleCommand |
||||||
|
{ |
||||||
|
public override void Execute(object parameter) |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue