Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Controlling action visibility via plugin.xml?
Controlling action visibility via plugin.xml? [message #293051] Mon, 17 October 2005 08:48 Go to next message
Eclipse UserFriend
Originally posted by: csetera.spss.com

Is there any way to control visibility of an action (menu item) via
plugin.xml or must that be done from within code? I can't seem to find
a way to handle that.
Re: Controlling action visibility via plugin.xml? [message #293053 is a reply to message #293051] Mon, 17 October 2005 08:58 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: arne.anka.ginguppin.de

> Is there any way to control visibility of an action (menu item) via
> plugin.xml or must that be done from within code? I can't seem to find
> a way to handle that.

depends on your definitopn of "visibility". at least for
perspective-dependent visiblity (i e if the perspective open and active or
not) that may achieved may declaring the action as perspectiveExtension in
plugin.xml.
Re: Controlling action visibility via plugin.xml? [message #293056 is a reply to message #293053] Mon, 17 October 2005 09:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: csetera.spss.com

arne anka wrote:
>> Is there any way to control visibility of an action (menu item) via
>> plugin.xml or must that be done from within code? I can't seem to
>> find a way to handle that.
>
>
> depends on your definitopn of "visibility". at least for
> perspective-dependent visiblity (i e if the perspective open and active
> or not) that may achieved may declaring the action as
> perspectiveExtension in plugin.xml.

I need more control than that. Essentially, I want to apply enablement
controls to visibility of the menu item.

At this point, I can't even see how to do this in code. I don't see any
way to get my hands on the action bars/menu bar manager from another
plugin to add the menu contribution dynamically. I've been hung up on
this issue for way too long. Thoughts appreciated.
Re: Controlling action visibility via plugin.xml? [message #293060 is a reply to message #293056] Mon, 17 October 2005 10:21 Go to previous messageGo to next message
Eclipse UserFriend
Craig Setera wrote:
>
> I need more control than that. Essentially, I want to apply enablement
> controls to visibility of the menu item.
>
> At this point, I can't even see how to do this in code. I don't see any
> way to get my hands on the action bars/menu bar manager from another
> plugin to add the menu contribution dynamically. I've been hung up on
> this issue for way too long. Thoughts appreciated.

A description of your use case would really help answer your question.
Sometimes there are other ways to do things that play well with eclipse.


If you are talking about actions you add, you can use extensions to add
your actions: actionSets, actionPartAssociations, editorActions, and
viewActions. Your editor can also programmatically add actions using
the ActionBarContributor. You can have your actions register listeners
(window, page, or part) and update their enablement.

If you are talking about general actions contributed by other plugins,
you can use activities (see eclipse help) to mask out menu contributions
by id.

Later,
PW
Re: Controlling action visibility via plugin.xml? [message #293072 is a reply to message #293060] Mon, 17 October 2005 11:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

Paul Webster wrote:
> If you are talking about actions you add, you can use extensions to add
> your actions: actionSets, actionPartAssociations, editorActions, and
> viewActions. Your editor can also programmatically add actions using
> the ActionBarContributor. You can have your actions register listeners
> (window, page, or part) and update their enablement.

Oh, and don't forget popupMenus.



d.
Re: Controlling action visibility via plugin.xml? [message #293076 is a reply to message #293060] Mon, 17 October 2005 14:53 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: csetera.spss.com

> A description of your use case would really help answer your question.
> Sometimes there are other ways to do things that play well with eclipse.
>
OK. You asked for it. See below :-)

>
> If you are talking about actions you add, you can use extensions to add
> your actions: actionSets, actionPartAssociations, editorActions, and
> viewActions. Your editor can also programmatically add actions using
> the ActionBarContributor. You can have your actions register listeners
> (window, page, or part) and update their enablement.
>
> If you are talking about general actions contributed by other plugins,
> you can use activities (see eclipse help) to mask out menu contributions
> by id.
>
> Later,
> PW

I think I'm aware of all of the options you mentioned. None of these
really do what I want though.

Here's the scenario. The common administration layer of plugins sits
atop the common layer of plugins. There are multiple administration
extensions that plug into the common administration layer. Each
provides its own wizard pages to a common "new server connection"
wizard. This wizard and the associated action that launches it are
defined in the common administration layer. The common layers ship
separately from the actual administration plugins. In addition, there
is non-administrative functionality that might be there without any
administrative extensions installed. In that case, I don't want the
"create new administrative connection" action to even be visible on the
menu because it can't work. I only want the "create administrative
connection" action to be visible if there are actually plug-ins that are
providing administrative functionality. The common administrative
functionality should just be there to glue together real administrative
functionality and otherwise be completely silent.

Does any of that make sense? Is there some other way I can make this
work?

Thanks,
Craig
Re: Controlling action visibility via plugin.xml? [message #293086 is a reply to message #293076] Mon, 17 October 2005 17:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

Craig Setera wrote:
> Here's the scenario. The common administration layer of plugins sits
> atop the common layer of plugins. There are multiple administration
> extensions that plug into the common administration layer. Each
> provides its own wizard pages to a common "new server connection"
> wizard. This wizard and the associated action that launches it are
> defined in the common administration layer. The common layers ship
> separately from the actual administration plugins. In addition, there
> is non-administrative functionality that might be there without any
> administrative extensions installed. In that case, I don't want the
> "create new administrative connection" action to even be visible on the
> menu because it can't work. I only want the "create administrative
> connection" action to be visible if there are actually plug-ins that are
> providing administrative functionality. The common administrative
> functionality should just be there to glue together real administrative
> functionality and otherwise be completely silent.

Why is the wizard and the associated action defined in the common
administration layer? This seems ... odd.



d.
Re: Controlling action visibility via plugin.xml? [message #293103 is a reply to message #293076] Tue, 18 October 2005 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Craig Setera wrote:
>
> I think I'm aware of all of the options you mentioned. None of these
> really do what I want though.
>
> Here's the scenario. The common administration layer of plugins sits
> atop the common layer of plugins. There are multiple administration
> extensions that plug into the common administration layer. Each
> provides its own wizard pages to a common "new server connection"
> wizard. This wizard and the associated action that launches it are
> defined in the common administration layer. The common layers ship
> separately from the actual administration plugins. In addition, there
> is non-administrative functionality that might be there without any
> administrative extensions installed. In that case, I don't want the
> "create new administrative connection" action to even be visible on the
> menu because it can't work. I only want the "create administrative
> connection" action to be visible if there are actually plug-ins that are
> providing administrative functionality. The common administrative
> functionality should just be there to glue together real administrative
> functionality and otherwise be completely silent.

Hmmm ... how about this:

You can put your actions in an actionSet with a default visibility of
false. Then you can check to see if your admin extension point has any
extensions, and if it does call IWorkbenchPage#showActionSet(String
actionSetID).

I'm not really sure when you would do the check though ... when your
common admin layer plugin(s) are loaded is when you could check to see
if anybody extends your extension point.

Later,
PW
Re: Controlling action visibility via plugin.xml? [message #293113 is a reply to message #293103] Tue, 18 October 2005 10:39 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: csetera.spss.com

> Hmmm ... how about this:
>
> You can put your actions in an actionSet with a default visibility of
> false. Then you can check to see if your admin extension point has any
> extensions, and if it does call IWorkbenchPage#showActionSet(String
> actionSetID).
>
> I'm not really sure when you would do the check though ... when your
> common admin layer plugin(s) are loaded is when you could check to see
> if anybody extends your extension point.
>
> Later,
> PW

Paul,

That was just the trick that I needed. Using that and the core
expressions stuff, I was able to create a new actionSetEnablement
extension point in my common ui plugin that manages enabling action sets
based on enablement expressions.

Thanks,
Craig
Re: Controlling action visibility via plugin.xml? [message #293131 is a reply to message #293051] Tue, 18 October 2005 14:25 Go to previous messageGo to next message
Eclipse UserFriend
I have a variation on this question. Perhaps someone can help.

I am building a product that when built allows me to carefully select what
plugins are installed. I have no problem when it's installed as a Product.

But... we also want to publish our tool as a Feature. The problem is that
we would like to suppress some of the popupmenu items that are contributed
by org.eclipse.jdt* and org.eclipse.team.cvs.*. These cause popups with
topics such as Run As, Debug As, Team etc.

Does anyone have any idea how to "Hide" contributed Actions?
Re: Controlling action visibility via plugin.xml? [message #293132 is a reply to message #293131] Tue, 18 October 2005 14:29 Go to previous messageGo to next message
Eclipse UserFriend
Charles Godwin wrote:
>
> Does anyone have any idea how to "Hide" contributed Actions?
>

Activities can help you ... there's an example in the on-line help.

Later,
PW
Re: Controlling action visibility via plugin.xml? [message #293133 is a reply to message #293132] Tue, 18 October 2005 14:46 Go to previous messageGo to next message
Eclipse UserFriend
Paul Webster wrote:

> Activities can help you ... there's an example in the on-line help.

> Later,
> PW

I don't think the example helps. It describes how to filter your own
Activites but how do I filter other plugins' ActivityIDs when my product
perspective in selected?
Re: Controlling action visibility via plugin.xml? [message #293518 is a reply to message #293133] Tue, 25 October 2005 11:03 Go to previous messageGo to next message
Eclipse UserFriend
Is it me?
Are my questions dumb?
or does this group stop replying once the question gets difficult?

i've tried repeatedly, in various threads, to finds out how to "subtract"
actions supplied by other, default, plug-ins and I have yet to find a
viable example or soulution.

for example can someone tell me how to hide, delete or otherwise remove
the Build group of actions in the main toolbar?
Re: Controlling action visibility via plugin.xml? [message #293520 is a reply to message #293518] Tue, 25 October 2005 11:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

Charles Godwin wrote:
> Is it me?
> Are my questions dumb?
> or does this group stop replying once the question gets difficult?

There are many reasons why people might stop replying. The people who
answer your questions are being nice. They have other things they need to
do. Generally, answers will point you to the stuff you need, but won't be
a long essay as we don't have that kind of time to spare.


> for example can someone tell me how to hide, delete or otherwise remove
> the Build group of actions in the main toolbar?

Paul's answer was a good one. If you are filtering the menu contributions
that are contributed by the WorkbenchActionBuilder (e.g, build), then you
need to filter by the command identifier.



cheers,
d.
Re: Controlling action visibility via plugin.xml? [message #293523 is a reply to message #293520] Tue, 25 October 2005 11:52 Go to previous messageGo to next message
Eclipse UserFriend
Thanks Doug for clarifying the situation.

you've identified my major problem with Eclipse. The interactive help is
thin (try looking up the keywords you provided) and there is limited
second level help. the only way someone trying to do anything extensive is
to ponderously read the source code.

I guess since the product is provided free, we get what we pay for.
Re: Controlling action visibility via plugin.xml? [message #293527 is a reply to message #293518] Tue, 25 October 2005 12:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

Charles Godwin <charles.godwin@ca.com> wrote:
> Is it me?
> Are my questions dumb?
> or does this group stop replying once the question gets difficult?
>
> i've tried repeatedly, in various threads, to finds out how to
> "subtract" actions supplied by other, default, plug-ins and I have
> yet to find a viable example or soulution.
>
> for example can someone tell me how to hide, delete or otherwise
> remove the Build group of actions in the main toolbar?

You should also try searching bugzilla first.
There is a preexisting bug about this.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=106007
So the reason you aren't getting an answer is because some of what you want
can't currently be done properly.
It's an all-or-nothing solution right now- i.e., either you get all actions
contributed by other plugins or none.

--
Sunil
Re: Controlling action visibility via plugin.xml? [message #293562 is a reply to message #293133] Wed, 26 October 2005 09:17 Go to previous messageGo to next message
Eclipse UserFriend
Charles Godwin wrote:
> Paul Webster wrote:
>
>> Activities can help you ... there's an example in the on-line help.
>
>
>> Later,
>> PW
>
>
> I don't think the example helps. It describes how to filter your own
> Activites but how do I filter other plugins' ActivityIDs when my product
> perspective in selected?
>

1. you can filter anybody's actionSet IDs ... I think the format is
plugin.id/actionset.id ... although you'll need to find the actionSet id's .

2. you will have to write code that disables your activity when your
perspective is opened, and enables your activity when your perspective
is closed. Check out IPerspectiveListener.

Later,
PW
Re: Controlling action visibility via plugin.xml? [message #293563 is a reply to message #293518] Wed, 26 October 2005 09:29 Go to previous messageGo to next message
Eclipse UserFriend
Charles Godwin wrote:
> Is it me? Are my questions dumb? or does this group stop replying once
> the question gets difficult?

Not dumb, but we get busy too.

>
> i've tried repeatedly, in various threads, to finds out how to
> "subtract" actions supplied by other, default, plug-ins and I have yet
> to find a viable example or soulution.

Hmmm ... activites? :-)

Seriously, you have more luck posting "I tried activities, and I
couldn't get X to disappear ... I thought a binding like this would work:

<activityPatternBinding
activityId="org.eclipse.javaDevelopment"
pattern="org\.eclipse\.ui\.workbench/.*">
</activityPatternBinding>

but nothing appeared to happen when I disabled and enabled the
corresponding capability"

If I look at a follow up post the first thing I say is "I said
activities can make contributions disappear ... what problem did you
have with activities?" Since you didn't post anything like that, and
I'm busy, I'll give someone else the chance to help you.

Later,
PW
Re: Controlling action visibility via plugin.xml? [message #293567 is a reply to message #293562] Wed, 26 October 2005 10:01 Go to previous messageGo to next message
Eclipse UserFriend
Paul

Thanks for both your replies.

I am doing my due diligence and will post when ready.
Re: Controlling action visibility via plugin.xml? [message #293578 is a reply to message #293527] Wed, 26 October 2005 11:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: douglas.pollock.magma.ca

Sunil Kamath wrote:
> You should also try searching bugzilla first.
> There is a preexisting bug about this.
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=106007
> So the reason you aren't getting an answer is because some of what you
> want can't currently be done properly.

I don't believe this bug is related.



cheers,
d.
Re: Controlling action visibility via plugin.xml? [message #293650 is a reply to message #293578] Thu, 27 October 2005 10:38 Go to previous message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

Douglas Pollock <douglas.pollock@magma.ca> wrote:
> Sunil Kamath wrote:
>> You should also try searching bugzilla first.
>> There is a preexisting bug about this.
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=106007
>> So the reason you aren't getting an answer is because some of what
>> you want can't currently be done properly.
>
> I don't believe this bug is related.
>
I think it is.
This is what he originally asked:
>>>
>>> But... we also want to publish our tool as a Feature. The problem is
>>> that
>>> we would like to suppress some of the popupmenu items that are
>>> contributed
>>> by org.eclipse.jdt* and org.eclipse.team.cvs.*. These cause popups with
>>> topics such as Run As, Debug As, Team etc.

>>> Does anyone have any idea how to "Hide" contributed Actions?

This is exactly what the bug asks.

--
Sunil
Previous Topic:how to change required java version to old version on eclipse
Next Topic:How to capture queries
Goto Forum:
  


Current Time: Thu May 29 21:16:30 EDT 2025

Powered by FUDForum. Page generated in 1.07757 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top