popupMenus objectContribution [message #329460] |
Wed, 25 June 2008 09:01 |
Eclipse User |
|
|
|
Originally posted by: nouha_benrhouma.yahoo.fr
Hi,
I have created an object contribution within a context menu and I have an
action associated with this object contribution.
This works good but I want to make this action visible only when I'm in a
specific perspective and a specific view. I'm working with eclipse 3.3.2
Is that possible please?
Thank you for help
|
|
|
|
Re: popupMenus objectContribution [message #329531 is a reply to message #329476] |
Fri, 27 June 2008 10:28 |
Eclipse User |
|
|
|
Originally posted by: nouha_benrhouma.yahoo.fr
Thank you for reply,
my problem is that I want to have a command or action that is only visible
in a specific view, with a specific object, under a specific perspective.
I have many plugins and each one has it's specific perspective.
Each perspective has it's views and in some views I use same objects.
Suppose that I have an object named com.test.sdk.Person
I use this object in the following views:
com.test.ui.FirstView
com.test.ui.SecondView
I have two plugins each one has it's perspective (com.test.perspective1
and com.test1.perspective1)
the two perspectives are showing several views and com.test.ui.FirstView
is common to the 2 perspectives.
I want to have the command (or action) visible only when I'm in
perspective com.test.perspective1, under the view com.test.ui.FirstView
with the object com.test.sdk.Person.
Can this be possible?
|
|
|
|
Re: popupMenus objectContribution [message #329691 is a reply to message #329538] |
Tue, 01 July 2008 11:45 |
Eclipse User |
|
|
|
Originally posted by: nouha_benrhouma.yahoo.fr
I tried it with command.I used instanceof (with visibleWhen), and
activePartId variable, but it seems there is a problem when using
instanceof because the command doesn't appears, is there something
specific with instanceof?
|
|
|
|
Re: popupMenus objectContribution [message #329772 is a reply to message #329745] |
Thu, 03 July 2008 13:16 |
Eclipse User |
|
|
|
Originally posted by: nouha_benrhouma.yahoo.fr
This is a sample extract of my plugin.xml
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions ">
<command
commandId="com.test.plugin.MyCommandName"
label="PersonCommand">
<visibleWhen>
<and>
<with
variable="activePartId">
<equals
value="com.test.plugin.ui.view.MyView">
</equals>
</with>
<instanceof
value="com.test.plugin..sdk.Person">
</instanceof></and></visibleWhen>
</command>
</menuContribution>
where com.test.plugin.ui.view.MyView is the id of the view where I want my
command to be shown and com.test.plugin..sdk.Person is the class of the
object (like object contribution).
I want the command to be shown when I right clic on Person in MyView, but
with this description, the command doesn't appear in MyView and appears
disabled in another view wherever I clic (though in my command handler,
isEnabled() method returns true.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03575 seconds