diff --git a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/ExpressionTests.cs b/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/ExpressionTests.cs index ceb23c8071..84f1d2ae76 100644 --- a/src/AddIns/BackendBindings/Boo/NRefactoryToBooConverter/Test/ExpressionTests.cs +++ b/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"); } - [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] diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/ExpressionFinder.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/ExpressionFinder.cs index d2c13f871c..3667fe0fc3 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/ExpressionFinder.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/ExpressionFinder.cs @@ -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 } } 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; } diff --git a/src/AddIns/BackendBindings/CSharpBinding/Test/ExpressionFinder.cs b/src/AddIns/BackendBindings/CSharpBinding/Test/ExpressionFinder.cs index 90f687bc19..bd13102e45 100644 --- a/src/AddIns/BackendBindings/CSharpBinding/Test/ExpressionFinder.cs +++ b/src/AddIns/BackendBindings/CSharpBinding/Test/ExpressionFinder.cs @@ -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); + } } } diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin b/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin index b311020429..851261b4ad 100644 --- a/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin +++ b/src/AddIns/BackendBindings/VBNetBinding/Project/VBNetBinding.addin @@ -1,4 +1,4 @@ - + diff --git a/src/AddIns/Misc/AddinScout/Project/Src/Gui/AddInDetailsPanel.cs b/src/AddIns/Misc/AddinScout/Project/Src/Gui/AddInDetailsPanel.cs index efe441ef61..87df94713a 100644 --- a/src/AddIns/Misc/AddinScout/Project/Src/Gui/AddInDetailsPanel.cs +++ b/src/AddIns/Misc/AddinScout/Project/Src/Gui/AddInDetailsPanel.cs @@ -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 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 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 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 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); diff --git a/src/AddIns/Misc/AddinScout/Project/Src/Gui/AddinTreeView.cs b/src/AddIns/Misc/AddinScout/Project/Src/Gui/AddinTreeView.cs index 54155c13ef..70dbd88f1c 100644 --- a/src/AddIns/Misc/AddinScout/Project/Src/Gui/AddinTreeView.cs +++ b/src/AddIns/Misc/AddinScout/Project/Src/Gui/AddinTreeView.cs @@ -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 treeNode.Nodes.Add(newNode); } } - } } diff --git a/src/AddIns/Misc/AddinScout/Project/Src/Gui/CodonListPanel.cs b/src/AddIns/Misc/AddinScout/Project/Src/Gui/CodonListPanel.cs index 93675ef0d8..e130a3f525 100644 --- a/src/AddIns/Misc/AddinScout/Project/Src/Gui/CodonListPanel.cs +++ b/src/AddIns/Misc/AddinScout/Project/Src/Gui/CodonListPanel.cs @@ -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; diff --git a/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs b/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs index 3ba3dd59fd..3ca6380f9a 100644 --- a/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs +++ b/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs @@ -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"); diff --git a/src/AddIns/Misc/StartPage/Project/Src/ICSharpCodePage.cs b/src/AddIns/Misc/StartPage/Project/Src/ICSharpCodePage.cs index de29430866..977de8cf44 100644 --- a/src/AddIns/Misc/StartPage/Project/Src/ICSharpCodePage.cs +++ b/src/AddIns/Misc/StartPage/Project/Src/ICSharpCodePage.cs @@ -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
"); } builder.Append(changeLogHtml); diff --git a/src/Main/Base/Project/Src/Commands/HelpCommands.cs b/src/Main/Base/Project/Src/Commands/HelpCommands.cs index 2531cdf376..8792e5be9f 100644 --- a/src/Main/Base/Project/Src/Commands/HelpCommands.cs +++ b/src/Main/Base/Project/Src/Commands/HelpCommands.cs @@ -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) { diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/ViewGPLDialog.cs b/src/Main/Base/Project/Src/Gui/Dialogs/ViewGPLDialog.cs index 3bb813a40c..40369ada31 100644 --- a/src/Main/Base/Project/Src/Gui/Dialogs/ViewGPLDialog.cs +++ b/src/Main/Base/Project/Src/Gui/Dialogs/ViewGPLDialog.cs @@ -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)) { diff --git a/src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs b/src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs index 7ea5a6dde0..e0a02e0779 100644 --- a/src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs +++ b/src/Main/Core/Project/Src/AddInTree/AddIn/AddIn.cs @@ -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("-node must specify the name attribute."); SetupAddIn(reader, addIn, hintPath); break; default: diff --git a/src/Main/Core/Project/Src/AddInTree/AddInTree.cs b/src/Main/Core/Project/Src/AddInTree/AddInTree.cs index c5ae6750b2..03d99a90db 100644 --- a/src/Main/Core/Project/Src/AddInTree/AddInTree.cs +++ b/src/Main/Core/Project/Src/AddInTree/AddInTree.cs @@ -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 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 public static void Load() { - List addInFiles = FileUtility.SearchDirectory(defaultCoreDirectory, "*.addin"); + Load(FileUtility.SearchDirectory(defaultCoreDirectory, "*.addin")); + } + + public static void Load(List addInFiles) + { List list = new List(); Dictionary dict = new Dictionary(); Dictionary addInDict = new Dictionary(); @@ -265,9 +271,7 @@ namespace ICSharpCode.Core } } foreach (AddIn addIn in list) { - if (addIn.Enabled) { - InsertAddIn(addIn); - } + InsertAddIn(addIn); } } } diff --git a/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs b/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs index 65e97e9055..0704ca6f1e 100644 --- a/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs +++ b/src/Main/Core/Project/Src/Services/FileUtility/FileUtility.cs @@ -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 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; } } diff --git a/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs b/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs index 3ef113f2dc..1a3d5231ec 100644 --- a/src/Main/Core/Project/Src/Services/MessageService/MessageService.cs +++ b/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) { - ShowMessage(message, "SharpDevelop"); + ShowMessage(message, DefaultMessageBoxTitle); } public static void ShowMessageFormatted(string formatstring, params string[] formatitems) diff --git a/src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs b/src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs index 5121712800..ec51c5257a 100644 --- a/src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs +++ b/src/Main/Core/Project/Src/Services/PropertyService/PropertyService.cs @@ -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();