mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-12 10:45:37 +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() {
|
private void checkCancelled() {
|
||||||
if (++monitorCheckCounter % 0x100 == 0 && monitor.isCanceled()) {
|
if (++monitorCheckCounter % 0x1000 == 0 && monitor.isCanceled()) {
|
||||||
throw new OperationCanceledException();
|
throw new OperationCanceledException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
||||||
index.acquireReadLock();
|
index.acquireReadLock();
|
||||||
IBinding[] bindings= index.findBindingsForPrefix(prefix, false, IndexFilter.ALL_DECLARED, monitor);
|
IBinding[] bindings= index.findBindingsForPrefix(prefix, false, IndexFilter.ALL_DECLARED, monitor);
|
||||||
for(int i=0; i<bindings.length; i++) {
|
for(int i=0; i<bindings.length; i++) {
|
||||||
if ((i % 100) == 0 && monitor.isCanceled()) {
|
if (i % 0x1000 == 0 && monitor.isCanceled()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
IBinding binding = bindings[i];
|
IBinding binding = bindings[i];
|
||||||
|
@ -254,11 +254,11 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
||||||
if(binding instanceof ICPPBinding) {
|
if(binding instanceof ICPPBinding) {
|
||||||
fqn= ((ICPPBinding)binding).getQualifiedName();
|
fqn= ((ICPPBinding)binding).getQualifiedName();
|
||||||
} else {
|
} else {
|
||||||
fqn = new String[] {binding.getName()};
|
fqn= new String[] {binding.getName()};
|
||||||
}
|
}
|
||||||
if (binding instanceof IFunction) {
|
if (binding instanceof IFunction) {
|
||||||
final IFunction function = (IFunction)binding;
|
final IFunction function= (IFunction)binding;
|
||||||
final String[] paramTypes = IndexModelUtil.extractParameterTypes(function);
|
final String[] paramTypes= IndexModelUtil.extractParameterTypes(function);
|
||||||
final String returnType= IndexModelUtil.extractReturnType(function);
|
final String returnType= IndexModelUtil.extractReturnType(function);
|
||||||
types.add(new IndexTypeInfo(fqn, elementType, paramTypes, returnType, index));
|
types.add(new IndexTypeInfo(fqn, elementType, paramTypes, returnType, index));
|
||||||
} else {
|
} else {
|
||||||
|
@ -266,7 +266,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(DOMException de) {
|
} catch(DOMException de) {
|
||||||
|
CCorePlugin.log(de);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -309,7 +309,7 @@ public class ElementSelectionDialog extends TypeSelectionDialog {
|
||||||
|
|
||||||
protected void scheduleUpdate(String filterText) {
|
protected void scheduleUpdate(String filterText) {
|
||||||
char[] newPrefix= toPrefix(filterText);
|
char[] newPrefix= toPrefix(filterText);
|
||||||
if (!isEquivalentPrefix(fCurrentPrefix, newPrefix)) {
|
if (fUpdateJob.getState() == Job.RUNNING || !isEquivalentPrefix(fCurrentPrefix, newPrefix)) {
|
||||||
fUpdateJob.cancel();
|
fUpdateJob.cancel();
|
||||||
fCurrentPrefix= newPrefix;
|
fCurrentPrefix= newPrefix;
|
||||||
fUpdateJob.schedule(200);
|
fUpdateJob.schedule(200);
|
||||||
|
|
|
@ -458,6 +458,7 @@ public class TypeSelectionDialog extends TwoPaneElementSelector {
|
||||||
*/
|
*/
|
||||||
void updateElements() {
|
void updateElements() {
|
||||||
fNewFilteredList.setFilter(fTextWidget.getText());
|
fNewFilteredList.setFilter(fTextWidget.getText());
|
||||||
|
handleSelectionChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue