|
|
|
@ -8,26 +8,60 @@
@@ -8,26 +8,60 @@
|
|
|
|
|
#region Using
|
|
|
|
|
using System; |
|
|
|
|
using System.Collections; |
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Drawing.Design; |
|
|
|
|
using System.ComponentModel; |
|
|
|
|
using System.ComponentModel.Design; |
|
|
|
|
using System.Workflow.Activities; |
|
|
|
|
using ICSharpCode.Core; |
|
|
|
|
using System.Reflection; |
|
|
|
|
using System.Drawing; |
|
|
|
|
using System.Windows.Forms; |
|
|
|
|
using ICSharpCode.SharpDevelop; |
|
|
|
|
using ICSharpCode.SharpDevelop.Gui; |
|
|
|
|
using ICSharpCode.SharpDevelop.Project; |
|
|
|
|
using ICSharpCode.SharpDevelop.Widgets.SideBar; |
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
namespace WorkflowDesigner |
|
|
|
|
{ |
|
|
|
|
// TODO - Replace this a class based on System.Drawing.Design.ToolboxService
|
|
|
|
|
public class WorkflowToolboxService : IToolboxService |
|
|
|
|
public class WorkflowToolboxService : IToolboxService, IServiceProvider |
|
|
|
|
{ |
|
|
|
|
private string category = "Workflow"; |
|
|
|
|
private static SideTab standardSideTab; |
|
|
|
|
|
|
|
|
|
public WorkflowToolboxService() |
|
|
|
|
public WorkflowToolboxService(IServiceProvider provider) |
|
|
|
|
{ |
|
|
|
|
this.provider = provider; |
|
|
|
|
|
|
|
|
|
// Make sure the side bar has actually been created!
|
|
|
|
|
if (SharpDevelopSideBar.SideBar == null) |
|
|
|
|
WorkbenchSingleton.Workbench.GetPad(typeof(SideBarView)).CreatePad(); |
|
|
|
|
|
|
|
|
|
if (standardSideTab == null) { |
|
|
|
|
Assembly assembly = AppDomain.CurrentDomain.Load("System.Workflow.Activities, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"); |
|
|
|
|
standardSideTab = CreateSideTabFromAssembly("Workflow", assembly); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#region IServiceProvider implementation
|
|
|
|
|
IServiceProvider provider; |
|
|
|
|
public object GetService(Type serviceType) |
|
|
|
|
{ |
|
|
|
|
return provider.GetService(serviceType); |
|
|
|
|
} |
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void ShowSideTabs() |
|
|
|
|
{ |
|
|
|
|
// Make sure the standard workflow sidebar is on screen.
|
|
|
|
|
if (!SharpDevelopSideBar.SideBar.Tabs.Contains(standardSideTab)) { |
|
|
|
|
SharpDevelopSideBar.SideBar.Tabs.Add(standardSideTab); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
SharpDevelopSideBar.SideBar.Refresh(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public CategoryNameCollection CategoryNames { |
|
|
|
@ -185,71 +219,48 @@ namespace WorkflowDesigner
@@ -185,71 +219,48 @@ namespace WorkflowDesigner
|
|
|
|
|
throw new NotImplementedException(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#region Helpers
|
|
|
|
|
static SideTab CreateSideTabFromAssembly(Assembly assembly) |
|
|
|
|
{ |
|
|
|
|
return CreateSideTabFromAssembly(assembly.FullName + " components", assembly); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static SideTab CreateSideTabFromAssembly(string name, Assembly assembly) |
|
|
|
|
{ |
|
|
|
|
SideTab sideTab = new SideTab(name); |
|
|
|
|
sideTab.CanSaved = false; |
|
|
|
|
AddPointerToSideTab(sideTab); |
|
|
|
|
LoadSideTabItemsFromAssembly(assembly, sideTab); |
|
|
|
|
return sideTab; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void AddPointerToSideTab(SideTab sideTab) |
|
|
|
|
{ |
|
|
|
|
// Add the standard pointer.
|
|
|
|
|
SharpDevelopSideTabItem sti = new SharpDevelopSideTabItem("Pointer"); |
|
|
|
|
sti.CanBeRenamed = false; |
|
|
|
|
sti.CanBeDeleted = false; |
|
|
|
|
Bitmap pointerBitmap = new Bitmap(IconService.GetBitmap("Icons.16x16.FormsDesigner.PointerIcon"), 16, 16); |
|
|
|
|
sti.Icon = pointerBitmap; |
|
|
|
|
sti.Tag = null; |
|
|
|
|
sideTab.Items.Add(sti); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void LoadSideTabItemsFromAssembly(Assembly assembly, SideTab sideTab) |
|
|
|
|
{ |
|
|
|
|
ICollection toolboxItems = System.Drawing.Design.ToolboxService.GetToolboxItems(assembly.GetName()); |
|
|
|
|
foreach (ToolboxItem tbi in toolboxItems) |
|
|
|
|
{ |
|
|
|
|
SharpDevelopSideTabItem sti = new SharpDevelopSideTabItem(tbi.DisplayName); |
|
|
|
|
sti.CanBeDeleted = false; |
|
|
|
|
sti.CanBeRenamed = false; |
|
|
|
|
sti.Tag = tbi; |
|
|
|
|
sti.Icon = tbi.Bitmap; |
|
|
|
|
sideTab.Items.Add(sti); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
#endregion
|
|
|
|
|
} |
|
|
|
|
// public class ToolboxService2 : System.Drawing.Design.ToolboxService
|
|
|
|
|
// {
|
|
|
|
|
// private CategoryNameCollection categoryNameCollection = new CategoryNameCollection(new string[] {});
|
|
|
|
|
// private string selectedCategory;
|
|
|
|
|
// private ArrayList items = new ArrayList(); // TODO: replace by category item lists.
|
|
|
|
|
//
|
|
|
|
|
// public ToolboxService2() : base()
|
|
|
|
|
// {
|
|
|
|
|
// foreach (Assembly assembly in System.AppDomain.CurrentDomain.GetAssemblies())
|
|
|
|
|
// {
|
|
|
|
|
// if (assembly.GetName().Name == "System.Workflow.Activities")
|
|
|
|
|
// {
|
|
|
|
|
// ICollection toolboxItems = System.Drawing.Design.ToolboxService.GetToolboxItems(assembly.GetName());
|
|
|
|
|
// LoggingService.DebugFormatted("ToolboxItems count = {0}", toolboxItems.Count);
|
|
|
|
|
//
|
|
|
|
|
// foreach (ToolboxItem tbi in toolboxItems)
|
|
|
|
|
// {
|
|
|
|
|
// ((IToolboxService)this).AddToolboxItem(tbi);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// protected override CategoryNameCollection CategoryNames {
|
|
|
|
|
// get {
|
|
|
|
|
// return categoryNameCollection;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// protected override string SelectedCategory {
|
|
|
|
|
// get {
|
|
|
|
|
// return selectedCategory;
|
|
|
|
|
// }
|
|
|
|
|
// set {
|
|
|
|
|
// selectedCategory = value;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// protected override ToolboxItemContainer SelectedItemContainer {
|
|
|
|
|
// get {
|
|
|
|
|
// throw new NotImplementedException();
|
|
|
|
|
// }
|
|
|
|
|
// set {
|
|
|
|
|
// throw new NotImplementedException();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// protected override System.Collections.IList GetItemContainers()
|
|
|
|
|
// {
|
|
|
|
|
// return items;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// protected override System.Collections.IList GetItemContainers(string categoryName)
|
|
|
|
|
// {
|
|
|
|
|
// return items;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// protected override void Refresh()
|
|
|
|
|
// {
|
|
|
|
|
// throw new NotImplementedException();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|