Enabling or disabling command handler based on selection [message #330981] |
Wed, 20 August 2008 13:19 |
Eclipse User |
|
|
|
Originally posted by: nick.allen.onlinehome.de
Hi,
I am writing a plug-in for Eclipse that integrates with the Bazaar
version control system. I have written my command handlers and used the
menu extension point to insert a "Bazaar" menu into the main eclipse
window. The problem is that my actions are always enabled and I need to
change that based on which files are selected or whether the editor has
focus or not. For selected files I need to check if they are in a parent
(or ancestor) directory that contains a ".bzr" directory and if the
editor has focus I need to check if the file being edited is in such a
directory structure.
The examples show how to use expressions in the XML file for the command
handlers but my condition is too complex to express in XML syntax. I
would like to do this programmatically or to at least write a new
expression class which I can then use in the XML (e.g.
IsUnderBazaarVersionControlExpression).
I have searched for 3 days solid and found nothing appropriate.
How do I do this? Any feedback greatly appreciated.
Many thanks in advance,
Nicholas Allen
|
|
|
Re: Enabling or disabling command handler based on selection [message #331022 is a reply to message #330981] |
Thu, 21 August 2008 14:47 |
Eclipse User |
|
|
|
Originally posted by: nick.allen.onlinehome.de
Does no-one know how to do this? I would really appreciate any help - I
am new to Eclipse and am getting frustrated that something so easy
should turn out to require so much work and investigation.
Thanks,
Nick
Nicholas Allen wrote:
> Hi,
>
> I am writing a plug-in for Eclipse that integrates with the Bazaar
> version control system. I have written my command handlers and used the
> menu extension point to insert a "Bazaar" menu into the main eclipse
> window. The problem is that my actions are always enabled and I need to
> change that based on which files are selected or whether the editor has
> focus or not. For selected files I need to check if they are in a parent
> (or ancestor) directory that contains a ".bzr" directory and if the
> editor has focus I need to check if the file being edited is in such a
> directory structure.
>
> The examples show how to use expressions in the XML file for the command
> handlers but my condition is too complex to express in XML syntax. I
> would like to do this programmatically or to at least write a new
> expression class which I can then use in the XML (e.g.
> IsUnderBazaarVersionControlExpression).
>
> I have searched for 3 days solid and found nothing appropriate.
> How do I do this? Any feedback greatly appreciated.
>
> Many thanks in advance,
>
> Nicholas Allen
|
|
|
|
Re: Enabling or disabling command handler based on selection [message #331028 is a reply to message #331027] |
Thu, 21 August 2008 15:49 |
Eclipse User |
|
|
|
Originally posted by: nick.allen.onlinehome.de
Many thanks for your replies! I will look into these - I hope it turns
out to be fairly easy...
Nick
Francis Upton (News) wrote:
> I don't know exactly, but have a look at org.eclipse.core.expressions,
> that shows you how to provide an expression programatically.
>
> Look at the command stuff in the Wiki as well. I always try to find an
> email by Paul Webster if I need to know about this stuff (it has the
> best links):
>
> Paul Webster
> http://wiki.eclipse.org/Platform_Command_Framework
> http://wiki.eclipse.org/Command_Core_Expressions
> http://wiki.eclipse.org/Menu_Contributions
> http://wiki.eclipse.org/Menus_Extension_Mapping
> http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
>
>
> You can create a Command programatically and associated an expression
> with it.
>
> HTH,
> Francis
>
>
> Nicholas Allen wrote:
>> Does no-one know how to do this? I would really appreciate any help - I
>> am new to Eclipse and am getting frustrated that something so easy
>> should turn out to require so much work and investigation.
>>
>> Thanks,
>>
>> Nick
>>
>> Nicholas Allen wrote:
>>> Hi,
>>>
>>> I am writing a plug-in for Eclipse that integrates with the Bazaar
>>> version control system. I have written my command handlers and used the
>>> menu extension point to insert a "Bazaar" menu into the main eclipse
>>> window. The problem is that my actions are always enabled and I need to
>>> change that based on which files are selected or whether the editor has
>>> focus or not. For selected files I need to check if they are in a parent
>>> (or ancestor) directory that contains a ".bzr" directory and if the
>>> editor has focus I need to check if the file being edited is in such a
>>> directory structure.
>>>
>>> The examples show how to use expressions in the XML file for the command
>>> handlers but my condition is too complex to express in XML syntax. I
>>> would like to do this programmatically or to at least write a new
>>> expression class which I can then use in the XML (e.g.
>>> IsUnderBazaarVersionControlExpression).
>>>
>>> I have searched for 3 days solid and found nothing appropriate.
>>> How do I do this? Any feedback greatly appreciated.
>>>
>>> Many thanks in advance,
>>>
>>> Nicholas Allen
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.03272 seconds