1 package org.eclipse.emf.codegen.ecore.templates.edit; 2 3 import java.util.*; 4 import org.eclipse.emf.codegen.ecore.genmodel.*; 5 6 public class PluginProperties 7 { 8 protected static String nl; 9 public static synchronized PluginProperties create(String lineSeparator) 10 { 11 nl = lineSeparator; 12 PluginProperties result = new PluginProperties(); 13 nl = null; 14 return result; 15 } 16 17 protected final String NL = nl == null ? (System.getProperties().getProperty("line.separator")) : nl; 18 protected final String TEXT_1 = ""; 19 protected final String TEXT_2 = "# <copyright>" + NL + "# </copyright>" + NL + "#" + NL + "# "; 20 protected final String TEXT_3 = "Id"; 21 protected final String TEXT_4 = NL + NL + "# ====================================================================" + NL + "# To code developer:" + NL + "# Do NOT change the properties between this line and the" + NL + "# \"%%% END OF TRANSLATED PROPERTIES %%%\" line." + NL + "# Make a new property name, append to the end of the file and change" + NL + "# the code to use the new property." + NL + "# ====================================================================" + NL + "" + NL + "# ====================================================================" + NL + "# %%% END OF TRANSLATED PROPERTIES %%%" + NL + "# ====================================================================" + NL + "" + NL + "pluginName = "; 22 protected final String TEXT_5 = " Edit Support" + NL + "providerName = www.example.org" + NL; 23 protected final String TEXT_6 = NL + "_UI_CreateChild_text = {0}" + NL + "_UI_CreateChild_text2 = {1} {0}" + NL + "_UI_CreateChild_text3 = {1}" + NL + "_UI_CreateChild_tooltip = Create New {0} Under {1} Feature" + NL + "_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}." + NL + "_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent." + NL; 24 protected final String TEXT_7 = NL + "_UI_PropertyDescriptor_description = The {0} of the {1}" + NL; 25 protected final String TEXT_8 = NL + "_UI_"; 26 protected final String TEXT_9 = "_type = "; 27 protected final String TEXT_10 = NL + "_UI_Unknown_type = Object" + NL + "" + NL + "_UI_Unknown_datatype= Value" + NL; 28 protected final String TEXT_11 = NL + "_UI_"; 29 protected final String TEXT_12 = "_"; 30 protected final String TEXT_13 = "_feature = "; 31 protected final String TEXT_14 = NL + "_UI_"; 32 protected final String TEXT_15 = "_"; 33 protected final String TEXT_16 = "_description = "; 34 protected final String TEXT_17 = NL + "_UI_Unknown_feature = Unspecified" + NL; 35 protected final String TEXT_18 = NL + "_UI_"; 36 protected final String TEXT_19 = "_"; 37 protected final String TEXT_20 = "_literal = "; 38 protected final String TEXT_21 = NL; 39 protected final String TEXT_22 = " = "; 40 protected final String TEXT_23 = NL; 41 42 public String generate(Object argument) 43 { 44 StringBuffer stringBuffer = new StringBuffer (); 45 46 60 61 GenModel genModel = (GenModel)argument; 62 stringBuffer.append(TEXT_1); 63 stringBuffer.append(TEXT_2); 64 stringBuffer.append("$"); 65 stringBuffer.append(TEXT_3); 66 stringBuffer.append("$"); 67 stringBuffer.append(TEXT_4); 68 stringBuffer.append(genModel.getModelName()); 69 stringBuffer.append(TEXT_5); 70 if (genModel.isCreationCommands()) { 71 stringBuffer.append(TEXT_6); 72 } 73 stringBuffer.append(TEXT_7); 74 for (Iterator i=genModel.getAllGenAndUsedGenPackagesWithClassifiers().iterator(); i.hasNext();) { GenPackage genPackage = (GenPackage)i.next(); 75 if (genPackage.getGenModel() == genModel || !genPackage.getGenModel().hasEditSupport()) { 76 for (Iterator j=genPackage.getGenClasses().iterator(); j.hasNext();) { GenClass genClass = (GenClass)j.next(); 77 stringBuffer.append(TEXT_8); 78 stringBuffer.append(genClass.getName()); 79 stringBuffer.append(TEXT_9); 80 stringBuffer.append(genClass.getFormattedName()); 81 } 82 } 83 } 84 stringBuffer.append(TEXT_10); 85 for (Iterator i=genModel.getFilteredAllGenFeatures().iterator(); i.hasNext();) { GenFeature genFeature = (GenFeature)i.next(); String description = genFeature.getPropertyDescription(); 86 stringBuffer.append(TEXT_11); 87 stringBuffer.append(genFeature.getGenClass().getName()); 88 stringBuffer.append(TEXT_12); 89 stringBuffer.append(genFeature.getName()); 90 stringBuffer.append(TEXT_13); 91 stringBuffer.append(genFeature.getFormattedName()); 92 if (description != null && description.length() > 0) { 93 stringBuffer.append(TEXT_14); 94 stringBuffer.append(genFeature.getGenClass().getName()); 95 stringBuffer.append(TEXT_15); 96 stringBuffer.append(genFeature.getName()); 97 stringBuffer.append(TEXT_16); 98 stringBuffer.append(description); 99 } 100 } 101 stringBuffer.append(TEXT_17); 102 for (Iterator i=genModel.getAllGenAndUsedGenPackagesWithClassifiers().iterator(); i.hasNext();) { GenPackage genPackage = (GenPackage)i.next(); 103 if (genPackage.getGenModel() == genModel || !genPackage.getGenModel().hasEditSupport()) { 104 for (Iterator j=genPackage.getGenEnums().iterator(); j.hasNext();) { GenEnum genEnum = (GenEnum)j.next(); 105 for (Iterator k=genEnum.getGenEnumLiterals().iterator(); k.hasNext();) { GenEnumLiteral genEnumLiteral = (GenEnumLiteral)k.next(); 106 stringBuffer.append(TEXT_18); 107 stringBuffer.append(genEnum.getName()); 108 stringBuffer.append(TEXT_19); 109 stringBuffer.append(genEnumLiteral.getName()); 110 stringBuffer.append(TEXT_20); 111 stringBuffer.append(genEnumLiteral.getName()); 112 } 113 } 114 } 115 } 116 for (Iterator i=genModel.getPropertyCategories().iterator(); i.hasNext();) { String category = (String )i.next(); 117 stringBuffer.append(TEXT_21); 118 stringBuffer.append(genModel.getPropertyCategoryKey(category)); 119 stringBuffer.append(TEXT_22); 120 stringBuffer.append(category); 121 } 122 stringBuffer.append(TEXT_23); 123 return stringBuffer.toString(); 124 } 125 } 126 | Popular Tags |