--- a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java Sun Dec 18 13:41:30 2011 -0600 +++ a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java Tue Jan 03 08:48:14 2012 -0600 @@ -395,7 +395,7 @@ CompletionSettings.getInstance(getActiveComponent()).completionAutoPopup()) { autoModEndOffset = modEndOffset; if (completionResultNull) - showCompletion(false, false, true, CompletionProvider.COMPLETION_QUERY_TYPE); + showCompletion(false, false, true, type & (CompletionProvider.COMPLETION_QUERY_MASK | CompletionProvider.USER_QUERY_MASK)); } boolean tooltipResultNull; @@ -1068,11 +1068,11 @@ final boolean noSuggestions = sortedResultItems.size() == 0; if (noSuggestions) { - if (hasAdditionalItems && qType == CompletionProvider.COMPLETION_QUERY_TYPE) { + if (hasAdditionalItems && (qType & CompletionProvider.COMPLETION_ALL_QUERY_TYPE) != CompletionProvider.COMPLETION_ALL_QUERY_TYPE) { showCompletion(this.explicitQuery, this.refreshedQuery, false, CompletionProvider.COMPLETION_ALL_QUERY_TYPE); return; } - if (!explicitQuery) { + if (!explicitQuery) { hideCompletion(false); return; } @@ -1523,7 +1523,7 @@ void finishNotify(CompletionResultSetImpl finishedResult) { Result localResult; boolean finished = false; - switch (finishedResult.getQueryType()) { + switch (finishedResult.getQueryType() & CompletionProvider.RESERVED_QUERY_MASK) { case CompletionProvider.COMPLETION_QUERY_TYPE: case CompletionProvider.COMPLETION_ALL_QUERY_TYPE: synchronized (this) { @@ -1589,7 +1589,7 @@ private static CompletionResultSetImpl findFirstValidResult(List resultSets) { for (int i = 0; i < resultSets.size(); i++) { CompletionResultSetImpl result = resultSets.get(i); - switch (result.getQueryType()) { + switch (result.getQueryType() & CompletionProvider.RESERVED_QUERY_MASK) { case CompletionProvider.DOCUMENTATION_QUERY_TYPE: if (result.getDocumentation() != null) { return result; --- a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java Sun Dec 18 13:41:30 2011 -0600 +++ a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java Tue Jan 03 08:48:14 2012 -0600 @@ -213,7 +213,7 @@ public synchronized void setHasAdditionalItems(boolean value) { checkNotFinished(); - if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE) { + if ((queryType & CompletionProvider.COMPLETION_ALL_QUERY_TYPE) == CompletionProvider.COMPLETION_ALL_QUERY_TYPE) { return; } this.hasAdditionalItems = value; @@ -225,7 +225,7 @@ public synchronized void setHasAdditionalItemsText(String text) { checkNotFinished(); - if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE) { + if ((queryType & CompletionProvider.COMPLETION_ALL_QUERY_TYPE) == CompletionProvider.COMPLETION_ALL_QUERY_TYPE) { return; } this.hasAdditionalItemsText = text; @@ -237,7 +237,7 @@ public synchronized void setDocumentation(CompletionDocumentation documentation) { checkNotFinished(); - if (!active || queryType != CompletionProvider.DOCUMENTATION_QUERY_TYPE) { + if (!active || (queryType & CompletionProvider.DOCUMENTATION_QUERY_TYPE) != CompletionProvider.DOCUMENTATION_QUERY_TYPE) { return; } this.documentation = documentation; @@ -253,7 +253,7 @@ public synchronized void setToolTip(JToolTip toolTip) { checkNotFinished(); - if (!active || queryType != CompletionProvider.TOOLTIP_QUERY_TYPE) { + if (!active || (queryType & CompletionProvider.TOOLTIP_QUERY_TYPE) != CompletionProvider.TOOLTIP_QUERY_TYPE) { return; } this.toolTip = toolTip; --- a/editor.completion/src/org/netbeans/spi/editor/completion/CompletionProvider.java Sun Dec 18 13:41:30 2011 -0600 +++ a/editor.completion/src/org/netbeans/spi/editor/completion/CompletionProvider.java Tue Jan 03 08:48:14 2012 -0600 @@ -67,22 +67,37 @@ /** * The int value representing the query for a code completion. */ - public static final int COMPLETION_QUERY_TYPE = 1; + public static final int COMPLETION_QUERY_TYPE = 0x01; /** * The int value representing the query for a documentation. */ - public static final int DOCUMENTATION_QUERY_TYPE = 2; + public static final int DOCUMENTATION_QUERY_TYPE = 0x02; /** * The int value representing the query for a tooltip hint. */ - public static final int TOOLTIP_QUERY_TYPE = 4; + public static final int TOOLTIP_QUERY_TYPE = 0x04; /** * The int value representing the query for an all code completion. */ - public static final int COMPLETION_ALL_QUERY_TYPE = 9; + public static final int COMPLETION_ALL_QUERY_TYPE = 0x11; + + /** + * The int mask representing the bits used for a completion query type. + */ + public static final int COMPLETION_QUERY_MASK = COMPLETION_QUERY_TYPE | COMPLETION_ALL_QUERY_TYPE; + + /** + * The int mask of bits a user can specify to customize the query type. + */ + public static final int USER_QUERY_MASK = 0xFFFF0000; + + /** + * The int mask of bits used by the API to specify the query type. + */ + public static final int RESERVED_QUERY_MASK = ~USER_QUERY_MASK; /** * Creates a task that performs a query of the given type on the given component.