mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Fix for 60490: Selected resources option should only be enabled/disabled in the Navigator and C/C++ Projects views
This commit is contained in:
parent
b0fba2c9e5
commit
2164ad4e15
4 changed files with 39 additions and 3 deletions
|
@ -193,7 +193,8 @@ public interface ICSearchConstants {
|
|||
*/
|
||||
int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
|
||||
|
||||
|
||||
public static final String EXTERNAL_SEARCH_LINK_PREFIX = "cdtlnk"; //$NON-NLS-1$
|
||||
|
||||
public class SearchFor{
|
||||
private SearchFor( int value )
|
||||
{
|
||||
|
|
|
@ -1,3 +1,11 @@
|
|||
2004-06-15 Bogdan Gheorghe
|
||||
Fix for Bug 60490: "Selected resource" option should only be enabled/disabled
|
||||
based on selections in the Navigator and C/C++ Projects views - search now
|
||||
works on all C/C++ views
|
||||
|
||||
* src/org/eclipse/cdt/internal/ui/search/CSearchScopeFactory.java
|
||||
* src/org/eclipse/cdt/internal/ui/search/NewSearchResultCollector.java
|
||||
|
||||
2004-06-15 Bogdan Gheorghe
|
||||
Fix for Bug 63957: Error with external search markers - changed label
|
||||
provider to provide proper paths for external links
|
||||
|
|
|
@ -17,10 +17,13 @@ import java.util.HashSet;
|
|||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||
import org.eclipse.cdt.core.search.ICSearchScope;
|
||||
import org.eclipse.cdt.core.search.SearchEngine;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IResource;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.window.Window;
|
||||
|
@ -115,13 +118,35 @@ public class CSearchScopeFactory {
|
|||
|
||||
Iterator iter = fStructuredSelection.iterator();
|
||||
while( iter.hasNext() ){
|
||||
addCElements( cElements, (IAdaptable)iter.next() );
|
||||
Object tempObj = iter.next();
|
||||
if ( tempObj instanceof ICElement){
|
||||
addCElements( cElements, (ICElement)tempObj );
|
||||
}
|
||||
else if (tempObj instanceof BasicSearchMatch){
|
||||
addCElements( cElements, (BasicSearchMatch)tempObj );
|
||||
}
|
||||
else if (tempObj instanceof IResource){
|
||||
addCElements(cElements, (IResource) tempObj);
|
||||
}
|
||||
}
|
||||
|
||||
return createCSearchScope( cElements );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param elements
|
||||
* @param match
|
||||
*/
|
||||
private void addCElements(Set elements, BasicSearchMatch match) {
|
||||
IResource tempResource=match.getResource();
|
||||
if (tempResource!=null ){
|
||||
ICElement cTransUnit = CCorePlugin.getDefault().getCoreModel().create(tempResource);
|
||||
if (cTransUnit != null)
|
||||
elements.add(cTransUnit);
|
||||
}
|
||||
}
|
||||
|
||||
public IWorkingSet[] queryWorkingSets() {
|
||||
Shell shell= CUIPlugin.getActiveWorkbenchShell();
|
||||
if (shell == null)
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.eclipse.cdt.core.CCorePlugin;
|
|||
import org.eclipse.cdt.core.model.ICElement;
|
||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||
import org.eclipse.cdt.core.search.BasicSearchResultCollector;
|
||||
import org.eclipse.cdt.core.search.ICSearchConstants;
|
||||
import org.eclipse.cdt.core.search.IMatch;
|
||||
import org.eclipse.cdt.ui.CUIPlugin;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
|
@ -30,6 +31,7 @@ public class NewSearchResultCollector extends BasicSearchResultCollector {
|
|||
private CSearchResult fSearch;
|
||||
private IProgressMonitor fProgressMonitor;
|
||||
private int fMatchCount;
|
||||
|
||||
|
||||
public NewSearchResultCollector(CSearchResult search, IProgressMonitor monitor) {
|
||||
super();
|
||||
|
@ -132,7 +134,7 @@ public class NewSearchResultCollector extends BasicSearchResultCollector {
|
|||
int segments = externalMatchLocation.segmentCount() - 1;
|
||||
for (int linkNumber=0; linkNumber<Integer.MAX_VALUE; linkNumber++){
|
||||
if (fileName !="") //$NON-NLS-1$
|
||||
fileName = "lnk" + linkNumber + "_" + externalMatchLocation.segment(segments); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fileName = ICSearchConstants.EXTERNAL_SEARCH_LINK_PREFIX + linkNumber + "_" + externalMatchLocation.segment(segments); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
else
|
||||
fileName = externalMatchLocation.segment(segments);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue