mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 09:45:39 +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;
|
int WAIT_UNTIL_READY_TO_SEARCH = IJob.WaitUntilReady;
|
||||||
|
|
||||||
|
public static final String EXTERNAL_SEARCH_LINK_PREFIX = "cdtlnk"; //$NON-NLS-1$
|
||||||
|
|
||||||
public class SearchFor{
|
public class SearchFor{
|
||||||
private SearchFor( int value )
|
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
|
2004-06-15 Bogdan Gheorghe
|
||||||
Fix for Bug 63957: Error with external search markers - changed label
|
Fix for Bug 63957: Error with external search markers - changed label
|
||||||
provider to provide proper paths for external links
|
provider to provide proper paths for external links
|
||||||
|
|
|
@ -17,10 +17,13 @@ import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
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.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;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.window.Window;
|
import org.eclipse.jface.window.Window;
|
||||||
|
@ -115,13 +118,35 @@ public class CSearchScopeFactory {
|
||||||
|
|
||||||
Iterator iter = fStructuredSelection.iterator();
|
Iterator iter = fStructuredSelection.iterator();
|
||||||
while( iter.hasNext() ){
|
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 );
|
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() {
|
public IWorkingSet[] queryWorkingSets() {
|
||||||
Shell shell= CUIPlugin.getActiveWorkbenchShell();
|
Shell shell= CUIPlugin.getActiveWorkbenchShell();
|
||||||
if (shell == null)
|
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.model.ICElement;
|
||||||
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
import org.eclipse.cdt.core.search.BasicSearchMatch;
|
||||||
import org.eclipse.cdt.core.search.BasicSearchResultCollector;
|
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.core.search.IMatch;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.resources.IFile;
|
import org.eclipse.core.resources.IFile;
|
||||||
|
@ -30,6 +31,7 @@ public class NewSearchResultCollector extends BasicSearchResultCollector {
|
||||||
private CSearchResult fSearch;
|
private CSearchResult fSearch;
|
||||||
private IProgressMonitor fProgressMonitor;
|
private IProgressMonitor fProgressMonitor;
|
||||||
private int fMatchCount;
|
private int fMatchCount;
|
||||||
|
|
||||||
|
|
||||||
public NewSearchResultCollector(CSearchResult search, IProgressMonitor monitor) {
|
public NewSearchResultCollector(CSearchResult search, IProgressMonitor monitor) {
|
||||||
super();
|
super();
|
||||||
|
@ -132,7 +134,7 @@ public class NewSearchResultCollector extends BasicSearchResultCollector {
|
||||||
int segments = externalMatchLocation.segmentCount() - 1;
|
int segments = externalMatchLocation.segmentCount() - 1;
|
||||||
for (int linkNumber=0; linkNumber<Integer.MAX_VALUE; linkNumber++){
|
for (int linkNumber=0; linkNumber<Integer.MAX_VALUE; linkNumber++){
|
||||||
if (fileName !="") //$NON-NLS-1$
|
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
|
else
|
||||||
fileName = externalMatchLocation.segment(segments);
|
fileName = externalMatchLocation.segment(segments);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue