Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 54581 - [GlobalActions] Provide API constants for actionDefinitionIDs/commandIDs
Summary: [GlobalActions] Provide API constants for actionDefinitionIDs/commandIDs
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.5 M6   Edit
Assignee: Paul Webster CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 74569 (view as bug list)
Depends on:
Blocks: 212635 266839
  Show dependency tree
 
Reported: 2004-03-12 02:38 EST by Markus Keller CLA
Modified: 2009-03-10 12:00 EDT (History)
5 users (show)

See Also:


Attachments
EclipseUI3.4M6.html (7.92 KB, text/html)
2008-04-13 10:12 EDT, Marc R. Hoffmann CLA
no flags Details
IWorkbenchCommandConstants.java (19.24 KB, text/plain)
2008-04-13 11:01 EDT, Marc R. Hoffmann CLA
pwebster: iplog+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2004-03-12 02:38:22 EST
ActionFactory should expose actionDefinitionIDs of retargetable actions.
When clients want to register an action via

    actionBars.setGlobalActionHandler(ActionFactory.XXX.getId(), fXXXAction);

, they need to set the actionDefinitionID of the given fXXXAction to the same
actionDefinitionID as the RetargetAction created by the ActionFactory in order
to see keybindings when the same action is shown in the context menu.

Since the actionDefinitionID cannot be changed without breaking clients, it
would be best to expose it. Today, clients have to look at the initializer of
the ActionFactory constant and copy-paste the actionDefinitionID from there (or
look at the command id in some plugin.xml, but that's always the same).
Comment 1 Dani Megert CLA 2004-11-03 14:03:00 EST
*** Bug 74569 has been marked as a duplicate of this bug. ***
Comment 2 Markus Keller CLA 2005-06-29 11:59:41 EDT
Any plans to address this issue in 3.2?
Comment 3 Douglas Pollock CLA 2005-06-29 12:04:26 EDT
No plans at the moment.
Comment 4 Nick Edgar CLA 2005-06-30 10:16:29 EDT
The action factory actions set their own actionDefinitionId (either in the
factory, or the action itself).  It may still make sense to document these so
that clients can define their own key binding extensions without having to
grovel for the constant.
Comment 5 Markus Keller CLA 2005-11-22 11:43:53 EST
Some of the constants are available in IWorkbenchActionDefinitionIds, but some are missing there (refresh), have another name (find/replace), or are different (revert vs. revert to saved).
Comment 6 Michael Van Meekeren CLA 2006-04-21 14:05:42 EDT
Moving Dougs bugs
Comment 7 Paul Webster CLA 2007-02-16 11:11:11 EST
This is interesting in that we definitely should be publishing command ids that are API, especially for the global retargetable actions like COPY, PASTE, etc.

ActionFactory is probably not the place to do it... with the changes in 3.3 it will return a CommandAction that has no action definition ID at all.

Later,
PW
Comment 8 Markus Keller CLA 2007-02-16 12:21:13 EST
> ActionFactory is probably not the place to do it... with the changes in 3.3 it
> will return a CommandAction that has no action definition ID at all.

I don't care too much where the command IDs are defined. However, making ActionFactory return an Action without an actionDefinitionID would be a breaking change (e.g. for clients using the workaround from bug 74569).
Comment 9 Paul Webster CLA 2007-02-16 12:25:18 EST
Sigh ... I won't pull the rug out.

PW
Comment 10 Markus Keller CLA 2007-06-19 05:49:17 EDT
Could this please be fixed in 3.4?
Comment 11 Paul Webster CLA 2007-06-19 06:41:12 EDT
I'd like to publish a list of commands that the platform supports, so lets do it in 3.4.

PW
Comment 12 Markus Keller CLA 2007-12-05 05:32:40 EST
Adapting summary, since there should be API for all non-internal actionDefinitionIDs / commandIDs defined by a plug-in.

A good new example of why we really need this is the proliferation of 
"org.eclipse.ui.navigate.linkWithEditor" manifest strings to support bug 79581.
Comment 13 Markus Keller CLA 2008-01-09 11:11:40 EST
> Target Milestone: 3.4
Shouldn't we try to get APIs done for M5?
Comment 14 Paul Webster CLA 2008-01-09 12:10:29 EST
(In reply to comment #13)
> > Target Milestone: 3.4
> Shouldn't we try to get APIs done for M5?

yes, but other more important API has pushed this down the list.

PW
Comment 15 Dani Megert CLA 2008-02-12 02:05:25 EST
Paul, M6 is API freeze, so what should tagging this to M7 tell us? ;-)
Comment 16 Marc R. Hoffmann CLA 2008-04-13 10:07:23 EDT
I'm currently working an an Eclipse corner article (bug 223445) about the command framework. In this article I encourage people to re-use built-in commands (e.g. "org.eclipse.ui.edit.delete"). For registering local handlers you need the command ids -- constants would be great!

I wrote a little script to extract all command ids from the org.eclipse.ui plugin and created an HTML table for the article (see attachment).
Comment 17 Marc R. Hoffmann CLA 2008-04-13 10:12:45 EDT
Created attachment 95831 [details]
EclipseUI3.4M6.html
Comment 18 Marc R. Hoffmann CLA 2008-04-13 11:00:52 EDT
Using the same script I generated the file IWorkbenchCommandConstants.java containing all commands defined in org.eclipse.ui. See attachment.
Comment 19 Marc R. Hoffmann CLA 2008-04-13 11:01:43 EDT
Created attachment 95834 [details]
IWorkbenchCommandConstants.java
Comment 20 Paul Webster CLA 2009-03-02 13:51:00 EST
Released an initial cut to HEAD >20090302

More constants can be added (some in the next 4 days, others in 3.6 :-)

PW
Comment 21 Marc R. Hoffmann CLA 2009-03-03 10:34:49 EST
Hi Paul,

thanks for adopting the constants to the API. In your latest commit you removed some of the global command ids again -- which would have been be useful to register local handlers for view specific implementations, some examples:

* org.eclipse.ui.edit.findReplace

  E.g. custom local finders, to search an entry in a long table or an element in
  a graphical editor.

* org.eclipse.ui.navigate.goInto
* org.eclipse.ui.navigate.up

  Usefull also to navigate in custom tree views.


In my current project we make heavy use of these and other predefined commands. Having them in the API would be great!

-marc
Comment 22 Paul Webster CLA 2009-03-03 10:40:29 EST
(In reply to comment #21)
> Hi Paul,

Hi Marc,

If you have those 3 specific ones that you need, I can add them back.  I didn't see a usecase for the navigate ones and thought that findReplace was tied to a more framework type action (as opposed to a retarget action).

PW
Comment 23 Marc R. Hoffmann CLA 2009-03-03 11:30:32 EST
Hi Paul,

yes, these are the ones our application has a use case for.

On the other hand command ids are used in different places within the Eclipse platform code itself, for example 

  org.eclipse.ui.fieldassist.ContentAssistCommandAdapter.CONTENT_PROPOSAL_COMMAND

If there is a central constants class for command ids, maybe all constants should move there replacing such private definitions.

-marc

Comment 24 Paul Webster CLA 2009-03-10 12:00:49 EDT
In I20090310-0100
PW