Author: scabanovich
Date: 2010-03-19 10:52:24 -0400 (Fri, 19 Mar 2010)
New Revision: 20933
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/webapp30.meta
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppLoader.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5975
Modified: trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/webapp30.meta
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/webapp30.meta 2010-03-19
14:51:18 UTC (rev 20932)
+++ trunk/jst/plugins/org.jboss.tools.jst.web/resources/meta/webapp30.meta 2010-03-19
14:52:24 UTC (rev 20933)
@@ -307,15 +307,7 @@
<XModelAttribute default="absolute ordering"
loader="ElementType" name="element type">
<Editor name="Uneditable"/>
</XModelAttribute>
- <XModelAttribute PROPERTIES="save=always;id=true" name="name"
xmlname="name.#text">
- <Constraint loader="ListString">
- <value name="doc"/>
- <value name="gif"/>
- <value name="html"/>
- <value name="txt"/>
- </Constraint>
- <Editor name="ListString"/>
- </XModelAttribute>
+ <XModelAttribute PROPERTIES="save=always;id=true" name="names"
xmlname="names"/>
<XModelAttribute name="others" xmlname="others">
<Constraint loader="List">
<value name="true"/>
@@ -725,7 +717,7 @@
PROPERTIES="validator.add=true" WizardClassName="%Default%"
displayName="Absolute Ordering..." kind="action"
name="CreateAbsoluteOrdering">
<EntityData EntityName="WebAppAbsoluteOrdering">
- <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="names"/>
<AttributeData AttributeName="others" Mandatory="no"/>
</EntityData>
</XActionItem>
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppLoader.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppLoader.java 2010-03-19
14:51:18 UTC (rev 20932)
+++
trunk/jst/plugins/org.jboss.tools.jst.web/src/org/jboss/tools/jst/web/webapp/model/FileWebAppLoader.java 2010-03-19
14:52:24 UTC (rev 20933)
@@ -18,7 +18,6 @@
import org.jboss.tools.common.meta.*;
import org.jboss.tools.common.model.*;
-import org.jboss.tools.common.model.impl.XModelObjectImpl;
import org.jboss.tools.common.model.loaders.impl.SimpleWebFileLoader;
import org.jboss.tools.common.model.util.*;
import org.jboss.tools.common.xml.XMLUtilities;
@@ -53,6 +52,7 @@
} else if(entity.getName().startsWith("FileWebApp")) { //$NON-NLS-1$
children.add("distributable"); //$NON-NLS-1$
} else if(entity.getName().startsWith("WebAppAbsoluteOrdering")) {
//$NON-NLS-1$
+ children.add("name"); //$NON-NLS-1$
children.add("others"); //$NON-NLS-1$
} else if(entity.getName().equals("WebAppSessionConfig30")) {
//$NON-NLS-1$
children.add("tracking-mode"); //$NON-NLS-1$
@@ -76,6 +76,8 @@
return (XMLUtil.getUniqueChild(element, "others") != null) ?
"true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
if("role-names".equals(xmlname)) //$NON-NLS-1$
return loadArray(element, "role-name"); //$NON-NLS-1$
+ if("names".equals(xmlname)) //$NON-NLS-1$
+ return loadArray(element, "name"); //$NON-NLS-1$
if("url-patterns".equals(xmlname)) //$NON-NLS-1$
return loadArray(element, "url-pattern"); //$NON-NLS-1$
if("http-methods".equals(xmlname)) //$NON-NLS-1$
@@ -124,6 +126,8 @@
if("true".equals(value)) XMLUtil.createElement(element,
"others"); //$NON-NLS-1$ //$NON-NLS-2$
} else if("role-names".equals(xmlname)) { //$NON-NLS-1$
saveArray(element, "role-name", value); //$NON-NLS-1$
+ } else if("names".equals(xmlname)) { //$NON-NLS-1$
+ saveArray(element, "name", value); //$NON-NLS-1$
} else if("url-patterns".equals(xmlname)) { //$NON-NLS-1$
saveArray(element, "url-pattern", value); //$NON-NLS-1$
} else if("http-methods".equals(xmlname)) { //$NON-NLS-1$
@@ -300,11 +304,11 @@
boolean needToSave(XModelObject o) {
if(o == null) return false;
String entity = o.getModelEntity().getName();
- if("WebAppSessionConfig".equals(entity) ||
"WebAppLoginConfig".equals(entity)) { //$NON-NLS-1$ //$NON-NLS-2$
+ if(entity.startsWith("WebAppSessionConfig") ||
"WebAppLoginConfig".equals(entity)) { //$NON-NLS-1$ //$NON-NLS-2$
return hasSetAttributes(o);
} else if("WebAppWelcomFileList".equals(entity) ||
"WebAppLocaleEncodingMappingList".equals(entity)) { //$NON-NLS-1$ //$NON-NLS-2$
return (o.getChildren().length > 0);
- } else if("WebAppJspConfig".equals(entity)) { //$NON-NLS-1$
+ } else if(entity.startsWith("WebAppJspConfig")) { //$NON-NLS-1$
return (o.getChildren().length > 0);
}
return true;
@@ -317,7 +321,7 @@
// it would be more safe to check isSavable
if(xml == null || xml.length() == 0 || "NAME".equals(xml)) continue;
//$NON-NLS-1$
String v = o.getAttributeValue(as[i].getName());
- if(v != null && v.length() > 0) return true;
+ if(v != null && v.length() > 0 &&
!v.equals(as[i].getDefaultValue())) return true;
}
String finalComment = o.get("#final-comment"); //$NON-NLS-1$
if(finalComment != null && finalComment.length() > 0) return true;