1 19 20 package org.netbeans.modules.web.project.ui.customizer; 21 22 import java.io.File ; 23 import javax.swing.JFileChooser ; 24 import javax.swing.JTable ; 25 import javax.swing.ListSelectionModel ; 26 import javax.swing.event.ListDataEvent ; 27 import javax.swing.event.ListDataListener ; 28 import javax.swing.table.TableColumn ; 29 import org.openide.filesystems.FileObject; 30 import org.openide.filesystems.FileUtil; 31 import org.openide.util.HelpCtx; 32 import org.openide.util.NbBundle; 33 import org.netbeans.api.queries.CollocationQuery; 34 import org.netbeans.spi.project.support.ant.PropertyUtils; 35 import org.netbeans.modules.web.project.WebProject; 36 37 41 public class CustomizerSources extends javax.swing.JPanel implements HelpCtx.Provider { 42 43 private File projectFld; 44 45 public CustomizerSources( WebProjectProperties uiProperties ) { 46 initComponents(); 47 jScrollPane1.getViewport().setBackground( sourceRoots.getBackground() ); 48 jScrollPane2.getViewport().setBackground( testRoots.getBackground() ); 49 50 sourceRoots.setModel( uiProperties.SOURCE_ROOTS_MODEL ); 51 testRoots.setModel( uiProperties.TEST_ROOTS_MODEL ); 52 sourceRoots.getTableHeader().setReorderingAllowed(false); 53 testRoots.getTableHeader().setReorderingAllowed(false); 54 55 FileObject projectFolder = uiProperties.getProject().getProjectDirectory(); 56 File pf = FileUtil.toFile( projectFolder ); 57 this.projectLocation.setText( pf == null ? "" : pf.getPath() ); this.projectFld = pf; 59 60 jTextFieldWebPages.setDocument(uiProperties.WEB_DOCBASE_DIR_MODEL); 61 62 WebSourceRootsUi.EditMediator emSR = WebSourceRootsUi.registerEditMediator( 63 (WebProject)uiProperties.getProject(), 64 ((WebProject)uiProperties.getProject()).getSourceRoots(), 65 sourceRoots, 66 addSourceRoot, 67 removeSourceRoot, 68 upSourceRoot, 69 downSourceRoot); 70 71 WebSourceRootsUi.EditMediator emTSR = WebSourceRootsUi.registerEditMediator( 72 (WebProject)uiProperties.getProject(), 73 ((WebProject)uiProperties.getProject()).getTestSourceRoots(), 74 testRoots, 75 addTestRoot, 76 removeTestRoot, 77 upTestRoot, 78 downTestRoot); 79 80 emSR.setRelatedEditMediator( emTSR ); 81 emTSR.setRelatedEditMediator( emSR ); 82 83 this.jComboBoxSourceLevel.setModel(uiProperties.JAVAC_SOURCE_MODEL); 84 uiProperties.JAVAC_SOURCE_MODEL.addListDataListener(new ListDataListener () { 85 public void intervalAdded(ListDataEvent e) { 86 enableSourceLevel(); 87 } 88 89 public void intervalRemoved(ListDataEvent e) { 90 enableSourceLevel(); 91 } 92 93 public void contentsChanged(ListDataEvent e) { 94 enableSourceLevel(); 95 } 96 }); 97 enableSourceLevel(); 98 initTableVisualProperties(sourceRoots); 99 initTableVisualProperties(testRoots); 100 } 101 102 private void initTableVisualProperties(JTable table) { 103 table.setRowHeight(testRoots.getRowHeight() + 4); 105 table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); 106 table.setIntercellSpacing(new java.awt.Dimension (0, 0)); 107 table.getParent().setBackground(table.getBackground()); 109 110 table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); 113 TableColumn column = table.getColumnModel().getColumn(0); 114 column.setMinWidth(230); 115 column.setWidth(230); 116 column.setMinWidth(75); 117 118 column = table.getColumnModel().getColumn(1); 119 column.setMinWidth(220); 120 column.setWidth(220); 121 column.setMinWidth(75); 122 } 123 124 public HelpCtx getHelpCtx() { 125 return new HelpCtx(CustomizerSources.class); 126 } 127 128 private void enableSourceLevel() { 129 this.jComboBoxSourceLevel.setEnabled(jComboBoxSourceLevel.getItemCount()>0); 130 } 131 132 137 private void initComponents() { 139 java.awt.GridBagConstraints gridBagConstraints; 140 141 jLabel1 = new javax.swing.JLabel (); 142 projectLocation = new javax.swing.JTextField (); 143 jLabelWebPages = new javax.swing.JLabel (); 144 jTextFieldWebPages = new javax.swing.JTextField (); 145 jButtonBrowse = new javax.swing.JButton (); 146 sourceRootsPanel = new javax.swing.JPanel (); 147 jLabel2 = new javax.swing.JLabel (); 148 jScrollPane1 = new javax.swing.JScrollPane (); 149 sourceRoots = new javax.swing.JTable (); 150 addSourceRoot = new javax.swing.JButton (); 151 removeSourceRoot = new javax.swing.JButton (); 152 upSourceRoot = new javax.swing.JButton (); 153 downSourceRoot = new javax.swing.JButton (); 154 testRootsPanel = new javax.swing.JPanel (); 155 jLabel3 = new javax.swing.JLabel (); 156 jScrollPane2 = new javax.swing.JScrollPane (); 157 testRoots = new javax.swing.JTable (); 158 addTestRoot = new javax.swing.JButton (); 159 removeTestRoot = new javax.swing.JButton (); 160 upTestRoot = new javax.swing.JButton (); 161 downTestRoot = new javax.swing.JButton (); 162 jLabelSourceLevel = new javax.swing.JLabel (); 163 jComboBoxSourceLevel = new javax.swing.JComboBox (); 164 165 setLayout(new java.awt.GridBagLayout ()); 166 167 jLabel1.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_ProjectFolder").charAt(0)); 168 jLabel1.setLabelFor(projectLocation); 169 jLabel1.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_ProjectFolder")); 170 gridBagConstraints = new java.awt.GridBagConstraints (); 171 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 172 gridBagConstraints.insets = new java.awt.Insets (0, 0, 12, 12); 173 add(jLabel1, gridBagConstraints); 174 175 projectLocation.setEditable(false); 176 gridBagConstraints = new java.awt.GridBagConstraints (); 177 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 178 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 179 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 180 gridBagConstraints.insets = new java.awt.Insets (0, 0, 12, 0); 181 add(projectLocation, gridBagConstraints); 182 projectLocation.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_projectLocation")); 183 184 jLabelWebPages.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_WebPages").charAt(0)); 185 jLabelWebPages.setLabelFor(jTextFieldWebPages); 186 jLabelWebPages.setText(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "CTL_WebPagesFolder")); 187 gridBagConstraints = new java.awt.GridBagConstraints (); 188 gridBagConstraints.gridx = 0; 189 gridBagConstraints.gridy = 1; 190 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 191 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 12); 192 add(jLabelWebPages, gridBagConstraints); 193 194 gridBagConstraints = new java.awt.GridBagConstraints (); 195 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 196 gridBagConstraints.weightx = 1.0; 197 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 12); 198 add(jTextFieldWebPages, gridBagConstraints); 199 jTextFieldWebPages.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_webPagesFolder")); 200 201 jButtonBrowse.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_WebPagesBrowse").charAt(0)); 202 jButtonBrowse.setText(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "LBL_Browse_JButton")); 203 jButtonBrowse.addActionListener(new java.awt.event.ActionListener () { 204 public void actionPerformed(java.awt.event.ActionEvent evt) { 205 jButtonBrowseActionPerformed(evt); 206 } 207 }); 208 209 gridBagConstraints = new java.awt.GridBagConstraints (); 210 gridBagConstraints.gridx = 2; 211 gridBagConstraints.gridy = 1; 212 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 213 add(jButtonBrowse, gridBagConstraints); 214 jButtonBrowse.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_webPagesFolderBrowse")); 215 216 sourceRootsPanel.setLayout(new java.awt.GridBagLayout ()); 217 218 jLabel2.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_SourceRoots").charAt(0)); 219 jLabel2.setLabelFor(sourceRoots); 220 jLabel2.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_SourceRoots")); 221 gridBagConstraints = new java.awt.GridBagConstraints (); 222 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 223 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 224 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 225 gridBagConstraints.insets = new java.awt.Insets (0, 0, 6, 0); 226 sourceRootsPanel.add(jLabel2, gridBagConstraints); 227 228 sourceRoots.setModel(new javax.swing.table.DefaultTableModel ( 229 new Object [][] { 230 {null, null}, 231 {null, null}, 232 {null, null}, 233 {null, null} 234 }, 235 new String [] { 236 "Package Folder", "Label" 237 } 238 ) { 239 Class [] types = new Class [] { 240 java.lang.Object .class, java.lang.String .class 241 }; 242 boolean[] canEdit = new boolean [] { 243 false, false 244 }; 245 246 public Class getColumnClass(int columnIndex) { 247 return types [columnIndex]; 248 } 249 250 public boolean isCellEditable(int rowIndex, int columnIndex) { 251 return canEdit [columnIndex]; 252 } 253 }); 254 jScrollPane1.setViewportView(sourceRoots); 255 sourceRoots.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_sourceRoots")); 256 257 gridBagConstraints = new java.awt.GridBagConstraints (); 258 gridBagConstraints.gridx = 0; 259 gridBagConstraints.gridy = 1; 260 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 261 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 262 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 263 gridBagConstraints.weightx = 1.0; 264 gridBagConstraints.weighty = 1.0; 265 gridBagConstraints.insets = new java.awt.Insets (0, 0, 0, 12); 266 sourceRootsPanel.add(jScrollPane1, gridBagConstraints); 267 268 addSourceRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_AddSourceRoot").charAt(0)); 269 addSourceRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_AddSourceRoot")); 270 gridBagConstraints = new java.awt.GridBagConstraints (); 271 gridBagConstraints.gridx = 1; 272 gridBagConstraints.gridy = 1; 273 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 274 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 275 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 276 sourceRootsPanel.add(addSourceRoot, gridBagConstraints); 277 addSourceRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_addSourceRoot")); 278 279 removeSourceRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_RemoveSourceRoot").charAt(0)); 280 removeSourceRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_RemoveSourceRoot")); 281 gridBagConstraints = new java.awt.GridBagConstraints (); 282 gridBagConstraints.gridx = 1; 283 gridBagConstraints.gridy = 2; 284 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 285 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 286 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 287 gridBagConstraints.insets = new java.awt.Insets (6, 0, 0, 0); 288 sourceRootsPanel.add(removeSourceRoot, gridBagConstraints); 289 removeSourceRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_removeSourceRoot")); 290 291 upSourceRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_UpSourceRoot").charAt(0)); 292 upSourceRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_UpSourceRoot")); 293 gridBagConstraints = new java.awt.GridBagConstraints (); 294 gridBagConstraints.gridx = 1; 295 gridBagConstraints.gridy = 3; 296 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 297 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 298 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 299 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 300 sourceRootsPanel.add(upSourceRoot, gridBagConstraints); 301 upSourceRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_upSourceRoot")); 302 303 downSourceRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_DownSourceRoot").charAt(0)); 304 downSourceRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_DownSourceRoot")); 305 gridBagConstraints = new java.awt.GridBagConstraints (); 306 gridBagConstraints.gridx = 1; 307 gridBagConstraints.gridy = 4; 308 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 309 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 310 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 311 gridBagConstraints.insets = new java.awt.Insets (6, 0, 0, 0); 312 sourceRootsPanel.add(downSourceRoot, gridBagConstraints); 313 downSourceRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_downSourceRoot")); 314 315 gridBagConstraints = new java.awt.GridBagConstraints (); 316 gridBagConstraints.gridx = 0; 317 gridBagConstraints.gridy = 2; 318 gridBagConstraints.gridwidth = 3; 319 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 320 gridBagConstraints.weightx = 1.0; 321 gridBagConstraints.weighty = 0.45; 322 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 323 add(sourceRootsPanel, gridBagConstraints); 324 325 testRootsPanel.setLayout(new java.awt.GridBagLayout ()); 326 327 jLabel3.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_TestRoots").charAt(0)); 328 jLabel3.setLabelFor(testRoots); 329 jLabel3.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_TestRoots")); 330 gridBagConstraints = new java.awt.GridBagConstraints (); 331 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 332 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 333 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 334 gridBagConstraints.weightx = 1.0; 335 gridBagConstraints.insets = new java.awt.Insets (0, 0, 6, 0); 336 testRootsPanel.add(jLabel3, gridBagConstraints); 337 338 testRoots.setModel(new javax.swing.table.DefaultTableModel ( 339 new Object [][] { 340 {null, null}, 341 {null, null}, 342 {null, null}, 343 {null, null} 344 }, 345 new String [] { 346 "Package Folder", "Label" 347 } 348 ) { 349 Class [] types = new Class [] { 350 java.lang.Object .class, java.lang.String .class 351 }; 352 boolean[] canEdit = new boolean [] { 353 false, false 354 }; 355 356 public Class getColumnClass(int columnIndex) { 357 return types [columnIndex]; 358 } 359 360 public boolean isCellEditable(int rowIndex, int columnIndex) { 361 return canEdit [columnIndex]; 362 } 363 }); 364 jScrollPane2.setViewportView(testRoots); 365 testRoots.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_testRoots")); 366 367 gridBagConstraints = new java.awt.GridBagConstraints (); 368 gridBagConstraints.gridx = 0; 369 gridBagConstraints.gridy = 1; 370 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 371 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 372 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 373 gridBagConstraints.weightx = 1.0; 374 gridBagConstraints.weighty = 1.0; 375 testRootsPanel.add(jScrollPane2, gridBagConstraints); 376 377 addTestRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_AddTestRoot").charAt(0)); 378 addTestRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_AddTestRoot")); 379 gridBagConstraints = new java.awt.GridBagConstraints (); 380 gridBagConstraints.gridx = 1; 381 gridBagConstraints.gridy = 1; 382 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 383 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 384 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 385 gridBagConstraints.insets = new java.awt.Insets (0, 12, 6, 0); 386 testRootsPanel.add(addTestRoot, gridBagConstraints); 387 addTestRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_addTestRoot")); 388 389 removeTestRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_RemoveTestRoot").charAt(0)); 390 removeTestRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_RemoveTestRoot")); 391 gridBagConstraints = new java.awt.GridBagConstraints (); 392 gridBagConstraints.gridx = 1; 393 gridBagConstraints.gridy = 2; 394 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 395 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 396 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 397 gridBagConstraints.insets = new java.awt.Insets (0, 12, 12, 0); 398 testRootsPanel.add(removeTestRoot, gridBagConstraints); 399 removeTestRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_removeTestRoot")); 400 401 upTestRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_UpTestRoot").charAt(0)); 402 upTestRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_UpTestRoot")); 403 gridBagConstraints = new java.awt.GridBagConstraints (); 404 gridBagConstraints.gridx = 1; 405 gridBagConstraints.gridy = 3; 406 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 407 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 408 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 409 gridBagConstraints.insets = new java.awt.Insets (0, 12, 6, 0); 410 testRootsPanel.add(upTestRoot, gridBagConstraints); 411 upTestRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_upTestRoot")); 412 413 downTestRoot.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_DownTestRoot").charAt(0)); 414 downTestRoot.setText(NbBundle.getMessage(CustomizerSources.class, "CTL_DownTestRoot")); 415 gridBagConstraints = new java.awt.GridBagConstraints (); 416 gridBagConstraints.gridx = 1; 417 gridBagConstraints.gridy = 4; 418 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 419 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 420 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 421 gridBagConstraints.insets = new java.awt.Insets (0, 12, 0, 0); 422 testRootsPanel.add(downTestRoot, gridBagConstraints); 423 downTestRoot.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "AD_CustomizerSources_downTestRoot")); 424 425 gridBagConstraints = new java.awt.GridBagConstraints (); 426 gridBagConstraints.gridx = 0; 427 gridBagConstraints.gridy = 3; 428 gridBagConstraints.gridwidth = 3; 429 gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; 430 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 431 gridBagConstraints.weightx = 1.0; 432 gridBagConstraints.weighty = 0.45; 433 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 434 add(testRootsPanel, gridBagConstraints); 435 436 jLabelSourceLevel.setDisplayedMnemonic(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "MNE_SourceLevel").charAt(0)); 437 jLabelSourceLevel.setLabelFor(jComboBoxSourceLevel); 438 jLabelSourceLevel.setText(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "TXT_SourceLevel")); 439 gridBagConstraints = new java.awt.GridBagConstraints (); 440 gridBagConstraints.gridx = 0; 441 gridBagConstraints.gridy = 4; 442 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 443 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 444 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 12); 445 add(jLabelSourceLevel, gridBagConstraints); 446 447 gridBagConstraints = new java.awt.GridBagConstraints (); 448 gridBagConstraints.gridx = 1; 449 gridBagConstraints.gridy = 4; 450 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 451 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 452 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 453 gridBagConstraints.insets = new java.awt.Insets (12, 0, 0, 0); 454 add(jComboBoxSourceLevel, gridBagConstraints); 455 jComboBoxSourceLevel.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "AN_SourceLevel")); 456 jComboBoxSourceLevel.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "AD_SourceLevel")); 457 458 } 459 461 private void jButtonBrowseActionPerformed(java.awt.event.ActionEvent evt) { JFileChooser chooser = new JFileChooser (); 463 FileUtil.preventFileChooserSymlinkTraversal(chooser, null); 464 chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); 465 File fileName = new File (jTextFieldWebPages.getText()); 466 File webPages = fileName.isAbsolute() ? fileName : new File (projectFld, fileName.getPath()); 467 if (webPages.exists()) { 468 chooser.setSelectedFile(webPages); 469 } else { 470 chooser.setSelectedFile(projectFld); 471 } 472 if ( JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) { 473 File selected = FileUtil.normalizeFile(chooser.getSelectedFile()); 474 String newWebPages; 475 if (CollocationQuery.areCollocated(projectFld, selected)) { 476 newWebPages = PropertyUtils.relativizeFile(projectFld, selected); 477 } else { 478 newWebPages = selected.getPath(); 479 } 480 jTextFieldWebPages.setText(newWebPages); 481 } 482 } 484 485 private javax.swing.JButton addSourceRoot; 487 private javax.swing.JButton addTestRoot; 488 private javax.swing.JButton downSourceRoot; 489 private javax.swing.JButton downTestRoot; 490 private javax.swing.JButton jButtonBrowse; 491 private javax.swing.JComboBox jComboBoxSourceLevel; 492 private javax.swing.JLabel jLabel1; 493 private javax.swing.JLabel jLabel2; 494 private javax.swing.JLabel jLabel3; 495 private javax.swing.JLabel jLabelSourceLevel; 496 private javax.swing.JLabel jLabelWebPages; 497 private javax.swing.JScrollPane jScrollPane1; 498 private javax.swing.JScrollPane jScrollPane2; 499 private javax.swing.JTextField jTextFieldWebPages; 500 private javax.swing.JTextField projectLocation; 501 private javax.swing.JButton removeSourceRoot; 502 private javax.swing.JButton removeTestRoot; 503 private javax.swing.JTable sourceRoots; 504 private javax.swing.JPanel sourceRootsPanel; 505 private javax.swing.JTable testRoots; 506 private javax.swing.JPanel testRootsPanel; 507 private javax.swing.JButton upSourceRoot; 508 private javax.swing.JButton upTestRoot; 509 511 } 512 | Popular Tags |