Browse Source

Enable WiX dialog designer.

pull/45/merge
Daniel Grunwald 12 years ago
parent
commit
d3a3db75fb
  1. 36
      src/AddIns/BackendBindings/WixBinding/Project/Src/Commands/OpenDialogCommand.cs
  2. 124
      src/AddIns/BackendBindings/WixBinding/Project/Src/Commands/ViewDialogXmlCommand.cs
  3. 106
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/SetupDialogControlsSideTab.cs
  4. 386
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/SetupDialogListPad.cs
  5. 598
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs
  6. 3
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerDisplayBinding.cs
  7. 200
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerGenerator.cs
  8. 303
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerLoader.cs
  9. 60
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerLoaderProvider.cs
  10. 7
      src/AddIns/BackendBindings/WixBinding/Project/Src/IWixDialogDesigner.cs
  11. 14
      src/AddIns/BackendBindings/WixBinding/Project/WixBinding.addin
  12. 5
      src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj
  13. 188
      src/AddIns/BackendBindings/WixBinding/Test/DialogLoading/NameCreationServiceValidNameTests.cs
  14. 200
      src/AddIns/BackendBindings/WixBinding/Test/Gui/BitmapCreatedByDesignerLoaderTestFixture.cs
  15. 222
      src/AddIns/BackendBindings/WixBinding/Test/Gui/CanAttachToFileNameTests.cs
  16. 230
      src/AddIns/BackendBindings/WixBinding/Test/Gui/DialogIdSpecifiedForDesignerLoaderTestFixture.cs
  17. 216
      src/AddIns/BackendBindings/WixBinding/Test/Gui/FlushLoaderTestFixture.cs
  18. 93
      src/AddIns/BackendBindings/WixBinding/Test/Gui/GetWixDesignerFromViewTests.cs
  19. 63
      src/AddIns/BackendBindings/WixBinding/Test/Gui/LoaderProviderTests.cs
  20. 142
      src/AddIns/BackendBindings/WixBinding/Test/Gui/MissingDialogIdDesignerLoaderTestFixture.cs
  21. 135
      src/AddIns/BackendBindings/WixBinding/Test/Gui/NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs
  22. 2
      src/AddIns/BackendBindings/WixBinding/Test/Utils/MockWorkbench.cs
  23. 5
      src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj
  24. 2
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/IDesignerGenerator.cs
  25. 2
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/AbstractCodeDomDesignerLoader.cs
  26. 10
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/DesignerLoaderProvider.cs
  27. 44
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerViewContent.cs
  28. 2
      src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/EventBindingService.cs
  29. 3
      src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyContainer.cs

36
src/AddIns/BackendBindings/WixBinding/Project/Src/Commands/OpenDialogCommand.cs

@ -1,18 +1,18 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using ICSharpCode.Core; using ICSharpCode.Core;
//
//namespace ICSharpCode.WixBinding namespace ICSharpCode.WixBinding
//{ {
// public class OpenDialogCommand : AbstractMenuCommand public class OpenDialogCommand : AbstractMenuCommand
// { {
// public override void Run() public override void Run()
// { {
// if (SetupDialogListPad.Instance != null) { if (SetupDialogListPad.Instance != null) {
// SetupDialogListPad.Instance.OpenSelectedDialog(); SetupDialogListPad.Instance.OpenSelectedDialog();
// } }
// } }
// } }
//} }

124
src/AddIns/BackendBindings/WixBinding/Project/Src/Commands/ViewDialogXmlCommand.cs

@ -1,62 +1,62 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using System.IO; using System.IO;
//using System.Xml; using System.Xml;
//
//using ICSharpCode.Core; using ICSharpCode.Core;
//using ICSharpCode.NRefactory; using ICSharpCode.NRefactory;
//using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
//
//namespace ICSharpCode.WixBinding namespace ICSharpCode.WixBinding
//{ {
// public class ViewDialogXmlCommand : AbstractMenuCommand public class ViewDialogXmlCommand : AbstractMenuCommand
// { {
// public override void Run() public override void Run()
// { {
// // Get currently selected setup dialog. // Get currently selected setup dialog.
// SetupDialogListViewItem selectedDialogListItem = SetupDialogListPad.Instance.SelectedDialog; SetupDialogListViewItem selectedDialogListItem = SetupDialogListPad.Instance.SelectedDialog;
// if (selectedDialogListItem == null) { if (selectedDialogListItem == null) {
// return; return;
// } }
//
// SetupDialogErrorListViewItem errorDialogListItem = selectedDialogListItem as SetupDialogErrorListViewItem; SetupDialogErrorListViewItem errorDialogListItem = selectedDialogListItem as SetupDialogErrorListViewItem;
// if (errorDialogListItem == null) { if (errorDialogListItem == null) {
// ViewDialogXml(selectedDialogListItem.FileName, selectedDialogListItem.Id); ViewDialogXml(selectedDialogListItem.FileName, selectedDialogListItem.Id);
// } else { } else {
// FileService.JumpToFilePosition(errorDialogListItem.FileName, errorDialogListItem.Line, errorDialogListItem.Column); FileService.JumpToFilePosition(errorDialogListItem.FileName, errorDialogListItem.Line, errorDialogListItem.Column);
// } }
// } }
//
// static void ViewDialogXml(string fileName, string dialogId) static void ViewDialogXml(string fileName, string dialogId)
// { {
// // Find dialog xml in text. // Find dialog xml in text.
// Location location = GetDialogElementLocation(fileName, dialogId); TextLocation location = GetDialogElementLocation(fileName, dialogId);
//
// // Jump to text. // Jump to text.
// if (!location.IsEmpty) { if (!location.IsEmpty) {
// FileService.JumpToFilePosition(fileName, location.Y, location.X); FileService.JumpToFilePosition(fileName, location.Line, location.Column);
// } else { } else {
// MessageService.ShowErrorFormatted(StringParser.Parse("${res:ICSharpCode.WixBinding.ViewDialogXml.DialogIdNotFoundMessage}"), new string[] {dialogId, Path.GetFileName(fileName)}); MessageService.ShowErrorFormatted(StringParser.Parse("${res:ICSharpCode.WixBinding.ViewDialogXml.DialogIdNotFoundMessage}"), new string[] {dialogId, Path.GetFileName(fileName)});
// } }
// } }
//
// /// <summary> /// <summary>
// /// Gets the dialog element location given the filename and the dialog id. /// Gets the dialog element location given the filename and the dialog id.
// /// </summary> /// </summary>
// static Location GetDialogElementLocation(string fileName, string id) static TextLocation GetDialogElementLocation(string fileName, string id)
// { {
// try { try {
// WorkbenchTextFileReader workbenchTextFileReader = new WorkbenchTextFileReader(); WorkbenchTextFileReader workbenchTextFileReader = new WorkbenchTextFileReader();
// using (TextReader reader = workbenchTextFileReader.Create(fileName)) { using (TextReader reader = workbenchTextFileReader.Create(fileName)) {
// WixDocumentReader wixReader = new WixDocumentReader(reader); WixDocumentReader wixReader = new WixDocumentReader(reader);
// return wixReader.GetStartElementLocation("Dialog", id); return wixReader.GetStartElementLocation("Dialog", id);
// } }
// } catch (XmlException ex) { } catch (XmlException ex) {
// WixBindingService.ShowErrorInErrorList(fileName, ex); WixBindingService.ShowErrorInErrorList(fileName, ex);
// } }
// return Location.Empty; return TextLocation.Empty;
// } }
// } }
//} }

106
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/SetupDialogControlsSideTab.cs

@ -1,53 +1,53 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using System.Drawing.Design; using System.Drawing.Design;
//using System.IO; using System.IO;
//using System.Reflection; using System.Reflection;
//
//using ICSharpCode.Core; using ICSharpCode.Core;
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.FormsDesigner.Gui; using ICSharpCode.FormsDesigner.Gui;
//using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
//using ICSharpCode.SharpDevelop.Widgets.SideBar; using ICSharpCode.SharpDevelop.Widgets.SideBar;
//
//namespace ICSharpCode.WixBinding namespace ICSharpCode.WixBinding
//{ {
// public sealed class SetupDialogControlsSideTab : SideTabDesigner public sealed class SetupDialogControlsSideTab : SideTabDesigner
// { {
// SetupDialogControlsSideTab(SideBarControl sideBar, Category category, IToolboxService toolboxService) SetupDialogControlsSideTab(SideBarControl sideBar, Category category, IToolboxService toolboxService)
// : base(sideBar, category, toolboxService) : base(sideBar, category, toolboxService)
// { {
// } }
//
// /// <summary> /// <summary>
// /// Creates a new instance of the SetupDialogControlsSideTab class. /// Creates a new instance of the SetupDialogControlsSideTab class.
// /// </summary> /// </summary>
// public static SetupDialogControlsSideTab CreateSideTab() public static SetupDialogControlsSideTab CreateSideTab()
// { {
// ComponentLibraryLoader loader = new ComponentLibraryLoader(); ComponentLibraryLoader loader = new ComponentLibraryLoader();
// loader.LoadToolComponentLibrary(ToolComponentLibraryFileName); loader.LoadToolComponentLibrary(ToolComponentLibraryFileName);
//
// // Fix WixBinding assembly hint path. // Fix WixBinding assembly hint path.
// Category category = (Category)loader.Categories[0]; Category category = (Category)loader.Categories[0];
// foreach (ToolComponent toolComponent in category.ToolComponents) { foreach (ToolComponent toolComponent in category.ToolComponents) {
// toolComponent.HintPath = StringParser.Parse(toolComponent.HintPath); toolComponent.HintPath = StringParser.Parse(toolComponent.HintPath);
// } }
// return new SetupDialogControlsSideTab(WixDialogDesigner.SetupDialogControlsToolBox, category, ToolboxProvider.ToolboxService); return new SetupDialogControlsSideTab(WixDialogDesigner.SetupDialogControlsToolBox, category, ToolboxProvider.ToolboxService);
// } }
//
// /// <summary> /// <summary>
// /// Gets the file that contains the list of controls supported by the Wix dialog /// Gets the file that contains the list of controls supported by the Wix dialog
// /// designer. /// designer.
// /// </summary> /// </summary>
// static string ToolComponentLibraryFileName { static string ToolComponentLibraryFileName {
// get { get {
// Assembly assembly = typeof(SetupDialogControlsSideTab).Assembly; Assembly assembly = typeof(SetupDialogControlsSideTab).Assembly;
// string assemblyFilename = assembly.CodeBase.Replace("file:///", String.Empty); string assemblyFilename = assembly.CodeBase.Replace("file:///", String.Empty);
// string directory = Path.GetDirectoryName(assemblyFilename); string directory = Path.GetDirectoryName(assemblyFilename);
// return Path.Combine(directory, "SetupDialogControlLibrary.sdcl"); return Path.Combine(directory, "SetupDialogControlLibrary.sdcl");
// } }
// } }
// } }
//} }

386
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/SetupDialogListPad.cs

@ -1,193 +1,193 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using System.IO; using System.IO;
//using System.Xml; using System.Xml;
//
//using ICSharpCode.Core; using ICSharpCode.Core;
//using ICSharpCode.Core.WinForms; using ICSharpCode.Core.WinForms;
//using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
//using ICSharpCode.SharpDevelop.Project; using ICSharpCode.SharpDevelop.Project;
//using ICSharpCode.SharpDevelop.Workbench; using ICSharpCode.SharpDevelop.Workbench;
//
//namespace ICSharpCode.WixBinding namespace ICSharpCode.WixBinding
//{ {
// public class SetupDialogListPad : AbstractPadContent public class SetupDialogListPad : AbstractPadContent
// { {
// SetupDialogListView setupDialogListView; SetupDialogListView setupDialogListView;
// bool disposed; bool disposed;
// static SetupDialogListPad instance; static SetupDialogListPad instance;
//
// public SetupDialogListPad() public SetupDialogListPad()
// { {
// instance = this; instance = this;
//
// setupDialogListView = new SetupDialogListView(); setupDialogListView = new SetupDialogListView();
// setupDialogListView.ContextMenuStrip = MenuService.CreateContextMenu(setupDialogListView, "/SharpDevelop/Pads/WixSetupDialogListPad/ContextMenu"); setupDialogListView.ContextMenuStrip = MenuService.CreateContextMenu(setupDialogListView, "/SharpDevelop/Pads/WixSetupDialogListPad/ContextMenu");
// setupDialogListView.ItemActivate += SetupDialogListViewItemActivate; setupDialogListView.ItemActivate += SetupDialogListViewItemActivate;
// setupDialogListView.Enter += SetupDialogListViewEnter; setupDialogListView.Enter += SetupDialogListViewEnter;
//
// // Show dialogs in currently open wix project. // Show dialogs in currently open wix project.
// ShowDialogList(); ShowDialogList();
//
// ProjectService.CurrentProjectChanged += CurrentProjectChanged; ProjectService.CurrentProjectChanged += CurrentProjectChanged;
// } }
//
// static public SetupDialogListPad Instance { static public SetupDialogListPad Instance {
// get { get {
// return instance; return instance;
// } }
// } }
//
// public override object Control { public override object Control {
// get { get {
// return setupDialogListView; return setupDialogListView;
// } }
// } }
//
// public override void Dispose() public override void Dispose()
// { {
// if (!disposed) { if (!disposed) {
// disposed = true; disposed = true;
// setupDialogListView.Dispose(); setupDialogListView.Dispose();
// setupDialogListView = null; setupDialogListView = null;
// ProjectService.CurrentProjectChanged -= CurrentProjectChanged; ProjectService.CurrentProjectChanged -= CurrentProjectChanged;
// } }
// } }
//
// /// <summary> /// <summary>
// /// Opens the selected dialog and displays it in the designer. /// Opens the selected dialog and displays it in the designer.
// /// </summary> /// </summary>
// public void OpenSelectedDialog() public void OpenSelectedDialog()
// { {
// SetupDialogListViewItem selectedDialog = SelectedDialog; SetupDialogListViewItem selectedDialog = SelectedDialog;
// if (selectedDialog != null) { if (selectedDialog != null) {
// SetupDialogErrorListViewItem errorItem = selectedDialog as SetupDialogErrorListViewItem; SetupDialogErrorListViewItem errorItem = selectedDialog as SetupDialogErrorListViewItem;
// if (errorItem == null) { if (errorItem == null) {
// OpenDialog(selectedDialog.FileName, selectedDialog.Id); OpenDialog(selectedDialog.FileName, selectedDialog.Id);
// } else { } else {
// FileService.JumpToFilePosition(errorItem.FileName, errorItem.Line, errorItem.Column); FileService.JumpToFilePosition(errorItem.FileName, errorItem.Line, errorItem.Column);
// } }
// } }
// } }
//
// /// <summary> /// <summary>
// /// Gets the selected dialog list view item. /// Gets the selected dialog list view item.
// /// </summary> /// </summary>
// public SetupDialogListViewItem SelectedDialog { public SetupDialogListViewItem SelectedDialog {
// get { get {
// if (setupDialogListView.SelectedItems.Count > 0) { if (setupDialogListView.SelectedItems.Count > 0) {
// return (SetupDialogListViewItem)(setupDialogListView.SelectedItems[0]); return (SetupDialogListViewItem)(setupDialogListView.SelectedItems[0]);
// } }
// return null; return null;
// } }
// } }
//
// /// <summary> /// <summary>
// /// Adds all the dialog ids from all the files in the project to the list view. /// Adds all the dialog ids from all the files in the project to the list view.
// /// </summary> /// </summary>
// /// <remarks> /// <remarks>
// /// If an error occurs an error item is added to the list. The error /// If an error occurs an error item is added to the list. The error
// /// list is only cleared the first time an error occurs /// list is only cleared the first time an error occurs
// /// since there may be multiple errors, one in each Wix file. /// since there may be multiple errors, one in each Wix file.
// /// Also we do not clear the error list unless we have an error /// Also we do not clear the error list unless we have an error
// /// so any previously added errors from a build, for example, are not /// so any previously added errors from a build, for example, are not
// /// cleared unless we have to. /// cleared unless we have to.
// /// </remarks> /// </remarks>
// void ShowDialogList() void ShowDialogList()
// { {
// // Make sure we do not leave any errors in the error list from a previous call. // Make sure we do not leave any errors in the error list from a previous call.
// if (setupDialogListView.HasErrors) { if (setupDialogListView.HasErrors) {
// WixBindingService.ClearErrorList(); WixBindingService.ClearErrorList();
// } }
//
// setupDialogListView.Items.Clear(); setupDialogListView.Items.Clear();
//
// WixProject openWixProject = ProjectService.CurrentProject as WixProject; WixProject openWixProject = ProjectService.CurrentProject as WixProject;
// if (openWixProject != null) { if (openWixProject != null) {
// bool clearedErrorList = false; bool clearedErrorList = false;
// foreach (FileProjectItem wixFile in openWixProject.WixFiles) { foreach (FileProjectItem wixFile in openWixProject.WixFiles) {
// if (File.Exists(wixFile.FileName)) { if (File.Exists(wixFile.FileName)) {
// try { try {
// AddDialogListItems(wixFile.FileName); AddDialogListItems(wixFile.FileName);
// } catch (XmlException ex) { } catch (XmlException ex) {
// // Clear the error list the first time only. // Clear the error list the first time only.
// if (!clearedErrorList) { if (!clearedErrorList) {
// clearedErrorList = true; clearedErrorList = true;
// WixBindingService.ClearErrorList(); WixBindingService.ClearErrorList();
// } }
// setupDialogListView.AddError(wixFile.FileName, ex); setupDialogListView.AddError(wixFile.FileName, ex);
// WixBindingService.AddErrorToErrorList(wixFile.FileName, ex); WixBindingService.AddErrorToErrorList(wixFile.FileName, ex);
// } }
// } }
// } }
// if (clearedErrorList) { if (clearedErrorList) {
// WixBindingService.ShowErrorList(); WixBindingService.ShowErrorList();
// } }
// } }
// } }
//
// /// <summary> /// <summary>
// /// Adds dialog ids to the list. /// Adds dialog ids to the list.
// /// </summary> /// </summary>
// void AddDialogListItems(string fileName) void AddDialogListItems(string fileName)
// { {
// WorkbenchTextFileReader workbenchTextFileReader = new WorkbenchTextFileReader(); WorkbenchTextFileReader workbenchTextFileReader = new WorkbenchTextFileReader();
// using (TextReader reader = workbenchTextFileReader.Create(fileName)) { using (TextReader reader = workbenchTextFileReader.Create(fileName)) {
// WixDocumentReader wixReader = new WixDocumentReader(reader); WixDocumentReader wixReader = new WixDocumentReader(reader);
// setupDialogListView.AddDialogs(fileName, wixReader.GetDialogIds()); setupDialogListView.AddDialogs(fileName, wixReader.GetDialogIds());
// } }
// } }
//
// void CurrentProjectChanged(object source, ProjectEventArgs e) void CurrentProjectChanged(object source, ProjectEventArgs e)
// { {
// ShowDialogList(); ShowDialogList();
// } }
//
// void SetupDialogListViewItemActivate(object source, EventArgs e) void SetupDialogListViewItemActivate(object source, EventArgs e)
// { {
// OpenSelectedDialog(); OpenSelectedDialog();
// } }
//
// /// <summary> /// <summary>
// /// When the setup dialog list gets focus update the list of dialogs since /// When the setup dialog list gets focus update the list of dialogs since
// /// the Wix document may have changed. /// the Wix document may have changed.
// /// </summary> /// </summary>
// void SetupDialogListViewEnter(object source, EventArgs e) void SetupDialogListViewEnter(object source, EventArgs e)
// { {
// UpdateDialogList(); UpdateDialogList();
// } }
//
// /// <summary> /// <summary>
// /// Opens the specified dialog id into the designer. /// Opens the specified dialog id into the designer.
// /// </summary> /// </summary>
// static void OpenDialog(string fileName, string dialogId) static void OpenDialog(string fileName, string dialogId)
// { {
// // Open the Wix file. // Open the Wix file.
// IViewContent viewContent = FileService.OpenFile(fileName); IViewContent viewContent = FileService.OpenFile(fileName);
//
// // Show the designer. // Show the designer.
// WixDialogDesigner designer = WixDialogDesigner.GetDesigner(viewContent); WixDialogDesigner designer = WixDialogDesigner.GetDesigner(viewContent);
// if (designer != null) { if (designer != null) {
// designer.OpenDialog(dialogId); designer.OpenDialog(dialogId);
// } else { } else {
// LoggingService.Debug("Could not open Wix dialog designer for: " + fileName); LoggingService.Debug("Could not open Wix dialog designer for: " + fileName);
// } }
// } }
//
// /// <summary> /// <summary>
// /// Updates the list if the Wix documents can be read otherwise the list /// Updates the list if the Wix documents can be read otherwise the list
// /// items are unchanged for that document. /// items are unchanged for that document.
// /// </summary> /// </summary>
// void UpdateDialogList() void UpdateDialogList()
// { {
// try { try {
// setupDialogListView.BeginUpdate(); setupDialogListView.BeginUpdate();
// ShowDialogList(); ShowDialogList();
// } finally { } finally {
// setupDialogListView.EndUpdate(); setupDialogListView.EndUpdate();
// } }
// } }
// } }
//} }

598
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs

@ -1,296 +1,302 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using System.Collections.ObjectModel; using System.Collections.ObjectModel;
//using System.IO; using System.IO;
//using System.Xml; using System.Xml;
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.NRefactory; using ICSharpCode.NRefactory;
//using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
//using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.SharpDevelop.Editor;
//using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
//using ICSharpCode.SharpDevelop.Project; using ICSharpCode.SharpDevelop.Project;
//using ICSharpCode.SharpDevelop.Refactoring; using ICSharpCode.SharpDevelop.Refactoring;
// using ICSharpCode.SharpDevelop.Workbench;
//namespace ICSharpCode.WixBinding
//{ namespace ICSharpCode.WixBinding
// public class WixDialogDesigner : FormsDesignerViewContent, IWixDialogDesigner {
// { public class WixDialogDesigner : FormsDesignerViewContent, IWixDialogDesigner
// string dialogId = String.Empty; {
// WixProject wixProject; string dialogId = String.Empty;
// WixProject wixProject;
// /// <summary>
// /// Ignore the dialog id in the text editor if the OpenDialog method is called /// <summary>
// /// and the designer is not being opened by the user clicking the Design tab. /// Ignore the dialog id in the text editor if the OpenDialog method is called
// /// </summary> /// and the designer is not being opened by the user clicking the Design tab.
// bool ignoreDialogIdSelectedInTextEditor; /// </summary>
// bool ignoreDialogIdSelectedInTextEditor;
// public WixDialogDesigner(IViewContent view)
// : this(view, new WixDialogDesignerLoaderProvider(), new WixDialogDesignerGenerator()) public WixDialogDesigner(IViewContent view)
// { : this(view, new WixDialogDesignerLoaderProvider())
// } {
// }
// public WixDialogDesigner(IViewContent view, WixDialogDesignerLoaderProvider designerLoaderProvider, WixDialogDesignerGenerator designerGenerator)
// : base(view, designerLoaderProvider, designerGenerator) public WixDialogDesigner(IViewContent view, WixDialogDesignerLoaderProvider designerLoaderProvider)
// { : base(view, designerLoaderProvider)
// designerLoaderProvider.Designer = this; {
// } }
//
// /// <summary> /// <summary>
// /// Gets the WixDialogDesigner from the primary view. /// Gets the WixDialogDesigner from the primary view.
// /// </summary> /// </summary>
// /// <returns>The wix dialog designer view that is attached as a /// <returns>The wix dialog designer view that is attached as a
// /// secondary view; <see langword="null"/> if the primary view /// secondary view; <see langword="null"/> if the primary view
// /// has no such designer attached.</returns> /// has no such designer attached.</returns>
// public static WixDialogDesigner GetDesigner(IViewContent view) public static WixDialogDesigner GetDesigner(IViewContent view)
// { {
// foreach (IViewContent secondaryView in view.SecondaryViewContents) { foreach (IViewContent secondaryView in view.SecondaryViewContents) {
// WixDialogDesigner designer = secondaryView as WixDialogDesigner; WixDialogDesigner designer = secondaryView as WixDialogDesigner;
// if (designer != null) { if (designer != null) {
// return designer; return designer;
// } }
// } }
// return null; return null;
// } }
//
// /// <summary> /// <summary>
// /// Attempts to open the Wix dialog from the document currently /// Attempts to open the Wix dialog from the document currently
// /// associated with this designer. /// associated with this designer.
// /// </summary> /// </summary>
// /// <param name="id">The id of the dialog that will be opened.</param> /// <param name="id">The id of the dialog that will be opened.</param>
// public void OpenDialog(string id) public void OpenDialog(string id)
// { {
// JumpToDialogElement(id); JumpToDialogElement(id);
// if (base.Host != null) { if (base.Host != null) {
// // Reload so the correct dialog is displayed. // Reload so the correct dialog is displayed.
// MergeAndUnloadDesigner(); MergeAndUnloadDesigner();
// DialogId = id; DialogId = id;
// ReloadDesignerFromMemory(); ReloadDesignerFromMemory();
// } else { } else {
// // Need to open the designer. // Need to open the designer.
// DialogId = id; DialogId = id;
// OpenDesigner(); OpenDesigner();
// } }
// } }
//
// protected override void LoadInternal(OpenedFile file, Stream stream) protected override void LoadInternal(OpenedFile file, Stream stream)
// { {
// if (file == this.PrimaryFile) { if (file == this.PrimaryFile) {
// // The FormsDesignerViewContent normally operates independently of any // The FormsDesignerViewContent normally operates independently of any
// // text editor. The following statements connect the forms designer // text editor. The following statements connect the forms designer
// // directly to the underlying XML text editor so that the caret positioning // directly to the underlying XML text editor so that the caret positioning
// // and text selection operations done by the WiX designer actually // and text selection operations done by the WiX designer actually
// // become visible in the text editor. // become visible in the text editor.
// if (!this.SourceCodeStorage.ContainsFile(file)) { if (!this.SourceCodeStorage.ContainsFile(file)) {
// ITextEditor editor = ((ITextEditorProvider)this.PrimaryViewContent).TextEditor; ITextEditor editor = ((ITextEditorProvider)this.PrimaryViewContent).TextEditor;
// this.SourceCodeStorage.AddFile(file, editor.Document, ParserService.DefaultFileEncoding, true); this.SourceCodeStorage.AddFile(file, editor.Document, SD.FileService.DefaultFileEncoding, true);
// } }
//
// try { try {
// if (!ignoreDialogIdSelectedInTextEditor) { if (!ignoreDialogIdSelectedInTextEditor) {
// string dialogId = GetDialogIdSelectedInTextEditor(); string dialogId = GetDialogIdSelectedInTextEditor();
// if (dialogId == null) { if (dialogId == null) {
// dialogId = GetFirstDialogIdInTextEditor(); dialogId = GetFirstDialogIdInTextEditor();
// JumpToDialogElement(dialogId); JumpToDialogElement(dialogId);
// } }
// DialogId = dialogId; DialogId = dialogId;
// } }
// wixProject = GetProject(); wixProject = GetProject();
// } catch (XmlException ex) { } catch (XmlException ex) {
// // Let the Wix designer loader try to load the XML and generate // Let the Wix designer loader try to load the XML and generate
// // an error message. // an error message.
// DialogId = "InvalidXML"; DialogId = "InvalidXML";
// AddToErrorList(ex); AddToErrorList(ex);
// } }
// } }
// base.LoadInternal(file, stream); base.LoadInternal(file, stream);
// } }
//
// #region Switch...WithoutSaveLoad #region Switch...WithoutSaveLoad
//
// // These four methods prevent the text editor from doing a full save/load // These four methods prevent the text editor from doing a full save/load
// // cycle when switching views. This allows the text editor to keep its // cycle when switching views. This allows the text editor to keep its
// // selection and caret position. // selection and caret position.
//
// public override bool SupportsSwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView) public override bool SupportsSwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView)
// { {
// return (newView == this) || (newView == this.PrimaryViewContent); return (newView == this) || (newView == this.PrimaryViewContent);
// } }
//
// public override void SwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView) public override void SwitchFromThisWithoutSaveLoad(OpenedFile file, IViewContent newView)
// { {
// if (newView != this) { if (newView != this) {
// this.MergeAndUnloadDesigner(); this.MergeAndUnloadDesigner();
// } }
// } }
//
// public override bool SupportsSwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView) public override bool SupportsSwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView)
// { {
// return (this.DesignerCodeFile != null) && return (this.DesignerCodeFile != null) &&
// ((oldView == this) || (oldView == this.PrimaryViewContent)); ((oldView == this) || (oldView == this.PrimaryViewContent));
// } }
//
// public override void SwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView) public override void SwitchToThisWithoutSaveLoad(OpenedFile file, IViewContent oldView)
// { {
// if (oldView != this) { if (oldView != this) {
// this.ReloadDesignerFromMemory(); this.ReloadDesignerFromMemory();
// } }
// } }
//
// #endregion #endregion
//
// /// <summary> /// <summary>
// /// Gets the Wix document filename. /// Gets the Wix document filename.
// /// </summary> /// </summary>
// public string DocumentFileName { public string DocumentFileName {
// get { return PrimaryFileName; } get { return PrimaryFileName; }
// } }
//
// /// <summary> /// <summary>
// /// Gets the wix project containing the document open in the designer. /// Gets the wix project containing the document open in the designer.
// /// </summary> /// </summary>
// public WixProject Project { public WixProject Project {
// get { return wixProject; } get { return wixProject; }
// } }
//
// /// <summary> /// <summary>
// /// Gets the Wix document xml. /// Gets the Wix document xml.
// /// </summary> /// </summary>
// public string GetDocumentXml() public string GetDocumentXml()
// { {
// return DesignerCodeFileContent; return DesignerCodeFileContent;
// } }
//
// /// <summary> public ITextEditor PrimaryViewContentTextEditor {
// /// Gets or sets the dialog id currently being designed. get {
// /// </summary> return PrimaryViewContent.GetRequiredService<ITextEditor>();
// public string DialogId { }
// get { return dialogId; } }
// set { dialogId = value; }
// } /// <summary>
// /// Gets or sets the dialog id currently being designed.
// /// <summary> /// </summary>
// /// Finds the WixDialogDesigner in the current window's secondary views public string DialogId {
// /// and switches to it. get { return dialogId; }
// /// </summary> set { dialogId = value; }
// void OpenDesigner() }
// {
// try { /// <summary>
// ignoreDialogIdSelectedInTextEditor = true; /// Finds the WixDialogDesigner in the current window's secondary views
// WorkbenchWindow.ActiveViewContent = this; /// and switches to it.
// } finally { /// </summary>
// ignoreDialogIdSelectedInTextEditor = false; void OpenDesigner()
// } {
// } try {
// ignoreDialogIdSelectedInTextEditor = true;
// /// <summary> WorkbenchWindow.ActiveViewContent = this;
// /// From the current cursor position in the text editor determine the } finally {
// /// selected dialog id. ignoreDialogIdSelectedInTextEditor = false;
// /// </summary> }
// string GetDialogIdSelectedInTextEditor() }
// {
// ITextEditor textEditor = ActiveTextEditor; /// <summary>
// if (textEditor != null) { /// From the current cursor position in the text editor determine the
// WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text); /// selected dialog id.
// return wixReader.GetDialogId(textEditor.Caret.Line); /// </summary>
// } string GetDialogIdSelectedInTextEditor()
// return null; {
// } ITextEditor textEditor = ActiveTextEditor;
// if (textEditor != null) {
// /// <summary> WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text);
// /// Gets the first dialog id in the file. return wixReader.GetDialogId(textEditor.Caret.Line);
// /// </summary> }
// string GetFirstDialogIdInTextEditor() return null;
// { }
// ITextEditor textEditor = ActiveTextEditor;
// if (textEditor != null) { /// <summary>
// WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text); /// Gets the first dialog id in the file.
// ReadOnlyCollection<string> ids = wixReader.GetDialogIds(); /// </summary>
// if (ids.Count > 0) { string GetFirstDialogIdInTextEditor()
// return ids[0]; {
// } ITextEditor textEditor = ActiveTextEditor;
// } if (textEditor != null) {
// return null; WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text);
// } ReadOnlyCollection<string> ids = wixReader.GetDialogIds();
// if (ids.Count > 0) {
// /// <summary> return ids[0];
// /// Gets the active text area control. }
// /// </summary> }
// ITextEditor ActiveTextEditor { return null;
// get { }
// ITextEditorProvider provider = this.PrimaryViewContent as ITextEditorProvider;
// if (provider != null) { /// <summary>
// return provider.TextEditor; /// Gets the active text area control.
// } /// </summary>
// return null; ITextEditor ActiveTextEditor {
// } get {
// } ITextEditorProvider provider = this.PrimaryViewContent as ITextEditorProvider;
// if (provider != null) {
// void AddToErrorList(XmlException ex) return provider.TextEditor;
// { }
// TaskService.ClearExceptCommentTasks(); return null;
// TaskService.Add(new Task(this.PrimaryFileName, ex.Message, ex.LinePosition - 1, ex.LineNumber - 1, TaskType.Error)); }
// WorkbenchSingleton.Workbench.GetPad(typeof(ErrorListPad)).BringPadToFront(); }
// }
// void AddToErrorList(XmlException ex)
// /// <summary> {
// /// Cannot use ProjectService.CurrentProject since it is possible to switch TaskService.ClearExceptCommentTasks();
// /// to the designer without selecting the project. TaskService.Add(new SDTask(this.PrimaryFileName, ex.Message, ex.LinePosition - 1, ex.LineNumber - 1, TaskType.Error));
// /// </summary> SD.Workbench.GetPad(typeof(ErrorListPad)).BringPadToFront();
// WixProject GetProject() }
// {
// Solution openSolution = ProjectService.OpenSolution; /// <summary>
// if (openSolution != null) { /// Cannot use ProjectService.CurrentProject since it is possible to switch
// foreach (IProject project in openSolution.Projects) { /// to the designer without selecting the project.
// if (project.IsFileInProject(this.PrimaryFileName)) { /// </summary>
// return project as WixProject; WixProject GetProject()
// } {
// } ISolution openSolution = ProjectService.OpenSolution;
// } if (openSolution != null) {
// return null; foreach (IProject project in openSolution.Projects) {
// } if (project.IsFileInProject(this.PrimaryFileName)) {
// return project as WixProject;
// /// <summary> }
// /// Jumps to dialog element with corresponding dialog id. This is only used }
// /// when the user opens a dialog from the Setup dialogs window or the cursor }
// /// was not near a dialog when the designer was switched to. Jumping to the return null;
// /// dialog selected ensures that when the user switches back, if they did }
// /// not make any changes, then the dialog xml is displayed.
// /// </summary> /// <summary>
// void JumpToDialogElement(string dialogId) /// Jumps to dialog element with corresponding dialog id. This is only used
// { /// when the user opens a dialog from the Setup dialogs window or the cursor
// try { /// was not near a dialog when the designer was switched to. Jumping to the
// if (dialogId != null) { /// dialog selected ensures that when the user switches back, if they did
// ITextEditor textEditor = ActiveTextEditor; /// not make any changes, then the dialog xml is displayed.
// if (textEditor != null) { /// </summary>
// WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text); void JumpToDialogElement(string dialogId)
// Location location = wixReader.GetStartElementLocation("Dialog", dialogId); {
// textEditor.JumpTo(location.Y, 1); try {
// } if (dialogId != null) {
// } ITextEditor textEditor = ActiveTextEditor;
// } catch (XmlException) { if (textEditor != null) {
// // Ignore WixDocumentReader wixReader = new WixDocumentReader(textEditor.Document.Text);
// } TextLocation location = wixReader.GetStartElementLocation("Dialog", dialogId);
// } textEditor.JumpTo(location.Line, 1);
// }
// static SharpDevelopSideBar setupDialogControlsToolBox; }
// } catch (XmlException) {
// public static SharpDevelopSideBar SetupDialogControlsToolBox { // Ignore
// get { }
// WorkbenchSingleton.AssertMainThread(); }
// if (setupDialogControlsToolBox == null) {
// setupDialogControlsToolBox = new SharpDevelopSideBar(); static SharpDevelopSideBar setupDialogControlsToolBox;
// setupDialogControlsToolBox.Tabs.Add(SetupDialogControlsSideTab.CreateSideTab());
// setupDialogControlsToolBox.ActiveTab = setupDialogControlsToolBox.Tabs[0]; public static SharpDevelopSideBar SetupDialogControlsToolBox {
// } get {
// return setupDialogControlsToolBox; SD.MainThread.VerifyAccess();
// } if (setupDialogControlsToolBox == null) {
// } setupDialogControlsToolBox = new SharpDevelopSideBar();
// setupDialogControlsToolBox.Tabs.Add(SetupDialogControlsSideTab.CreateSideTab());
// setupDialogControlsToolBox.ActiveTab = setupDialogControlsToolBox.Tabs[0];
// public override object ToolsContent { }
// get { return SetupDialogControlsToolBox; } return setupDialogControlsToolBox;
// } }
// } }
//}
public override object ToolsContent {
get { return SetupDialogControlsToolBox; }
}
}
}

3
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerDisplayBinding.cs

@ -32,8 +32,7 @@ namespace ICSharpCode.WixBinding
public IViewContent[] CreateSecondaryViewContent(IViewContent view) public IViewContent[] CreateSecondaryViewContent(IViewContent view)
{ {
//return new IViewContent[] {new WixDialogDesigner(view)}; return new IViewContent[] {new WixDialogDesigner(view)};
return null;
} }
bool IsViewTextEditorProvider(IViewContent view) bool IsViewTextEditorProvider(IViewContent view)

200
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerGenerator.cs

@ -1,122 +1,78 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using System.CodeDom; using System.CodeDom;
//using System.CodeDom.Compiler; using System.CodeDom.Compiler;
//using System.Collections; using System.Collections;
//using System.Collections.Generic; using System.Collections.Generic;
//using System.ComponentModel; using System.ComponentModel;
//using System.Reflection; using System.Reflection;
//using System.Xml; using System.Xml;
//
//using ICSharpCode.Core; using ICSharpCode.Core;
//using ICSharpCode.NRefactory.TypeSystem; using ICSharpCode.FormsDesigner;
//using ICSharpCode.SharpDevelop.Editor; using ICSharpCode.NRefactory.Editor;
//using Microsoft.CSharp; using ICSharpCode.NRefactory.TypeSystem;
// using ICSharpCode.SharpDevelop.Editor;
//namespace ICSharpCode.WixBinding using Microsoft.CSharp;
//{
// /// <summary> namespace ICSharpCode.WixBinding
// /// Simplified designer generator interface that the WixDesignerLoader calls {
// /// when flushing the changes. /// <summary>
// /// </summary> /// Simplified designer generator interface that the WixDesignerLoader calls
// public interface IWixDialogDesignerGenerator /// when flushing the changes.
// { /// </summary>
// /// <summary> public interface IWixDialogDesignerGenerator
// /// Passes the updated dialog element and its original id to the generator {
// /// so the wix document can be updated. /// <summary>
// /// </summary> /// Passes the updated dialog element and its original id to the generator
// /// <remarks>The dialog id is passed since it becomes the name of the /// so the wix document can be updated.
// /// form and this can be changed from the designer.</remarks> /// </summary>
// void MergeFormChanges(string dialogId, XmlElement dialogElement); /// <remarks>The dialog id is passed since it becomes the name of the
// } /// form and this can be changed from the designer.</remarks>
// void MergeFormChanges(string dialogId, XmlElement dialogElement);
// public class WixDialogDesignerGenerator : IDesignerGenerator, IWixDialogDesignerGenerator }
// {
// FormsDesignerViewContent view; public class WixDialogDesignerGenerator : IWixDialogDesignerGenerator
// ITextEditor textEditor; {
// readonly IWixDialogDesigner view;
// public CodeDomProvider CodeDomProvider {
// get { return new CSharpCodeProvider(); } public WixDialogDesignerGenerator(IWixDialogDesigner view)
// } {
// this.view = view;
// public FormsDesignerViewContent ViewContent { }
// get { return view; }
// } /// <summary>
// /// Merges the changes made to the wix document by overwriting the dialog element.
// public IEnumerable<OpenedFile> GetSourceFiles(out OpenedFile designerCodeFile) /// </summary>
// { void IWixDialogDesignerGenerator.MergeFormChanges(string dialogId, XmlElement dialogElement)
// designerCodeFile = view.PrimaryFile; {
// return new [] {designerCodeFile}; DomRegion region = GetTextEditorRegionForDialogElement(dialogId);
// } if (region.IsEmpty) {
// ThrowDialogElementCouldNotBeFoundError(dialogId);
// public void Attach(FormsDesignerViewContent view) }
// {
// this.view = view; var textEditor = view.PrimaryViewContentTextEditor;
// textEditor = ((ITextEditorProvider)view.PrimaryViewContent).TextEditor; WixTextWriter writer = new WixTextWriter(textEditor.Options);
// } WixDialogElement wixDialogElement = (WixDialogElement)dialogElement;
// string newDialogXml = wixDialogElement.GetXml(writer);
// public void Detach()
// { WixDocumentEditor editor = new WixDocumentEditor(textEditor);
// view = null; editor.Replace(region, newDialogXml);
// } }
//
// /// <summary> DomRegion GetTextEditorRegionForDialogElement(string dialogId)
// /// Merges the changes made to the wix document by overwriting the dialog element. {
// /// </summary> WixDocumentReader wixReader = new WixDocumentReader(view.GetDocumentXml());
// void IWixDialogDesignerGenerator.MergeFormChanges(string dialogId, XmlElement dialogElement) return wixReader.GetElementRegion("Dialog", dialogId);
// { }
// DomRegion region = GetTextEditorRegionForDialogElement(dialogId);
// if (region.IsEmpty) { void ThrowDialogElementCouldNotBeFoundError(string dialogId)
// ThrowDialogElementCouldNotBeFoundError(dialogId); {
// } string messageFormat = StringParser.Parse("${res:ICSharpCode.WixBinding.DialogDesignerGenerator.DialogIdNotFoundMessage}");
// string message = String.Format(messageFormat, dialogId);
// WixTextWriter writer = new WixTextWriter(textEditor.Options); throw new FormsDesignerLoadException(message);
// WixDialogElement wixDialogElement = (WixDialogElement)dialogElement; }
// string newDialogXml = wixDialogElement.GetXml(writer); }
// }
// WixDocumentEditor editor = new WixDocumentEditor(textEditor);
// editor.Replace(region, newDialogXml);
// }
//
// DomRegion GetTextEditorRegionForDialogElement(string dialogId)
// {
// IDocument document = view.DesignerCodeFileDocument;
// WixDocumentReader wixReader = new WixDocumentReader(document.Text);
// return wixReader.GetElementRegion("Dialog", dialogId);
// }
//
// void ThrowDialogElementCouldNotBeFoundError(string dialogId)
// {
// string messageFormat = StringParser.Parse("${res:ICSharpCode.WixBinding.DialogDesignerGenerator.DialogIdNotFoundMessage}");
// string message = String.Format(messageFormat, dialogId);
// throw new FormsDesignerLoadException(message);
// }
//
// public void MergeFormChanges(CodeCompileUnit unit)
// {
// }
//
// public void NotifyComponentRenamed(object component, string newName, string oldName)
// {
// }
//
// public bool InsertComponentEvent(IComponent component, EventDescriptor edesc, string eventMethodName, string body, out string file, out int position)
// {
// file = null;
// position = 0;
// return false;
// }
//
// public ICollection GetCompatibleMethods(EventDescriptor edesc)
// {
// return new ArrayList();
// }
//
// public ICollection GetCompatibleMethods(EventInfo edesc)
// {
// return new ArrayList();
// }
// }
//}

303
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerLoader.cs

@ -1,155 +1,148 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using System.ComponentModel; using System.ComponentModel;
//using System.ComponentModel.Design.Serialization; using System.ComponentModel.Design.Serialization;
//using System.Security.Permissions; using System.Security.Permissions;
//using System.Windows.Forms; using System.Windows.Forms;
//using System.Xml; using System.Xml;
//
//using ICSharpCode.Core; using ICSharpCode.Core;
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.FormsDesigner.Services; using ICSharpCode.FormsDesigner.Services;
// using ICSharpCode.SharpDevelop;
//namespace ICSharpCode.WixBinding
//{ namespace ICSharpCode.WixBinding
// [PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")] {
// [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")] [PermissionSet(SecurityAction.InheritanceDemand, Name="FullTrust")]
// public class WixDialogDesignerLoader : BasicDesignerLoader, IComponentCreator [PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]
// { public class WixDialogDesignerLoader : BasicDesignerLoader, IComponentCreator
// WixDialog wixDialog; {
// IWixDialogDesignerGenerator generator; WixDialog wixDialog;
// IFileLoader fileLoader; IWixDialogDesignerGenerator generator;
// IWixDialogDesigner designer; IFileLoader fileLoader;
// IWixDialogDesigner designer;
// public WixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator)
// : this(designer, generator, new DefaultFileLoader()) /// <summary>
// { /// Creates a new WixDialogDesignerLoader that will load the specified
// } /// dialog id from the Wix xml.
// /// </summary>
// /// <summary> public WixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator = null, IFileLoader fileLoader = null)
// /// Creates a new WixDialogDesignerLoader that will load the specified {
// /// dialog id from the Wix xml. if (designer == null) {
// /// </summary> throw new ArgumentNullException("designer");
// public WixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator, IFileLoader fileLoader) }
// {
// this.designer = designer; this.designer = designer;
// this.generator = generator; this.generator = generator ?? new WixDialogDesignerGenerator(designer);
// this.fileLoader = fileLoader; this.fileLoader = fileLoader ?? new DefaultFileLoader();
// }
// if (designer == null) {
// throw new ArgumentNullException("designer"); public IWixDialogDesigner Designer {
// } get { return designer; }
// if (generator == null) { }
// throw new ArgumentNullException("generator");
// } public IWixDialogDesignerGenerator Generator {
// } get { return generator; }
// }
// public IWixDialogDesigner Designer {
// get { return designer; } public override void BeginLoad(IDesignerLoaderHost host)
// } {
// VerifyDesignerHasDialogId();
// public IWixDialogDesignerGenerator Generator {
// get { return generator; } GetDialogElement();
// } VerifyDialogElementFound();
//
// public override void BeginLoad(IDesignerLoaderHost host) AddServicesToHost(host);
// {
// VerifyDesignerHasDialogId(); base.BeginLoad(host);
// }
// GetDialogElement();
// VerifyDialogElementFound(); void VerifyDesignerHasDialogId()
// {
// AddServicesToHost(host); if (DesignerHasDialogId) {
// ThrowNoDialogSelectedInDocumentException();
// base.BeginLoad(host); }
// } }
//
// void VerifyDesignerHasDialogId() bool DesignerHasDialogId {
// { get { return designer.DialogId == null; }
// if (DesignerHasDialogId) { }
// ThrowNoDialogSelectedInDocumentException();
// } void ThrowNoDialogSelectedInDocumentException()
// } {
// string message = StringParser.Parse("${res:ICSharpCode.WixBinding.WixDialogDesigner.NoDialogSelectedInDocumentMessage}");
// bool DesignerHasDialogId { throw new FormsDesignerLoadException(message);
// get { return designer.DialogId == null; } }
// }
// void GetDialogElement()
// void ThrowNoDialogSelectedInDocumentException() {
// { WixDocument document = CreateWixDocument();
// string message = StringParser.Parse("${res:ICSharpCode.WixBinding.WixDialogDesigner.NoDialogSelectedInDocumentMessage}"); document.LoadXml(designer.GetDocumentXml());
// throw new FormsDesignerLoadException(message); wixDialog = document.CreateWixDialog(designer.DialogId, new WorkbenchTextFileReader());
// } }
//
// void GetDialogElement() WixDocument CreateWixDocument()
// { {
// WixDocument document = CreateWixDocument(); WixDocument document = new WixDocument(designer.Project, fileLoader);
// document.LoadXml(designer.GetDocumentXml()); document.FileName = designer.DocumentFileName;
// wixDialog = document.CreateWixDialog(designer.DialogId, new WorkbenchTextFileReader()); return document;
// } }
//
// WixDocument CreateWixDocument() void VerifyDialogElementFound()
// { {
// WixDocument document = new WixDocument(designer.Project, fileLoader); if (wixDialog == null) {
// document.FileName = designer.DocumentFileName; ThrowDialogIdNotFoundException(designer.DialogId);
// return document; }
// } }
//
// void VerifyDialogElementFound() void ThrowDialogIdNotFoundException(string dialogId)
// { {
// if (wixDialog == null) { string messageFormat = StringParser.Parse("${res:ICSharpCode.WixBinding.DialogDesignerGenerator.DialogIdNotFoundMessage}");
// ThrowDialogIdNotFoundException(designer.DialogId); string message = String.Format(messageFormat, designer.DialogId);
// } throw new FormsDesignerLoadException(message);
// } }
//
// void ThrowDialogIdNotFoundException(string dialogId) void AddServicesToHost(IDesignerLoaderHost host)
// { {
// string messageFormat = StringParser.Parse("${res:ICSharpCode.WixBinding.DialogDesignerGenerator.DialogIdNotFoundMessage}"); host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host));
// string message = String.Format(messageFormat, designer.DialogId); host.AddService(typeof(INameCreationService), new XmlDesignerNameCreationService(host));
// throw new FormsDesignerLoadException(message); host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(host));
// } }
//
// void AddServicesToHost(IDesignerLoaderHost host) /// <summary>
// { /// Creates a component of the specified type.
// host.AddService(typeof(ComponentSerializationService), new CodeDomComponentSerializationService((IServiceProvider)host)); /// </summary>
// host.AddService(typeof(INameCreationService), new XmlDesignerNameCreationService(host)); public IComponent CreateComponent(Type componentClass, string name)
// host.AddService(typeof(IDesignerSerializationService), new DesignerSerializationService(host)); {
// } return base.LoaderHost.CreateComponent(componentClass, name);
// }
// /// <summary>
// /// Creates a component of the specified type. /// <summary>
// /// </summary> /// Updates the dialog xml element and then passes this to the generator so the
// public IComponent CreateComponent(Type componentClass, string name) /// Wix document is updated.
// { /// </summary>
// return base.LoaderHost.CreateComponent(componentClass, name); protected override void PerformFlush(IDesignerSerializationManager serializationManager)
// } {
// XmlElement updatedDialogElement = GenerateNewDialogElementFromDesignedForm();
// /// <summary> MergeDialogChangesIntoFullWixDocument(updatedDialogElement);
// /// Updates the dialog xml element and then passes this to the generator so the }
// /// Wix document is updated.
// /// </summary> XmlElement GenerateNewDialogElementFromDesignedForm()
// protected override void PerformFlush(IDesignerSerializationManager serializationManager) {
// { Form form = (Form)base.LoaderHost.RootComponent;
// XmlElement updatedDialogElement = GenerateNewDialogElementFromDesignedForm(); return wixDialog.UpdateDialogElement(form);
// MergeDialogChangesIntoFullWixDocument(updatedDialogElement); }
// }
// void MergeDialogChangesIntoFullWixDocument(XmlElement updatedDialogElement)
// XmlElement GenerateNewDialogElementFromDesignedForm() {
// { generator.MergeFormChanges(designer.DialogId, updatedDialogElement);
// Form form = (Form)base.LoaderHost.RootComponent; }
// return wixDialog.UpdateDialogElement(form);
// } protected override void PerformLoad(IDesignerSerializationManager serializationManager)
// {
// void MergeDialogChangesIntoFullWixDocument(XmlElement updatedDialogElement) wixDialog.CreateDialog(this);
// { }
// generator.MergeFormChanges(designer.DialogId, updatedDialogElement); }
// } }
//
// protected override void PerformLoad(IDesignerSerializationManager serializationManager)
// {
// wixDialog.CreateDialog(this);
// }
// }
//}

60
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesignerLoaderProvider.cs

@ -1,35 +1,25 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using System.ComponentModel.Design.Serialization; using System.Collections.Generic;
//using ICSharpCode.FormsDesigner; using System.ComponentModel.Design.Serialization;
// using System.Diagnostics;
//namespace ICSharpCode.WixBinding using ICSharpCode.FormsDesigner;
//{ using ICSharpCode.SharpDevelop.Workbench;
// public class WixDialogDesignerLoaderProvider : IDesignerLoaderProvider
// { namespace ICSharpCode.WixBinding
// IWixDialogDesigner designer; {
// public class WixDialogDesignerLoaderProvider : IDesignerLoaderProvider
// public WixDialogDesignerLoaderProvider() {
// { public DesignerLoader CreateLoader(FormsDesignerViewContent viewContent)
// } {
// return new WixDialogDesignerLoader((IWixDialogDesigner)viewContent);
// public DesignerLoader CreateLoader(IDesignerGenerator generator) }
// {
// return new WixDialogDesignerLoader(designer, generator as IWixDialogDesignerGenerator); public IReadOnlyList<OpenedFile> GetSourceFiles(FormsDesignerViewContent viewContent)
// } {
// return new[] { viewContent.PrimaryFile };
// /// <summary> }
// /// Gets or sets the designer that the loader provider should use. }
// /// </summary> }
// public IWixDialogDesigner Designer {
// get {
// return designer;
// }
// set {
// designer = value;
// }
// }
// }
//}

7
src/AddIns/BackendBindings/WixBinding/Project/Src/IWixDialogDesigner.cs

@ -2,6 +2,8 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.WixBinding namespace ICSharpCode.WixBinding
{ {
@ -28,5 +30,10 @@ namespace ICSharpCode.WixBinding
/// being designed. /// being designed.
/// </summary> /// </summary>
WixProject Project {get;} WixProject Project {get;}
/// <summary>
/// Gets the text editor in the primary view content.
/// </summary>
ITextEditor PrimaryViewContentTextEditor { get; }
} }
} }

14
src/AddIns/BackendBindings/WixBinding/Project/WixBinding.addin

@ -7,7 +7,7 @@
<Manifest> <Manifest>
<Identity name = "ICSharpCode.WixBinding"/> <Identity name = "ICSharpCode.WixBinding"/>
<!--<Dependency addin = "ICSharpCode.FormsDesigner" requirePreload = "true"/>--> <Dependency addin = "ICSharpCode.FormsDesigner" requirePreload = "true"/>
<Dependency addin = "ICSharpCode.XmlEditor" requirePreload = "true"/> <Dependency addin = "ICSharpCode.XmlEditor" requirePreload = "true"/>
</Manifest> </Manifest>
@ -157,16 +157,16 @@
</Condition> </Condition>
</Path> </Path>
<!--<Path name = "/SharpDevelop/Workbench/Pads"> <Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "WixSetupDialogListPad" <Pad id = "WixSetupDialogListPad"
category = "Setup" category = "Setup"
title = "${res:ICSharpCode.WixBinding.SetupDialogListPad.Title}" title = "${res:ICSharpCode.WixBinding.SetupDialogListPad.Title}"
icon = "Setup.Icons.16x16.SetupDialogsPad" icon = "Setup.Icons.16x16.SetupDialogsPad"
class = "ICSharpCode.WixBinding.SetupDialogListPad" class = "ICSharpCode.WixBinding.SetupDialogListPad"
defaultPosition = "Bottom, Hidden" /> defaultPosition = "Bottom, Hidden" />
</Path>--> </Path>
<!--<Path name = "/SharpDevelop/Pads/WixSetupDialogListPad/ContextMenu"> <Path name = "/SharpDevelop/Pads/WixSetupDialogListPad/ContextMenu">
<Condition name = "Ownerstate" ownerstate = "ItemSelected" action = "Disable"> <Condition name = "Ownerstate" ownerstate = "ItemSelected" action = "Disable">
<MenuItem id = "OpenDialog" <MenuItem id = "OpenDialog"
icon = "Icons.16x16.OpenFileIcon" icon = "Icons.16x16.OpenFileIcon"
@ -177,14 +177,14 @@
icon = "Icons.16x16.FormsDesigner.ViewCode" icon = "Icons.16x16.FormsDesigner.ViewCode"
class = "ICSharpCode.WixBinding.ViewDialogXmlCommand"/> class = "ICSharpCode.WixBinding.ViewDialogXmlCommand"/>
</Condition> </Condition>
</Path>--> </Path>
<!--<Path name = "/SharpDevelop/Workbench/DisplayBindings"> <Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "WixDialogDesigner" <DisplayBinding id = "WixDialogDesigner"
type = "Secondary" type = "Secondary"
class = "ICSharpCode.WixBinding.WixDialogDesignerDisplayBinding" class = "ICSharpCode.WixBinding.WixDialogDesignerDisplayBinding"
fileNamePattern = "\.(wxs|wxi)$"/> fileNamePattern = "\.(wxs|wxi)$"/>
</Path>--> </Path>
<!-- Setup menu items that are created in the View menu --> <!-- Setup menu items that are created in the View menu -->
<Path name = "/SharpDevelop/Workbench/MainMenu/View"> <Path name = "/SharpDevelop/Workbench/MainMenu/View">

5
src/AddIns/BackendBindings/WixBinding/Project/WixBinding.csproj

@ -251,6 +251,11 @@
<Name>ICSharpCode.SharpDevelop.Widgets</Name> <Name>ICSharpCode.SharpDevelop.Widgets</Name>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj">
<Project>{9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1}</Project>
<Name>FormsDesigner</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj"> <ProjectReference Include="..\..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">

188
src/AddIns/BackendBindings/WixBinding/Test/DialogLoading/NameCreationServiceValidNameTests.cs

@ -1,94 +1,94 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.WixBinding; using ICSharpCode.WixBinding;
//using NUnit.Framework; using NUnit.Framework;
//using System; using System;
//using System.ComponentModel; using System.ComponentModel;
//using System.Windows.Forms; using System.Windows.Forms;
//using WixBinding.Tests.Utils; using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.DialogLoading namespace WixBinding.Tests.DialogLoading
//{ {
// /// <summary> /// <summary>
// /// Unit tests for the XmlDesignerLoader.NameCreationService.ValidName method. /// Unit tests for the XmlDesignerLoader.NameCreationService.ValidName method.
// /// </summary> /// </summary>
// [TestFixture] [TestFixture]
// public class NameCreationServiceValidNameTests public class NameCreationServiceValidNameTests
// { {
// XmlDesignerNameCreationService nameCreationService; XmlDesignerNameCreationService nameCreationService;
// MockDesignerLoaderHost loaderHost; MockDesignerLoaderHost loaderHost;
//
// [SetUp] [SetUp]
// public void Init() public void Init()
// { {
// loaderHost = new MockDesignerLoaderHost(); loaderHost = new MockDesignerLoaderHost();
// nameCreationService = new XmlDesignerNameCreationService(loaderHost); nameCreationService = new XmlDesignerNameCreationService(loaderHost);
// } }
//
// [Test] [Test]
// public void NullName() public void NullName()
// { {
// Assert.IsFalse(nameCreationService.IsValidName(null)); Assert.IsFalse(nameCreationService.IsValidName(null));
// } }
//
// [Test] [Test]
// public void EmptyString() public void EmptyString()
// { {
// Assert.IsFalse(nameCreationService.IsValidName(String.Empty)); Assert.IsFalse(nameCreationService.IsValidName(String.Empty));
// } }
//
// [Test] [Test]
// public void FirstCharIsDigit() public void FirstCharIsDigit()
// { {
// Assert.IsFalse(nameCreationService.IsValidName("8")); Assert.IsFalse(nameCreationService.IsValidName("8"));
// } }
//
// [Test] [Test]
// public void FirstCharIsUnderscore() public void FirstCharIsUnderscore()
// { {
// Assert.IsTrue(nameCreationService.IsValidName("_")); Assert.IsTrue(nameCreationService.IsValidName("_"));
// } }
//
// [Test] [Test]
// public void FirstCharIsNonDigit() public void FirstCharIsNonDigit()
// { {
// Assert.IsFalse(nameCreationService.IsValidName("a*")); Assert.IsFalse(nameCreationService.IsValidName("a*"));
// } }
//
//
// [Test] [Test]
// public void SecondCharIsUnderscore() public void SecondCharIsUnderscore()
// { {
// Assert.IsTrue(nameCreationService.IsValidName("a_")); Assert.IsTrue(nameCreationService.IsValidName("a_"));
// } }
//
// [Test] [Test]
// public void SecondCharIsNonDigit() public void SecondCharIsNonDigit()
// { {
// Assert.IsFalse(nameCreationService.IsValidName("a$")); Assert.IsFalse(nameCreationService.IsValidName("a$"));
// } }
//
// [Test] [Test]
// [ExpectedException(typeof(Exception), ExpectedMessage = "Invalid name 9")] [ExpectedException(typeof(Exception), ExpectedMessage = "Invalid name 9")]
// public void ValidateNameThrowsExceptionWhenFirstCharIsDigit() public void ValidateNameThrowsExceptionWhenFirstCharIsDigit()
// { {
// nameCreationService.ValidateName("9"); nameCreationService.ValidateName("9");
// } }
//
// [Test] [Test]
// public void FirstTextBoxName() public void FirstTextBoxName()
// { {
// Assert.AreEqual("textBox1", nameCreationService.CreateName(typeof(TextBox))); Assert.AreEqual("textBox1", nameCreationService.CreateName(typeof(TextBox)));
// } }
//
// [Test] [Test]
// public void SecondTextBoxName() public void SecondTextBoxName()
// { {
// Component component = new Component(); Component component = new Component();
// loaderHost.Container.Add(component, "textBox1"); loaderHost.Container.Add(component, "textBox1");
// Assert.AreEqual("textBox2", nameCreationService.CreateName(typeof(TextBox))); Assert.AreEqual("textBox2", nameCreationService.CreateName(typeof(TextBox)));
// } }
// } }
//} }

200
src/AddIns/BackendBindings/WixBinding/Test/Gui/BitmapCreatedByDesignerLoaderTestFixture.cs

@ -1,97 +1,103 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.FormsDesigner.Services; using ICSharpCode.FormsDesigner.Services;
//using ICSharpCode.WixBinding; using ICSharpCode.WixBinding;
//using NUnit.Framework; using NUnit.Framework;
//using System; using System;
//using System.Collections.Generic; using System.Collections.Generic;
//using System.ComponentModel; using System.ComponentModel;
//using System.ComponentModel.Design.Serialization; using System.ComponentModel.Design.Serialization;
//using System.Windows.Forms; using System.Windows.Forms;
//using WixBinding.Tests.Utils; using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui namespace WixBinding.Tests.Gui
//{ {
// /// <summary> /// <summary>
// /// Tests that a WixDialogDesignerLoader creates bitmaps specified in the Wix XML. /// Tests that a WixDialogDesignerLoader creates bitmaps specified in the Wix XML.
// /// </summary> /// </summary>
// [TestFixture] [TestFixture]
// public class BitmapCreatedByDesignerLoaderTestFixture : DialogLoadingTestFixtureBase, IWixDialogDesigner public class BitmapCreatedByDesignerLoaderTestFixture : DialogLoadingTestFixtureBase, IWixDialogDesigner
// { {
// Form formCreated; Form formCreated;
// MockDesignerLoaderHost loaderHost; MockDesignerLoaderHost loaderHost;
//
// [TestFixtureSetUp] [TestFixtureSetUp]
// public void SetUpFixture() public void SetUpFixture()
// { {
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator(), this); WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, fileLoader: this);
// loaderHost = new MockDesignerLoaderHost(); loaderHost = new MockDesignerLoaderHost();
// loader.BeginLoad(loaderHost); loader.BeginLoad(loaderHost);
// IComponent rootComponent = loaderHost.RootComponent; IComponent rootComponent = loaderHost.RootComponent;
// formCreated = (Form)rootComponent; formCreated = (Form)rootComponent;
// } }
//
// [TestFixtureTearDown] [TestFixtureTearDown]
// public void TearDownFixture() public void TearDownFixture()
// { {
// if (formCreated != null) { if (formCreated != null) {
// formCreated.Dispose(); formCreated.Dispose();
// } }
// } }
//
// [Test] [Test]
// public void DialogBitmapFileNameRequested() public void DialogBitmapFileNameRequested()
// { {
// Assert.AreEqual(@"C:\Projects\Setup\Bitmaps\DialogBitmap.bmp", BitmapFileNamesRequested[0]); Assert.AreEqual(@"C:\Projects\Setup\Bitmaps\DialogBitmap.bmp", BitmapFileNamesRequested[0]);
// } }
//
// [Test] [Test]
// public void BannerBitmapFileNameRequested() public void BannerBitmapFileNameRequested()
// { {
// Assert.AreEqual(@"C:\Projects\Setup\Bitmaps\BannerBitmap.bmp", BitmapFileNamesRequested[1]); Assert.AreEqual(@"C:\Projects\Setup\Bitmaps\BannerBitmap.bmp", BitmapFileNamesRequested[1]);
// } }
//
// string IWixDialogDesigner.DialogId { string IWixDialogDesigner.DialogId {
// get { get {
// return "WelcomeDialog"; return "WelcomeDialog";
// } }
// } }
//
// string IWixDialogDesigner.GetDocumentXml() string IWixDialogDesigner.GetDocumentXml()
// { {
// return GetWixXml(); return GetWixXml();
// } }
//
// string IWixDialogDesigner.DocumentFileName { string IWixDialogDesigner.DocumentFileName {
// get { get {
// return @"C:\Projects\Setup\Setup.wxs"; return @"C:\Projects\Setup\Setup.wxs";
// } }
// } }
//
// WixProject IWixDialogDesigner.Project { WixProject IWixDialogDesigner.Project {
// get { get {
// WixProject project = WixBindingTestsHelper.CreateEmptyWixProject(); WixProject project = WixBindingTestsHelper.CreateEmptyWixProject();
// project.SetProperty("DefineConstants", "DATADIR=Bitmaps"); project.SetProperty("DefineConstants", "DATADIR=Bitmaps");
// return project; return project;
// } }
// } }
//
// string GetWixXml() ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
// { get {
// return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" + throw new NotImplementedException();
// "\t<Fragment>\r\n" + }
// "\t\t<UI>\r\n" + }
// "\t\t\t<Dialog Id='WelcomeDialog' Height='270' Width='370'>\r\n" +
// "\t\t\t\t<Control Id='DialogBitmap' Type='Bitmap' X='10' Y='15' Width='50' Height='50' Text='DialogBitmap.bmp'/>\r\n" + string GetWixXml()
// "\t\t\t\t<Control Id='BannerBitmap' Type='Bitmap' X='10' Y='15' Width='50' Height='50' Text='BannerBitmap.bmp'/>\r\n" + {
// "\t\t\t</Dialog>\r\n" + return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" +
// "\t\t</UI>\r\n" + "\t<Fragment>\r\n" +
// "\t\t<Binary Id='DialogBitmap.bmp' SourceFile='Bitmaps\\DialogBitmap.bmp'/>\r\n" + "\t\t<UI>\r\n" +
// "\t\t<Binary Id='BannerBitmap.bmp' SourceFile='$(var.DATADIR)\\BannerBitmap.bmp'/>\r\n" + "\t\t\t<Dialog Id='WelcomeDialog' Height='270' Width='370'>\r\n" +
// "\t</Fragment>\r\n" + "\t\t\t\t<Control Id='DialogBitmap' Type='Bitmap' X='10' Y='15' Width='50' Height='50' Text='DialogBitmap.bmp'/>\r\n" +
// "</Wix>"; "\t\t\t\t<Control Id='BannerBitmap' Type='Bitmap' X='10' Y='15' Width='50' Height='50' Text='BannerBitmap.bmp'/>\r\n" +
// } "\t\t\t</Dialog>\r\n" +
// } "\t\t</UI>\r\n" +
//} "\t\t<Binary Id='DialogBitmap.bmp' SourceFile='Bitmaps\\DialogBitmap.bmp'/>\r\n" +
"\t\t<Binary Id='BannerBitmap.bmp' SourceFile='$(var.DATADIR)\\BannerBitmap.bmp'/>\r\n" +
"\t</Fragment>\r\n" +
"</Wix>";
}
}
}

222
src/AddIns/BackendBindings/WixBinding/Test/Gui/CanAttachToFileNameTests.cs

@ -1,116 +1,106 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System; using System;
//using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
//using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
//using ICSharpCode.WixBinding; using ICSharpCode.WixBinding;
//using NUnit.Framework; using NUnit.Framework;
//using WixBinding.Tests.Utils; using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui namespace WixBinding.Tests.Gui
//{ {
// /// <summary> /// <summary>
// /// Tests that the WixDialogDesignerDisplayBinding can attach to /// Tests that the WixDialogDesignerDisplayBinding can attach to
// /// Wix documents. /// Wix documents.
// /// </summary> /// </summary>
// [TestFixture] [TestFixture]
// public class CanAttachToFileNameTestFixture public class CanAttachToFileNameTestFixture
// { {
// WixDialogDesignerDisplayBinding binding; WixDialogDesignerDisplayBinding binding;
//
// [SetUp] [SetUp]
// public void Init() public void Init()
// { {
// binding = new WixDialogDesignerDisplayBinding(); binding = new WixDialogDesignerDisplayBinding();
// } }
//
// [Test] [Test]
// public void WixFileName() public void WixFileName()
// { {
// MockTextEditorViewContent view = new MockTextEditorViewContent(); MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName("Setup.wxs"); view.SetFileName("Setup.wxs");
// Assert.IsTrue(binding.CanAttachTo(view)); Assert.IsTrue(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void WixIncludeFileName() public void WixIncludeFileName()
// { {
// MockTextEditorViewContent view = new MockTextEditorViewContent(); MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName("Setup.wxi"); view.SetFileName("Setup.wxi");
// Assert.IsTrue(binding.CanAttachTo(view)); Assert.IsTrue(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void WixFileNameUppercase() public void WixFileNameUppercase()
// { {
// MockTextEditorViewContent view = new MockTextEditorViewContent(); MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName("SETUP.WXS"); view.SetFileName("SETUP.WXS");
// Assert.IsTrue(binding.CanAttachTo(view)); Assert.IsTrue(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void NonWixFileName() public void NonWixFileName()
// { {
// MockTextEditorViewContent view = new MockTextEditorViewContent(); MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName("Setup.txt"); view.SetFileName("Setup.txt");
// Assert.IsFalse(binding.CanAttachTo(view)); Assert.IsFalse(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void NonTextEditorProviderView() public void NonTextEditorProviderView()
// { {
// MockViewContent view = new MockViewContent(); MockViewContent view = new MockViewContent();
// view.SetFileName("Setup.wxs"); view.SetFileName("Setup.wxs");
// Assert.IsFalse(binding.CanAttachTo(view)); Assert.IsFalse(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void UntitledWixFileName() public void UntitledWixFileName()
// { {
// MockTextEditorViewContent view = new MockTextEditorViewContent(); MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetUntitledFileName("Setup.wxs"); view.SetUntitledFileName("Setup.wxs");
// Assert.IsTrue(binding.CanAttachTo(view)); Assert.IsTrue(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void UntitledNonWixFileName() public void UntitledNonWixFileName()
// { {
// MockTextEditorViewContent view = new MockTextEditorViewContent(); MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetUntitledFileName("Setup.txt"); view.SetUntitledFileName("Setup.txt");
// Assert.IsFalse(binding.CanAttachTo(view)); Assert.IsFalse(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void NullUntitledFileName() public void NullUntitledFileName()
// { {
// MockTextEditorViewContent view = new MockTextEditorViewContent(); MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetUntitledFileName(null); view.SetUntitledFileName(null);
// Assert.IsFalse(binding.CanAttachTo(view)); Assert.IsFalse(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void NullFileName() public void NullFileName()
// { {
// MockTextEditorViewContent view = new MockTextEditorViewContent(); MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName(null); view.SetFileName(null);
// Assert.IsFalse(binding.CanAttachTo(view)); Assert.IsFalse(binding.CanAttachTo(view));
// } }
//
// [Test] [Test]
// public void ReattachIsFalse() public void ReattachIsFalse()
// { {
// Assert.IsFalse(binding.ReattachWhenParserServiceIsReady); Assert.IsFalse(binding.ReattachWhenParserServiceIsReady);
// } }
// }
// [Test] }
// public void CreatesWixDialogDesigner()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// IViewContent[] views = binding.CreateSecondaryViewContent(view);
// Assert.AreEqual(1, views.Length);
// Assert.IsTrue(views[0] is WixDialogDesigner);
// views[0].Dispose();
// }
// }
//}

230
src/AddIns/BackendBindings/WixBinding/Test/Gui/DialogIdSpecifiedForDesignerLoaderTestFixture.cs

@ -1,112 +1,118 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.FormsDesigner.Services; using ICSharpCode.FormsDesigner.Services;
//using ICSharpCode.WixBinding; using ICSharpCode.WixBinding;
//using NUnit.Framework; using NUnit.Framework;
//using System; using System;
//using System.Collections.Generic; using System.Collections.Generic;
//using System.ComponentModel; using System.ComponentModel;
//using System.ComponentModel.Design.Serialization; using System.ComponentModel.Design.Serialization;
//using System.Windows.Forms; using System.Windows.Forms;
//using WixBinding.Tests.Utils; using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui namespace WixBinding.Tests.Gui
//{ {
// /// <summary> /// <summary>
// /// Tests that a WixDialogDesignerLoader uses the dialog id to find the dialog /// Tests that a WixDialogDesignerLoader uses the dialog id to find the dialog
// /// XML element. /// XML element.
// /// </summary> /// </summary>
// [TestFixture] [TestFixture]
// public class DialogIdSpecifiedForDesignerLoaderTestFixture : IWixDialogDesigner public class DialogIdSpecifiedForDesignerLoaderTestFixture : IWixDialogDesigner
// { {
// Form formCreated; Form formCreated;
// MockDesignerLoaderHost loaderHost; MockDesignerLoaderHost loaderHost;
//
// [TestFixtureSetUp] [TestFixtureSetUp]
// public void SetUpFixture() public void SetUpFixture()
// { {
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator()); WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this);
// loaderHost = new MockDesignerLoaderHost(); loaderHost = new MockDesignerLoaderHost();
// loader.BeginLoad(loaderHost); loader.BeginLoad(loaderHost);
// IComponent rootComponent = loaderHost.RootComponent; IComponent rootComponent = loaderHost.RootComponent;
// formCreated = (Form)rootComponent; formCreated = (Form)rootComponent;
// } }
//
// [TestFixtureTearDown] [TestFixtureTearDown]
// public void TearDownFixture() public void TearDownFixture()
// { {
// if (formCreated != null) { if (formCreated != null) {
// formCreated.Dispose(); formCreated.Dispose();
// } }
// } }
//
// [Test] [Test]
// public void FormName() public void FormName()
// { {
// Assert.AreEqual("WelcomeDialog", formCreated.Name); Assert.AreEqual("WelcomeDialog", formCreated.Name);
// } }
//
// [Test] [Test]
// public void OneComponentCreated() public void OneComponentCreated()
// { {
// Assert.AreEqual(1, loaderHost.CreatedComponents.Count); Assert.AreEqual(1, loaderHost.CreatedComponents.Count);
// } }
//
// [Test] [Test]
// public void NameCreationServiceCreated() public void NameCreationServiceCreated()
// { {
// INameCreationService nameCreationService = (INameCreationService)loaderHost.GetService(typeof(INameCreationService)); INameCreationService nameCreationService = (INameCreationService)loaderHost.GetService(typeof(INameCreationService));
// Assert.IsTrue(nameCreationService is XmlDesignerNameCreationService); Assert.IsTrue(nameCreationService is XmlDesignerNameCreationService);
// } }
//
// [Test] [Test]
// public void ComponentSerializationServiceCreated() public void ComponentSerializationServiceCreated()
// { {
// ComponentSerializationService serializationService = (ComponentSerializationService)loaderHost.GetService(typeof(ComponentSerializationService)); ComponentSerializationService serializationService = (ComponentSerializationService)loaderHost.GetService(typeof(ComponentSerializationService));
// Assert.IsTrue(serializationService is ComponentSerializationService); Assert.IsTrue(serializationService is ComponentSerializationService);
// } }
//
// [Test] [Test]
// public void DesignerSerializationServiceCreated() public void DesignerSerializationServiceCreated()
// { {
// IDesignerSerializationService designerSerializationServiceCreated = (IDesignerSerializationService)loaderHost.GetService(typeof(IDesignerSerializationService)); IDesignerSerializationService designerSerializationServiceCreated = (IDesignerSerializationService)loaderHost.GetService(typeof(IDesignerSerializationService));
// Assert.IsTrue(designerSerializationServiceCreated is DesignerSerializationService); Assert.IsTrue(designerSerializationServiceCreated is DesignerSerializationService);
// } }
//
// string IWixDialogDesigner.DialogId { string IWixDialogDesigner.DialogId {
// get { get {
// return "WelcomeDialog"; return "WelcomeDialog";
// } }
// } }
//
// string IWixDialogDesigner.GetDocumentXml() string IWixDialogDesigner.GetDocumentXml()
// { {
// return GetWixXml(); return GetWixXml();
// } }
//
// public string DocumentFileName { public string DocumentFileName {
// get { get {
// return String.Empty; return String.Empty;
// } }
// } }
//
// public WixProject Project { public WixProject Project {
// get { get {
// return WixBindingTestsHelper.CreateEmptyWixProject(); return WixBindingTestsHelper.CreateEmptyWixProject();
// } }
// } }
//
// string GetWixXml() ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
// { get {
// return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" + throw new NotImplementedException();
// "\t<Fragment>\r\n" + }
// "\t\t<UI>\r\n" + }
// "\t\t\t<Dialog Id=\"WelcomeDialog\" Height=\"100\" Width=\"200\"/>\r\n" +
// "\t\t</UI>\r\n" + string GetWixXml()
// "\t</Fragment>\r\n" + {
// "</Wix>"; return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" +
// } "\t<Fragment>\r\n" +
// } "\t\t<UI>\r\n" +
//} "\t\t\t<Dialog Id=\"WelcomeDialog\" Height=\"100\" Width=\"200\"/>\r\n" +
"\t\t</UI>\r\n" +
"\t</Fragment>\r\n" +
"</Wix>";
}
}
}

216
src/AddIns/BackendBindings/WixBinding/Test/Gui/FlushLoaderTestFixture.cs

@ -1,105 +1,111 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.WixBinding; using ICSharpCode.WixBinding;
//using NUnit.Framework; using NUnit.Framework;
//using System; using System;
//using System.CodeDom; using System.CodeDom;
//using System.CodeDom.Compiler; using System.CodeDom.Compiler;
//using System.Collections; using System.Collections;
//using System.Collections.Generic; using System.Collections.Generic;
//using System.ComponentModel; using System.ComponentModel;
//using System.Reflection; using System.Reflection;
//using System.Windows.Forms; using System.Windows.Forms;
//using System.Xml; using System.Xml;
//using WixBinding.Tests.Utils; using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui namespace WixBinding.Tests.Gui
//{ {
// /// <summary> /// <summary>
// /// Tests that a WixDialogDesignerLoader calls the IDesignerGenerator.MergeFormChanges /// Tests that a WixDialogDesignerLoader calls the IDesignerGenerator.MergeFormChanges
// /// method after being flushed. /// method after being flushed.
// /// </summary> /// </summary>
// [TestFixture] [TestFixture]
// public class FlushLoaderTestFixture : IWixDialogDesignerGenerator, IWixDialogDesigner public class FlushLoaderTestFixture : IWixDialogDesignerGenerator, IWixDialogDesigner
// { {
// class DerivedWixDialogDesignerLoader : WixDialogDesignerLoader class DerivedWixDialogDesignerLoader : WixDialogDesignerLoader
// { {
// public DerivedWixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator) public DerivedWixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator)
// : base(designer, generator) : base(designer, generator)
// { {
// } }
//
// public void CallPerformFlush() public void CallPerformFlush()
// { {
// base.PerformFlush(null); base.PerformFlush(null);
// } }
// } }
//
// string newDialogTitle; string newDialogTitle;
// string dialogId; string dialogId;
//
// [TestFixtureSetUp] [TestFixtureSetUp]
// public void SetUpFixture() public void SetUpFixture()
// { {
// newDialogTitle = String.Empty; newDialogTitle = String.Empty;
// dialogId = String.Empty; dialogId = String.Empty;
//
// DerivedWixDialogDesignerLoader loader = new DerivedWixDialogDesignerLoader(this, this); DerivedWixDialogDesignerLoader loader = new DerivedWixDialogDesignerLoader(this, this);
// MockDesignerLoaderHost loaderHost = new MockDesignerLoaderHost(); MockDesignerLoaderHost loaderHost = new MockDesignerLoaderHost();
// loader.BeginLoad(loaderHost); loader.BeginLoad(loaderHost);
// using (Form form = (Form)loaderHost.RootComponent) { using (Form form = (Form)loaderHost.RootComponent) {
// form.Text = "NewTitle"; form.Text = "NewTitle";
// loader.CallPerformFlush(); loader.CallPerformFlush();
// } }
// } }
//
// [Test] [Test]
// public void MergeFormChangesCalled() public void MergeFormChangesCalled()
// { {
// Assert.AreEqual("NewTitle", newDialogTitle); Assert.AreEqual("NewTitle", newDialogTitle);
// } }
//
// [Test] [Test]
// public void DialogId() public void DialogId()
// { {
// Assert.AreEqual("WelcomeDialog", dialogId); Assert.AreEqual("WelcomeDialog", dialogId);
// } }
//
// string IWixDialogDesigner.DialogId { string IWixDialogDesigner.DialogId {
// get { return "WelcomeDialog"; } get { return "WelcomeDialog"; }
// } }
//
// string IWixDialogDesigner.GetDocumentXml() string IWixDialogDesigner.GetDocumentXml()
// { {
// return GetWixXml(); return GetWixXml();
// } }
//
// public string DocumentFileName { public string DocumentFileName {
// get { return String.Empty; } get { return String.Empty; }
// } }
//
// public WixProject Project { public WixProject Project {
// get { return WixBindingTestsHelper.CreateEmptyWixProject(); } get { return WixBindingTestsHelper.CreateEmptyWixProject(); }
// } }
//
// string GetWixXml() ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
// { get {
// return throw new NotImplementedException();
// "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" + }
// "\t<Fragment>\r\n" + }
// "\t\t<UI>\r\n" +
// "\t\t\t<Dialog Id=\"WelcomeDialog\" Height=\"100\" Width=\"200\"/>\r\n" + string GetWixXml()
// "\t\t</UI>\r\n" + {
// "\t</Fragment>\r\n" + return
// "</Wix>"; "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" +
// } "\t<Fragment>\r\n" +
// "\t\t<UI>\r\n" +
// public void MergeFormChanges(string dialogId, XmlElement dialogElement) "\t\t\t<Dialog Id=\"WelcomeDialog\" Height=\"100\" Width=\"200\"/>\r\n" +
// { "\t\t</UI>\r\n" +
// this.dialogId = dialogId; "\t</Fragment>\r\n" +
// newDialogTitle = dialogElement.GetAttribute("Title"); "</Wix>";
// } }
// }
//} public void MergeFormChanges(string dialogId, XmlElement dialogElement)
{
this.dialogId = dialogId;
newDialogTitle = dialogElement.GetAttribute("Title");
}
}
}

93
src/AddIns/BackendBindings/WixBinding/Test/Gui/GetWixDesignerFromViewTests.cs

@ -1,35 +1,58 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using ICSharpCode.WixBinding; using ICSharpCode.SharpDevelop;
//using NUnit.Framework; using ICSharpCode.SharpDevelop.Project;
//using System; using ICSharpCode.SharpDevelop.Widgets;
//using WixBinding.Tests.Utils; using ICSharpCode.SharpDevelop.WinForms;
// using ICSharpCode.SharpDevelop.Workbench;
//namespace WixBinding.Tests.Gui using ICSharpCode.WixBinding;
//{ using NUnit.Framework;
// /// <summary> using System;
// /// Tests that the WixDialogDesigner.GetDesigner method returns the using Rhino.Mocks;
// /// Wix dialog designer attached to the primary view. using WixBinding.Tests.Utils;
// /// </summary>
// [TestFixture] namespace WixBinding.Tests.Gui
// public class GetWixDesignerFromViewTests {
// { /// <summary>
// [Test] /// Tests that the WixDialogDesigner.GetDesigner method returns the
// public void WixDesignerAttached() /// Wix dialog designer attached to the primary view.
// { /// </summary>
// MockTextEditorViewContent view = new MockTextEditorViewContent(); [TestFixture]
// using (WixDialogDesigner designerAdded = new WixDialogDesigner(view)) { public class GetWixDesignerFromViewTests
// view.SecondaryViewContents.Add(designerAdded); {
// Assert.IsNotNull(WixDialogDesigner.GetDesigner(view)); [TestFixtureSetUp]
// } public void FixtureSetUp()
// } {
// SD.InitializeForUnitTests();
// [Test] SD.Services.AddService(typeof(IWinFormsService), MockRepository.GenerateStub<IWinFormsService>());
// public void NoWixDesignerAttached() SD.WinForms.Stub(s => s.CreateWindowsFormsHost()).IgnoreArguments().Return(new CustomWindowsFormsHost());
// { SD.Services.AddService(typeof(IWorkbench), new MockWorkbench());
// MockViewContent view = new MockViewContent(); SD.Services.AddService(typeof(IFileService), MockRepository.GenerateStub<IFileService>());
// Assert.IsNull(WixDialogDesigner.GetDesigner(view)); SD.Services.AddService(typeof(IProjectService), MockRepository.GenerateStub<IProjectService>());
// } }
// }
//} [TestFixtureTearDown]
public void FixtureTearDown()
{
SD.TearDownForUnitTests();
}
[Test]
public void WixDesignerAttached()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
using (WixDialogDesigner designerAdded = new WixDialogDesigner(view)) {
view.SecondaryViewContents.Add(designerAdded);
Assert.IsNotNull(WixDialogDesigner.GetDesigner(view));
}
}
[Test]
public void NoWixDesignerAttached()
{
MockViewContent view = new MockViewContent();
Assert.IsNull(WixDialogDesigner.GetDesigner(view));
}
}
}

63
src/AddIns/BackendBindings/WixBinding/Test/Gui/LoaderProviderTests.cs

@ -1,63 +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 ICSharpCode.WixBinding;
//using NUnit.Framework;
//using System;
//using System.ComponentModel.Design.Serialization;
//using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui
//{
// [TestFixture]
// public class LoaderProviderTests : IWixDialogDesigner
// {
// [Test]
// public void NoDesignerSpecified()
// {
// WixDialogDesignerLoaderProvider provider = new WixDialogDesignerLoaderProvider();
// WixDialogDesignerGenerator generator = new WixDialogDesignerGenerator();
// try {
// DesignerLoader loader = provider.CreateLoader(generator);
// Assert.Fail("Expected an argument exception before this line.");
// } catch (ArgumentException ex) {
// Assert.AreEqual("designer", ex.ParamName);
// }
// }
//
// [Test]
// public void DialogIdAndTextEditorSpecified()
// {
// WixDialogDesignerLoaderProvider provider = new WixDialogDesignerLoaderProvider();
// provider.Designer = this;
// WixDialogDesignerGenerator generator = new WixDialogDesignerGenerator();
// WixDialogDesignerLoader loader = (WixDialogDesignerLoader)provider.CreateLoader(generator);
// Assert.IsTrue(loader is WixDialogDesignerLoader);
// Assert.AreSame(this, loader.Designer);
// Assert.AreSame(generator, loader.Generator);
// }
//
// string IWixDialogDesigner.DialogId {
// get { return "WelcomeDialog"; }
// }
//
// string IWixDialogDesigner.DocumentFileName {
// get { return String.Empty; }
// }
//
// WixProject IWixDialogDesigner.Project {
// get { return WixBindingTestsHelper.CreateEmptyWixProject(); }
// }
//
// string IWixDialogDesigner.GetDocumentXml()
// {
// return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" +
// "\t<Fragment>\r\n" +
// "\t\t<UI>\r\n" +
// "\t\t\t<Dialog Id=\"WelcomeDialog\" Height=\"100\" Width=\"200\"/>\r\n" +
// "\t\t</UI>\r\n" +
// "\t</Fragment>\r\n" +
// "</Wix>";
// }
// }
//}

142
src/AddIns/BackendBindings/WixBinding/Test/Gui/MissingDialogIdDesignerLoaderTestFixture.cs

@ -1,67 +1,75 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using ICSharpCode.Core; using ICSharpCode.Core;
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.WixBinding; using ICSharpCode.SharpDevelop;
//using NUnit.Framework; using ICSharpCode.WixBinding;
//using System; using NUnit.Framework;
//using System.Collections.Generic; using System;
//using System.ComponentModel; using System.Collections.Generic;
//using System.Resources; using System.ComponentModel;
//using System.Windows.Forms; using System.Resources;
//using WixBinding.Tests.Utils; using System.Windows.Forms;
// using WixBinding.Tests.Utils;
//namespace WixBinding.Tests.Gui
//{ namespace WixBinding.Tests.Gui
// /// <summary> {
// /// Tests that a WixDialogDesignerLoader reports that the dialog id cannot be found /// <summary>
// /// in the Wix document. /// Tests that a WixDialogDesignerLoader reports that the dialog id cannot be found
// /// </summary> /// in the Wix document.
// [TestFixture] /// </summary>
// public class MissingDialogIdDesignerLoaderTestFixture : IWixDialogDesigner [TestFixture]
// { public class MissingDialogIdDesignerLoaderTestFixture : IWixDialogDesigner
// [TestFixtureSetUp] {
// public void SetupFixture() [TestFixtureSetUp]
// { public void SetupFixture()
// WixBindingTestsHelper.RegisterResourceStringsWithSharpDevelopResourceManager(); {
// } SD.InitializeForUnitTests();
// WixBindingTestsHelper.RegisterResourceStringsWithSharpDevelopResourceManager();
// [Test] }
// [ExpectedException(typeof(FormsDesignerLoadException), ExpectedMessage = "Unable to find dialog with an id of 'MissingDialog'.")]
// public void LoadMissingDialog() [Test]
// { [ExpectedException(typeof(FormsDesignerLoadException), ExpectedMessage = "Unable to find dialog with an id of 'MissingDialog'.")]
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator()); public void LoadMissingDialog()
// MockDesignerLoaderHost loaderHost = new MockDesignerLoaderHost(); {
// loader.BeginLoad(loaderHost); WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this);
// } MockDesignerLoaderHost loaderHost = new MockDesignerLoaderHost();
// loader.BeginLoad(loaderHost);
// string IWixDialogDesigner.DialogId { }
// get { return "MissingDialog"; }
// } string IWixDialogDesigner.DialogId {
// get { return "MissingDialog"; }
// string IWixDialogDesigner.GetDocumentXml() }
// {
// return GetWixXml(); string IWixDialogDesigner.GetDocumentXml()
// } {
// return GetWixXml();
// public string DocumentFileName { }
// get { return String.Empty; }
// } public string DocumentFileName {
// get { return String.Empty; }
// public WixProject Project { }
// get { return WixBindingTestsHelper.CreateEmptyWixProject(); }
// } public WixProject Project {
// get { return WixBindingTestsHelper.CreateEmptyWixProject(); }
// string GetWixXml() }
// {
// return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" + ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
// "\t<Fragment>\r\n" + get {
// "\t\t<UI>\r\n" + throw new NotImplementedException();
// "\t\t\t<Dialog Id=\"WelcomeDialog\" Height=\"100\" Width=\"200\"/>\r\n" + }
// "\t\t</UI>\r\n" + }
// "\t</Fragment>\r\n" +
// "</Wix>"; string GetWixXml()
// } {
// } return "<Wix xmlns=\"http://schemas.microsoft.com/wix/2006/wi\">\r\n" +
//} "\t<Fragment>\r\n" +
"\t\t<UI>\r\n" +
"\t\t\t<Dialog Id=\"WelcomeDialog\" Height=\"100\" Width=\"200\"/>\r\n" +
"\t\t</UI>\r\n" +
"\t</Fragment>\r\n" +
"</Wix>";
}
}
}

135
src/AddIns/BackendBindings/WixBinding/Test/Gui/NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs

@ -1,69 +1,66 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using ICSharpCode.Core; using ICSharpCode.Core;
//using ICSharpCode.FormsDesigner; using ICSharpCode.FormsDesigner;
//using ICSharpCode.WixBinding; using ICSharpCode.SharpDevelop;
//using NUnit.Framework; using ICSharpCode.WixBinding;
//using System; using NUnit.Framework;
//using System.Resources; using System;
//using WixBinding.Tests.Utils; using System.Resources;
// using WixBinding.Tests.Utils;
//namespace WixBinding.Tests.Gui
//{ namespace WixBinding.Tests.Gui
// /// <summary> {
// /// Tests that a FormsDesignerLoadException is thrown when the WixDialogDesignerLoader /// <summary>
// /// is used when no dialog id is set. /// Tests that a FormsDesignerLoadException is thrown when the WixDialogDesignerLoader
// /// </summary> /// is used when no dialog id is set.
// [TestFixture] /// </summary>
// public class NoDialogIdSpecifiedForDesignerLoaderTestFixture : IWixDialogDesigner [TestFixture]
// { public class NoDialogIdSpecifiedForDesignerLoaderTestFixture : IWixDialogDesigner
// [TestFixtureSetUp] {
// public void SetupFixture() [TestFixtureSetUp]
// { public void SetupFixture()
// WixBindingTestsHelper.RegisterResourceStringsWithSharpDevelopResourceManager(); {
// } SD.InitializeForUnitTests();
// WixBindingTestsHelper.RegisterResourceStringsWithSharpDevelopResourceManager();
// [Test] }
// [ExpectedException(typeof(FormsDesignerLoadException), ExpectedMessage = "No setup dialog selected in Wix document. Please move the cursor inside a dialog element or use the Setup Dialogs window to open a dialog.")]
// public void NoDialogIdSpecified() [Test]
// { [ExpectedException(typeof(FormsDesignerLoadException), ExpectedMessage = "No setup dialog selected in Wix document. Please move the cursor inside a dialog element or use the Setup Dialogs window to open a dialog.")]
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator()); public void NoDialogIdSpecified()
// loader.BeginLoad(new MockDesignerLoaderHost()); {
// } WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this);
// loader.BeginLoad(new MockDesignerLoaderHost());
// [Test] }
// public void NoGeneratorSpecified()
// { string IWixDialogDesigner.DialogId {
// try { get {
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, null); return null;
// Assert.Fail("Expected an argument exception before this line."); }
// } catch (ArgumentException ex) { }
// Assert.AreEqual("generator", ex.ParamName);
// } string IWixDialogDesigner.GetDocumentXml()
// } {
// return String.Empty;
// string IWixDialogDesigner.DialogId { }
// get {
// return null; ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
// } get {
// } throw new NotImplementedException();
// }
// string IWixDialogDesigner.GetDocumentXml() }
// {
// return String.Empty; public string DocumentFileName {
// } get {
// return String.Empty;
// public string DocumentFileName { }
// get { }
// return String.Empty;
// } public WixProject Project {
// } get {
// return WixBindingTestsHelper.CreateEmptyWixProject();
// public WixProject Project { }
// get { }
// return WixBindingTestsHelper.CreateEmptyWixProject(); }
// } }
// }
// }
//}

2
src/AddIns/BackendBindings/WixBinding/Test/Utils/MockWorkbench.cs

@ -103,7 +103,7 @@ namespace WixBinding.Tests.Utils
public PadDescriptor GetPad(Type type) public PadDescriptor GetPad(Type type)
{ {
throw new NotImplementedException(); return null;
} }
public void CloseAllViews() public void CloseAllViews()

5
src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj

@ -150,7 +150,6 @@
<Compile Include="Project\WixProjectOutputTypeFileExtensionTests.cs" /> <Compile Include="Project\WixProjectOutputTypeFileExtensionTests.cs" />
<Compile Include="DialogLoading\SimpleDialogTestFixture.cs" /> <Compile Include="DialogLoading\SimpleDialogTestFixture.cs" />
<Compile Include="DialogLoading\SimpleDialogUsingObjectCreatorTestFixture.cs" /> <Compile Include="DialogLoading\SimpleDialogUsingObjectCreatorTestFixture.cs" />
<Compile Include="Gui\LoaderProviderTests.cs" />
<Compile Include="Gui\NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs" /> <Compile Include="Gui\NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs" />
<Compile Include="Utils\MockDesignerLoaderHost.cs" /> <Compile Include="Utils\MockDesignerLoaderHost.cs" />
<Compile Include="Gui\DialogIdSpecifiedForDesignerLoaderTestFixture.cs" /> <Compile Include="Gui\DialogIdSpecifiedForDesignerLoaderTestFixture.cs" />
@ -323,6 +322,10 @@
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project> <Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name> <Name>ICSharpCode.Core.WinForms</Name>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\DisplayBindings\FormsDesigner\Project\FormsDesigner.csproj">
<Project>{9E951B9F-6AC2-4537-9D0B-0AE7C026D5A1}</Project>
<Name>FormsDesigner</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\DisplayBindings\XmlEditor\Project\XmlEditor.csproj"> <ProjectReference Include="..\..\..\DisplayBindings\XmlEditor\Project\XmlEditor.csproj">
<Project>{DCA2703D-250A-463E-A68A-07ED105AE6BD}</Project> <Project>{DCA2703D-250A-463E-A68A-07ED105AE6BD}</Project>
<Name>XmlEditor</Name> <Name>XmlEditor</Name>

2
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerGenerator/IDesignerGenerator.cs

@ -14,6 +14,7 @@ using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.FormsDesigner namespace ICSharpCode.FormsDesigner
{ {
/*
public interface IDesignerGenerator public interface IDesignerGenerator
{ {
CodeDomProvider CodeDomProvider { CodeDomProvider CodeDomProvider {
@ -35,4 +36,5 @@ namespace ICSharpCode.FormsDesigner
ICollection GetCompatibleMethods(EventDescriptor edesc); ICollection GetCompatibleMethods(EventDescriptor edesc);
void NotifyComponentRenamed(object component, string newName, string oldName); void NotifyComponentRenamed(object component, string newName, string oldName);
} }
*/
} }

2
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/AbstractCodeDomDesignerLoader.cs

@ -14,6 +14,7 @@ using ICSharpCode.FormsDesigner.Services;
namespace ICSharpCode.FormsDesigner namespace ICSharpCode.FormsDesigner
{ {
/*
/// <summary> /// <summary>
/// An abstract base class for CodeDOM designer loaders. /// An abstract base class for CodeDOM designer loaders.
/// </summary> /// </summary>
@ -172,4 +173,5 @@ namespace ICSharpCode.FormsDesigner
MessageService.ShowError(sb.ToString()); MessageService.ShowError(sb.ToString());
} }
} }
*/
} }

10
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/DesignerLoader/DesignerLoaderProvider.cs

@ -2,14 +2,22 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) // This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System; using System;
using System.Collections.Generic;
using System.ComponentModel.Design.Serialization; using System.ComponentModel.Design.Serialization;
using ICSharpCode.NRefactory; using ICSharpCode.NRefactory;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.FormsDesigner namespace ICSharpCode.FormsDesigner
{ {
public interface IDesignerLoaderProvider public interface IDesignerLoaderProvider
{ {
DesignerLoader CreateLoader(IDesignerGenerator generator); DesignerLoader CreateLoader(FormsDesignerViewContent viewContent);
/// <summary>
/// Gets the source files involved when designing.
/// The first file in the resulting list is the main code file.
/// </summary>
IReadOnlyList<OpenedFile> GetSourceFiles(FormsDesignerViewContent viewContent);
} }
/* /*
public class NRefactoryDesignerLoaderProvider : IDesignerLoaderProvider public class NRefactoryDesignerLoaderProvider : IDesignerLoaderProvider

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

@ -39,7 +39,6 @@ namespace ICSharpCode.FormsDesigner
readonly IViewContent primaryViewContent; readonly IViewContent primaryViewContent;
readonly IDesignerLoaderProvider loaderProvider; readonly IDesignerLoaderProvider loaderProvider;
DesignerLoader loader; DesignerLoader loader;
readonly IDesignerGenerator generator;
readonly ResourceStore resourceStore; readonly ResourceStore resourceStore;
FormsDesignerUndoEngine undoEngine; FormsDesignerUndoEngine undoEngine;
TypeResolutionService typeResolutionService; TypeResolutionService typeResolutionService;
@ -132,17 +131,13 @@ namespace ICSharpCode.FormsDesigner
ICSharpCode.SharpDevelop.Debugging.DebuggerService.DebugStarting += this.DebugStarting; ICSharpCode.SharpDevelop.Debugging.DebuggerService.DebugStarting += this.DebugStarting;
} }
public FormsDesignerViewContent(IViewContent primaryViewContent, IDesignerLoaderProvider loaderProvider, IDesignerGenerator generator) public FormsDesignerViewContent(IViewContent primaryViewContent, IDesignerLoaderProvider loaderProvider)
: this(primaryViewContent) : this(primaryViewContent)
{ {
if (loaderProvider == null) if (loaderProvider == null)
throw new ArgumentNullException("loaderProvider"); throw new ArgumentNullException("loaderProvider");
if (generator == null)
throw new ArgumentNullException("generator");
this.loaderProvider = loaderProvider; this.loaderProvider = loaderProvider;
this.generator = generator;
this.generator.Attach(this);
this.Files.Add(this.primaryViewContent.PrimaryFile); this.Files.Add(this.primaryViewContent.PrimaryFile);
} }
@ -194,9 +189,9 @@ namespace ICSharpCode.FormsDesigner
this.sourceCodeStorage.LoadFile(file, stream); this.sourceCodeStorage.LoadFile(file, stream);
LoggingService.Debug("Forms designer: Determining designer source files for " + file.FileName); LoggingService.Debug("Forms designer: Determining designer source files for " + file.FileName);
OpenedFile newDesignerCodeFile; IReadOnlyList<OpenedFile> sourceFiles = loaderProvider.GetSourceFiles(this);
IEnumerable<OpenedFile> sourceFiles = this.generator.GetSourceFiles(out newDesignerCodeFile); OpenedFile newDesignerCodeFile = sourceFiles.FirstOrDefault();
if (sourceFiles == null || newDesignerCodeFile == null) { if (newDesignerCodeFile == null) {
throw new FormsDesignerLoadException("The designer source files could not be determined."); throw new FormsDesignerLoadException("The designer source files could not be determined.");
} }
@ -294,9 +289,9 @@ namespace ICSharpCode.FormsDesigner
this.addedTypeDescriptionProviders.Add(typeof(Image), TypeDescriptor.AddAttributes(typeof(Image), new EditorAttribute(typeof(ImageResourceEditor), typeof(System.Drawing.Design.UITypeEditor)))); this.addedTypeDescriptionProviders.Add(typeof(Image), TypeDescriptor.AddAttributes(typeof(Image), new EditorAttribute(typeof(ImageResourceEditor), typeof(System.Drawing.Design.UITypeEditor))));
this.addedTypeDescriptionProviders.Add(typeof(Icon), TypeDescriptor.AddAttributes(typeof(Icon), new EditorAttribute(typeof(ImageResourceEditor), typeof(System.Drawing.Design.UITypeEditor)))); this.addedTypeDescriptionProviders.Add(typeof(Icon), TypeDescriptor.AddAttributes(typeof(Icon), new EditorAttribute(typeof(ImageResourceEditor), typeof(System.Drawing.Design.UITypeEditor))));
if (generator.CodeDomProvider != null) { // if (generator.CodeDomProvider != null) {
serviceContainer.AddService(typeof(System.CodeDom.Compiler.CodeDomProvider), generator.CodeDomProvider); // serviceContainer.AddService(typeof(System.CodeDom.Compiler.CodeDomProvider), generator.CodeDomProvider);
} // }
designSurface = CreateDesignSurface(serviceContainer); designSurface = CreateDesignSurface(serviceContainer);
designSurface.Loading += this.DesignerLoading; designSurface.Loading += this.DesignerLoading;
@ -305,10 +300,8 @@ namespace ICSharpCode.FormsDesigner
designSurface.Unloading += this.DesignerUnloading; designSurface.Unloading += this.DesignerUnloading;
serviceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), new ICSharpCode.FormsDesigner.Services.MenuCommandService(this, designSurface)); serviceContainer.AddService(typeof(System.ComponentModel.Design.IMenuCommandService), new ICSharpCode.FormsDesigner.Services.MenuCommandService(this, designSurface));
ICSharpCode.FormsDesigner.Services.EventBindingService eventBindingService = new ICSharpCode.FormsDesigner.Services.EventBindingService(this, designSurface);
serviceContainer.AddService(typeof(System.ComponentModel.Design.IEventBindingService), eventBindingService);
this.loader = loaderProvider.CreateLoader(generator); this.loader = loaderProvider.CreateLoader(this);
designSurface.BeginLoad(this.loader); designSurface.BeginLoad(this.loader);
if (!designSurface.IsLoaded) { if (!designSurface.IsLoaded) {
@ -378,16 +371,13 @@ namespace ICSharpCode.FormsDesigner
bool loading = this.loader != null && this.loader.Loading; bool loading = this.loader != null && this.loader.Loading;
LoggingService.Debug("Forms designer: ComponentChanged: " + (e.Component == null ? "<null>" : e.Component.ToString()) + ", Member=" + (e.Member == null ? "<null>" : e.Member.Name) + ", OldValue=" + (e.OldValue == null ? "<null>" : e.OldValue.ToString()) + ", NewValue=" + (e.NewValue == null ? "<null>" : e.NewValue.ToString()) + "; Loading=" + loading + "; Unloading=" + this.unloading); LoggingService.Debug("Forms designer: ComponentChanged: " + (e.Component == null ? "<null>" : e.Component.ToString()) + ", Member=" + (e.Member == null ? "<null>" : e.Member.Name) + ", OldValue=" + (e.OldValue == null ? "<null>" : e.OldValue.ToString()) + ", NewValue=" + (e.NewValue == null ? "<null>" : e.NewValue.ToString()) + "; Loading=" + loading + "; Unloading=" + this.unloading);
if (!loading && !unloading) { if (!loading && !unloading) {
try {
this.MakeDirty(); this.MakeDirty();
if (e.Component != null && e.Member != null && e.Member.Name == "Name" && #warning Reimplement designer component rename
e.NewValue is string && !object.Equals(e.OldValue, e.NewValue)) { // if (e.Component != null && e.Member != null && e.Member.Name == "Name" &&
// changing the name of the component // e.NewValue is string && !object.Equals(e.OldValue, e.NewValue)) {
generator.NotifyComponentRenamed(e.Component, (string)e.NewValue, (string)e.OldValue); // // changing the name of the component
} // generator.NotifyComponentRenamed(e.Component, (string)e.NewValue, (string)e.OldValue);
} catch (Exception ex) { // }
MessageService.ShowException(ex);
}
} }
} }
@ -657,6 +647,7 @@ namespace ICSharpCode.FormsDesigner
} }
} }
/*
public void ShowSourceCode(IComponent component, EventDescriptor edesc, string eventMethodName) public void ShowSourceCode(IComponent component, EventDescriptor edesc, string eventMethodName)
{ {
int position; int position;
@ -675,6 +666,7 @@ namespace ICSharpCode.FormsDesigner
{ {
return generator.GetCompatibleMethods(edesc); return generator.GetCompatibleMethods(edesc);
} }
*/
void IsActiveViewContentChangedHandler(object sender, EventArgs e) void IsActiveViewContentChangedHandler(object sender, EventArgs e)
{ {
@ -726,10 +718,6 @@ namespace ICSharpCode.FormsDesigner
this.IsActiveViewContentChanged -= this.IsActiveViewContentChangedHandler; this.IsActiveViewContentChanged -= this.IsActiveViewContentChangedHandler;
if (this.generator != null) {
this.generator.Detach();
}
this.resourceStore.Dispose(); this.resourceStore.Dispose();
this.UserContent = null; this.UserContent = null;

2
src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/EventBindingService.cs

@ -9,6 +9,7 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.FormsDesigner.Services namespace ICSharpCode.FormsDesigner.Services
{ {
/*
public class EventBindingService : System.ComponentModel.Design.EventBindingService public class EventBindingService : System.ComponentModel.Design.EventBindingService
{ {
readonly FormsDesignerViewContent formDesigner; readonly FormsDesignerViewContent formDesigner;
@ -84,4 +85,5 @@ namespace ICSharpCode.FormsDesigner.Services
} }
} }
*/
} }

3
src/Main/Base/Project/Src/Gui/Pads/PropertyPad/PropertyContainer.cs

@ -5,6 +5,7 @@ using System;
using System.Collections; using System.Collections;
using System.ComponentModel.Design; using System.ComponentModel.Design;
using System.Windows.Forms; using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.SharpDevelop.Gui namespace ICSharpCode.SharpDevelop.Gui
{ {
@ -40,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Gui
internal PropertyContainer(bool createPadOnConstruction) internal PropertyContainer(bool createPadOnConstruction)
{ {
if (createPadOnConstruction && SD.Workbench != null) { if (createPadOnConstruction) {
PadDescriptor desc = SD.Workbench.GetPad(typeof(PropertyPad)); PadDescriptor desc = SD.Workbench.GetPad(typeof(PropertyPad));
if (desc != null) desc.CreatePad(); if (desc != null) desc.CreatePad();
} }

Loading…
Cancel
Save