creating dynamic visibleWhen expression [message #329813] |
Sun, 06 July 2008 21:02 |
Eclipse User |
|
|
|
Originally posted by: novs.gmx.net
Hi,
I declared created a definition using the
"org.eclipse.core.expressions.definitions" definition point which is
attached to some menu and toolbar entries as visibleWhen expression, so
that they are only shown when an editor is open. However, some of the
toolbar items are not created via plugin.xml but during runtime as
CommandContributionItems. My problem is, that I'd like to attach the same
expression to these dynamically created items but the registerVisibleWhen
method from the MenuService seems to be no longer available. Is there an
alternative?
Thanks very much for your help,
Chris
|
|
|
|
Re: creating dynamic visibleWhen expression [message #330026 is a reply to message #329923] |
Sun, 13 July 2008 18:08 |
Eclipse User |
|
|
|
Originally posted by: novs.gmx.net
Hi Paul,
Thank you very much for your answer. Using AbstractContributionFactory
seems to be a convenient way to achieve exactly what I have in mind.
However, the information in the comment of this class seems to be
outdated. The createContributionItems method is called with a
ServiceLocator and an IContributionRoot instead of an IMenuService and a
List (as mentioned in the comment). This means that I would have to
include ContributionRoot and WorkbenchMenuService, both of which are
internal, as imports. Is there a way to avoid this (to avoid problems if
the API changes in the next Eclipse version).
Regards,
Chris
|
|
|
|
Re: creating dynamic visibleWhen expression [message #330089 is a reply to message #330085] |
Mon, 14 July 2008 15:37 |
Eclipse User |
|
|
|
Originally posted by: novs.gmx.net
You are right, it's called with IContributionRoot which contains
addContributionItem as well as registerVisibilityForChild. My current
problem is, that both methods require the visibleWhen-Expression as an
argument, and I have no idea on how to create an Expression object for an
existing plugin.xml definition using the public API. It seems to work if I
use "new ReferenceExpression(expressionDefinitionID)" but this is internal.
Regards,
Chris
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07599 seconds