This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 43101
Collapse All | Expand All

(-)src/org/netbeans/modules/java/j2seproject/J2SEProjectUtil.java (-1 / +18 lines)
Lines 23-29 Link Here
23
public class J2SEProjectUtil {
23
public class J2SEProjectUtil {
24
    private J2SEProjectUtil () {}
24
    private J2SEProjectUtil () {}
25
    
25
    
26
    /** Returns the J2SEProject source' directory.
26
    /** Returns the J2SEProject sources directory.
27
     *
27
     *
28
     * @param p project (assumed J2SEProject)
28
     * @param p project (assumed J2SEProject)
29
     * @return source directory or null if not set or a wrong type of project
29
     * @return source directory or null if not set or a wrong type of project
Lines 32-37 Link Here
32
        if (p instanceof J2SEProject) {
32
        if (p instanceof J2SEProject) {
33
            J2SEProject j2se = (J2SEProject) p;
33
            J2SEProject j2se = (J2SEProject) p;
34
            return j2se.getSourceDirectory ();
34
            return j2se.getSourceDirectory ();
35
        } else {
36
            // support only J2SEProject, better throw IAE
37
            return null;
38
        }
39
    }
40
    
41
    /** Returns the property value evaluated by J2SEProject's PropertyEvaluator.
42
     *
43
     * @param p project (assumed J2SEProject)
44
     * @param property name of property
45
     * @return evaluated value of given property or null if property not set or
46
     * if a wrong type of project
47
     */    
48
    final public static String getEvaluatedProperty (Project p, String property) {
49
        if (p instanceof J2SEProject) {
50
            J2SEProject j2se = (J2SEProject) p;
51
            return j2se.evaluator ().getProperty (property);
35
        } else {
52
        } else {
36
            // support only J2SEProject, better throw IAE
53
            // support only J2SEProject, better throw IAE
37
            return null;
54
            return null;
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties (-3 / +2 lines)
Lines 57-65 Link Here
57
57
58
58
59
#Customize jar creation
59
#Customize jar creation
60
LBL_CustomizeJar_DistDir_JTextField=Distribution Directory:
60
LBL_CustomizeJar_DistDir_JTextField=JAR File:
61
LBL_CustomizeJar_BrowseDistDir_JButton=Browse...
61
LBL_CustomizeJar_Excludes_JTextField=Exclude From JAR:
62
LBL_CustomizeJar_Excludes_JTextField=Exclude From Distribution:
63
LBL_CustomizeJar_Commpres_JCheckBox=Compress JAR
62
LBL_CustomizeJar_Commpres_JCheckBox=Compress JAR
64
63
65
# Customize javadoc creation
64
# Customize javadoc creation
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerJar.form (-18 / +5 lines)
Lines 25-48 Link Here
25
    </Component>
25
    </Component>
26
    <Component class="javax.swing.JTextField" name="jTextFieldDistDir">
26
    <Component class="javax.swing.JTextField" name="jTextFieldDistDir">
27
      <Properties>
27
      <Properties>
28
        <Property name="enabled" type="boolean" value="false"/>
28
        <Property name="editable" type="boolean" value="false"/>
29
      </Properties>
29
      </Properties>
30
      <Constraints>
30
      <Constraints>
31
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
31
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
32
          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="12" insetsRight="12" anchor="10" weightX="1.0" weightY="0.0"/>
32
          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="12" insetsRight="12" anchor="10" weightX="1.0" weightY="0.0"/>
33
        </Constraint>
34
      </Constraints>
35
    </Component>
36
    <Component class="javax.swing.JButton" name="jButtonDistDir">
37
      <Properties>
38
        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
39
          <ResourceString bundle="org/netbeans/modules/java/j2seproject/ui/customizer/Bundle.properties" key="LBL_CustomizeJar_BrowseDistDir_JButton" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
40
        </Property>
41
        <Property name="enabled" type="boolean" value="false"/>
42
      </Properties>
43
      <Constraints>
44
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
45
          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="0" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="0" insetsRight="12" anchor="10" weightX="0.0" weightY="0.0"/>
46
        </Constraint>
33
        </Constraint>
47
      </Constraints>
34
      </Constraints>
48
    </Component>
35
    </Component>
Lines 54-67 Link Here
54
      </Properties>
41
      </Properties>
55
      <Constraints>
42
      <Constraints>
56
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
43
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
57
          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="12" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
44
          <GridBagConstraints gridX="0" gridY="1" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="18" weightX="0.0" weightY="0.0"/>
58
        </Constraint>
45
        </Constraint>
59
      </Constraints>
46
      </Constraints>
60
    </Component>
47
    </Component>
61
    <Component class="javax.swing.JTextField" name="jTextFieldExcludes">
48
    <Component class="javax.swing.JTextField" name="jTextFieldExcludes">
62
      <Constraints>
49
      <Constraints>
63
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
50
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
64
          <GridBagConstraints gridX="-1" gridY="-1" gridWidth="1" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="0" insetsBottom="12" insetsRight="12" anchor="10" weightX="1.0" weightY="0.0"/>
51
          <GridBagConstraints gridX="1" gridY="1" gridWidth="0" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="12" anchor="10" weightX="1.0" weightY="0.0"/>
65
        </Constraint>
52
        </Constraint>
66
      </Constraints>
53
      </Constraints>
67
    </Component>
54
    </Component>
Lines 73-79 Link Here
73
      </Properties>
60
      </Properties>
74
      <Constraints>
61
      <Constraints>
75
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
62
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
76
          <GridBagConstraints gridX="0" gridY="2" gridWidth="0" gridHeight="0" fill="0" ipadX="0" ipadY="0" insetsTop="12" insetsLeft="12" insetsBottom="12" insetsRight="12" anchor="18" weightX="0.0" weightY="1.0"/>
63
          <GridBagConstraints gridX="0" gridY="2" gridWidth="0" gridHeight="0" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="12" insetsBottom="0" insetsRight="12" anchor="18" weightX="0.0" weightY="1.0"/>
77
        </Constraint>
64
        </Constraint>
78
      </Constraints>
65
      </Constraints>
79
    </Component>
66
    </Component>
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/CustomizerJar.java (-21 / +13 lines)
Lines 26-31 Link Here
26
import javax.swing.event.ListDataEvent;
26
import javax.swing.event.ListDataEvent;
27
import javax.swing.event.ListDataListener;
27
import javax.swing.event.ListDataListener;
28
import org.netbeans.api.project.ant.AntArtifact;
28
import org.netbeans.api.project.ant.AntArtifact;
29
import org.netbeans.modules.java.j2seproject.J2SEProjectUtil;
29
import org.netbeans.spi.project.support.ant.AntProjectHelper;
30
import org.netbeans.spi.project.support.ant.AntProjectHelper;
30
import org.netbeans.spi.project.support.ant.PropertyUtils;
31
import org.netbeans.spi.project.support.ant.PropertyUtils;
31
import org.openide.DialogDisplayer;
32
import org.openide.DialogDisplayer;
Lines 46-62 Link Here
46
        vps = new VisualPropertySupport( j2seProperties );
47
        vps = new VisualPropertySupport( j2seProperties );
47
    }
48
    }
48
    
49
    
49
    
50
    public void initValues() {
50
    public void initValues() {
51
        
51
        
52
        vps.register( jTextFieldDistDir, J2SEProjectProperties.DIST_DIR );
52
        vps.register( jTextFieldDistDir, J2SEProjectProperties.DIST_JAR );
53
        vps.register( jTextFieldExcludes, J2SEProjectProperties.BUILD_CLASSES_EXCLUDES );
53
        vps.register( jTextFieldExcludes, J2SEProjectProperties.BUILD_CLASSES_EXCLUDES );
54
        vps.register( jCheckBoxCommpress, J2SEProjectProperties.JAR_COMPRESS ); 
54
        vps.register( jCheckBoxCommpress, J2SEProjectProperties.JAR_COMPRESS ); 
55
        
56
        // XXX Temporarily removing some controls
57
        remove( jLabelDistDir );
58
        remove( jTextFieldDistDir );
59
        remove( jButtonDistDir );
60
    } 
55
    } 
61
        
56
        
62
    
57
    
Lines 70-76 Link Here
70
65
71
        jLabelDistDir = new javax.swing.JLabel();
66
        jLabelDistDir = new javax.swing.JLabel();
72
        jTextFieldDistDir = new javax.swing.JTextField();
67
        jTextFieldDistDir = new javax.swing.JTextField();
73
        jButtonDistDir = new javax.swing.JButton();
74
        jLabel2 = new javax.swing.JLabel();
68
        jLabel2 = new javax.swing.JLabel();
75
        jTextFieldExcludes = new javax.swing.JTextField();
69
        jTextFieldExcludes = new javax.swing.JTextField();
76
        jCheckBoxCommpress = new javax.swing.JCheckBox();
70
        jCheckBoxCommpress = new javax.swing.JCheckBox();
Lines 84-113 Link Here
84
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 12);
78
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 12);
85
        add(jLabelDistDir, gridBagConstraints);
79
        add(jLabelDistDir, gridBagConstraints);
86
80
87
        jTextFieldDistDir.setEnabled(false);
81
        jTextFieldDistDir.setEditable(false);
88
        gridBagConstraints = new java.awt.GridBagConstraints();
82
        gridBagConstraints = new java.awt.GridBagConstraints();
83
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
89
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
84
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
90
        gridBagConstraints.weightx = 1.0;
91
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 12, 12);
85
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 12, 12);
86
        gridBagConstraints.weightx = 1.0;
92
        add(jTextFieldDistDir, gridBagConstraints);
87
        add(jTextFieldDistDir, gridBagConstraints);
93
88
94
        jButtonDistDir.setText(org.openide.util.NbBundle.getMessage(CustomizerJar.class, "LBL_CustomizeJar_BrowseDistDir_JButton"));
95
        jButtonDistDir.setEnabled(false);
96
        gridBagConstraints = new java.awt.GridBagConstraints();
97
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
98
        gridBagConstraints.insets = new java.awt.Insets(0, 6, 0, 12);
99
        add(jButtonDistDir, gridBagConstraints);
100
101
        jLabel2.setText(org.openide.util.NbBundle.getMessage(CustomizerJar.class, "LBL_CustomizeJar_Excludes_JTextField"));
89
        jLabel2.setText(org.openide.util.NbBundle.getMessage(CustomizerJar.class, "LBL_CustomizeJar_Excludes_JTextField"));
102
        gridBagConstraints = new java.awt.GridBagConstraints();
90
        gridBagConstraints = new java.awt.GridBagConstraints();
91
        gridBagConstraints.gridx = 0;
92
        gridBagConstraints.gridy = 1;
93
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12);
103
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
94
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
104
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 12);
105
        add(jLabel2, gridBagConstraints);
95
        add(jLabel2, gridBagConstraints);
106
96
107
        gridBagConstraints = new java.awt.GridBagConstraints();
97
        gridBagConstraints = new java.awt.GridBagConstraints();
98
        gridBagConstraints.gridx = 1;
99
        gridBagConstraints.gridy = 1;
100
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
108
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
101
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
102
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 12);
109
        gridBagConstraints.weightx = 1.0;
103
        gridBagConstraints.weightx = 1.0;
110
        gridBagConstraints.insets = new java.awt.Insets(12, 0, 12, 12);
111
        add(jTextFieldExcludes, gridBagConstraints);
104
        add(jTextFieldExcludes, gridBagConstraints);
112
105
113
        jCheckBoxCommpress.setText(org.openide.util.NbBundle.getMessage(CustomizerJar.class, "LBL_CustomizeJar_Commpres_JCheckBox"));
106
        jCheckBoxCommpress.setText(org.openide.util.NbBundle.getMessage(CustomizerJar.class, "LBL_CustomizeJar_Commpres_JCheckBox"));
Lines 116-131 Link Here
116
        gridBagConstraints.gridy = 2;
109
        gridBagConstraints.gridy = 2;
117
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
110
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
118
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
111
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
112
        gridBagConstraints.insets = new java.awt.Insets(0, 12, 0, 12);
119
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
113
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
120
        gridBagConstraints.weighty = 1.0;
114
        gridBagConstraints.weighty = 1.0;
121
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 12, 12);
122
        add(jCheckBoxCommpress, gridBagConstraints);
115
        add(jCheckBoxCommpress, gridBagConstraints);
123
116
124
    }//GEN-END:initComponents
117
    }//GEN-END:initComponents
125
    
118
    
126
    
119
    
127
    // Variables declaration - do not modify//GEN-BEGIN:variables
120
    // Variables declaration - do not modify//GEN-BEGIN:variables
128
    private javax.swing.JButton jButtonDistDir;
129
    private javax.swing.JCheckBox jCheckBoxCommpress;
121
    private javax.swing.JCheckBox jCheckBoxCommpress;
130
    private javax.swing.JLabel jLabel2;
122
    private javax.swing.JLabel jLabel2;
131
    private javax.swing.JLabel jLabelDistDir;
123
    private javax.swing.JLabel jLabelDistDir;
(-)src/org/netbeans/modules/java/j2seproject/ui/customizer/VisualPropertySupport.java (-2 / +8 lines)
Lines 28-33 Link Here
28
import javax.swing.event.ListDataListener;
28
import javax.swing.event.ListDataListener;
29
import javax.swing.text.BadLocationException;
29
import javax.swing.text.BadLocationException;
30
import javax.swing.text.Document;
30
import javax.swing.text.Document;
31
import org.netbeans.modules.java.j2seproject.J2SEProjectUtil;
31
32
32
/** Class which makes creation of the GUI easier. Registers JComponent
33
/** Class which makes creation of the GUI easier. Registers JComponent
33
 * property names and handles reading/storing the values from the components
34
 * property names and handles reading/storing the values from the components
Lines 147-160 Link Here
147
    
148
    
148
    private Object getAsType( String propertyName, Class expectedType, boolean throwException ) {
149
    private Object getAsType( String propertyName, Class expectedType, boolean throwException ) {
149
        
150
        
150
        Object value = j2seProperties.get( propertyName );
151
        Object value;
152
        if (expectedType.equals (String.class)) {
153
            value = J2SEProjectUtil.getEvaluatedProperty (j2seProperties.getProject (), propertyName);
154
        } else {
155
            value = j2seProperties.get( propertyName );
156
        }
151
        
157
        
152
        if ( value == null || expectedType.isInstance( value ) ) {
158
        if ( value == null || expectedType.isInstance( value ) ) {
153
            return value;
159
            return value;
154
        }
160
        }
155
        else if ( throwException ) {            
161
        else if ( throwException ) {            
156
            throw new IllegalArgumentException( "Value of property: " + propertyName +        // NOI18N
162
            throw new IllegalArgumentException( "Value of property: " + propertyName +        // NOI18N
157
                                                " exbected to be: " + expectedType.getName() + // NOI18N
163
                                                " expected to be: " + expectedType.getName() + // NOI18N
158
                                                " but was: " + value.getClass().getName() + "!" );   // NOI18N
164
                                                " but was: " + value.getClass().getName() + "!" );   // NOI18N
159
        }
165
        }
160
        else {
166
        else {

Return to bug 43101