Problem related to IPopupMenuContributionPolicy [message #148118] |
Tue, 28 August 2007 16:12 |
Eclipse User |
|
|
|
Originally posted by: vinsarwate.rediffmail.com
Hi,
I am asking this here because I tried searching for any existing bugs
related to IPopupMenuContributionPolicy in Eclipse GMF but I couldn't find
any.
What I am trying is for learning purpose only. In my GMF editor, my goal
is to show "Hide this Node" option in context menu for a particular node
(say MyCustomEditPart).
I am trying to use Contribution Item Provider extension point.For this I
have created following entry in my plugin.xml
<extension
point=" org.eclipse.gmf.runtime.common.ui.services.action.contributi onItemProviders ">
<contributionItemProvider
checkPluginLoaded="false"
class=" my.custom.package.provider.MyDiagramContributionItemProvider ">
<Priority name="Lowest"/>
<popupContribution
class=" org.eclipse.gmf.runtime.diagram.ui.providers.DiagramContextM enuProvider ">
<popupStructuredContributionCriteria
objectClass="my.custom.package.MyCustomEditPart"
policyClass=" my.custom.package.policy.MyCustomPopupMenuContributionPolicy ">
</popupStructuredContributionCriteria>
<popupAction
id="hideThisNodeActionId"
path="/editGroup"/>
</popupContribution>
</contributionItemProvider>
</extension>
I understand that in this case I don't need "policyClass" attribute and
code works fine. But now I want to generalized this mechanism for other
editparts also. Therefore I though of specifying
" org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditP art " as
"objectClass" and then apply rules for this contribution using
"policyClass" attribute.
But using this approach,
ProviderContributionDescriptor$PopupContributionCriteria.get Policy() is
unable to load my "MyCustomPopupMenuContributionPolicy" class.
When I debugged it, I found that instead of calling
configElement.createExecutableExtension(POLICY_CLASS), it is calling
configElement.createExecutableExtension(policyClassName) where
policyClassName is
" my.custom.package.policy.MyCustomPopupMenuContributionPolicy ". In other
words, instead of looking for attribute name "policyClass" in
configuration elements, this code looks for "policyClass" attribute's
value and there is no property by this name (i.e.
" my.custom.package.policy.MyCustomPopupMenuContributionPolicy ").
Please correct me if I am missing something while observing this behavior.
Thanks,
Vinay
|
|
|
Powered by
FUDForum. Page generated in 0.02709 seconds