Bug 44156 - [Commands] parameters: provide M-x-like command interface
Summary: [Commands] parameters: provide M-x-like command interface
Status: ASSIGNED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P5 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2003-10-03 16:16 EDT by Tom Roche CLA
Modified: 2019-09-06 15:32 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Roche CLA 2003-10-03 16:16:28 EDT
I believe Eclipse usability could be enhanced by providing an
interface similar to Emacs' M-x (or Alt-x) name-of-command gesture.
What I mean:

It was suggested that I might find the fix to another bug by moving
from 3.0-M3 to 3.0-M3-I20030930, so I moved. While coding Java, I
wanted to open a class which I knew by name, so I did C-S-t to get the
Open Type dialog, as I had for many versions, including 3.0-M3. C-S-t
did nothing. So I went to prefs>Workbench>Keys to try to track it
down. (Note that this particular task would be easier to accomplish if
one could print the keybindings

https://bugs.eclipse.org/bugs/show_bug.cgi?id=37439

but that is not implemented.) I spent awhile scrolling through the
lists but failed to find it--no doubt I did not choose the appropriate
category.

In Emacs, one can invoke a command directly (M-x name-of-command), as
well as by keybinding. This is useful, because often the name of the
command (which can be tab-completed in the minibuffer) is more
mnemonic than the keybinding.

Why not provide similar functionality in Eclipse? M-x could bring up a
simple text dialog into which the user could enter a command. The
names of the command could be the same as those currently exposed in
the Workbench>Keys preference page.

This would also be a useful interface for user-defined commands ...
Comment 1 Chris McLaren CLA 2003-10-06 10:47:38 EDT
agreed. there is ongoing work (M5?) for rearchitecting commands/actions/etc. most of this work is done now. the api gives a mechanism to programmatically execute a command. once this is complete, it would be easy to write an action for M-x to open a command dialog (with look ahead and autocomplete). i'll need to hang on to this for a while..
Comment 2 Ed Burnette CLA 2004-11-29 12:14:30 EST
Can you provide a link for the API for running commands/actions/etc. by name?
Comment 3 Douglas Pollock CLA 2004-11-29 15:40:27 EST
There is no easy-to-use API to look-up commands by name.  However, you can do 
the following: 
 
    IWorkbenchCommandSupport support = workbench.getCommandSupport(); 
    ICommandManager manager = support.getCommandManager(); 
    Set commandIds = manager.getDefinedCommandIds(); 
    Iterator commandIdItr = commandIds.iterator(); 
    Map commandsByName = new HashMap(); 
 
    while (commandIdItr.hasNext()) { 
        String commandId = (String) commandIdItr.next(); 
        ICommand command = manager.getCommand(commandId); 
        try { 
            commandsByName.put(command.getName(), command); 
        } catch (NotDefinedException e) { 
            // This shouldn't happen 
        } 
    } 
 
If the object building such a map has a long lifespan, then it should listen to 
the command manager for changes (manager.addCommandListener()) 
Comment 4 Douglas Pollock CLA 2005-02-21 15:28:57 EST
I would like to consider this for 3.1, though it is definitely lower on my list
of priorities.  (i.e., don't get your hopes up)
Comment 5 Ed Burnette CLA 2005-03-25 19:21:57 EST
Some of this API is deprecated in 3.1M5a, see bug 89149 for my attempt to use
the new API.
Comment 6 Douglas Pollock CLA 2005-04-28 15:01:29 EDT
Deferring from 3.0
Comment 7 Michael Van Meekeren CLA 2006-04-21 13:21:28 EDT
Moving Dougs bugs
Comment 8 Paul Webster CLA 2006-09-28 10:59:49 EDT
There are currently no plans to work on this feature.

PW
Comment 9 Paul Webster CLA 2007-03-18 10:39:26 EDT
While there are no plans to work on this feature, check out the new CTRL+E dialog in 3.3.

It is a filtered tree dialog that brings together a number of sources, including open editors, Commands, a number of menu items, etc.

PW
Comment 10 Denis Roy CLA 2007-06-22 09:32:32 EDT
Changes requested on bug 193523
Comment 11 Mark Feber CLA 2009-06-16 19:31:34 EDT
This behavior is available in the current release of the Emacs+ plugin.
See:
http://www.eclipseplugincentral.com/modules.php?op=modload&name=Web_Links&file=index&req=viewlink&cid=1442

The relevant portion from the doc reads:

Command Execution - 

    * Execute Extended Command (Alt-X): Reads a command name from the 
      minibuffer (with completion and wildcards) and executes it

[Additional info: 


Execute Extended Command (Alt-X):  Reads a command name from the minibuffer (with completion & wildcards) and executes it.  The status area is used as the minibuffer.  Entering TAB or SPACE in the minibuffer displays the set of possible completions in a pop-up.

Command Selection - Command names follow the Emacs convention of words separated by hyphens (in the case of multiple commands with the same name - see Category below - a number is appended to make the name unique).  The set of commands available in a particular context is determined by:

    * the current editor
    * the set of command categories in force
    * commands must have a handler and be enabled
    * commands must not have any required arguments
      (NB: Many useful editing commands obtain the selected text once the command is invoked, not as an argument.)

Not all commands that the Eclipse command service makes available at a given point necessarily have an effect.

Wildcards - Meta X provides simple wildcarding to assist in locating the desired command.  The wildcard characters are * and ? and have their usual meaning:

    * * any character zero or more times
    * ? any character once

Invoking completion on a string with wildcards will pop up the set of all matching commands and replace the minibuffer text with their initial substring (which may be the empty string).

Mouse - The completions pop-up provides hover text for each command.  Double clicking on a command invokes it.

Category Selection - In Eclipse, commands are associated with categories.  In the context of text editing some categories are more useful than others.  M-X uses an initial set of Eclipse categories which are configurable on the preference page.  In the case where multiple categories provide commands with the same name, the unique identifier, along with any provided documentation, can be determined using the hover text.
Comment 12 Eclipse Webmaster CLA 2019-09-06 15:32:41 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.