Lines 57-63
Link Here
|
57 |
import java.util.Collections; |
57 |
import java.util.Collections; |
58 |
import javax.swing.AbstractAction; |
58 |
import javax.swing.AbstractAction; |
59 |
import javax.swing.DefaultListCellRenderer; |
59 |
import javax.swing.DefaultListCellRenderer; |
60 |
import javax.swing.JButton; |
|
|
61 |
import javax.swing.JComponent; |
60 |
import javax.swing.JComponent; |
62 |
import javax.swing.JFileChooser; |
61 |
import javax.swing.JFileChooser; |
63 |
import javax.swing.JList; |
62 |
import javax.swing.JList; |
Lines 77-82
Link Here
|
77 |
import org.netbeans.spi.project.libraries.LibraryImplementation; |
76 |
import org.netbeans.spi.project.libraries.LibraryImplementation; |
78 |
import org.netbeans.spi.project.libraries.LibraryStorageArea; |
77 |
import org.netbeans.spi.project.libraries.LibraryStorageArea; |
79 |
import org.netbeans.spi.project.libraries.support.LibrariesSupport; |
78 |
import org.netbeans.spi.project.libraries.support.LibrariesSupport; |
|
|
79 |
import org.openide.DialogDescriptor; |
80 |
|
80 |
|
81 |
/** |
81 |
/** |
82 |
* |
82 |
* |
Lines 90-96
Link Here
|
90 |
private VolumeContentModel model; |
90 |
private VolumeContentModel model; |
91 |
private Boolean allowRelativePaths = null; |
91 |
private Boolean allowRelativePaths = null; |
92 |
|
92 |
|
93 |
/** Creates new form J2SEVolumeCustomizer */ |
|
|
94 |
J2SEVolumeCustomizer (String volumeType) { |
93 |
J2SEVolumeCustomizer (String volumeType) { |
95 |
this.volumeType = volumeType; |
94 |
this.volumeType = volumeType; |
96 |
initComponents(); |
95 |
initComponents(); |
Lines 107-115
Link Here
|
107 |
public void setEnabled(boolean enabled) { |
106 |
public void setEnabled(boolean enabled) { |
108 |
super.setEnabled(enabled); |
107 |
super.setEnabled(enabled); |
109 |
this.addButton.setEnabled(enabled); |
108 |
this.addButton.setEnabled(enabled); |
110 |
if (this.addURLButton != null) { |
109 |
addURLButton.setEnabled(volumeType.equals(J2SELibraryTypeProvider.VOLUME_TYPE_JAVADOC)); |
111 |
this.addURLButton.setEnabled(enabled); |
|
|
112 |
} |
113 |
int[] indices = content.getSelectedIndices(); |
110 |
int[] indices = content.getSelectedIndices(); |
114 |
this.removeButton.setEnabled(enabled && indices.length > 0); |
111 |
this.removeButton.setEnabled(enabled && indices.length > 0); |
115 |
this.downButton.setEnabled(enabled && indices.length > 0 && indices[indices.length-1]<model.getSize()-1); |
112 |
this.downButton.setEnabled(enabled && indices.length > 0 && indices[indices.length-1]<model.getSize()-1); |
Lines 188-194
Link Here
|
188 |
* 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 |
189 |
* always regenerated by the Form Editor. |
186 |
* always regenerated by the Form Editor. |
190 |
*/ |
187 |
*/ |
191 |
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents |
188 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
192 |
private void initComponents() { |
189 |
private void initComponents() { |
193 |
java.awt.GridBagConstraints gridBagConstraints; |
190 |
java.awt.GridBagConstraints gridBagConstraints; |
194 |
|
191 |
|
Lines 196-210
Link Here
|
196 |
jScrollPane1 = new javax.swing.JScrollPane(); |
193 |
jScrollPane1 = new javax.swing.JScrollPane(); |
197 |
content = new javax.swing.JList(); |
194 |
content = new javax.swing.JList(); |
198 |
addButton = new javax.swing.JButton(); |
195 |
addButton = new javax.swing.JButton(); |
|
|
196 |
addURLButton = new javax.swing.JButton(); |
199 |
removeButton = new javax.swing.JButton(); |
197 |
removeButton = new javax.swing.JButton(); |
200 |
upButton = new javax.swing.JButton(); |
198 |
upButton = new javax.swing.JButton(); |
201 |
downButton = new javax.swing.JButton(); |
199 |
downButton = new javax.swing.JButton(); |
202 |
|
200 |
|
203 |
setLayout(new java.awt.GridBagLayout()); |
201 |
setLayout(new java.awt.GridBagLayout()); |
204 |
|
202 |
|
205 |
getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_J2SEVolumeCustomizer")); |
|
|
206 |
message.setLabelFor(content); |
203 |
message.setLabelFor(content); |
207 |
org.openide.awt.Mnemonics.setLocalizedText(message, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_ContentMessage")); |
204 |
org.openide.awt.Mnemonics.setLocalizedText(message, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_ContentMessage")); // NOI18N |
208 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
205 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
209 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
206 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
210 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
207 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
Lines 225-254
Link Here
|
225 |
gridBagConstraints.insets = new java.awt.Insets(0, 6, 6, 6); |
222 |
gridBagConstraints.insets = new java.awt.Insets(0, 6, 6, 6); |
226 |
add(jScrollPane1, gridBagConstraints); |
223 |
add(jScrollPane1, gridBagConstraints); |
227 |
|
224 |
|
228 |
org.openide.awt.Mnemonics.setLocalizedText(addButton, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_AddContent")); |
225 |
org.openide.awt.Mnemonics.setLocalizedText(addButton, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_AddContent")); // NOI18N |
229 |
addButton.addActionListener(new java.awt.event.ActionListener() { |
226 |
addButton.addActionListener(new java.awt.event.ActionListener() { |
230 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
227 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
231 |
addResource(evt); |
228 |
addResource(evt); |
232 |
} |
229 |
} |
233 |
}); |
230 |
}); |
234 |
|
|
|
235 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
231 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
236 |
gridBagConstraints.gridx = 1; |
232 |
gridBagConstraints.gridx = 1; |
237 |
gridBagConstraints.gridy = 1; |
233 |
gridBagConstraints.gridy = 1; |
238 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
234 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
239 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
235 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
240 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
236 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
241 |
gridBagConstraints.insets = new java.awt.Insets(0, 6, 6, 6); |
237 |
gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 6); |
242 |
add(addButton, gridBagConstraints); |
238 |
add(addButton, gridBagConstraints); |
243 |
addButton.getAccessibleContext().setAccessibleDescription(null); |
239 |
addButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_addButton")); // NOI18N |
244 |
|
240 |
|
245 |
org.openide.awt.Mnemonics.setLocalizedText(removeButton, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_RemoveContent")); |
241 |
org.openide.awt.Mnemonics.setLocalizedText(addURLButton, NbBundle.getMessage(J2SEVolumeCustomizer.class, "J2SEVolumeCustomizer.addURLButton.text")); // NOI18N |
|
|
242 |
addURLButton.addActionListener(new java.awt.event.ActionListener() { |
243 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
244 |
addURLButtonActionPerformed(evt); |
245 |
} |
246 |
}); |
247 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
248 |
gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; |
249 |
gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; |
250 |
gridBagConstraints.insets = new java.awt.Insets(5, 6, 6, 6); |
251 |
add(addURLButton, gridBagConstraints); |
252 |
|
253 |
org.openide.awt.Mnemonics.setLocalizedText(removeButton, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_RemoveContent")); // NOI18N |
246 |
removeButton.addActionListener(new java.awt.event.ActionListener() { |
254 |
removeButton.addActionListener(new java.awt.event.ActionListener() { |
247 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
255 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
248 |
removeResource(evt); |
256 |
removeResource(evt); |
249 |
} |
257 |
} |
250 |
}); |
258 |
}); |
251 |
|
|
|
252 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
259 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
253 |
gridBagConstraints.gridx = 1; |
260 |
gridBagConstraints.gridx = 1; |
254 |
gridBagConstraints.gridy = 3; |
261 |
gridBagConstraints.gridy = 3; |
Lines 257-271
Link Here
|
257 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
264 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
258 |
gridBagConstraints.insets = new java.awt.Insets(5, 6, 6, 6); |
265 |
gridBagConstraints.insets = new java.awt.Insets(5, 6, 6, 6); |
259 |
add(removeButton, gridBagConstraints); |
266 |
add(removeButton, gridBagConstraints); |
260 |
removeButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_RemoveContent")); |
267 |
removeButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_RemoveContent")); // NOI18N |
261 |
|
268 |
|
262 |
org.openide.awt.Mnemonics.setLocalizedText(upButton, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_UpContent")); |
269 |
org.openide.awt.Mnemonics.setLocalizedText(upButton, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_UpContent")); // NOI18N |
263 |
upButton.addActionListener(new java.awt.event.ActionListener() { |
270 |
upButton.addActionListener(new java.awt.event.ActionListener() { |
264 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
271 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
265 |
upResource(evt); |
272 |
upResource(evt); |
266 |
} |
273 |
} |
267 |
}); |
274 |
}); |
268 |
|
|
|
269 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
275 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
270 |
gridBagConstraints.gridx = 1; |
276 |
gridBagConstraints.gridx = 1; |
271 |
gridBagConstraints.gridy = 4; |
277 |
gridBagConstraints.gridy = 4; |
Lines 274-288
Link Here
|
274 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
280 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
275 |
gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 6); |
281 |
gridBagConstraints.insets = new java.awt.Insets(5, 6, 0, 6); |
276 |
add(upButton, gridBagConstraints); |
282 |
add(upButton, gridBagConstraints); |
277 |
upButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_UpContent")); |
283 |
upButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_UpContent")); // NOI18N |
278 |
|
284 |
|
279 |
org.openide.awt.Mnemonics.setLocalizedText(downButton, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_DownContent")); |
285 |
org.openide.awt.Mnemonics.setLocalizedText(downButton, org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("CTL_DownContent")); // NOI18N |
280 |
downButton.addActionListener(new java.awt.event.ActionListener() { |
286 |
downButton.addActionListener(new java.awt.event.ActionListener() { |
281 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
287 |
public void actionPerformed(java.awt.event.ActionEvent evt) { |
282 |
downResource(evt); |
288 |
downResource(evt); |
283 |
} |
289 |
} |
284 |
}); |
290 |
}); |
285 |
|
|
|
286 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
291 |
gridBagConstraints = new java.awt.GridBagConstraints(); |
287 |
gridBagConstraints.gridx = 1; |
292 |
gridBagConstraints.gridx = 1; |
288 |
gridBagConstraints.gridy = 5; |
293 |
gridBagConstraints.gridy = 5; |
Lines 291-300
Link Here
|
291 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
296 |
gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; |
292 |
gridBagConstraints.insets = new java.awt.Insets(5, 6, 6, 6); |
297 |
gridBagConstraints.insets = new java.awt.Insets(5, 6, 6, 6); |
293 |
add(downButton, gridBagConstraints); |
298 |
add(downButton, gridBagConstraints); |
294 |
downButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_DownContent")); |
299 |
downButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_DownContent")); // NOI18N |
295 |
|
300 |
|
296 |
} |
301 |
getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getBundle(J2SEVolumeCustomizer.class).getString("AD_J2SEVolumeCustomizer")); // NOI18N |
297 |
// </editor-fold>//GEN-END:initComponents |
302 |
}// </editor-fold>//GEN-END:initComponents |
298 |
|
303 |
|
299 |
private void downResource(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downResource |
304 |
private void downResource(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downResource |
300 |
int[] indices = this.content.getSelectedIndices(); |
305 |
int[] indices = this.content.getSelectedIndices(); |
Lines 396-422
Link Here
|
396 |
} |
401 |
} |
397 |
}//GEN-LAST:event_addResource |
402 |
}//GEN-LAST:event_addResource |
398 |
|
403 |
|
399 |
|
404 |
private void addURLButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addURLButtonActionPerformed |
400 |
// private void addURLResource () { |
405 |
DialogDescriptor.InputLine input = new DialogDescriptor.InputLine( |
401 |
// DialogDescriptor.InputLine input = new DialogDescriptor.InputLine ( |
406 |
NbBundle.getMessage(J2SEVolumeCustomizer.class, "CTL_AddJavadocURLMessage"), |
402 |
// NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_AddJavadocURLMessage"), |
407 |
NbBundle.getMessage(J2SEVolumeCustomizer.class, "CTL_AddJavadocURLTitle")); |
403 |
// NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_AddJavadocURLTitle")); |
408 |
if (DialogDisplayer.getDefault().notify(input) == DialogDescriptor.OK_OPTION) { |
404 |
// if (DialogDisplayer.getDefault().notify(input) == DialogDescriptor.OK_OPTION) { |
409 |
try { |
405 |
// try { |
410 |
String value = input.getInputText(); |
406 |
// String value = input.getInputText(); |
411 |
URL url = new URL(value); |
407 |
// URL url = new URL (value); |
412 |
model.addResource(url); |
408 |
// this.model.addResource(url); |
413 |
content.setSelectedIndex(model.getSize() - 1); |
409 |
// this.content.setSelectedIndex(this.model.getSize()-1); |
414 |
} catch (MalformedURLException mue) { |
410 |
// } catch (MalformedURLException mue) { |
415 |
DialogDisplayer.getDefault().notify(new DialogDescriptor.Message( |
411 |
// DialogDescriptor.Message message = new DialogDescriptor.Message ( |
416 |
NbBundle.getMessage(J2SEVolumeCustomizer.class, "CTL_InvalidURLFormat"), |
412 |
// NbBundle.getMessage(J2SEVolumeCustomizer.class,"CTL_InvalidURLFormat"), |
417 |
DialogDescriptor.ERROR_MESSAGE)); |
413 |
// DialogDescriptor.ERROR_MESSAGE |
418 |
} |
414 |
// ); |
419 |
} |
415 |
// DialogDisplayer.getDefault().notify(message); |
420 |
}//GEN-LAST:event_addURLButtonActionPerformed |
416 |
// } |
|
|
417 |
// } |
418 |
// } |
419 |
|
420 |
|
421 |
|
421 |
private void addFiles (String[] fileNames, URL libraryLocation, String volume) throws MalformedURLException, URISyntaxException { |
422 |
private void addFiles (String[] fileNames, URL libraryLocation, String volume) throws MalformedURLException, URISyntaxException { |
422 |
int firstIndex = this.model.getSize(); |
423 |
int firstIndex = this.model.getSize(); |
Lines 579-584
Link Here
|
579 |
|
580 |
|
580 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
581 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
581 |
private javax.swing.JButton addButton; |
582 |
private javax.swing.JButton addButton; |
|
|
583 |
private javax.swing.JButton addURLButton; |
582 |
private javax.swing.JList content; |
584 |
private javax.swing.JList content; |
583 |
private javax.swing.JButton downButton; |
585 |
private javax.swing.JButton downButton; |
584 |
private javax.swing.JScrollPane jScrollPane1; |
586 |
private javax.swing.JScrollPane jScrollPane1; |
Lines 586-592
Link Here
|
586 |
private javax.swing.JButton removeButton; |
588 |
private javax.swing.JButton removeButton; |
587 |
private javax.swing.JButton upButton; |
589 |
private javax.swing.JButton upButton; |
588 |
// End of variables declaration//GEN-END:variables |
590 |
// End of variables declaration//GEN-END:variables |
589 |
private JButton addURLButton; |
|
|
590 |
|
591 |
|
591 |
private static class ContentRenderer extends DefaultListCellRenderer { |
592 |
private static class ContentRenderer extends DefaultListCellRenderer { |
592 |
|
593 |
|
Lines 605-611
Link Here
|
605 |
Exceptions.printStackTrace(ex); |
606 |
Exceptions.printStackTrace(ex); |
606 |
} |
607 |
} |
607 |
} |
608 |
} |
608 |
if (uri != null) { |
609 |
if (uri != null && uri.toString().startsWith("http")) { |
|
|
610 |
displayName = uri.toString(); |
611 |
} else if (uri != null) { |
609 |
if (uri.toString().contains("!/")) { //NOI18N |
612 |
if (uri.toString().contains("!/")) { //NOI18N |
610 |
uri = LibrariesSupport.getArchiveFile(uri); |
613 |
uri = LibrariesSupport.getArchiveFile(uri); |
611 |
} |
614 |
} |