KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > ejbjarproject > ui > customizer > CustomizerSources


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.ejbjarproject.ui.customizer;
21
22 import java.io.File JavaDoc;
23 import javax.swing.JFileChooser JavaDoc;
24 import javax.swing.event.ListDataEvent JavaDoc;
25 import javax.swing.event.ListDataListener JavaDoc;
26 import org.netbeans.api.queries.CollocationQuery;
27 import org.openide.filesystems.FileObject;
28 import org.openide.filesystems.FileUtil;
29 import org.openide.util.HelpCtx;
30 import org.openide.util.NbBundle;
31 import org.netbeans.modules.j2ee.ejbjarproject.EjbJarProject;
32 import org.netbeans.spi.project.support.ant.PropertyUtils;
33
34 /**
35  *
36  * @author Tomas Zezula
37  */

38 public class CustomizerSources extends javax.swing.JPanel JavaDoc implements HelpCtx.Provider {
39     
40     private File JavaDoc projectFld;
41     
42     public CustomizerSources( EjbJarProjectProperties uiProperties ) {
43         initComponents();
44         jScrollPane1.getViewport().setBackground( sourceRoots.getBackground() );
45         jScrollPane2.getViewport().setBackground( testRoots.getBackground() );
46         
47         sourceRoots.setModel( uiProperties.SOURCE_ROOTS_MODEL );
48         testRoots.setModel( uiProperties.TEST_ROOTS_MODEL );
49         sourceRoots.getTableHeader().setReorderingAllowed(false);
50         testRoots.getTableHeader().setReorderingAllowed(false);
51         
52         FileObject projectFolder = uiProperties.getProject().getProjectDirectory();
53         File JavaDoc pf = FileUtil.toFile( projectFolder );
54         this.projectLocation.setText( pf == null ? "" : pf.getPath() ); // NOI18N
55
this.projectFld = pf;
56         
57         jTextFieldConfigFilesFolder.setDocument(uiProperties.META_INF_MODEL);
58         
59         EjbJarSourceRootsUi.EditMediator emSR = EjbJarSourceRootsUi.registerEditMediator(
60             (EjbJarProject)uiProperties.getProject(),
61             ((EjbJarProject)uiProperties.getProject()).getSourceRoots(),
62             sourceRoots,
63             addSourceRoot,
64             removeSourceRoot,
65             upSourceRoot,
66             downSourceRoot);
67         
68         EjbJarSourceRootsUi.EditMediator emTSR = EjbJarSourceRootsUi.registerEditMediator(
69             (EjbJarProject)uiProperties.getProject(),
70             ((EjbJarProject)uiProperties.getProject()).getTestSourceRoots(),
71             testRoots,
72             addTestRoot,
73             removeTestRoot,
74             upTestRoot,
75             downTestRoot);
76         
77         emSR.setRelatedEditMediator( emTSR );
78         emTSR.setRelatedEditMediator( emSR );
79         this.sourceLevel.setModel(uiProperties.JAVAC_SOURCE_MODEL);
80         uiProperties.JAVAC_SOURCE_MODEL.addListDataListener(new ListDataListener JavaDoc () {
81             public void intervalAdded(ListDataEvent JavaDoc e) {
82                 enableSourceLevel ();
83             }
84
85             public void intervalRemoved(ListDataEvent JavaDoc e) {
86                 enableSourceLevel ();
87             }
88
89             public void contentsChanged(ListDataEvent JavaDoc e) {
90                 enableSourceLevel ();
91             }
92         });
93         enableSourceLevel ();
94     }
95
96     public HelpCtx getHelpCtx() {
97         return new HelpCtx (CustomizerSources.class);
98     }
99     
100     private void enableSourceLevel () {
101         this.sourceLevel.setEnabled(sourceLevel.getItemCount()>0);
102     }
103     
104     /** This method is called from within the constructor to
105      * initialize the form.
106      * WARNING: Do NOT modify this code. The content of this method is
107      * always regenerated by the Form Editor.
108      */

109     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
110
private void initComponents() {
111         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
112
113         jLabel1 = new javax.swing.JLabel JavaDoc();
114         projectLocation = new javax.swing.JTextField JavaDoc();
115         jLabelConfigFilesFolder = new javax.swing.JLabel JavaDoc();
116         jTextFieldConfigFilesFolder = new javax.swing.JTextField JavaDoc();
117         jButtonBrowse = new javax.swing.JButton JavaDoc();
118         sourceRootsPanel = new javax.swing.JPanel JavaDoc();
119         jLabel2 = new javax.swing.JLabel JavaDoc();
120         jScrollPane1 = new javax.swing.JScrollPane JavaDoc();
121         sourceRoots = new javax.swing.JTable JavaDoc();
122         addSourceRoot = new javax.swing.JButton JavaDoc();
123         removeSourceRoot = new javax.swing.JButton JavaDoc();
124         upSourceRoot = new javax.swing.JButton JavaDoc();
125         downSourceRoot = new javax.swing.JButton JavaDoc();
126         testRootsPanel = new javax.swing.JPanel JavaDoc();
127         jLabel3 = new javax.swing.JLabel JavaDoc();
128         jScrollPane2 = new javax.swing.JScrollPane JavaDoc();
129         testRoots = new javax.swing.JTable JavaDoc();
130         addTestRoot = new javax.swing.JButton JavaDoc();
131         removeTestRoot = new javax.swing.JButton JavaDoc();
132         upTestRoot = new javax.swing.JButton JavaDoc();
133         downTestRoot = new javax.swing.JButton JavaDoc();
134         jPanel1 = new javax.swing.JPanel JavaDoc();
135         jLabel4 = new javax.swing.JLabel JavaDoc();
136         sourceLevel = new javax.swing.JComboBox JavaDoc();
137         jPanel2 = new javax.swing.JPanel JavaDoc();
138
139         setLayout(new java.awt.GridBagLayout JavaDoc());
140
141         jLabel1.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_ProjectFolder").charAt(0));
142         jLabel1.setLabelFor(projectLocation);
143         jLabel1.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_ProjectFolder"));
144         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
145         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
146         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 12, 12);
147         add(jLabel1, gridBagConstraints);
148
149         projectLocation.setEditable(false);
150         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
151         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
152         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
153         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
154         gridBagConstraints.weightx = 1.0;
155         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 12, 0);
156         add(projectLocation, gridBagConstraints);
157
158         jLabelConfigFilesFolder.setDisplayedMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_ConfigFilesFolder").charAt(0));
159         jLabelConfigFilesFolder.setLabelFor(jTextFieldConfigFilesFolder);
160         jLabelConfigFilesFolder.setText(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "CTL_ConfigFilesFolder"));
161         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
162         gridBagConstraints.gridx = 0;
163         gridBagConstraints.gridy = 1;
164         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
165         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
166         add(jLabelConfigFilesFolder, gridBagConstraints);
167
168         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
169         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
170         gridBagConstraints.weightx = 1.0;
171         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
172         add(jTextFieldConfigFilesFolder, gridBagConstraints);
173         jTextFieldConfigFilesFolder.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "ACSD_CustomizerSources_ConfigFilesFolder"));
174
175         jButtonBrowse.setMnemonic(NbBundle.getMessage(CustomizerSources.class, "MNE_ConfigFilesFolderBrowse").charAt(0));
176         jButtonBrowse.setText(org.openide.util.NbBundle.getMessage(CustomizerSources.class, "LBL_Browse_JButton"));
177         jButtonBrowse.addActionListener(new java.awt.event.ActionListener JavaDoc() {
178             public void actionPerformed(java.awt.event.ActionEvent JavaDoc evt) {
179                 jButtonBrowseActionPerformed(evt);
180             }
181         });
182
183         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
184         gridBagConstraints.gridx = 2;
185         gridBagConstraints.gridy = 1;
186         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
187         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
188         add(jButtonBrowse, gridBagConstraints);
189         jButtonBrowse.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerSources.class, "ACSD_CustomizerSources_ConfigFilesFolderBrowse"));
190
191         sourceRootsPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
192
193         jLabel2.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_SourceRoots").charAt(0));
194         jLabel2.setLabelFor(sourceRoots);
195         jLabel2.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_SourceRoots"));
196         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
197         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
198         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
199         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
200         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
201         sourceRootsPanel.add(jLabel2, gridBagConstraints);
202
203         sourceRoots.setModel(new javax.swing.table.DefaultTableModel JavaDoc(
204             new Object JavaDoc [][] {
205                 {null, null},
206                 {null, null},
207                 {null, null},
208                 {null, null}
209             },
210             new String JavaDoc [] {
211                 "Package Folder", "Label"
212             }
213         ) {
214             Class JavaDoc[] types = new Class JavaDoc [] {
215                 java.lang.Object JavaDoc.class, java.lang.String JavaDoc.class
216             };
217             boolean[] canEdit = new boolean [] {
218                 false, false
219             };
220
221             public Class JavaDoc getColumnClass(int columnIndex) {
222                 return types [columnIndex];
223             }
224
225             public boolean isCellEditable(int rowIndex, int columnIndex) {
226                 return canEdit [columnIndex];
227             }
228         });
229         jScrollPane1.setViewportView(sourceRoots);
230
231         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
232         gridBagConstraints.gridx = 0;
233         gridBagConstraints.gridy = 1;
234         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
235         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
236         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
237         gridBagConstraints.weightx = 1.0;
238         gridBagConstraints.weighty = 1.0;
239         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
240         sourceRootsPanel.add(jScrollPane1, gridBagConstraints);
241
242         addSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_AddSourceRoot").charAt(0));
243         addSourceRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_AddSourceRoot"));
244         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
245         gridBagConstraints.gridx = 1;
246         gridBagConstraints.gridy = 1;
247         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
248         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
249         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
250         sourceRootsPanel.add(addSourceRoot, gridBagConstraints);
251
252         removeSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_RemoveSourceRoot").charAt(0));
253         removeSourceRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_RemoveSourceRoot"));
254         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
255         gridBagConstraints.gridx = 1;
256         gridBagConstraints.gridy = 2;
257         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
258         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
259         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
260         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 0);
261         sourceRootsPanel.add(removeSourceRoot, gridBagConstraints);
262
263         upSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_UpSourceRoot").charAt(0));
264         upSourceRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_UpSourceRoot"));
265         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
266         gridBagConstraints.gridx = 1;
267         gridBagConstraints.gridy = 3;
268         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
269         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
270         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
271         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
272         sourceRootsPanel.add(upSourceRoot, gridBagConstraints);
273
274         downSourceRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_DownSourceRoot").charAt(0));
275         downSourceRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_DownSourceRoot"));
276         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
277         gridBagConstraints.gridx = 1;
278         gridBagConstraints.gridy = 4;
279         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
280         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
281         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
282         gridBagConstraints.insets = new java.awt.Insets JavaDoc(6, 0, 0, 0);
283         sourceRootsPanel.add(downSourceRoot, gridBagConstraints);
284
285         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
286         gridBagConstraints.gridx = 0;
287         gridBagConstraints.gridy = 2;
288         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
289         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
290         gridBagConstraints.weightx = 1.0;
291         gridBagConstraints.weighty = 0.45;
292         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
293         add(sourceRootsPanel, gridBagConstraints);
294
295         testRootsPanel.setLayout(new java.awt.GridBagLayout JavaDoc());
296
297         jLabel3.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_TestRoots").charAt(0));
298         jLabel3.setLabelFor(testRoots);
299         jLabel3.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_TestRoots"));
300         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
301         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
302         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
303         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
304         gridBagConstraints.weightx = 1.0;
305         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
306         testRootsPanel.add(jLabel3, gridBagConstraints);
307
308         testRoots.setModel(new javax.swing.table.DefaultTableModel JavaDoc(
309             new Object JavaDoc [][] {
310                 {null, null},
311                 {null, null},
312                 {null, null},
313                 {null, null}
314             },
315             new String JavaDoc [] {
316                 "Package Folder", "Label"
317             }
318         ) {
319             Class JavaDoc[] types = new Class JavaDoc [] {
320                 java.lang.Object JavaDoc.class, java.lang.String JavaDoc.class
321             };
322             boolean[] canEdit = new boolean [] {
323                 false, false
324             };
325
326             public Class JavaDoc getColumnClass(int columnIndex) {
327                 return types [columnIndex];
328             }
329
330             public boolean isCellEditable(int rowIndex, int columnIndex) {
331                 return canEdit [columnIndex];
332             }
333         });
334         jScrollPane2.setViewportView(testRoots);
335
336         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
337         gridBagConstraints.gridx = 0;
338         gridBagConstraints.gridy = 1;
339         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
340         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
341         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
342         gridBagConstraints.weightx = 1.0;
343         gridBagConstraints.weighty = 1.0;
344         testRootsPanel.add(jScrollPane2, gridBagConstraints);
345
346         addTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_AddTestRoot").charAt(0));
347         addTestRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_AddTestRoot"));
348         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
349         gridBagConstraints.gridx = 1;
350         gridBagConstraints.gridy = 1;
351         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
352         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
353         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
354         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 6, 0);
355         testRootsPanel.add(addTestRoot, gridBagConstraints);
356
357         removeTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_RemoveTestRoot").charAt(0));
358         removeTestRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_RemoveTestRoot"));
359         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
360         gridBagConstraints.gridx = 1;
361         gridBagConstraints.gridy = 2;
362         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
363         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
364         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
365         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 12, 0);
366         testRootsPanel.add(removeTestRoot, gridBagConstraints);
367
368         upTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_UpTestRoot").charAt(0));
369         upTestRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_UpTestRoot"));
370         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
371         gridBagConstraints.gridx = 1;
372         gridBagConstraints.gridy = 3;
373         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
374         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
375         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
376         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 6, 0);
377         testRootsPanel.add(upTestRoot, gridBagConstraints);
378
379         downTestRoot.setMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_DownTestRoot").charAt(0));
380         downTestRoot.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("CTL_DownTestRoot"));
381         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
382         gridBagConstraints.gridx = 1;
383         gridBagConstraints.gridy = 4;
384         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
385         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
386         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
387         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 12, 0, 0);
388         testRootsPanel.add(downTestRoot, gridBagConstraints);
389
390         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
391         gridBagConstraints.gridx = 0;
392         gridBagConstraints.gridy = 3;
393         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
394         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
395         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
396         gridBagConstraints.weightx = 1.0;
397         gridBagConstraints.weighty = 0.45;
398         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
399         add(testRootsPanel, gridBagConstraints);
400
401         jPanel1.setLayout(new java.awt.GridBagLayout JavaDoc());
402
403         jLabel4.setDisplayedMnemonic(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("MNE_SourceLevel").charAt(0));
404         jLabel4.setLabelFor(sourceLevel);
405         jLabel4.setText(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("TXT_SourceLevel"));
406         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
407         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
408         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
409         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 0, 12);
410         jPanel1.add(jLabel4, gridBagConstraints);
411
412         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
413         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
414         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
415         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
416         gridBagConstraints.weightx = 0.75;
417         jPanel1.add(sourceLevel, gridBagConstraints);
418         sourceLevel.getAccessibleContext().setAccessibleName(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("AN_SourceLevel"));
419         sourceLevel.getAccessibleContext().setAccessibleDescription(java.util.ResourceBundle.getBundle("org/netbeans/modules/j2ee/ejbjarproject/ui/customizer/Bundle").getString("AD_SourceLevel"));
420
421         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
422         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
423         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
424         gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
425         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
426         gridBagConstraints.weightx = 1.0;
427         jPanel1.add(jPanel2, gridBagConstraints);
428
429         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
430         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
431         gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
432         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
433         gridBagConstraints.weightx = 1.0;
434         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 0, 0, 0);
435         add(jPanel1, gridBagConstraints);
436
437     }
438     // </editor-fold>//GEN-END:initComponents
439

440     private void jButtonBrowseActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jButtonBrowseActionPerformed
441
JFileChooser JavaDoc chooser = new JFileChooser JavaDoc();
442         FileUtil.preventFileChooserSymlinkTraversal(chooser, null);
443         chooser.setFileSelectionMode (JFileChooser.DIRECTORIES_ONLY);
444         File JavaDoc fileName = new File JavaDoc(jTextFieldConfigFilesFolder.getText());
445         File JavaDoc configFiles = fileName.isAbsolute() ? fileName : new File JavaDoc(projectFld, fileName.getPath());
446         if (configFiles.isAbsolute()) {
447             chooser.setSelectedFile(configFiles);
448         } else {
449             chooser.setSelectedFile(projectFld);
450         }
451         if ( JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(this)) {
452             File JavaDoc selected = FileUtil.normalizeFile(chooser.getSelectedFile());
453             String JavaDoc newConfigFiles;
454             if (CollocationQuery.areCollocated(projectFld, selected)) {
455                 newConfigFiles = PropertyUtils.relativizeFile(projectFld, selected);
456             } else {
457                 newConfigFiles = selected.getPath();
458             }
459             jTextFieldConfigFilesFolder.setText(newConfigFiles);
460         }
461     }//GEN-LAST:event_jButtonBrowseActionPerformed
462

463     
464     // Variables declaration - do not modify//GEN-BEGIN:variables
465
private javax.swing.JButton JavaDoc addSourceRoot;
466     private javax.swing.JButton JavaDoc addTestRoot;
467     private javax.swing.JButton JavaDoc downSourceRoot;
468     private javax.swing.JButton JavaDoc downTestRoot;
469     private javax.swing.JButton JavaDoc jButtonBrowse;
470     private javax.swing.JLabel JavaDoc jLabel1;
471     private javax.swing.JLabel JavaDoc jLabel2;
472     private javax.swing.JLabel JavaDoc jLabel3;
473     private javax.swing.JLabel JavaDoc jLabel4;
474     private javax.swing.JLabel JavaDoc jLabelConfigFilesFolder;
475     private javax.swing.JPanel JavaDoc jPanel1;
476     private javax.swing.JPanel JavaDoc jPanel2;
477     private javax.swing.JScrollPane JavaDoc jScrollPane1;
478     private javax.swing.JScrollPane JavaDoc jScrollPane2;
479     private javax.swing.JTextField JavaDoc jTextFieldConfigFilesFolder;
480     private javax.swing.JTextField JavaDoc projectLocation;
481     private javax.swing.JButton JavaDoc removeSourceRoot;
482     private javax.swing.JButton JavaDoc removeTestRoot;
483     private javax.swing.JComboBox JavaDoc sourceLevel;
484     private javax.swing.JTable JavaDoc sourceRoots;
485     private javax.swing.JPanel JavaDoc sourceRootsPanel;
486     private javax.swing.JTable JavaDoc testRoots;
487     private javax.swing.JPanel JavaDoc testRootsPanel;
488     private javax.swing.JButton JavaDoc upSourceRoot;
489     private javax.swing.JButton JavaDoc upTestRoot;
490     // End of variables declaration//GEN-END:variables
491

492 }
493
Popular Tags