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

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

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

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

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

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

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

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

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

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

@ -1,122 +1,78 @@ @@ -1,122 +1,78 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System;
//using System.CodeDom;
//using System.CodeDom.Compiler;
//using System.Collections;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Reflection;
//using System.Xml;
//
//using ICSharpCode.Core;
//using ICSharpCode.NRefactory.TypeSystem;
//using ICSharpCode.SharpDevelop.Editor;
//using Microsoft.CSharp;
//
//namespace ICSharpCode.WixBinding
//{
// /// <summary>
// /// Simplified designer generator interface that the WixDesignerLoader calls
// /// when flushing the changes.
// /// </summary>
// public interface IWixDialogDesignerGenerator
// {
// /// <summary>
// /// Passes the updated dialog element and its original id to the generator
// /// so the wix document can be updated.
// /// </summary>
// /// <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;
// ITextEditor textEditor;
//
// public CodeDomProvider CodeDomProvider {
// get { return new CSharpCodeProvider(); }
// }
//
// public FormsDesignerViewContent ViewContent {
// get { return view; }
// }
//
// public IEnumerable<OpenedFile> GetSourceFiles(out OpenedFile designerCodeFile)
// {
// designerCodeFile = view.PrimaryFile;
// return new [] {designerCodeFile};
// }
//
// public void Attach(FormsDesignerViewContent view)
// {
// this.view = view;
// textEditor = ((ITextEditorProvider)view.PrimaryViewContent).TextEditor;
// }
//
// public void Detach()
// {
// view = null;
// }
//
// /// <summary>
// /// Merges the changes made to the wix document by overwriting the dialog element.
// /// </summary>
// void IWixDialogDesignerGenerator.MergeFormChanges(string dialogId, XmlElement dialogElement)
// {
// DomRegion region = GetTextEditorRegionForDialogElement(dialogId);
// if (region.IsEmpty) {
// ThrowDialogElementCouldNotBeFoundError(dialogId);
// }
//
// WixTextWriter writer = new WixTextWriter(textEditor.Options);
// 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();
// }
// }
//}
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Xml;
using ICSharpCode.Core;
using ICSharpCode.FormsDesigner;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop.Editor;
using Microsoft.CSharp;
namespace ICSharpCode.WixBinding
{
/// <summary>
/// Simplified designer generator interface that the WixDesignerLoader calls
/// when flushing the changes.
/// </summary>
public interface IWixDialogDesignerGenerator
{
/// <summary>
/// Passes the updated dialog element and its original id to the generator
/// so the wix document can be updated.
/// </summary>
/// <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 : IWixDialogDesignerGenerator
{
readonly IWixDialogDesigner view;
public WixDialogDesignerGenerator(IWixDialogDesigner view)
{
this.view = view;
}
/// <summary>
/// Merges the changes made to the wix document by overwriting the dialog element.
/// </summary>
void IWixDialogDesignerGenerator.MergeFormChanges(string dialogId, XmlElement dialogElement)
{
DomRegion region = GetTextEditorRegionForDialogElement(dialogId);
if (region.IsEmpty) {
ThrowDialogElementCouldNotBeFoundError(dialogId);
}
var textEditor = view.PrimaryViewContentTextEditor;
WixTextWriter writer = new WixTextWriter(textEditor.Options);
WixDialogElement wixDialogElement = (WixDialogElement)dialogElement;
string newDialogXml = wixDialogElement.GetXml(writer);
WixDocumentEditor editor = new WixDocumentEditor(textEditor);
editor.Replace(region, newDialogXml);
}
DomRegion GetTextEditorRegionForDialogElement(string dialogId)
{
WixDocumentReader wixReader = new WixDocumentReader(view.GetDocumentXml());
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);
}
}
}

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

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

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

@ -2,6 +2,8 @@ @@ -2,6 +2,8 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.NRefactory.Editor;
using ICSharpCode.SharpDevelop.Editor;
namespace ICSharpCode.WixBinding
{
@ -28,5 +30,10 @@ namespace ICSharpCode.WixBinding @@ -28,5 +30,10 @@ namespace ICSharpCode.WixBinding
/// being designed.
/// </summary>
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 @@ @@ -7,7 +7,7 @@
<Manifest>
<Identity name = "ICSharpCode.WixBinding"/>
<!--<Dependency addin = "ICSharpCode.FormsDesigner" requirePreload = "true"/>-->
<Dependency addin = "ICSharpCode.FormsDesigner" requirePreload = "true"/>
<Dependency addin = "ICSharpCode.XmlEditor" requirePreload = "true"/>
</Manifest>
@ -157,16 +157,16 @@ @@ -157,16 +157,16 @@
</Condition>
</Path>
<!--<Path name = "/SharpDevelop/Workbench/Pads">
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "WixSetupDialogListPad"
category = "Setup"
title = "${res:ICSharpCode.WixBinding.SetupDialogListPad.Title}"
icon = "Setup.Icons.16x16.SetupDialogsPad"
class = "ICSharpCode.WixBinding.SetupDialogListPad"
defaultPosition = "Bottom, Hidden" />
</Path>-->
</Path>
<!--<Path name = "/SharpDevelop/Pads/WixSetupDialogListPad/ContextMenu">
<Path name = "/SharpDevelop/Pads/WixSetupDialogListPad/ContextMenu">
<Condition name = "Ownerstate" ownerstate = "ItemSelected" action = "Disable">
<MenuItem id = "OpenDialog"
icon = "Icons.16x16.OpenFileIcon"
@ -177,14 +177,14 @@ @@ -177,14 +177,14 @@
icon = "Icons.16x16.FormsDesigner.ViewCode"
class = "ICSharpCode.WixBinding.ViewDialogXmlCommand"/>
</Condition>
</Path>-->
</Path>
<!--<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<Path name = "/SharpDevelop/Workbench/DisplayBindings">
<DisplayBinding id = "WixDialogDesigner"
type = "Secondary"
class = "ICSharpCode.WixBinding.WixDialogDesignerDisplayBinding"
fileNamePattern = "\.(wxs|wxi)$"/>
</Path>-->
</Path>
<!-- Setup menu items that are created in the View menu -->
<Path name = "/SharpDevelop/Workbench/MainMenu/View">

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

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

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

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

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

@ -1,97 +1,103 @@ @@ -1,97 +1,103 @@
//// 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.FormsDesigner;
//using ICSharpCode.FormsDesigner.Services;
//using ICSharpCode.WixBinding;
//using NUnit.Framework;
//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.ComponentModel.Design.Serialization;
//using System.Windows.Forms;
//using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui
//{
// /// <summary>
// /// Tests that a WixDialogDesignerLoader creates bitmaps specified in the Wix XML.
// /// </summary>
// [TestFixture]
// public class BitmapCreatedByDesignerLoaderTestFixture : DialogLoadingTestFixtureBase, IWixDialogDesigner
// {
// Form formCreated;
// MockDesignerLoaderHost loaderHost;
//
// [TestFixtureSetUp]
// public void SetUpFixture()
// {
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator(), this);
// loaderHost = new MockDesignerLoaderHost();
// loader.BeginLoad(loaderHost);
// IComponent rootComponent = loaderHost.RootComponent;
// formCreated = (Form)rootComponent;
// }
//
// [TestFixtureTearDown]
// public void TearDownFixture()
// {
// if (formCreated != null) {
// formCreated.Dispose();
// }
// }
//
// [Test]
// public void DialogBitmapFileNameRequested()
// {
// Assert.AreEqual(@"C:\Projects\Setup\Bitmaps\DialogBitmap.bmp", BitmapFileNamesRequested[0]);
// }
//
// [Test]
// public void BannerBitmapFileNameRequested()
// {
// Assert.AreEqual(@"C:\Projects\Setup\Bitmaps\BannerBitmap.bmp", BitmapFileNamesRequested[1]);
// }
//
// string IWixDialogDesigner.DialogId {
// get {
// return "WelcomeDialog";
// }
// }
//
// string IWixDialogDesigner.GetDocumentXml()
// {
// return GetWixXml();
// }
//
// string IWixDialogDesigner.DocumentFileName {
// get {
// return @"C:\Projects\Setup\Setup.wxs";
// }
// }
//
// WixProject IWixDialogDesigner.Project {
// get {
// WixProject project = WixBindingTestsHelper.CreateEmptyWixProject();
// project.SetProperty("DefineConstants", "DATADIR=Bitmaps");
// return project;
// }
// }
//
// 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='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" +
// "\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>";
// }
// }
//}
// 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.FormsDesigner;
using ICSharpCode.FormsDesigner.Services;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Windows.Forms;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Gui
{
/// <summary>
/// Tests that a WixDialogDesignerLoader creates bitmaps specified in the Wix XML.
/// </summary>
[TestFixture]
public class BitmapCreatedByDesignerLoaderTestFixture : DialogLoadingTestFixtureBase, IWixDialogDesigner
{
Form formCreated;
MockDesignerLoaderHost loaderHost;
[TestFixtureSetUp]
public void SetUpFixture()
{
WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, fileLoader: this);
loaderHost = new MockDesignerLoaderHost();
loader.BeginLoad(loaderHost);
IComponent rootComponent = loaderHost.RootComponent;
formCreated = (Form)rootComponent;
}
[TestFixtureTearDown]
public void TearDownFixture()
{
if (formCreated != null) {
formCreated.Dispose();
}
}
[Test]
public void DialogBitmapFileNameRequested()
{
Assert.AreEqual(@"C:\Projects\Setup\Bitmaps\DialogBitmap.bmp", BitmapFileNamesRequested[0]);
}
[Test]
public void BannerBitmapFileNameRequested()
{
Assert.AreEqual(@"C:\Projects\Setup\Bitmaps\BannerBitmap.bmp", BitmapFileNamesRequested[1]);
}
string IWixDialogDesigner.DialogId {
get {
return "WelcomeDialog";
}
}
string IWixDialogDesigner.GetDocumentXml()
{
return GetWixXml();
}
string IWixDialogDesigner.DocumentFileName {
get {
return @"C:\Projects\Setup\Setup.wxs";
}
}
WixProject IWixDialogDesigner.Project {
get {
WixProject project = WixBindingTestsHelper.CreateEmptyWixProject();
project.SetProperty("DefineConstants", "DATADIR=Bitmaps");
return project;
}
}
ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
get {
throw new NotImplementedException();
}
}
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='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" +
"\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 @@ @@ -1,116 +1,106 @@
//// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
//// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
//
//using System;
//using ICSharpCode.SharpDevelop;
//using ICSharpCode.SharpDevelop.Gui;
//using ICSharpCode.WixBinding;
//using NUnit.Framework;
//using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui
//{
// /// <summary>
// /// Tests that the WixDialogDesignerDisplayBinding can attach to
// /// Wix documents.
// /// </summary>
// [TestFixture]
// public class CanAttachToFileNameTestFixture
// {
// WixDialogDesignerDisplayBinding binding;
//
// [SetUp]
// public void Init()
// {
// binding = new WixDialogDesignerDisplayBinding();
// }
//
// [Test]
// public void WixFileName()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName("Setup.wxs");
// Assert.IsTrue(binding.CanAttachTo(view));
// }
//
// [Test]
// public void WixIncludeFileName()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName("Setup.wxi");
// Assert.IsTrue(binding.CanAttachTo(view));
// }
//
// [Test]
// public void WixFileNameUppercase()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName("SETUP.WXS");
// Assert.IsTrue(binding.CanAttachTo(view));
// }
//
// [Test]
// public void NonWixFileName()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName("Setup.txt");
// Assert.IsFalse(binding.CanAttachTo(view));
// }
//
// [Test]
// public void NonTextEditorProviderView()
// {
// MockViewContent view = new MockViewContent();
// view.SetFileName("Setup.wxs");
// Assert.IsFalse(binding.CanAttachTo(view));
// }
//
// [Test]
// public void UntitledWixFileName()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetUntitledFileName("Setup.wxs");
// Assert.IsTrue(binding.CanAttachTo(view));
// }
//
// [Test]
// public void UntitledNonWixFileName()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetUntitledFileName("Setup.txt");
// Assert.IsFalse(binding.CanAttachTo(view));
// }
//
// [Test]
// public void NullUntitledFileName()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetUntitledFileName(null);
// Assert.IsFalse(binding.CanAttachTo(view));
// }
//
// [Test]
// public void NullFileName()
// {
// MockTextEditorViewContent view = new MockTextEditorViewContent();
// view.SetFileName(null);
// Assert.IsFalse(binding.CanAttachTo(view));
// }
//
// [Test]
// public void ReattachIsFalse()
// {
// 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();
// }
// }
//}
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Gui
{
/// <summary>
/// Tests that the WixDialogDesignerDisplayBinding can attach to
/// Wix documents.
/// </summary>
[TestFixture]
public class CanAttachToFileNameTestFixture
{
WixDialogDesignerDisplayBinding binding;
[SetUp]
public void Init()
{
binding = new WixDialogDesignerDisplayBinding();
}
[Test]
public void WixFileName()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
view.SetFileName("Setup.wxs");
Assert.IsTrue(binding.CanAttachTo(view));
}
[Test]
public void WixIncludeFileName()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
view.SetFileName("Setup.wxi");
Assert.IsTrue(binding.CanAttachTo(view));
}
[Test]
public void WixFileNameUppercase()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
view.SetFileName("SETUP.WXS");
Assert.IsTrue(binding.CanAttachTo(view));
}
[Test]
public void NonWixFileName()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
view.SetFileName("Setup.txt");
Assert.IsFalse(binding.CanAttachTo(view));
}
[Test]
public void NonTextEditorProviderView()
{
MockViewContent view = new MockViewContent();
view.SetFileName("Setup.wxs");
Assert.IsFalse(binding.CanAttachTo(view));
}
[Test]
public void UntitledWixFileName()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
view.SetUntitledFileName("Setup.wxs");
Assert.IsTrue(binding.CanAttachTo(view));
}
[Test]
public void UntitledNonWixFileName()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
view.SetUntitledFileName("Setup.txt");
Assert.IsFalse(binding.CanAttachTo(view));
}
[Test]
public void NullUntitledFileName()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
view.SetUntitledFileName(null);
Assert.IsFalse(binding.CanAttachTo(view));
}
[Test]
public void NullFileName()
{
MockTextEditorViewContent view = new MockTextEditorViewContent();
view.SetFileName(null);
Assert.IsFalse(binding.CanAttachTo(view));
}
[Test]
public void ReattachIsFalse()
{
Assert.IsFalse(binding.ReattachWhenParserServiceIsReady);
}
}
}

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

@ -1,112 +1,118 @@ @@ -1,112 +1,118 @@
//// 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.FormsDesigner;
//using ICSharpCode.FormsDesigner.Services;
//using ICSharpCode.WixBinding;
//using NUnit.Framework;
//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.ComponentModel.Design.Serialization;
//using System.Windows.Forms;
//using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui
//{
// /// <summary>
// /// Tests that a WixDialogDesignerLoader uses the dialog id to find the dialog
// /// XML element.
// /// </summary>
// [TestFixture]
// public class DialogIdSpecifiedForDesignerLoaderTestFixture : IWixDialogDesigner
// {
// Form formCreated;
// MockDesignerLoaderHost loaderHost;
//
// [TestFixtureSetUp]
// public void SetUpFixture()
// {
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator());
// loaderHost = new MockDesignerLoaderHost();
// loader.BeginLoad(loaderHost);
// IComponent rootComponent = loaderHost.RootComponent;
// formCreated = (Form)rootComponent;
// }
//
// [TestFixtureTearDown]
// public void TearDownFixture()
// {
// if (formCreated != null) {
// formCreated.Dispose();
// }
// }
//
// [Test]
// public void FormName()
// {
// Assert.AreEqual("WelcomeDialog", formCreated.Name);
// }
//
// [Test]
// public void OneComponentCreated()
// {
// Assert.AreEqual(1, loaderHost.CreatedComponents.Count);
// }
//
// [Test]
// public void NameCreationServiceCreated()
// {
// INameCreationService nameCreationService = (INameCreationService)loaderHost.GetService(typeof(INameCreationService));
// Assert.IsTrue(nameCreationService is XmlDesignerNameCreationService);
// }
//
// [Test]
// public void ComponentSerializationServiceCreated()
// {
// ComponentSerializationService serializationService = (ComponentSerializationService)loaderHost.GetService(typeof(ComponentSerializationService));
// Assert.IsTrue(serializationService is ComponentSerializationService);
// }
//
// [Test]
// public void DesignerSerializationServiceCreated()
// {
// IDesignerSerializationService designerSerializationServiceCreated = (IDesignerSerializationService)loaderHost.GetService(typeof(IDesignerSerializationService));
// Assert.IsTrue(designerSerializationServiceCreated is DesignerSerializationService);
// }
//
// string IWixDialogDesigner.DialogId {
// get {
// return "WelcomeDialog";
// }
// }
//
// string IWixDialogDesigner.GetDocumentXml()
// {
// return GetWixXml();
// }
//
// public string DocumentFileName {
// get {
// return String.Empty;
// }
// }
//
// public WixProject Project {
// get {
// return WixBindingTestsHelper.CreateEmptyWixProject();
// }
// }
//
// 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>";
// }
// }
//}
// 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.FormsDesigner;
using ICSharpCode.FormsDesigner.Services;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Windows.Forms;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Gui
{
/// <summary>
/// Tests that a WixDialogDesignerLoader uses the dialog id to find the dialog
/// XML element.
/// </summary>
[TestFixture]
public class DialogIdSpecifiedForDesignerLoaderTestFixture : IWixDialogDesigner
{
Form formCreated;
MockDesignerLoaderHost loaderHost;
[TestFixtureSetUp]
public void SetUpFixture()
{
WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this);
loaderHost = new MockDesignerLoaderHost();
loader.BeginLoad(loaderHost);
IComponent rootComponent = loaderHost.RootComponent;
formCreated = (Form)rootComponent;
}
[TestFixtureTearDown]
public void TearDownFixture()
{
if (formCreated != null) {
formCreated.Dispose();
}
}
[Test]
public void FormName()
{
Assert.AreEqual("WelcomeDialog", formCreated.Name);
}
[Test]
public void OneComponentCreated()
{
Assert.AreEqual(1, loaderHost.CreatedComponents.Count);
}
[Test]
public void NameCreationServiceCreated()
{
INameCreationService nameCreationService = (INameCreationService)loaderHost.GetService(typeof(INameCreationService));
Assert.IsTrue(nameCreationService is XmlDesignerNameCreationService);
}
[Test]
public void ComponentSerializationServiceCreated()
{
ComponentSerializationService serializationService = (ComponentSerializationService)loaderHost.GetService(typeof(ComponentSerializationService));
Assert.IsTrue(serializationService is ComponentSerializationService);
}
[Test]
public void DesignerSerializationServiceCreated()
{
IDesignerSerializationService designerSerializationServiceCreated = (IDesignerSerializationService)loaderHost.GetService(typeof(IDesignerSerializationService));
Assert.IsTrue(designerSerializationServiceCreated is DesignerSerializationService);
}
string IWixDialogDesigner.DialogId {
get {
return "WelcomeDialog";
}
}
string IWixDialogDesigner.GetDocumentXml()
{
return GetWixXml();
}
public string DocumentFileName {
get {
return String.Empty;
}
}
public WixProject Project {
get {
return WixBindingTestsHelper.CreateEmptyWixProject();
}
}
ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
get {
throw new NotImplementedException();
}
}
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>";
}
}
}

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

@ -1,105 +1,111 @@ @@ -1,105 +1,111 @@
//// 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.FormsDesigner;
//using ICSharpCode.WixBinding;
//using NUnit.Framework;
//using System;
//using System.CodeDom;
//using System.CodeDom.Compiler;
//using System.Collections;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Reflection;
//using System.Windows.Forms;
//using System.Xml;
//using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui
//{
// /// <summary>
// /// Tests that a WixDialogDesignerLoader calls the IDesignerGenerator.MergeFormChanges
// /// method after being flushed.
// /// </summary>
// [TestFixture]
// public class FlushLoaderTestFixture : IWixDialogDesignerGenerator, IWixDialogDesigner
// {
// class DerivedWixDialogDesignerLoader : WixDialogDesignerLoader
// {
// public DerivedWixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator)
// : base(designer, generator)
// {
// }
//
// public void CallPerformFlush()
// {
// base.PerformFlush(null);
// }
// }
//
// string newDialogTitle;
// string dialogId;
//
// [TestFixtureSetUp]
// public void SetUpFixture()
// {
// newDialogTitle = String.Empty;
// dialogId = String.Empty;
//
// DerivedWixDialogDesignerLoader loader = new DerivedWixDialogDesignerLoader(this, this);
// MockDesignerLoaderHost loaderHost = new MockDesignerLoaderHost();
// loader.BeginLoad(loaderHost);
// using (Form form = (Form)loaderHost.RootComponent) {
// form.Text = "NewTitle";
// loader.CallPerformFlush();
// }
// }
//
// [Test]
// public void MergeFormChangesCalled()
// {
// Assert.AreEqual("NewTitle", newDialogTitle);
// }
//
// [Test]
// public void DialogId()
// {
// Assert.AreEqual("WelcomeDialog", dialogId);
// }
//
// string IWixDialogDesigner.DialogId {
// get { return "WelcomeDialog"; }
// }
//
// string IWixDialogDesigner.GetDocumentXml()
// {
// return GetWixXml();
// }
//
// public string DocumentFileName {
// get { return String.Empty; }
// }
//
// public WixProject Project {
// get { return WixBindingTestsHelper.CreateEmptyWixProject(); }
// }
//
// 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>";
// }
//
// public void MergeFormChanges(string dialogId, XmlElement dialogElement)
// {
// this.dialogId = dialogId;
// newDialogTitle = dialogElement.GetAttribute("Title");
// }
// }
//}
// 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.FormsDesigner;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.Windows.Forms;
using System.Xml;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Gui
{
/// <summary>
/// Tests that a WixDialogDesignerLoader calls the IDesignerGenerator.MergeFormChanges
/// method after being flushed.
/// </summary>
[TestFixture]
public class FlushLoaderTestFixture : IWixDialogDesignerGenerator, IWixDialogDesigner
{
class DerivedWixDialogDesignerLoader : WixDialogDesignerLoader
{
public DerivedWixDialogDesignerLoader(IWixDialogDesigner designer, IWixDialogDesignerGenerator generator)
: base(designer, generator)
{
}
public void CallPerformFlush()
{
base.PerformFlush(null);
}
}
string newDialogTitle;
string dialogId;
[TestFixtureSetUp]
public void SetUpFixture()
{
newDialogTitle = String.Empty;
dialogId = String.Empty;
DerivedWixDialogDesignerLoader loader = new DerivedWixDialogDesignerLoader(this, this);
MockDesignerLoaderHost loaderHost = new MockDesignerLoaderHost();
loader.BeginLoad(loaderHost);
using (Form form = (Form)loaderHost.RootComponent) {
form.Text = "NewTitle";
loader.CallPerformFlush();
}
}
[Test]
public void MergeFormChangesCalled()
{
Assert.AreEqual("NewTitle", newDialogTitle);
}
[Test]
public void DialogId()
{
Assert.AreEqual("WelcomeDialog", dialogId);
}
string IWixDialogDesigner.DialogId {
get { return "WelcomeDialog"; }
}
string IWixDialogDesigner.GetDocumentXml()
{
return GetWixXml();
}
public string DocumentFileName {
get { return String.Empty; }
}
public WixProject Project {
get { return WixBindingTestsHelper.CreateEmptyWixProject(); }
}
ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
get {
throw new NotImplementedException();
}
}
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>";
}
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 @@ @@ -1,35 +1,58 @@
//// 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 WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui
//{
// /// <summary>
// /// Tests that the WixDialogDesigner.GetDesigner method returns the
// /// Wix dialog designer attached to the primary view.
// /// </summary>
// [TestFixture]
// public class GetWixDesignerFromViewTests
// {
// [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));
// }
// }
//}
// 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.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Widgets;
using ICSharpCode.SharpDevelop.WinForms;
using ICSharpCode.SharpDevelop.Workbench;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using Rhino.Mocks;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Gui
{
/// <summary>
/// Tests that the WixDialogDesigner.GetDesigner method returns the
/// Wix dialog designer attached to the primary view.
/// </summary>
[TestFixture]
public class GetWixDesignerFromViewTests
{
[TestFixtureSetUp]
public void FixtureSetUp()
{
SD.InitializeForUnitTests();
SD.Services.AddService(typeof(IWinFormsService), MockRepository.GenerateStub<IWinFormsService>());
SD.WinForms.Stub(s => s.CreateWindowsFormsHost()).IgnoreArguments().Return(new CustomWindowsFormsHost());
SD.Services.AddService(typeof(IWorkbench), new MockWorkbench());
SD.Services.AddService(typeof(IFileService), MockRepository.GenerateStub<IFileService>());
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 @@ @@ -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 @@ @@ -1,67 +1,75 @@
//// 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.Core;
//using ICSharpCode.FormsDesigner;
//using ICSharpCode.WixBinding;
//using NUnit.Framework;
//using System;
//using System.Collections.Generic;
//using System.ComponentModel;
//using System.Resources;
//using System.Windows.Forms;
//using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui
//{
// /// <summary>
// /// Tests that a WixDialogDesignerLoader reports that the dialog id cannot be found
// /// in the Wix document.
// /// </summary>
// [TestFixture]
// public class MissingDialogIdDesignerLoaderTestFixture : IWixDialogDesigner
// {
// [TestFixtureSetUp]
// public void SetupFixture()
// {
// WixBindingTestsHelper.RegisterResourceStringsWithSharpDevelopResourceManager();
// }
//
// [Test]
// [ExpectedException(typeof(FormsDesignerLoadException), ExpectedMessage = "Unable to find dialog with an id of 'MissingDialog'.")]
// public void LoadMissingDialog()
// {
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator());
// MockDesignerLoaderHost loaderHost = new MockDesignerLoaderHost();
// loader.BeginLoad(loaderHost);
// }
//
// string IWixDialogDesigner.DialogId {
// get { return "MissingDialog"; }
// }
//
// string IWixDialogDesigner.GetDocumentXml()
// {
// return GetWixXml();
// }
//
// public string DocumentFileName {
// get { return String.Empty; }
// }
//
// public WixProject Project {
// get { return WixBindingTestsHelper.CreateEmptyWixProject(); }
// }
//
// 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>";
// }
// }
//}
// 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.Core;
using ICSharpCode.FormsDesigner;
using ICSharpCode.SharpDevelop;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Resources;
using System.Windows.Forms;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Gui
{
/// <summary>
/// Tests that a WixDialogDesignerLoader reports that the dialog id cannot be found
/// in the Wix document.
/// </summary>
[TestFixture]
public class MissingDialogIdDesignerLoaderTestFixture : IWixDialogDesigner
{
[TestFixtureSetUp]
public void SetupFixture()
{
SD.InitializeForUnitTests();
WixBindingTestsHelper.RegisterResourceStringsWithSharpDevelopResourceManager();
}
[Test]
[ExpectedException(typeof(FormsDesignerLoadException), ExpectedMessage = "Unable to find dialog with an id of 'MissingDialog'.")]
public void LoadMissingDialog()
{
WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this);
MockDesignerLoaderHost loaderHost = new MockDesignerLoaderHost();
loader.BeginLoad(loaderHost);
}
string IWixDialogDesigner.DialogId {
get { return "MissingDialog"; }
}
string IWixDialogDesigner.GetDocumentXml()
{
return GetWixXml();
}
public string DocumentFileName {
get { return String.Empty; }
}
public WixProject Project {
get { return WixBindingTestsHelper.CreateEmptyWixProject(); }
}
ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
get {
throw new NotImplementedException();
}
}
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 @@ @@ -1,69 +1,66 @@
//// 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.Core;
//using ICSharpCode.FormsDesigner;
//using ICSharpCode.WixBinding;
//using NUnit.Framework;
//using System;
//using System.Resources;
//using WixBinding.Tests.Utils;
//
//namespace WixBinding.Tests.Gui
//{
// /// <summary>
// /// Tests that a FormsDesignerLoadException is thrown when the WixDialogDesignerLoader
// /// is used when no dialog id is set.
// /// </summary>
// [TestFixture]
// public class NoDialogIdSpecifiedForDesignerLoaderTestFixture : IWixDialogDesigner
// {
// [TestFixtureSetUp]
// public void SetupFixture()
// {
// 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()
// {
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, new WixDialogDesignerGenerator());
// loader.BeginLoad(new MockDesignerLoaderHost());
// }
//
// [Test]
// public void NoGeneratorSpecified()
// {
// try {
// WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this, null);
// Assert.Fail("Expected an argument exception before this line.");
// } catch (ArgumentException ex) {
// Assert.AreEqual("generator", ex.ParamName);
// }
// }
//
// string IWixDialogDesigner.DialogId {
// get {
// return null;
// }
// }
//
// string IWixDialogDesigner.GetDocumentXml()
// {
// return String.Empty;
// }
//
// public string DocumentFileName {
// get {
// return String.Empty;
// }
// }
//
// public WixProject Project {
// get {
// return WixBindingTestsHelper.CreateEmptyWixProject();
// }
// }
// }
//}
// 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.Core;
using ICSharpCode.FormsDesigner;
using ICSharpCode.SharpDevelop;
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
using System.Resources;
using WixBinding.Tests.Utils;
namespace WixBinding.Tests.Gui
{
/// <summary>
/// Tests that a FormsDesignerLoadException is thrown when the WixDialogDesignerLoader
/// is used when no dialog id is set.
/// </summary>
[TestFixture]
public class NoDialogIdSpecifiedForDesignerLoaderTestFixture : IWixDialogDesigner
{
[TestFixtureSetUp]
public void SetupFixture()
{
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()
{
WixDialogDesignerLoader loader = new WixDialogDesignerLoader(this);
loader.BeginLoad(new MockDesignerLoaderHost());
}
string IWixDialogDesigner.DialogId {
get {
return null;
}
}
string IWixDialogDesigner.GetDocumentXml()
{
return String.Empty;
}
ICSharpCode.SharpDevelop.Editor.ITextEditor IWixDialogDesigner.PrimaryViewContentTextEditor {
get {
throw new NotImplementedException();
}
}
public string DocumentFileName {
get {
return String.Empty;
}
}
public WixProject Project {
get {
return WixBindingTestsHelper.CreateEmptyWixProject();
}
}
}
}

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

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

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

@ -150,7 +150,6 @@ @@ -150,7 +150,6 @@
<Compile Include="Project\WixProjectOutputTypeFileExtensionTests.cs" />
<Compile Include="DialogLoading\SimpleDialogTestFixture.cs" />
<Compile Include="DialogLoading\SimpleDialogUsingObjectCreatorTestFixture.cs" />
<Compile Include="Gui\LoaderProviderTests.cs" />
<Compile Include="Gui\NoDialogIdSpecifiedForDesignerLoaderTestFixture.cs" />
<Compile Include="Utils\MockDesignerLoaderHost.cs" />
<Compile Include="Gui\DialogIdSpecifiedForDesignerLoaderTestFixture.cs" />
@ -323,6 +322,10 @@ @@ -323,6 +322,10 @@
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name>
</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">
<Project>{DCA2703D-250A-463E-A68A-07ED105AE6BD}</Project>
<Name>XmlEditor</Name>

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

@ -14,6 +14,7 @@ using ICSharpCode.SharpDevelop.Workbench; @@ -14,6 +14,7 @@ using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.FormsDesigner
{
/*
public interface IDesignerGenerator
{
CodeDomProvider CodeDomProvider {
@ -35,4 +36,5 @@ namespace ICSharpCode.FormsDesigner @@ -35,4 +36,5 @@ namespace ICSharpCode.FormsDesigner
ICollection GetCompatibleMethods(EventDescriptor edesc);
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; @@ -14,6 +14,7 @@ using ICSharpCode.FormsDesigner.Services;
namespace ICSharpCode.FormsDesigner
{
/*
/// <summary>
/// An abstract base class for CodeDOM designer loaders.
/// </summary>
@ -172,4 +173,5 @@ namespace ICSharpCode.FormsDesigner @@ -172,4 +173,5 @@ namespace ICSharpCode.FormsDesigner
MessageService.ShowError(sb.ToString());
}
}
*/
}

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

@ -2,14 +2,22 @@ @@ -2,14 +2,22 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Collections.Generic;
using System.ComponentModel.Design.Serialization;
using ICSharpCode.NRefactory;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.FormsDesigner
{
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

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

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

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

@ -9,6 +9,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -9,6 +9,7 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.FormsDesigner.Services
{
/*
public class EventBindingService : System.ComponentModel.Design.EventBindingService
{
readonly FormsDesignerViewContent formDesigner;
@ -84,4 +85,5 @@ namespace ICSharpCode.FormsDesigner.Services @@ -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; @@ -5,6 +5,7 @@ using System;
using System.Collections;
using System.ComponentModel.Design;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Workbench;
namespace ICSharpCode.SharpDevelop.Gui
{
@ -40,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -40,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Gui
internal PropertyContainer(bool createPadOnConstruction)
{
if (createPadOnConstruction && SD.Workbench != null) {
if (createPadOnConstruction) {
PadDescriptor desc = SD.Workbench.GetPad(typeof(PropertyPad));
if (desc != null) desc.CreatePad();
}

Loading…
Cancel
Save