mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 01:45:33 +02:00
Open Element: Faster queries and cancellation
This commit is contained in:
parent
db9a31fff7
commit
5b31b196fa
3 changed files with 8 additions and 7 deletions
|
@ -127,7 +127,7 @@ public class NamedNodeCollector implements IBTreeVisitor, IPDOMVisitor {
|
|||
}
|
||||
|
||||
private void checkCancelled() {
|
||||
if (++monitorCheckCounter % 0x100 == 0 && monitor.isCanceled()) {
|
||||
if (++monitorCheckCounter % 0x1000 == 0 && monitor.isCanceled()) {
|
||||
throw new OperationCanceledException();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
index.acquireReadLock();
|
||||
IBinding[] bindings= index.findBindingsForPrefix(prefix, false, IndexFilter.ALL_DECLARED, monitor);
|
||||
for(int i=0; i<bindings.length; i++) {
|
||||
if ((i % 100) == 0 && monitor.isCanceled()) {
|
||||
if (i % 0x1000 == 0 && monitor.isCanceled()) {
|
||||
return null;
|
||||
}
|
||||
IBinding binding = bindings[i];
|
||||
|
@ -254,11 +254,11 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
if(binding instanceof ICPPBinding) {
|
||||
fqn= ((ICPPBinding)binding).getQualifiedName();
|
||||
} else {
|
||||
fqn = new String[] {binding.getName()};
|
||||
fqn= new String[] {binding.getName()};
|
||||
}
|
||||
if (binding instanceof IFunction) {
|
||||
final IFunction function = (IFunction)binding;
|
||||
final String[] paramTypes = IndexModelUtil.extractParameterTypes(function);
|
||||
final IFunction function= (IFunction)binding;
|
||||
final String[] paramTypes= IndexModelUtil.extractParameterTypes(function);
|
||||
final String returnType= IndexModelUtil.extractReturnType(function);
|
||||
types.add(new IndexTypeInfo(fqn, elementType, paramTypes, returnType, index));
|
||||
} else {
|
||||
|
@ -266,7 +266,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
}
|
||||
}
|
||||
} catch(DOMException de) {
|
||||
|
||||
CCorePlugin.log(de);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
@ -309,7 +309,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
|||
|
||||
protected void scheduleUpdate(String filterText) {
|
||||
char[] newPrefix= toPrefix(filterText);
|
||||
if (!isEquivalentPrefix(fCurrentPrefix, newPrefix)) {
|
||||
if (fUpdateJob.getState() == Job.RUNNING || !isEquivalentPrefix(fCurrentPrefix, newPrefix)) {
|
||||
fUpdateJob.cancel();
|
||||
fCurrentPrefix= newPrefix;
|
||||
fUpdateJob.schedule(200);
|
||||
|
|
|
@ -458,6 +458,7 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
|
|||
*/
|
||||
void updateElements() {
|
||||
fNewFilteredList.setFilter(fTextWidget.getText());
|
||||
handleSelectionChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue