mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix CN global short-cuts
This commit is contained in:
parent
9b82414491
commit
9adf9270de
1 changed files with 13 additions and 4 deletions
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.ui.navigator;
|
||||||
|
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.dnd.Clipboard;
|
import org.eclipse.swt.dnd.Clipboard;
|
||||||
|
@ -22,6 +23,7 @@ import org.eclipse.swt.widgets.Tree;
|
||||||
import org.eclipse.ui.IActionBars;
|
import org.eclipse.ui.IActionBars;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
import org.eclipse.ui.actions.ActionContext;
|
||||||
import org.eclipse.ui.actions.ActionFactory;
|
import org.eclipse.ui.actions.ActionFactory;
|
||||||
import org.eclipse.ui.actions.ActionGroup;
|
import org.eclipse.ui.actions.ActionGroup;
|
||||||
import org.eclipse.ui.actions.DeleteResourceAction;
|
import org.eclipse.ui.actions.DeleteResourceAction;
|
||||||
|
@ -81,9 +83,17 @@ public class CNavigatorRefactorActionGroup extends ActionGroup {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.ui.actions.ActionGroup#setContext(org.eclipse.ui.actions.ActionContext)
|
||||||
|
*/
|
||||||
|
public void setContext(ActionContext context) {
|
||||||
|
// convert non-IResource to IResources on the fly
|
||||||
|
ISelection selection = SelectionConverter.convertSelectionToResources(context.getSelection());
|
||||||
|
super.setContext(new ActionContext(selection));
|
||||||
|
}
|
||||||
|
|
||||||
public void fillContextMenu(IMenuManager menu) {
|
public void fillContextMenu(IMenuManager menu) {
|
||||||
IStructuredSelection selection = SelectionConverter
|
IStructuredSelection selection = (IStructuredSelection)getContext().getSelection();
|
||||||
.convertSelectionToResources(getContext().getSelection());
|
|
||||||
boolean anyResourceSelected = !selection.isEmpty()
|
boolean anyResourceSelected = !selection.isEmpty()
|
||||||
&& ResourceSelectionUtil.allResourcesAreOfType(selection,
|
&& ResourceSelectionUtil.allResourcesAreOfType(selection,
|
||||||
IResource.PROJECT | IResource.FOLDER | IResource.FILE);
|
IResource.PROJECT | IResource.FOLDER | IResource.FILE);
|
||||||
|
@ -186,8 +196,7 @@ public class CNavigatorRefactorActionGroup extends ActionGroup {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateActionBars() {
|
public void updateActionBars() {
|
||||||
IStructuredSelection selection = (IStructuredSelection) getContext()
|
IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
|
||||||
.getSelection();
|
|
||||||
|
|
||||||
copyAction.selectionChanged(selection);
|
copyAction.selectionChanged(selection);
|
||||||
pasteAction.selectionChanged(selection);
|
pasteAction.selectionChanged(selection);
|
||||||
|
|
Loading…
Add table
Reference in a new issue