Browse Source

- Implement IServiceProvider in IViewContent to get services for View Contents as suggested by Daniel.

- Add outline in OutlinePad while in WPF Designer.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/wpfdesigner@6158 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
pull/1/head
Kumar Devvrat 16 years ago
parent
commit
27fe096db9
  1. 4
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs
  2. 8
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml.cs
  3. 4
      src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/WpfDesign.Designer.csproj
  4. 14
      src/Main/Base/Project/Src/Gui/AbstractViewContent.cs
  5. 2
      src/Main/Base/Project/Src/Gui/IViewContent.cs
  6. 9
      src/Main/Base/Project/Src/Gui/Pads/OutlinePad.cs

4
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.AddIn/Src/WpfViewContent.cs

@ -98,6 +98,10 @@ namespace ICSharpCode.WpfDesign.AddIn @@ -98,6 +98,10 @@ namespace ICSharpCode.WpfDesign.AddIn
outline.Root = OutlineNode.Create(designer.DesignContext.RootItem);
}
var outlineContent = GetService(typeof(IOutlineContentHost));
if(outlineContent==null)
this.Services.AddService(typeof(IOutlineContentHost),Outline);
propertyGridView.PropertyGrid.SelectedItems = null;
designer.DesignContext.Services.Selection.SelectionChanged += OnSelectionChanged;
designer.DesignContext.Services.GetService<UndoService>().UndoStackChanged += OnUndoStackChanged;

8
src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/OutlineView/Outline.xaml.cs

@ -18,10 +18,12 @@ using System.Windows.Media; @@ -18,10 +18,12 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.WpfDesign.Designer.OutlineView
{
public partial class Outline
public partial class Outline : IOutlineContentHost
{
public Outline()
{
@ -35,5 +37,9 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView @@ -35,5 +37,9 @@ namespace ICSharpCode.WpfDesign.Designer.OutlineView
get { return (OutlineNode)GetValue(RootProperty); }
set { SetValue(RootProperty, value); }
}
public object OutlineContent {
get { return this; }
}
}
}

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

@ -226,6 +226,10 @@ @@ -226,6 +226,10 @@
<Resource Include="Images\Tag.png" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\..\..\Main\ICSharpCode.SharpDevelop.Widgets\Project\ICSharpCode.SharpDevelop.Widgets.csproj">
<Project>{8035765F-D51F-4A0C-A746-2FD100E19419}</Project>
<Name>ICSharpCode.SharpDevelop.Widgets</Name>

14
src/Main/Base/Project/Src/Gui/AbstractViewContent.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using System.ComponentModel.Design;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
@ -512,6 +513,19 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -512,6 +513,19 @@ namespace ICSharpCode.SharpDevelop.Gui
}
#endregion
#region IServiceProvider
ServiceContainer _services=new ServiceContainer();
public object GetService(Type serviceType){
return _services.GetService(serviceType);
}
public ServiceContainer Services {
get { return _services; }
}
#endregion
public virtual void Save(OpenedFile file, Stream stream)
{
}

2
src/Main/Base/Project/Src/Gui/IViewContent.cs

@ -37,7 +37,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -37,7 +37,7 @@ namespace ICSharpCode.SharpDevelop.Gui
/// A view content is a view onto multiple files, or other content that opens like a document
/// (e.g. the start page).
/// </summary>
public interface IViewContent : IDisposable, ICanBeDirty
public interface IViewContent : IDisposable, ICanBeDirty, IServiceProvider
{
/// <summary>
/// This is the UI element for the view.

9
src/Main/Base/Project/Src/Gui/Pads/OutlinePad.cs

@ -44,6 +44,15 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -44,6 +44,15 @@ namespace ICSharpCode.SharpDevelop.Gui
void WorkbenchActiveContentChanged(object sender, EventArgs e)
{
IViewContent view = WorkbenchSingleton.Workbench.ActiveViewContent;
if(view!=null){
IOutlineContentHost content = view.GetService(typeof(IOutlineContentHost)) as IOutlineContentHost;
if(content!=null){
contentControl.SetContent(content.OutlineContent, content);
return ;
}
}
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;
if (provider != null) {
IOutlineContentHost content = provider.TextEditor.GetService(typeof(IOutlineContentHost)) as IOutlineContentHost;

Loading…
Cancel
Save