Lines 38-50
Link Here
|
38 |
* Version 2 license, then the option applies only if the new code is |
38 |
* Version 2 license, then the option applies only if the new code is |
39 |
* made subject to such option by the copyright holder. |
39 |
* made subject to such option by the copyright holder. |
40 |
*/ |
40 |
*/ |
41 |
|
|
|
42 |
package org.netbeans.modules.java.editor.options; |
41 |
package org.netbeans.modules.java.editor.options; |
43 |
|
42 |
|
|
|
43 |
import java.awt.Component; |
44 |
import java.util.Arrays; |
45 |
import java.util.Collection; |
46 |
import java.util.TreeSet; |
47 |
import java.util.Vector; |
44 |
import java.util.prefs.Preferences; |
48 |
import java.util.prefs.Preferences; |
45 |
import javax.swing.JComponent; |
49 |
import javax.swing.JComponent; |
|
|
50 |
import javax.swing.JTable; |
46 |
import javax.swing.event.DocumentEvent; |
51 |
import javax.swing.event.DocumentEvent; |
47 |
import javax.swing.event.DocumentListener; |
52 |
import javax.swing.event.DocumentListener; |
|
|
53 |
import javax.swing.event.TableModelEvent; |
54 |
import javax.swing.event.TableModelListener; |
55 |
import javax.swing.table.DefaultTableModel; |
48 |
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer; |
56 |
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer; |
49 |
import org.openide.util.HelpCtx; |
57 |
import org.openide.util.HelpCtx; |
50 |
|
58 |
|
Lines 52-76
Link Here
|
52 |
* |
60 |
* |
53 |
* @author Dusan Balek |
61 |
* @author Dusan Balek |
54 |
*/ |
62 |
*/ |
55 |
public class CodeCompletionPanel extends javax.swing.JPanel implements DocumentListener { |
63 |
public class CodeCompletionPanel extends javax.swing.JPanel implements DocumentListener, TableModelListener { |
56 |
|
64 |
|
57 |
public static final String JAVA_AUTO_POPUP_ON_IDENTIFIER_PART = "javaAutoPopupOnIdentifierPart"; //NOI18N |
65 |
public static final String JAVA_AUTO_POPUP_ON_IDENTIFIER_PART = "javaAutoPopupOnIdentifierPart"; //NOI18N |
|
|
66 |
public static final boolean JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT = false; |
58 |
public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N |
67 |
public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N |
|
|
68 |
public static final String JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT = "."; //NOI18N |
59 |
public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N |
69 |
public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N |
|
|
70 |
public static final String JAVA_COMPLETION_SELECTORS_DEFAULT = ".,;:([+-="; //NOI18N |
60 |
public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N |
71 |
public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N |
|
|
72 |
public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT = ".#@"; //NOI18N |
61 |
public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N |
73 |
public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N |
|
|
74 |
public static final boolean GUESS_METHOD_ARGUMENTS_DEFAULT = true; |
75 |
public static final String JAVA_COMPLETION_WHITELIST = "javaCompletionWhitelist"; //NOI18N |
76 |
public static final String JAVA_COMPLETION_WHITELIST_DEFAULT = ""; //NOI18N |
77 |
public static final String JAVA_COMPLETION_BLACKLIST = "javaCompletionBlacklist"; //NOI18N |
78 |
public static final String JAVA_COMPLETION_BLACKLIST_DEFAULT = ""; //NOI18N |
62 |
|
79 |
|
63 |
private Preferences preferences; |
80 |
private final Preferences preferences; |
64 |
|
81 |
|
|
|
82 |
private void initExcluderTable(JTable table, String pref) { |
83 |
String[] entries = pref.split(","); //NOI18N |
84 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
85 |
for (String entry : entries) { |
86 |
if (entry.length() > 0) { |
87 |
model.addRow(new String[]{entry}); |
88 |
} |
89 |
} |
90 |
model.addTableModelListener(this); |
91 |
} |
92 |
|
65 |
/** Creates new form FmtTabsIndents */ |
93 |
/** Creates new form FmtTabsIndents */ |
66 |
public CodeCompletionPanel(Preferences p) { |
94 |
public CodeCompletionPanel(Preferences p) { |
67 |
initComponents(); |
95 |
initComponents(); |
68 |
preferences = p; |
96 |
preferences = p; |
69 |
guessMethodArguments.setSelected(preferences.getBoolean(GUESS_METHOD_ARGUMENTS, true)); |
97 |
guessMethodArguments.setSelected(preferences.getBoolean(GUESS_METHOD_ARGUMENTS, GUESS_METHOD_ARGUMENTS_DEFAULT)); |
70 |
javaAutoPopupOnIdentifierPart.setSelected(preferences.getBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, false)); |
98 |
javaAutoPopupOnIdentifierPart.setSelected(preferences.getBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT)); |
71 |
javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, ".")); //NOI18N |
99 |
javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT)); |
72 |
javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, ".,;:([+-=")); //NOI18N |
100 |
javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, JAVA_COMPLETION_SELECTORS_DEFAULT)); |
73 |
javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, ".#@")); //NOI18N |
101 |
javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT)); |
|
|
102 |
String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, JAVA_COMPLETION_BLACKLIST_DEFAULT); |
103 |
initExcluderTable(javaCompletionExcludeTable, blacklist); |
104 |
String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, JAVA_COMPLETION_WHITELIST); |
105 |
initExcluderTable(javaCompletionIncludeTable, whitelist); |
74 |
javaAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
106 |
javaAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
75 |
javaCompletionSelectorsField.getDocument().addDocumentListener(this); |
107 |
javaCompletionSelectorsField.getDocument().addDocumentListener(this); |
76 |
javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
108 |
javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
Lines 97-102
Link Here
|
97 |
update(e); |
129 |
update(e); |
98 |
} |
130 |
} |
99 |
|
131 |
|
|
|
132 |
// allows common excluder buttons to know which table to act on |
133 |
private JTable getSelectedExcluderTable() { |
134 |
Component selected = javaCompletionExcluderTab.getSelectedComponent(); |
135 |
if (selected == javaCompletionExcludeScrollPane) { |
136 |
return javaCompletionExcludeTable; |
137 |
} else if (selected == javaCompletionIncludeScrollPane) { |
138 |
return javaCompletionIncludeTable; |
139 |
} else { |
140 |
throw new RuntimeException(selected.getName()); |
141 |
} |
142 |
} |
143 |
|
144 |
// listen to changes in the excluder lists, and do sanity checking on input |
145 |
public void tableChanged(TableModelEvent e) { |
146 |
DefaultTableModel model = (DefaultTableModel) e.getSource(); |
147 |
String pref; |
148 |
if (model == javaCompletionExcludeTable.getModel()) { |
149 |
pref = JAVA_COMPLETION_BLACKLIST; |
150 |
} else if (model == javaCompletionIncludeTable.getModel()) { |
151 |
pref = JAVA_COMPLETION_WHITELIST; |
152 |
} else { |
153 |
throw new RuntimeException(); |
154 |
} |
155 |
@SuppressWarnings("unchecked") |
156 |
Vector<Vector<String>> data = model.getDataVector(); |
157 |
Collection<String> entries = new TreeSet<String>(); |
158 |
for (Vector<String> row : data) { |
159 |
String entry = row.elementAt(0); |
160 |
if (entry == null) { |
161 |
continue; |
162 |
} |
163 |
entry = entry.trim(); |
164 |
if (entry.length() == 0) { |
165 |
continue; |
166 |
} |
167 |
// this could be checked by a custom editor on input |
168 |
if (!entry.matches("[$\\w._]*")) { //NOI18N |
169 |
continue; |
170 |
} |
171 |
entries.add(entry); |
172 |
} |
173 |
StringBuilder builder = new StringBuilder(); |
174 |
for (String entry : entries) { |
175 |
if (builder.length() > 0) { |
176 |
builder.append(","); //NOI18N |
177 |
} |
178 |
builder.append(entry); |
179 |
} |
180 |
preferences.put(pref, builder.toString()); |
181 |
} |
182 |
|
100 |
/** This method is called from within the constructor to |
183 |
/** This method is called from within the constructor to |
101 |
* initialize the form. |
184 |
* initialize the form. |
102 |
* WARNING: Do NOT modify this code. The content of this method is |
185 |
* WARNING: Do NOT modify this code. The content of this method is |
Lines 105-110
Link Here
|
105 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
188 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
106 |
private void initComponents() { |
189 |
private void initComponents() { |
107 |
|
190 |
|
|
|
191 |
javaCompletionExcluderFrame = new javax.swing.JFrame(); |
192 |
javaCompletionExcluderTab = new javax.swing.JTabbedPane(); |
193 |
javaCompletionExcludeScrollPane = new javax.swing.JScrollPane(); |
194 |
javaCompletionExcludeTable = new javax.swing.JTable(); |
195 |
javaCompletionIncludeScrollPane = new javax.swing.JScrollPane(); |
196 |
javaCompletionIncludeTable = new javax.swing.JTable(); |
197 |
javaCompletionExcluderAddButton = new javax.swing.JButton(); |
198 |
javaCompletionExcluderRemoveButton = new javax.swing.JButton(); |
199 |
javaCompletionExcluderCloseButton = new javax.swing.JButton(); |
200 |
javaCompletionPane = new javax.swing.JPanel(); |
108 |
guessMethodArguments = new javax.swing.JCheckBox(); |
201 |
guessMethodArguments = new javax.swing.JCheckBox(); |
109 |
javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox(); |
202 |
javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox(); |
110 |
javaAutoCompletionTriggersLabel = new javax.swing.JLabel(); |
203 |
javaAutoCompletionTriggersLabel = new javax.swing.JLabel(); |
Lines 114-124
Link Here
|
114 |
javadocAutoCompletionTriggersLabel = new javax.swing.JLabel(); |
207 |
javadocAutoCompletionTriggersLabel = new javax.swing.JLabel(); |
115 |
javadocAutoCompletionTriggersField = new javax.swing.JTextField(); |
208 |
javadocAutoCompletionTriggersField = new javax.swing.JTextField(); |
116 |
jSeparator1 = new javax.swing.JSeparator(); |
209 |
jSeparator1 = new javax.swing.JSeparator(); |
|
|
210 |
javaCompletionExcluderLabel = new javax.swing.JLabel(); |
211 |
javaCompletionExcluderButton = new javax.swing.JButton(); |
117 |
|
212 |
|
|
|
213 |
javaCompletionExcluderFrame.setTitle(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderFrame.title")); // NOI18N |
214 |
javaCompletionExcluderFrame.setAlwaysOnTop(true); |
215 |
javaCompletionExcluderFrame.setMinimumSize(new java.awt.Dimension(409, 233)); |
216 |
javaCompletionExcluderFrame.setUndecorated(true); |
217 |
|
218 |
javaCompletionExcludeTable.setModel(new javax.swing.table.DefaultTableModel( |
219 |
new Object [][] { |
220 |
|
221 |
}, |
222 |
new String [] { |
223 |
"Fully Qualified Name prefix" |
224 |
} |
225 |
) { |
226 |
Class[] types = new Class [] { |
227 |
java.lang.String.class |
228 |
}; |
229 |
|
230 |
public Class getColumnClass(int columnIndex) { |
231 |
return types [columnIndex]; |
232 |
} |
233 |
}); |
234 |
javaCompletionExcludeTable.getTableHeader().setReorderingAllowed(false); |
235 |
javaCompletionExcludeScrollPane.setViewportView(javaCompletionExcludeTable); |
236 |
javaCompletionExcludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N |
237 |
|
238 |
javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle"), javaCompletionExcludeScrollPane); // NOI18N |
239 |
|
240 |
javaCompletionIncludeTable.setModel(new javax.swing.table.DefaultTableModel( |
241 |
new Object [][] { |
242 |
|
243 |
}, |
244 |
new String [] { |
245 |
"Fully Qualified Name prefix" |
246 |
} |
247 |
) { |
248 |
Class[] types = new Class [] { |
249 |
java.lang.String.class |
250 |
}; |
251 |
|
252 |
public Class getColumnClass(int columnIndex) { |
253 |
return types [columnIndex]; |
254 |
} |
255 |
}); |
256 |
javaCompletionIncludeTable.getTableHeader().setReorderingAllowed(false); |
257 |
javaCompletionIncludeScrollPane.setViewportView(javaCompletionIncludeTable); |
258 |
javaCompletionIncludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N |
259 |
|
260 |
javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle"), javaCompletionIncludeScrollPane); // NOI18N |
261 |
|
262 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderAddButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderAddButton.text")); // NOI18N |
263 |
javaCompletionExcluderAddButton.addActionListener(new java.awt.event.ActionListener() { |
264 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
265 |
javaCompletionExcluderAddButtonActionPerformed(evt); |
266 |
} |
267 |
}); |
268 |
|
269 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderRemoveButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderRemoveButton.text")); // NOI18N |
270 |
javaCompletionExcluderRemoveButton.addActionListener(new java.awt.event.ActionListener() { |
271 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
272 |
javaCompletionExcluderRemoveButtonActionPerformed(evt); |
273 |
} |
274 |
}); |
275 |
|
276 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderCloseButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderCloseButton.text")); // NOI18N |
277 |
javaCompletionExcluderCloseButton.addActionListener(new java.awt.event.ActionListener() { |
278 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
279 |
javaCompletionExcluderCloseButtonActionPerformed(evt); |
280 |
} |
281 |
}); |
282 |
|
283 |
org.jdesktop.layout.GroupLayout javaCompletionExcluderFrameLayout = new org.jdesktop.layout.GroupLayout(javaCompletionExcluderFrame.getContentPane()); |
284 |
javaCompletionExcluderFrame.getContentPane().setLayout(javaCompletionExcluderFrameLayout); |
285 |
javaCompletionExcluderFrameLayout.setHorizontalGroup( |
286 |
javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
287 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionExcluderFrameLayout.createSequentialGroup() |
288 |
.addContainerGap() |
289 |
.add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
290 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
291 |
.add(javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) |
292 |
.add(javaCompletionExcluderCloseButton, 0, 0, Short.MAX_VALUE) |
293 |
.add(javaCompletionExcluderRemoveButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
294 |
.add(javaCompletionExcluderAddButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
295 |
.addContainerGap(10, Short.MAX_VALUE)) |
296 |
); |
297 |
javaCompletionExcluderFrameLayout.setVerticalGroup( |
298 |
javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
299 |
.add(javaCompletionExcluderFrameLayout.createSequentialGroup() |
300 |
.add(javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
301 |
.add(javaCompletionExcluderFrameLayout.createSequentialGroup() |
302 |
.addContainerGap() |
303 |
.add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 221, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
304 |
.add(javaCompletionExcluderFrameLayout.createSequentialGroup() |
305 |
.add(59, 59, 59) |
306 |
.add(javaCompletionExcluderAddButton) |
307 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
308 |
.add(javaCompletionExcluderRemoveButton) |
309 |
.add(63, 63, 63) |
310 |
.add(javaCompletionExcluderCloseButton))) |
311 |
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
312 |
); |
313 |
|
118 |
setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
314 |
setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
119 |
|
315 |
|
120 |
org.openide.awt.Mnemonics.setLocalizedText(guessMethodArguments, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_GuessMethodArgs")); // NOI18N |
316 |
org.openide.awt.Mnemonics.setLocalizedText(guessMethodArguments, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_GuessMethodArgs")); // NOI18N |
121 |
guessMethodArguments.setBorder(null); |
|
|
122 |
guessMethodArguments.addActionListener(new java.awt.event.ActionListener() { |
317 |
guessMethodArguments.addActionListener(new java.awt.event.ActionListener() { |
123 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
318 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
124 |
guessMethodArgumentsActionPerformed(evt); |
319 |
guessMethodArgumentsActionPerformed(evt); |
Lines 126-132
Link Here
|
126 |
}); |
321 |
}); |
127 |
|
322 |
|
128 |
org.openide.awt.Mnemonics.setLocalizedText(javaAutoPopupOnIdentifierPart, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_AutoPopupOnIdentifierPartBox")); // NOI18N |
323 |
org.openide.awt.Mnemonics.setLocalizedText(javaAutoPopupOnIdentifierPart, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_AutoPopupOnIdentifierPartBox")); // NOI18N |
129 |
javaAutoPopupOnIdentifierPart.setBorder(null); |
|
|
130 |
javaAutoPopupOnIdentifierPart.addActionListener(new java.awt.event.ActionListener() { |
324 |
javaAutoPopupOnIdentifierPart.addActionListener(new java.awt.event.ActionListener() { |
131 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
325 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
132 |
javaAutoPopupOnIdentifierPartActionPerformed(evt); |
326 |
javaAutoPopupOnIdentifierPartActionPerformed(evt); |
Lines 146-198
Link Here
|
146 |
|
340 |
|
147 |
javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N |
341 |
javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N |
148 |
|
342 |
|
149 |
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); |
343 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderLabel, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderLabel.text")); // NOI18N |
150 |
this.setLayout(layout); |
344 |
|
151 |
layout.setHorizontalGroup( |
345 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderButton.text")); // NOI18N |
152 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
346 |
javaCompletionExcluderButton.addActionListener(new java.awt.event.ActionListener() { |
153 |
.add(layout.createSequentialGroup() |
347 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
|
|
348 |
javaCompletionExcluderButtonActionPerformed(evt); |
349 |
} |
350 |
}); |
351 |
|
352 |
org.jdesktop.layout.GroupLayout javaCompletionPaneLayout = new org.jdesktop.layout.GroupLayout(javaCompletionPane); |
353 |
javaCompletionPane.setLayout(javaCompletionPaneLayout); |
354 |
javaCompletionPaneLayout.setHorizontalGroup( |
355 |
javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
356 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
154 |
.addContainerGap() |
357 |
.addContainerGap() |
155 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
358 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
156 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE) |
359 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE) |
|
|
360 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
361 |
.add(javadocAutoCompletionTriggersLabel) |
362 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
363 |
.add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) |
364 |
.addContainerGap()) |
365 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
366 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
367 |
.addContainerGap() |
368 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
157 |
.add(guessMethodArguments) |
369 |
.add(guessMethodArguments) |
158 |
.add(layout.createSequentialGroup() |
370 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
159 |
.add(javaAutoCompletionTriggersLabel) |
371 |
.add(javaAutoCompletionTriggersLabel) |
160 |
.add(34, 34, 34) |
372 |
.add(34, 34, 34) |
161 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
373 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
162 |
.add(javaAutoPopupOnIdentifierPart) |
374 |
.add(javaAutoPopupOnIdentifierPart) |
163 |
.add(layout.createSequentialGroup() |
375 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
164 |
.add(javaCompletionSelectorsLabel) |
376 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
|
|
377 |
.add(javaCompletionExcluderLabel) |
378 |
.add(javaCompletionSelectorsLabel)) |
379 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
380 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
165 |
.add(30, 30, 30) |
381 |
.add(30, 30, 30) |
166 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
382 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
167 |
.add(layout.createSequentialGroup() |
383 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup() |
168 |
.add(javadocAutoCompletionTriggersLabel) |
384 |
.add(23, 23, 23) |
169 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
385 |
.add(javaCompletionExcluderButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) |
170 |
.add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) |
386 |
.addContainerGap(25, Short.MAX_VALUE))) |
171 |
.addContainerGap()) |
|
|
172 |
); |
387 |
); |
173 |
layout.setVerticalGroup( |
388 |
javaCompletionPaneLayout.setVerticalGroup( |
174 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
389 |
javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
175 |
.add(layout.createSequentialGroup() |
390 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
|
|
391 |
.add(171, 171, 171) |
392 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
393 |
.add(18, 18, 18) |
394 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
395 |
.add(javadocAutoCompletionTriggersLabel) |
396 |
.add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
397 |
.addContainerGap(23, Short.MAX_VALUE)) |
398 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
399 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
176 |
.addContainerGap() |
400 |
.addContainerGap() |
177 |
.add(guessMethodArguments) |
401 |
.add(guessMethodArguments, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
178 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
402 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
179 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
403 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
180 |
.add(javaAutoCompletionTriggersLabel) |
404 |
.add(javaAutoCompletionTriggersLabel) |
181 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
405 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
182 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
406 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
183 |
.add(javaAutoPopupOnIdentifierPart) |
407 |
.add(javaAutoPopupOnIdentifierPart) |
184 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
408 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
185 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
409 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
186 |
.add(javaCompletionSelectorsLabel) |
410 |
.add(javaCompletionSelectorsLabel) |
187 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
411 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
188 |
.add(18, 18, 18) |
412 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
189 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
413 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
190 |
.add(18, 18, 18) |
414 |
.add(javaCompletionExcluderButton) |
191 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
415 |
.add(javaCompletionExcluderLabel)) |
192 |
.add(javadocAutoCompletionTriggersLabel) |
416 |
.addContainerGap(91, Short.MAX_VALUE))) |
193 |
.add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
|
|
194 |
.addContainerGap(30, Short.MAX_VALUE)) |
195 |
); |
417 |
); |
|
|
418 |
|
419 |
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); |
420 |
this.setLayout(layout); |
421 |
layout.setHorizontalGroup( |
422 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
423 |
.add(javaCompletionPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
424 |
); |
425 |
layout.setVerticalGroup( |
426 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
427 |
.add(javaCompletionPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
428 |
); |
196 |
}// </editor-fold>//GEN-END:initComponents |
429 |
}// </editor-fold>//GEN-END:initComponents |
197 |
|
430 |
|
198 |
private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed |
431 |
private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed |
Lines 203-208
Link Here
|
203 |
preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected()); |
436 |
preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected()); |
204 |
}//GEN-LAST:event_guessMethodArgumentsActionPerformed |
437 |
}//GEN-LAST:event_guessMethodArgumentsActionPerformed |
205 |
|
438 |
|
|
|
439 |
private void javaCompletionExcluderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderButtonActionPerformed |
440 |
if (javaCompletionExcluderFrame.isVisible()) |
441 |
return; |
442 |
javaCompletionExcluderFrame.pack(); |
443 |
javaCompletionExcluderFrame.setLocationRelativeTo(this); |
444 |
javaCompletionExcluderFrame.setVisible(true); |
445 |
}//GEN-LAST:event_javaCompletionExcluderButtonActionPerformed |
446 |
|
447 |
private void javaCompletionExcluderAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderAddButtonActionPerformed |
448 |
JTable table = getSelectedExcluderTable(); |
449 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
450 |
int rows = model.getRowCount(); |
451 |
model.setRowCount(rows + 1); |
452 |
table.editCellAt(rows, 0); |
453 |
table.requestFocus(); |
454 |
}//GEN-LAST:event_javaCompletionExcluderAddButtonActionPerformed |
455 |
|
456 |
private void javaCompletionExcluderRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderRemoveButtonActionPerformed |
457 |
JTable table = getSelectedExcluderTable(); |
458 |
int[] rows = table.getSelectedRows(); |
459 |
if (rows.length == 0) |
460 |
return; |
461 |
// remove rows in descending order: row numbers change when a row is removed |
462 |
Arrays.sort(rows); |
463 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
464 |
for (int row = rows.length - 1 ; row >=0 ; row--) { |
465 |
model.removeRow(row); |
466 |
} |
467 |
}//GEN-LAST:event_javaCompletionExcluderRemoveButtonActionPerformed |
468 |
|
469 |
private void javaCompletionExcluderCloseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderCloseButtonActionPerformed |
470 |
javaCompletionExcluderFrame.setVisible(false); |
471 |
}//GEN-LAST:event_javaCompletionExcluderCloseButtonActionPerformed |
472 |
|
206 |
private void update(DocumentEvent e) { |
473 |
private void update(DocumentEvent e) { |
207 |
if (e.getDocument() == javaAutoCompletionTriggersField.getDocument()) |
474 |
if (e.getDocument() == javaAutoCompletionTriggersField.getDocument()) |
208 |
preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText()); |
475 |
preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText()); |
Lines 218-223
Link Here
|
218 |
private javax.swing.JTextField javaAutoCompletionTriggersField; |
485 |
private javax.swing.JTextField javaAutoCompletionTriggersField; |
219 |
private javax.swing.JLabel javaAutoCompletionTriggersLabel; |
486 |
private javax.swing.JLabel javaAutoCompletionTriggersLabel; |
220 |
private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart; |
487 |
private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart; |
|
|
488 |
private javax.swing.JScrollPane javaCompletionExcludeScrollPane; |
489 |
private javax.swing.JTable javaCompletionExcludeTable; |
490 |
private javax.swing.JButton javaCompletionExcluderAddButton; |
491 |
private javax.swing.JButton javaCompletionExcluderButton; |
492 |
private javax.swing.JButton javaCompletionExcluderCloseButton; |
493 |
private javax.swing.JFrame javaCompletionExcluderFrame; |
494 |
private javax.swing.JLabel javaCompletionExcluderLabel; |
495 |
private javax.swing.JButton javaCompletionExcluderRemoveButton; |
496 |
private javax.swing.JTabbedPane javaCompletionExcluderTab; |
497 |
private javax.swing.JScrollPane javaCompletionIncludeScrollPane; |
498 |
private javax.swing.JTable javaCompletionIncludeTable; |
499 |
private javax.swing.JPanel javaCompletionPane; |
221 |
private javax.swing.JTextField javaCompletionSelectorsField; |
500 |
private javax.swing.JTextField javaCompletionSelectorsField; |
222 |
private javax.swing.JLabel javaCompletionSelectorsLabel; |
501 |
private javax.swing.JLabel javaCompletionSelectorsLabel; |
223 |
private javax.swing.JTextField javadocAutoCompletionTriggersField; |
502 |
private javax.swing.JTextField javadocAutoCompletionTriggersField; |
Lines 226-232
Link Here
|
226 |
|
505 |
|
227 |
private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer { |
506 |
private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer { |
228 |
|
507 |
|
229 |
private Preferences preferences; |
508 |
private final Preferences preferences; |
230 |
|
509 |
|
231 |
private CodeCompletionPreferencesCusromizer(Preferences p) { |
510 |
private CodeCompletionPreferencesCusromizer(Preferences p) { |
232 |
preferences = p; |
511 |
preferences = p; |