Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: a88e722770b0f701c9dfd2481f8d1a1bfe22d710 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<%
//input: [oeg].gmfgraph.Color colorVal
//input: String colorName
//input: [oeg].common.codegen.ImportAssistant importManager 
//input: [oeg].graphdef.codegen GraphDefDispatcher dispatcher

	if (colorVal instanceof RGBColor) {
		String staticFieldType = importManager.getImportedName("org.eclipse.swt.graphics.Color");
		String staticFieldName = (colorName == null) ? "COLOR" : colorName;
		String staticFieldValue = "new " + staticFieldType + "(null, " + ((RGBColor)colorVal).getRed() + ", " + ((RGBColor)colorVal).getGreen() + ", " + ((RGBColor)colorVal).getBlue() + ")";
%><%=dispatcher.getStaticFieldsManager().addStaticField(staticFieldType, staticFieldName, staticFieldValue)%>
<%	} else if (colorVal instanceof ConstantColor) {%><%=importManager.getImportedName("org.eclipse.draw2d.ColorConstants") + "." + ((ConstantColor) colorVal).getValue().getLiteral()%>
<%	} else {
		throw new IllegalStateException("Unknown color: " + colorVal);
	}
%>

Back to the top