mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Patch from Chris to catch Cancel exception
This commit is contained in:
parent
65f227f889
commit
6cd03b77ff
2 changed files with 21 additions and 7 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-02-05 Alain Magloire
|
||||||
|
|
||||||
|
Patch from Chris Wiebe
|
||||||
|
Catch the Cancel exception.
|
||||||
|
|
||||||
|
* src/org/eclipse/cdt/internal/ui/opentype/TypeSearchOperation.java
|
||||||
|
|
||||||
2004-02-05 Alain Magloire
|
2004-02-05 Alain Magloire
|
||||||
PR 51221
|
PR 51221
|
||||||
Reformat Patch from Bogdan base on Thomas Fletcher original patch
|
Reformat Patch from Bogdan base on Thomas Fletcher original patch
|
||||||
|
|
|
@ -16,11 +16,12 @@ import org.eclipse.cdt.core.search.SearchEngine;
|
||||||
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
import org.eclipse.cdt.internal.core.search.matching.OrPattern;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
|
|
||||||
public class TypeSearchOperation implements IRunnableWithProgress {
|
public class TypeSearchOperation implements IRunnableWithProgress {
|
||||||
|
|
||||||
private final TypeSearchResultCollector collector= new TypeSearchResultCollector();
|
private final TypeSearchResultCollector collector = new TypeSearchResultCollector();
|
||||||
|
|
||||||
private ICSearchScope scope;
|
private ICSearchScope scope;
|
||||||
private IWorkspace workspace;
|
private IWorkspace workspace;
|
||||||
|
@ -31,22 +32,28 @@ public class TypeSearchOperation implements IRunnableWithProgress {
|
||||||
this.workspace = workspace;
|
this.workspace = workspace;
|
||||||
this.scope = scope;
|
this.scope = scope;
|
||||||
this.engine = engine;
|
this.engine = engine;
|
||||||
|
|
||||||
// search for namespaces, classes, structs, unions, enums and typedefs
|
// search for namespaces, classes, structs, unions, enums and typedefs
|
||||||
pattern = new OrPattern();
|
pattern = new OrPattern();
|
||||||
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, false));
|
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.TYPE, ICSearchConstants.DECLARATIONS, false));
|
||||||
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.NAMESPACE, ICSearchConstants.DECLARATIONS, false));
|
pattern.addPattern(
|
||||||
|
SearchEngine.createSearchPattern("*", ICSearchConstants.NAMESPACE, ICSearchConstants.DECLARATIONS, false));
|
||||||
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.CLASS, ICSearchConstants.DECLARATIONS, false));
|
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.CLASS, ICSearchConstants.DECLARATIONS, false));
|
||||||
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.STRUCT, ICSearchConstants.DECLARATIONS, false));
|
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.STRUCT, ICSearchConstants.DECLARATIONS, false));
|
||||||
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.CLASS_STRUCT, ICSearchConstants.DECLARATIONS, false));
|
pattern.addPattern(
|
||||||
|
SearchEngine.createSearchPattern("*", ICSearchConstants.CLASS_STRUCT, ICSearchConstants.DECLARATIONS, false));
|
||||||
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.UNION, ICSearchConstants.DECLARATIONS, false));
|
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.UNION, ICSearchConstants.DECLARATIONS, false));
|
||||||
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.ENUM, ICSearchConstants.DECLARATIONS, false));
|
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.ENUM, ICSearchConstants.DECLARATIONS, false));
|
||||||
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.TYPEDEF, ICSearchConstants.DECLARATIONS, false));
|
pattern.addPattern(SearchEngine.createSearchPattern("*", ICSearchConstants.TYPEDEF, ICSearchConstants.DECLARATIONS, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run(IProgressMonitor monitor) throws InterruptedException {
|
public void run(IProgressMonitor monitor) throws InterruptedException {
|
||||||
collector.setProgressMonitor(monitor);
|
collector.setProgressMonitor(monitor);
|
||||||
engine.search(workspace, pattern, scope, collector, true);
|
try {
|
||||||
|
engine.search(workspace, pattern, scope, collector, true);
|
||||||
|
} catch (OperationCanceledException e) {
|
||||||
|
throw new InterruptedException();
|
||||||
|
}
|
||||||
if (monitor.isCanceled()) {
|
if (monitor.isCanceled()) {
|
||||||
throw new InterruptedException();
|
throw new InterruptedException();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue