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 59240
Collapse All | Expand All

(-)a/web.project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerWar.form (-4 / +1 lines)
Lines 1-4 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.1" encoding="UTF-8" ?>
2
2
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <AuxValues>
4
  <AuxValues>
Lines 43-51 Link Here
43
          </Constraints>
43
          </Constraints>
44
        </Component>
44
        </Component>
45
        <Component class="javax.swing.JTextField" name="jTextFieldFileName">
45
        <Component class="javax.swing.JTextField" name="jTextFieldFileName">
46
          <Properties>
47
            <Property name="editable" type="boolean" value="false"/>
48
          </Properties>
49
          <AccessibilityProperties>
46
          <AccessibilityProperties>
50
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
47
            <Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
51
              <ResourceString bundle="org/netbeans/modules/web/project/ui/customizer/Bundle.properties" key="ACS_CustomizeWAR_FileName_A11YDesc" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
48
              <ResourceString bundle="org/netbeans/modules/web/project/ui/customizer/Bundle.properties" key="ACS_CustomizeWAR_FileName_A11YDesc" replaceFormat="java.util.ResourceBundle.getBundle(&quot;{bundleNameSlashes}&quot;).getString(&quot;{key}&quot;)"/>
(-)a/web.project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerWar.java (-2 lines)
Lines 147-154 Link Here
147
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
147
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
148
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 11);
148
        gridBagConstraints.insets = new java.awt.Insets(0, 0, 11, 11);
149
        jPanel1.add(jLabelFileName, gridBagConstraints);
149
        jPanel1.add(jLabelFileName, gridBagConstraints);
150
151
        jTextFieldFileName.setEditable(false);
152
        gridBagConstraints = new java.awt.GridBagConstraints();
150
        gridBagConstraints = new java.awt.GridBagConstraints();
153
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
151
        gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
154
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
152
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
(-)a/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java (-1 / +4 lines)
Lines 761-769 Link Here
761
        
761
        
762
        ep.setProperty(WebProjectProperties.J2EE_PLATFORM, j2eeProfile.toPropertiesString());
762
        ep.setProperty(WebProjectProperties.J2EE_PLATFORM, j2eeProfile.toPropertiesString());
763
        
763
        
764
        // TODO 59240 // war.name = f(name)
765
        // war.ear.name = f(war.name)
764
        ep.setProperty(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(name) + ".war"); // NOI18N
766
        ep.setProperty(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(name) + ".war"); // NOI18N
765
        //XXX the name of the dist.ear.jar file should be different, but now it cannot be since the name is used as a key in module provider mapping
767
        //XXX the name of the dist.ear.jar file should be different, but now it cannot be since the name is used as a key in module provider mapping
766
        ep.setProperty(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(name) + ".war"); // NOI18N
768
//        ep.setProperty(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(name) + ".war"); // NOI18N
769
        ep.setProperty(WebProjectProperties.WAR_EAR_NAME, "${"+WebProjectProperties.WAR_NAME+"}"); // NOI18N
767
        
770
        
768
        ep.setProperty(WebProjectProperties.WAR_COMPRESS, "false"); // NOI18N
771
        ep.setProperty(WebProjectProperties.WAR_COMPRESS, "false"); // NOI18N
769
        ep.setProperty(WebProjectProperties.WAR_CONTENT_ADDITIONAL, ""); // NOI18N
772
        ep.setProperty(WebProjectProperties.WAR_CONTENT_ADDITIONAL, ""); // NOI18N
(-)a/web.project/src/org/netbeans/modules/web/project/api/WebProjectUtilities.java (-3 lines)
Lines 761-771 Link Here
761
        
761
        
762
        ep.setProperty(WebProjectProperties.J2EE_PLATFORM, j2eeProfile.toPropertiesString());
762
        ep.setProperty(WebProjectProperties.J2EE_PLATFORM, j2eeProfile.toPropertiesString());
763
        
763
        
764
        // TODO 59240 // war.name = f(name)
765
        // war.ear.name = f(war.name)
766
        ep.setProperty(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(name) + ".war"); // NOI18N
764
        ep.setProperty(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(name) + ".war"); // NOI18N
767
        //XXX the name of the dist.ear.jar file should be different, but now it cannot be since the name is used as a key in module provider mapping
765
        //XXX the name of the dist.ear.jar file should be different, but now it cannot be since the name is used as a key in module provider mapping
768
//        ep.setProperty(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(name) + ".war"); // NOI18N
769
        ep.setProperty(WebProjectProperties.WAR_EAR_NAME, "${"+WebProjectProperties.WAR_NAME+"}"); // NOI18N
766
        ep.setProperty(WebProjectProperties.WAR_EAR_NAME, "${"+WebProjectProperties.WAR_NAME+"}"); // NOI18N
770
        
767
        
771
        ep.setProperty(WebProjectProperties.WAR_COMPRESS, "false"); // NOI18N
768
        ep.setProperty(WebProjectProperties.WAR_COMPRESS, "false"); // NOI18N
(-)a/web.project/src/org/netbeans/modules/web/project/WebProjectOperations.java (-6 / +10 lines)
Lines 224-233 Link Here
224
		String warName = (String) projectProps.get(WebProjectProperties.WAR_NAME);
224
		String warName = (String) projectProps.get(WebProjectProperties.WAR_NAME);
225
		String warEarName = (String) projectProps.get(WebProjectProperties.WAR_EAR_NAME);
225
		String warEarName = (String) projectProps.get(WebProjectProperties.WAR_EAR_NAME);
226
		String oldName = warName.substring(0, warName.length() - 4);
226
		String oldName = warName.substring(0, warName.length() - 4);
227
		if (warName.endsWith(".war") && oldName.equals(oldProjectName)) //NOI18N
227
		if (warName.endsWith(".war") && oldName.equals(oldProjectName)) { //NOI18N
228
		    projectProps.put(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
228
		    projectProps.put(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
229
		if (warEarName.endsWith(".war") && oldName.equals(oldProjectName)) //NOI18N
229
                }
230
		if (warEarName.endsWith(".war") && oldName.equals(oldProjectName)) { //NOI18N
230
		    projectProps.put(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
231
		    projectProps.put(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
232
                }
231
                
233
                
232
                ProjectWebModule wm = (ProjectWebModule) project.getLookup ().lookup(ProjectWebModule.class);
234
                ProjectWebModule wm = (ProjectWebModule) project.getLookup ().lookup(ProjectWebModule.class);
233
                if (wm != null) //should not be null
235
                if (wm != null) //should not be null
Lines 266-275 Link Here
266
		String warName = (String) projectProps.get(WebProjectProperties.WAR_NAME);
268
		String warName = (String) projectProps.get(WebProjectProperties.WAR_NAME);
267
		String warEarName = (String) projectProps.get(WebProjectProperties.WAR_EAR_NAME);
269
		String warEarName = (String) projectProps.get(WebProjectProperties.WAR_EAR_NAME);
268
		String oldName = warName.substring(0, warName.length() - 4);
270
		String oldName = warName.substring(0, warName.length() - 4);
269
		if (warName.endsWith(".war") && oldName.equals(oldProjectName)) //NOI18N
271
		if (warName.endsWith(".war") && oldName.equals(oldProjectName)) {//NOI18N
270
		    projectProps.put(WebProjectProperties.WAR_NAME, newName + ".war"); //NOI18N
272
		    projectProps.put(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
271
		if (warEarName.endsWith(".war") && oldName.equals(oldProjectName)) //NOI18N
273
                }
272
		    projectProps.put(WebProjectProperties.WAR_EAR_NAME, newName + ".war"); //NOI18N
274
		if (warEarName.endsWith(".war") && oldName.equals(oldProjectName)) {//NOI18N
275
		    projectProps.put(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
276
                }
273
277
274
		ProjectWebModule wm = (ProjectWebModule) project.getLookup().lookup(ProjectWebModule.class);
278
		ProjectWebModule wm = (ProjectWebModule) project.getLookup().lookup(ProjectWebModule.class);
275
		String serverId = privateProps.getProperty(WebProjectProperties.J2EE_SERVER_INSTANCE);
279
		String serverId = privateProps.getProperty(WebProjectProperties.J2EE_SERVER_INSTANCE);
(-)a/web.project/src/org/netbeans/modules/web/project/WebProjectOperations.java (-8 / +4 lines)
Lines 224-235 Link Here
224
		String warName = (String) projectProps.get(WebProjectProperties.WAR_NAME);
224
		String warName = (String) projectProps.get(WebProjectProperties.WAR_NAME);
225
		String warEarName = (String) projectProps.get(WebProjectProperties.WAR_EAR_NAME);
225
		String warEarName = (String) projectProps.get(WebProjectProperties.WAR_EAR_NAME);
226
		String oldName = warName.substring(0, warName.length() - 4);
226
		String oldName = warName.substring(0, warName.length() - 4);
227
		if (warName.endsWith(".war") && oldName.equals(oldProjectName)) { //NOI18N
227
		if (warName.endsWith(".war") && oldName.equals(oldProjectName)) //NOI18N
228
		    projectProps.put(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
228
		    projectProps.put(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
229
                }
229
		if (warEarName.endsWith(".war") && oldName.equals(oldProjectName)) //NOI18N
230
		if (warEarName.endsWith(".war") && oldName.equals(oldProjectName)) { //NOI18N
231
		    projectProps.put(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
230
		    projectProps.put(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
232
                }
233
                
231
                
234
                ProjectWebModule wm = (ProjectWebModule) project.getLookup ().lookup(ProjectWebModule.class);
232
                ProjectWebModule wm = (ProjectWebModule) project.getLookup ().lookup(ProjectWebModule.class);
235
                if (wm != null) //should not be null
233
                if (wm != null) //should not be null
Lines 268-279 Link Here
268
		String warName = (String) projectProps.get(WebProjectProperties.WAR_NAME);
266
		String warName = (String) projectProps.get(WebProjectProperties.WAR_NAME);
269
		String warEarName = (String) projectProps.get(WebProjectProperties.WAR_EAR_NAME);
267
		String warEarName = (String) projectProps.get(WebProjectProperties.WAR_EAR_NAME);
270
		String oldName = warName.substring(0, warName.length() - 4);
268
		String oldName = warName.substring(0, warName.length() - 4);
271
		if (warName.endsWith(".war") && oldName.equals(oldProjectName)) {//NOI18N
269
		if (warName.endsWith(".war") && oldName.equals(oldProjectName)) //NOI18N
272
		    projectProps.put(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
270
		    projectProps.put(WebProjectProperties.WAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
273
                }
271
		if (warEarName.endsWith(".war") && oldName.equals(oldProjectName)) //NOI18N
274
		if (warEarName.endsWith(".war") && oldName.equals(oldProjectName)) {//NOI18N
275
		    projectProps.put(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
272
		    projectProps.put(WebProjectProperties.WAR_EAR_NAME, PropertyUtils.getUsablePropertyName(newName) + ".war"); //NOI18N
276
                }
277
273
278
		ProjectWebModule wm = (ProjectWebModule) project.getLookup().lookup(ProjectWebModule.class);
274
		ProjectWebModule wm = (ProjectWebModule) project.getLookup().lookup(ProjectWebModule.class);
279
		String serverId = privateProps.getProperty(WebProjectProperties.J2EE_SERVER_INSTANCE);
275
		String serverId = privateProps.getProperty(WebProjectProperties.J2EE_SERVER_INSTANCE);
(-)a/web.project/src/org/netbeans/modules/web/project/ui/customizer/Bundle.properties (+2 lines)
Lines 174-179 Link Here
174
LBL_CustomizeLibraries_LibrariesP_JLabel=Pr&ocessor-path Libraries\:
174
LBL_CustomizeLibraries_LibrariesP_JLabel=Pr&ocessor-path Libraries\:
175
LBL_CustomizeLibraries_Processors_Tab=Processor
175
LBL_CustomizeLibraries_Processors_Tab=Processor
176
176
177
MSG_EmptyWarName=WAR file must not be empty
178
MSG_ForbiddenCharactersInWarName=Invalid name for WAR file. Forbidden characters are: {0}
177
179
178
#AddFilter
180
#AddFilter
179
LBL_AddFilter_Title=AddFilter
181
LBL_AddFilter_Title=AddFilter
(-)a/web.project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerWar.form (-2 / +9 lines)
Lines 10-16 Link Here
10
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
10
    <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
11
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
11
    <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
12
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
12
    <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
13
    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-87,0,0,2,50"/>
13
    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-78,0,0,2,-88"/>
14
  </AuxValues>
14
  </AuxValues>
15
15
16
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
16
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
Lines 150-156 Link Here
150
    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
150
    <Container class="javax.swing.JScrollPane" name="jScrollPane2">
151
      <Constraints>
151
      <Constraints>
152
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
152
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
153
          <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="0" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="11" anchor="10" weightX="1.0" weightY="1.0"/>
153
          <GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="6" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="11" anchor="10" weightX="1.0" weightY="1.0"/>
154
        </Constraint>
154
        </Constraint>
155
      </Constraints>
155
      </Constraints>
156
156
Lines 250-254 Link Here
250
        </Constraint>
250
        </Constraint>
251
      </Constraints>
251
      </Constraints>
252
    </Component>
252
    </Component>
253
    <Component class="javax.swing.JLabel" name="errorLabel">
254
      <Constraints>
255
        <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
256
          <GridBagConstraints gridX="0" gridY="10" gridWidth="2" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="15" weightX="1.0" weightY="0.0"/>
257
        </Constraint>
258
      </Constraints>
259
    </Component>
253
  </SubComponents>
260
  </SubComponents>
254
</Form>
261
</Form>
(-)a/web.project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerWar.java (-23 / +87 lines)
Lines 41-102 Link Here
41
 * Version 2 license, then the option applies only if the new code is
41
 * Version 2 license, then the option applies only if the new code is
42
 * made subject to such option by the copyright holder.
42
 * made subject to such option by the copyright holder.
43
 */
43
 */
44
45
package org.netbeans.modules.web.project.ui.customizer;
44
package org.netbeans.modules.web.project.ui.customizer;
46
45
46
import java.text.MessageFormat;
47
import java.util.regex.Pattern;
47
import javax.swing.JButton;
48
import javax.swing.JButton;
48
import javax.swing.JFileChooser;
49
import javax.swing.JFileChooser;
49
import javax.swing.JPanel;
50
import javax.swing.JPanel;
51
import javax.swing.event.DocumentEvent;
52
import javax.swing.event.DocumentListener;
50
import javax.swing.event.TableModelEvent;
53
import javax.swing.event.TableModelEvent;
51
import javax.swing.event.TableModelListener;
54
import javax.swing.event.TableModelListener;
52
import javax.swing.table.TableModel;
55
import javax.swing.table.TableModel;
53
import org.netbeans.api.java.project.JavaProjectConstants;
56
import org.netbeans.api.java.project.JavaProjectConstants;
54
import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants;
57
import org.netbeans.modules.j2ee.api.ejbjar.EjbProjectConstants;
55
import org.netbeans.modules.j2ee.common.Util;
58
import org.netbeans.modules.j2ee.common.Util;
59
import org.netbeans.modules.j2ee.common.project.ui.MessageUtils;
56
import org.netbeans.modules.java.api.common.classpath.ClassPathSupport;
60
import org.netbeans.modules.java.api.common.classpath.ClassPathSupport;
57
import org.netbeans.modules.java.api.common.classpath.ClassPathSupport.Item;
61
import org.netbeans.modules.java.api.common.classpath.ClassPathSupport.Item;
58
import org.netbeans.modules.java.api.common.project.ui.ClassPathUiSupport;
62
import org.netbeans.modules.java.api.common.project.ui.ClassPathUiSupport;
59
import org.netbeans.modules.java.api.common.project.ui.customizer.EditMediator;
63
import org.netbeans.modules.java.api.common.project.ui.customizer.EditMediator;
60
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
64
import org.netbeans.modules.j2ee.deployment.devmodules.api.J2eePlatform;
61
import org.netbeans.modules.web.project.classpath.ClassPathSupportCallbackImpl;
65
import org.netbeans.modules.web.project.classpath.ClassPathSupportCallbackImpl;
66
import org.netbeans.spi.project.ui.support.ProjectCustomizer;
62
import org.openide.DialogDisplayer;
67
import org.openide.DialogDisplayer;
63
import org.openide.NotifyDescriptor;
68
import org.openide.NotifyDescriptor;
69
import org.openide.WizardValidationException;
64
import org.openide.util.HelpCtx;
70
import org.openide.util.HelpCtx;
65
import org.openide.util.NbBundle;
71
import org.openide.util.NbBundle;
72
import org.openide.util.Utilities;
66
73
67
/** Customizer for WAR packaging.
74
/** Customizer for WAR packaging.
68
 */
75
 */
69
public class CustomizerWar extends JPanel implements HelpCtx.Provider, TableModelListener {
76
public class CustomizerWar extends JPanel implements HelpCtx.Provider, TableModelListener {
70
    
77
71
    WebProjectProperties uiProperties;
78
    WebProjectProperties uiProperties;
72
    
79
    ProjectCustomizer.Category category;
80
73
    /** Creates new form CustomizerCompile */
81
    /** Creates new form CustomizerCompile */
74
    public CustomizerWar(WebProjectProperties uiProperties) {
82
    public CustomizerWar(ProjectCustomizer.Category category, WebProjectProperties uiProperties) {
83
        this.category=category;
75
        this.uiProperties = uiProperties;
84
        this.uiProperties = uiProperties;
76
        initComponents();
85
        initComponents();
77
        this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerWar.class, "ACS_CustomizeWAR_A11YDesc")); //NOI18N
86
        this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerWar.class, "ACS_CustomizeWAR_A11YDesc")); //NOI18N
78
        
87
79
        jTextFieldFileName.setDocument( uiProperties.WAR_NAME_MODEL );
88
        jTextFieldFileName.setDocument(uiProperties.WAR_NAME_MODEL);
80
        jTextFieldExContent.setDocument( uiProperties.BUILD_CLASSES_EXCLUDES_MODEL );
89
        jTextFieldFileName.getDocument().addDocumentListener(new DocumentListener() {
81
        uiProperties.WAR_COMPRESS_MODEL.setMnemonic( jCheckBoxCompress.getMnemonic() );
90
            
82
        jCheckBoxCompress.setModel( uiProperties.WAR_COMPRESS_MODEL );
91
            @Override
92
            public void insertUpdate(DocumentEvent e) {
93
                checkValidWarFilename();
94
            }
95
96
            @Override
97
            public void removeUpdate(DocumentEvent e) {
98
                checkValidWarFilename();
99
            }
100
101
            @Override
102
            public void changedUpdate(DocumentEvent e) {
103
                checkValidWarFilename();
104
            }
105
            
106
        });
107
        jTextFieldExContent.setDocument(uiProperties.BUILD_CLASSES_EXCLUDES_MODEL);
108
        uiProperties.WAR_COMPRESS_MODEL.setMnemonic(jCheckBoxCompress.getMnemonic());
109
        jCheckBoxCompress.setModel(uiProperties.WAR_COMPRESS_MODEL);
83
        ClassPathUiSupport.Callback callback = new ClassPathUiSupport.Callback() {
110
        ClassPathUiSupport.Callback callback = new ClassPathUiSupport.Callback() {
111
84
            public void initItem(Item item) {
112
            public void initItem(Item item) {
85
                if (item.getType() != ClassPathSupport.Item.TYPE_LIBRARY || !item.getLibrary().getType().equals(J2eePlatform.LIBRARY_TYPE)) {
113
                if (item.getType() != ClassPathSupport.Item.TYPE_LIBRARY || !item.getLibrary().getType().equals(J2eePlatform.LIBRARY_TYPE)) {
86
                    item.setAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT, "/"); //NOI18N
114
                    item.setAdditionalProperty(ClassPathSupportCallbackImpl.PATH_IN_DEPLOYMENT, "/"); //NOI18N
87
                }
115
                }
88
            }
116
            }
89
        };
117
        };
90
        
118
91
        jTableAddContent.setModel( uiProperties.WAR_CONTENT_ADDITIONAL_MODEL);
119
        jTableAddContent.setModel(uiProperties.WAR_CONTENT_ADDITIONAL_MODEL);
92
        jTableAddContent.setDefaultRenderer(ClassPathSupport.Item.class, uiProperties.CLASS_PATH_TABLE_ITEM_RENDERER);
120
        jTableAddContent.setDefaultRenderer(ClassPathSupport.Item.class, uiProperties.CLASS_PATH_TABLE_ITEM_RENDERER);
93
        Util.initTwoColumnTableVisualProperties(this, jTableAddContent);
121
        Util.initTwoColumnTableVisualProperties(this, jTableAddContent);
94
        jTableAddContent.setRowHeight(jTableAddContent.getRowHeight() + 4);
122
        jTableAddContent.setRowHeight(jTableAddContent.getRowHeight() + 4);
95
        
123
96
        EditMediator.register( uiProperties.getProject(),
124
        EditMediator.register(uiProperties.getProject(),
97
                uiProperties.getProject().getAntProjectHelper(),
125
                uiProperties.getProject().getAntProjectHelper(),
98
                uiProperties.getProject().getReferenceHelper(),
126
                uiProperties.getProject().getReferenceHelper(),
99
                EditMediator.createListComponent(jTableAddContent, uiProperties.WAR_CONTENT_ADDITIONAL_MODEL.getDefaultListModel()) , 
127
                EditMediator.createListComponent(jTableAddContent, uiProperties.WAR_CONTENT_ADDITIONAL_MODEL.getDefaultListModel()),
100
                jButtonAddJar.getModel(),
128
                jButtonAddJar.getModel(),
101
                jButtonAddLib.getModel(),
129
                jButtonAddLib.getModel(),
102
                jButtonAddProject.getModel(),
130
                jButtonAddProject.getModel(),
Lines 110-116 Link Here
110
                null, JFileChooser.FILES_AND_DIRECTORIES);
138
                null, JFileChooser.FILES_AND_DIRECTORIES);
111
        uiProperties.WAR_CONTENT_ADDITIONAL_MODEL.addTableModelListener(this);
139
        uiProperties.WAR_CONTENT_ADDITIONAL_MODEL.addTableModelListener(this);
112
    }
140
    }
113
    
141
114
    /** This method is called from within the constructor to
142
    /** This method is called from within the constructor to
115
     * initialize the form.
143
     * initialize the form.
116
     * WARNING: Do NOT modify this code. The content of this method is
144
     * WARNING: Do NOT modify this code. The content of this method is
Lines 134-139 Link Here
134
        jButtonAddLib = new javax.swing.JButton();
162
        jButtonAddLib = new javax.swing.JButton();
135
        jButtonAddJar = new javax.swing.JButton();
163
        jButtonAddJar = new javax.swing.JButton();
136
        jButtonRemove = new javax.swing.JButton();
164
        jButtonRemove = new javax.swing.JButton();
165
        errorLabel = new javax.swing.JLabel();
137
166
138
        setLayout(new java.awt.GridBagLayout());
167
        setLayout(new java.awt.GridBagLayout());
139
168
Lines 227-233 Link Here
227
        gridBagConstraints = new java.awt.GridBagConstraints();
256
        gridBagConstraints = new java.awt.GridBagConstraints();
228
        gridBagConstraints.gridx = 0;
257
        gridBagConstraints.gridx = 0;
229
        gridBagConstraints.gridy = 4;
258
        gridBagConstraints.gridy = 4;
230
        gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER;
259
        gridBagConstraints.gridheight = 6;
231
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
260
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
232
        gridBagConstraints.weightx = 1.0;
261
        gridBagConstraints.weightx = 1.0;
233
        gridBagConstraints.weighty = 1.0;
262
        gridBagConstraints.weighty = 1.0;
Lines 278-286 Link Here
278
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
307
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
279
        add(jButtonRemove, gridBagConstraints);
308
        add(jButtonRemove, gridBagConstraints);
280
        jButtonRemove.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_CustomizeWAR_AdditionalRemove_A11YDesc")); // NOI18N
309
        jButtonRemove.getAccessibleContext().setAccessibleDescription(bundle.getString("ACS_CustomizeWAR_AdditionalRemove_A11YDesc")); // NOI18N
310
311
        gridBagConstraints = new java.awt.GridBagConstraints();
312
        gridBagConstraints.gridx = 0;
313
        gridBagConstraints.gridy = 10;
314
        gridBagConstraints.gridwidth = 2;
315
        gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
316
        gridBagConstraints.anchor = java.awt.GridBagConstraints.SOUTH;
317
        gridBagConstraints.weightx = 1.0;
318
        add(errorLabel, gridBagConstraints);
281
    }// </editor-fold>//GEN-END:initComponents
319
    }// </editor-fold>//GEN-END:initComponents
282
    
283
    // Variables declaration - do not modify//GEN-BEGIN:variables
320
    // Variables declaration - do not modify//GEN-BEGIN:variables
321
    private javax.swing.JLabel errorLabel;
284
    private javax.swing.JLabel excludeMessage;
322
    private javax.swing.JLabel excludeMessage;
285
    private javax.swing.JButton jButtonAddJar;
323
    private javax.swing.JButton jButtonAddJar;
286
    private javax.swing.JButton jButtonAddLib;
324
    private javax.swing.JButton jButtonAddLib;
Lines 296-308 Link Here
296
    private javax.swing.JTextField jTextFieldExContent;
334
    private javax.swing.JTextField jTextFieldExContent;
297
    private javax.swing.JTextField jTextFieldFileName;
335
    private javax.swing.JTextField jTextFieldFileName;
298
    // End of variables declaration//GEN-END:variables
336
    // End of variables declaration//GEN-END:variables
299
    
337
300
    /** Help context where to find more about the paste type action.
338
    /** Help context where to find more about the paste type action.
301
     * @return the help context for this action
339
     * @return the help context for this action
302
     */
340
     */
303
    public HelpCtx getHelpCtx() {
341
    public HelpCtx getHelpCtx() {
304
        return new HelpCtx(CustomizerWar.class);
342
        return new HelpCtx(CustomizerWar.class);
305
    }
343
    }
344
    
345
    private void checkValidWarFilename(){
346
        MessageUtils.clear(errorLabel);
347
        category.setValid(true);
348
        
349
        String filename=jTextFieldFileName.getText();
350
        String pattern;
351
        String forbiddenChars;
352
        if (Utilities.isWindows()) {
353
            pattern = ".*[\\/:*?\"<>|].*";    // NOI18N
354
            forbiddenChars = "\\ / : * ? \" < > |";    // NOI18N
355
        } else {
356
            pattern = ".*[\\/].*";    // NOI18N
357
            forbiddenChars = "\\ /";    // NOI18N
358
        }
359
        String message=null;
360
        if (filename.trim().length() == 0) {
361
            message = NbBundle.getMessage(CustomizerWar.class, "MSG_EmptyWarName");
362
        }else if (Pattern.matches(pattern, filename)) {
363
            message = NbBundle.getMessage(CustomizerWar.class, "MSG_ForbiddenCharactersInWarName");
364
            message=MessageFormat.format(message, forbiddenChars);
365
        }
366
        if(message != null){
367
            category.setValid(false);
368
            MessageUtils.setMessage(errorLabel, MessageUtils.MessageType.ERROR, "<html>"+message+"</html>"); // NOI18N
369
        }
370
    }
306
371
307
    public void tableChanged(TableModelEvent e) {
372
    public void tableChanged(TableModelEvent e) {
308
        if (e.getColumn() != 1) {
373
        if (e.getColumn() != 1) {
Lines 316-334 Link Here
316
            if (newPathInWar.equals("WEB-INF\\lib") || newPathInWar.equals("WEB-INF/lib")) { //NOI18N
381
            if (newPathInWar.equals("WEB-INF\\lib") || newPathInWar.equals("WEB-INF/lib")) { //NOI18N
317
                if (cpItem.getResolvedFile().isDirectory()) {
382
                if (cpItem.getResolvedFile().isDirectory()) {
318
                    message = NbBundle.getMessage(CustomizerWar.class,
383
                    message = NbBundle.getMessage(CustomizerWar.class,
319
                        "MSG_NO_FOLDER_IN_WEBINF_LIB", newPathInWar); // NOI18N
384
                            "MSG_NO_FOLDER_IN_WEBINF_LIB", newPathInWar); // NOI18N
320
                } else {
385
                } else {
321
                    message = NbBundle.getMessage(CustomizerWar.class,
386
                    message = NbBundle.getMessage(CustomizerWar.class,
322
                        "MSG_NO_FILE_IN_WEBINF_LIB", newPathInWar); // NOI18N
387
                            "MSG_NO_FILE_IN_WEBINF_LIB", newPathInWar); // NOI18N
323
                }
388
                }
324
            } else if (newPathInWar.equals("WEB-INF\\classes") || newPathInWar.equals("WEB-INF/classes")) { //NOI18N
389
            } else if (newPathInWar.equals("WEB-INF\\classes") || newPathInWar.equals("WEB-INF/classes")) { //NOI18N
325
                    message = NbBundle.getMessage(CustomizerWar.class,
390
                message = NbBundle.getMessage(CustomizerWar.class,
326
                        "MSG_NO_FOLDER_IN_WEBINF_CLASSES", newPathInWar); // NOI18N
391
                        "MSG_NO_FOLDER_IN_WEBINF_CLASSES", newPathInWar); // NOI18N
327
            }
392
            }
328
        }
393
        }
329
        if (message != null) {
394
        if (message != null) {
330
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message (message, NotifyDescriptor.WARNING_MESSAGE));
395
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.WARNING_MESSAGE));
331
        }
396
        }
332
    }
397
    }
333
    
334
}
398
}
(-)a/web.project/src/org/netbeans/modules/web/project/ui/customizer/WebCompositePanelProvider.java (-1 / +1 lines)
Lines 152-158 Link Here
152
        } else if (BUILD.equals(nm)) {
152
        } else if (BUILD.equals(nm)) {
153
            return new CustomizerCompile(uiProps);
153
            return new CustomizerCompile(uiProps);
154
        } else if (WAR.equals(nm)) {
154
        } else if (WAR.equals(nm)) {
155
            return new CustomizerWar(uiProps);
155
            return new CustomizerWar(category, uiProps);
156
        } else if (JAVADOC.equals(nm)) {
156
        } else if (JAVADOC.equals(nm)) {
157
            return new CustomizerJavadoc(uiProps);
157
            return new CustomizerJavadoc(uiProps);
158
        } else if (RUN.equals(nm)) {
158
        } else if (RUN.equals(nm)) {
(-)a/web.project/src/org/netbeans/modules/web/project/ui/customizer/CustomizerWar.java (-13 / +13 lines)
Lines 85-91 Link Here
85
        initComponents();
85
        initComponents();
86
        this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerWar.class, "ACS_CustomizeWAR_A11YDesc")); //NOI18N
86
        this.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(CustomizerWar.class, "ACS_CustomizeWAR_A11YDesc")); //NOI18N
87
87
88
        jTextFieldFileName.setDocument(uiProperties.WAR_NAME_MODEL);
88
        jTextFieldFileName.setDocument( uiProperties.WAR_NAME_MODEL );
89
        jTextFieldFileName.getDocument().addDocumentListener(new DocumentListener() {
89
        jTextFieldFileName.getDocument().addDocumentListener(new DocumentListener() {
90
            
90
            
91
            @Override
91
            @Override
Lines 104-112 Link Here
104
            }
104
            }
105
            
105
            
106
        });
106
        });
107
        jTextFieldExContent.setDocument(uiProperties.BUILD_CLASSES_EXCLUDES_MODEL);
107
        jTextFieldExContent.setDocument( uiProperties.BUILD_CLASSES_EXCLUDES_MODEL );
108
        uiProperties.WAR_COMPRESS_MODEL.setMnemonic(jCheckBoxCompress.getMnemonic());
108
        uiProperties.WAR_COMPRESS_MODEL.setMnemonic( jCheckBoxCompress.getMnemonic() );
109
        jCheckBoxCompress.setModel(uiProperties.WAR_COMPRESS_MODEL);
109
        jCheckBoxCompress.setModel( uiProperties.WAR_COMPRESS_MODEL );
110
        ClassPathUiSupport.Callback callback = new ClassPathUiSupport.Callback() {
110
        ClassPathUiSupport.Callback callback = new ClassPathUiSupport.Callback() {
111
111
112
            public void initItem(Item item) {
112
            public void initItem(Item item) {
Lines 116-130 Link Here
116
            }
116
            }
117
        };
117
        };
118
118
119
        jTableAddContent.setModel(uiProperties.WAR_CONTENT_ADDITIONAL_MODEL);
119
        jTableAddContent.setModel( uiProperties.WAR_CONTENT_ADDITIONAL_MODEL );
120
        jTableAddContent.setDefaultRenderer(ClassPathSupport.Item.class, uiProperties.CLASS_PATH_TABLE_ITEM_RENDERER);
120
        jTableAddContent.setDefaultRenderer(ClassPathSupport.Item.class, uiProperties.CLASS_PATH_TABLE_ITEM_RENDERER);
121
        Util.initTwoColumnTableVisualProperties(this, jTableAddContent);
121
        Util.initTwoColumnTableVisualProperties(this, jTableAddContent);
122
        jTableAddContent.setRowHeight(jTableAddContent.getRowHeight() + 4);
122
        jTableAddContent.setRowHeight(jTableAddContent.getRowHeight() + 4);
123
123
124
        EditMediator.register(uiProperties.getProject(),
124
        EditMediator.register( uiProperties.getProject(),
125
                uiProperties.getProject().getAntProjectHelper(),
125
                uiProperties.getProject().getAntProjectHelper(),
126
                uiProperties.getProject().getReferenceHelper(),
126
                uiProperties.getProject().getReferenceHelper(),
127
                EditMediator.createListComponent(jTableAddContent, uiProperties.WAR_CONTENT_ADDITIONAL_MODEL.getDefaultListModel()),
127
                EditMediator.createListComponent(jTableAddContent, uiProperties.WAR_CONTENT_ADDITIONAL_MODEL.getDefaultListModel()) ,
128
                jButtonAddJar.getModel(),
128
                jButtonAddJar.getModel(),
129
                jButtonAddLib.getModel(),
129
                jButtonAddLib.getModel(),
130
                jButtonAddProject.getModel(),
130
                jButtonAddProject.getModel(),
Lines 350-359 Link Here
350
        String pattern;
350
        String pattern;
351
        String forbiddenChars;
351
        String forbiddenChars;
352
        if (Utilities.isWindows()) {
352
        if (Utilities.isWindows()) {
353
            pattern = ".*[\\/:*?\"<>|].*";    // NOI18N
353
            pattern = ".*[\\\\/:\\*\\?\"<>\\|].*";    // NOI18N
354
            forbiddenChars = "\\ / : * ? \" < > |";    // NOI18N
354
            forbiddenChars = "\\ / : * ? \" < > |";    // NOI18N
355
        } else {
355
        } else {
356
            pattern = ".*[\\/].*";    // NOI18N
356
            pattern = ".*[\\\\/].*";    // NOI18N
357
            forbiddenChars = "\\ /";    // NOI18N
357
            forbiddenChars = "\\ /";    // NOI18N
358
        }
358
        }
359
        String message=null;
359
        String message=null;
Lines 381-398 Link Here
381
            if (newPathInWar.equals("WEB-INF\\lib") || newPathInWar.equals("WEB-INF/lib")) { //NOI18N
381
            if (newPathInWar.equals("WEB-INF\\lib") || newPathInWar.equals("WEB-INF/lib")) { //NOI18N
382
                if (cpItem.getResolvedFile().isDirectory()) {
382
                if (cpItem.getResolvedFile().isDirectory()) {
383
                    message = NbBundle.getMessage(CustomizerWar.class,
383
                    message = NbBundle.getMessage(CustomizerWar.class,
384
                            "MSG_NO_FOLDER_IN_WEBINF_LIB", newPathInWar); // NOI18N
384
                        "MSG_NO_FOLDER_IN_WEBINF_LIB", newPathInWar); // NOI18N
385
                } else {
385
                } else {
386
                    message = NbBundle.getMessage(CustomizerWar.class,
386
                    message = NbBundle.getMessage(CustomizerWar.class,
387
                            "MSG_NO_FILE_IN_WEBINF_LIB", newPathInWar); // NOI18N
387
                        "MSG_NO_FILE_IN_WEBINF_LIB", newPathInWar); // NOI18N
388
                }
388
                }
389
            } else if (newPathInWar.equals("WEB-INF\\classes") || newPathInWar.equals("WEB-INF/classes")) { //NOI18N
389
            } else if (newPathInWar.equals("WEB-INF\\classes") || newPathInWar.equals("WEB-INF/classes")) { //NOI18N
390
                message = NbBundle.getMessage(CustomizerWar.class,
390
                    message = NbBundle.getMessage(CustomizerWar.class,
391
                        "MSG_NO_FOLDER_IN_WEBINF_CLASSES", newPathInWar); // NOI18N
391
                        "MSG_NO_FOLDER_IN_WEBINF_CLASSES", newPathInWar); // NOI18N
392
            }
392
            }
393
        }
393
        }
394
        if (message != null) {
394
        if (message != null) {
395
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message(message, NotifyDescriptor.WARNING_MESSAGE));
395
            DialogDisplayer.getDefault().notify(new NotifyDescriptor.Message (message, NotifyDescriptor.WARNING_MESSAGE));
396
        }
396
        }
397
    }
397
    }
398
}
398
}

Return to bug 59240