Browse Source

Now AddIns are loaded from three locations:

- ApplicationBase\AddIns
- ConfigDirectory\AddIns
- locations defined in ConfigDirectory\AddIns.xml

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@802 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
0642cc120b
  1. 1698
      data/schemas/AddIn.xsd
  2. 2960
      doc/technotes/AddInBuildingGuide.rtf
  3. BIN
      doc/technotes/AddInBuildingGuide.sxw
  4. 2970
      doc/technotes/AddInTree.rtf
  5. BIN
      doc/technotes/AddInTree.sxw
  6. 4
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  7. 4
      src/Main/Base/Project/Src/Project/Items/ProjectItem.cs
  8. 75
      src/Main/Base/Project/Src/Project/MSBuildFile.cs
  9. 12
      src/Main/Core/Project/Src/AddInTree/AddIn/AddInReference.cs
  10. 12
      src/Main/Core/Project/Src/AddInTree/AddIn/Manifest.cs
  11. 7
      src/Main/Core/Project/Src/AddInTree/AddInTree.cs
  12. 70
      src/Main/Core/Project/Src/AddInTree/CoreStartup.cs
  13. 19
      src/Main/StartUp/Project/SharpDevelopMain.cs
  14. 12
      src/Tools/BuildAddinDocumentation/MainClass.cs

1698
data/schemas/AddIn.xsd

File diff suppressed because it is too large Load Diff

2960
doc/technotes/AddInBuildingGuide.rtf

File diff suppressed because it is too large Load Diff

BIN
doc/technotes/AddInBuildingGuide.sxw

Binary file not shown.

2970
doc/technotes/AddInTree.rtf

File diff suppressed because it is too large Load Diff

BIN
doc/technotes/AddInTree.sxw

Binary file not shown.

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

@ -729,7 +729,7 @@ @@ -729,7 +729,7 @@
<Compile Include="Src\TextEditor\Gui\Editor\CompletionWindow\OverrideCompletionDataProvider.cs" />
<Compile Include="Src\Gui\Pads\TaskList\TaskView.cs" />
<Compile Include="Src\Gui\Pads\TaskList\TaskListPad.cs" />
<Compile Include="Src\Internal\Undo\MSBuildFile.cs" />
<Compile Include="Src\Project\MSBuildFile.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Libraries\DockPanel_Src\WinFormsUI\WinFormsUI.csproj">
@ -756,4 +756,4 @@ @@ -756,4 +756,4 @@
</Content>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
</Project>
</Project>

4
src/Main/Base/Project/Src/Project/Items/ProjectItem.cs

@ -140,7 +140,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -140,7 +140,7 @@ namespace ICSharpCode.SharpDevelop.Project
}
internal void WriteItem(MSBuildFileWriter writer)
internal void WriteItem(XmlWriter writer)
{
writer.WriteStartElement(Tag);
writer.WriteAttributeString("Include", Include);
@ -167,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -167,7 +167,7 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
internal static void WriteItemGroup(MSBuildFileWriter writer, List<ProjectItem> items)
internal static void WriteItemGroup(XmlWriter writer, List<ProjectItem> items)
{
writer.WriteStartElement("ItemGroup");
foreach (ProjectItem item in items) {

75
src/Main/Base/Project/Src/Internal/Undo/MSBuildFile.cs → src/Main/Base/Project/Src/Project/MSBuildFile.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
// <file>
// <file>
// <copyright see="prj:///doc/copyright.txt">2002-2005 AlphaSierraPapa</copyright>
// <license see="prj:///doc/license.txt">GNU General Public License</license>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision: 562 $</version>
// <owner name="Scott Ferrett" email="surf@softvelocity.com"/>
// <version>$Revision$</version>
// </file>
using System;
@ -99,71 +99,10 @@ namespace ICSharpCode.SharpDevelop.Project @@ -99,71 +99,10 @@ namespace ICSharpCode.SharpDevelop.Project
return instr;
}
public MSBuildFileWriter(string fileName, Encoding encoding) : base(fileName, encoding) { }
//
// Summary:
// When overridden in a derived class, writes out the attribute with the
// specified local name and value.
//
// Parameters:
// localName:
// The local name of the attribute.
// value:
// The value of the attribute.
//
// Exceptions:
// System.InvalidOperationException
//
// System.ArgumentException
//
public new void WriteAttributeString(string localName, string value)
{
base.WriteAttributeString(localName, Convert(value));
}
//
// Summary:
// When overridden in a derived class, writes an attribute with the specified
// local name, namespace URI, and value.
//
// Parameters:
// localName:
// The local name of the attribute.
// value:
// The value of the attribute.
// ns:
// The namespace URI to associate with the attribute.
//
// Exceptions:
// System.InvalidOperationException
//
// System.ArgumentException
//
public new void WriteAttributeString(string localName, string ns, string value)
{
base.WriteAttributeString(localName, ns, Convert(value));
}
//
// Summary:
// When overridden in a derived class, writes out the attribute with the
// specified prefix, local name, namespace URI, and value.
//
// Parameters:
// localName:
// The local name of the attribute.
// prefix:
// The namespace prefix of the attribute.
// value:
// The value of the attribute.
// ns:
// The namespace URI of the attribute.
//
// Exceptions:
// System.InvalidOperationException
//
// System.ArgumentException
//
public new void WriteAttributeString(string prefix, string localName, string ns, string value)
public override void WriteString(string text)
{
base.WriteAttributeString(prefix, localName, ns, Convert(value));
base.WriteString(Convert(text));
}
}
}
}

12
src/Main/Core/Project/Src/AddInTree/AddIn/AddInReference.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 21.11.2005
* Time: 18:01
*/
// <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;
using System.Collections.Generic;

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

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 21.11.2005
* Time: 17:20
*/
// <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;
using System.Collections.Generic;

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

@ -14,9 +14,9 @@ using System.Collections.Generic; @@ -14,9 +14,9 @@ using System.Collections.Generic;
namespace ICSharpCode.Core
{
/// <summary>
/// Description of AddInTree.
/// Static class containing the AddInTree. Contains methods for accessing tree nodes and building items.
/// </summary>
public sealed class AddInTree
public static class AddInTree
{
static List<AddIn> addIns = new List<AddIn>();
static AddInTreeNode rootNode = new AddInTreeNode();
@ -223,7 +223,8 @@ namespace ICSharpCode.Core @@ -223,7 +223,8 @@ namespace ICSharpCode.Core
if (dict.ContainsKey(pair.Key)) {
MessageService.ShowError("Name '" + pair.Key + "' is used by " +
"'" + addInDict[pair.Key].FileName + "' and '" + fileName + "'");
addIn.enabled = false;
DisableAddin(addIn, dict, addInDict);
break;
} else {
dict.Add(pair.Key, pair.Value);
addInDict.Add(pair.Key, addIn);

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

@ -1,13 +1,15 @@ @@ -1,13 +1,15 @@
/*
* Created by SharpDevelop.
* User: Daniel Grunwald
* Date: 25.11.2005
* Time: 18:56
*/
// <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;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Text;
namespace ICSharpCode.Core
{
@ -17,6 +19,7 @@ namespace ICSharpCode.Core @@ -17,6 +19,7 @@ namespace ICSharpCode.Core
public class CoreStartup
{
List<string> addInFiles = new List<string>();
List<string> disabledAddIns = new List<string>();
string propertiesName;
string configDirectory;
string dataDirectory;
@ -79,9 +82,62 @@ namespace ICSharpCode.Core @@ -79,9 +82,62 @@ 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()
{
LoggingService.Info("Loading AddInTree...");
AddInTree.Load(addInFiles);
// run workspace autostart commands

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

@ -128,11 +128,8 @@ namespace ICSharpCode.SharpDevelop @@ -128,11 +128,8 @@ namespace ICSharpCode.SharpDevelop
SplashScreenForm.SetCommandLineArgs(args);
foreach (string parameter in SplashScreenForm.GetParameterList()) {
switch (parameter.ToUpper()) {
case "NOLOGO":
noLogo = true;
break;
}
if ("nologo".Equals(parameter, StringComparison.OrdinalIgnoreCase))
noLogo = true;
}
if (!noLogo) {
@ -179,7 +176,17 @@ namespace ICSharpCode.SharpDevelop @@ -179,7 +176,17 @@ namespace ICSharpCode.SharpDevelop
StringParser.RegisterStringTagProvider(new SharpDevelopStringTagProvider());
LoggingService.Info("Looking for AddIns...");
c.AddAddInsFromDirectory(FileUtility.Combine(FileUtility.ApplicationRootPath, "AddIns"));
c.AddAddInsFromDirectory(Path.Combine(FileUtility.ApplicationRootPath, "AddIns"));
string fileName = Path.Combine(PropertyService.ConfigDirectory, "AddIns");
if (Directory.Exists(fileName)) {
c.AddAddInsFromDirectory(fileName);
}
fileName = Path.Combine(PropertyService.ConfigDirectory, "AddIns.xml");
if (File.Exists(fileName)) {
c.LoadAddInConfiguration(fileName);
}
LoggingService.Info("Loading AddInTree...");
c.RunInitialization();
LoggingService.Info("Initializing workbench...");

12
src/Tools/BuildAddinDocumentation/MainClass.cs

@ -69,7 +69,13 @@ namespace BuildAddinDocumentation @@ -69,7 +69,13 @@ namespace BuildAddinDocumentation
XmlDocument doc = new XmlDocument();
doc.Load(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd"));
UpdateSchema(doc, doozers, conditions);
doc.Save(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd"));
using (XmlTextWriter writer = new XmlTextWriter(Path.Combine(srcDir, "..\\data\\schemas\\Addin.xsd"), System.Text.Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
writer.IndentChar = '\t';
writer.Indentation = 1;
doc.Save(writer);
}
Debug.WriteLine("Finished");
}
static void RecursiveInsertDoozerList(XmlElement e, List<XmlElement> doozers, List<XmlElement> conditionList)
@ -181,14 +187,14 @@ namespace BuildAddinDocumentation @@ -181,14 +187,14 @@ namespace BuildAddinDocumentation
}
e5 = CreateChild(e4, "annotation");
e6 = CreateChild(e5, "documentation");
e6.InnerXml = XmlToHtml(doozerChild.InnerXml);
e6.InnerXml = XmlToHtml(doozerChild.InnerXml).Replace(" ", "\t");
}
e = CreateChild(doc.DocumentElement, "element");
e.SetAttribute("name", doozer.GetAttribute("shortname"));
e.SetAttribute("type", doozer.GetAttribute("shortname"));
e2 = CreateChild(e, "annotation");
e3 = CreateChild(e2, "documentation");
e3.InnerXml = XmlToHtml(doozer["summary"].InnerXml);
e3.InnerXml = XmlToHtml(doozer["summary"].InnerXml).Replace(" ", "\t");
}
}

Loading…
Cancel
Save