eclipse plugin: Set the default for EString attributes...

...to the empty string instead of null
This commit is contained in:
Timotei Dolean 2011-07-26 15:33:43 +00:00
parent 07389efa2b
commit a6132677d1
13 changed files with 39 additions and 32 deletions

View file

@ -57,12 +57,10 @@ public class WMLFoldingRegionProvider extends DefaultFoldingRegionProvider
else if ( eObject instanceof WMLMacroDefine )
endName = ( ( WMLMacroDefine ) eObject ).getEndName( );
if ( endName != null ) {
if ( endName.endsWith( "\r\n" ) )
length -= 2;
else if ( endName.endsWith( "\n" ) )
-- length;
}
if ( endName.endsWith( "\r\n" ) )
length -= 2;
else if ( endName.endsWith( "\n" ) )
-- length;
foldingRegionAcceptor.accept(offset, length, significant);
}

View file

@ -14,7 +14,8 @@
<eStructuralFeatures xsi:type="ecore:EReference" name="Expressions" upperBound="-1"
eType="ecore:EClass platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="_extendedTagName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="_cardinality" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EChar"
@ -68,23 +69,26 @@
<eClassifiers xsi:type="ecore:EClass" name="WMLMacroCallParameter"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLArrayCall" eSuperTypes="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLKeyValue">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" unique="false" upperBound="-1"
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString" defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLMacroDefine" eSuperTypes="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLRootExpression">
<eStructuralFeatures xsi:type="ecore:EReference" name="Expressions" upperBound="-1"
eType="ecore:EClass platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLValuedExpression"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLPreprocIF" eSuperTypes="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLRootExpression">
<eStructuralFeatures xsi:type="ecore:EReference" name="Expressions" upperBound="-1"
eType="ecore:EClass platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLValuedExpression"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Elses" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="Elses" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
<eStructuralFeatures xsi:type="ecore:EReference" name="ElseExpressions" upperBound="-1"
eType="ecore:EClass platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLValuedExpression"
containment="true"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="endName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="WMLRootExpression" eSuperTypes="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLExpression"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLExpression" eSuperTypes="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLValuedExpression">
@ -94,6 +98,7 @@
<eClassifiers xsi:type="ecore:EClass" name="WMLValuedExpression"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLTextdomain" eSuperTypes="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLRootExpression"/>
<eClassifiers xsi:type="ecore:EClass" name="WMLLuaCode" eSuperTypes="platform:/resource/org.wesnoth/src-gen/org/wesnoth/WML.ecore#//WMLKeyValue">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"
defaultValueLiteral=""/>
</eClassifiers>
</ecore:EPackage>

View file

@ -37,7 +37,7 @@ public interface WMLArrayCall extends WMLKeyValue
* <!-- end-user-doc -->
* @return the value of the '<em>Value</em>' attribute list.
* @see org.wesnoth.wml.WmlPackage#getWMLArrayCall_Value()
* @model unique="false"
* @model default="" unique="false"
* @generated
*/
EList<String> getValue();

View file

@ -27,6 +27,7 @@ public interface WMLLuaCode extends WMLKeyValue
{
/**
* Returns the value of the '<em><b>Value</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Value</em>' attribute isn't clear,
@ -36,7 +37,7 @@ public interface WMLLuaCode extends WMLKeyValue
* @return the value of the '<em>Value</em>' attribute.
* @see #setValue(String)
* @see org.wesnoth.wml.WmlPackage#getWMLLuaCode_Value()
* @model
* @model default=""
* @generated
*/
String getValue();

View file

@ -45,6 +45,7 @@ public interface WMLMacroDefine extends WMLRootExpression
/**
* Returns the value of the '<em><b>End Name</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>End Name</em>' attribute isn't clear,
@ -54,7 +55,7 @@ public interface WMLMacroDefine extends WMLRootExpression
* @return the value of the '<em>End Name</em>' attribute.
* @see #setEndName(String)
* @see org.wesnoth.wml.WmlPackage#getWMLMacroDefine_EndName()
* @model
* @model default=""
* @generated
*/
String getEndName();

View file

@ -47,6 +47,7 @@ public interface WMLPreprocIF extends WMLRootExpression
/**
* Returns the value of the '<em><b>Elses</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Elses</em>' attribute isn't clear,
@ -56,7 +57,7 @@ public interface WMLPreprocIF extends WMLRootExpression
* @return the value of the '<em>Elses</em>' attribute.
* @see #setElses(String)
* @see org.wesnoth.wml.WmlPackage#getWMLPreprocIF_Elses()
* @model
* @model default=""
* @generated
*/
String getElses();
@ -89,6 +90,7 @@ public interface WMLPreprocIF extends WMLRootExpression
/**
* Returns the value of the '<em><b>End Name</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>End Name</em>' attribute isn't clear,
@ -98,7 +100,7 @@ public interface WMLPreprocIF extends WMLRootExpression
* @return the value of the '<em>End Name</em>' attribute.
* @see #setEndName(String)
* @see org.wesnoth.wml.WmlPackage#getWMLPreprocIF_EndName()
* @model
* @model default=""
* @generated
*/
String getEndName();

View file

@ -76,6 +76,7 @@ public interface WMLTag extends WMLRootExpression
/**
* Returns the value of the '<em><b>End Name</b></em>' attribute.
* The default value is <code>""</code>.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>End Name</em>' attribute isn't clear,
@ -85,7 +86,7 @@ public interface WMLTag extends WMLRootExpression
* @return the value of the '<em>End Name</em>' attribute.
* @see #setEndName(String)
* @see org.wesnoth.wml.WmlPackage#getWMLTag_EndName()
* @model
* @model default=""
* @generated
*/
String getEndName();

View file

@ -38,7 +38,7 @@ public class WMLLuaCodeImpl extends WMLKeyValueImpl implements WMLLuaCode
* @generated
* @ordered
*/
protected static final String VALUE_EDEFAULT = null;
protected static final String VALUE_EDEFAULT = "";
/**
* The cached value of the '{@link #getValue() <em>Value</em>}' attribute.

View file

@ -59,7 +59,7 @@ public class WMLMacroDefineImpl extends WMLRootExpressionImpl implements WMLMacr
* @generated
* @ordered
*/
protected static final String END_NAME_EDEFAULT = null;
protected static final String END_NAME_EDEFAULT = "";
/**
* The cached value of the '{@link #getEndName() <em>End Name</em>}' attribute.

View file

@ -61,7 +61,7 @@ public class WMLPreprocIFImpl extends WMLRootExpressionImpl implements WMLPrepro
* @generated
* @ordered
*/
protected static final String ELSES_EDEFAULT = null;
protected static final String ELSES_EDEFAULT = "";
/**
* The cached value of the '{@link #getElses() <em>Elses</em>}' attribute.
@ -91,7 +91,7 @@ public class WMLPreprocIFImpl extends WMLRootExpressionImpl implements WMLPrepro
* @generated
* @ordered
*/
protected static final String END_NAME_EDEFAULT = null;
protected static final String END_NAME_EDEFAULT = "";
/**
* The cached value of the '{@link #getEndName() <em>End Name</em>}' attribute.

View file

@ -83,7 +83,7 @@ public class WMLTagImpl extends WMLRootExpressionImpl implements WMLTag
* @generated
* @ordered
*/
protected static final String END_NAME_EDEFAULT = null;
protected static final String END_NAME_EDEFAULT = "";
/**
* The cached value of the '{@link #getEndName() <em>End Name</em>}' attribute.

View file

@ -711,7 +711,7 @@ public class WmlPackageImpl extends EPackageImpl implements WmlPackage
initEClass(wmlTagEClass, WMLTag.class, "WMLTag", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLTag_Plus(), ecorePackage.getEString(), "plus", "", 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getWMLTag_Expressions(), this.getWMLExpression(), null, "Expressions", null, 0, -1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLTag_EndName(), ecorePackage.getEString(), "endName", null, 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLTag_EndName(), ecorePackage.getEString(), "endName", "", 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLTag__extendedTagName(), ecorePackage.getEString(), "_extendedTagName", "", 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLTag__cardinality(), ecorePackage.getEChar(), "_cardinality", " ", 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLTag__needsExpanding(), ecorePackage.getEBoolean(), "_needsExpanding", "false", 0, 1, WMLTag.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
@ -741,17 +741,17 @@ public class WmlPackageImpl extends EPackageImpl implements WmlPackage
initEClass(wmlMacroCallParameterEClass, WMLMacroCallParameter.class, "WMLMacroCallParameter", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(wmlArrayCallEClass, WMLArrayCall.class, "WMLArrayCall", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLArrayCall_Value(), ecorePackage.getEString(), "value", null, 0, -1, WMLArrayCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLArrayCall_Value(), ecorePackage.getEString(), "value", "", 0, -1, WMLArrayCall.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, !IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(wmlMacroDefineEClass, WMLMacroDefine.class, "WMLMacroDefine", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getWMLMacroDefine_Expressions(), this.getWMLValuedExpression(), null, "Expressions", null, 0, -1, WMLMacroDefine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLMacroDefine_EndName(), ecorePackage.getEString(), "endName", null, 0, 1, WMLMacroDefine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLMacroDefine_EndName(), ecorePackage.getEString(), "endName", "", 0, 1, WMLMacroDefine.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(wmlPreprocIFEClass, WMLPreprocIF.class, "WMLPreprocIF", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEReference(getWMLPreprocIF_Expressions(), this.getWMLValuedExpression(), null, "Expressions", null, 0, -1, WMLPreprocIF.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLPreprocIF_Elses(), ecorePackage.getEString(), "Elses", null, 0, 1, WMLPreprocIF.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLPreprocIF_Elses(), ecorePackage.getEString(), "Elses", "", 0, 1, WMLPreprocIF.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEReference(getWMLPreprocIF_ElseExpressions(), this.getWMLValuedExpression(), null, "ElseExpressions", null, 0, -1, WMLPreprocIF.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLPreprocIF_EndName(), ecorePackage.getEString(), "endName", null, 0, 1, WMLPreprocIF.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLPreprocIF_EndName(), ecorePackage.getEString(), "endName", "", 0, 1, WMLPreprocIF.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEClass(wmlRootExpressionEClass, WMLRootExpression.class, "WMLRootExpression", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
@ -763,7 +763,7 @@ public class WmlPackageImpl extends EPackageImpl implements WmlPackage
initEClass(wmlTextdomainEClass, WMLTextdomain.class, "WMLTextdomain", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEClass(wmlLuaCodeEClass, WMLLuaCode.class, "WMLLuaCode", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
initEAttribute(getWMLLuaCode_Value(), ecorePackage.getEString(), "value", null, 0, 1, WMLLuaCode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
initEAttribute(getWMLLuaCode_Value(), ecorePackage.getEString(), "value", "", 0, 1, WMLLuaCode.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
// Create resource
createResource(eNS_URI);

View file

@ -31,10 +31,9 @@ process( EClass this ):
process( EStructuralFeature this ):
null;
// make the all strings to default to the empty string
process( EAttribute this ):
if name == 'plus' || name == 'point' || name == 'relative' ||
name == 'name' || name == 'eol'
then
if eAttributeType.name == "EString" then
setDefaultValueLiteral( "" );
createCardinalityOperation( EClass this, String name, char chr ) :