SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

Using conditions in the addin file

Last post 06-28-2007 10:28 PM by ankit_chawla. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-28-2007 9:00 PM

    Using conditions in the addin file

    Hey,

    We are trying to add a condition to the addin file which would ensure that a particular menuitem would automatically become enabled when a file with a specific extension is opened and become disabled otherwise. We have found the activeextension attribute in the condition tag but are not able to use it to get the desired result. Can anyone tell us how we should go about doing that? The code that we tried out (given below) results in the menuitem not being displayed at all because obviously a file with the ".aspx" extension is not open when sharpdevelop is started. 

    Path name = "/SharpDevelop/Workbench/MainMenu/File">

    <Condition activeextension="*.aspx"/>

    <MenuItem id = "PreviewBrowser"

    insertbefore = "Print"

    label = "Preview in Browser"

    class = "ASPDesignerDotNet.Src.PreviewBrowser"/>

    </Condition>

    </Path>

  • 06-28-2007 9:43 PM In reply to

    Re: Using conditions in the addin file

    You need to specify the name of the condition type you want to use. ActiveContentExtension compares an extension, it does not try to do pattern matching, so you cannot use a * there. Also, the default action for a menu item where the condition fails is to make the menu item invisible. If you instead want to disable it, use action="Disable"

    Example:

    <Condition name="ActiveContentExtension" activeextension=".aspx" action = "Disable">

     
    The available conditions are documented in SharpDevelop/doc/technotes/ConditionList.html (in SharpDevelop's source code download). 

    Daniel Grunwald
  • 06-28-2007 10:28 PM In reply to

    Re: Using conditions in the addin file

    thanks a lot, it works now. :)
Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.