1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 06:32:10 +02:00

Bug 354793 - References in Project key binding missing

This commit is contained in:
Anton Leherbauer 2011-09-02 11:19:58 +02:00
parent 5af07f83aa
commit 4a04387f57
7 changed files with 185 additions and 95 deletions

View file

@ -94,11 +94,19 @@ ActionDefinition.opendecl.description= Open an editor on the selected element's
ActionDefinition.opencview.name= Show in C/C++ Project view
ActionDefinition.opencview.description= Show the selected resource in the C/C++ Project view
ActionDefinition.finddecl.name= Find Declaration
ActionDefinition.finddecl.description= Find Declaration
ActionDefinition.finddecl.name= Declaration
ActionDefinition.finddecl.description= Search for declarations of the selected element in the workspace
ActionDefinition.finddecl.project.name= Declaration in Project
ActionDefinition.finddecl.project.description= Search for declarations of the selected element in the enclosing project
ActionDefinition.finddecl.workingset.name= Declaration in Working Set
ActionDefinition.finddecl.workingset.description= Search for declarations of the selected element in a working set
ActionDefinition.findrefs.name= Find References
ActionDefinition.findrefs.description= Find References
ActionDefinition.findrefs.name= References
ActionDefinition.findrefs.description= Search for references to the selected element in the workspace
ActionDefinition.findrefs.project.name= References in Project
ActionDefinition.findrefs.project.description= Search for references to the selected element in the enclosing project
ActionDefinition.findrefs.workingset.name= References in Working Set
ActionDefinition.findrefs.workingset.description= Search for references to the selected element in a working set
ActionDefinition.openCallHierarchy.name= Open Call Hierarchy
ActionDefinition.openCallHierarchy.description= Open the call hierarchy for the selected element

View file

@ -2378,11 +2378,31 @@
categoryId="org.eclipse.cdt.ui.category.source"
name="%ActionDefinition.finddecl.name"
id="org.eclipse.cdt.ui.search.finddecl"/>
<command
description="%ActionDefinition.finddecl.project.description"
categoryId="org.eclipse.cdt.ui.category.source"
name="%ActionDefinition.finddecl.project.name"
id="org.eclipse.cdt.ui.search.finddecl.project"/>
<command
description="%ActionDefinition.finddecl.workingset.description"
categoryId="org.eclipse.cdt.ui.category.source"
name="%ActionDefinition.finddecl.workingset.name"
id="org.eclipse.cdt.ui.search.finddecl.workingset"/>
<command
categoryId="org.eclipse.cdt.ui.category.source"
description="%ActionDefinition.findrefs.description"
name="%ActionDefinition.findrefs.name"
id="org.eclipse.cdt.ui.search.findrefs"/>
<command
categoryId="org.eclipse.cdt.ui.category.source"
description="%ActionDefinition.findrefs.project.description"
name="%ActionDefinition.findrefs.project.name"
id="org.eclipse.cdt.ui.search.findrefs.project"/>
<command
categoryId="org.eclipse.cdt.ui.category.source"
description="%ActionDefinition.findrefs.workingset.description"
name="%ActionDefinition.findrefs.workingset.name"
id="org.eclipse.cdt.ui.search.findrefs.workingset"/>
<command
categoryId="org.eclipse.ui.category.navigate"
description="%ActionDefinition.openCallHierarchy.description"

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 IBM Corporation and others.
* Copyright (c) 2005, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -510,6 +510,7 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
// Do this before setting input but after the initializations of the fields filtering
registerActionBars(bars);
bars.updateActionBars();
fTreeViewer.setInput(fInput);
PlatformUI.getWorkbench().getHelpSystem().setHelp(control, ICHelpContextIds.COUTLINE_VIEW);
@ -591,7 +592,9 @@ public abstract class AbstractCModelOutlinePage extends Page implements IContent
if (fRefactoringActionGroup != null) {
fRefactoringActionGroup.fillActionBars(actionBars);
}
if (fSelectionSearchGroup != null) {
fSelectionSearchGroup.fillActionBars(actionBars);
}
IMenuManager menu= actionBars.getMenuManager();
menu.add(new Separator("EndFilterGroup")); //$NON-NLS-1$

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2010 QNX Software Systems and others.
* Copyright (c) 2000, 2011 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -152,12 +152,36 @@ public interface ICEditorActionDefinitionIds extends ITextEditorActionDefinition
*/
public static final String FIND_REFS= "org.eclipse.cdt.ui.search.findrefs"; //$NON-NLS-1$
/**
* Action definition ID of the find references in project action
* (value <code>"org.eclipse.cdt.ui.search.findrefs.project"</code>).
*/
public static final String FIND_REFS_PROJECT= "org.eclipse.cdt.ui.search.findrefs.project"; //$NON-NLS-1$
/**
* Action definition ID of the find references in working set action
* (value <code>"org.eclipse.cdt.ui.search.findrefs.workingset"</code>).
*/
public static final String FIND_REFS_WORKING_SET= "org.eclipse.cdt.ui.search.findrefs.workingset"; //$NON-NLS-1$
/**
* Action definition ID of the find declarations in workspace action
* (value <code>"org.eclipse.cdt.ui.search.finddecl"</code>).
*/
public static final String FIND_DECL= "org.eclipse.cdt.ui.search.finddecl"; //$NON-NLS-1$
/**
* Action definition ID of the find declarations in project action
* (value <code>"org.eclipse.cdt.ui.search.finddecl.project"</code>).
*/
public static final String FIND_DECL_PROJECT= "org.eclipse.cdt.ui.search.finddecl.project"; //$NON-NLS-1$
/**
* Action definition ID of the find declarations in working set action
* (value <code>"org.eclipse.cdt.ui.search.finddecl.workingset"</code>).
*/
public static final String FIND_DECL_WORKING_SET= "org.eclipse.cdt.ui.search.finddecl.workingset"; //$NON-NLS-1$
/**
* Action definition ID of the navigate -> open type hierarchy action
* (value <code>"org.eclipse.cdt.ui.edit.text.c.open.type.hierarchy"</code>).

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others.
* Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -21,6 +21,7 @@ import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.search.ui.IContextMenuConstants;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.actions.ActionGroup;
@ -45,8 +46,11 @@ public class DeclarationsSearchGroup extends ActionGroup {
public DeclarationsSearchGroup(IWorkbenchSite site) {
fFindDeclarationsAction= new FindDeclarationsAction(site);
fFindDeclarationsAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_DECL);
fFindDeclarationsProjectAction = new FindDeclarationsProjectAction(site);
fFindDeclarationsProjectAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_DECL_PROJECT);
fFindDeclarationsInWorkingSetAction = new FindDeclarationsInWorkingSetAction(site,null);
fFindDeclarationsInWorkingSetAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_DECL_WORKING_SET);
fSite = site;
}
/**
@ -57,13 +61,14 @@ public class DeclarationsSearchGroup extends ActionGroup {
fFindDeclarationsAction= new FindDeclarationsAction(editor);
fFindDeclarationsAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_DECL);
if (editor != null){
editor.setAction(ICEditorActionDefinitionIds.FIND_DECL, fFindDeclarationsAction);
}
fFindDeclarationsProjectAction = new FindDeclarationsProjectAction(editor);
fFindDeclarationsProjectAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_DECL_PROJECT);
editor.setAction(ICEditorActionDefinitionIds.FIND_DECL_PROJECT, fFindDeclarationsProjectAction);
fFindDeclarationsInWorkingSetAction = new FindDeclarationsInWorkingSetAction(editor,null);
fFindDeclarationsInWorkingSetAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_DECL_WORKING_SET);
editor.setAction(ICEditorActionDefinitionIds.FIND_DECL_WORKING_SET, fFindDeclarationsInWorkingSetAction);
}
/*
* Method declared on ActionGroup.
@ -93,6 +98,13 @@ public class DeclarationsSearchGroup extends ActionGroup {
}
}
@Override
public void fillActionBars(IActionBars actionBars) {
actionBars.setGlobalActionHandler(ICEditorActionDefinitionIds.FIND_DECL, fFindDeclarationsAction);
actionBars.setGlobalActionHandler(ICEditorActionDefinitionIds.FIND_DECL_PROJECT, fFindDeclarationsProjectAction);
actionBars.setGlobalActionHandler(ICEditorActionDefinitionIds.FIND_DECL_WORKING_SET, fFindDeclarationsInWorkingSetAction);
}
private FindAction[] getWorkingSetActions() {
ArrayList<FindAction> actions= new ArrayList<FindAction>(CSearchUtil.LRU_WORKINGSET_LIST_SIZE);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others.
* Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -16,6 +16,7 @@ import java.util.Iterator;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.search.ui.IContextMenuConstants;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.IWorkingSet;
import org.eclipse.ui.actions.ActionGroup;
@ -37,8 +38,11 @@ public class ReferencesSearchGroup extends ActionGroup {
public ReferencesSearchGroup(IWorkbenchSite site) {
fFindRefsAction= new FindRefsAction(site);
fFindRefsAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_REFS);
fFindRefsProjectAction = new FindRefsProjectAction(site);
fFindRefsProjectAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_REFS_PROJECT);
fFindRefsInWorkingSetAction = new FindRefsInWorkingSetAction(site, null);
fFindRefsInWorkingSetAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_REFS_WORKING_SET);
fSite=site;
}
@ -50,11 +54,13 @@ public class ReferencesSearchGroup extends ActionGroup {
fFindRefsAction= new FindRefsAction(editor);
fFindRefsAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_REFS);
if (editor != null){
editor.setAction(ICEditorActionDefinitionIds.FIND_REFS, fFindRefsAction);
}
fFindRefsProjectAction = new FindRefsProjectAction(editor);
fFindRefsProjectAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_REFS_PROJECT);
editor.setAction(ICEditorActionDefinitionIds.FIND_REFS_PROJECT, fFindRefsProjectAction);
fFindRefsInWorkingSetAction = new FindRefsInWorkingSetAction(editor, null);
fFindRefsInWorkingSetAction.setActionDefinitionId(ICEditorActionDefinitionIds.FIND_REFS_WORKING_SET);
editor.setAction(ICEditorActionDefinitionIds.FIND_REFS_WORKING_SET, fFindRefsInWorkingSetAction);
}
/*
@ -88,6 +94,13 @@ public class ReferencesSearchGroup extends ActionGroup {
}
@Override
public void fillActionBars(IActionBars actionBars) {
actionBars.setGlobalActionHandler(ICEditorActionDefinitionIds.FIND_REFS, fFindRefsAction);
actionBars.setGlobalActionHandler(ICEditorActionDefinitionIds.FIND_REFS_PROJECT, fFindRefsProjectAction);
actionBars.setGlobalActionHandler(ICEditorActionDefinitionIds.FIND_REFS, fFindRefsAction);
}
private FindAction[] getWorkingSetActions() {
ArrayList<FindAction> actions= new ArrayList<FindAction>(CSearchUtil.LRU_WORKINGSET_LIST_SIZE);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation and others.
* Copyright (c) 2004, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -12,10 +12,12 @@ package org.eclipse.cdt.internal.ui.search.actions;
import java.util.List;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.actions.ActionGroup;
import org.eclipse.ui.part.Page;
@ -32,7 +34,7 @@ public class SelectionSearchGroup extends ActionGroup {
private ReferencesSearchGroup fRefSearchGroup;
public SelectionSearchGroup(CEditor editor){
//TODO: Assert editor not null
Assert.isNotNull(editor);
fEditor= editor;
fDeclarationsSearchGroup= new DeclarationsSearchGroup(fEditor);
@ -62,6 +64,14 @@ public class SelectionSearchGroup extends ActionGroup {
fRefSearchGroup.fillContextMenu(menu);
}
@Override
public void fillActionBars(IActionBars actionBars) {
if (fEditor == null) {
fDeclarationsSearchGroup.fillActionBars(actionBars);
fRefSearchGroup.fillActionBars(actionBars);
}
}
public static boolean canActionBeAdded(ISelection selection) {
if(selection instanceof ITextSelection) {
return (((ITextSelection)selection).getLength() > 0);