diff -r 5d7d6f8c989f editor.completion/apichanges.xml --- a/editor.completion/apichanges.xml Wed Jan 30 09:34:41 2008 +0100 +++ b/editor.completion/apichanges.xml Wed Jan 30 13:58:44 2008 +0100 @@ -105,6 +105,23 @@ is the proper place. + + + Addition of CompletionResultSet.setHasAdditionalItemsText() + + + + + +

+ void CompletionResultSet.setHasAdditionalItemsText(String text) was added + to allow for customization of the text displayed in a completion popup whenever + a CompletionProvider indicates that additional items could be added to the result set. +

+
+ +
+ Addition of CompletionResultSet.setHasAdditionalItems() diff -r 5d7d6f8c989f editor.completion/manifest.mf --- a/editor.completion/manifest.mf Wed Jan 30 09:34:41 2008 +0100 +++ b/editor.completion/manifest.mf Wed Jan 30 13:58:44 2008 +0100 @@ -2,6 +2,6 @@ OpenIDE-Module: org.netbeans.modules.edi 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.10 +OpenIDE-Module-Specification-Version: 1.11 OpenIDE-Module-Layer: org/netbeans/modules/editor/completion/resources/layer.xml AutoUpdate-Show-In-Client: false diff -r 5d7d6f8c989f editor.completion/src/org/netbeans/modules/editor/completion/Bundle.properties --- a/editor.completion/src/org/netbeans/modules/editor/completion/Bundle.properties Wed Jan 30 09:34:41 2008 +0100 +++ b/editor.completion/src/org/netbeans/modules/editor/completion/Bundle.properties Wed Jan 30 13:58:44 2008 +0100 @@ -50,7 +50,7 @@ HINT_doc_browser_show_web_button=Show do HINT_doc_browser_show_web_button=Show documentation in external web browser HINT_doc_browser_goto_source_button=Open source in editor -TXT_completion_shortcut_tips=Imported Items; Press {0} Again for All Items +TXT_completion_shortcut_tips={0}Press {1} Again for All Items diff -r 5d7d6f8c989f editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java --- a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java Wed Jan 30 09:34:41 2008 +0100 +++ b/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java Wed Jan 30 13:58:44 2008 +0100 @@ -244,7 +244,7 @@ CaretListener, KeyListener, FocusListene } } layout.showCompletion(Collections.singletonList(waitText), - null, -1, CompletionImpl.this, null, 0); + null, -1, CompletionImpl.this, null, null, 0); pleaseWaitDisplayed = true; } }); @@ -593,7 +593,7 @@ CaretListener, KeyListener, FocusListene } } else { completionCancel(); - layout.showCompletion(Collections.singletonList(NO_SUGGESTIONS), null, -1, CompletionImpl.this, null, 0); + layout.showCompletion(Collections.singletonList(NO_SUGGESTIONS), null, -1, CompletionImpl.this, null, null, 0); pleaseWaitDisplayed = false; } } @@ -770,6 +770,7 @@ outer: for (Iterator it = localComp String title = null; int anchorOffset = -1; boolean hasAdditionalItems = false; + final StringBuilder hasAdditionalItemsText = new StringBuilder(); if (size > 0) { for (int i = 0; i < completionResultSets.size(); i++) { CompletionResultSetImpl resultSet = completionResultSets.get(i); @@ -778,8 +779,12 @@ outer: for (Iterator it = localComp resultItems.addAll(items); if (title == null) title = resultSet.getTitle(); - if (!hasAdditionalItems) - hasAdditionalItems = resultSet.hasAdditionalItems(); + if (resultSet.hasAdditionalItems()) { + hasAdditionalItems = true; + String s = resultSet.getHasAdditionalItemsText(); + if (s != null) + hasAdditionalItemsText.append(s); + } if (anchorOffset == -1) anchorOffset = resultSet.getAnchorOffset(); } @@ -837,7 +842,7 @@ outer: for (Iterator it = localComp int selectedIndex = getCompletionPreSelectionIndex(sortedResultItems); getActiveComponent().putClientProperty("completion-visible", Boolean.TRUE); - layout.showCompletion(noSuggestions ? Collections.singletonList(NO_SUGGESTIONS) : sortedResultItems, displayTitle, displayAnchorOffset, CompletionImpl.this, displayAdditionalItems ? completionShortcut : null, selectedIndex); + layout.showCompletion(noSuggestions ? Collections.singletonList(NO_SUGGESTIONS) : sortedResultItems, displayTitle, displayAnchorOffset, CompletionImpl.this, displayAdditionalItems ? hasAdditionalItemsText.toString() : null, displayAdditionalItems ? completionShortcut : null, selectedIndex); pleaseWaitDisplayed = false; // Show documentation as well if set by default diff -r 5d7d6f8c989f editor.completion/src/org/netbeans/modules/editor/completion/CompletionLayout.java --- a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionLayout.java Wed Jan 30 09:34:41 2008 +0100 +++ b/editor.completion/src/org/netbeans/modules/editor/completion/CompletionLayout.java Wed Jan 30 13:58:44 2008 +0100 @@ -133,8 +133,8 @@ public final class CompletionLayout { } public void showCompletion(List data, String title, int anchorOffset, - ListSelectionListener listSelectionListener, String shortcutHint, int selectedIndex) { - completionPopup.show(data, title, anchorOffset, listSelectionListener, shortcutHint, selectedIndex); + ListSelectionListener listSelectionListener, String additionalItemsText, String shortcutHint, int selectedIndex) { + completionPopup.show(data, title, anchorOffset, listSelectionListener, additionalItemsText, shortcutHint, selectedIndex); if (!visiblePopups.contains(completionPopup)) visiblePopups.push(completionPopup); } @@ -294,7 +294,7 @@ public final class CompletionLayout { private CompletionScrollPane completionScrollPane; public void show(List data, String title, int anchorOffset, - ListSelectionListener listSelectionListener, String shortcutHint, int selectedIndex) { + ListSelectionListener listSelectionListener, String additionalItemsText, String shortcutHint, int selectedIndex) { JTextComponent editorComponent = getEditorComponent(); if (editorComponent == null) { @@ -345,7 +345,7 @@ public final class CompletionLayout { BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.gray), BorderFactory.createEmptyBorder(2, 2, 2, 2)))); label.setFont(label.getFont().deriveFont((float)label.getFont().getSize() - 2)); label.setHorizontalAlignment(SwingConstants.RIGHT); - label.setText(NbBundle.getMessage(CompletionLayout.class, "TXT_completion_shortcut_tips", shortcutHint)); //NOI18N + label.setText(NbBundle.getMessage(CompletionLayout.class, "TXT_completion_shortcut_tips", additionalItemsText, shortcutHint)); //NOI18N panel.add(label, BorderLayout.SOUTH); setContentComponent(panel); } else { diff -r 5d7d6f8c989f editor.completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java --- a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java Wed Jan 30 09:34:41 2008 +0100 +++ b/editor.completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java Wed Jan 30 13:58:44 2008 +0100 @@ -92,6 +92,8 @@ public final class CompletionResultSetIm private List items; private boolean hasAdditionalItems; + + private String hasAdditionalItemsText; private boolean finished; @@ -218,6 +220,18 @@ public final class CompletionResultSetIm return hasAdditionalItems; } + public synchronized void setHasAdditionalItemsText(String text) { + checkNotFinished(); + if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE) { + return; + } + this.hasAdditionalItemsText = text; + } + + public synchronized String getHasAdditionalItemsText() { + return hasAdditionalItemsText; + } + public synchronized void setDocumentation(CompletionDocumentation documentation) { checkNotFinished(); if (!active || queryType != CompletionProvider.DOCUMENTATION_QUERY_TYPE) { diff -r 5d7d6f8c989f editor.completion/src/org/netbeans/spi/editor/completion/CompletionResultSet.java --- a/editor.completion/src/org/netbeans/spi/editor/completion/CompletionResultSet.java Wed Jan 30 09:34:41 2008 +0100 +++ b/editor.completion/src/org/netbeans/spi/editor/completion/CompletionResultSet.java Wed Jan 30 13:58:44 2008 +0100 @@ -193,6 +193,21 @@ public final class CompletionResultSet { public void setHasAdditionalItems(boolean value) { impl.setHasAdditionalItems(value); } + + /** + * Set the text to be displayed in a completion popup whenever a {@link CompletionProvider} + * indicates that additional items could be added to this result set by passing + * true to {@link CompletionResultSet#setHasAdditionalItems(boolean)}. + * + * @param text the text that will be prepend to the "Press 'Ctrl-Space' Again for All Items" + * message in the completion popup. null can be passed to revert any previous + * setting of the text. + * + * @since 1.11 + */ + public void setHasAdditionalItemsText(String text) { + impl.setHasAdditionalItemsText(text); + } /** * Set the documentation to this result set.