Browse Source

Original AddInManager now only shows its menu item (Tools menu), if AddInManager2 is not installed or enabled.

pull/32/head
Andreas Weizel 13 years ago
parent
commit
39cbae8588
  1. 9
      src/AddIns/Misc/AddInManager/Project/AddInManager.addin
  2. 19
      src/AddIns/Misc/AddInManager/Project/Src/Commands.cs

9
src/AddIns/Misc/AddInManager/Project/AddInManager.addin

@ -11,13 +11,16 @@ @@ -11,13 +11,16 @@
<Runtime>
<Import assembly = "ICSharpCode.AddInManager.dll">
<ConditionEvaluator name="AddInManagerAddInState" class="ICSharpCode.AddInManager.AddInManagerAddInStateConditionEvaluator"/>
<ConditionEvaluator name="AddInManager2NotInstalled" class="ICSharpCode.AddInManager.AddInManager2NotInstalledConditionEvaluator"/>
</Import>
</Runtime>
<Path name = "/SharpDevelop/Workbench/Tools">
<MenuItem id = "ShowAddInManager"
label = "${res:AddInManager.Title}"
class = "ICSharpCode.AddInManager.ShowCommand"/>
<Condition name="AddInManager2NotInstalled">
<MenuItem id = "ShowAddInManager"
label = "${res:AddInManager.Title}"
class = "ICSharpCode.AddInManager.ShowCommand"/>
</Condition>
</Path>
<Path name = "/SharpDevelop/Workbench/DisplayBindings">

19
src/AddIns/Misc/AddInManager/Project/Src/Commands.cs

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using ICSharpCode.Core;
using System.Linq;
#if !STANDALONE
using ICSharpCode.SharpDevelop;
@ -43,6 +44,24 @@ namespace ICSharpCode.AddInManager @@ -43,6 +44,24 @@ namespace ICSharpCode.AddInManager
}
}
public class AddInManager2NotInstalledConditionEvaluator : IConditionEvaluator
{
public bool IsValid(object caller, Condition condition)
{
#if !STANDALONE
AddIn addInManager2AddIn = SD.AddInTree.AddIns.Where(
a => ((a.Manifest != null) && (a.Manifest.PrimaryIdentity == "ICSharpCode.AddInManager2")))
.FirstOrDefault();
if (addInManager2AddIn != null)
{
return !addInManager2AddIn.Enabled;
}
#endif
return true;
}
}
public class DisableCommand : AbstractMenuCommand
{
public override void Run()

Loading…
Cancel
Save