Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-09-14 18:20:42 +0000
committeratikhomirov2006-09-14 18:20:42 +0000
commit2a15db4f11dc4e218b9f4139c3ae494bc9942a71 (patch)
treebca26dd51471755eb00ee65e6c2293d36e89efcd /plugins/org.eclipse.gmf.graphdef.codegen
parent16fb807b1c691a94a966edda2c571eebec42fb2a (diff)
downloadorg.eclipse.gmf-tooling-2a15db4f11dc4e218b9f4139c3ae494bc9942a71.tar.gz
org.eclipse.gmf-tooling-2a15db4f11dc4e218b9f4139c3ae494bc9942a71.tar.xz
org.eclipse.gmf-tooling-2a15db4f11dc4e218b9f4139c3ae494bc9942a71.zip
[155707] mgolubev - Do not generate magic numbers for SWT.* constants in the GridLayout support code
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java72
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet4
2 files changed, 41 insertions, 35 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java
index 68ebb254b..b9b5043d9 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/src/org/eclipse/gmf/graphdef/codegen/templates/InitGridLayoutDataGenerator.java
@@ -20,26 +20,28 @@ public class InitGridLayoutDataGenerator
protected final String TEXT_3 = " = new ";
protected final String TEXT_4 = "();" + NL + "\t\t\t";
protected final String TEXT_5 = ".verticalAlignment = ";
- protected final String TEXT_6 = ";" + NL + "\t\t\t";
- protected final String TEXT_7 = ".horizontalAlignment = ";
- protected final String TEXT_8 = ";";
- protected final String TEXT_9 = NL + "\t\t\t";
- protected final String TEXT_10 = ".widthHint = ";
- protected final String TEXT_11 = ";" + NL + "\t\t\t";
- protected final String TEXT_12 = ".heightHint = ";
- protected final String TEXT_13 = ";";
- protected final String TEXT_14 = NL + "\t\t\t";
- protected final String TEXT_15 = ".horizontalIndent = ";
- protected final String TEXT_16 = ";" + NL + "\t\t\t";
- protected final String TEXT_17 = ".horizontalSpan = ";
+ protected final String TEXT_6 = ".";
+ protected final String TEXT_7 = ";" + NL + "\t\t\t";
+ protected final String TEXT_8 = ".horizontalAlignment = ";
+ protected final String TEXT_9 = ".";
+ protected final String TEXT_10 = ";";
+ protected final String TEXT_11 = NL + "\t\t\t";
+ protected final String TEXT_12 = ".widthHint = ";
+ protected final String TEXT_13 = ";" + NL + "\t\t\t";
+ protected final String TEXT_14 = ".heightHint = ";
+ protected final String TEXT_15 = ";";
+ protected final String TEXT_16 = NL + "\t\t\t";
+ protected final String TEXT_17 = ".horizontalIndent = ";
protected final String TEXT_18 = ";" + NL + "\t\t\t";
- protected final String TEXT_19 = ".verticalSpan = ";
+ protected final String TEXT_19 = ".horizontalSpan = ";
protected final String TEXT_20 = ";" + NL + "\t\t\t";
- protected final String TEXT_21 = ".grabExcessHorizontalSpace = ";
+ protected final String TEXT_21 = ".verticalSpan = ";
protected final String TEXT_22 = ";" + NL + "\t\t\t";
- protected final String TEXT_23 = ".grabExcessVerticalSpace = ";
- protected final String TEXT_24 = ";" + NL;
- protected final String TEXT_25 = NL;
+ protected final String TEXT_23 = ".grabExcessHorizontalSpace = ";
+ protected final String TEXT_24 = ";" + NL + "\t\t\t";
+ protected final String TEXT_25 = ".grabExcessVerticalSpace = ";
+ protected final String TEXT_26 = ";" + NL;
+ protected final String TEXT_27 = NL;
public String generate(Object argument)
{
@@ -61,50 +63,54 @@ final String layoutImplClassName = dispatcher.getFQNSwitch().get(gmfLayoutData,
stringBuffer.append(TEXT_4);
stringBuffer.append(layoutConstraintVarName);
stringBuffer.append(TEXT_5);
- stringBuffer.append(gmfLayoutData.getVerticalAlignment().getValue());
+ stringBuffer.append(layoutImplClassName);
stringBuffer.append(TEXT_6);
- stringBuffer.append(layoutConstraintVarName);
+ stringBuffer.append(gmfLayoutData.getVerticalAlignment().getName());
stringBuffer.append(TEXT_7);
- stringBuffer.append(gmfLayoutData.getHorizontalAlignment().getValue());
+ stringBuffer.append(layoutConstraintVarName);
stringBuffer.append(TEXT_8);
+ stringBuffer.append(layoutImplClassName);
+ stringBuffer.append(TEXT_9);
+ stringBuffer.append(gmfLayoutData.getHorizontalAlignment().getName());
+ stringBuffer.append(TEXT_10);
Dimension sizeHint = gmfLayoutData.getSizeHint();
if (sizeHint != null){
- stringBuffer.append(TEXT_9);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_10);
- stringBuffer.append(sizeHint.getDx());
stringBuffer.append(TEXT_11);
stringBuffer.append(layoutConstraintVarName);
stringBuffer.append(TEXT_12);
- stringBuffer.append(sizeHint.getDy());
+ stringBuffer.append(sizeHint.getDx());
stringBuffer.append(TEXT_13);
+ stringBuffer.append(layoutConstraintVarName);
+ stringBuffer.append(TEXT_14);
+ stringBuffer.append(sizeHint.getDy());
+ stringBuffer.append(TEXT_15);
}
- stringBuffer.append(TEXT_14);
- stringBuffer.append(layoutConstraintVarName);
- stringBuffer.append(TEXT_15);
- stringBuffer.append(gmfLayoutData.getHorizontalIndent());
stringBuffer.append(TEXT_16);
stringBuffer.append(layoutConstraintVarName);
stringBuffer.append(TEXT_17);
- stringBuffer.append(gmfLayoutData.getHorizontalSpan());
+ stringBuffer.append(gmfLayoutData.getHorizontalIndent());
stringBuffer.append(TEXT_18);
stringBuffer.append(layoutConstraintVarName);
stringBuffer.append(TEXT_19);
- stringBuffer.append(gmfLayoutData.getVerticalSpan());
+ stringBuffer.append(gmfLayoutData.getHorizontalSpan());
stringBuffer.append(TEXT_20);
stringBuffer.append(layoutConstraintVarName);
stringBuffer.append(TEXT_21);
- stringBuffer.append(gmfLayoutData.isGrabExcessHorizontalSpace());
+ stringBuffer.append(gmfLayoutData.getVerticalSpan());
stringBuffer.append(TEXT_22);
stringBuffer.append(layoutConstraintVarName);
stringBuffer.append(TEXT_23);
- stringBuffer.append(gmfLayoutData.isGrabExcessVerticalSpace());
+ stringBuffer.append(gmfLayoutData.isGrabExcessHorizontalSpace());
stringBuffer.append(TEXT_24);
+ stringBuffer.append(layoutConstraintVarName);
stringBuffer.append(TEXT_25);
+ stringBuffer.append(gmfLayoutData.isGrabExcessVerticalSpace());
+ stringBuffer.append(TEXT_26);
+ stringBuffer.append(TEXT_27);
return stringBuffer.toString();
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet
index c037a8233..363996220 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/layoutData/GridLayoutData.javajet
@@ -10,8 +10,8 @@ final String layoutConstraintVarName = argsBundle.getConstraintVariableName();
final String layoutImplClassName = dispatcher.getFQNSwitch().get(gmfLayoutData, dispatcher.getImportManager());
%>
<%=layoutImplClassName%> <%=layoutConstraintVarName%> = new <%=layoutImplClassName%>();
- <%=layoutConstraintVarName%>.verticalAlignment = <%=gmfLayoutData.getVerticalAlignment().getValue()%>;
- <%=layoutConstraintVarName%>.horizontalAlignment = <%=gmfLayoutData.getHorizontalAlignment().getValue()%>;
+ <%=layoutConstraintVarName%>.verticalAlignment = <%=layoutImplClassName%>.<%=gmfLayoutData.getVerticalAlignment().getName()%>;
+ <%=layoutConstraintVarName%>.horizontalAlignment = <%=layoutImplClassName%>.<%=gmfLayoutData.getHorizontalAlignment().getName()%>;
<%
Dimension sizeHint = gmfLayoutData.getSizeHint();
if (sizeHint != null){

Back to the top