mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fix for 74425: [Search] C/C++ Search missing Enclosing Project scope
Fix for 102926: Turning on index includes in ctags property page does nothing Fix for 102927: Add menu item to force reindex.
This commit is contained in:
parent
aec1c2f69e
commit
54101f2441
13 changed files with 321 additions and 12 deletions
|
@ -1064,13 +1064,14 @@
|
||||||
name="CSearchPage"
|
name="CSearchPage"
|
||||||
point="org.eclipse.search.searchPages">
|
point="org.eclipse.search.searchPages">
|
||||||
<page
|
<page
|
||||||
showScopeSection="true"
|
canSearchEnclosingProjects="true"
|
||||||
label="%CSearchPage.label"
|
class="org.eclipse.cdt.internal.ui.search.CSearchPage"
|
||||||
extensions="c:90,cpp:90, cxx:90, cc:90,C:90, h:90, hh:90, hpp:90, H:90"
|
extensions="c:90,cpp:90, cxx:90, cc:90,C:90, h:90, hh:90, hpp:90, H:90"
|
||||||
icon="icons/obj16/csearch_obj.gif"
|
icon="icons/obj16/csearch_obj.gif"
|
||||||
class="org.eclipse.cdt.internal.ui.search.CSearchPage"
|
id="org.eclipse.cdt.ui.CSearchPage"
|
||||||
sizeHint="460, 160"
|
label="%CSearchPage.label"
|
||||||
id="org.eclipse.cdt.ui.CSearchPage">
|
showScopeSection="true"
|
||||||
|
sizeHint="460, 160">
|
||||||
</page>
|
</page>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
import org.eclipse.cdt.internal.ui.IContextMenuConstants;
|
||||||
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
|
import org.eclipse.cdt.internal.ui.actions.SelectionConverter;
|
||||||
import org.eclipse.cdt.internal.ui.editor.OpenIncludeAction;
|
import org.eclipse.cdt.internal.ui.editor.OpenIncludeAction;
|
||||||
|
import org.eclipse.cdt.internal.ui.search.actions.AddToIndexAction;
|
||||||
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
|
import org.eclipse.cdt.internal.ui.search.actions.SelectionSearchGroup;
|
||||||
import org.eclipse.cdt.ui.actions.CustomFiltersActionGroup;
|
import org.eclipse.cdt.ui.actions.CustomFiltersActionGroup;
|
||||||
import org.eclipse.cdt.ui.actions.RefactoringActionGroup;
|
import org.eclipse.cdt.ui.actions.RefactoringActionGroup;
|
||||||
|
@ -77,6 +78,8 @@ public class MainActionGroup extends CViewActionGroup {
|
||||||
WorkingSetFilterActionGroup workingSetGroup;
|
WorkingSetFilterActionGroup workingSetGroup;
|
||||||
CustomFiltersActionGroup fCustomFiltersActionGroup;
|
CustomFiltersActionGroup fCustomFiltersActionGroup;
|
||||||
|
|
||||||
|
AddToIndexAction addToIndexAction;
|
||||||
|
|
||||||
SelectionSearchGroup selectionSearchGroup;
|
SelectionSearchGroup selectionSearchGroup;
|
||||||
RefactoringActionGroup refactoringActionGroup;
|
RefactoringActionGroup refactoringActionGroup;
|
||||||
|
|
||||||
|
@ -163,6 +166,7 @@ public class MainActionGroup extends CViewActionGroup {
|
||||||
selectionSearchGroup = new SelectionSearchGroup(getCView().getSite());
|
selectionSearchGroup = new SelectionSearchGroup(getCView().getSite());
|
||||||
refactoringActionGroup = new RefactoringActionGroup(getCView().getSite(), null);
|
refactoringActionGroup = new RefactoringActionGroup(getCView().getSite(), null);
|
||||||
|
|
||||||
|
addToIndexAction = new AddToIndexAction(getCView().getSite());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -183,6 +187,9 @@ public class MainActionGroup extends CViewActionGroup {
|
||||||
menu.add(importAction);
|
menu.add(importAction);
|
||||||
exportAction.selectionChanged(resources);
|
exportAction.selectionChanged(resources);
|
||||||
menu.add(exportAction);
|
menu.add(exportAction);
|
||||||
|
//Can be added once support for manually adding external files to index is established
|
||||||
|
/*menu.add(new Separator());
|
||||||
|
menu.add(addToIndexAction);*/
|
||||||
menu.add(new Separator());
|
menu.add(new Separator());
|
||||||
addSearchMenu(menu, celements);
|
addSearchMenu(menu, celements);
|
||||||
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
|
menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
|
||||||
|
@ -198,6 +205,8 @@ public class MainActionGroup extends CViewActionGroup {
|
||||||
menu.add(new Separator());
|
menu.add(new Separator());
|
||||||
buildGroup.fillContextMenu(menu);
|
buildGroup.fillContextMenu(menu);
|
||||||
menu.add(new Separator());
|
menu.add(new Separator());
|
||||||
|
menu.add(addToIndexAction);
|
||||||
|
menu.add(new Separator());
|
||||||
refactorGroup.fillContextMenu(menu);
|
refactorGroup.fillContextMenu(menu);
|
||||||
menu.add(new Separator());
|
menu.add(new Separator());
|
||||||
importAction.selectionChanged(resources);
|
importAction.selectionChanged(resources);
|
||||||
|
|
|
@ -61,12 +61,18 @@ SearchUtil.workingSetConcatenation= {0}, {1}
|
||||||
CSearch.FindDeclarationAction.label= &Workspace
|
CSearch.FindDeclarationAction.label= &Workspace
|
||||||
CSearch.FindDeclarationAction.tooltip= Search for Declarations of the Selected Element in the Workspace
|
CSearch.FindDeclarationAction.tooltip= Search for Declarations of the Selected Element in the Workspace
|
||||||
|
|
||||||
|
CSearch.FindDeclarationsProjectAction.label = &Project
|
||||||
|
CSearch.FindDeclarationsProjectAction.tooltip = Search for Declarations of the Selected Element in the current project
|
||||||
|
|
||||||
CSearch.FindDeclarationsInWorkingSetAction.label= Working &Set...
|
CSearch.FindDeclarationsInWorkingSetAction.label= Working &Set...
|
||||||
CSearch.FindDeclarationsInWorkingSetAction.tooltip= Search for Declarations of the Selected Element in a Working Set
|
CSearch.FindDeclarationsInWorkingSetAction.tooltip= Search for Declarations of the Selected Element in a Working Set
|
||||||
|
|
||||||
CSearch.FindReferencesAction.label= &Workspace
|
CSearch.FindReferencesAction.label= &Workspace
|
||||||
CSearch.FindReferencesAction.tooltip= Search for References to the Selected Element in the Workspace
|
CSearch.FindReferencesAction.tooltip= Search for References to the Selected Element in the Workspace
|
||||||
|
|
||||||
|
CSearch.FindReferencesProjectAction.label= &Project
|
||||||
|
CSearch.FindReferencesProjectAction.tooltip= Search for References to the Selected Element in the current project
|
||||||
|
|
||||||
CSearch.FindReferencesInWorkingSetAction.label= Working &Set...
|
CSearch.FindReferencesInWorkingSetAction.label= Working &Set...
|
||||||
CSearch.FindReferencesInWorkingSetAction.tooltip= Search for References to the Selected Element in a Working Set
|
CSearch.FindReferencesInWorkingSetAction.tooltip= Search for References to the Selected Element in a Working Set
|
||||||
|
|
||||||
|
@ -99,6 +105,7 @@ WorkspaceScope= Workspace
|
||||||
WorkingSetScope= Working Set - {0}
|
WorkingSetScope= Working Set - {0}
|
||||||
SelectionScope= Selection
|
SelectionScope= Selection
|
||||||
HierarchyScope= Hierarchy - {0}
|
HierarchyScope= Hierarchy - {0}
|
||||||
|
ProjectScope = Project
|
||||||
|
|
||||||
CElementLabels.concat_string=\ -\
|
CElementLabels.concat_string=\ -\
|
||||||
CElementLabels.comma_string=,\
|
CElementLabels.comma_string=,\
|
||||||
|
@ -130,3 +137,7 @@ CSearchResultPage.groupby_class.tooltip=Group by Class
|
||||||
# Search Page Indexer warnings
|
# Search Page Indexer warnings
|
||||||
CSearchPage.warning.indexernoprojects=Index not enabled on any projects
|
CSearchPage.warning.indexernoprojects=Index not enabled on any projects
|
||||||
CSearchPage.warning.indexersomeprojects=Index not enabled on some projects
|
CSearchPage.warning.indexersomeprojects=Index not enabled on some projects
|
||||||
|
|
||||||
|
# Add To Index Action
|
||||||
|
ActionDefinition.addToIndex.name= Add To Index
|
||||||
|
ActionDefinition.addToIndex.description= Add file to index
|
|
@ -93,6 +93,14 @@ public class CSearchPage extends DialogPage implements ISearchPage, ICSearchCons
|
||||||
String scopeDescription = ""; //$NON-NLS-1$
|
String scopeDescription = ""; //$NON-NLS-1$
|
||||||
|
|
||||||
switch( getContainer().getSelectedScope() ) {
|
switch( getContainer().getSelectedScope() ) {
|
||||||
|
case ISearchPageContainer.SELECTED_PROJECTS_SCOPE:
|
||||||
|
if( fStructuredSelection != null && fStructuredSelection.iterator().hasNext() ){
|
||||||
|
scopeDescription = CSearchMessages.getString("ProjectScope"); //$NON-NLS-1$
|
||||||
|
scope = CSearchScopeFactory.getInstance().createEnclosingProjectScope(fStructuredSelection);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case ISearchPageContainer.SELECTION_SCOPE:
|
case ISearchPageContainer.SELECTION_SCOPE:
|
||||||
if( fStructuredSelection != null && fStructuredSelection.iterator().hasNext() ){
|
if( fStructuredSelection != null && fStructuredSelection.iterator().hasNext() ){
|
||||||
scopeDescription = CSearchMessages.getString("SelectionScope"); //$NON-NLS-1$
|
scopeDescription = CSearchMessages.getString("SelectionScope"); //$NON-NLS-1$
|
||||||
|
|
|
@ -19,6 +19,7 @@ import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
import org.eclipse.cdt.core.search.SearchEngine;
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
|
@ -133,7 +134,28 @@ public class CSearchScopeFactory {
|
||||||
return createCSearchScope( cElements );
|
return createCSearchScope( cElements );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fStructuredSelection
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public ICSearchScope createEnclosingProjectScope(IStructuredSelection fStructuredSelection) {
|
||||||
|
Set cElements = new HashSet( fStructuredSelection.size() );
|
||||||
|
|
||||||
|
Iterator iter = fStructuredSelection.iterator();
|
||||||
|
while( iter.hasNext() ){
|
||||||
|
Object tempObj = iter.next();
|
||||||
|
if ( tempObj instanceof ICElement){
|
||||||
|
ICProject cproject = ((ICElement) tempObj).getCProject();
|
||||||
|
if (cproject != null)
|
||||||
|
cElements.add(cproject);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return createCSearchScope( cElements );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param elements
|
* @param elements
|
||||||
* @param match
|
* @param match
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
package org.eclipse.cdt.internal.ui.search.actions;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
import org.eclipse.cdt.core.index.ICDTIndexer;
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
|
import org.eclipse.cdt.internal.ui.search.CSearchMessages;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.jface.action.Action;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.ui.IWorkbenchSite;
|
||||||
|
|
||||||
|
public class AddToIndexAction extends Action {
|
||||||
|
|
||||||
|
protected IWorkbenchSite fSite;
|
||||||
|
protected CEditor fEditor;
|
||||||
|
|
||||||
|
|
||||||
|
public AddToIndexAction(CEditor editor, String label, String tooltip){
|
||||||
|
fEditor = editor;
|
||||||
|
setText(label); //$NON-NLS-1$
|
||||||
|
setToolTipText(tooltip); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public AddToIndexAction(CEditor editor){
|
||||||
|
this(editor,
|
||||||
|
CSearchMessages.getString("ActionDefinition.addToIndex.name"), //$NON-NLS-1$
|
||||||
|
CSearchMessages.getString("ActionDefinition.addToIndex.description")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public AddToIndexAction(IWorkbenchSite site){
|
||||||
|
this(site,
|
||||||
|
CSearchMessages.getString("ActionDefinition.addToIndex.name"), //$NON-NLS-1$
|
||||||
|
CSearchMessages.getString("ActionDefinition.addToIndex.description")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public AddToIndexAction(IWorkbenchSite site, String label, String tooltip) {
|
||||||
|
fSite = site;
|
||||||
|
setText(label);
|
||||||
|
setToolTipText(tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
if (fEditor != null){
|
||||||
|
ICElement celement= fEditor.getInputCElement();
|
||||||
|
IResource resource = celement.getUnderlyingResource();
|
||||||
|
if (resource != null){
|
||||||
|
IProject project = resource.getProject();
|
||||||
|
if (project != null)
|
||||||
|
CCorePlugin.getDefault().getCoreModel().getIndexManager().addResource(project,resource);
|
||||||
|
}
|
||||||
|
} else if ( fSite != null) {
|
||||||
|
if (fSite.getSelectionProvider() != null ){
|
||||||
|
IStructuredSelection sel = (IStructuredSelection) fSite.getSelectionProvider().getSelection();
|
||||||
|
Iterator iter = sel.iterator();
|
||||||
|
while (iter.hasNext()){
|
||||||
|
Object element = iter.next();
|
||||||
|
if (element instanceof ICElement){
|
||||||
|
ICElement cel = (ICElement) element;
|
||||||
|
IProject proj = cel.getCProject().getProject();
|
||||||
|
IResource resource =cel.getResource();
|
||||||
|
if (proj!= null &&
|
||||||
|
resource != null){
|
||||||
|
CCorePlugin.getDefault().getCoreModel().getIndexManager().addResource(proj,resource);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Can be added to deal with external files -> but need indexer addResourceByPath support
|
||||||
|
/*else if (element instanceof ITranslationUnit){
|
||||||
|
ITranslationUnit trans = (ITranslationUnit) element;
|
||||||
|
IProject proj = trans.getCProject().getProject();
|
||||||
|
IPath path=trans.getPath();
|
||||||
|
CCorePlugin.getDefault().getCoreModel().getIndexManager().addResourceByPath(proj,path, ICDTIndexer.COMPILATION_UNIT);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -39,12 +39,14 @@ public class DeclarationsSearchGroup extends ActionGroup {
|
||||||
private IWorkbenchSite fSite;
|
private IWorkbenchSite fSite;
|
||||||
|
|
||||||
private FindDeclarationsAction fFindDeclarationsAction;
|
private FindDeclarationsAction fFindDeclarationsAction;
|
||||||
|
private FindDeclarationsProjectAction fFindDeclarationsProjectAction;
|
||||||
private FindDeclarationsInWorkingSetAction fFindDeclarationsInWorkingSetAction;
|
private FindDeclarationsInWorkingSetAction fFindDeclarationsInWorkingSetAction;
|
||||||
|
|
||||||
private ArrayList actions;
|
private ArrayList actions;
|
||||||
|
|
||||||
public DeclarationsSearchGroup(IWorkbenchSite site) {
|
public DeclarationsSearchGroup(IWorkbenchSite site) {
|
||||||
fFindDeclarationsAction= new FindDeclarationsAction(site);
|
fFindDeclarationsAction= new FindDeclarationsAction(site);
|
||||||
|
fFindDeclarationsProjectAction = new FindDeclarationsProjectAction(site);
|
||||||
fFindDeclarationsInWorkingSetAction = new FindDeclarationsInWorkingSetAction(site,null);
|
fFindDeclarationsInWorkingSetAction = new FindDeclarationsInWorkingSetAction(site,null);
|
||||||
fSite = site;
|
fSite = site;
|
||||||
}
|
}
|
||||||
|
@ -59,6 +61,9 @@ public class DeclarationsSearchGroup extends ActionGroup {
|
||||||
if (editor != null){
|
if (editor != null){
|
||||||
editor.setAction(ICEditorActionDefinitionIds.FIND_DECL, fFindDeclarationsAction);
|
editor.setAction(ICEditorActionDefinitionIds.FIND_DECL, fFindDeclarationsAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fFindDeclarationsProjectAction = new FindDeclarationsProjectAction(editor);
|
||||||
|
|
||||||
fFindDeclarationsInWorkingSetAction = new FindDeclarationsInWorkingSetAction(editor,null);
|
fFindDeclarationsInWorkingSetAction = new FindDeclarationsInWorkingSetAction(editor,null);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -83,6 +88,7 @@ public class DeclarationsSearchGroup extends ActionGroup {
|
||||||
|
|
||||||
FindAction[] actions = getWorkingSetActions();
|
FindAction[] actions = getWorkingSetActions();
|
||||||
incomingMenu.add(fFindDeclarationsAction);
|
incomingMenu.add(fFindDeclarationsAction);
|
||||||
|
incomingMenu.add(fFindDeclarationsProjectAction);
|
||||||
incomingMenu.add(fFindDeclarationsInWorkingSetAction);
|
incomingMenu.add(fFindDeclarationsInWorkingSetAction);
|
||||||
|
|
||||||
for (int i=0; i<actions.length; i++){
|
for (int i=0; i<actions.length; i++){
|
||||||
|
@ -136,6 +142,7 @@ public class DeclarationsSearchGroup extends ActionGroup {
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
fFindDeclarationsAction= null;
|
fFindDeclarationsAction= null;
|
||||||
|
fFindDeclarationsProjectAction=null;
|
||||||
fFindDeclarationsInWorkingSetAction= null;
|
fFindDeclarationsInWorkingSetAction= null;
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,12 +105,14 @@ public abstract class FindAction extends SelectionParseAction {
|
||||||
if (obj instanceof ISourceReference && fSite.getSelectionProvider() instanceof ProblemTreeViewer) {
|
if (obj instanceof ISourceReference && fSite.getSelectionProvider() instanceof ProblemTreeViewer) {
|
||||||
try {
|
try {
|
||||||
fEditor = ((ProblemTreeViewer)fSite.getSelectionProvider()).getEditor();
|
fEditor = ((ProblemTreeViewer)fSite.getSelectionProvider()).getEditor();
|
||||||
IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
|
if (fEditor != null){
|
||||||
ISourceReference ref = (ISourceReference)obj;
|
IDocument doc = fEditor.getDocumentProvider().getDocument(fEditor.getEditorInput());
|
||||||
|
ISourceReference ref = (ISourceReference)obj;
|
||||||
TextSelection selection = new TextSelection(doc, ref.getSourceRange().getIdStartPos(), ref.getSourceRange().getIdLength());
|
|
||||||
run(selection);
|
TextSelection selection = new TextSelection(doc, ref.getSourceRange().getIdStartPos(), ref.getSourceRange().getIdLength());
|
||||||
return;
|
run(selection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class FindDeclarationsInWorkingSetAction extends FindAction {
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.selsearch.FindAction#getLimitTo()
|
* @see org.eclipse.cdt.internal.ui.editor.selsearch.FindAction#getLimitTo()
|
||||||
*/
|
*/
|
||||||
protected LimitTo getLimitTo() {
|
protected LimitTo getLimitTo() {
|
||||||
return ICSearchConstants.DECLARATIONS;
|
return ICSearchConstants.DECLARATIONS_DEFINITIONS;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
package org.eclipse.cdt.internal.ui.search.actions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
|
import org.eclipse.cdt.core.search.ICSearchConstants.LimitTo;
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
|
import org.eclipse.cdt.internal.ui.search.CSearchMessages;
|
||||||
|
import org.eclipse.cdt.internal.ui.search.CSearchScopeFactory;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.ui.IWorkbenchSite;
|
||||||
|
|
||||||
|
public class FindDeclarationsProjectAction extends FindAction {
|
||||||
|
|
||||||
|
public FindDeclarationsProjectAction(CEditor editor, String label, String tooltip){
|
||||||
|
super(editor);
|
||||||
|
setText(label); //$NON-NLS-1$
|
||||||
|
setToolTipText(tooltip); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public FindDeclarationsProjectAction(CEditor editor){
|
||||||
|
this(editor,
|
||||||
|
CSearchMessages.getString("CSearch.FindDeclarationsProjectAction.label"), //$NON-NLS-1$
|
||||||
|
CSearchMessages.getString("CSearch.FindDeclarationsProjectAction.tooltip")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public FindDeclarationsProjectAction(IWorkbenchSite site){
|
||||||
|
this(site,
|
||||||
|
CSearchMessages.getString("CSearch.FindDeclarationsProjectAction.label"), //$NON-NLS-1$
|
||||||
|
CSearchMessages.getString("CSearch.FindDeclarationsProjectAction.tooltip")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param site
|
||||||
|
* @param string
|
||||||
|
* @param string2
|
||||||
|
* @param string3
|
||||||
|
*/
|
||||||
|
public FindDeclarationsProjectAction(IWorkbenchSite site, String label, String tooltip) {
|
||||||
|
super(site);
|
||||||
|
setText(label);
|
||||||
|
setToolTipText(tooltip);
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.editor.selsearch.FindAction#getScope(org.eclipse.core.resources.IProject)
|
||||||
|
*/
|
||||||
|
protected ICSearchScope getScope() {
|
||||||
|
|
||||||
|
ICProject proj = null;
|
||||||
|
if (fEditor != null){
|
||||||
|
proj= fEditor.getInputCElement().getCProject();
|
||||||
|
} else if (fSite != null){
|
||||||
|
IStructuredSelection sel = (IStructuredSelection) getSelection();
|
||||||
|
return CSearchScopeFactory.getInstance().createEnclosingProjectScope(sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
ICElement[] element = new ICElement[1];
|
||||||
|
element[0]=proj;
|
||||||
|
return SearchEngine.createCSearchScope(element);
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.editor.selsearch.FindAction#getScopeDescription()
|
||||||
|
*/
|
||||||
|
protected String getScopeDescription() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return CSearchMessages.getString("ProjectScope"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.editor.selsearch.FindAction#getLimitTo()
|
||||||
|
*/
|
||||||
|
protected LimitTo getLimitTo() {
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return ICSearchConstants.DECLARATIONS_DEFINITIONS;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package org.eclipse.cdt.internal.ui.search.actions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
|
import org.eclipse.cdt.core.model.ICProject;
|
||||||
|
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||||
|
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||||
|
import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
|
import org.eclipse.cdt.core.search.ICSearchConstants.LimitTo;
|
||||||
|
import org.eclipse.cdt.internal.ui.editor.CEditor;
|
||||||
|
import org.eclipse.cdt.internal.ui.search.CSearchMessages;
|
||||||
|
import org.eclipse.cdt.internal.ui.search.CSearchScopeFactory;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.ui.IWorkbenchSite;
|
||||||
|
|
||||||
|
public class FindRefsProjectAction extends FindAction {
|
||||||
|
|
||||||
|
public FindRefsProjectAction(CEditor editor, String label, String tooltip){
|
||||||
|
super(editor);
|
||||||
|
setText(label); //$NON-NLS-1$
|
||||||
|
setToolTipText(tooltip); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public FindRefsProjectAction(CEditor editor){
|
||||||
|
this(editor,
|
||||||
|
CSearchMessages.getString("CSearch.FindReferencesProjectAction.label"), //$NON-NLS-1$
|
||||||
|
CSearchMessages.getString("CSearch.FindReferencesProjectAction.tooltip")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public FindRefsProjectAction(IWorkbenchSite site){
|
||||||
|
this(site,
|
||||||
|
CSearchMessages.getString("CSearch.FindReferencesProjectAction.label"), //$NON-NLS-1$
|
||||||
|
CSearchMessages.getString("CSearch.FindReferencesProjectAction.tooltip")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @param site
|
||||||
|
* @param string
|
||||||
|
* @param string2
|
||||||
|
* @param string3
|
||||||
|
*/
|
||||||
|
public FindRefsProjectAction(IWorkbenchSite site, String label, String tooltip) {
|
||||||
|
super(site);
|
||||||
|
setText(label);
|
||||||
|
setToolTipText(tooltip);
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.editor.selsearch.FindAction#getScope(org.eclipse.core.resources.IProject)
|
||||||
|
*/
|
||||||
|
protected ICSearchScope getScope() {
|
||||||
|
|
||||||
|
ICProject proj = null;
|
||||||
|
if (fEditor != null){
|
||||||
|
proj= fEditor.getInputCElement().getCProject();
|
||||||
|
} else if (fSite != null){
|
||||||
|
IStructuredSelection sel = (IStructuredSelection) getSelection();
|
||||||
|
return CSearchScopeFactory.getInstance().createEnclosingProjectScope(sel);
|
||||||
|
}
|
||||||
|
|
||||||
|
ICElement[] element = new ICElement[1];
|
||||||
|
element[0]=proj;
|
||||||
|
return SearchEngine.createCSearchScope(element);
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.editor.selsearch.FindAction#getScopeDescription()
|
||||||
|
*/
|
||||||
|
protected String getScopeDescription() {
|
||||||
|
return CSearchMessages.getString("ProjectScope"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.ui.editor.selsearch.FindAction#getLimitTo()
|
||||||
|
*/
|
||||||
|
protected LimitTo getLimitTo() {
|
||||||
|
return ICSearchConstants.REFERENCES;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -29,6 +29,7 @@ import org.eclipse.ui.texteditor.ITextEditorActionConstants;
|
||||||
public class ReferencesSearchGroup extends ActionGroup {
|
public class ReferencesSearchGroup extends ActionGroup {
|
||||||
|
|
||||||
private FindRefsAction fFindRefsAction;
|
private FindRefsAction fFindRefsAction;
|
||||||
|
private FindRefsProjectAction fFindRefsProjectAction;
|
||||||
private FindRefsInWorkingSetAction fFindRefsInWorkingSetAction;
|
private FindRefsInWorkingSetAction fFindRefsInWorkingSetAction;
|
||||||
|
|
||||||
private CEditor fEditor;
|
private CEditor fEditor;
|
||||||
|
@ -36,6 +37,7 @@ public class ReferencesSearchGroup extends ActionGroup {
|
||||||
|
|
||||||
public ReferencesSearchGroup(IWorkbenchSite site) {
|
public ReferencesSearchGroup(IWorkbenchSite site) {
|
||||||
fFindRefsAction= new FindRefsAction(site);
|
fFindRefsAction= new FindRefsAction(site);
|
||||||
|
fFindRefsProjectAction = new FindRefsProjectAction(site);
|
||||||
fFindRefsInWorkingSetAction = new FindRefsInWorkingSetAction(site, null);
|
fFindRefsInWorkingSetAction = new FindRefsInWorkingSetAction(site, null);
|
||||||
fSite=site;
|
fSite=site;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +53,7 @@ public class ReferencesSearchGroup extends ActionGroup {
|
||||||
if (editor != null){
|
if (editor != null){
|
||||||
editor.setAction(ICEditorActionDefinitionIds.FIND_REFS, fFindRefsAction);
|
editor.setAction(ICEditorActionDefinitionIds.FIND_REFS, fFindRefsAction);
|
||||||
}
|
}
|
||||||
|
fFindRefsProjectAction = new FindRefsProjectAction(editor);
|
||||||
fFindRefsInWorkingSetAction = new FindRefsInWorkingSetAction(editor, null);
|
fFindRefsInWorkingSetAction = new FindRefsInWorkingSetAction(editor, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +84,7 @@ public class ReferencesSearchGroup extends ActionGroup {
|
||||||
|
|
||||||
FindAction[] actions = getWorkingSetActions();
|
FindAction[] actions = getWorkingSetActions();
|
||||||
incomingMenu.add(fFindRefsAction);
|
incomingMenu.add(fFindRefsAction);
|
||||||
|
incomingMenu.add(fFindRefsProjectAction);
|
||||||
incomingMenu.add(fFindRefsInWorkingSetAction);
|
incomingMenu.add(fFindRefsInWorkingSetAction);
|
||||||
|
|
||||||
for (int i=0; i<actions.length; i++){
|
for (int i=0; i<actions.length; i++){
|
||||||
|
@ -115,6 +119,7 @@ public class ReferencesSearchGroup extends ActionGroup {
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
fFindRefsAction= null;
|
fFindRefsAction= null;
|
||||||
|
fFindRefsProjectAction=null;
|
||||||
fFindRefsInWorkingSetAction= null;
|
fFindRefsInWorkingSetAction= null;
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.ui.dialogs;
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
import org.eclipse.cdt.core.ICDescriptor;
|
||||||
import org.eclipse.cdt.core.ICExtensionReference;
|
import org.eclipse.cdt.core.ICExtensionReference;
|
||||||
|
import org.eclipse.cdt.core.index.ICDTIndexer;
|
||||||
import org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsIndexer;
|
import org.eclipse.cdt.internal.core.index.ctagsindexer.CTagsIndexer;
|
||||||
import org.eclipse.cdt.internal.ui.CUIMessages;
|
import org.eclipse.cdt.internal.ui.CUIMessages;
|
||||||
import org.eclipse.cdt.internal.ui.util.SWTUtil;
|
import org.eclipse.cdt.internal.ui.util.SWTUtil;
|
||||||
|
@ -125,6 +126,9 @@ public class CTagsIndexerBlock extends AbstractIndexerPage {
|
||||||
orig = cext[i].getExtensionData("ctagsindexincludes"); //$NON-NLS-1$
|
orig = cext[i].getExtensionData("ctagsindexincludes"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(indexIncludeFiles)) {
|
if (orig == null || !orig.equals(indexIncludeFiles)) {
|
||||||
cext[i].setExtensionData("ctagsindexincludes", indexIncludeFiles); //$NON-NLS-1$
|
cext[i].setExtensionData("ctagsindexincludes", indexIncludeFiles); //$NON-NLS-1$
|
||||||
|
if (indexIncludeFiles.equals( "true")){ //$NON-NLS-1$
|
||||||
|
CCorePlugin.getDefault().getCoreModel().getIndexManager().addResource(proj,proj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
orig = cext[i].getExtensionData("ctagslocationtype"); //$NON-NLS-1$
|
orig = cext[i].getExtensionData("ctagslocationtype"); //$NON-NLS-1$
|
||||||
if (orig == null || !orig.equals(cTagsLocationType)) {
|
if (orig == null || !orig.equals(cTagsLocationType)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue