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.CardLayout; |
44 |
import java.awt.Component; |
45 |
import java.util.SortedSet; |
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-67
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 |
58 |
public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N |
66 |
public static final String JAVA_AUTO_COMPLETION_TRIGGERS = "javaAutoCompletionTriggers"; //NOI18N |
59 |
public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N |
67 |
public static final String JAVA_COMPLETION_SELECTORS = "javaCompletionSelectors"; //NOI18N |
60 |
public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N |
68 |
public static final String JAVADOC_AUTO_COMPLETION_TRIGGERS = "javadocAutoCompletionTriggers"; //NOI18N |
61 |
public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N |
69 |
public static final String GUESS_METHOD_ARGUMENTS = "guessMethodArguments"; //NOI18N |
|
|
70 |
public static final String JAVA_COMPLETION_WHITELIST = "javaCompletionWhitelist"; //NOI18N |
71 |
public static final String JAVA_COMPLETION_BLACKLIST = "javaCompletionBlacklist"; //NOI18N |
62 |
|
72 |
|
63 |
private Preferences preferences; |
73 |
private final Preferences preferences; |
64 |
|
74 |
|
|
|
75 |
private void initExcluderTable(JTable table, String pref) { |
76 |
String[] entries = pref.split(","); //NOI18N |
77 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
78 |
for (String entry : entries) { |
79 |
if (entry.length() > 0) |
80 |
model.addRow(new String[]{entry}); |
81 |
} |
82 |
model.addTableModelListener(this); |
83 |
} |
84 |
|
65 |
/** Creates new form FmtTabsIndents */ |
85 |
/** Creates new form FmtTabsIndents */ |
66 |
public CodeCompletionPanel(Preferences p) { |
86 |
public CodeCompletionPanel(Preferences p) { |
67 |
initComponents(); |
87 |
initComponents(); |
Lines 71-76
Link Here
|
71 |
javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, ".")); //NOI18N |
91 |
javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, ".")); //NOI18N |
72 |
javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, ".,;:([+-=")); //NOI18N |
92 |
javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, ".,;:([+-=")); //NOI18N |
73 |
javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, ".#@")); //NOI18N |
93 |
javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, ".#@")); //NOI18N |
|
|
94 |
String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, "sun.,sunw."); //NOI18N |
95 |
initExcluderTable(javaCompletionExcludeTable, blacklist); |
96 |
String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, ""); //NOI18N |
97 |
initExcluderTable(javaCompletionIncludeTable, whitelist); |
74 |
javaAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
98 |
javaAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
75 |
javaCompletionSelectorsField.getDocument().addDocumentListener(this); |
99 |
javaCompletionSelectorsField.getDocument().addDocumentListener(this); |
76 |
javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
100 |
javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
Lines 97-102
Link Here
|
97 |
update(e); |
121 |
update(e); |
98 |
} |
122 |
} |
99 |
|
123 |
|
|
|
124 |
// allows common excluder buttons to know which table to act on |
125 |
private JTable getSelectedExcluderTable() { |
126 |
Component selected = javaCompletionExcluderTab.getSelectedComponent(); |
127 |
if (selected == javaCompletionExcludeScrollPane) |
128 |
return javaCompletionExcludeTable; |
129 |
else if (selected == javaCompletionIncludeScrollPane) |
130 |
return javaCompletionIncludeTable; |
131 |
else |
132 |
throw new RuntimeException(selected.getName()); |
133 |
} |
134 |
|
135 |
// listen to changes in the excluder lists, and do sanity checking on input |
136 |
public void tableChanged(TableModelEvent e) { |
137 |
DefaultTableModel model = (DefaultTableModel) e.getSource(); |
138 |
String pref; |
139 |
if (model == javaCompletionExcludeTable.getModel()) |
140 |
pref = JAVA_COMPLETION_BLACKLIST; |
141 |
else if (model == javaCompletionIncludeTable.getModel()) |
142 |
pref = JAVA_COMPLETION_WHITELIST; |
143 |
else |
144 |
throw new RuntimeException(); |
145 |
@SuppressWarnings("unchecked") |
146 |
Vector<Vector<String>> data = model.getDataVector(); |
147 |
SortedSet<String> entries = new TreeSet<String>(); |
148 |
for (Vector<String> row : data) { |
149 |
String entry = row.elementAt(0); |
150 |
if (entry == null) |
151 |
continue; |
152 |
entry = entry.trim(); |
153 |
if (entry.length() == 0) |
154 |
continue; |
155 |
// this could be checked by a custom editor |
156 |
if (!entry.matches("[$\\w.]*")) //NOI18N |
157 |
continue; |
158 |
entries.add(entry); |
159 |
} |
160 |
StringBuilder builder = new StringBuilder(); |
161 |
for (String entry : entries){ |
162 |
if (builder.length() > 0) |
163 |
builder.append(","); //NOI18N |
164 |
builder.append(entry); |
165 |
} |
166 |
preferences.put(pref, builder.toString()); |
167 |
} |
168 |
|
100 |
/** This method is called from within the constructor to |
169 |
/** This method is called from within the constructor to |
101 |
* initialize the form. |
170 |
* initialize the form. |
102 |
* WARNING: Do NOT modify this code. The content of this method is |
171 |
* 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 |
174 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
106 |
private void initComponents() { |
175 |
private void initComponents() { |
107 |
|
176 |
|
|
|
177 |
javaCompletionPane = new javax.swing.JPanel(); |
108 |
guessMethodArguments = new javax.swing.JCheckBox(); |
178 |
guessMethodArguments = new javax.swing.JCheckBox(); |
109 |
javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox(); |
179 |
javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox(); |
110 |
javaAutoCompletionTriggersLabel = new javax.swing.JLabel(); |
180 |
javaAutoCompletionTriggersLabel = new javax.swing.JLabel(); |
Lines 114-124
Link Here
|
114 |
javadocAutoCompletionTriggersLabel = new javax.swing.JLabel(); |
184 |
javadocAutoCompletionTriggersLabel = new javax.swing.JLabel(); |
115 |
javadocAutoCompletionTriggersField = new javax.swing.JTextField(); |
185 |
javadocAutoCompletionTriggersField = new javax.swing.JTextField(); |
116 |
jSeparator1 = new javax.swing.JSeparator(); |
186 |
jSeparator1 = new javax.swing.JSeparator(); |
|
|
187 |
javaCompletionExcluderLabel = new javax.swing.JLabel(); |
188 |
javaCompletionExcluderButton = new javax.swing.JButton(); |
189 |
javaCompletionExcluderPane = new javax.swing.JPanel(); |
190 |
javaCompletionExcluderTab = new javax.swing.JTabbedPane(); |
191 |
javaCompletionExcludeScrollPane = new javax.swing.JScrollPane(); |
192 |
javaCompletionExcludeTable = new javax.swing.JTable(); |
193 |
javaCompletionIncludeScrollPane = new javax.swing.JScrollPane(); |
194 |
javaCompletionIncludeTable = new javax.swing.JTable(); |
195 |
javaCompletionExcluderAddButton = new javax.swing.JButton(); |
196 |
javaCompletionExcluderDeleteButton = new javax.swing.JButton(); |
197 |
javaCompletionExcluderBackButton = new javax.swing.JButton(); |
117 |
|
198 |
|
118 |
setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
199 |
setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
|
|
200 |
setLayout(new java.awt.CardLayout()); |
119 |
|
201 |
|
120 |
org.openide.awt.Mnemonics.setLocalizedText(guessMethodArguments, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_GuessMethodArgs")); // NOI18N |
202 |
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() { |
203 |
guessMethodArguments.addActionListener(new java.awt.event.ActionListener() { |
123 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
204 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
124 |
guessMethodArgumentsActionPerformed(evt); |
205 |
guessMethodArgumentsActionPerformed(evt); |
Lines 126-132
Link Here
|
126 |
}); |
207 |
}); |
127 |
|
208 |
|
128 |
org.openide.awt.Mnemonics.setLocalizedText(javaAutoPopupOnIdentifierPart, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "LBL_AutoPopupOnIdentifierPartBox")); // NOI18N |
209 |
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() { |
210 |
javaAutoPopupOnIdentifierPart.addActionListener(new java.awt.event.ActionListener() { |
131 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
211 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
132 |
javaAutoPopupOnIdentifierPartActionPerformed(evt); |
212 |
javaAutoPopupOnIdentifierPartActionPerformed(evt); |
Lines 146-208
Link Here
|
146 |
|
226 |
|
147 |
javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N |
227 |
javadocAutoCompletionTriggersField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javadocAutoCompletionTriggersField.text")); // NOI18N |
148 |
|
228 |
|
149 |
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this); |
229 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderLabel, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderLabel.text")); // NOI18N |
150 |
this.setLayout(layout); |
230 |
|
151 |
layout.setHorizontalGroup( |
231 |
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) |
232 |
javaCompletionExcluderButton.addActionListener(new java.awt.event.ActionListener() { |
153 |
.add(layout.createSequentialGroup() |
233 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
|
|
234 |
javaCompletionExcluderButtonActionPerformed(evt); |
235 |
} |
236 |
}); |
237 |
|
238 |
org.jdesktop.layout.GroupLayout javaCompletionPaneLayout = new org.jdesktop.layout.GroupLayout(javaCompletionPane); |
239 |
javaCompletionPane.setLayout(javaCompletionPaneLayout); |
240 |
javaCompletionPaneLayout.setHorizontalGroup( |
241 |
javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
242 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
154 |
.addContainerGap() |
243 |
.addContainerGap() |
155 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
244 |
.add(javadocAutoCompletionTriggersLabel) |
156 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 362, Short.MAX_VALUE) |
245 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
|
246 |
.add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
247 |
.addContainerGap(115, Short.MAX_VALUE)) |
248 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
249 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
250 |
.addContainerGap() |
251 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
157 |
.add(guessMethodArguments) |
252 |
.add(guessMethodArguments) |
158 |
.add(layout.createSequentialGroup() |
253 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
159 |
.add(javaAutoCompletionTriggersLabel) |
254 |
.add(javaAutoCompletionTriggersLabel) |
160 |
.add(34, 34, 34) |
255 |
.add(34, 34, 34) |
161 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
256 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
162 |
.add(javaAutoPopupOnIdentifierPart) |
257 |
.add(javaAutoPopupOnIdentifierPart) |
163 |
.add(layout.createSequentialGroup() |
258 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 408, Short.MAX_VALUE) |
164 |
.add(javaCompletionSelectorsLabel) |
259 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
|
|
260 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
261 |
.add(javaCompletionExcluderLabel) |
262 |
.add(javaCompletionSelectorsLabel)) |
263 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
264 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
165 |
.add(30, 30, 30) |
265 |
.add(30, 30, 30) |
166 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
266 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
167 |
.add(layout.createSequentialGroup() |
267 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup() |
168 |
.add(javadocAutoCompletionTriggersLabel) |
268 |
.add(23, 23, 23) |
169 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
269 |
.add(javaCompletionExcluderButton))))) |
170 |
.add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))) |
270 |
.addContainerGap())) |
171 |
.addContainerGap()) |
|
|
172 |
); |
271 |
); |
173 |
layout.setVerticalGroup( |
272 |
javaCompletionPaneLayout.setVerticalGroup( |
174 |
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
273 |
javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
175 |
.add(layout.createSequentialGroup() |
274 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup() |
|
|
275 |
.add(231, 231, 231) |
276 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
277 |
.add(javadocAutoCompletionTriggersLabel) |
278 |
.add(javadocAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
279 |
.addContainerGap(52, Short.MAX_VALUE)) |
280 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
281 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
176 |
.addContainerGap() |
282 |
.addContainerGap() |
177 |
.add(guessMethodArguments) |
283 |
.add(guessMethodArguments) |
178 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
284 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
179 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
285 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
180 |
.add(javaAutoCompletionTriggersLabel) |
286 |
.add(javaAutoCompletionTriggersLabel) |
181 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
287 |
.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) |
288 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
183 |
.add(javaAutoPopupOnIdentifierPart) |
289 |
.add(javaAutoPopupOnIdentifierPart) |
184 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
290 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
185 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
291 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
186 |
.add(javaCompletionSelectorsLabel) |
292 |
.add(javaCompletionSelectorsLabel) |
187 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
293 |
.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) |
294 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
|
295 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
296 |
.add(javaCompletionExcluderButton) |
297 |
.add(javaCompletionExcluderLabel)) |
298 |
.add(44, 44, 44) |
189 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
299 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
190 |
.add(18, 18, 18) |
300 |
.addContainerGap(94, Short.MAX_VALUE))) |
191 |
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
|
|
192 |
.add(javadocAutoCompletionTriggersLabel) |
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 |
); |
301 |
); |
|
|
302 |
|
303 |
add(javaCompletionPane, "javaCompletion"); |
304 |
|
305 |
javaCompletionExcludeTable.setModel(new javax.swing.table.DefaultTableModel( |
306 |
new Object [][] { |
307 |
|
308 |
}, |
309 |
new String [] { |
310 |
"Fully Qualified Name prefix" |
311 |
} |
312 |
) { |
313 |
Class[] types = new Class [] { |
314 |
java.lang.String.class |
315 |
}; |
316 |
|
317 |
public Class getColumnClass(int columnIndex) { |
318 |
return types [columnIndex]; |
319 |
} |
320 |
}); |
321 |
javaCompletionExcludeTable.getTableHeader().setReorderingAllowed(false); |
322 |
javaCompletionExcludeScrollPane.setViewportView(javaCompletionExcludeTable); |
323 |
javaCompletionExcludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N |
324 |
javaCompletionExcludeTable.getColumnModel().getColumn(0).setCellEditor(null); |
325 |
|
326 |
javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle"), javaCompletionExcludeScrollPane); // NOI18N |
327 |
|
328 |
javaCompletionIncludeTable.setModel(new javax.swing.table.DefaultTableModel( |
329 |
new Object [][] { |
330 |
|
331 |
}, |
332 |
new String [] { |
333 |
"Fully Qualified Name prefix" |
334 |
} |
335 |
) { |
336 |
Class[] types = new Class [] { |
337 |
java.lang.String.class |
338 |
}; |
339 |
|
340 |
public Class getColumnClass(int columnIndex) { |
341 |
return types [columnIndex]; |
342 |
} |
343 |
}); |
344 |
javaCompletionIncludeTable.getTableHeader().setReorderingAllowed(false); |
345 |
javaCompletionIncludeScrollPane.setViewportView(javaCompletionIncludeTable); |
346 |
javaCompletionIncludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N |
347 |
|
348 |
javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle"), javaCompletionIncludeScrollPane); // NOI18N |
349 |
|
350 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderAddButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderAddButton.text")); // NOI18N |
351 |
javaCompletionExcluderAddButton.addActionListener(new java.awt.event.ActionListener() { |
352 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
353 |
javaCompletionExcluderAddButtonActionPerformed(evt); |
354 |
} |
355 |
}); |
356 |
|
357 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderDeleteButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderDeleteButton.text")); // NOI18N |
358 |
javaCompletionExcluderDeleteButton.addActionListener(new java.awt.event.ActionListener() { |
359 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
360 |
javaCompletionExcluderDeleteButtonActionPerformed(evt); |
361 |
} |
362 |
}); |
363 |
|
364 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderBackButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderBackButton.text")); // NOI18N |
365 |
javaCompletionExcluderBackButton.addActionListener(new java.awt.event.ActionListener() { |
366 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
367 |
javaCompletionExcluderBackButtonActionPerformed(evt); |
368 |
} |
369 |
}); |
370 |
|
371 |
org.jdesktop.layout.GroupLayout javaCompletionExcluderPaneLayout = new org.jdesktop.layout.GroupLayout(javaCompletionExcluderPane); |
372 |
javaCompletionExcluderPane.setLayout(javaCompletionExcluderPaneLayout); |
373 |
javaCompletionExcluderPaneLayout.setHorizontalGroup( |
374 |
javaCompletionExcluderPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
375 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionExcluderPaneLayout.createSequentialGroup() |
376 |
.addContainerGap() |
377 |
.add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
378 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
379 |
.add(javaCompletionExcluderPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
380 |
.add(javaCompletionExcluderDeleteButton) |
381 |
.add(javaCompletionExcluderAddButton) |
382 |
.add(javaCompletionExcluderBackButton)) |
383 |
.addContainerGap(26, Short.MAX_VALUE)) |
384 |
); |
385 |
javaCompletionExcluderPaneLayout.setVerticalGroup( |
386 |
javaCompletionExcluderPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
387 |
.add(javaCompletionExcluderPaneLayout.createSequentialGroup() |
388 |
.addContainerGap() |
389 |
.add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) |
390 |
.addContainerGap()) |
391 |
.add(javaCompletionExcluderPaneLayout.createSequentialGroup() |
392 |
.add(59, 59, 59) |
393 |
.add(javaCompletionExcluderAddButton) |
394 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
395 |
.add(javaCompletionExcluderDeleteButton) |
396 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 137, Short.MAX_VALUE) |
397 |
.add(javaCompletionExcluderBackButton) |
398 |
.add(22, 22, 22)) |
399 |
); |
400 |
|
401 |
add(javaCompletionExcluderPane, "javaCompletionExcluder"); |
196 |
}// </editor-fold>//GEN-END:initComponents |
402 |
}// </editor-fold>//GEN-END:initComponents |
197 |
|
403 |
|
198 |
private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed |
404 |
private void javaAutoPopupOnIdentifierPartActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaAutoPopupOnIdentifierPartActionPerformed |
199 |
preferences.putBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, javaAutoPopupOnIdentifierPart.isSelected()); |
405 |
preferences.putBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, javaAutoPopupOnIdentifierPart. |
|
|
406 |
isSelected()); |
200 |
}//GEN-LAST:event_javaAutoPopupOnIdentifierPartActionPerformed |
407 |
}//GEN-LAST:event_javaAutoPopupOnIdentifierPartActionPerformed |
201 |
|
408 |
|
202 |
private void guessMethodArgumentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guessMethodArgumentsActionPerformed |
409 |
private void guessMethodArgumentsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_guessMethodArgumentsActionPerformed |
203 |
preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected()); |
410 |
preferences.putBoolean(GUESS_METHOD_ARGUMENTS, guessMethodArguments.isSelected()); |
204 |
}//GEN-LAST:event_guessMethodArgumentsActionPerformed |
411 |
}//GEN-LAST:event_guessMethodArgumentsActionPerformed |
205 |
|
412 |
|
|
|
413 |
private void javaCompletionExcluderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderButtonActionPerformed |
414 |
((CardLayout) getLayout()).next(this); |
415 |
}//GEN-LAST:event_javaCompletionExcluderButtonActionPerformed |
416 |
|
417 |
private void javaCompletionExcluderAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderAddButtonActionPerformed |
418 |
JTable table = getSelectedExcluderTable(); |
419 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
420 |
int rows = model.getRowCount(); |
421 |
model.setRowCount(rows + 1); |
422 |
table.editCellAt(rows, 0); |
423 |
table.requestFocus(); |
424 |
}//GEN-LAST:event_javaCompletionExcluderAddButtonActionPerformed |
425 |
|
426 |
private void javaCompletionExcluderBackButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderBackButtonActionPerformed |
427 |
((CardLayout) getLayout()).previous(this); |
428 |
}//GEN-LAST:event_javaCompletionExcluderBackButtonActionPerformed |
429 |
|
430 |
private void javaCompletionExcluderDeleteButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderDeleteButtonActionPerformed |
431 |
JTable table = getSelectedExcluderTable(); |
432 |
int row = table.getSelectedRow(); |
433 |
if (row == -1) |
434 |
return; |
435 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
436 |
model.removeRow(row); |
437 |
}//GEN-LAST:event_javaCompletionExcluderDeleteButtonActionPerformed |
438 |
|
206 |
private void update(DocumentEvent e) { |
439 |
private void update(DocumentEvent e) { |
207 |
if (e.getDocument() == javaAutoCompletionTriggersField.getDocument()) |
440 |
if (e.getDocument() == javaAutoCompletionTriggersField.getDocument()) |
208 |
preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText()); |
441 |
preferences.put(JAVA_AUTO_COMPLETION_TRIGGERS, javaAutoCompletionTriggersField.getText()); |
Lines 218-223
Link Here
|
218 |
private javax.swing.JTextField javaAutoCompletionTriggersField; |
451 |
private javax.swing.JTextField javaAutoCompletionTriggersField; |
219 |
private javax.swing.JLabel javaAutoCompletionTriggersLabel; |
452 |
private javax.swing.JLabel javaAutoCompletionTriggersLabel; |
220 |
private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart; |
453 |
private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart; |
|
|
454 |
private javax.swing.JScrollPane javaCompletionExcludeScrollPane; |
455 |
private javax.swing.JTable javaCompletionExcludeTable; |
456 |
private javax.swing.JButton javaCompletionExcluderAddButton; |
457 |
private javax.swing.JButton javaCompletionExcluderBackButton; |
458 |
private javax.swing.JButton javaCompletionExcluderButton; |
459 |
private javax.swing.JButton javaCompletionExcluderDeleteButton; |
460 |
private javax.swing.JLabel javaCompletionExcluderLabel; |
461 |
private javax.swing.JPanel javaCompletionExcluderPane; |
462 |
private javax.swing.JTabbedPane javaCompletionExcluderTab; |
463 |
private javax.swing.JScrollPane javaCompletionIncludeScrollPane; |
464 |
private javax.swing.JTable javaCompletionIncludeTable; |
465 |
private javax.swing.JPanel javaCompletionPane; |
221 |
private javax.swing.JTextField javaCompletionSelectorsField; |
466 |
private javax.swing.JTextField javaCompletionSelectorsField; |
222 |
private javax.swing.JLabel javaCompletionSelectorsLabel; |
467 |
private javax.swing.JLabel javaCompletionSelectorsLabel; |
223 |
private javax.swing.JTextField javadocAutoCompletionTriggersField; |
468 |
private javax.swing.JTextField javadocAutoCompletionTriggersField; |
Lines 226-232
Link Here
|
226 |
|
471 |
|
227 |
private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer { |
472 |
private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer { |
228 |
|
473 |
|
229 |
private Preferences preferences; |
474 |
private final Preferences preferences; |
230 |
|
475 |
|
231 |
private CodeCompletionPreferencesCusromizer(Preferences p) { |
476 |
private CodeCompletionPreferencesCusromizer(Preferences p) { |
232 |
preferences = p; |
477 |
preferences = p; |