Lines 42-54
Link Here
|
42 |
|
42 |
|
43 |
import java.util.ArrayList; |
43 |
import java.util.ArrayList; |
44 |
import java.util.Collections; |
44 |
import java.util.Collections; |
45 |
import javax.swing.UIManager; |
45 |
import java.util.prefs.Preferences; |
46 |
import javax.swing.event.DocumentEvent; |
46 |
import javax.swing.event.DocumentEvent; |
47 |
import javax.swing.event.DocumentListener; |
47 |
import javax.swing.event.DocumentListener; |
48 |
import org.netbeans.core.ui.options.filetypes.FileAssociationsModel.MimeItem; |
48 |
import org.netbeans.core.ui.options.filetypes.FileAssociationsModel.MimeItem; |
49 |
import org.openide.DialogDescriptor; |
49 |
import org.openide.DialogDescriptor; |
50 |
import org.openide.DialogDisplayer; |
50 |
import org.openide.DialogDisplayer; |
51 |
import org.openide.util.NbBundle; |
51 |
import org.openide.util.NbBundle; |
|
|
52 |
import org.openide.util.NbPreferences; |
52 |
|
53 |
|
53 |
/** Options panel with extensions and associated MIME types. |
54 |
/** Options panel with extensions and associated MIME types. |
54 |
* |
55 |
* |
Lines 95-100
Link Here
|
95 |
jScrollPane1 = new javax.swing.JScrollPane(); |
96 |
jScrollPane1 = new javax.swing.JScrollPane(); |
96 |
txtPattern = new javax.swing.JTextArea(); |
97 |
txtPattern = new javax.swing.JTextArea(); |
97 |
txtPatternError = new javax.swing.JLabel(); |
98 |
txtPatternError = new javax.swing.JLabel(); |
|
|
99 |
autoScan = new javax.swing.JCheckBox(); |
100 |
autoScanLabel = new javax.swing.JLabel(); |
98 |
|
101 |
|
99 |
lblExtension.setLabelFor(cbExtension); |
102 |
lblExtension.setLabelFor(cbExtension); |
100 |
org.openide.awt.Mnemonics.setLocalizedText(lblExtension, org.openide.util.NbBundle.getMessage(FileAssociationsPanel.class, "FileAssociationsPanel.lblExtension.text")); // NOI18N |
103 |
org.openide.awt.Mnemonics.setLocalizedText(lblExtension, org.openide.util.NbBundle.getMessage(FileAssociationsPanel.class, "FileAssociationsPanel.lblExtension.text")); // NOI18N |
Lines 169-174
Link Here
|
169 |
txtPatternError.setVerticalAlignment(javax.swing.SwingConstants.TOP); |
172 |
txtPatternError.setVerticalAlignment(javax.swing.SwingConstants.TOP); |
170 |
txtPatternError.setFocusable(false); |
173 |
txtPatternError.setFocusable(false); |
171 |
|
174 |
|
|
|
175 |
org.openide.awt.Mnemonics.setLocalizedText(autoScan, org.openide.util.NbBundle.getMessage(FileAssociationsPanel.class, "FileAssociationsPanel.autoScan.text", new Object[] {})); // NOI18N |
176 |
autoScan.addActionListener(new java.awt.event.ActionListener() { |
177 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
178 |
autoScanActionPerformed(evt); |
179 |
} |
180 |
}); |
181 |
|
182 |
org.openide.awt.Mnemonics.setLocalizedText(autoScanLabel, org.openide.util.NbBundle.getMessage(FileAssociationsPanel.class, "FileAssociationsPanel.autoScanLabel.text", new Object[] {})); // NOI18N |
183 |
|
172 |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
184 |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
173 |
this.setLayout(layout); |
185 |
this.setLayout(layout); |
174 |
layout.setHorizontalGroup( |
186 |
layout.setHorizontalGroup( |
Lines 179-185
Link Here
|
179 |
.addGroup(layout.createSequentialGroup() |
191 |
.addGroup(layout.createSequentialGroup() |
180 |
.addComponent(lblFileAssociations) |
192 |
.addComponent(lblFileAssociations) |
181 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
193 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
182 |
.addComponent(sepFileAssociations, javax.swing.GroupLayout.DEFAULT_SIZE, 530, Short.MAX_VALUE)) |
194 |
.addComponent(sepFileAssociations, javax.swing.GroupLayout.DEFAULT_SIZE, 542, Short.MAX_VALUE)) |
183 |
.addGroup(layout.createSequentialGroup() |
195 |
.addGroup(layout.createSequentialGroup() |
184 |
.addGap(10, 10, 10) |
196 |
.addGap(10, 10, 10) |
185 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
197 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
Lines 190-200
Link Here
|
190 |
.addGroup(layout.createSequentialGroup() |
202 |
.addGroup(layout.createSequentialGroup() |
191 |
.addComponent(lblAssociatedAlso) |
203 |
.addComponent(lblAssociatedAlso) |
192 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
204 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
193 |
.addComponent(lblAssociatedAlsoExt, javax.swing.GroupLayout.DEFAULT_SIZE, 281, Short.MAX_VALUE)) |
205 |
.addComponent(lblAssociatedAlsoExt, javax.swing.GroupLayout.DEFAULT_SIZE, 323, Short.MAX_VALUE)) |
194 |
.addGroup(layout.createSequentialGroup() |
206 |
.addGroup(layout.createSequentialGroup() |
195 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
207 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
196 |
.addComponent(cbExtension, 0, 254, Short.MAX_VALUE) |
208 |
.addComponent(cbExtension, 0, 293, Short.MAX_VALUE) |
197 |
.addComponent(cbType, 0, 254, Short.MAX_VALUE)) |
209 |
.addComponent(cbType, 0, 293, Short.MAX_VALUE)) |
198 |
.addGap(10, 10, 10) |
210 |
.addGap(10, 10, 10) |
199 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
211 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
200 |
.addGroup(layout.createSequentialGroup() |
212 |
.addGroup(layout.createSequentialGroup() |
Lines 203-221
Link Here
|
203 |
.addComponent(btnRemove)) |
215 |
.addComponent(btnRemove)) |
204 |
.addComponent(btnDefault))))) |
216 |
.addComponent(btnDefault))))) |
205 |
.addGroup(layout.createSequentialGroup() |
217 |
.addGroup(layout.createSequentialGroup() |
|
|
218 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
219 |
.addGroup(layout.createSequentialGroup() |
220 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
221 |
.addGroup(layout.createSequentialGroup() |
222 |
.addGap(10, 10, 10) |
223 |
.addComponent(lblPattern)) |
224 |
.addGroup(layout.createSequentialGroup() |
225 |
.addComponent(autoScan, javax.swing.GroupLayout.DEFAULT_SIZE, 503, Short.MAX_VALUE) |
226 |
.addGap(44, 44, 44))) |
227 |
.addGap(41, 41, 41)) |
228 |
.addGroup(layout.createSequentialGroup() |
229 |
.addGap(21, 21, 21) |
230 |
.addComponent(autoScanLabel) |
231 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) |
232 |
.addComponent(txtPatternError, javax.swing.GroupLayout.DEFAULT_SIZE, 72, Short.MAX_VALUE)) |
233 |
.addGroup(layout.createSequentialGroup() |
206 |
.addComponent(lblFilesIgnored) |
234 |
.addComponent(lblFilesIgnored) |
207 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
235 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
208 |
.addComponent(setFilesIgnored, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE)) |
|
|
209 |
.addGroup(layout.createSequentialGroup() |
210 |
.addGap(10, 10, 10) |
211 |
.addComponent(lblPattern) |
212 |
.addGap(41, 41, 41) |
213 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
236 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
214 |
.addComponent(txtPatternError, javax.swing.GroupLayout.DEFAULT_SIZE, 455, Short.MAX_VALUE) |
|
|
215 |
.addGroup(layout.createSequentialGroup() |
237 |
.addGroup(layout.createSequentialGroup() |
216 |
.addComponent(jScrollPane1) |
238 |
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE) |
217 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
239 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
218 |
.addComponent(btnDefaultIgnored))))) |
240 |
.addComponent(btnDefaultIgnored)) |
|
|
241 |
.addComponent(setFilesIgnored, javax.swing.GroupLayout.DEFAULT_SIZE, 499, Short.MAX_VALUE)))) |
219 |
.addContainerGap()) |
242 |
.addContainerGap()) |
220 |
); |
243 |
); |
221 |
layout.setVerticalGroup( |
244 |
layout.setVerticalGroup( |
Lines 250-257
Link Here
|
250 |
.addComponent(btnDefaultIgnored) |
273 |
.addComponent(btnDefaultIgnored) |
251 |
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) |
274 |
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)) |
252 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
275 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
253 |
.addComponent(txtPatternError, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE) |
276 |
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
254 |
.addGap(16, 16, 16)) |
277 |
.addGroup(layout.createSequentialGroup() |
|
|
278 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
279 |
.addComponent(txtPatternError, javax.swing.GroupLayout.DEFAULT_SIZE, 129, Short.MAX_VALUE) |
280 |
.addGap(16, 16, 16)) |
281 |
.addGroup(layout.createSequentialGroup() |
282 |
.addGap(20, 20, 20) |
283 |
.addComponent(autoScan) |
284 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) |
285 |
.addComponent(autoScanLabel) |
286 |
.addGap(79, 79, 79)))) |
255 |
); |
287 |
); |
256 |
|
288 |
|
257 |
lblExtension.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(FileAssociationsPanel.class, "FileAssociationsPanel.lblExtension.AN")); // NOI18N |
289 |
lblExtension.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(FileAssociationsPanel.class, "FileAssociationsPanel.lblExtension.AN")); // NOI18N |
Lines 354-359
Link Here
|
354 |
txtPattern.setText(IgnoredFilesPreferences.DEFAULT_IGNORED_FILES); |
386 |
txtPattern.setText(IgnoredFilesPreferences.DEFAULT_IGNORED_FILES); |
355 |
}//GEN-LAST:event_btnDefaultIgnoredActionPerformed |
387 |
}//GEN-LAST:event_btnDefaultIgnoredActionPerformed |
356 |
|
388 |
|
|
|
389 |
private void autoScanActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_autoScanActionPerformed |
390 |
controller.changed(); |
391 |
}//GEN-LAST:event_autoScanActionPerformed |
392 |
|
357 |
void load() { |
393 |
void load() { |
358 |
cbExtension.removeAllItems(); |
394 |
cbExtension.removeAllItems(); |
359 |
cbType.removeAllItems(); |
395 |
cbType.removeAllItems(); |
Lines 378-383
Link Here
|
378 |
txtPattern.setText(IgnoredFilesPreferences.getIgnoredFiles()); |
414 |
txtPattern.setText(IgnoredFilesPreferences.getIgnoredFiles()); |
379 |
txtPattern.getDocument().addDocumentListener(patternListener); |
415 |
txtPattern.getDocument().addDocumentListener(patternListener); |
380 |
btnDefaultIgnored.setEnabled(!IgnoredFilesPreferences.DEFAULT_IGNORED_FILES.equals(txtPattern.getText())); |
416 |
btnDefaultIgnored.setEnabled(!IgnoredFilesPreferences.DEFAULT_IGNORED_FILES.equals(txtPattern.getText())); |
|
|
417 |
|
418 |
boolean manual = NbPreferences.root().node("org/openide/actions/FileSystemRefreshAction").getBoolean("manual", false); // NOI18N |
419 |
autoScan.setSelected(!manual); |
381 |
} |
420 |
} |
382 |
|
421 |
|
383 |
void store() { |
422 |
void store() { |
Lines 385-390
Link Here
|
385 |
model.store(); |
424 |
model.store(); |
386 |
// store ignored files pattern |
425 |
// store ignored files pattern |
387 |
IgnoredFilesPreferences.setIgnoredFiles(txtPattern.getText()); |
426 |
IgnoredFilesPreferences.setIgnoredFiles(txtPattern.getText()); |
|
|
427 |
|
428 |
final Preferences nd = NbPreferences.root().node("org/openide/actions/FileSystemRefreshAction"); // NOI18N |
429 |
boolean manual = nd.getBoolean("manual", false); |
430 |
if (manual == autoScan.isSelected()) { |
431 |
nd.putBoolean("manual", !manual); // NOI18N |
432 |
} |
388 |
} |
433 |
} |
389 |
|
434 |
|
390 |
boolean valid() { |
435 |
boolean valid() { |
Lines 394-399
Link Here
|
394 |
} |
439 |
} |
395 |
|
440 |
|
396 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
441 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
|
|
442 |
private javax.swing.JCheckBox autoScan; |
443 |
private javax.swing.JLabel autoScanLabel; |
397 |
private javax.swing.JButton btnDefault; |
444 |
private javax.swing.JButton btnDefault; |
398 |
private javax.swing.JButton btnDefaultIgnored; |
445 |
private javax.swing.JButton btnDefaultIgnored; |
399 |
private javax.swing.JButton btnNew; |
446 |
private javax.swing.JButton btnNew; |