Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2006-01-25 14:02:29 +0000
committeratikhomirov2006-01-25 14:02:29 +0000
commit3638514641b1c773518fb246b581767df6351018 (patch)
tree8a894dfa16a1da3154c66d722b6e507378cd849f /plugins/org.eclipse.gmf.graphdef.codegen/templates
parentb979e2e490a2d901eed093ffec182e5601418f42 (diff)
downloadorg.eclipse.gmf-tooling-3638514641b1c773518fb246b581767df6351018.tar.gz
org.eclipse.gmf-tooling-3638514641b1c773518fb246b581767df6351018.tar.xz
org.eclipse.gmf-tooling-3638514641b1c773518fb246b581767df6351018.zip
support Figure.color attributes
Diffstat (limited to 'plugins/org.eclipse.gmf.graphdef.codegen/templates')
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/Color.jetinc1
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/ConcreteShape.javajet4
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/DecorationFigure.javajet5
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/FigureAttrs.jetinc8
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet7
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/ShapeAttrs.jetinc36
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc6
-rw-r--r--plugins/org.eclipse.gmf.graphdef.codegen/templates/instantiate.jetinc13
8 files changed, 45 insertions, 35 deletions
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/Color.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Color.jetinc
new file mode 100644
index 000000000..1ec741c0f
--- /dev/null
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/Color.jetinc
@@ -0,0 +1 @@
+<%if (colorVal instanceof RGBColor) {%>new Color(null, <%=((RGBColor) colorVal).getRed()%>, <%=((RGBColor) colorVal).getGreen()%>, <%=((RGBColor) colorVal).getBlue()%>)<%} else if (colorVal instanceof ConstantColor) {%>ColorConstants.<%=((ConstantColor) colorVal).getValue().getLiteral()%><%}%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/ConcreteShape.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/ConcreteShape.javajet
index 1303fc12c..279419fca 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/ConcreteShape.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/ConcreteShape.javajet
@@ -16,8 +16,8 @@ public class <%=shapeFig.getName()%> extends <%=fqnSwitch.doSwitch(shapeFig)%> {
public <%=shapeFig.getName()%>() {
<%
{
-Shape shapeFigure = shapeFig;
-String shapeVarName = "this";
+Shape figureInstance = shapeFig;
+String figureVarName = "this";
%>
<%@ include file="ShapeAttrs.jetinc" %>
<%
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/DecorationFigure.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/DecorationFigure.javajet
index 5a8d59594..0b613d8c0 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/DecorationFigure.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/DecorationFigure.javajet
@@ -24,10 +24,5 @@ String decFigVarName = "this";%>
<%if (scale != null) {%>
setScale(<%=scale.getX()%>, <%=scale.getY()%>);
<%}%>
-<%
-Shape shapeFigure = (Shape) figure;
-String shapeVarName = "this";
-%>
-<%@ include file="ShapeAttrs.jetinc" %>
}
}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/FigureAttrs.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/FigureAttrs.jetinc
index e69de29bb..828d28083 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/FigureAttrs.jetinc
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/FigureAttrs.jetinc
@@ -0,0 +1,8 @@
+<%Color colorVal;
+if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_ForegroundColor())) {
+ colorVal = figureInstance.getForegroundColor();%>
+ <%=figureVarName%>.setForegroundColor(<%@ include file="Color.jetinc"%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getFigure_BackgroundColor())) {
+ colorVal = figureInstance.getBackgroundColor();%>
+ <%=figureVarName%>.setBackgroundColor(<%@ include file="Color.jetinc"%>);
+<%}%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet b/plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet
index 21a6552b7..9596af38a 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/PolylineConnection.javajet
@@ -15,9 +15,10 @@ public class <%=figure.getName()%> extends org.eclipse.gmf.runtime.draw2d.ui.fig
* @generated
*/
public <%=figure.getName()%>() {
-<%Shape shapeFigure = figure;
-String shapeVarName = "this";%>
-<%@ include file="ShapeAttrs.jetinc" %>
+<% { // scope
+Shape figureInstance = figure;
+String figureVarName = "this";%>
+<%@ include file="ShapeAttrs.jetinc" %><% }// scope %>
<%if (figure.getSourceDecoration() != null) {%>
setSourceDecoration(createSourceDecoration());
<%}
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/ShapeAttrs.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/ShapeAttrs.jetinc
index 9dfc6a9f6..312ad4d7f 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/ShapeAttrs.jetinc
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/ShapeAttrs.jetinc
@@ -1,22 +1,22 @@
<%
// PERHAPS, do this with reflection?
-%><%if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Fill())) {%>
- <%=shapeVarName%>.setFill(<%=shapeFigure.isFill()%>);
-<%} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Outline())) {%>
- <%=shapeVarName%>.setOutline(<%=shapeFigure.isOutline()%>);
-<%} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineWidth())) {%>
- <%=shapeVarName%>.setLineWidth(<%=shapeFigure.getLineWidth()%>);
-<%} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineKind())) {%>
- <%=shapeVarName%>.setLineStyle(org.eclipse.draw2d.Graphics.<%=shapeFigure.getLineKind().getName()%>);
-<%} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorFill())) {%>
- <%=shapeVarName%>.setFillXOR(<%=shapeFigure.isXorFill()%>);
-<%} if (shapeFigure.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorOutline())) {%>
- <%=shapeVarName%>.setOutlineXOR(<%=shapeFigure.isXorOutline()%>);
-<%} if (shapeFigure instanceof Polyline && !((Polyline) shapeFigure).getTemplate().isEmpty()) {
- for (Iterator pointIt = ((Polyline) shapeFigure).getTemplate().iterator(); pointIt.hasNext(); ) {
+%><%if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Fill())) {%>
+ <%=figureVarName%>.setFill(<%=figureInstance.isFill()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_Outline())) {%>
+ <%=figureVarName%>.setOutline(<%=figureInstance.isOutline()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineWidth())) {%>
+ <%=figureVarName%>.setLineWidth(<%=figureInstance.getLineWidth()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_LineKind())) {%>
+ <%=figureVarName%>.setLineStyle(org.eclipse.draw2d.Graphics.<%=figureInstance.getLineKind().getName()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorFill())) {%>
+ <%=figureVarName%>.setFillXOR(<%=figureInstance.isXorFill()%>);
+<%} if (figureInstance.eIsSet(GMFGraphPackage.eINSTANCE.getShape_XorOutline())) {%>
+ <%=figureVarName%>.setOutlineXOR(<%=figureInstance.isXorOutline()%>);
+<%} if (figureInstance instanceof Polyline && !((Polyline) figureInstance).getTemplate().isEmpty()) {
+ for (Iterator pointIt = ((Polyline) figureInstance).getTemplate().iterator(); pointIt.hasNext(); ) {
Point p = (Point) pointIt.next();%>
- <%=shapeVarName%>.addPoint(new org.eclipse.draw2d.geometry.Point(<%=p.getX()%>, <%=p.getY()%>));
-<%}%><%} else if (shapeFigure instanceof RoundedRectangle) {
- RoundedRectangle rrFigure = (RoundedRectangle) shapeFigure;%>
- <%=shapeVarName%>.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(<%=rrFigure.getCornerWidth()%>), getMapMode().DPtoLP(<%=rrFigure.getCornerHeight()%>)));
+ <%=figureVarName%>.addPoint(new org.eclipse.draw2d.geometry.Point(<%=p.getX()%>, <%=p.getY()%>));
+<%}%><%} else if (figureInstance instanceof RoundedRectangle) {
+ RoundedRectangle rrFigure = (RoundedRectangle) figureInstance;%>
+ <%=figureVarName%>.setCornerDimensions(new org.eclipse.draw2d.geometry.Dimension(getMapMode().DPtoLP(<%=rrFigure.getCornerWidth()%>), getMapMode().DPtoLP(<%=rrFigure.getCornerHeight()%>)));
<%}%><%@ include file="FigureAttrs.jetinc"%> \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc
index aad4c971d..be64196f9 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/decoration.jetinc
@@ -1,5 +1,9 @@
<%=fqnSwitch.doSwitch(df)%> <%=decFigVarName%> = new <%=fqnSwitch.doSwitch(df)%>();
-<%@ include file="FigureAttrs.jetinc"%>
+<% { // scope
+Figure figureInstance = df;
+String figureVarName = decFigVarName;
+%>
+<%@ include file="FigureAttrs.jetinc"%><%} // scope %>
<% /*include FigureChildren*/ %>
<%
if ((df instanceof PolylineDecoration || df instanceof PolygonDecoration)) {
diff --git a/plugins/org.eclipse.gmf.graphdef.codegen/templates/instantiate.jetinc b/plugins/org.eclipse.gmf.graphdef.codegen/templates/instantiate.jetinc
index a25433733..f4b9584c1 100644
--- a/plugins/org.eclipse.gmf.graphdef.codegen/templates/instantiate.jetinc
+++ b/plugins/org.eclipse.gmf.graphdef.codegen/templates/instantiate.jetinc
@@ -2,18 +2,19 @@
// FigureMarker: figureMarker
// String: figureVarName
if (figureMarker instanceof CustomFigure) {
+ CustomFigure figureInstance = (CustomFigure) figureMarker;
%>
- org.eclipse.draw2d.IFigure <%=figureVarName%> = new <%=((CustomFigure) figureMarker).getQualifiedClassName()%>();
+ <%=fqnSwitch.doSwitch(figureMarker)%> <%=figureVarName%> = new <%=fqnSwitch.doSwitch(figureMarker)%>();
<%@ include file="FigureAttrs.jetinc"%>
<%} else if (figureMarker instanceof Shape) {
-Shape shapeFigure = (Shape) figureMarker;
-String shapeVarName = figureVarName;%>
+Shape figureInstance = (Shape) figureMarker;%>
<%=fqnSwitch.doSwitch(figureMarker)%> <%=figureVarName%> = new <%=fqnSwitch.doSwitch(figureMarker)%>();
<%@ include file="ShapeAttrs.jetinc"%>
<%} else if (figureMarker instanceof FigureRef) {%>
org.eclipse.draw2d.IFigure <%=figureVarName%> = new <%=((FigureRef) figureMarker).getFigure().getName()%>();
-<%@ include file="FigureAttrs.jetinc"%>
-<%} else if (figureMarker instanceof Label) {%>
- org.eclipse.draw2d.Label <%=figureVarName%> = new org.eclipse.draw2d.Label();
+<%} else if (figureMarker instanceof Label) {
+ Label figureInstance = (Label) figureMarker;
+%>
+ <%=fqnSwitch.doSwitch(figureMarker)%> <%=figureVarName%> = new <%=fqnSwitch.doSwitch(figureMarker)%>();
<%=figureVarName%>.setText("<%=((Label) figureMarker).getText()%>");
<%@ include file="FigureAttrs.jetinc"%><%}%> \ No newline at end of file

Back to the top