Browse Source

Show new AddIn properties in the AddInScout.

Fixed C# ExpressionFinder bug: identifiers were resolved as type names when they were in front of a keyword like 'in' or 'as'.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@795 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
d5b981e7e0
  1. 4
      src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/ExpressionTests.cs
  2. 20
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/ExpressionFinder.cs
  3. 6
      src/AddIns/BackendBindings/CSharpBinding/Test/ExpressionFinder.cs
  4. 2
      src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin
  5. 1
      src/AddIns/DisplayBindings/FormDesigner/Project/FormDesigner.addin
  6. 27
      src/AddIns/Misc/AddinScout/Project/Src/Gui/AddInDetailsPanel.cs
  7. 3
      src/AddIns/Misc/AddinScout/Project/Src/Gui/AddinTreeView.cs
  8. 2
      src/AddIns/Misc/AddinScout/Project/Src/Gui/CodonListPanel.cs
  9. 2
      src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs
  10. 2
      src/AddIns/Misc/StartPage/Project/Src/ICSharpCodePage.cs
  11. 2
      src/Main/Base/Project/Src/Commands/HelpCommands.cs
  12. 2
      src/Main/Base/Project/Src/Gui/Dialogs/ViewGPLDialog.cs
  13. 2
      src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs
  14. 18
      src/Main/Core/Project/Src/AddInTree/AddInTree.cs
  15. 10
      src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs
  16. 13
      src/Main/Core/Project/Src/Services/MessageService/MessageService.cs
  17. 2
      src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs

4
src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/ExpressionTests.cs

@ -247,10 +247,10 @@ namespace NRefactoryToBooConverter.Tests
TestExpr("delegate (int a, string b) { }", "def (a as System.Int32, b as System.String):\n\tpass"); TestExpr("delegate (int a, string b) { }", "def (a as System.Int32, b as System.String):\n\tpass");
} }
[Test, Ignore("ConditionalExpression does not have a boo syntax")] [Test]
public void Conditional() public void Conditional()
{ {
TestExpr("a ? b : c", "a ? b : c"); TestExpr("a ? b : c", "(b if a else c)");
} }
[Test] [Test]

20
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/ExpressionFinder.cs

@ -220,7 +220,8 @@ namespace CSharpBinding.Parser
StringBuilder b = new StringBuilder(expressionBeforeOffset); StringBuilder b = new StringBuilder(expressionBeforeOffset);
// append characters after expression // append characters after expression
bool wordFollowing = false; bool wordFollowing = false;
for (int i = offset + 1; i < inText.Length; ++i) { int i;
for (i = offset + 1; i < inText.Length; ++i) {
char c = inText[i]; char c = inText[i];
if (Char.IsLetterOrDigit(c) || c == '_') { if (Char.IsLetterOrDigit(c) || c == '_') {
if (Char.IsWhiteSpace(inText, i - 1)) { if (Char.IsWhiteSpace(inText, i - 1)) {
@ -261,8 +262,21 @@ namespace CSharpBinding.Parser
} }
} }
ExpressionResult res = CreateResult(b.ToString(), textWithoutComments, offsetWithoutComments); ExpressionResult res = CreateResult(b.ToString(), textWithoutComments, offsetWithoutComments);
if (res.Context == ExpressionContext.Default && wordFollowing) if (res.Context == ExpressionContext.Default && wordFollowing) {
res.Context = ExpressionContext.Type; b = new StringBuilder();
for (; i < inText.Length; ++i) {
char c = inText[i];
if (char.IsLetterOrDigit(c) || c == '_')
b.Append(c);
else
break;
}
if (b.Length > 0) {
if (ICSharpCode.NRefactory.Parser.CSharp.Keywords.GetToken(b.ToString()) < 0) {
res.Context = ExpressionContext.Type;
}
}
}
return res; return res;
} }

6
src/AddIns/BackendBindings/CSharpBinding/Test/ExpressionFinder.cs

@ -121,5 +121,11 @@ class Main {
{ {
FindFull(program2, "der_score_field", "under_score_field", ExpressionContext.Default); FindFull(program2, "der_score_field", "under_score_field", ExpressionContext.Default);
} }
[Test]
public void IdentifierBeforeKeyword()
{
FindFull(program2, "arName", "varName", ExpressionContext.Default);
}
} }
} }

2
src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin

@ -1,4 +1,4 @@
<AddIn name = "SharpDevelop Bindings" <AddIn name = "VB Binding"
author = "Mike Krueger, Markus Palme" author = "Mike Krueger, Markus Palme"
copyright = "GPL" copyright = "GPL"
url = "http://www.icsharpcode.net" url = "http://www.icsharpcode.net"

1
src/AddIns/DisplayBindings/FormDesigner/Project/FormDesigner.addin

@ -6,6 +6,7 @@
<Manifest> <Manifest>
<Identity name = "ICSharpCode.FormDesigner"/> <Identity name = "ICSharpCode.FormDesigner"/>
<Dependency addin="a"/>
</Manifest> </Manifest>
<Runtime> <Runtime>

27
src/AddIns/Misc/AddinScout/Project/Src/Gui/AddInDetailsPanel.cs

@ -7,6 +7,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
@ -55,7 +56,7 @@ namespace AddInScout
try { try {
System.Diagnostics.Process.Start(url); System.Diagnostics.Process.Start(url);
} catch (Exception) { } catch (Exception) {
// Silent: On my System the browser starts but Process.Start throws an exception. Mike 2.11.2004/Notebook/ICE 1517 on the way to DevCon Europe 2004 // Silent: On my System the browser starts but Process.Start throws an exception. Mike 2.11.2004/Notebook/ICE 1517 on the way to DevCon Europe 2004
// MessageBox.Show("Unable to Start Browser\n" + ex.ToString()); // MessageBox.Show("Unable to Start Browser\n" + ex.ToString());
} }
} else if (selectedItem.Text.ToLower().Equals("filename")) { } else if (selectedItem.Text.ToLower().Equals("filename")) {
@ -77,8 +78,7 @@ namespace AddInScout
new ListViewItem(new string[] { "Copyright", ai.Properties["copyright"]}), new ListViewItem(new string[] { "Copyright", ai.Properties["copyright"]}),
new ListViewItem(new string[] { "Description", ai.Properties["description"] }), new ListViewItem(new string[] { "Description", ai.Properties["description"] }),
new ListViewItem(new string[] { "FileName", ai.FileName}), new ListViewItem(new string[] { "FileName", ai.FileName}),
new ListViewItem(new string[] { "Url", ai.Properties["url"]}), new ListViewItem(new string[] { "Url", ai.Properties["url"]})
new ListViewItem(new string[] { "Version", ai.Properties["version"]})
}; };
// set Filename & Url rows to 'weblink' style // set Filename & Url rows to 'weblink' style
@ -86,6 +86,27 @@ namespace AddInScout
items[3].ForeColor = items[4].ForeColor = Color.Blue; items[3].ForeColor = items[4].ForeColor = Color.Blue;
addInDetailsListView.Items.AddRange(items); addInDetailsListView.Items.AddRange(items);
if (ai.Version != null)
addInDetailsListView.Items.Add(new ListViewItem(new string[] { "Version", ai.Version.ToString()}));
foreach (KeyValuePair<string, Version> entry in ai.Manifest.Identities) {
ListViewItem newListViewItem = new ListViewItem("Identity");
newListViewItem.SubItems.Add(entry.Key + " = " + entry.Value);
addInDetailsListView.Items.Add(newListViewItem);
}
foreach (AddInReference entry in ai.Manifest.Conflicts) {
ListViewItem newListViewItem = new ListViewItem("Conflict");
newListViewItem.SubItems.Add(entry.ToString());
addInDetailsListView.Items.Add(newListViewItem);
}
foreach (AddInReference entry in ai.Manifest.Dependencies) {
ListViewItem newListViewItem = new ListViewItem("Dependency");
newListViewItem.SubItems.Add(entry.ToString());
addInDetailsListView.Items.Add(newListViewItem);
}
foreach (Runtime runtime in ai.Runtimes) { foreach (Runtime runtime in ai.Runtimes) {
ListViewItem newListViewItem = new ListViewItem("Runtime Library"); ListViewItem newListViewItem = new ListViewItem("Runtime Library");
newListViewItem.SubItems.Add(runtime.Assembly); newListViewItem.SubItems.Add(runtime.Assembly);

3
src/AddIns/Misc/AddinScout/Project/Src/Gui/AddinTreeView.cs

@ -58,6 +58,8 @@ namespace AddInScout
void GetExtensions(AddIn ai, TreeNode treeNode) void GetExtensions(AddIn ai, TreeNode treeNode)
{ {
if (!ai.Enabled)
return;
foreach (ExtensionPath ext in ai.Paths.Values) { foreach (ExtensionPath ext in ai.Paths.Values) {
TreeNode newNode = new TreeNode(ext.Name); TreeNode newNode = new TreeNode(ext.Name);
newNode.ImageIndex = 3; newNode.ImageIndex = 3;
@ -66,6 +68,5 @@ namespace AddInScout
treeNode.Nodes.Add(newNode); treeNode.Nodes.Add(newNode);
} }
} }
} }
} }

2
src/AddIns/Misc/AddinScout/Project/Src/Gui/CodonListPanel.cs

@ -85,7 +85,7 @@ namespace AddInScout
ExtLabel.Text = "Extension : " + path; ExtLabel.Text = "Extension : " + path;
AddInTreeNode node = AddInTree.GetTreeNode(path); AddInTreeNode node = AddInTree.GetTreeNode(path, false);
foreach (Codon c in node.Codons) { foreach (Codon c in node.Codons) {
ListViewItem lvi = new ListViewItem(c.Name); ListViewItem lvi = new ListViewItem(c.Name);
lvi.Tag = c; lvi.Tag = c;

2
src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs

@ -104,7 +104,7 @@ namespace HtmlHelp2.OptionsPanel
try try
{ {
ProcessStartInfo info = new ProcessStartInfo("cmd", "/c call echo Unregistering... & unregister.bat & echo. & echo Registering... & call register.bat & pause"); ProcessStartInfo info = new ProcessStartInfo("cmd", "/c call echo Unregistering... & unregister.bat & echo. & echo Registering... & call register.bat & pause");
info.WorkingDirectory = Path.Combine(FileUtility.SharpDevelopRootPath, "bin\\setup\\help"); info.WorkingDirectory = Path.Combine(FileUtility.ApplicationRootPath, "bin\\setup\\help");
Process p = Process.Start(info); Process p = Process.Start(info);
p.WaitForExit(45000); p.WaitForExit(45000);
WorkbenchSingleton.SafeThreadAsyncCall(typeof(HtmlHelp2Environment), "ReloadNamespace"); WorkbenchSingleton.SafeThreadAsyncCall(typeof(HtmlHelp2Environment), "ReloadNamespace");

2
src/AddIns/Misc/StartPage/Project/Src/ICSharpCodePage.cs

@ -598,7 +598,7 @@ namespace ICSharpCode.StartPage
StringWriter writer = new StringWriter(); StringWriter writer = new StringWriter();
XmlTextWriter xmlWriter = new XmlTextWriter(writer); XmlTextWriter xmlWriter = new XmlTextWriter(writer);
xmlWriter.Formatting = Formatting.None; xmlWriter.Formatting = Formatting.None;
transform.Transform(Path.Combine(FileUtility.SharpDevelopRootPath, "doc/ChangeLog.xml"), xmlWriter); transform.Transform(Path.Combine(FileUtility.ApplicationRootPath, "doc/ChangeLog.xml"), xmlWriter);
changeLogHtml = writer.ToString().Replace("\n", "\n<br>"); changeLogHtml = writer.ToString().Replace("\n", "\n<br>");
} }
builder.Append(changeLogHtml); builder.Append(changeLogHtml);

2
src/Main/Base/Project/Src/Commands/HelpCommands.cs

@ -58,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Commands
public override void Run() public override void Run()
{ {
if (site.StartsWith("home://")) { if (site.StartsWith("home://")) {
string file = FileUtility.Combine(FileUtility.SharpDevelopRootPath, "bin", site.Substring(7).Replace('/', Path.DirectorySeparatorChar)); string file = FileUtility.Combine(FileUtility.ApplicationRootPath, "bin", site.Substring(7).Replace('/', Path.DirectorySeparatorChar));
try { try {
Process.Start(file); Process.Start(file);
} catch (Exception) { } catch (Exception) {

2
src/Main/Base/Project/Src/Gui/Dialogs/ViewGPLDialog.cs

@ -27,7 +27,7 @@ namespace ICSharpCode.SharpDevelop.Gui
void LoadGPL() void LoadGPL()
{ {
string filename = FileUtility.SharpDevelopRootPath + string filename = FileUtility.ApplicationRootPath +
Path.DirectorySeparatorChar + "doc" + Path.DirectorySeparatorChar + "doc" +
Path.DirectorySeparatorChar + "license.txt"; Path.DirectorySeparatorChar + "license.txt";
if (FileUtility.TestFileExists(filename)) { if (FileUtility.TestFileExists(filename)) {

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

@ -172,8 +172,6 @@ namespace ICSharpCode.Core
switch (reader.LocalName) { switch (reader.LocalName) {
case "AddIn": case "AddIn":
addIn.properties = Properties.ReadFromAttributes(reader); addIn.properties = Properties.ReadFromAttributes(reader);
if (!addIn.properties.Contains("name"))
throw new ApplicationException("<AddIn>-node must specify the name attribute.");
SetupAddIn(reader, addIn, hintPath); SetupAddIn(reader, addIn, hintPath);
break; break;
default: default:

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

@ -28,7 +28,7 @@ namespace ICSharpCode.Core
static AddInTree() static AddInTree()
{ {
defaultCoreDirectory = FileUtility.Combine(FileUtility.SharpDevelopRootPath, "AddIns"); defaultCoreDirectory = FileUtility.Combine(FileUtility.ApplicationRootPath, "AddIns");
doozers.Add("Class", new ClassDoozer()); doozers.Add("Class", new ClassDoozer());
doozers.Add("FileFilter", new FileFilterDoozer()); doozers.Add("FileFilter", new FileFilterDoozer());
@ -162,8 +162,10 @@ namespace ICSharpCode.Core
static void InsertAddIn(AddIn addIn) static void InsertAddIn(AddIn addIn)
{ {
foreach (ExtensionPath path in addIn.Paths.Values) { if (addIn.Enabled) {
AddExtensionPath(path); foreach (ExtensionPath path in addIn.Paths.Values) {
AddExtensionPath(path);
}
} }
addIns.Add(addIn); addIns.Add(addIn);
} }
@ -216,7 +218,11 @@ namespace ICSharpCode.Core
public static void Load() public static void Load()
{ {
List<string> addInFiles = FileUtility.SearchDirectory(defaultCoreDirectory, "*.addin"); Load(FileUtility.SearchDirectory(defaultCoreDirectory, "*.addin"));
}
public static void Load(List<string> addInFiles)
{
List<AddIn> list = new List<AddIn>(); List<AddIn> list = new List<AddIn>();
Dictionary<string, Version> dict = new Dictionary<string, Version>(); Dictionary<string, Version> dict = new Dictionary<string, Version>();
Dictionary<string, AddIn> addInDict = new Dictionary<string, AddIn>(); Dictionary<string, AddIn> addInDict = new Dictionary<string, AddIn>();
@ -265,9 +271,7 @@ namespace ICSharpCode.Core
} }
} }
foreach (AddIn addIn in list) { foreach (AddIn addIn in list) {
if (addIn.Enabled) { InsertAddIn(addIn);
InsertAddIn(addIn);
}
} }
} }
} }

10
src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs

@ -45,12 +45,12 @@ namespace ICSharpCode.Core
// Call it only when necessary. (see IsEqualFile) // Call it only when necessary. (see IsEqualFile)
readonly static char[] separators = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar, Path.VolumeSeparatorChar }; readonly static char[] separators = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar, Path.VolumeSeparatorChar };
static string sharpDevelopRootPath; static string applicationRootPath;
const string fileNameRegEx = @"^([a-zA-Z]:)?[^:]+$"; const string fileNameRegEx = @"^([a-zA-Z]:)?[^:]+$";
public static string SharpDevelopRootPath { public static string ApplicationRootPath {
get { get {
return sharpDevelopRootPath; return applicationRootPath;
} }
} }
@ -59,9 +59,9 @@ namespace ICSharpCode.Core
Assembly entryAssembly = Assembly.GetEntryAssembly(); Assembly entryAssembly = Assembly.GetEntryAssembly();
// entryAssembly == null might happen in unit test mode // entryAssembly == null might happen in unit test mode
if (entryAssembly != null) { if (entryAssembly != null) {
sharpDevelopRootPath = Path.Combine(Path.GetDirectoryName(entryAssembly.Location), ".."); applicationRootPath = Path.Combine(Path.GetDirectoryName(entryAssembly.Location), "..");
} else { } else {
sharpDevelopRootPath = Environment.CurrentDirectory; applicationRootPath = Environment.CurrentDirectory;
} }
} }

13
src/Main/Core/Project/Src/Services/MessageService/MessageService.cs

@ -149,9 +149,20 @@ namespace ICSharpCode.Core
} }
} }
static string defaultMessageBoxTitle = "SharpDevelop";
public static string DefaultMessageBoxTitle {
get {
return defaultMessageBoxTitle;
}
set {
defaultMessageBoxTitle = value;
}
}
public static void ShowMessage(string message) public static void ShowMessage(string message)
{ {
ShowMessage(message, "SharpDevelop"); ShowMessage(message, DefaultMessageBoxTitle);
} }
public static void ShowMessageFormatted(string formatstring, params string[] formatitems) public static void ShowMessageFormatted(string formatstring, params string[] formatitems)

2
src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs

@ -19,7 +19,7 @@ namespace ICSharpCode.Core
const string propertyXmlRootNodeName = "SharpDevelopProperties"; const string propertyXmlRootNodeName = "SharpDevelopProperties";
static string configDirectory = FileUtility.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".ICSharpCode", "SharpDevelop2") + Path.DirectorySeparatorChar; static string configDirectory = FileUtility.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ".ICSharpCode", "SharpDevelop2") + Path.DirectorySeparatorChar;
static string dataDirectory = FileUtility.Combine(FileUtility.SharpDevelopRootPath, "data"); static string dataDirectory = FileUtility.Combine(FileUtility.ApplicationRootPath, "data");
static Properties properties = new Properties(); static Properties properties = new Properties();

Loading…
Cancel
Save