Browse Source

Add simple AddIn manager that can enable and disable AddIns.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@806 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
d4304b6400
  1. 21
      src/AddIns/Misc/AddInManager/Project/AddInManager.addin
  2. 67
      src/AddIns/Misc/AddInManager/Project/AddInManager.csproj
  3. 34
      src/AddIns/Misc/AddInManager/Project/Configuration/AssemblyInfo.cs
  4. 148
      src/AddIns/Misc/AddInManager/Project/Src/AddInControl.cs
  5. 20
      src/AddIns/Misc/AddInManager/Project/Src/Commands.cs
  6. 380
      src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs
  7. 120
      src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.resx
  8. 2
      src/AddIns/Misc/RegExpTk/Project/Src/Dialogs/MainWindow.cs
  9. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  10. 71
      src/Main/Base/Project/Src/Gui/FormLocationHelper.cs
  11. 18
      src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs
  12. 13
      src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplaceDialog.cs
  13. 1
      src/Main/Core/Project/ICSharpCode.Core.csproj
  14. 19
      src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs
  15. 13
      src/Main/Core/Project/Src/AddInTree/AddIn/Manifest.cs
  16. 125
      src/Main/Core/Project/Src/AddInTree/AddInManager.cs
  17. 4
      src/Main/Core/Project/Src/AddInTree/AddInTree.cs
  18. 73
      src/Main/Core/Project/Src/AddInTree/CoreStartup.cs
  19. 5
      src/Main/StartUp/Project/SharpDevelopMain.cs
  20. 2
      src/Main/StartUp/Project/StartUp.csproj
  21. 9
      src/SharpDevelop.WithTests.sln
  22. 9
      src/SharpDevelop.sln

21
src/AddIns/Misc/AddInManager/Project/AddInManager.addin

@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
<AddIn name = "AddInManager"
author = "Daniel Grunwald"
copyright = "GNU General Public License"
url = ""
description = "Can install, enable, disable and uninstall AddIns">
<Manifest>
<Identity name = "ICSharpCode.AddInManager"/>
</Manifest>
<Runtime>
<Import assembly = "ICSharpCode.AddInManager.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/MainMenu/Tools">
<MenuItem id = "ShowAddInManager"
insertafter = "Separator1" insertbefore = "Separator2"
label = "AddIn Manager"
class = "ICSharpCode.AddInManager.ShowCommand"/>
</Path>
</AddIn>

67
src/AddIns/Misc/AddInManager/Project/AddInManager.csproj

@ -0,0 +1,67 @@ @@ -0,0 +1,67 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>ICSharpCode.AddInManager</RootNamespace>
<AssemblyName>ICSharpCode.AddInManager</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F93E52FD-DA66-4CE5-A0CB-BCD902811122}</ProjectGuid>
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
<NoStdLib>False</NoStdLib>
<RegisterForComInterop>False</RegisterForComInterop>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
<BaseAddress>4194304</BaseAddress>
<PlatformTarget>AnyCPU</PlatformTarget>
<FileAlignment>4096</FileAlignment>
<WarningLevel>4</WarningLevel>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\AddInManager\</OutputPath>
<Optimize>False</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>Full</DebugType>
<CheckForOverflowUnderflow>True</CheckForOverflowUnderflow>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\AddInManager\</OutputPath>
<Optimize>True</Optimize>
<DefineConstants>TRACE</DefineConstants>
<DebugSymbols>false</DebugSymbols>
<DebugType>None</DebugType>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<None Include="AddInManager.addin">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Src\Commands.cs" />
<Compile Include="Src\ManagerForm.cs" />
<EmbeddedResource Include="Src\ManagerForm.resx">
<DependentUpon>ManagerForm.cs</DependentUpon>
</EmbeddedResource>
<Compile Include="Src\AddInControl.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Main\Core\Project\ICSharpCode.Core.csproj">
<Project>{35CEF10F-2D4C-45F2-9DD1-161E0FEC583C}</Project>
<Name>ICSharpCode.Core</Name>
<Private>False</Private>
</ProjectReference>
<ProjectReference Include="..\..\..\..\Main\Base\Project\ICSharpCode.SharpDevelop.csproj">
<Project>{2748AD25-9C63-4E12-877B-4DCE96FBED54}</Project>
<Name>ICSharpCode.SharpDevelop</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

34
src/AddIns/Misc/AddInManager/Project/Configuration/AssemblyInfo.cs

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Daniel Grunwald" email="daniel@danielgrunwald.de"/>
// <version>$Revision$</version>
// </file>
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly: AssemblyTitle("AddInManager")]
[assembly: AssemblyDescription("AddInManager for ICSharpCode.Core")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("ICSharpCode")]
[assembly: AssemblyProduct("SharpDevelop")]
[assembly: AssemblyCopyright("GNU General Public Licence")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("2.0.0.1")]

148
src/AddIns/Misc/AddInManager/Project/Src/AddInControl.cs

@ -0,0 +1,148 @@ @@ -0,0 +1,148 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 26.11.2005
* Time: 15:54
*/
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace ICSharpCode.AddInManager
{
/// <summary>
/// Description of AddInControl.
/// </summary>
public class AddInControl : Control
{
AddIn addIn;
public AddIn AddIn {
get {
return addIn;
}
}
public AddInControl(AddIn addIn)
{
this.addIn = addIn;
this.BackColor = SystemColors.Window;
this.Size = new Size(100, 40);
this.SetStyle(ControlStyles.Selectable, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.ResizeRedraw, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
}
bool selected;
public bool Selected {
get {
return selected;
}
set {
if (selected != value) {
selected = value;
Invalidate();
}
}
}
protected override void OnClick(EventArgs e)
{
base.OnClick(e);
Focus();
}
protected override void OnPaint(PaintEventArgs e)
{
Graphics g = e.Graphics;
Rectangle bounds = this.ClientRectangle;
bounds.Offset(1, 1);
bounds.Inflate(-2, -2);
Brush gradient = new LinearGradientBrush(bounds,
selected ? SystemColors.ControlLight : SystemColors.ControlLightLight,
selected ? SystemColors.Highlight : SystemColors.ControlDark,
LinearGradientMode.ForwardDiagonal);
GraphicsPath path = new GraphicsPath();
const int egdeRadius = 3;
const int innerMargin = egdeRadius + 2;
RectangleF arcRect = new RectangleF(bounds.Location, new SizeF(egdeRadius * 2, egdeRadius * 2));
//top left Arc
path.AddArc(arcRect, 180, 90);
path.AddLine(bounds.X + egdeRadius, bounds.Y, bounds.Right - egdeRadius, bounds.Y);
// top right arc
arcRect.X = bounds.Right - egdeRadius * 2;
path.AddArc(arcRect, 270, 90);
path.AddLine(bounds.Right, bounds.Left + egdeRadius, bounds.Right, bounds.Bottom - egdeRadius);
// bottom right arc
arcRect.Y = bounds.Bottom - egdeRadius * 2;
path.AddArc(arcRect, 0, 90);
path.AddLine(bounds.X + egdeRadius, bounds.Bottom, bounds.Right - egdeRadius, bounds.Bottom);
// bottom left arc
arcRect.X = bounds.Left;
path.AddArc(arcRect, 90, 90);
path.AddLine(bounds.X, bounds.Left + egdeRadius, bounds.X, bounds.Bottom - egdeRadius);
g.FillPath(gradient, path);
g.DrawPath(SystemPens.ControlText, path);
path.Dispose();
gradient.Dispose();
Brush textBrush;
string description = GetText(out textBrush);
if (selected && textBrush == SystemBrushes.GrayText)
textBrush = SystemBrushes.HighlightText;
int titleWidth;
using (Font boldFont = new Font("Arial", 8, FontStyle.Bold)) {
g.DrawString(addIn.Name, boldFont, textBrush, innerMargin, innerMargin);
titleWidth = (int)g.MeasureString(addIn.Name, boldFont).Width + 1;
}
if (addIn.Version != null && addIn.Version.ToString() != "0.0.0.0") {
g.DrawString(addIn.Version.ToString(), Font, textBrush, innerMargin + titleWidth + 4, innerMargin);
}
RectangleF textBounds = bounds;
textBounds.Offset(innerMargin, innerMargin);
textBounds.Inflate(-innerMargin * 2, -innerMargin * 2);
g.DrawString(description, Font, textBrush, textBounds);
}
string GetText(out Brush textBrush)
{
switch (addIn.Action) {
case AddInAction.Enable:
if (addIn.Enabled) {
textBrush = SystemBrushes.ControlText;
return addIn.Properties["description"];
} else {
textBrush = SystemBrushes.ActiveCaption;
return "AddIn will be enabled after restarting SharpDevelop";
}
case AddInAction.Disable:
textBrush = SystemBrushes.GrayText;
if (addIn.Enabled)
return "AddIn will be disabled after restarting SharpDevelop";
else
return "Disabled"; // TODO: Test if it was disabled because of conflict
case AddInAction.Install:
textBrush = SystemBrushes.ActiveCaption;
return "AddIn will be installed after restarting SharpDevelop";
case AddInAction.Uninstall:
textBrush = SystemBrushes.GrayText;
return "AddIn will be removed after restarting SharpDevelop";
case AddInAction.Update:
textBrush = SystemBrushes.ActiveCaption;
return "AddIn will be updated after restarting SharpDevelop";
default:
textBrush = Brushes.Yellow;
return addIn.Action.ToString();
}
}
}
}

20
src/AddIns/Misc/AddInManager/Project/Src/Commands.cs

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 26.11.2005
* Time: 14:53
*/
using System;
using ICSharpCode.Core;
namespace ICSharpCode.AddInManager
{
public class ShowCommand : AbstractMenuCommand
{
public override void Run()
{
ManagerForm.ShowForm();
}
}
}

380
src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.cs

@ -0,0 +1,380 @@ @@ -0,0 +1,380 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 26.11.2005
* Time: 14:53
*/
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace ICSharpCode.AddInManager
{
public class ManagerForm : System.Windows.Forms.Form
{
static ManagerForm instance;
public static ManagerForm Instance {
get {
return instance;
}
}
public static void ShowForm()
{
if (instance == null) {
instance = new ManagerForm();
instance.Owner = ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm;
instance.Show();
} else {
instance.Activate();
}
}
public ManagerForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();
ICSharpCode.SharpDevelop.Gui.FormLocationHelper.Apply(this, "AddInManager.WindowBounds", true);
Stack<AddInControl> stack = new Stack<AddInControl>();
int index = 0;
AddInControl ctl;
foreach (AddIn addIn in AddInTree.AddIns) {
string identity = addIn.Manifest.PrimaryIdentity;
if (identity == null || identity == "SharpDevelop") // || identity == "ICSharpCode.AddInManager"
continue;
ctl = new AddInControl(addIn);
ctl.Dock = DockStyle.Top;
ctl.TabIndex = index++;
stack.Push(ctl);
ctl.Enter += OnControlEnter;
ctl.Click += OnControlClick;
}
while (stack.Count > 0) {
splitContainer.Panel1.Controls.Add(stack.Pop());
}
splitContainer.Panel2Collapsed = true;
}
void OnControlClick(object sender, EventArgs e)
{
// clicking again on already focused item:
// remove selection of other items / or with Ctrl: toggle selection
if (((Control)sender).Focused)
OnControlEnter(sender, e);
}
AddInControl oldFocus;
bool ignoreFocusChange;
void OnControlEnter(object sender, EventArgs e)
{
if (ignoreFocusChange)
return;
bool ctrl = (ModifierKeys & Keys.Control) == Keys.Control;
if ((ModifierKeys & Keys.Shift) == Keys.Shift && sender != oldFocus) {
bool sel = false;
foreach (AddInControl ctl in splitContainer.Panel1.Controls) {
if (ctl == sender || ctl == oldFocus) {
sel = !sel;
ctl.Selected = true;
} else {
if (sel || !ctrl) {
ctl.Selected = sel;
}
}
}
} else if (ctrl) {
foreach (AddInControl ctl in splitContainer.Panel1.Controls) {
if (ctl == sender)
ctl.Selected = !ctl.Selected;
}
oldFocus = (AddInControl)sender;
} else {
foreach (AddInControl ctl in splitContainer.Panel1.Controls) {
ctl.Selected = ctl == sender;
}
oldFocus = (AddInControl)sender;
}
UpdateActionBox();
}
List<AddIn> selected;
AddInAction selectedAction;
void UpdateActionBox()
{
ignoreFocusChange = true;
selected = new List<AddIn>();
foreach (AddInControl ctl in splitContainer.Panel1.Controls) {
if (ctl.Selected)
selected.Add(ctl.AddIn);
}
splitContainer.Panel2Collapsed = selected.Count == 0;
if (selected.Count > 0) {
dependencyTable.Visible = false;
uninstallButton.Enabled = false;
runActionButton.Enabled = false;
runActionButton.Visible = true;
uninstallButton.Visible = true;
bool allEnabled = true;
bool allDisabled = true;
foreach (AddIn addIn in selected) {
allEnabled &= addIn.Action == AddInAction.Enable;
allDisabled &= addIn.Action == AddInAction.Disable;
}
if (allEnabled) {
selectedAction = AddInAction.Disable;
actionGroupBox.Text = runActionButton.Text = "Disable";
actionDescription.Text = "Disables the selected AddIns.";
ShowDependencies(selected, false);
uninstallButton.Enabled = runActionButton.Enabled = !dependencyTable.Visible;
} else if (allDisabled) {
selectedAction = AddInAction.Enable;
actionGroupBox.Text = runActionButton.Text = "Enable";
actionDescription.Text = "Enables the selected AddIns.";
ShowDependencies(selected, true);
runActionButton.Enabled = !dependencyTable.Visible;
uninstallButton.Enabled = true;
} else {
actionGroupBox.Text = "";
actionDescription.Text = "AddIns with multiple states are selected";
runActionButton.Visible = false;
uninstallButton.Visible = false;
}
}
ignoreFocusChange = false;
}
void ShowDependencies(List<AddIn> addIns, bool enable)
{
}
void CloseButtonClick(object sender, EventArgs e)
{
Close();
}
void RunActionButtonClick(object sender, EventArgs e)
{
if (selectedAction == AddInAction.Disable) {
ICSharpCode.Core.AddInManager.Disable(selected);
} else if (selectedAction == AddInAction.Enable) {
ICSharpCode.Core.AddInManager.Enable(selected);
}
foreach (AddInControl ctl in splitContainer.Panel1.Controls) {
ctl.Invalidate();
}
UpdateActionBox();
}
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
instance = null;
}
#region Windows Forms Designer generated code
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.topPanel = new System.Windows.Forms.Panel();
this.bottomPanel = new System.Windows.Forms.Panel();
this.installButton = new System.Windows.Forms.Button();
this.closeButton = new System.Windows.Forms.Button();
this.splitContainer = new System.Windows.Forms.SplitContainer();
this.actionGroupBox = new System.Windows.Forms.GroupBox();
this.actionFlowLayoutPanel = new System.Windows.Forms.FlowLayoutPanel();
this.actionDescription = new System.Windows.Forms.Label();
this.dependencyTable = new System.Windows.Forms.TableLayoutPanel();
this.runActionButton = new System.Windows.Forms.Button();
this.uninstallButton = new System.Windows.Forms.Button();
this.bottomPanel.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout();
this.splitContainer.SuspendLayout();
this.actionGroupBox.SuspendLayout();
this.actionFlowLayoutPanel.SuspendLayout();
this.SuspendLayout();
//
// topPanel
//
this.topPanel.Dock = System.Windows.Forms.DockStyle.Top;
this.topPanel.Location = new System.Drawing.Point(0, 0);
this.topPanel.Name = "topPanel";
this.topPanel.Size = new System.Drawing.Size(460, 33);
this.topPanel.TabIndex = 0;
//
// bottomPanel
//
this.bottomPanel.Controls.Add(this.installButton);
this.bottomPanel.Controls.Add(this.closeButton);
this.bottomPanel.Dock = System.Windows.Forms.DockStyle.Bottom;
this.bottomPanel.Location = new System.Drawing.Point(0, 355);
this.bottomPanel.Name = "bottomPanel";
this.bottomPanel.Size = new System.Drawing.Size(460, 35);
this.bottomPanel.TabIndex = 2;
//
// installButton
//
this.installButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.installButton.Location = new System.Drawing.Point(274, 6);
this.installButton.Name = "installButton";
this.installButton.Size = new System.Drawing.Size(93, 23);
this.installButton.TabIndex = 0;
this.installButton.Text = "Install AddIn";
this.installButton.UseCompatibleTextRendering = true;
this.installButton.UseVisualStyleBackColor = true;
//
// closeButton
//
this.closeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.closeButton.Location = new System.Drawing.Point(373, 6);
this.closeButton.Name = "closeButton";
this.closeButton.Size = new System.Drawing.Size(75, 23);
this.closeButton.TabIndex = 1;
this.closeButton.Text = "Close";
this.closeButton.UseCompatibleTextRendering = true;
this.closeButton.UseVisualStyleBackColor = true;
this.closeButton.Click += new System.EventHandler(this.CloseButtonClick);
//
// splitContainer
//
this.splitContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer.FixedPanel = System.Windows.Forms.FixedPanel.Panel2;
this.splitContainer.Location = new System.Drawing.Point(0, 33);
this.splitContainer.Name = "splitContainer";
//
// splitContainer.Panel1
//
this.splitContainer.Panel1.AutoScroll = true;
this.splitContainer.Panel1.BackColor = System.Drawing.SystemColors.Window;
this.splitContainer.Panel1MinSize = 100;
//
// splitContainer.Panel2
//
this.splitContainer.Panel2.Controls.Add(this.actionGroupBox);
this.splitContainer.Panel2MinSize = 100;
this.splitContainer.Size = new System.Drawing.Size(460, 322);
this.splitContainer.SplitterDistance = 310;
this.splitContainer.TabIndex = 1;
//
// actionGroupBox
//
this.actionGroupBox.Controls.Add(this.actionFlowLayoutPanel);
this.actionGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.actionGroupBox.Location = new System.Drawing.Point(0, 0);
this.actionGroupBox.Name = "actionGroupBox";
this.actionGroupBox.Size = new System.Drawing.Size(146, 322);
this.actionGroupBox.TabIndex = 0;
this.actionGroupBox.TabStop = false;
this.actionGroupBox.Text = "actionGroupBox";
this.actionGroupBox.UseCompatibleTextRendering = true;
//
// actionFlowLayoutPanel
//
this.actionFlowLayoutPanel.AutoScroll = true;
this.actionFlowLayoutPanel.Controls.Add(this.actionDescription);
this.actionFlowLayoutPanel.Controls.Add(this.dependencyTable);
this.actionFlowLayoutPanel.Controls.Add(this.runActionButton);
this.actionFlowLayoutPanel.Controls.Add(this.uninstallButton);
this.actionFlowLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.actionFlowLayoutPanel.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
this.actionFlowLayoutPanel.Location = new System.Drawing.Point(3, 17);
this.actionFlowLayoutPanel.Name = "actionFlowLayoutPanel";
this.actionFlowLayoutPanel.Size = new System.Drawing.Size(140, 302);
this.actionFlowLayoutPanel.TabIndex = 0;
this.actionFlowLayoutPanel.WrapContents = false;
//
// actionDescription
//
this.actionDescription.AutoSize = true;
this.actionDescription.Location = new System.Drawing.Point(3, 0);
this.actionDescription.Name = "actionDescription";
this.actionDescription.Size = new System.Drawing.Size(90, 18);
this.actionDescription.TabIndex = 0;
this.actionDescription.Text = "actionDescription";
this.actionDescription.UseCompatibleTextRendering = true;
//
// dependencyTable
//
this.dependencyTable.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.dependencyTable.ColumnCount = 2;
this.dependencyTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.dependencyTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.dependencyTable.Location = new System.Drawing.Point(3, 21);
this.dependencyTable.Name = "dependencyTable";
this.dependencyTable.RowCount = 2;
this.dependencyTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.dependencyTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.dependencyTable.Size = new System.Drawing.Size(106, 100);
this.dependencyTable.TabIndex = 1;
//
// runActionButton
//
this.runActionButton.Location = new System.Drawing.Point(3, 127);
this.runActionButton.Name = "runActionButton";
this.runActionButton.Size = new System.Drawing.Size(91, 23);
this.runActionButton.TabIndex = 2;
this.runActionButton.Text = "runAction";
this.runActionButton.UseCompatibleTextRendering = true;
this.runActionButton.UseVisualStyleBackColor = true;
this.runActionButton.Click += new System.EventHandler(this.RunActionButtonClick);
//
// uninstallButton
//
this.uninstallButton.Location = new System.Drawing.Point(3, 156);
this.uninstallButton.Name = "uninstallButton";
this.uninstallButton.Size = new System.Drawing.Size(91, 23);
this.uninstallButton.TabIndex = 3;
this.uninstallButton.Text = "Uninstall";
this.uninstallButton.UseCompatibleTextRendering = true;
this.uninstallButton.UseVisualStyleBackColor = true;
//
// ManagerForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(460, 390);
this.Controls.Add(this.splitContainer);
this.Controls.Add(this.bottomPanel);
this.Controls.Add(this.topPanel);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.MinimumSize = new System.Drawing.Size(250, 200);
this.Name = "ManagerForm";
this.Text = "AddIn Manager";
this.bottomPanel.ResumeLayout(false);
this.splitContainer.Panel2.ResumeLayout(false);
this.splitContainer.ResumeLayout(false);
this.actionGroupBox.ResumeLayout(false);
this.actionFlowLayoutPanel.ResumeLayout(false);
this.actionFlowLayoutPanel.PerformLayout();
this.ResumeLayout(false);
}
private System.Windows.Forms.Button installButton;
private System.Windows.Forms.Button uninstallButton;
private System.Windows.Forms.Button runActionButton;
private System.Windows.Forms.TableLayoutPanel dependencyTable;
private System.Windows.Forms.Label actionDescription;
private System.Windows.Forms.FlowLayoutPanel actionFlowLayoutPanel;
private System.Windows.Forms.GroupBox actionGroupBox;
private System.Windows.Forms.Button closeButton;
private System.Windows.Forms.SplitContainer splitContainer;
private System.Windows.Forms.Panel bottomPanel;
private System.Windows.Forms.Panel topPanel;
#endregion
}
}

120
src/AddIns/Misc/AddInManager/Project/Src/ManagerForm.resx

@ -0,0 +1,120 @@ @@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

2
src/AddIns/Misc/RegExpTk/Project/Src/Dialogs/MainWindow.cs

@ -99,10 +99,10 @@ namespace Plugins.RegExpTk { @@ -99,10 +99,10 @@ namespace Plugins.RegExpTk {
ReplaceCheckBox_CheckedChanged((CheckBox)ControlDictionary["ReplaceCheckBox"], null);
this.StartPosition=FormStartPosition.CenterScreen;
this.Width=Screen.PrimaryScreen.WorkingArea.Width / 2;
((TextBox)ControlDictionary["RegularExpressionTextBox"]).TextChanged+=new EventHandler(SetRegEx);
FormLocationHelper.Apply(this, "RegExpTk.WindowBounds", true);
}

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -730,6 +730,7 @@ @@ -730,6 +730,7 @@
<Compile Include="Src\Gui\Pads\TaskList\TaskView.cs" />
<Compile Include="Src\Gui\Pads\TaskList\TaskListPad.cs" />
<Compile Include="Src\Project\MSBuildFile.cs" />
<Compile Include="Src\Gui\FormLocationHelper.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj">

71
src/Main/Base/Project/Src/Gui/FormLocationHelper.cs

@ -0,0 +1,71 @@ @@ -0,0 +1,71 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 26.11.2005
* Time: 15:27
*/
using System;
using System.Drawing;
using System.Windows.Forms;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Gui
{
/// <summary>
/// Description of FormLocationHelper.
/// </summary>
public static class FormLocationHelper
{
public static void Apply(Form form, string propertyName, bool isResizable)
{
form.StartPosition = FormStartPosition.Manual;
if (isResizable) {
form.Bounds = Validate(PropertyService.Get(propertyName, GetDefaultBounds(form)));
} else {
form.Location = Validate(PropertyService.Get(propertyName, GetDefaultLocation(form)), form.Size);
}
form.Closing += delegate {
if (isResizable) {
PropertyService.Set(propertyName, form.Bounds);
} else {
PropertyService.Set(propertyName, form.Location);
}
};
}
static Rectangle Validate(Rectangle bounds)
{
// Check if form is outside the screen and get it back if necessary.
// This is important when the user uses multiple screens, a window stores its location
// on the secondary monitor and then the secondary monitor is removed.
Rectangle screen1 = Screen.FromPoint(new Point(bounds.X, bounds.Y)).WorkingArea;
Rectangle screen2 = Screen.FromPoint(new Point(bounds.X + bounds.Width, bounds.Y)).WorkingArea;
if (bounds.Y < screen1.Y - 5 && bounds.Y < screen2.Y - 5)
bounds.Y = screen1.Y - 5;
if (bounds.X < screen1.X - bounds.Width / 2)
bounds.X = screen1.X - bounds.Width / 2;
else if (bounds.X > screen2.Right - bounds.Width / 2)
bounds.X = screen2.Right - bounds.Width / 2;
return bounds;
}
static Point Validate(Point location, Size size)
{
return Validate(new Rectangle(location, size)).Location;
}
static Rectangle GetDefaultBounds(Form form)
{
return new Rectangle(GetDefaultLocation(form), form.Size);
}
static Point GetDefaultLocation(Form form)
{
Rectangle parent = WorkbenchSingleton.MainForm.Bounds;
Size size = form.Size;
return new Point(parent.Left + (parent.Width - size.Width) / 2,
parent.Top + (parent.Height - size.Height) / 2);
}
}
}

18
src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

@ -59,23 +59,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -59,23 +59,7 @@ namespace ICSharpCode.SharpDevelop.Gui
ListViewSizeChanged(null, null);
Owner = WorkbenchSingleton.MainForm;
Icon = null;
this.StartPosition = FormStartPosition.Manual;
this.Bounds = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.GotoDialog.Bounds", GetDefaultBounds());
}
Rectangle GetDefaultBounds()
{
Rectangle parent = WorkbenchSingleton.MainForm.Bounds;
Size size = this.Size;
return new Rectangle(parent.Left + (parent.Width - size.Width) / 2,
parent.Top + (parent.Height - size.Height) / 2,
size.Width, size.Height);
}
protected override void OnClosing(CancelEventArgs e)
{
base.OnClosing(e);
PropertyService.Set("ICSharpCode.SharpDevelop.Gui.GotoDialog.Bounds", this.Bounds);
FormLocationHelper.Apply(this, "ICSharpCode.SharpDevelop.Gui.GotoDialog.Bounds", true);
}
void ListViewSizeChanged(object sender, EventArgs e)

13
src/Main/Base/Project/Src/TextEditor/SearchAndReplace/Gui/SearchAndReplaceDialog.cs

@ -53,7 +53,6 @@ namespace SearchAndReplace @@ -53,7 +53,6 @@ namespace SearchAndReplace
this.ShowInTaskbar = false;
this.TopMost = false;
this.Text = StringParser.Parse("${res:Dialog.NewProject.SearchReplace.Title}");
this.StartPosition = FormStartPosition.CenterParent;
this.KeyPreview = true;
searchAndReplacePanel = new SearchAndReplacePanel();
@ -79,22 +78,12 @@ namespace SearchAndReplace @@ -79,22 +78,12 @@ namespace SearchAndReplace
Controls.Add(toolStrip);
SetSearchAndReplaceMode();
this.StartPosition = FormStartPosition.Manual;
this.Location = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.SearchAndReplaceDialog.Location", GetDefaultLocation());
}
Point GetDefaultLocation()
{
Rectangle parent = WorkbenchSingleton.MainForm.Bounds;
Size size = this.Size;
return new Point(parent.Left + (parent.Width - size.Width) / 2,
parent.Top + (parent.Height - size.Height) / 2);
FormLocationHelper.Apply(this, "ICSharpCode.SharpDevelop.Gui.SearchAndReplaceDialog.Location", false);
}
protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
base.OnClosing(e);
PropertyService.Set("ICSharpCode.SharpDevelop.Gui.SearchAndReplaceDialog.Location", this.Location);
Instance = null;
}

1
src/Main/Core/Project/ICSharpCode.Core.csproj

@ -140,6 +140,7 @@ @@ -140,6 +140,7 @@
<Compile Include="Src\AddInTree\AddIn\Manifest.cs" />
<Compile Include="Src\AddInTree\AddIn\AddInReference.cs" />
<Compile Include="Src\AddInTree\CoreStartup.cs" />
<Compile Include="Src\AddInTree\AddInManager.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Src\Services\LoggingService" />

19
src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs

@ -22,7 +22,8 @@ namespace ICSharpCode.Core @@ -22,7 +22,8 @@ namespace ICSharpCode.Core
string addInFileName = null;
AddInManifest manifest = new AddInManifest();
Dictionary<string, ExtensionPath> paths = new Dictionary<string, ExtensionPath>();
internal bool enabled = true;
AddInAction action = AddInAction.Enable;
bool enabled = true;
static bool hasShownErrorMessage = false;
@ -43,6 +44,18 @@ namespace ICSharpCode.Core @@ -43,6 +44,18 @@ namespace ICSharpCode.Core
return null;
}
/// <summary>
/// Action to execute when the application is restarted.
/// </summary>
public AddInAction Action {
get {
return action;
}
set {
action = value;
}
}
public List<Runtime> Runtimes {
get {
return runtimes;
@ -89,6 +102,10 @@ namespace ICSharpCode.Core @@ -89,6 +102,10 @@ namespace ICSharpCode.Core
get {
return enabled;
}
set {
enabled = value;
this.Action = value ? AddInAction.Enable : AddInAction.Disable;
}
}
AddIn()

13
src/Main/Core/Project/Src/AddInTree/AddIn/Manifest.cs

@ -20,6 +20,13 @@ namespace ICSharpCode.Core @@ -20,6 +20,13 @@ namespace ICSharpCode.Core
List<AddInReference> conflicts = new List<AddInReference>();
Dictionary<string, Version> identities = new Dictionary<string, Version>();
Version primaryVersion;
string primaryIdentity;
public string PrimaryIdentity {
get {
return primaryIdentity;
}
}
public Version PrimaryVersion {
get {
@ -55,8 +62,12 @@ namespace ICSharpCode.Core @@ -55,8 +62,12 @@ namespace ICSharpCode.Core
}
}
Version v = AddInReference.ParseVersion(version, hintPath);
if (primaryVersion == null)
if (primaryVersion == null) {
primaryVersion = v;
}
if (primaryIdentity == null) {
primaryIdentity = name;
}
identities.Add(name, v);
}

125
src/Main/Core/Project/Src/AddInTree/AddInManager.cs

@ -0,0 +1,125 @@ @@ -0,0 +1,125 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 26.11.2005
* Time: 18:27
*/
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Text;
namespace ICSharpCode.Core
{
public enum AddInAction
{
Enable,
Disable,
Install,
Uninstall,
Update
}
public static class AddInManager
{
static string configurationFileName;
public static string ConfigurationFileName {
get {
return configurationFileName;
}
set {
configurationFileName = value;
}
}
public static void Enable(List<AddIn> addIns)
{
List<string> addInFiles = new List<string>();
List<string> disabled = new List<string>();
LoadAddInConfiguration(addInFiles, disabled);
foreach (AddIn addIn in addIns) {
string identity = addIn.Manifest.PrimaryIdentity;
if (identity == null)
throw new ArgumentException("The AddIn cannot be disabled because it has no identity.");
disabled.Remove(identity);
addIn.Action = AddInAction.Enable;
}
SaveAddInConfiguration(addInFiles, disabled);
}
public static void Disable(List<AddIn> addIns)
{
List<string> addInFiles = new List<string>();
List<string> disabled = new List<string>();
LoadAddInConfiguration(addInFiles, disabled);
foreach (AddIn addIn in addIns) {
string identity = addIn.Manifest.PrimaryIdentity;
if (identity == null)
throw new ArgumentException("The AddIn cannot be disabled because it has no identity.");
if (!disabled.Contains(identity))
disabled.Add(identity);
addIn.Action = AddInAction.Disable;
}
SaveAddInConfiguration(addInFiles, disabled);
}
/// <summary>
/// Loads a configuration file.
/// The 'file' from XML elements in the form "&lt;AddIn file='full path to .addin file'&gt;" will
/// be added to <paramref name="addInFiles"/>, the 'addin' element from
/// "&lt;Disable addin='addin identity'&gt;" will be added to <paramref name="disabledAddIns"/>,
/// all other XML elements are ignored.
/// </summary>
public static void LoadAddInConfiguration(List<string> addInFiles, List<string> disabledAddIns)
{
if (!File.Exists(configurationFileName))
return;
using (XmlTextReader reader = new XmlTextReader(configurationFileName)) {
while (reader.Read()) {
if (reader.NodeType == XmlNodeType.Element) {
if (reader.Name == "AddIn") {
string fileName = reader.GetAttribute("file");
if (fileName != null && fileName.Length > 0) {
addInFiles.Add(fileName);
}
} else if (reader.Name == "Disable") {
string addIn = reader.GetAttribute("addin");
if (addIn != null && addIn.Length > 0) {
disabledAddIns.Add(addIn);
}
}
}
}
}
}
public static void SaveAddInConfiguration(List<string> addInFiles, List<string> disabledAddIns)
{
using (XmlTextWriter writer = new XmlTextWriter(configurationFileName, Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument();
writer.WriteStartElement("AddInConfiguration");
foreach (string file in addInFiles) {
writer.WriteStartElement("AddIn");
writer.WriteAttributeString("file", file);
writer.WriteEndElement();
}
foreach (string name in disabledAddIns) {
writer.WriteStartElement("Disable");
writer.WriteAttributeString("addin", name);
writer.WriteEndElement();
}
writer.WriteEndDocument();
}
}
}
}

4
src/Main/Core/Project/Src/AddInTree/AddInTree.cs

@ -205,7 +205,7 @@ namespace ICSharpCode.Core @@ -205,7 +205,7 @@ namespace ICSharpCode.Core
// used by Load(): disables an addin and removes it from the dictionaries.
static void DisableAddin(AddIn addIn, Dictionary<string, Version> dict, Dictionary<string, AddIn> addInDict)
{
addIn.enabled = false;
addIn.Enabled = false;
foreach (string name in addIn.Manifest.Identities.Keys) {
dict.Remove(name);
addInDict.Remove(name);
@ -222,7 +222,7 @@ namespace ICSharpCode.Core @@ -222,7 +222,7 @@ namespace ICSharpCode.Core
if (disabledAddIns != null && disabledAddIns.Count > 0) {
foreach (string name in addIn.Manifest.Identities.Keys) {
if (disabledAddIns.Contains(name)) {
addIn.enabled = false;
addIn.Enabled = false;
break;
}
}

73
src/Main/Core/Project/Src/AddInTree/CoreStartup.cs

@ -8,8 +8,6 @@ @@ -8,8 +8,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Text;
namespace ICSharpCode.Core
{
@ -24,6 +22,7 @@ namespace ICSharpCode.Core @@ -24,6 +22,7 @@ namespace ICSharpCode.Core
string configDirectory;
string dataDirectory;
string applicationName;
string addInConfigurationFile;
/// <summary>
/// Sets the name used for the properties (only name, without path or extension).
@ -68,6 +67,18 @@ namespace ICSharpCode.Core @@ -68,6 +67,18 @@ namespace ICSharpCode.Core
}
}
/// <summary>
/// Gets/Sets the configuration file used to store the enabled/disabled state of the AddIns.
/// </summary>
public string AddInConfigurationFile {
get {
return addInConfigurationFile;
}
set {
addInConfigurationFile = value;
}
}
public CoreStartup(string applicationName)
{
if (applicationName == null)
@ -82,62 +93,12 @@ namespace ICSharpCode.Core @@ -82,62 +93,12 @@ namespace ICSharpCode.Core
addInFiles.AddRange(FileUtility.SearchDirectory(addInDir, "*.addin"));
}
public void LoadAddInConfiguration(string configurationFile)
{
LoadAddInConfiguration(configurationFile, addInFiles, disabledAddIns);
}
/// <summary>
/// Loads a configuration file.
/// The 'file' from XML elements in the form "&lt;AddIn file='full path to .addin file'&gt;" will
/// be added to <paramref name="addInFiles"/>, the 'addin' element from
/// "&lt;Disable addin='addin identity'&gt;" will be added to <paramref name="disabledAddIns"/>,
/// all other XML elements are ignored.
/// </summary>
public static void LoadAddInConfiguration(string configurationFile, List<string> addInFiles, List<string> disabledAddIns)
{
using (XmlTextReader reader = new XmlTextReader(configurationFile)) {
while (reader.Read()) {
if (reader.NodeType == XmlNodeType.Element) {
if (reader.Name == "AddIn") {
string fileName = reader.GetAttribute("file");
if (fileName != null && fileName.Length > 0) {
addInFiles.Add(fileName);
}
} else if (reader.Name == "Disable") {
string addIn = reader.GetAttribute("addin");
if (addIn != null && addIn.Length > 0) {
disabledAddIns.Add(addIn);
}
}
}
}
}
}
public static void SaveAddInConfiguration(string configurationFile, List<string> addInFiles, List<string> disabledAddIns)
{
using (XmlTextWriter writer = new XmlTextWriter(configurationFile, Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
writer.WriteStartDocument();
writer.WriteStartElement("AddInConfiguration");
foreach (string file in addInFiles) {
writer.WriteStartElement("AddIn");
writer.WriteAttributeString("file", file);
writer.WriteEndElement();
}
foreach (string name in disabledAddIns) {
writer.WriteStartElement("Disable");
writer.WriteAttributeString("addin", name);
writer.WriteEndElement();
}
writer.WriteEndDocument();
}
}
public void RunInitialization()
{
if (addInConfigurationFile != null) {
AddInManager.ConfigurationFileName = addInConfigurationFile;
AddInManager.LoadAddInConfiguration(addInFiles, disabledAddIns);
}
AddInTree.Load(addInFiles, disabledAddIns);
// run workspace autostart commands

5
src/Main/StartUp/Project/SharpDevelopMain.cs

@ -181,10 +181,7 @@ namespace ICSharpCode.SharpDevelop @@ -181,10 +181,7 @@ namespace ICSharpCode.SharpDevelop
if (Directory.Exists(fileName)) {
c.AddAddInsFromDirectory(fileName);
}
fileName = Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml");
if (File.Exists(fileName)) {
c.LoadAddInConfiguration(fileName);
}
c.AddInConfigurationFile = Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml");
LoggingService.Info("Loading AddInTree...");
c.RunInitialization();

2
src/Main/StartUp/Project/StartUp.csproj

@ -71,4 +71,4 @@ @@ -71,4 +71,4 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
</Project>

9
src/SharpDevelop.WithTests.sln

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.745
# SharpDevelop 2.0.0.797
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@ -38,6 +38,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CE5B42B7-6 @@ -38,6 +38,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CE5B42B7-6
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager", "AddIns\Misc\AddInManager\Project\AddInManager.csproj", "{F93E52FD-DA66-4CE5-A0CB-BCD902811122}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HtmlHelp2", "AddIns\Misc\HtmlHelp2\Project\HtmlHelp2.csproj", "{918487B7-2153-4618-BBB3-344DBDDF2A2A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SubversionAddIn", "AddIns\Misc\SubversionAddIn\Project\SubversionAddIn.csproj", "{17F4D7E0-6933-4C2E-8714-FD7E98D625D5}"
@ -270,6 +272,10 @@ Global @@ -270,6 +272,10 @@ Global
{C9DE556D-325C-4544-B29F-16A9EB7C9830}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C9DE556D-325C-4544-B29F-16A9EB7C9830}.Release|Any CPU.Build.0 = Release|Any CPU
{C9DE556D-325C-4544-B29F-16A9EB7C9830}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Any CPU.Build.0 = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -297,6 +303,7 @@ Global @@ -297,6 +303,7 @@ Global
{6604365C-C702-4C10-9BA8-637F1E3D4D0D} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{17F4D7E0-6933-4C2E-8714-FD7E98D625D5} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{918487B7-2153-4618-BBB3-344DBDDF2A2A} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{F93E52FD-DA66-4CE5-A0CB-BCD902811122} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}

9
src/SharpDevelop.sln

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.639
# SharpDevelop 2.0.0.797
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}"
ProjectSection(SolutionItems) = postProject
EndProjectSection
@ -32,6 +32,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CE5B42B7-6 @@ -32,6 +32,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{CE5B42B7-6
ProjectSection(SolutionItems) = postProject
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddInManager", "AddIns\Misc\AddInManager\Project\AddInManager.csproj", "{F93E52FD-DA66-4CE5-A0CB-BCD902811122}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NAntAddIn", "AddIns\Misc\NAntAddIn\Project\NAntAddIn.csproj", "{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MbUnitPad", "AddIns\Misc\MbUnitPad\Project\MbUnitPad.csproj", "{B1CE28A0-04E8-490D-8256-E0C4D52C93C8}"
@ -218,6 +220,10 @@ Global @@ -218,6 +220,10 @@ Global
{DBCF20A1-BA13-4582-BFA9-74DE4D987B73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DBCF20A1-BA13-4582-BFA9-74DE4D987B73}.Release|Any CPU.Build.0 = Release|Any CPU
{DBCF20A1-BA13-4582-BFA9-74DE4D987B73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Any CPU.Build.0 = Release|Any CPU
{F93E52FD-DA66-4CE5-A0CB-BCD902811122}.Release|Any CPU.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -244,6 +250,7 @@ Global @@ -244,6 +250,7 @@ Global
{918487B7-2153-4618-BBB3-344DBDDF2A2A} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{B1CE28A0-04E8-490D-8256-E0C4D52C93C8} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{1DB3CAD2-38E8-4C5E-8E1B-0E37B1A5C006} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{F93E52FD-DA66-4CE5-A0CB-BCD902811122} = {CE5B42B7-6E8C-4385-9E97-F4023FC16BF2}
{B08385CD-F0CC-488C-B4F4-EEB34B6D2688} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{1D18D788-F7EE-4585-A23B-34DC8EC63CB8} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}
{EC06F96A-AEEC-49D6-B03D-AB87C6EB674C} = {6604365C-C702-4C10-9BA8-637F1E3D4D0D}

Loading…
Cancel
Save