5 comments
Comment actions Permalink

Hello akshay,

a> How to add icons to the toolbar?

You need for implementing AnAction, or ToggleAction.
Then you must add to plugin.xml action definition and then connect it to
existing ActionGroup.

For example:
]]>

As you can see:

add-to-group element can connect your action into existings action groups
(toolbars, menu, popups).

To connect you must know group id - look into resources.jar!/idea/ActionManager.xml.

WBR,
--
Alexey Efimov, Java Developer
Tops BI


0
Comment actions Permalink

Speaking of which - is there an easy way to discover (not necessarily programmaticaly) which groups
IDEA already has?

For example, I wanted to add an action to the "Analyze" menu, and in the end I had to resort to
running in debug mode and inspecting the actionManager's fields to find it out...

Is there an easier way? Perhaps ActionManager.getGroups or something similar?

Alexey Efimov wrote:

<add-to-group anchor="after" group-id="ProjectViewPopupMenu" relative-to-action="EditSource"/>

0
Comment actions Permalink

Hello Arik,

AK> Speaking of which - is there an easy way to discover (not
AK> necessarily programmaticaly) which groups IDEA already has?
AK>
AK> For example, I wanted to add an action to the "Analyze" menu, and in
AK> the end I had to resort to running in debug mode and inspecting the
AK> actionManager's fields to find it out...
AK>
AK> Is there an easier way? Perhaps ActionManager.getGroups or something
AK> similar?

Programaticaly way is using ActionManager. Every action or group - is action.
ActionGroup actionGroup = (ActionGroup)actionManager.getAction("MyActi");

If you need to add your ouw Actions - you must cast group to DefaultActionGroup.
This one may add actions to existings action group programaticaly.

But the best way to do it - is using XML descriptor.

Thanks!
--
Alexey Efimov, Java Developer
Tops BI


0
Comment actions Permalink

Have a look at "ActionManager.xml" in resources.jar.
Lists all predefined actions and groups.

0
Comment actions Permalink

Hi Alexey,

Thanks for the quick reply - but what I meant was actually discovering which groups are already
defined in IDEA (e.g. what is the ID of "Analyze" menu).

Chris Sherrat has pointed out I can take a look at ActionManager.xml in the resources.jar - which
seems good enough for my needs.

Thanks a lot,
Arik.


Alexey Efimov wrote:

Hello Arik,

AK> Speaking of which - is there an easy way to discover (not
AK> necessarily programmaticaly) which groups IDEA already has?
AK> AK> For example, I wanted to add an action to the "Analyze" menu,
and in
AK> the end I had to resort to running in debug mode and inspecting the
AK> actionManager's fields to find it out...
AK> AK> Is there an easier way? Perhaps ActionManager.getGroups or
something
AK> similar?

Programaticaly way is using ActionManager. Every action or group - is
action.
ActionGroup actionGroup = (ActionGroup)actionManager.getAction("MyActi");

If you need to add your ouw Actions - you must cast group to
DefaultActionGroup. This one may add actions to existings action group
programaticaly.

But the best way to do it - is using XML descriptor.

Thanks!
--
Alexey Efimov, Java Developer
Tops BI

0

Please sign in to leave a comment.