Lines 42-59
Link Here
|
42 |
package org.netbeans.modules.java.editor.options; |
42 |
package org.netbeans.modules.java.editor.options; |
43 |
|
43 |
|
44 |
import java.awt.Component; |
44 |
import java.awt.Component; |
45 |
import java.util.Arrays; |
|
|
46 |
import java.util.Collection; |
47 |
import java.util.TreeSet; |
48 |
import java.util.Vector; |
49 |
import java.util.prefs.Preferences; |
45 |
import java.util.prefs.Preferences; |
|
|
46 |
import javax.swing.DefaultListModel; |
50 |
import javax.swing.JComponent; |
47 |
import javax.swing.JComponent; |
51 |
import javax.swing.JTable; |
48 |
import javax.swing.JList; |
52 |
import javax.swing.event.DocumentEvent; |
49 |
import javax.swing.event.DocumentEvent; |
53 |
import javax.swing.event.DocumentListener; |
50 |
import javax.swing.event.DocumentListener; |
54 |
import javax.swing.event.TableModelEvent; |
|
|
55 |
import javax.swing.event.TableModelListener; |
56 |
import javax.swing.table.DefaultTableModel; |
57 |
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer; |
51 |
import org.netbeans.modules.options.editor.spi.PreferencesCustomizer; |
58 |
import org.openide.util.HelpCtx; |
52 |
import org.openide.util.HelpCtx; |
59 |
|
53 |
|
Lines 62-68
Link Here
|
62 |
* @author Dusan Balek |
56 |
* @author Dusan Balek |
63 |
* @author Sam Halliday |
57 |
* @author Sam Halliday |
64 |
*/ |
58 |
*/ |
65 |
public class CodeCompletionPanel extends javax.swing.JPanel implements DocumentListener, TableModelListener { |
59 |
public class CodeCompletionPanel extends javax.swing.JPanel implements DocumentListener { |
66 |
|
60 |
|
67 |
public static final String JAVA_AUTO_POPUP_ON_IDENTIFIER_PART = "javaAutoPopupOnIdentifierPart"; //NOI18N |
61 |
public static final String JAVA_AUTO_POPUP_ON_IDENTIFIER_PART = "javaAutoPopupOnIdentifierPart"; //NOI18N |
68 |
public static final boolean JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT = false; |
62 |
public static final boolean JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT = false; |
Lines 78-96
Link Here
|
78 |
public static final String JAVA_COMPLETION_WHITELIST_DEFAULT = ""; //NOI18N |
72 |
public static final String JAVA_COMPLETION_WHITELIST_DEFAULT = ""; //NOI18N |
79 |
public static final String JAVA_COMPLETION_BLACKLIST = "javaCompletionBlacklist"; //NOI18N |
73 |
public static final String JAVA_COMPLETION_BLACKLIST = "javaCompletionBlacklist"; //NOI18N |
80 |
public static final String JAVA_COMPLETION_BLACKLIST_DEFAULT = ""; //NOI18N |
74 |
public static final String JAVA_COMPLETION_BLACKLIST_DEFAULT = ""; //NOI18N |
|
|
75 |
public static final String JAVA_COMPLETION_EXCLUDER_METHODS = "javaCompletionExcluderMethods"; //NOI18N |
76 |
public static final boolean JAVA_COMPLETION_EXCLUDER_METHODS_DEFAULT = false; |
77 |
|
78 |
private static final String JAVA_FQN_REGEX = "[$\\w._]*"; |
81 |
|
79 |
|
82 |
private final Preferences preferences; |
80 |
private final Preferences preferences; |
83 |
|
81 |
|
84 |
private void initExcluderTable(JTable table, String pref) { |
82 |
// editing is null if a new entry is to be created, otherwise the entry to be replaced |
85 |
String[] entries = pref.split(","); //NOI18N |
83 |
private volatile String editing; |
86 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
|
|
87 |
for (String entry : entries) { |
88 |
if (entry.length() > 0) { |
89 |
model.addRow(new String[]{entry}); |
90 |
} |
91 |
} |
92 |
model.addTableModelListener(this); |
93 |
} |
94 |
|
84 |
|
95 |
/** Creates new form FmtTabsIndents */ |
85 |
/** Creates new form FmtTabsIndents */ |
96 |
public CodeCompletionPanel(Preferences p) { |
86 |
public CodeCompletionPanel(Preferences p) { |
Lines 100-120
Link Here
|
100 |
javaAutoPopupOnIdentifierPart.setSelected(preferences.getBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT)); |
90 |
javaAutoPopupOnIdentifierPart.setSelected(preferences.getBoolean(JAVA_AUTO_POPUP_ON_IDENTIFIER_PART, JAVA_AUTO_POPUP_ON_IDENTIFIER_PART_DEFAULT)); |
101 |
javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT)); |
91 |
javaAutoCompletionTriggersField.setText(preferences.get(JAVA_AUTO_COMPLETION_TRIGGERS, JAVA_AUTO_COMPLETION_TRIGGERS_DEFAULT)); |
102 |
javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, JAVA_COMPLETION_SELECTORS_DEFAULT)); |
92 |
javaCompletionSelectorsField.setText(preferences.get(JAVA_COMPLETION_SELECTORS, JAVA_COMPLETION_SELECTORS_DEFAULT)); |
103 |
javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT)); |
93 |
javadocAutoCompletionTriggersField.setText(preferences.get(JAVADOC_AUTO_COMPLETION_TRIGGERS, JAVADOC_AUTO_COMPLETION_TRIGGERS_DEFAULT)); |
104 |
String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, JAVA_COMPLETION_BLACKLIST_DEFAULT); |
94 |
String blacklist = preferences.get(JAVA_COMPLETION_BLACKLIST, JAVA_COMPLETION_BLACKLIST_DEFAULT); |
105 |
initExcluderTable(javaCompletionExcludeTable, blacklist); |
95 |
initExcluderList(javaCompletionExcludeJlist, blacklist); |
106 |
String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, JAVA_COMPLETION_WHITELIST_DEFAULT); |
96 |
String whitelist = preferences.get(JAVA_COMPLETION_WHITELIST, JAVA_COMPLETION_WHITELIST_DEFAULT); |
107 |
initExcluderTable(javaCompletionIncludeTable, whitelist); |
97 |
initExcluderList(javaCompletionIncludeJlist, whitelist); |
|
|
98 |
javaCompletionExcluderMethodsCheckBox.setSelected(preferences.getBoolean(JAVA_COMPLETION_EXCLUDER_METHODS, JAVA_COMPLETION_EXCLUDER_METHODS_DEFAULT)); |
99 |
javaCompletionExcluderDialog2.getRootPane().setDefaultButton(javaCompletionExcluderDialogOkButton); |
100 |
|
101 |
// can't NetBeans visual editor do these automatically? |
102 |
javaCompletionExcluderDialog1.pack(); |
103 |
javaCompletionExcluderDialog1.setLocationRelativeTo(this); |
104 |
javaCompletionExcluderDialog2.pack(); |
105 |
javaCompletionExcluderDialog2.setLocationRelativeTo(this); |
106 |
|
108 |
javaAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
107 |
javaAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
109 |
javaCompletionSelectorsField.getDocument().addDocumentListener(this); |
108 |
javaCompletionSelectorsField.getDocument().addDocumentListener(this); |
110 |
javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
109 |
javadocAutoCompletionTriggersField.getDocument().addDocumentListener(this); |
|
|
110 |
} |
111 |
|
112 |
private void initExcluderList(JList jList, String list) { |
113 |
DefaultListModel model = new DefaultListModel(); |
114 |
String [] entries = list.split(","); //NOI18N |
115 |
for (String entry : entries){ |
116 |
if (entry.length() != 0) |
117 |
model.addElement(entry); |
118 |
} |
119 |
jList.setModel(model); |
120 |
} |
121 |
|
122 |
// existing is null if add is required |
123 |
private void openExcluderEditor() { |
124 |
assert !javaCompletionExcluderDialog2.isVisible(); |
125 |
javaCompletionExcluderDialogTextField.setText(editing); |
126 |
javaCompletionExcluderDialog2.setVisible(true); |
127 |
javaCompletionExcluderDialogTextField.requestFocus(); |
111 |
} |
128 |
} |
112 |
|
129 |
|
113 |
public static PreferencesCustomizer.Factory getCustomizerFactory() { |
130 |
public static PreferencesCustomizer.Factory getCustomizerFactory() { |
114 |
return new PreferencesCustomizer.Factory() { |
131 |
return new PreferencesCustomizer.Factory() { |
115 |
|
132 |
|
116 |
public PreferencesCustomizer create(Preferences preferences) { |
133 |
public PreferencesCustomizer create(Preferences preferences) { |
117 |
return new CodeCompletionPreferencesCusromizer(preferences); |
134 |
return new CodeCompletionPreferencesCustomizer(preferences); |
118 |
} |
135 |
} |
119 |
}; |
136 |
}; |
120 |
} |
137 |
} |
Lines 131-190
Link Here
|
131 |
update(e); |
148 |
update(e); |
132 |
} |
149 |
} |
133 |
|
150 |
|
134 |
// allows common excluder buttons to know which table to act on |
|
|
135 |
private JTable getSelectedExcluderTable() { |
136 |
Component selected = javaCompletionExcluderTab.getSelectedComponent(); |
137 |
if (selected == javaCompletionExcludeScrollPane) { |
138 |
return javaCompletionExcludeTable; |
139 |
} else if (selected == javaCompletionIncludeScrollPane) { |
140 |
return javaCompletionIncludeTable; |
141 |
} else { |
142 |
throw new RuntimeException(selected.getName()); |
143 |
} |
144 |
} |
145 |
|
146 |
// listen to changes in the excluder lists, and do sanity checking on input |
147 |
public void tableChanged(TableModelEvent e) { |
148 |
DefaultTableModel model = (DefaultTableModel) e.getSource(); |
149 |
String pref; |
150 |
if (model == javaCompletionExcludeTable.getModel()) { |
151 |
pref = JAVA_COMPLETION_BLACKLIST; |
152 |
} else if (model == javaCompletionIncludeTable.getModel()) { |
153 |
pref = JAVA_COMPLETION_WHITELIST; |
154 |
} else { |
155 |
throw new RuntimeException(); |
156 |
} |
157 |
@SuppressWarnings("unchecked") |
158 |
Vector<Vector<String>> data = model.getDataVector(); |
159 |
Collection<String> entries = new TreeSet<String>(); |
160 |
for (Vector<String> row : data) { |
161 |
String entry = row.elementAt(0); |
162 |
if (entry == null) { |
163 |
continue; |
164 |
} |
165 |
// users can enter wildcards, which is the same as the raw prefix |
166 |
if (entry.contains("*")) |
167 |
entry = entry.replaceAll("\\*", ""); |
168 |
entry = entry.trim(); |
169 |
if (entry.length() == 0) { |
170 |
continue; |
171 |
} |
172 |
// this could be checked by a custom editor on input |
173 |
if (!entry.matches("[$\\w._]*")) { //NOI18N |
174 |
continue; |
175 |
} |
176 |
entries.add(entry); |
177 |
} |
178 |
StringBuilder builder = new StringBuilder(); |
179 |
for (String entry : entries) { |
180 |
if (builder.length() > 0) { |
181 |
builder.append(","); //NOI18N |
182 |
} |
183 |
builder.append(entry); |
184 |
} |
185 |
preferences.put(pref, builder.toString()); |
186 |
} |
187 |
|
188 |
/** This method is called from within the constructor to |
151 |
/** This method is called from within the constructor to |
189 |
* initialize the form. |
152 |
* initialize the form. |
190 |
* WARNING: Do NOT modify this code. The content of this method is |
153 |
* WARNING: Do NOT modify this code. The content of this method is |
Lines 193-207
Link Here
|
193 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
156 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
194 |
private void initComponents() { |
157 |
private void initComponents() { |
195 |
|
158 |
|
196 |
javaCompletionExcluderFrame = new javax.swing.JFrame(); |
159 |
javaCompletionExcluderDialog2 = new javax.swing.JDialog(); |
|
|
160 |
javaCompletionExcluderDialogTextField = new javax.swing.JTextField(); |
161 |
javaCompletionExcluderDialogOkButton = new javax.swing.JButton(); |
162 |
javaCompletionExcluderDialogLabel = new javax.swing.JLabel(); |
163 |
javaCompletionExcluderDialogCancelButton = new javax.swing.JButton(); |
164 |
javaCompletionExcluderDialog1 = new javax.swing.JDialog(); |
197 |
javaCompletionExcluderTab = new javax.swing.JTabbedPane(); |
165 |
javaCompletionExcluderTab = new javax.swing.JTabbedPane(); |
198 |
javaCompletionExcludeScrollPane = new javax.swing.JScrollPane(); |
166 |
javaCompletionExcludeScrollPane = new javax.swing.JScrollPane(); |
199 |
javaCompletionExcludeTable = new javax.swing.JTable(); |
167 |
javaCompletionExcludeJlist = new javax.swing.JList(); |
200 |
javaCompletionIncludeScrollPane = new javax.swing.JScrollPane(); |
168 |
javaCompletionIncludeScrollPane = new javax.swing.JScrollPane(); |
201 |
javaCompletionIncludeTable = new javax.swing.JTable(); |
169 |
javaCompletionIncludeJlist = new javax.swing.JList(); |
202 |
javaCompletionExcluderAddButton = new javax.swing.JButton(); |
170 |
javaCompletionExcluderAddButton = new javax.swing.JButton(); |
203 |
javaCompletionExcluderRemoveButton = new javax.swing.JButton(); |
171 |
javaCompletionExcluderRemoveButton = new javax.swing.JButton(); |
204 |
javaCompletionExcluderCloseButton = new javax.swing.JButton(); |
172 |
javaCompletionExcluderCloseButton = new javax.swing.JButton(); |
|
|
173 |
javaCompletionExcluderEditButton = new javax.swing.JButton(); |
174 |
javaCompletionExcluderMethodsCheckBox = new javax.swing.JCheckBox(); |
205 |
javaCompletionPane = new javax.swing.JPanel(); |
175 |
javaCompletionPane = new javax.swing.JPanel(); |
206 |
guessMethodArguments = new javax.swing.JCheckBox(); |
176 |
guessMethodArguments = new javax.swing.JCheckBox(); |
207 |
javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox(); |
177 |
javaAutoPopupOnIdentifierPart = new javax.swing.JCheckBox(); |
Lines 215-266
Link Here
|
215 |
javaCompletionExcluderLabel = new javax.swing.JLabel(); |
185 |
javaCompletionExcluderLabel = new javax.swing.JLabel(); |
216 |
javaCompletionExcluderButton = new javax.swing.JButton(); |
186 |
javaCompletionExcluderButton = new javax.swing.JButton(); |
217 |
|
187 |
|
218 |
javaCompletionExcluderFrame.setTitle(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderFrame.title")); // NOI18N |
188 |
javaCompletionExcluderDialog2.setModal(true); |
219 |
javaCompletionExcluderFrame.setAlwaysOnTop(true); |
189 |
javaCompletionExcluderDialog2.setUndecorated(true); |
220 |
javaCompletionExcluderFrame.setMinimumSize(new java.awt.Dimension(409, 233)); |
|
|
221 |
javaCompletionExcluderFrame.setUndecorated(true); |
222 |
|
190 |
|
223 |
javaCompletionExcludeTable.setModel(new javax.swing.table.DefaultTableModel( |
191 |
javaCompletionExcluderDialogTextField.setText(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderDialogTextField.text")); // NOI18N |
224 |
new Object [][] { |
192 |
javaCompletionExcluderDialogTextField.addKeyListener(new java.awt.event.KeyAdapter() { |
225 |
|
193 |
public void keyTyped(java.awt.event.KeyEvent evt) { |
226 |
}, |
194 |
javaCompletionExcluderDialogTextFieldKeyTyped(evt); |
227 |
new String [] { |
|
|
228 |
"Fully Qualified Name prefix" |
229 |
} |
230 |
) { |
231 |
Class[] types = new Class [] { |
232 |
java.lang.String.class |
233 |
}; |
234 |
|
235 |
public Class getColumnClass(int columnIndex) { |
236 |
return types [columnIndex]; |
237 |
} |
195 |
} |
238 |
}); |
196 |
}); |
239 |
javaCompletionExcludeTable.getTableHeader().setReorderingAllowed(false); |
197 |
|
240 |
javaCompletionExcludeScrollPane.setViewportView(javaCompletionExcludeTable); |
198 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderDialogOkButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderDialogOkButton.text")); // NOI18N |
241 |
javaCompletionExcludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N |
199 |
javaCompletionExcluderDialogOkButton.addActionListener(new java.awt.event.ActionListener() { |
|
|
200 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
201 |
javaCompletionExcluderDialogOkButtonActionPerformed(evt); |
202 |
} |
203 |
}); |
204 |
|
205 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderDialogLabel, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderDialogLabel.text")); // NOI18N |
206 |
|
207 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderDialogCancelButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderDialogCancelButton.text")); // NOI18N |
208 |
javaCompletionExcluderDialogCancelButton.addActionListener(new java.awt.event.ActionListener() { |
209 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
210 |
javaCompletionExcluderDialogCancelButtonActionPerformed(evt); |
211 |
} |
212 |
}); |
213 |
|
214 |
org.jdesktop.layout.GroupLayout javaCompletionExcluderDialog2Layout = new org.jdesktop.layout.GroupLayout(javaCompletionExcluderDialog2.getContentPane()); |
215 |
javaCompletionExcluderDialog2.getContentPane().setLayout(javaCompletionExcluderDialog2Layout); |
216 |
javaCompletionExcluderDialog2Layout.setHorizontalGroup( |
217 |
javaCompletionExcluderDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
218 |
.add(javaCompletionExcluderDialog2Layout.createSequentialGroup() |
219 |
.addContainerGap() |
220 |
.add(javaCompletionExcluderDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false) |
221 |
.add(org.jdesktop.layout.GroupLayout.LEADING, javaCompletionExcluderDialogLabel, 0, 0, Short.MAX_VALUE) |
222 |
.add(org.jdesktop.layout.GroupLayout.LEADING, javaCompletionExcluderDialogTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)) |
223 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) |
224 |
.add(javaCompletionExcluderDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) |
225 |
.add(javaCompletionExcluderDialogOkButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
226 |
.add(javaCompletionExcluderDialogCancelButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
227 |
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
228 |
); |
229 |
javaCompletionExcluderDialog2Layout.setVerticalGroup( |
230 |
javaCompletionExcluderDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
231 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionExcluderDialog2Layout.createSequentialGroup() |
232 |
.add(javaCompletionExcluderDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
233 |
.add(javaCompletionExcluderDialog2Layout.createSequentialGroup() |
234 |
.addContainerGap() |
235 |
.add(javaCompletionExcluderDialogLabel) |
236 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
237 |
.add(javaCompletionExcluderDialog2Layout.createSequentialGroup() |
238 |
.addContainerGap() |
239 |
.add(javaCompletionExcluderDialogCancelButton) |
240 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED))) |
241 |
.add(javaCompletionExcluderDialog2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
242 |
.add(javaCompletionExcluderDialogTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
243 |
.add(javaCompletionExcluderDialogOkButton)) |
244 |
.add(61, 61, 61)) |
245 |
); |
246 |
|
247 |
javaCompletionExcluderDialog1.setTitle(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderDialog1.title")); // NOI18N |
248 |
javaCompletionExcluderDialog1.setModal(true); |
249 |
|
250 |
javaCompletionExcludeScrollPane.setViewportView(javaCompletionExcludeJlist); |
242 |
|
251 |
|
243 |
javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle"), javaCompletionExcludeScrollPane); // NOI18N |
252 |
javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeScrollPane.TabConstraints.tabTitle"), javaCompletionExcludeScrollPane); // NOI18N |
244 |
|
253 |
|
245 |
javaCompletionIncludeTable.setModel(new javax.swing.table.DefaultTableModel( |
254 |
javaCompletionIncludeScrollPane.setViewportView(javaCompletionIncludeJlist); |
246 |
new Object [][] { |
|
|
247 |
|
248 |
}, |
249 |
new String [] { |
250 |
"Fully Qualified Name prefix" |
251 |
} |
252 |
) { |
253 |
Class[] types = new Class [] { |
254 |
java.lang.String.class |
255 |
}; |
256 |
|
257 |
public Class getColumnClass(int columnIndex) { |
258 |
return types [columnIndex]; |
259 |
} |
260 |
}); |
261 |
javaCompletionIncludeTable.getTableHeader().setReorderingAllowed(false); |
262 |
javaCompletionIncludeScrollPane.setViewportView(javaCompletionIncludeTable); |
263 |
javaCompletionIncludeTable.getColumnModel().getColumn(0).setHeaderValue(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcludeTable.columnModel.title0")); // NOI18N |
264 |
|
255 |
|
265 |
javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle"), javaCompletionIncludeScrollPane); // NOI18N |
256 |
javaCompletionExcluderTab.addTab(org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionIncludeScrollPane.TabConstraints.tabTitle"), javaCompletionIncludeScrollPane); // NOI18N |
266 |
|
257 |
|
Lines 285-318
Link Here
|
285 |
} |
276 |
} |
286 |
}); |
277 |
}); |
287 |
|
278 |
|
288 |
org.jdesktop.layout.GroupLayout javaCompletionExcluderFrameLayout = new org.jdesktop.layout.GroupLayout(javaCompletionExcluderFrame.getContentPane()); |
279 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderEditButton, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderEditButton.text")); // NOI18N |
289 |
javaCompletionExcluderFrame.getContentPane().setLayout(javaCompletionExcluderFrameLayout); |
280 |
javaCompletionExcluderEditButton.addActionListener(new java.awt.event.ActionListener() { |
290 |
javaCompletionExcluderFrameLayout.setHorizontalGroup( |
281 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
291 |
javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
282 |
javaCompletionExcluderEditButtonActionPerformed(evt); |
292 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionExcluderFrameLayout.createSequentialGroup() |
283 |
} |
|
|
284 |
}); |
285 |
|
286 |
org.openide.awt.Mnemonics.setLocalizedText(javaCompletionExcluderMethodsCheckBox, org.openide.util.NbBundle.getMessage(CodeCompletionPanel.class, "CodeCompletionPanel.javaCompletionExcluderMethodsCheckBox.text")); // NOI18N |
287 |
javaCompletionExcluderMethodsCheckBox.addActionListener(new java.awt.event.ActionListener() { |
288 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
289 |
javaCompletionExcluderMethodsCheckBoxActionPerformed(evt); |
290 |
} |
291 |
}); |
292 |
|
293 |
org.jdesktop.layout.GroupLayout javaCompletionExcluderDialog1Layout = new org.jdesktop.layout.GroupLayout(javaCompletionExcluderDialog1.getContentPane()); |
294 |
javaCompletionExcluderDialog1.getContentPane().setLayout(javaCompletionExcluderDialog1Layout); |
295 |
javaCompletionExcluderDialog1Layout.setHorizontalGroup( |
296 |
javaCompletionExcluderDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
297 |
.add(javaCompletionExcluderDialog1Layout.createSequentialGroup() |
293 |
.addContainerGap() |
298 |
.addContainerGap() |
294 |
.add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
299 |
.add(javaCompletionExcluderDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
295 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
300 |
.add(javaCompletionExcluderDialog1Layout.createSequentialGroup() |
296 |
.add(javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) |
301 |
.add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 298, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
297 |
.add(javaCompletionExcluderCloseButton, 0, 0, Short.MAX_VALUE) |
302 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
298 |
.add(javaCompletionExcluderRemoveButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
303 |
.add(javaCompletionExcluderDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false) |
299 |
.add(javaCompletionExcluderAddButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
304 |
.add(javaCompletionExcluderEditButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
300 |
.addContainerGap(10, Short.MAX_VALUE)) |
305 |
.add(javaCompletionExcluderRemoveButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
|
|
306 |
.add(javaCompletionExcluderAddButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) |
307 |
.add(javaCompletionExcluderDialog1Layout.createSequentialGroup() |
308 |
.add(javaCompletionExcluderMethodsCheckBox) |
309 |
.add(125, 125, 125) |
310 |
.add(javaCompletionExcluderCloseButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 93, Short.MAX_VALUE))) |
311 |
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
301 |
); |
312 |
); |
302 |
javaCompletionExcluderFrameLayout.setVerticalGroup( |
313 |
javaCompletionExcluderDialog1Layout.setVerticalGroup( |
303 |
javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
314 |
javaCompletionExcluderDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
304 |
.add(javaCompletionExcluderFrameLayout.createSequentialGroup() |
315 |
.add(javaCompletionExcluderDialog1Layout.createSequentialGroup() |
305 |
.add(javaCompletionExcluderFrameLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
316 |
.add(javaCompletionExcluderDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
306 |
.add(javaCompletionExcluderFrameLayout.createSequentialGroup() |
317 |
.add(javaCompletionExcluderDialog1Layout.createSequentialGroup() |
307 |
.addContainerGap() |
318 |
.addContainerGap() |
308 |
.add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 221, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
319 |
.add(javaCompletionExcluderTab, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 221, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
309 |
.add(javaCompletionExcluderFrameLayout.createSequentialGroup() |
320 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
|
|
321 |
.add(javaCompletionExcluderDialog1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
322 |
.add(javaCompletionExcluderMethodsCheckBox) |
323 |
.add(javaCompletionExcluderCloseButton))) |
324 |
.add(javaCompletionExcluderDialog1Layout.createSequentialGroup() |
310 |
.add(59, 59, 59) |
325 |
.add(59, 59, 59) |
311 |
.add(javaCompletionExcluderAddButton) |
326 |
.add(javaCompletionExcluderAddButton) |
312 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
327 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
313 |
.add(javaCompletionExcluderRemoveButton) |
328 |
.add(javaCompletionExcluderEditButton) |
314 |
.add(63, 63, 63) |
329 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
315 |
.add(javaCompletionExcluderCloseButton))) |
330 |
.add(javaCompletionExcluderRemoveButton))) |
316 |
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
331 |
.addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) |
317 |
); |
332 |
); |
318 |
|
333 |
|
Lines 361-367
Link Here
|
361 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
376 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
362 |
.addContainerGap() |
377 |
.addContainerGap() |
363 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
378 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
364 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 337, Short.MAX_VALUE) |
379 |
.add(jSeparator1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 511, Short.MAX_VALUE) |
365 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
380 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
366 |
.add(javadocAutoCompletionTriggersLabel) |
381 |
.add(javadocAutoCompletionTriggersLabel) |
367 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
382 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
Lines 371-394
Link Here
|
371 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
386 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
372 |
.addContainerGap() |
387 |
.addContainerGap() |
373 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
388 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
374 |
.add(guessMethodArguments) |
389 |
.add(guessMethodArguments) |
375 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
390 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
376 |
.add(javaAutoCompletionTriggersLabel) |
391 |
.add(javaAutoCompletionTriggersLabel) |
377 |
.add(34, 34, 34) |
392 |
.add(34, 34, 34) |
378 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
393 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
379 |
.add(javaAutoPopupOnIdentifierPart) |
394 |
.add(javaAutoPopupOnIdentifierPart) |
380 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
395 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
381 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
396 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING) |
382 |
.add(javaCompletionExcluderLabel) |
397 |
.add(javaCompletionExcluderLabel) |
383 |
.add(javaCompletionSelectorsLabel)) |
398 |
.add(javaCompletionSelectorsLabel)) |
384 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
399 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
385 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
400 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
386 |
.add(30, 30, 30) |
401 |
.add(30, 30, 30) |
387 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
402 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 86, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
388 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup() |
403 |
.add(org.jdesktop.layout.GroupLayout.TRAILING, javaCompletionPaneLayout.createSequentialGroup() |
389 |
.add(23, 23, 23) |
404 |
.add(23, 23, 23) |
390 |
.add(javaCompletionExcluderButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) |
405 |
.add(javaCompletionExcluderButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))))) |
391 |
.addContainerGap(25, Short.MAX_VALUE))) |
406 |
.addContainerGap(199, Short.MAX_VALUE))) |
392 |
); |
407 |
); |
393 |
javaCompletionPaneLayout.setVerticalGroup( |
408 |
javaCompletionPaneLayout.setVerticalGroup( |
394 |
javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
409 |
javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
Lines 402-419
Link Here
|
402 |
.addContainerGap(23, Short.MAX_VALUE)) |
417 |
.addContainerGap(23, Short.MAX_VALUE)) |
403 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
418 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) |
404 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
419 |
.add(javaCompletionPaneLayout.createSequentialGroup() |
405 |
.addContainerGap() |
420 |
.addContainerGap() |
406 |
.add(guessMethodArguments, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
421 |
.add(guessMethodArguments, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) |
407 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
422 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
408 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
423 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
409 |
.add(javaAutoCompletionTriggersLabel) |
424 |
.add(javaAutoCompletionTriggersLabel) |
410 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
425 |
.add(javaAutoCompletionTriggersField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
411 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
426 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
412 |
.add(javaAutoPopupOnIdentifierPart) |
427 |
.add(javaAutoPopupOnIdentifierPart) |
413 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
428 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
414 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
429 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
415 |
.add(javaCompletionSelectorsLabel) |
430 |
.add(javaCompletionSelectorsLabel) |
416 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
431 |
.add(javaCompletionSelectorsField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) |
417 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
432 |
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) |
418 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
433 |
.add(javaCompletionPaneLayout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) |
419 |
.add(javaCompletionExcluderButton) |
434 |
.add(javaCompletionExcluderButton) |
Lines 442-479
Link Here
|
442 |
}//GEN-LAST:event_guessMethodArgumentsActionPerformed |
457 |
}//GEN-LAST:event_guessMethodArgumentsActionPerformed |
443 |
|
458 |
|
444 |
private void javaCompletionExcluderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderButtonActionPerformed |
459 |
private void javaCompletionExcluderButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderButtonActionPerformed |
445 |
if (javaCompletionExcluderFrame.isVisible()) |
460 |
assert !javaCompletionExcluderDialog1.isVisible(); |
446 |
return; |
461 |
javaCompletionExcluderDialog1.setVisible(true); |
447 |
javaCompletionExcluderFrame.pack(); |
|
|
448 |
javaCompletionExcluderFrame.setLocationRelativeTo(this); |
449 |
javaCompletionExcluderFrame.setVisible(true); |
450 |
}//GEN-LAST:event_javaCompletionExcluderButtonActionPerformed |
462 |
}//GEN-LAST:event_javaCompletionExcluderButtonActionPerformed |
451 |
|
463 |
|
|
|
464 |
// allows common excluder buttons to know which table to act on |
465 |
private JList getSelectedExcluderList() { |
466 |
Component selected = javaCompletionExcluderTab.getSelectedComponent(); |
467 |
if (selected == javaCompletionExcludeScrollPane) { |
468 |
return javaCompletionExcludeJlist; |
469 |
} else if (selected == javaCompletionIncludeScrollPane) { |
470 |
return javaCompletionIncludeJlist; |
471 |
} else { |
472 |
throw new RuntimeException(selected.getName()); |
473 |
} |
474 |
} |
475 |
|
452 |
private void javaCompletionExcluderAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderAddButtonActionPerformed |
476 |
private void javaCompletionExcluderAddButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderAddButtonActionPerformed |
453 |
JTable table = getSelectedExcluderTable(); |
477 |
openExcluderEditor(); |
454 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
|
|
455 |
int rows = model.getRowCount(); |
456 |
model.setRowCount(rows + 1); |
457 |
table.editCellAt(rows, 0); |
458 |
table.requestFocus(); |
459 |
}//GEN-LAST:event_javaCompletionExcluderAddButtonActionPerformed |
478 |
}//GEN-LAST:event_javaCompletionExcluderAddButtonActionPerformed |
460 |
|
479 |
|
461 |
private void javaCompletionExcluderRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderRemoveButtonActionPerformed |
480 |
private void javaCompletionExcluderRemoveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderRemoveButtonActionPerformed |
462 |
JTable table = getSelectedExcluderTable(); |
481 |
JList list = getSelectedExcluderList(); |
463 |
int[] rows = table.getSelectedRows(); |
482 |
int[] rows = list.getSelectedIndices(); |
464 |
if (rows.length == 0) |
483 |
DefaultListModel model = (DefaultListModel) list.getModel(); |
465 |
return; |
|
|
466 |
// remove rows in descending order: row numbers change when a row is removed |
484 |
// remove rows in descending order: row numbers change when a row is removed |
467 |
Arrays.sort(rows); |
|
|
468 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
469 |
for (int row = rows.length - 1; row >= 0; row--) { |
485 |
for (int row = rows.length - 1; row >= 0; row--) { |
470 |
model.removeRow(rows[row]); |
486 |
model.remove(rows[row]); |
471 |
} |
487 |
} |
472 |
}//GEN-LAST:event_javaCompletionExcluderRemoveButtonActionPerformed |
488 |
}//GEN-LAST:event_javaCompletionExcluderRemoveButtonActionPerformed |
473 |
|
489 |
|
474 |
private void javaCompletionExcluderCloseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderCloseButtonActionPerformed |
490 |
private void javaCompletionExcluderCloseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderCloseButtonActionPerformed |
475 |
javaCompletionExcluderFrame.setVisible(false); |
491 |
javaCompletionExcluderDialog1.setVisible(false); |
476 |
}//GEN-LAST:event_javaCompletionExcluderCloseButtonActionPerformed |
492 |
}//GEN-LAST:event_javaCompletionExcluderCloseButtonActionPerformed |
|
|
493 |
|
494 |
private void javaCompletionExcluderEditButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderEditButtonActionPerformed |
495 |
JList list = getSelectedExcluderList(); |
496 |
int index = list.getSelectedIndex(); |
497 |
if (index == -1) |
498 |
return; |
499 |
DefaultListModel model = (DefaultListModel) list.getModel(); |
500 |
editing = (String) model.getElementAt(index); |
501 |
openExcluderEditor(); |
502 |
}//GEN-LAST:event_javaCompletionExcluderEditButtonActionPerformed |
503 |
|
504 |
private void javaCompletionExcluderMethodsCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderMethodsCheckBoxActionPerformed |
505 |
preferences.putBoolean(JAVA_COMPLETION_EXCLUDER_METHODS, javaCompletionExcluderMethodsCheckBox.isSelected()); |
506 |
}//GEN-LAST:event_javaCompletionExcluderMethodsCheckBoxActionPerformed |
507 |
|
508 |
private void javaCompletionExcluderDialogOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderDialogOkButtonActionPerformed |
509 |
JList list = getSelectedExcluderList(); |
510 |
String text = javaCompletionExcluderDialogTextField.getText(); |
511 |
DefaultListModel model = (DefaultListModel) list.getModel(); |
512 |
int index = model.size(); |
513 |
if (editing != null){ |
514 |
// if this was an "edit" rather than "add", then remove the old entry first |
515 |
index = model.indexOf(editing); |
516 |
model.remove(index); |
517 |
editing = null; |
518 |
} |
519 |
String[] entries = text.split(","); // NOI18N |
520 |
for (String entry : entries) { |
521 |
// strip wildcards |
522 |
if (entry.contains("*")) |
523 |
entry = entry.replaceAll("\\*", ""); |
524 |
entry = entry.trim(); |
525 |
if (entry.length() != 0 && entry.matches(JAVA_FQN_REGEX)){ |
526 |
model.insertElementAt(entry, index); |
527 |
index++; |
528 |
} |
529 |
} |
530 |
StringBuilder builder = new StringBuilder(); |
531 |
for (int i = 0 ; i < model.size() ; i++) { |
532 |
String entry = (String) model.getElementAt(i); |
533 |
if (builder.length() > 0) { |
534 |
builder.append(","); //NOI18N |
535 |
} |
536 |
builder.append(entry); |
537 |
} |
538 |
String pref; |
539 |
if (list == javaCompletionExcludeJlist) |
540 |
pref = JAVA_COMPLETION_BLACKLIST; |
541 |
else if (list == javaCompletionIncludeJlist) |
542 |
pref = JAVA_COMPLETION_WHITELIST; |
543 |
else |
544 |
throw new RuntimeException(list.getName()); |
545 |
|
546 |
preferences.put(pref, builder.toString()); |
547 |
javaCompletionExcluderDialog2.setVisible(false); |
548 |
javaCompletionExcluderDialogTextField.setText(null); |
549 |
}//GEN-LAST:event_javaCompletionExcluderDialogOkButtonActionPerformed |
550 |
|
551 |
private void javaCompletionExcluderDialogCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_javaCompletionExcluderDialogCancelButtonActionPerformed |
552 |
javaCompletionExcluderDialog2.setVisible(false); |
553 |
javaCompletionExcluderDialogTextField.setText(null); |
554 |
editing = null; |
555 |
}//GEN-LAST:event_javaCompletionExcluderDialogCancelButtonActionPerformed |
556 |
|
557 |
private void javaCompletionExcluderDialogTextFieldKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_javaCompletionExcluderDialogTextFieldKeyTyped |
558 |
char c = evt.getKeyChar(); |
559 |
// could use javax.lang.model.SourceVersion.isIdentifier if we had Java 6 |
560 |
if (c != ' ' && c != ',' && c != '*' && !String.valueOf(c).matches(JAVA_FQN_REGEX)) { |
561 |
getToolkit().beep(); |
562 |
evt.consume(); |
563 |
} |
564 |
}//GEN-LAST:event_javaCompletionExcluderDialogTextFieldKeyTyped |
477 |
|
565 |
|
478 |
private void update(DocumentEvent e) { |
566 |
private void update(DocumentEvent e) { |
479 |
if (e.getDocument() == javaAutoCompletionTriggersField.getDocument()) |
567 |
if (e.getDocument() == javaAutoCompletionTriggersField.getDocument()) |
Lines 490-506
Link Here
|
490 |
private javax.swing.JTextField javaAutoCompletionTriggersField; |
578 |
private javax.swing.JTextField javaAutoCompletionTriggersField; |
491 |
private javax.swing.JLabel javaAutoCompletionTriggersLabel; |
579 |
private javax.swing.JLabel javaAutoCompletionTriggersLabel; |
492 |
private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart; |
580 |
private javax.swing.JCheckBox javaAutoPopupOnIdentifierPart; |
|
|
581 |
private javax.swing.JList javaCompletionExcludeJlist; |
493 |
private javax.swing.JScrollPane javaCompletionExcludeScrollPane; |
582 |
private javax.swing.JScrollPane javaCompletionExcludeScrollPane; |
494 |
private javax.swing.JTable javaCompletionExcludeTable; |
|
|
495 |
private javax.swing.JButton javaCompletionExcluderAddButton; |
583 |
private javax.swing.JButton javaCompletionExcluderAddButton; |
496 |
private javax.swing.JButton javaCompletionExcluderButton; |
584 |
private javax.swing.JButton javaCompletionExcluderButton; |
497 |
private javax.swing.JButton javaCompletionExcluderCloseButton; |
585 |
private javax.swing.JButton javaCompletionExcluderCloseButton; |
498 |
private javax.swing.JFrame javaCompletionExcluderFrame; |
586 |
private javax.swing.JDialog javaCompletionExcluderDialog1; |
|
|
587 |
private javax.swing.JDialog javaCompletionExcluderDialog2; |
588 |
private javax.swing.JButton javaCompletionExcluderDialogCancelButton; |
589 |
private javax.swing.JLabel javaCompletionExcluderDialogLabel; |
590 |
private javax.swing.JButton javaCompletionExcluderDialogOkButton; |
591 |
private javax.swing.JTextField javaCompletionExcluderDialogTextField; |
592 |
private javax.swing.JButton javaCompletionExcluderEditButton; |
499 |
private javax.swing.JLabel javaCompletionExcluderLabel; |
593 |
private javax.swing.JLabel javaCompletionExcluderLabel; |
|
|
594 |
private javax.swing.JCheckBox javaCompletionExcluderMethodsCheckBox; |
500 |
private javax.swing.JButton javaCompletionExcluderRemoveButton; |
595 |
private javax.swing.JButton javaCompletionExcluderRemoveButton; |
501 |
private javax.swing.JTabbedPane javaCompletionExcluderTab; |
596 |
private javax.swing.JTabbedPane javaCompletionExcluderTab; |
|
|
597 |
private javax.swing.JList javaCompletionIncludeJlist; |
502 |
private javax.swing.JScrollPane javaCompletionIncludeScrollPane; |
598 |
private javax.swing.JScrollPane javaCompletionIncludeScrollPane; |
503 |
private javax.swing.JTable javaCompletionIncludeTable; |
|
|
504 |
private javax.swing.JPanel javaCompletionPane; |
599 |
private javax.swing.JPanel javaCompletionPane; |
505 |
private javax.swing.JTextField javaCompletionSelectorsField; |
600 |
private javax.swing.JTextField javaCompletionSelectorsField; |
506 |
private javax.swing.JLabel javaCompletionSelectorsLabel; |
601 |
private javax.swing.JLabel javaCompletionSelectorsLabel; |
Lines 508-518
Link Here
|
508 |
private javax.swing.JLabel javadocAutoCompletionTriggersLabel; |
603 |
private javax.swing.JLabel javadocAutoCompletionTriggersLabel; |
509 |
// End of variables declaration//GEN-END:variables |
604 |
// End of variables declaration//GEN-END:variables |
510 |
|
605 |
|
511 |
private static class CodeCompletionPreferencesCusromizer implements PreferencesCustomizer { |
606 |
private static class CodeCompletionPreferencesCustomizer implements PreferencesCustomizer { |
512 |
|
607 |
|
513 |
private final Preferences preferences; |
608 |
private final Preferences preferences; |
514 |
|
609 |
|
515 |
private CodeCompletionPreferencesCusromizer(Preferences p) { |
610 |
private CodeCompletionPreferencesCustomizer(Preferences p) { |
516 |
preferences = p; |
611 |
preferences = p; |
517 |
} |
612 |
} |
518 |
|
613 |
|