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 @@ -247,10 +247,10 @@ namespace NRefactoryToBooConverter.Tests
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()
{
TestExpr("a ? b : c", "a ? b : c");
TestExpr("a ? b : c", "(b if a else c)");
}
[Test]

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

@ -220,7 +220,8 @@ namespace CSharpBinding.Parser @@ -220,7 +220,8 @@ namespace CSharpBinding.Parser
StringBuilder b = new StringBuilder(expressionBeforeOffset);
// append characters after expression
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];
if (Char.IsLetterOrDigit(c) || c == '_') {
if (Char.IsWhiteSpace(inText, i - 1)) {
@ -261,8 +262,21 @@ namespace CSharpBinding.Parser @@ -261,8 +262,21 @@ namespace CSharpBinding.Parser
}
}
ExpressionResult res = CreateResult(b.ToString(), textWithoutComments, offsetWithoutComments);
if (res.Context == ExpressionContext.Default && wordFollowing)
res.Context = ExpressionContext.Type;
if (res.Context == ExpressionContext.Default && wordFollowing) {
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;
}

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

@ -121,5 +121,11 @@ class Main { @@ -121,5 +121,11 @@ class Main {
{
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 @@ @@ -1,4 +1,4 @@
<AddIn name = "SharpDevelop Bindings"
<AddIn name = "VB Binding"
author = "Mike Krueger, Markus Palme"
copyright = "GPL"
url = "http://www.icsharpcode.net"

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

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

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

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
@ -55,7 +56,7 @@ namespace AddInScout @@ -55,7 +56,7 @@ namespace AddInScout
try {
System.Diagnostics.Process.Start(url);
} 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());
}
} else if (selectedItem.Text.ToLower().Equals("filename")) {
@ -77,8 +78,7 @@ namespace AddInScout @@ -77,8 +78,7 @@ namespace AddInScout
new ListViewItem(new string[] { "Copyright", ai.Properties["copyright"]}),
new ListViewItem(new string[] { "Description", ai.Properties["description"] }),
new ListViewItem(new string[] { "FileName", ai.FileName}),
new ListViewItem(new string[] { "Url", ai.Properties["url"]}),
new ListViewItem(new string[] { "Version", ai.Properties["version"]})
new ListViewItem(new string[] { "Url", ai.Properties["url"]})
};
// set Filename & Url rows to 'weblink' style
@ -86,6 +86,27 @@ namespace AddInScout @@ -86,6 +86,27 @@ namespace AddInScout
items[3].ForeColor = items[4].ForeColor = Color.Blue;
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) {
ListViewItem newListViewItem = new ListViewItem("Runtime Library");
newListViewItem.SubItems.Add(runtime.Assembly);

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

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

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

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

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

@ -104,7 +104,7 @@ namespace HtmlHelp2.OptionsPanel @@ -104,7 +104,7 @@ namespace HtmlHelp2.OptionsPanel
try
{
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);
p.WaitForExit(45000);
WorkbenchSingleton.SafeThreadAsyncCall(typeof(HtmlHelp2Environment), "ReloadNamespace");

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

@ -598,7 +598,7 @@ namespace ICSharpCode.StartPage @@ -598,7 +598,7 @@ namespace ICSharpCode.StartPage
StringWriter writer = new StringWriter();
XmlTextWriter xmlWriter = new XmlTextWriter(writer);
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>");
}
builder.Append(changeLogHtml);

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

@ -58,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Commands @@ -58,7 +58,7 @@ namespace ICSharpCode.SharpDevelop.Commands
public override void Run()
{
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 {
Process.Start(file);
} catch (Exception) {

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

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

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

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

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

@ -28,7 +28,7 @@ namespace ICSharpCode.Core @@ -28,7 +28,7 @@ namespace ICSharpCode.Core
static AddInTree()
{
defaultCoreDirectory = FileUtility.Combine(FileUtility.SharpDevelopRootPath, "AddIns");
defaultCoreDirectory = FileUtility.Combine(FileUtility.ApplicationRootPath, "AddIns");
doozers.Add("Class", new ClassDoozer());
doozers.Add("FileFilter", new FileFilterDoozer());
@ -162,8 +162,10 @@ namespace ICSharpCode.Core @@ -162,8 +162,10 @@ namespace ICSharpCode.Core
static void InsertAddIn(AddIn addIn)
{
foreach (ExtensionPath path in addIn.Paths.Values) {
AddExtensionPath(path);
if (addIn.Enabled) {
foreach (ExtensionPath path in addIn.Paths.Values) {
AddExtensionPath(path);
}
}
addIns.Add(addIn);
}
@ -216,7 +218,11 @@ namespace ICSharpCode.Core @@ -216,7 +218,11 @@ namespace ICSharpCode.Core
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>();
Dictionary<string, Version> dict = new Dictionary<string, Version>();
Dictionary<string, AddIn> addInDict = new Dictionary<string, AddIn>();
@ -265,9 +271,7 @@ namespace ICSharpCode.Core @@ -265,9 +271,7 @@ namespace ICSharpCode.Core
}
}
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 @@ -45,12 +45,12 @@ namespace ICSharpCode.Core
// Call it only when necessary. (see IsEqualFile)
readonly static char[] separators = { Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar, Path.VolumeSeparatorChar };
static string sharpDevelopRootPath;
static string applicationRootPath;
const string fileNameRegEx = @"^([a-zA-Z]:)?[^:]+$";
public static string SharpDevelopRootPath {
public static string ApplicationRootPath {
get {
return sharpDevelopRootPath;
return applicationRootPath;
}
}
@ -59,9 +59,9 @@ namespace ICSharpCode.Core @@ -59,9 +59,9 @@ namespace ICSharpCode.Core
Assembly entryAssembly = Assembly.GetEntryAssembly();
// entryAssembly == null might happen in unit test mode
if (entryAssembly != null) {
sharpDevelopRootPath = Path.Combine(Path.GetDirectoryName(entryAssembly.Location), "..");
applicationRootPath = Path.Combine(Path.GetDirectoryName(entryAssembly.Location), "..");
} else {
sharpDevelopRootPath = Environment.CurrentDirectory;
applicationRootPath = Environment.CurrentDirectory;
}
}

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

@ -149,9 +149,20 @@ namespace ICSharpCode.Core @@ -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)
{
ShowMessage(message, "SharpDevelop");
ShowMessage(message, DefaultMessageBoxTitle);
}
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 @@ -19,7 +19,7 @@ namespace ICSharpCode.Core
const string propertyXmlRootNodeName = "SharpDevelopProperties";
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();

Loading…
Cancel
Save