Index: apichanges.xml =================================================================== RCS file: /cvs/editor/completion/apichanges.xml,v retrieving revision 1.6 diff -u -r1.6 apichanges.xml --- apichanges.xml 17 Apr 2007 17:13:50 -0000 1.6 +++ apichanges.xml 20 Jun 2007 08:49:10 -0000 @@ -82,6 +82,24 @@ + + + Addition of CompletionResultSet.hasAdditionalItems() + + + + + +

+ void CompletionResultSet.hasAdditionalItems(boolean value) was added + to indicate that some items could exist that will likely need a long time to be computed + and added to the result set. It is preferred to add them on the special 'all' code + completion invocation only. +

+
+ +
+ Support for UI Gestures Collector Index: manifest.mf =================================================================== RCS file: /cvs/editor/completion/manifest.mf,v retrieving revision 1.7 diff -u -r1.7 manifest.mf --- manifest.mf 17 Apr 2007 11:28:21 -0000 1.7 +++ manifest.mf 20 Jun 2007 08:49:10 -0000 @@ -2,4 +2,4 @@ OpenIDE-Module: org.netbeans.modules.editor.completion/1 OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/completion/Bundle.properties OpenIDE-Module-Install: org/netbeans/modules/editor/completion/CompletionModule.class -OpenIDE-Module-Specification-Version: 1.8 +OpenIDE-Module-Specification-Version: 1.9 Index: src/org/netbeans/modules/editor/completion/CompletionImpl.java =================================================================== RCS file: /cvs/editor/completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java,v retrieving revision 1.71 diff -u -r1.71 CompletionImpl.java --- src/org/netbeans/modules/editor/completion/CompletionImpl.java 7 Jun 2007 19:49:53 -0000 1.71 +++ src/org/netbeans/modules/editor/completion/CompletionImpl.java 20 Jun 2007 08:49:10 -0000 @@ -713,6 +713,7 @@ final List sortedResultItems = new ArrayList(sortedResultsSize); String title = null; int anchorOffset = -1; + boolean additionalItems = false; int cnt = 0; for (int i = 0; i < completionResultSets.size(); i++) { CompletionResultSetImpl resultSet = (CompletionResultSetImpl)completionResultSets.get(i); @@ -732,6 +733,8 @@ } if (title == null) title = resultSet.getTitle(); + if (!additionalItems) + additionalItems = resultSet.hasAdditionalItems(); if (anchorOffset == -1) anchorOffset = resultSet.getAnchorOffset(); } @@ -748,7 +751,7 @@ // Request displaying of the completion pane in AWT thread final String displayTitle = title; final int displayAnchorOffset = anchorOffset; - final int queryType = qType; + final boolean displayAdditionalItems = additionalItems; Runnable requestShowRunnable = new Runnable() { public void run() { int caretOffset = getActiveComponent().getSelectionStart(); @@ -769,7 +772,7 @@ } int selectedIndex = getCompletionPreSelectionIndex(sortedResultItems); - layout.showCompletion(noSuggestions ? Collections.singletonList(NO_SUGGESTIONS) : sortedResultItems, displayTitle, displayAnchorOffset, CompletionImpl.this, queryType == CompletionProvider.COMPLETION_QUERY_TYPE ? completionShortcut : null, selectedIndex); + layout.showCompletion(noSuggestions ? Collections.singletonList(NO_SUGGESTIONS) : sortedResultItems, displayTitle, displayAnchorOffset, CompletionImpl.this, displayAdditionalItems ? completionShortcut : null, selectedIndex); pleaseWaitDisplayed = false; // Show documentation as well if set by default Index: src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java =================================================================== RCS file: /cvs/editor/completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java,v retrieving revision 1.8 diff -u -r1.8 CompletionResultSetImpl.java --- src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java 24 Oct 2006 12:52:58 -0000 1.8 +++ src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java 20 Jun 2007 08:49:10 -0000 @@ -69,6 +69,8 @@ private List items; + private boolean hasAdditionalItems; + private boolean finished; private CompletionDocumentation documentation; @@ -180,6 +182,19 @@ assert isFinished() : "Adding not finished"; return (items != null) ? items : Collections.emptyList(); } + + + public synchronized void hasAdditionalItems(boolean value) { + checkNotFinished(); + if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE) { + return; + } + this.hasAdditionalItems = value; + } + + public synchronized boolean hasAdditionalItems() { + return hasAdditionalItems; + } public synchronized void setDocumentation(CompletionDocumentation documentation) { checkNotFinished(); Index: src/org/netbeans/spi/editor/completion/CompletionResultSet.java =================================================================== RCS file: /cvs/editor/completion/src/org/netbeans/spi/editor/completion/CompletionResultSet.java,v retrieving revision 1.6 diff -u -r1.6 CompletionResultSet.java --- src/org/netbeans/spi/editor/completion/CompletionResultSet.java 24 Oct 2006 12:52:58 -0000 1.6 +++ src/org/netbeans/spi/editor/completion/CompletionResultSet.java 20 Jun 2007 08:49:10 -0000 @@ -157,6 +157,21 @@ impl.estimateItems(estimatedItemCount, estimatedItemWidth); } + + /** + * Indicate that additional items could be added to this result set. However, + * adding of these items will likely need a long time to complete so it is + * preferred to add them only on the special code completion invocation + * denoted by {@link CompletionProvider#COMPLETION_ALL_QUERY_TYPE}. + *
+ * Calling this method is relevant only for tasks + * created by {@link CompletionProvider#createTask(int, javax.swing.text.JTextComponent)} + * with {@link CompletionProvider#COMPLETION_QUERY_TYPE}. + */ + public void hasAdditionalItems(boolean value) { + impl.hasAdditionalItems(value); + } + /** * Set the documentation to this result set. *