KeyBinding for delete [message #1005917] |
Tue, 29 January 2013 10:00  |
Eclipse User |
|
|
|
Hi,
I am working with a RCP application. I have defined my scheme extending from org.eclipse.ui.defaultAcceleratorConfiguration.
I have defined key for command org.eclipse.ui.edit.delete(M2+DEL).
In my view(containing treeviewer) when user press delete then action is performed but i want it to be performed with (shift + delete) as defined in scheme.
If user tries edit menu then short cut for delete is shift + delete, then why delete key is still working as shortcut?
Do you know what is problematic here?
Cheers,
[Updated on: Tue, 29 January 2013 10:03] by Moderator Report message to a moderator
|
|
|
|
Re: KeyBinding for delete [message #1005933 is a reply to message #1005922] |
Tue, 29 January 2013 10:48   |
Eclipse User |
|
|
|
Hi,
Yes i am running my product with my defined scheme(plugin_customization.ini file is added). Actually i have some other key definitions as well and they are working fine but not delete.
<extension
point="org.eclipse.ui.bindings">
<scheme
id="MyScheme"
name="MyScheme"
parentId="org.eclipse.ui.defaultAcceleratorConfiguration">
</scheme>
<key
commandId="org.eclipse.ui.file.saveAll"
schemeId="MyScheme"
sequence="M1+S">
</key>
<key
commandId="org.eclipse.ui.edit.delete"
schemeId="MyScheme"
sequence="M2+DEL">
</key>
</extension>
This is define in main plugin and my view is constructed by other plugin and main pluigin contains all other plugins as dependency.
thanks!
|
|
|
Re: KeyBinding for delete [message #1005939 is a reply to message #1005933] |
Tue, 29 January 2013 10:59   |
Eclipse User |
|
|
|
Do you have this code in your ActionBarAdvisor class?
@Override
protected void makeActions(final IWorkbenchWindow window) {
// Creates the actions and registers them.
// Registering is needed to ensure that key bindings work.
// The corresponding commands keybindings are defined in the plugin.xml
// file.
// Registering also provides automatic disposal of the actions when
// the window is closed.
register(ActionFactory.UNDO.create(window));
register(ActionFactory.REDO.create(window));
register(ActionFactory.DELETE.create(window));
...
}
as defined in https://bugs.eclipse.org/bugs/show_bug.cgi?id=270007
|
|
|
|
|
Re: KeyBinding for delete [message #1005972 is a reply to message #1005964] |
Tue, 29 January 2013 12:49   |
Eclipse User |
|
|
|
protected void fillMenuBar(IMenuManager menuBar) {
MenuManager fileMenu = new MenuManager("&File", "file");
MenuManager editMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
menuBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
menuBar.add(fileMenu);
menuBar.add(editMenu);
fileMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
fileMenu.add(exitAction);
// Edit
editMenu.add(undoAction);
editMenu.add(redoAction);
editMenu.add(deleteAction);
editMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}
|
|
|
|
Re: KeyBinding for delete [message #1005980 is a reply to message #1005975] |
Tue, 29 January 2013 13:16   |
Eclipse User |
|
|
|
In the same class.. in makeActions method. Here comes rest of the class
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {
public static final String TOOLBAR_MAIN = "main";
public static final String TOOLBAR_EDIT = "edit";
private IWorkbenchAction exitAction;
private IWorkbenchAction saveAllAction;
private IWorkbenchAction saveAsAction;
private IWorkbenchAction undoAction;
private IWorkbenchAction redoAction;
private IWorkbenchAction deleteAction;
public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
super(configurer);
}
protected void makeActions(IWorkbenchWindow window) {
exitAction = ActionFactory.QUIT.create(window);
undoAction = ActionFactory.UNDO.create(window);
redoAction = ActionFactory.REDO.create(window);
deleteAction = ActionFactory.DELETE.create(window);
saveAllAction = ActionFactory.SAVE_ALL.create(window);
saveAsAction = ActionFactory.SAVE_AS.create(window);
register(undoAction);
register(redoAction);
register(deleteAction);
register(saveAsAction);
register(ActionFactory.CUT.create(window));
register(ActionFactory.COPY.create(window));
register(ActionFactory.PASTE.create(window));
register(ActionFactory.SELECT_ALL.create(window));
}
}
thanks alot for helping
|
|
|
|
Re: KeyBinding for delete [message #1005990 is a reply to message #1005986] |
Tue, 29 January 2013 13:42   |
Eclipse User |
|
|
|
This is from view class.
@Override
public void init(IViewSite site) throws PartInitException {
super.init(site);
IActionBars bars = site.getActionBars();
UndoAction actionUndo = new UndoAction(site.getWorkbenchWindow(), this);
RedoAction actionRedo = new RedoAction(site.getWorkbenchWindow(), this);
deleteAction = new DeleteAction(site.getWorkbenchWindow(), this);
bars.setGlobalActionHandler(ActionFactory.DELETE.getId(), deleteAction);
bars.setGlobalActionHandler(ActionFactory.UNDO.getId(), actionUndo);
bars.setGlobalActionHandler(ActionFactory.REDO.getId(), actionRedo);
bars.updateActionBars();
}
this is action class
public class DeleteAction extends Action implements ISelectionListener {
private IWorkbenchWindow window;
private IWorkbenchPart part;
private IUndoContext context;
public DeleteAction(IWorkbenchWindow window, IWorkbenchPart part) {
this.window = window;
this.part = part;
setActionDefinitionId(ActionFactory.DELETE.getId());
window.getSelectionService().addSelectionListener(this);
setText("Delete View");
setEnabled(false);
}
@Override
public void run() {...
....
}
}
thanks!
|
|
|
|
Re: KeyBinding for delete [message #1005993 is a reply to message #1005991] |
Tue, 29 January 2013 13:56   |
Eclipse User |
|
|
|
Hi,
I have tried that but it does not make any difference... and when i select the object to delete and open edit menu then delete menu item's short cut is shift + delete which is correct one but still delete key works and other key definition for saveAll action works fine.. it is very strange for me. Can you predict what is wrong here?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.06280 seconds