This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 124351
Collapse All | Expand All

(-)a/editor.completion/apichanges.xml (+17 lines)
Lines 105-110 is the proper place. Link Here
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
105
    <!-- ACTUAL CHANGES BEGIN HERE: -->
106
106
107
    <changes>
107
    <changes>
108
        <change id="CompletionResultSet.setHasAdditionalItemsText">
109
            <api name="completion"/>
110
            <summary>Addition of CompletionResultSet.setHasAdditionalItemsText()</summary>
111
            <version major="1" minor="11"/>
112
            <date day="30" month="1" year="2008"/>
113
            <author login="dbalek"/>
114
            <compatibility addition="yes"/>
115
            <description>
116
            <p>
117
                <code>void CompletionResultSet.setHasAdditionalItemsText(String text)</code> was added
118
                to allow for customization of the text displayed in a completion popup whenever
119
                a CompletionProvider indicates that additional items could be added to the result set.
120
            </p>
121
            </description>
122
            <issue number="124351"/>
123
        </change>
124
108
        <change id="CompletionResultSet.setHasAdditionalItems">
125
        <change id="CompletionResultSet.setHasAdditionalItems">
109
            <api name="completion"/>
126
            <api name="completion"/>
110
            <summary>Addition of CompletionResultSet.setHasAdditionalItems()</summary>
127
            <summary>Addition of CompletionResultSet.setHasAdditionalItems()</summary>
(-)a/editor.completion/manifest.mf (-1 / +1 lines)
Lines 2-7 OpenIDE-Module: org.netbeans.modules.edi Link Here
2
OpenIDE-Module: org.netbeans.modules.editor.completion/1
2
OpenIDE-Module: org.netbeans.modules.editor.completion/1
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/completion/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/editor/completion/Bundle.properties
4
OpenIDE-Module-Install: org/netbeans/modules/editor/completion/CompletionModule.class
4
OpenIDE-Module-Install: org/netbeans/modules/editor/completion/CompletionModule.class
5
OpenIDE-Module-Specification-Version: 1.10
5
OpenIDE-Module-Specification-Version: 1.11
6
OpenIDE-Module-Layer: org/netbeans/modules/editor/completion/resources/layer.xml
6
OpenIDE-Module-Layer: org/netbeans/modules/editor/completion/resources/layer.xml
7
AutoUpdate-Show-In-Client: false
7
AutoUpdate-Show-In-Client: false
(-)a/editor.completion/src/org/netbeans/modules/editor/completion/Bundle.properties (-1 / +1 lines)
Lines 50-56 HINT_doc_browser_show_web_button=Show do Link Here
50
HINT_doc_browser_show_web_button=Show documentation in external web browser
50
HINT_doc_browser_show_web_button=Show documentation in external web browser
51
HINT_doc_browser_goto_source_button=Open source in editor
51
HINT_doc_browser_goto_source_button=Open source in editor
52
52
53
TXT_completion_shortcut_tips=Imported Items; Press {0} Again for All Items
53
TXT_completion_shortcut_tips={0}Press {1} Again for All Items
54
54
55
55
56
56
(-)a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionImpl.java (-5 / +10 lines)
Lines 244-250 CaretListener, KeyListener, FocusListene Link Here
244
                    }
244
                    }
245
                }
245
                }
246
                layout.showCompletion(Collections.singletonList(waitText),
246
                layout.showCompletion(Collections.singletonList(waitText),
247
                        null, -1, CompletionImpl.this, null, 0);
247
                        null, -1, CompletionImpl.this, null, null, 0);
248
                pleaseWaitDisplayed = true;                
248
                pleaseWaitDisplayed = true;                
249
            }
249
            }
250
        });
250
        });
Lines 593-599 CaretListener, KeyListener, FocusListene Link Here
593
            }
593
            }
594
        } else {
594
        } else {
595
            completionCancel();
595
            completionCancel();
596
            layout.showCompletion(Collections.singletonList(NO_SUGGESTIONS), null, -1, CompletionImpl.this, null, 0);
596
            layout.showCompletion(Collections.singletonList(NO_SUGGESTIONS), null, -1, CompletionImpl.this, null, null, 0);
597
            pleaseWaitDisplayed = false;
597
            pleaseWaitDisplayed = false;
598
        }
598
        }
599
    }
599
    }
Lines 770-775 outer: for (Iterator it = localComp Link Here
770
        String title = null;
770
        String title = null;
771
        int anchorOffset = -1;
771
        int anchorOffset = -1;
772
        boolean hasAdditionalItems = false;
772
        boolean hasAdditionalItems = false;
773
        final StringBuilder hasAdditionalItemsText = new StringBuilder();
773
        if (size > 0) {
774
        if (size > 0) {
774
            for (int i = 0; i < completionResultSets.size(); i++) {
775
            for (int i = 0; i < completionResultSets.size(); i++) {
775
                CompletionResultSetImpl resultSet = completionResultSets.get(i);
776
                CompletionResultSetImpl resultSet = completionResultSets.get(i);
Lines 778-785 outer: for (Iterator it = localComp Link Here
778
                    resultItems.addAll(items);
779
                    resultItems.addAll(items);
779
                    if (title == null)
780
                    if (title == null)
780
                        title = resultSet.getTitle();
781
                        title = resultSet.getTitle();
781
                    if (!hasAdditionalItems)
782
                    if (resultSet.hasAdditionalItems()) {
782
                        hasAdditionalItems = resultSet.hasAdditionalItems();
783
                        hasAdditionalItems = true;
784
                        String s = resultSet.getHasAdditionalItemsText();
785
                        if (s != null)
786
                            hasAdditionalItemsText.append(s);
787
                    }
783
                    if (anchorOffset == -1)
788
                    if (anchorOffset == -1)
784
                        anchorOffset = resultSet.getAnchorOffset();
789
                        anchorOffset = resultSet.getAnchorOffset();
785
                }
790
                }
Lines 837-843 outer: for (Iterator it = localComp Link Here
837
                
842
                
838
                int selectedIndex = getCompletionPreSelectionIndex(sortedResultItems);
843
                int selectedIndex = getCompletionPreSelectionIndex(sortedResultItems);
839
                getActiveComponent().putClientProperty("completion-visible", Boolean.TRUE);
844
                getActiveComponent().putClientProperty("completion-visible", Boolean.TRUE);
840
                layout.showCompletion(noSuggestions ? Collections.singletonList(NO_SUGGESTIONS) : sortedResultItems, displayTitle, displayAnchorOffset, CompletionImpl.this, displayAdditionalItems ? completionShortcut : null, selectedIndex);
845
                layout.showCompletion(noSuggestions ? Collections.singletonList(NO_SUGGESTIONS) : sortedResultItems, displayTitle, displayAnchorOffset, CompletionImpl.this, displayAdditionalItems ? hasAdditionalItemsText.toString() : null, displayAdditionalItems ? completionShortcut : null, selectedIndex);
841
                pleaseWaitDisplayed = false;
846
                pleaseWaitDisplayed = false;
842
847
843
                // Show documentation as well if set by default
848
                // Show documentation as well if set by default
(-)a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionLayout.java (-4 / +4 lines)
Lines 133-140 public final class CompletionLayout { Link Here
133
    }
133
    }
134
134
135
    public void showCompletion(List data, String title, int anchorOffset,
135
    public void showCompletion(List data, String title, int anchorOffset,
136
    ListSelectionListener listSelectionListener, String shortcutHint, int selectedIndex) {
136
    ListSelectionListener listSelectionListener, String additionalItemsText, String shortcutHint, int selectedIndex) {
137
        completionPopup.show(data, title, anchorOffset, listSelectionListener, shortcutHint, selectedIndex);
137
        completionPopup.show(data, title, anchorOffset, listSelectionListener, additionalItemsText, shortcutHint, selectedIndex);
138
        if (!visiblePopups.contains(completionPopup))
138
        if (!visiblePopups.contains(completionPopup))
139
            visiblePopups.push(completionPopup);
139
            visiblePopups.push(completionPopup);
140
    }
140
    }
Lines 294-300 public final class CompletionLayout { Link Here
294
        private CompletionScrollPane completionScrollPane;
294
        private CompletionScrollPane completionScrollPane;
295
        
295
        
296
        public void show(List data, String title, int anchorOffset,
296
        public void show(List data, String title, int anchorOffset,
297
        ListSelectionListener listSelectionListener, String shortcutHint, int selectedIndex) {
297
        ListSelectionListener listSelectionListener, String additionalItemsText, String shortcutHint, int selectedIndex) {
298
            
298
            
299
	    JTextComponent editorComponent = getEditorComponent();
299
	    JTextComponent editorComponent = getEditorComponent();
300
	    if (editorComponent == null) {
300
	    if (editorComponent == null) {
Lines 345-351 public final class CompletionLayout { Link Here
345
                            BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.gray), BorderFactory.createEmptyBorder(2, 2, 2, 2))));
345
                            BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 1, 1, 1, Color.gray), BorderFactory.createEmptyBorder(2, 2, 2, 2))));
346
                    label.setFont(label.getFont().deriveFont((float)label.getFont().getSize() - 2));
346
                    label.setFont(label.getFont().deriveFont((float)label.getFont().getSize() - 2));
347
                    label.setHorizontalAlignment(SwingConstants.RIGHT);
347
                    label.setHorizontalAlignment(SwingConstants.RIGHT);
348
                    label.setText(NbBundle.getMessage(CompletionLayout.class, "TXT_completion_shortcut_tips", shortcutHint)); //NOI18N
348
                    label.setText(NbBundle.getMessage(CompletionLayout.class, "TXT_completion_shortcut_tips", additionalItemsText, shortcutHint)); //NOI18N
349
                    panel.add(label, BorderLayout.SOUTH);
349
                    panel.add(label, BorderLayout.SOUTH);
350
                    setContentComponent(panel);
350
                    setContentComponent(panel);
351
                } else {
351
                } else {
(-)a/editor.completion/src/org/netbeans/modules/editor/completion/CompletionResultSetImpl.java (+14 lines)
Lines 92-97 public final class CompletionResultSetIm Link Here
92
    private List<CompletionItem> items;
92
    private List<CompletionItem> items;
93
    
93
    
94
    private boolean hasAdditionalItems;
94
    private boolean hasAdditionalItems;
95
    
96
    private String hasAdditionalItemsText;
95
    
97
    
96
    private boolean finished;
98
    private boolean finished;
97
    
99
    
Lines 218-223 public final class CompletionResultSetIm Link Here
218
        return hasAdditionalItems;
220
        return hasAdditionalItems;
219
    }    
221
    }    
220
    
222
    
223
    public synchronized void setHasAdditionalItemsText(String text) {
224
        checkNotFinished();
225
        if (queryType != CompletionProvider.COMPLETION_QUERY_TYPE) {
226
            return;
227
        }
228
        this.hasAdditionalItemsText = text;
229
    }
230
    
231
    public synchronized String getHasAdditionalItemsText() {
232
        return hasAdditionalItemsText;
233
    }
234
221
    public synchronized void setDocumentation(CompletionDocumentation documentation) {
235
    public synchronized void setDocumentation(CompletionDocumentation documentation) {
222
        checkNotFinished();
236
        checkNotFinished();
223
        if (!active || queryType != CompletionProvider.DOCUMENTATION_QUERY_TYPE) {
237
        if (!active || queryType != CompletionProvider.DOCUMENTATION_QUERY_TYPE) {
(-)a/editor.completion/src/org/netbeans/spi/editor/completion/CompletionResultSet.java (+15 lines)
Lines 193-198 public final class CompletionResultSet { Link Here
193
    public void setHasAdditionalItems(boolean value) {
193
    public void setHasAdditionalItems(boolean value) {
194
        impl.setHasAdditionalItems(value);
194
        impl.setHasAdditionalItems(value);
195
    }
195
    }
196
        
197
    /**
198
     * Set the text to be displayed in a completion popup whenever a {@link CompletionProvider}
199
     * indicates that additional items could be added to this result set by passing
200
     * <code>true</code> to {@link CompletionResultSet#setHasAdditionalItems(boolean)}.
201
     *
202
     * @param text the text that will be prepend to the "Press 'Ctrl-Space' Again for All Items"
203
     * message in the completion popup. <code>null</code> can be passed to revert any previous
204
     * setting of the text.
205
     *  
206
     * @since 1.11
207
     */
208
    public void setHasAdditionalItemsText(String text) {
209
        impl.setHasAdditionalItemsText(text);
210
    }
196
    
211
    
197
    /**
212
    /**
198
     * Set the documentation to this result set.
213
     * Set the documentation to this result set.

Return to bug 124351