Browse Source

Add documentation for conditions, rename CombineOpen to SolutionOpen.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@591 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
e2abd3442e
  1. 12
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 290
      doc/technotes/ConditionList.html
  3. 13
      doc/technotes/listing.css
  4. 6
      src/AddIns/Misc/MbUnitPad/Project/MbUnitPad.addin
  5. 9
      src/Main/Base/Project/Src/Gui/BrowserDisplayBinding/BrowserLocationConditionEvaluator.cs
  6. 13
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/ActiveContentExtensionEvaluator.cs
  7. 17
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/ActiveViewContentUntitledEvaluator.cs
  8. 3
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/ActiveWindowStateEvaluator.cs
  9. 12
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/CombineOpenEvaluator.cs
  10. 14
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/DebuggerSupportsEvaluator.cs
  11. 22
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/IsProcessRunningEvaluator.cs
  12. 2
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/OpenWindowStateEvaluator.cs
  13. 15
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/ProjectActiveEvaluator.cs
  14. 3
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/ProjectOpenEvaluator.cs
  15. 14
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/WindowActiveEvaluator.cs
  16. 15
      src/Main/Base/Project/Src/Internal/ConditionEvaluators/WindowOpenEvaluator.cs
  17. 11
      src/Main/Base/Project/Src/TextEditor/Conditions/TextContentCondition.cs
  18. 15
      src/Main/Core/Project/Src/AddInTree/AddIn/DefaultConditionEvaluators/CompareConditionEvaluator.cs
  19. 3
      src/Main/StartUp/Project/SharpDevelopMain.cs
  20. 18
      src/Tools/BuildAddinDocumentation/MainClass.cs

12
AddIns/ICSharpCode.SharpDevelop.addin

@ -122,7 +122,7 @@ @@ -122,7 +122,7 @@
<!-- Project browser Paths -->
<Path name = "/SharpDevelop/Pads/ProjectBrowser/ToolBar/Standard">
<Condition name = "CombineOpen" iscombineopen="True" action="Disable">
<Condition name = "SolutionOpen" action="Disable">
<ToolbarItem id = "Properties"
icon = "Icons.16x16.PropertiesIcon"
tooltip = "${res:MainWindow.Windows.PropertiesScoutLabel}"
@ -699,7 +699,7 @@ @@ -699,7 +699,7 @@
</Or>
<Condition name = "ActiveViewContentUntitled" activewindowuntitled="False"/>
</And>
<Condition name = "CombineOpen" iscombineopen="True"/>
<Condition name = "SolutionOpen"/>
</Or>
<ToolbarItem id = "Compile"
icon = "Icons.16x16.BuildCombine"
@ -980,7 +980,7 @@ @@ -980,7 +980,7 @@
shortcut = "Control|F4"
class ="ICSharpCode.SharpDevelop.Commands.CloseFile"/>
</Condition>
<Condition name = "CombineOpen" iscombineopen="True" action="Disable">
<Condition name = "SolutionOpen" action="Disable">
<MenuItem id = "CloseCombine"
label = "${res:XML.MainMenu.FileMenu.Close.Project}"
shortcut = "Control|Shift|F4"
@ -1110,7 +1110,7 @@ @@ -1110,7 +1110,7 @@
<ComplexCondition action="Disable">
<Or>
<Condition name = "WindowActive" activewindow="*"/>
<Condition name = "CombineOpen" iscombineopen="True"/>
<Condition name = "SolutionOpen"/>
</Or>
<MenuItem id = "WordCount"
label = "${res:XML.MainMenu.EditMenu.WordCount}"
@ -1164,7 +1164,7 @@ @@ -1164,7 +1164,7 @@
</Or>
<Condition name = "ActiveViewContentUntitled" activewindowuntitled="False"/>
</And>
<Condition name = "CombineOpen" iscombineopen="True"/>
<Condition name = "SolutionOpen"/>
</Or>
<MenuItem id = "Build"
label = "${res:XML.MainMenu.BuildMenu.BuildSolution}"
@ -1209,7 +1209,7 @@ @@ -1209,7 +1209,7 @@
</Or>
<Condition name = "ActiveViewContentUntitled" activewindowuntitled="False"/>
</And>
<Condition name = "CombineOpen" iscombineopen="True"/>
<Condition name = "SolutionOpen"/>
</Or>
<Condition name="DebuggerSupports" debuggersupports = "Start">

290
doc/technotes/ConditionList.html

@ -5,13 +5,81 @@ @@ -5,13 +5,81 @@
</head><body>
<h1>Condition List</h1>
<p class="notice">This file was generated by the tool 'BuildAddinDocumentation'.
It is based on SharpDevelop 2.0.0.589.</p>
It is based on SharpDevelop 2.0.0.590.</p>
<ul>
<li><a href="#ActiveContentExtension">ActiveContentExtension</a>
<li><a href="#ActiveViewContentUntitled">ActiveViewContentUntitled</a>
<li><a href="#ActiveWindowState">ActiveWindowState</a>
<li><a href="#BrowserLocation">BrowserLocation</a>
<li><a href="#Compare">Compare</a>
<li><a href="#DebuggerSupports">DebuggerSupports</a>
<li><a href="#IsProcessRunning">IsProcessRunning</a>
<li><a href="#OpenWindowState">OpenWindowState</a>
<li><a href="#OwnerState">OwnerState</a>
<li><a href="#ProjectActive">ProjectActive</a>
<li><a href="#SolutionOpen">SolutionOpen</a>
<li><a href="#TextContent">TextContent</a>
<li><a href="#WindowActive">WindowActive</a>
<li><a href="#WindowOpen">WindowOpen</a>
</ul>
<div>
<h2><a name="ActiveContentExtension">ActiveContentExtension</a></h2>
<p>
Tests the file extension of the file edited in the active window content.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.ActiveContentExtensionConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>activeextension:</td>
<td>
The file extension the file should have.
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if a C# file is being edited</span>
<br><pre>
&lt;Condition name = "ActiveContentExtension" activeextension=".cs"&gt;</pre></p>
</div>
<div>
<h2><a name="ActiveViewContentUntitled">ActiveViewContentUntitled</a></h2>
<p>
Tests if the active view content is untitled.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.ActiveViewContentUntitledConditionEvaluator</td>
</tr>
<tr>
<th>Attributes:</td>
<td>Boolean value to test against.</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if the active view content is untitled</span>
<br><pre>
&lt;Condition name = "ActiveViewContentUntitled" activewindowuntitled="True"&gt;
- or -
&lt;Condition name = "ActiveViewContentUntitled"&gt;</pre></p>
<p><span class="exampleTitle">Example: Test if the active view content has a title</span>
<br><pre>
&lt;Condition name = "ActiveViewContentUntitled" activewindowuntitled="False"&gt;</pre></p>
</div>
<div>
<h2><a name="ActiveWindowState">ActiveWindowState</a></h2>
<p>
Tests the window state of the active workbench window.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.ActiveWindowStateConditionEvaluator</td>
</tr>
</table>
</div>
<div>
<h2><a name="BrowserLocation">BrowserLocation</a></h2>
<p>
@ -23,12 +91,31 @@ It is based on SharpDevelop 2.0.0.589.</p> @@ -23,12 +91,31 @@ It is based on SharpDevelop 2.0.0.589.</p>
<td>ICSharpCode.SharpDevelop.BrowserDisplayBinding.BrowserLocationConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>urlRegex:</td>
<td>
The regular expression that must match the URL.
</td>
</tr>
<tr>
<th>options:</td>
<td>
Optional; options that are passed as <see cref="T:System.Text.RegularExpressions.RegexOptions" />.
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if the browser is showing a HtmlHelp page</span>
<br><pre>
&lt;Condition name = "BrowserLocation" urlRegex = "^ms-help:\/\/"&gt;</pre></p>
</div>
<div>
<h2><a name="Compare">Compare</a></h2>
<p>
Condition evaluator that compares two strings.
Compares two strings (case sensitive).
The strings are passed through the StringParser, so it is possible to compare
SharpDevelop properties.<br />
Useful if you want to run a command only when a setting is active to prevent
loading your addin if that setting isn't set.
</p>
<table>
<tr>
@ -36,19 +123,97 @@ It is based on SharpDevelop 2.0.0.589.</p> @@ -36,19 +123,97 @@ It is based on SharpDevelop 2.0.0.589.</p>
<td>ICSharpCode.Core.CompareConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>string:</td>
<td>
The first string.
</td>
</tr>
<tr>
<th>equals:</td>
<td>
The second string.
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if the browser is showing a HtmlHelp page</span>
<br><pre>
&lt;Condition name = "Compare" string = "${property:SharpDevelop.FiletypesRegisterStartup}" equals = "True"&gt;</pre></p>
</div>
<div>
<h2><a name="DebuggerSupports">DebuggerSupports</a></h2>
<p>
Tests if the debugger supports a certain feature.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.DebuggerSupportsConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>debuggersupports:</td>
<td>
The name of the feature the debugger must support.
Possible feature names: "Start", "StartWithoutDebugging", "Stop",
"ExecutionControl", "Stepping".
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if the debugger supports stepping</span>
<br><pre>
&lt;Condition name = "DebuggerSupports" debuggersupports="Stepping"&gt;</pre></p>
<p><span class="exampleTitle">Example: Test if the debugger supports killing the running application</span>
<br><pre>
&lt;Condition name = "DebuggerSupports" debuggersupports="Stop"&gt;</pre></p>
</div>
<div>
<h2><a name="IsProcessRunning">IsProcessRunning</a></h2>
<p>
Tests the values of DebuggerService.CurrentDebugger.IsDebugging (debugger attached to a process)
and DebuggerService.CurrentDebugger.IsProcessRunning (process is running and not in break mode).
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.IsProcessRunningConditionEvaluator</td>
</tr>
<tr>
<th>Attributes:</td>
<td>
Optional; boolean value IsDebugging should have.
</td>
</tr>
<tr>
<th>Attributes:</td>
<td>
Optional; boolean value IsProcessRunning should have.
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if currently no process is running</span>
<br><pre>
&lt;Condition name = "IsProcessRunning" isdebugging="False"&gt;</pre></p>
<p><span class="exampleTitle">Example: Test if the debugger is attached to anything</span>
<br><pre>
&lt;Condition name = "IsProcessRunning" isdebugging="True"&gt;</pre></p>
<p><span class="exampleTitle">Example: Test if the debugger is attached and we are in break mode</span>
<br><pre>
&lt;Condition name = "IsProcessRunning" isdebugging="True" isprocessrunning="False"&gt;</pre></p>
<p><span class="exampleTitle">Example: Test if the debugger is attached and the process is running</span>
<br><pre>
&lt;Condition name = "IsProcessRunning" isdebugging="True" isprocessrunning="True"&gt;</pre></p>
</div>
<div>
<h2><a name="OpenWindowState">OpenWindowState</a></h2>
<p>
Description of WindowStateCondition.
Tests if any open window has a specified window state.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.OpenWindowStateConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
</table>
</div>
<div>
@ -62,7 +227,124 @@ It is based on SharpDevelop 2.0.0.589.</p> @@ -62,7 +227,124 @@ It is based on SharpDevelop 2.0.0.589.</p>
<th>Condition name:</td>
<td>ICSharpCode.Core.OwnerStateConditionEvaluator</td>
</tr>
</table>
</div>
<div>
<h2><a name="ProjectActive">ProjectActive</a></h2>
<p>
Tests if any project is active or if a project of a specific language is active.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.ProjectActiveConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>activeproject:</td>
<td>
The language name the project should have.
"*" to test if any project is active.
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if any project is active</span>
<br><pre>
&lt;Condition name = "ProjectActive" activeproject="*"&gt;</pre></p>
<p><span class="exampleTitle">Example: Test if a C# project is active</span>
<br><pre>
&lt;Condition name = "ProjectActive" activeproject="C#"&gt;</pre></p>
</div>
<div>
<h2><a name="SolutionOpen">SolutionOpen</a></h2>
<p>
Tests if a solution is open.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.SolutionOpenConditionEvaluator</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if a solution is opened</span>
<br><pre>
&lt;Condition name = "SolutionOpen"&gt;</pre></p>
</div>
<div>
<h2><a name="TextContent">TextContent</a></h2>
<p>
Tests the name of the highlighting strategy of the text editor.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.SharpDevelop.DefaultEditor.Conditions.TextContentConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>textcontent:</td>
<td>
The name of the highlighting strategy that should be active.
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if any XML file is being edited</span>
<br><pre>
&lt;Condition name = "TextContent" textcontent="XML"&gt;</pre></p>
</div>
<div>
<h2><a name="WindowActive">WindowActive</a></h2>
<p>
Tests if the current workbench window is a specified type or implements an interface.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.WindowActiveConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>activewindow:</td>
<td>
The fully qualified name of the type the active window should be or the
interface name it should implement.
"*" to test if any window is active.
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if the current window is a text editor</span>
<br><pre>
&lt;Condition name="WindowActive" activewindow="ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.ITextEditorControlProvider"&gt;</pre></p>
<p><span class="exampleTitle">Example: Test if any window is active</span>
<br><pre>
&lt;Condition name="WindowActive" activewindow="*"&gt;</pre></p>
</div>
<div>
<h2><a name="WindowOpen">WindowOpen</a></h2>
<p>
Tests if a window of a specified type or implementing an interface is open.
The window does not need to be the active window.
</p>
<table>
<tr>
<th>Condition name:</td>
<td>ICSharpCode.Core.WindowOpenConditionEvaluator</td>
</tr>
<tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>
<tr>
<th>openwindow:</td>
<td>
The fully qualified name of the type the window should be or the
interface name it should implement.
"*" to test if any window is open.
</td>
</tr>
</table>
<p><span class="exampleTitle">Example: Test if a text editor is opened</span>
<br><pre>
&lt;Condition name="WindowOpen" openwindow="ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.ITextEditorControlProvider"&gt;</pre></p>
<p><span class="exampleTitle">Example: Test if any window is open</span>
<br><pre>
&lt;Condition name="WindowOpen" openwindow="*"&gt;</pre></p>
</div>
</body></html>

13
doc/technotes/listing.css

@ -17,13 +17,13 @@ h1 { @@ -17,13 +17,13 @@ h1 {
}
h2 {
font-size: 150%;
text-decoration: bold;
margin-top: 0px;
margin-bottom: 0px;
}
h3 {
font-size: 110%;
margin-top: 0px;
margin-bottom: 0px;
}
div {
border: 1px solid #ccccff;
@ -31,8 +31,10 @@ div { @@ -31,8 +31,10 @@ div {
padding-left: 4px;
padding-right: 10px;
padding-top: 4px;
padding-bottom: 0px !important;
padding-bottom: 4px;
margin-top: 4px;
margin-bottom: 4px;
margin-bottom: 8px;
}
td, th {
background: #fdfdfd;
@ -48,3 +50,10 @@ hr { @@ -48,3 +50,10 @@ hr {
background-color: #ccccff;
height: 1px;
}
.exampleTitle {
font-weight: bold;
}
pre {
margin-top: -10px !important;
margin-top: 4px;
}

6
src/AddIns/Misc/MbUnitPad/Project/MbUnitPad.addin

@ -62,7 +62,7 @@ @@ -62,7 +62,7 @@
</Path>
<Path name = "/SharpDevelop/Pads/MbUnitPad/Toolbar">
<Condition name = "CombineOpen" iscombineopen="True" action="Disable">
<Condition name = "SolutionOpen" action="Disable">
<ToolbarItem id = "Reload"
icon = "Icons.16x16.BrowserRefresh"
tooltip = "${res:NUnitPad.NUnitPadContent.RefreshItem}"
@ -84,7 +84,7 @@ @@ -84,7 +84,7 @@
</Condition>
<ComplexCondition action="Disable">
<And>
<Condition name="CombineOpen" iscombineopen="True"/>
<Condition name="SolutionOpen"/>
<Not>
<Condition name="MbUnitRunningTests"/>
</Not>
@ -96,7 +96,7 @@ @@ -96,7 +96,7 @@
</ComplexCondition>
<ComplexCondition action="Disable">
<And>
<Condition name="CombineOpen" iscombineopen="True"/>
<Condition name="SolutionOpen"/>
<Condition name="MbUnitRunningTests"/>
</And>
<ToolbarItem id = "Stop"

9
src/Main/Base/Project/Src/Gui/BrowserDisplayBinding/BrowserLocationConditionEvaluator.cs

@ -14,6 +14,15 @@ namespace ICSharpCode.SharpDevelop.BrowserDisplayBinding @@ -14,6 +14,15 @@ namespace ICSharpCode.SharpDevelop.BrowserDisplayBinding
/// <summary>
/// Conditions that tries to match the URL of a <see cref="HtmlViewPane"/> with a regex.
/// </summary>
/// <attribute name="urlRegex">
/// The regular expression that must match the URL.
/// </attribute>
/// <attribute name="options">
/// Optional; options that are passed as <see cref="RegexOptions"/>.
/// </attribute>
/// <example title="Test if the browser is showing a HtmlHelp page">
/// &lt;Condition name = "BrowserLocation" urlRegex = "^ms-help:\/\/"&gt;
/// </example>
public class BrowserLocationConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)

13
src/Main/Base/Project/Src/Internal/ConditionEvaluators/ActiveContentExtensionEvaluator.cs

@ -13,6 +13,15 @@ using ICSharpCode.SharpDevelop.Gui; @@ -13,6 +13,15 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Core
{
/// <summary>
/// Tests the file extension of the file edited in the active window content.
/// </summary>
/// <attribute name="activeextension">
/// The file extension the file should have.
/// </attribute>
/// <example title="Test if a C# file is being edited">
/// &lt;Condition name = "ActiveContentExtension" activeextension=".cs"&gt;
/// </example>
public class ActiveContentExtensionConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
@ -22,14 +31,14 @@ namespace ICSharpCode.Core @@ -22,14 +31,14 @@ namespace ICSharpCode.Core
}
try {
string name = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled ?
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.UntitledName : WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.FileName;
WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.UntitledName : WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.FileName;
if (name == null) {
return false;
}
string extension = Path.GetExtension(name);
return extension.ToUpper() == condition.Properties["activeextension"].ToUpper();
return extension.ToUpperInvariant() == condition.Properties["activeextension"].ToUpperInvariant();
} catch (Exception) {
return false;
}

17
src/Main/Base/Project/Src/Internal/ConditionEvaluators/ActiveViewContentUntitledEvaluator.cs

@ -14,6 +14,18 @@ using ICSharpCode.SharpDevelop.Gui; @@ -14,6 +14,18 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Core
{
/// <summary>
/// Tests if the active view content is untitled.
/// </summary>
/// <attributes name="activewindowuntitled">Boolean value to test against.</attributes>
/// <example title="Test if the active view content is untitled">
/// &lt;Condition name = "ActiveViewContentUntitled" activewindowuntitled="True"&gt;
/// - or -
/// &lt;Condition name = "ActiveViewContentUntitled"&gt;
/// </example>
/// <example title="Test if the active view content has a title">
/// &lt;Condition name = "ActiveViewContentUntitled" activewindowuntitled="False"&gt;
/// </example>
public class ActiveViewContentUntitledConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
@ -22,9 +34,10 @@ namespace ICSharpCode.Core @@ -22,9 +34,10 @@ namespace ICSharpCode.Core
return false;
}
if (!condition.Properties.Contains("activewindowuntitled"))
return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled;
bool activewindowuntitled = Boolean.Parse(condition.Properties["activewindowuntitled"]);
return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled && activewindowuntitled ||
!WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled && !activewindowuntitled ;
return WorkbenchSingleton.Workbench.ActiveWorkbenchWindow.ViewContent.IsUntitled == activewindowuntitled;
}
}
}

3
src/Main/Base/Project/Src/Internal/ConditionEvaluators/ActiveWindowStateEvaluator.cs

@ -19,6 +19,9 @@ namespace ICSharpCode.Core @@ -19,6 +19,9 @@ namespace ICSharpCode.Core
ViewOnly = 4
}
/// <summary>
/// Tests the window state of the active workbench window.
/// </summary>
public class ActiveWindowStateConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)

12
src/Main/Base/Project/Src/Internal/ConditionEvaluators/CombineOpenEvaluator.cs

@ -14,13 +14,17 @@ using ICSharpCode.SharpDevelop.Gui; @@ -14,13 +14,17 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Core
{
public class CombineOpenConditionEvaluator : IConditionEvaluator
/// <summary>
/// Tests if a solution is open.
/// </summary>
/// <example title="Test if a solution is opened">
/// &lt;Condition name = "SolutionOpen"&gt;
/// </example>
public class SolutionOpenConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
{
bool isCombineOpen = Boolean.Parse(condition.Properties["iscombineopen"]);
return ProjectService.OpenSolution != null || !isCombineOpen;
return (ProjectService.OpenSolution != null);
}
}
}

14
src/Main/Base/Project/Src/Internal/ConditionEvaluators/DebuggerSupportsEvaluator.cs

@ -12,6 +12,20 @@ using ICSharpCode.SharpDevelop.Gui; @@ -12,6 +12,20 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Core
{
/// <summary>
/// Tests if the debugger supports a certain feature.
/// </summary>
/// <attribute name="debuggersupports">
/// The name of the feature the debugger must support.
/// Possible feature names: "Start", "StartWithoutDebugging", "Stop",
/// "ExecutionControl", "Stepping".
/// </attribute>
/// <example title="Test if the debugger supports stepping">
/// &lt;Condition name = "DebuggerSupports" debuggersupports="Stepping"&gt;
/// </example>
/// <example title="Test if the debugger supports killing the running application">
/// &lt;Condition name = "DebuggerSupports" debuggersupports="Stop"&gt;
/// </example>
public class DebuggerSupportsConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)

22
src/Main/Base/Project/Src/Internal/ConditionEvaluators/IsProcessRunningEvaluator.cs

@ -12,6 +12,28 @@ using ICSharpCode.SharpDevelop.Gui; @@ -12,6 +12,28 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Core
{
/// <summary>
/// Tests the values of DebuggerService.CurrentDebugger.IsDebugging (debugger attached to a process)
/// and DebuggerService.CurrentDebugger.IsProcessRunning (process is running and not in break mode).
/// </summary>
/// <attributes name="isdebugging">
/// Optional; boolean value IsDebugging should have.
/// </attributes>
/// <attributes name="isprocessrunning">
/// Optional; boolean value IsProcessRunning should have.
/// </attributes>
/// <example title="Test if currently no process is running">
/// &lt;Condition name = "IsProcessRunning" isdebugging="False"&gt;
/// </example>
/// <example title="Test if the debugger is attached to anything">
/// &lt;Condition name = "IsProcessRunning" isdebugging="True"&gt;
/// </example>
/// <example title="Test if the debugger is attached and we are in break mode">
/// &lt;Condition name = "IsProcessRunning" isdebugging="True" isprocessrunning="False"&gt;
/// </example>
/// <example title="Test if the debugger is attached and the process is running">
/// &lt;Condition name = "IsProcessRunning" isdebugging="True" isprocessrunning="True"&gt;
/// </example>
public class IsProcessRunningConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)

2
src/Main/Base/Project/Src/Internal/ConditionEvaluators/OpenWindowStateEvaluator.cs

@ -13,7 +13,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -13,7 +13,7 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Core
{
/// <summary>
/// Description of WindowStateCondition.
/// Tests if any open window has a specified window state.
/// </summary>
public class OpenWindowStateConditionEvaluator : IConditionEvaluator
{

15
src/Main/Base/Project/Src/Internal/ConditionEvaluators/ProjectActiveEvaluator.cs

@ -16,12 +16,25 @@ using ICSharpCode.SharpDevelop.Project; @@ -16,12 +16,25 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Core
{
/// <summary>
/// Tests if any project is active or if a project of a specific language is active.
/// </summary>
/// <attribute name="activeproject">
/// The language name the project should have.
/// "*" to test if any project is active.
/// </attribute>
/// <example title="Test if any project is active">
/// &lt;Condition name = "ProjectActive" activeproject="*"&gt;
/// </example>
/// <example title="Test if a C# project is active">
/// &lt;Condition name = "ProjectActive" activeproject="C#"&gt;
/// </example>
public class ProjectActiveConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
{
string activeproject = condition.Properties["activeproject"];
IProject project = ProjectService.CurrentProject;
if (activeproject == "*") {
return project != null;

3
src/Main/Base/Project/Src/Internal/ConditionEvaluators/ProjectOpenEvaluator.cs

@ -15,6 +15,7 @@ using ICSharpCode.SharpDevelop.Project; @@ -15,6 +15,7 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Core
{
/*
public class ProjectOpenConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
@ -29,5 +30,5 @@ namespace ICSharpCode.Core @@ -29,5 +30,5 @@ namespace ICSharpCode.Core
return project != null && project.Language == openproject;
}
}
*/
}

14
src/Main/Base/Project/Src/Internal/ConditionEvaluators/WindowActiveEvaluator.cs

@ -14,6 +14,20 @@ using ICSharpCode.SharpDevelop.Gui; @@ -14,6 +14,20 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Core
{
/// <summary>
/// Tests if the current workbench window is a specified type or implements an interface.
/// </summary>
/// <attribute name="activewindow">
/// The fully qualified name of the type the active window should be or the
/// interface name it should implement.
/// "*" to test if any window is active.
/// </attribute>
/// <example title="Test if the current window is a text editor">
/// &lt;Condition name="WindowActive" activewindow="ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.ITextEditorControlProvider"&gt;
/// </example>
/// <example title="Test if any window is active">
/// &lt;Condition name="WindowActive" activewindow="*"&gt;
/// </example>
public class WindowActiveConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)

15
src/Main/Base/Project/Src/Internal/ConditionEvaluators/WindowOpenEvaluator.cs

@ -15,6 +15,21 @@ using ICSharpCode.SharpDevelop.Gui; @@ -15,6 +15,21 @@ using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.Core
{
/// <summary>
/// Tests if a window of a specified type or implementing an interface is open.
/// The window does not need to be the active window.
/// </summary>
/// <attribute name="openwindow">
/// The fully qualified name of the type the window should be or the
/// interface name it should implement.
/// "*" to test if any window is open.
/// </attribute>
/// <example title="Test if a text editor is opened">
/// &lt;Condition name="WindowOpen" openwindow="ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor.ITextEditorControlProvider"&gt;
/// </example>
/// <example title="Test if any window is open">
/// &lt;Condition name="WindowOpen" openwindow="*"&gt;
/// </example>
public class WindowOpenConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)

11
src/Main/Base/Project/Src/TextEditor/Conditions/TextContentCondition.cs

@ -16,6 +16,15 @@ using ICSharpCode.TextEditor; @@ -16,6 +16,15 @@ using ICSharpCode.TextEditor;
namespace ICSharpCode.SharpDevelop.DefaultEditor.Conditions
{
/// <summary>
/// Tests the name of the highlighting strategy of the text editor.
/// </summary>
/// <attribute name="textcontent">
/// The name of the highlighting strategy that should be active.
/// </attribute>
/// <example title="Test if any XML file is being edited">
/// &lt;Condition name = "TextContent" textcontent="XML"&gt;
/// </example>
public class TextContentConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
@ -24,7 +33,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Conditions @@ -24,7 +33,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Conditions
if (caller is TextEditorControl) {
TextEditorControl ctrl = (TextEditorControl)caller;
if (ctrl.Document != null && ctrl.Document.HighlightingStrategy != null) {
return textcontent == ctrl.Document.HighlightingStrategy.Name;
return string.Equals(textcontent, ctrl.Document.HighlightingStrategy.Name, StringComparison.OrdinalIgnoreCase);
}
}
return false;

15
src/Main/Core/Project/Src/AddInTree/AddIn/DefaultConditionEvaluators/CompareConditionEvaluator.cs

@ -11,8 +11,21 @@ using System.Collections; @@ -11,8 +11,21 @@ using System.Collections;
namespace ICSharpCode.Core
{
/// <summary>
/// Condition evaluator that compares two strings.
/// Compares two strings (case sensitive).
/// The strings are passed through the StringParser, so it is possible to compare
/// SharpDevelop properties.<br/>
/// Useful if you want to run a command only when a setting is active to prevent
/// loading your addin if that setting isn't set.
/// </summary>
/// <attribute name="string">
/// The first string.
/// </attribute>
/// <attribute name="equals">
/// The second string.
/// </attribute>
/// <example title="Test if the browser is showing a HtmlHelp page">
/// &lt;Condition name = "Compare" string = "${property:SharpDevelop.FiletypesRegisterStartup}" equals = "True"&gt;
/// </example>
public class CompareConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)

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

@ -186,14 +186,13 @@ namespace ICSharpCode.SharpDevelop @@ -186,14 +186,13 @@ namespace ICSharpCode.SharpDevelop
AddInTree.ConditionEvaluators.Add("ActiveContentExtension", new ActiveContentExtensionConditionEvaluator());
AddInTree.ConditionEvaluators.Add("ActiveViewContentUntitled", new ActiveViewContentUntitledConditionEvaluator());
AddInTree.ConditionEvaluators.Add("ActiveWindowState", new ActiveWindowStateConditionEvaluator());
AddInTree.ConditionEvaluators.Add("CombineOpen", new CombineOpenConditionEvaluator());
AddInTree.ConditionEvaluators.Add("SolutionOpen", new SolutionOpenConditionEvaluator());
AddInTree.ConditionEvaluators.Add("DebuggerSupports", new DebuggerSupportsConditionEvaluator());
AddInTree.ConditionEvaluators.Add("IsProcessRunning", new IsProcessRunningConditionEvaluator());
AddInTree.ConditionEvaluators.Add("OpenWindowState", new OpenWindowStateConditionEvaluator());
AddInTree.ConditionEvaluators.Add("WindowActive", new WindowActiveConditionEvaluator());
AddInTree.ConditionEvaluators.Add("WindowOpen", new WindowOpenConditionEvaluator());
AddInTree.ConditionEvaluators.Add("ProjectActive", new ProjectActiveConditionEvaluator());
AddInTree.ConditionEvaluators.Add("ProjectOpen", new ProjectOpenConditionEvaluator());
AddInTree.ConditionEvaluators.Add("TextContent", new ICSharpCode.SharpDevelop.DefaultEditor.Conditions.TextContentConditionEvaluator());
AddInTree.ConditionEvaluators.Add("BrowserLocation", new ICSharpCode.SharpDevelop.BrowserDisplayBinding.BrowserLocationConditionEvaluator());

18
src/Tools/BuildAddinDocumentation/MainClass.cs

@ -100,21 +100,25 @@ namespace BuildAddinDocumentation @@ -100,21 +100,25 @@ namespace BuildAddinDocumentation
html.WriteLine(" <th>Condition name:</td>");
html.WriteLine(" <td>" + fullname + "</td>");
html.WriteLine(" </tr>");
html.WriteLine(" <tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>");
bool firstNonAttribute = true;
bool lastWasAttribute = false;
foreach (XmlElement sub in e) {
switch (sub.Name) {
case "summary":
case "example":
break;
case "attribute":
if (!lastWasAttribute) {
lastWasAttribute = true;
html.WriteLine(" <tr><td colspan=2><hr><h3>Attributes:</h3></td></tr>");
}
html.WriteLine(" <tr>");
html.WriteLine(" <th>" + sub.GetAttribute("name") + ":</td>");
html.WriteLine(" <td>" + sub.InnerXml + "</td>");
html.WriteLine(" </tr>");
break;
default:
if (firstNonAttribute) {
firstNonAttribute = false;
if (lastWasAttribute) {
lastWasAttribute = false;
html.WriteLine(" <tr><td colspan=2><hr></td></tr>");
}
html.WriteLine(" <tr>");
@ -125,6 +129,12 @@ namespace BuildAddinDocumentation @@ -125,6 +129,12 @@ namespace BuildAddinDocumentation
}
}
html.WriteLine(" </table>");
foreach (XmlElement sub in e) {
if (sub.Name == "example") {
html.WriteLine(" <p><span class=\"exampleTitle\">Example: " + sub.GetAttribute("title") + "</span>");
html.WriteLine(" <br><pre>" + sub.InnerXml.TrimEnd() + "</pre></p>");
}
}
html.WriteLine("</div>");
}
}

Loading…
Cancel
Save