1 17 package org.eclipse.emf.codegen.ecore.genmodel.impl; 18 19 20 import java.lang.reflect.Method ; 21 import java.util.ArrayList ; 22 import java.util.Collection ; 23 import java.util.Collections ; 24 import java.util.HashSet ; 25 import java.util.Iterator ; 26 import java.util.List ; 27 import java.util.ListIterator ; 28 import java.util.Map ; 29 import java.util.Set ; 30 31 import org.eclipse.core.runtime.IProgressMonitor; 32 import org.eclipse.core.runtime.IStatus; 33 import org.eclipse.core.runtime.MultiStatus; 34 import org.eclipse.core.runtime.Path; 35 import org.eclipse.core.runtime.Status; 36 import org.eclipse.core.runtime.SubProgressMonitor; 37 import org.eclipse.jdt.core.ToolFactory; 38 import org.eclipse.jdt.core.formatter.CodeFormatter; 39 40 import org.eclipse.emf.codegen.ecore.CodeGenEcorePlugin; 41 import org.eclipse.emf.codegen.ecore.Generator; 42 import org.eclipse.emf.codegen.ecore.genmodel.GenClass; 43 import org.eclipse.emf.codegen.ecore.genmodel.GenDataType; 44 import org.eclipse.emf.codegen.ecore.genmodel.GenEnum; 45 import org.eclipse.emf.codegen.ecore.genmodel.GenEnumLiteral; 46 import org.eclipse.emf.codegen.ecore.genmodel.GenFeature; 47 import org.eclipse.emf.codegen.ecore.genmodel.GenModel; 48 import org.eclipse.emf.codegen.ecore.genmodel.GenModelFactory; 49 import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage; 50 import org.eclipse.emf.codegen.ecore.genmodel.GenOperation; 51 import org.eclipse.emf.codegen.ecore.genmodel.GenPackage; 52 import org.eclipse.emf.codegen.ecore.genmodel.GenParameter; 53 import org.eclipse.emf.codegen.ecore.genmodel.GenResourceKind; 54 import org.eclipse.emf.codegen.jet.JETCompiler; 55 import org.eclipse.emf.codegen.jet.JETEmitter; 56 import org.eclipse.emf.codegen.jet.JETException; 57 import org.eclipse.emf.codegen.jmerge.JControlModel; 58 import org.eclipse.emf.codegen.util.CodeGenUtil; 59 import org.eclipse.emf.codegen.util.ImportManager; 60 import org.eclipse.emf.common.notify.Notification; 61 import org.eclipse.emf.common.notify.NotificationChain; 62 import org.eclipse.emf.common.util.AbstractTreeIterator; 63 import org.eclipse.emf.common.util.ECollections; 64 import org.eclipse.emf.common.util.EList; 65 import org.eclipse.emf.common.util.TreeIterator; 66 import org.eclipse.emf.common.util.URI; 67 import org.eclipse.emf.common.util.UniqueEList; 68 import org.eclipse.emf.ecore.EClass; 69 import org.eclipse.emf.ecore.EClassifier; 70 import org.eclipse.emf.ecore.EModelElement; 71 import org.eclipse.emf.ecore.EObject; 72 import org.eclipse.emf.ecore.EPackage; 73 import org.eclipse.emf.ecore.EStructuralFeature; 74 import org.eclipse.emf.ecore.EcorePackage; 75 import org.eclipse.emf.ecore.InternalEObject; 76 import org.eclipse.emf.ecore.impl.ENotificationImpl; 77 import org.eclipse.emf.ecore.util.BasicExtendedMetaData; 78 import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; 79 import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; 80 import org.eclipse.emf.ecore.util.EObjectResolvingEList; 81 import org.eclipse.emf.ecore.util.EcoreUtil; 82 import org.eclipse.emf.ecore.util.ExtendedMetaData; 83 import org.eclipse.emf.ecore.util.InternalEList; 84 85 86 140 public class GenModelImpl extends GenBaseImpl implements GenModel 141 { 142 150 protected static final String COPYRIGHT_TEXT_EDEFAULT = null; 151 152 160 protected String copyrightText = COPYRIGHT_TEXT_EDEFAULT; 161 162 170 protected static final String MODEL_DIRECTORY_EDEFAULT = null; 171 172 180 protected String modelDirectory = MODEL_DIRECTORY_EDEFAULT; 181 182 190 protected static final boolean CREATION_COMMANDS_EDEFAULT = true; 191 192 200 protected boolean creationCommands = CREATION_COMMANDS_EDEFAULT; 201 202 210 protected static final boolean CREATION_ICONS_EDEFAULT = true; 211 212 220 protected boolean creationIcons = CREATION_ICONS_EDEFAULT; 221 222 230 protected static final String EDIT_DIRECTORY_EDEFAULT = null; 231 232 240 protected String editDirectory = EDIT_DIRECTORY_EDEFAULT; 241 242 249 protected boolean editDirectoryESet = false; 250 251 259 protected static final String EDITOR_DIRECTORY_EDEFAULT = null; 260 261 269 protected String editorDirectory = EDITOR_DIRECTORY_EDEFAULT; 270 271 278 protected boolean editorDirectoryESet = false; 279 280 288 protected static final String MODEL_PLUGIN_ID_EDEFAULT = null; 289 290 298 protected String modelPluginID = MODEL_PLUGIN_ID_EDEFAULT; 299 300 308 protected static final String TEMPLATE_DIRECTORY_EDEFAULT = null; 309 310 318 protected String templateDirectory = TEMPLATE_DIRECTORY_EDEFAULT; 319 320 328 protected static final boolean RUNTIME_JAR_EDEFAULT = false; 329 330 338 protected boolean runtimeJar = RUNTIME_JAR_EDEFAULT; 339 340 348 protected EList foreignModel = null; 349 350 358 protected static final boolean DYNAMIC_TEMPLATES_EDEFAULT = false; 359 360 368 protected boolean dynamicTemplates = DYNAMIC_TEMPLATES_EDEFAULT; 369 370 378 protected static final String REDIRECTION_EDEFAULT = null; 379 380 388 protected String redirection = REDIRECTION_EDEFAULT; 389 390 398 protected static final boolean FORCE_OVERWRITE_EDEFAULT = false; 399 400 408 protected boolean forceOverwrite = FORCE_OVERWRITE_EDEFAULT; 409 410 418 protected static final String NON_EXTERNALIZED_STRING_TAG_EDEFAULT = null; 419 420 428 protected String nonExternalizedStringTag = NON_EXTERNALIZED_STRING_TAG_EDEFAULT; 429 430 438 protected static final String MODEL_NAME_EDEFAULT = null; 439 440 448 protected String modelName = MODEL_NAME_EDEFAULT; 449 450 458 protected static final String MODEL_PLUGIN_CLASS_EDEFAULT = null; 459 460 468 protected String modelPluginClass = MODEL_PLUGIN_CLASS_EDEFAULT; 469 470 478 protected static final String EDIT_PLUGIN_CLASS_EDEFAULT = null; 479 480 488 protected String editPluginClass = EDIT_PLUGIN_CLASS_EDEFAULT; 489 490 497 protected boolean editPluginClassESet = false; 498 499 507 protected static final String EDITOR_PLUGIN_CLASS_EDEFAULT = null; 508 509 517 protected String editorPluginClass = EDITOR_PLUGIN_CLASS_EDEFAULT; 518 519 526 protected boolean editorPluginClassESet = false; 527 528 536 protected static final boolean UPDATE_CLASSPATH_EDEFAULT = true; 537 538 546 protected boolean updateClasspath = UPDATE_CLASSPATH_EDEFAULT; 547 548 556 protected static final boolean GENERATE_SCHEMA_EDEFAULT = false; 557 558 566 protected boolean generateSchema = GENERATE_SCHEMA_EDEFAULT; 567 568 576 protected static final boolean NON_NLS_MARKERS_EDEFAULT = false; 577 578 586 protected boolean nonNLSMarkers = NON_NLS_MARKERS_EDEFAULT; 587 588 596 protected EList staticPackages = null; 597 598 606 protected EList modelPluginVariables = null; 607 608 616 protected static final String ROOT_EXTENDS_INTERFACE_EDEFAULT = "org.eclipse.emf.ecore.EObject"; 617 618 626 protected String rootExtendsInterface = ROOT_EXTENDS_INTERFACE_EDEFAULT; 627 628 636 protected static final String ROOT_EXTENDS_CLASS_EDEFAULT = "org.eclipse.emf.ecore.impl.EObjectImpl"; 637 638 646 protected String rootExtendsClass = ROOT_EXTENDS_CLASS_EDEFAULT; 647 648 656 protected static final String ROOT_IMPLEMENTS_INTERFACE_EDEFAULT = null; 657 658 666 protected String rootImplementsInterface = ROOT_IMPLEMENTS_INTERFACE_EDEFAULT; 667 668 676 protected static final boolean SUPPRESS_EMF_TYPES_EDEFAULT = false; 677 678 686 protected boolean suppressEMFTypes = SUPPRESS_EMF_TYPES_EDEFAULT; 687 688 696 protected static final String FEATURE_MAP_WRAPPER_INTERFACE_EDEFAULT = null; 697 698 706 protected String featureMapWrapperInterface = FEATURE_MAP_WRAPPER_INTERFACE_EDEFAULT; 707 708 716 protected static final String FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE_EDEFAULT = null; 717 718 726 protected String featureMapWrapperInternalInterface = FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE_EDEFAULT; 727 728 736 protected static final String FEATURE_MAP_WRAPPER_CLASS_EDEFAULT = null; 737 738 746 protected String featureMapWrapperClass = FEATURE_MAP_WRAPPER_CLASS_EDEFAULT; 747 748 756 protected static final boolean RUNTIME_COMPATIBILITY_EDEFAULT = false; 757 758 766 protected boolean runtimeCompatibility = RUNTIME_COMPATIBILITY_EDEFAULT; 767 768 776 protected static final boolean RICH_CLIENT_PLATFORM_EDEFAULT = false; 777 778 786 protected boolean richClientPlatform = RICH_CLIENT_PLATFORM_EDEFAULT; 787 788 796 protected static final boolean REFLECTIVE_DELEGATION_EDEFAULT = false; 797 798 806 protected boolean reflectiveDelegation = REFLECTIVE_DELEGATION_EDEFAULT; 807 808 816 protected static final boolean CODE_FORMATTING_EDEFAULT = false; 817 818 826 protected boolean codeFormatting = CODE_FORMATTING_EDEFAULT; 827 828 836 protected static final String TESTS_DIRECTORY_EDEFAULT = null; 837 838 846 protected String testsDirectory = TESTS_DIRECTORY_EDEFAULT; 847 848 855 protected boolean testsDirectoryESet = false; 856 857 865 protected static final String TEST_SUITE_CLASS_EDEFAULT = null; 866 867 875 protected String testSuiteClass = TEST_SUITE_CLASS_EDEFAULT; 876 877 884 protected boolean testSuiteClassESet = false; 885 886 894 protected static final String BOOLEAN_FLAGS_FIELD_EDEFAULT = null; 895 896 904 protected String booleanFlagsField = BOOLEAN_FLAGS_FIELD_EDEFAULT; 905 906 914 protected static final int BOOLEAN_FLAGS_RESERVED_BITS_EDEFAULT = -1; 915 916 924 protected int booleanFlagsReservedBits = BOOLEAN_FLAGS_RESERVED_BITS_EDEFAULT; 925 926 934 protected static final String IMPORTER_ID_EDEFAULT = null; 935 936 944 protected String importerID = IMPORTER_ID_EDEFAULT; 945 946 954 protected static final boolean BUNDLE_MANIFEST_EDEFAULT = true; 955 956 964 protected boolean bundleManifest = BUNDLE_MANIFEST_EDEFAULT; 965 966 974 protected EList genPackages = null; 975 976 protected EList staticGenPackages = null; 977 978 986 protected EList usedGenPackages = null; 987 988 993 protected GenModelImpl() 994 { 995 super(); 996 } 997 998 1003 protected EClass eStaticClass() 1004 { 1005 return GenModelPackage.eINSTANCE.getGenModel(); 1006 } 1007 1008 1013 public String getCopyrightText() 1014 { 1015 return copyrightText; 1016 } 1017 1018 1023 public void setCopyrightText(String newCopyrightText) 1024 { 1025 String oldCopyrightText = copyrightText; 1026 copyrightText = newCopyrightText; 1027 if (eNotificationRequired()) 1028 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__COPYRIGHT_TEXT, oldCopyrightText, copyrightText)); 1029 } 1030 1031 protected String getSourceFragmentPath() 1032 { 1033 return "src"; 1034 } 1035 1036 1037 1042 public String getModelDirectory() 1043 { 1044 return modelDirectory; 1045 } 1046 1047 1052 public String getModelDirectoryGen() 1053 { 1054 return modelDirectory; 1055 } 1056 1057 1062 public void setModelDirectory(String newModelDirectory) 1063 { 1064 String oldModelDirectory = modelDirectory; 1065 modelDirectory = newModelDirectory; 1066 if (eNotificationRequired()) 1067 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__MODEL_DIRECTORY, oldModelDirectory, modelDirectory)); 1068 } 1069 1070 1075 public boolean isCreationCommands() 1076 { 1077 return creationCommands; 1078 } 1079 1080 1085 public void setCreationCommands(boolean newCreationCommands) 1086 { 1087 boolean oldCreationCommands = creationCommands; 1088 creationCommands = newCreationCommands; 1089 if (eNotificationRequired()) 1090 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__CREATION_COMMANDS, oldCreationCommands, creationCommands)); 1091 } 1092 1093 1098 public boolean isCreationIcons() 1099 { 1100 return creationIcons; 1101 } 1102 1103 1108 public void setCreationIcons(boolean newCreationIcons) 1109 { 1110 boolean oldCreationIcons = creationIcons; 1111 creationIcons = newCreationIcons; 1112 if (eNotificationRequired()) 1113 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__CREATION_ICONS, oldCreationIcons, creationIcons)); 1114 } 1115 1116 protected ImportManager importManager; 1117 protected StringBuffer importStringBuffer; 1118 protected int importInsertionPoint; 1119 protected boolean canGenerate; 1120 1121 public void markImportLocation(StringBuffer stringBuffer, GenPackage genPackage) 1122 { 1123 markImportLocation(stringBuffer); 1124 importManager.addJavaLangImports(genPackage.getJavaLangConflicts()); 1125 } 1126 1127 public void markImportLocation(StringBuffer stringBuffer) 1128 { 1129 importStringBuffer = stringBuffer; 1130 importInsertionPoint = stringBuffer.length(); 1131 importManager.addCompilationUnitImports(stringBuffer.toString()); 1132 } 1133 1134 public void emitSortedImports() 1135 { 1136 importStringBuffer.insert(importInsertionPoint, importManager.computeSortedImports()); 1137 } 1138 1139 public String getImportedName(String qualifiedName) 1140 { 1141 int index = qualifiedName.indexOf("$"); 1142 importManager.addImport(index == -1 ? qualifiedName : qualifiedName.substring(0, index)); 1143 return importManager.getImportedName(qualifiedName); 1144 } 1145 1146 public void addImport(String qualifiedName) 1147 { 1148 importManager.addImport(qualifiedName); 1149 } 1150 1151 public void addPseudoImport(String qualifiedName) 1152 { 1153 importManager.addPseudoImport(qualifiedName); 1154 } 1155 1156 protected ImportManager getImportManager() 1157 { 1158 return importManager; 1159 } 1160 1161 protected void setImportManager(ImportManager importManager) 1162 { 1163 this.importManager = importManager; 1164 1165 for (Iterator iter = getUsedGenPackages().iterator(); iter.hasNext(); ) 1166 { 1167 GenBaseImpl genPackage = (GenBaseImpl)iter.next(); 1168 genPackage.setImportManager(importManager); } 1170 1171 for (Iterator iter = getStaticGenPackages().iterator(); iter.hasNext(); ) 1172 { 1173 GenBaseImpl genPackage = (GenBaseImpl)iter.next(); 1174 genPackage.setImportManager(importManager); } 1176 } 1177 1178 public String getDriverNumber() 1179 { 1180 return null; 1183 } 1184 1185 public String getDate() 1186 { 1187 return null; 1190 } 1191 1192 public String getNonNLS() 1193 { 1194 return isNonNLSMarkers() ? " //$NON-NLS-1$" : ""; 1195 } 1196 1197 public String getNonNLS(int i) 1198 { 1199 if (isNonNLSMarkers()) 1200 { 1201 StringBuffer result = new StringBuffer (15); 1202 result.append(" //$NON-NLS-"); 1203 result.append(i); 1204 result.append('$'); 1205 return result.toString(); 1206 } 1207 return ""; 1208 } 1209 1210 public String getNonNLS(String s) 1211 { 1212 return getNonNLS(s, 1); 1213 } 1214 1215 public String getNonNLS(String s, int i) 1216 { 1217 if (s == null) return ""; 1218 1219 StringBuffer result = new StringBuffer (15); 1220 boolean openQuote = true; 1221 int j = s.indexOf('\"'); 1222 1223 while (j != -1) 1224 { 1225 if (openQuote) result.append(getNonNLS(i++)); 1226 openQuote = !openQuote; 1227 j = s.indexOf('\"', j + 1); 1228 } 1229 return result.toString(); 1230 } 1231 1232 public void initialize(Collection ePackages) 1233 { 1234 LOOP: 1235 for (Iterator iter = ePackages.iterator(); iter.hasNext(); ) 1236 { 1237 EPackage ePackage = (EPackage)iter.next(); 1238 1239 for (Iterator j = getGenPackages().iterator(); j.hasNext(); ) 1240 { 1241 GenPackage genPackage = (GenPackage)j.next(); 1242 if (genPackage.getEcorePackage() == ePackage) 1243 { 1244 genPackage.initialize(ePackage); 1245 continue LOOP; 1246 } 1247 } 1248 1249 GenPackage genPackage = createGenPackage(); 1250 getGenPackages().add(genPackage); 1251 genPackage.initialize(ePackage); 1252 } 1253 } 1254 1255 protected String jControlModelName = "emf-merge.xml"; 1256 1257 protected String interfaceTemplateName = "model/Interface.javajet"; 1258 protected String classTemplateName = "model/Class.javajet"; 1259 protected String enumClassTemplateName = "model/EnumClass.javajet"; 1260 protected String packageInterfaceTemplateName = "model/PackageInterface.javajet"; 1261 protected String packageClassTemplateName = "model/PackageClass.javajet"; 1262 protected String factoryInterfaceTemplateName = "model/FactoryInterface.javajet"; 1263 protected String factoryClassTemplateName = "model/FactoryClass.javajet"; 1264 protected String adapterFactoryClassTemplateName = "model/AdapterFactoryClass.javajet"; 1265 protected String switchClassTemplateName = "model/SwitchClass.javajet"; 1266 protected String validatorSwitchClassTemplateName = "model/ValidatorClass.javajet"; 1267 protected String pluginXMLTemplateName = "model/plugin.xmljet"; 1268 protected String manifestMFTemplateName = "model/manifest.mfjet"; 1269 protected String pluginPropertiesTemplateName = "model/plugin.propertiesjet"; 1270 protected String buildPropertiesTemplateName = "model/build.propertiesjet"; 1271 protected String modelPluginTemplateName = "model/Plugin.javajet"; 1272 protected String resourceTemplateName = "model/ResourceClass.javajet"; 1273 protected String resourceFactoryTemplateName = "model/ResourceFactoryClass.javajet"; 1274 1275 protected String [] templatePath = null; 1276 1277 protected JControlModel jControlModel = null; 1278 1279 protected JETEmitter interfaceEmitter = null; 1280 protected JETEmitter classEmitter = null; 1281 protected JETEmitter enumClassEmitter = null; 1282 protected JETEmitter packageInterfaceEmitter = null; 1283 protected JETEmitter packageClassEmitter = null; 1284 protected JETEmitter factoryInterfaceEmitter = null; 1285 protected JETEmitter factoryClassEmitter = null; 1286 protected JETEmitter adapterFactoryClassEmitter = null; 1287 protected JETEmitter switchClassEmitter = null; 1288 protected JETEmitter validatorSwitchClassEmitter = null; 1289 protected JETEmitter pluginXMLEmitter = null; 1290 protected JETEmitter manifestMFEmitter = null; 1291 protected JETEmitter pluginPropertiesEmitter = null; 1292 protected JETEmitter buildPropertiesEmitter = null; 1293 protected JETEmitter modelPluginClassEmitter = null; 1294 protected JETEmitter resourceClassEmitter = null; 1295 protected JETEmitter resourceFactoryClassEmitter = null; 1296 1297 protected String [] getTemplatePath() 1298 { 1299 if (templatePath == null) 1300 { 1301 templatePath = new String [2]; 1302 } 1303 String theTemplateDirectory = getTemplateDirectory(); 1304 templatePath[0] = 1305 !isDynamicTemplates() ? 1306 null : 1307 theTemplateDirectory != null && theTemplateDirectory.indexOf(":") == -1 ? 1308 URI.createPlatformResourceURI(theTemplateDirectory).toString() : 1309 theTemplateDirectory; 1310 templatePath[1] = CodeGenEcorePlugin.INSTANCE.getBaseURL().toString() + "templates"; 1311 return templatePath; 1312 } 1313 1314 public JControlModel getJControlModel() 1315 { 1316 if (jControlModel == null) 1317 { 1318 jControlModel = new JControlModel(JETCompiler.find(getTemplatePath(), jControlModelName)); 1319 } 1320 return jControlModel; 1321 } 1322 1323 public static final Class [] OBJECT_ARGUMENT = new Class [ ] { Object .class }; 1324 public void setMethod(JETEmitter jetEmitter, String className) 1325 { 1326 if (!isDynamicTemplates()) 1327 { 1328 try 1329 { 1330 Class emitterClass = getClass().getClassLoader().loadClass(className); 1331 Method emitterMethod = emitterClass.getDeclaredMethod("generate", OBJECT_ARGUMENT); 1332 jetEmitter.setMethod(emitterMethod); 1333 } 1334 catch (Exception exception) 1335 { 1336 } 1339 } 1340 } 1341 1342 protected JETEmitter createJETEmitter(String relativeTemplateURI) 1343 { 1344 JETEmitter jetEmitter = 1345 new JETEmitter(getTemplatePath(), relativeTemplateURI, getClass().getClassLoader()) 1346 { 1347 public void initialize(IProgressMonitor progressMonitor) throws JETException 1348 { 1349 if (getClasspathEntries().isEmpty()) 1350 { 1351 addClasspathEntries(this); 1352 } 1353 super.initialize(progressMonitor); 1354 } 1355 }; 1356 return jetEmitter; 1357 } 1358 1359 protected void addClasspathEntries(JETEmitter jetEmitter) throws JETException 1360 { 1361 jetEmitter.addVariable("EMF_CODEGEN", "org.eclipse.emf.codegen"); 1362 jetEmitter.addVariable("EMF_CODEGEN_ECORE", "org.eclipse.emf.codegen.ecore"); 1363 jetEmitter.addVariable("EMF_COMMON", "org.eclipse.emf.common"); 1364 jetEmitter.addVariable("EMF_ECORE", "org.eclipse.emf.ecore"); 1365 } 1366 1367 public JETEmitter getInterfaceEmitter() 1368 { 1369 if (interfaceEmitter == null) 1370 { 1371 interfaceEmitter = createJETEmitter(interfaceTemplateName); 1372 setMethod(interfaceEmitter, "org.eclipse.emf.codegen.ecore.templates.model.Interface"); 1373 } 1374 return interfaceEmitter; 1375 } 1376 1377 public JETEmitter getClassEmitter() 1378 { 1379 if (classEmitter == null) 1380 { 1381 classEmitter = createJETEmitter(classTemplateName); 1382 setMethod(classEmitter, "org.eclipse.emf.codegen.ecore.templates.model.Class"); 1383 } 1384 return classEmitter; 1385 } 1386 1387 public JETEmitter getEnumClassEmitter() 1388 { 1389 if (enumClassEmitter == null) 1390 { 1391 enumClassEmitter = createJETEmitter(enumClassTemplateName); 1392 setMethod(enumClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.EnumClass"); 1393 } 1394 return enumClassEmitter; 1395 } 1396 1397 public JETEmitter getFactoryInterfaceEmitter() 1398 { 1399 if (factoryInterfaceEmitter == null) 1400 { 1401 factoryInterfaceEmitter = createJETEmitter(factoryInterfaceTemplateName); 1402 setMethod(factoryInterfaceEmitter, "org.eclipse.emf.codegen.ecore.templates.model.FactoryInterface"); 1403 } 1404 return factoryInterfaceEmitter; 1405 } 1406 1407 public JETEmitter getFactoryClassEmitter() 1408 { 1409 if (factoryClassEmitter == null) 1410 { 1411 factoryClassEmitter = createJETEmitter(factoryClassTemplateName); 1412 setMethod(factoryClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.FactoryClass"); 1413 } 1414 return factoryClassEmitter; 1415 } 1416 1417 public JETEmitter getPackageInterfaceEmitter() 1418 { 1419 if (packageInterfaceEmitter == null) 1420 { 1421 packageInterfaceEmitter = createJETEmitter(packageInterfaceTemplateName); 1422 setMethod(packageInterfaceEmitter, "org.eclipse.emf.codegen.ecore.templates.model.PackageInterface"); 1423 } 1424 return packageInterfaceEmitter; 1425 } 1426 1427 public JETEmitter getPackageClassEmitter() 1428 { 1429 if (packageClassEmitter == null) 1430 { 1431 packageClassEmitter = createJETEmitter(packageClassTemplateName); 1432 setMethod(packageClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.PackageClass"); 1433 } 1434 return packageClassEmitter; 1435 } 1436 1437 public JETEmitter getAdapterFactoryClassEmitter() 1438 { 1439 if (adapterFactoryClassEmitter == null) 1440 { 1441 adapterFactoryClassEmitter = createJETEmitter(adapterFactoryClassTemplateName); 1442 setMethod(adapterFactoryClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.AdapterFactoryClass"); 1443 } 1444 return adapterFactoryClassEmitter; 1445 } 1446 1447 public JETEmitter getSwitchClassEmitter() 1448 { 1449 if (switchClassEmitter == null) 1450 { 1451 switchClassEmitter = createJETEmitter(switchClassTemplateName); 1452 setMethod(switchClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.SwitchClass"); 1453 } 1454 return switchClassEmitter; 1455 } 1456 1457 public JETEmitter getValidatorClassEmitter() 1458 { 1459 if (validatorSwitchClassEmitter == null) 1460 { 1461 validatorSwitchClassEmitter = createJETEmitter(validatorSwitchClassTemplateName); 1462 setMethod(validatorSwitchClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.ValidatorClass"); 1463 } 1464 return validatorSwitchClassEmitter; 1465 } 1466 1467 public JETEmitter getPluginXMLEmitter() 1468 { 1469 if (pluginXMLEmitter == null) 1470 { 1471 pluginXMLEmitter = createJETEmitter(pluginXMLTemplateName); 1472 setMethod(pluginXMLEmitter, "org.eclipse.emf.codegen.ecore.templates.model.PluginXML"); 1473 } 1474 return pluginXMLEmitter; 1475 } 1476 1477 public JETEmitter getManifestMFEmitter() 1478 { 1479 if (manifestMFEmitter == null) 1480 { 1481 manifestMFEmitter = createJETEmitter(manifestMFTemplateName); 1482 setMethod(manifestMFEmitter, "org.eclipse.emf.codegen.ecore.templates.model.ManifestMF"); 1483 } 1484 return manifestMFEmitter; 1485 } 1486 1487 public JETEmitter getPluginPropertiesEmitter() 1488 { 1489 if (pluginPropertiesEmitter == null) 1490 { 1491 pluginPropertiesEmitter = createJETEmitter(pluginPropertiesTemplateName); 1492 setMethod(pluginPropertiesEmitter, "org.eclipse.emf.codegen.ecore.templates.model.PluginProperties"); 1493 } 1494 return pluginPropertiesEmitter; 1495 } 1496 1497 public JETEmitter getBuildPropertiesEmitter() 1498 { 1499 if (buildPropertiesEmitter == null) 1500 { 1501 buildPropertiesEmitter = createJETEmitter(buildPropertiesTemplateName); 1502 setMethod(buildPropertiesEmitter, "org.eclipse.emf.codegen.ecore.templates.model.BuildProperties"); 1503 } 1504 return buildPropertiesEmitter; 1505 } 1506 1507 public JETEmitter getModelPluginClassEmitter() 1508 { 1509 if (modelPluginClassEmitter == null) 1510 { 1511 modelPluginClassEmitter = createJETEmitter(modelPluginTemplateName); 1512 setMethod(modelPluginClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.Plugin"); 1513 } 1514 return modelPluginClassEmitter; 1515 } 1516 1517 public JETEmitter getResourceClassEmitter() 1518 { 1519 if (resourceClassEmitter == null) 1520 { 1521 resourceClassEmitter = createJETEmitter(resourceTemplateName); 1522 setMethod(resourceClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.ResourceClass"); 1523 } 1524 return resourceClassEmitter; 1525 } 1526 1527 public JETEmitter getResourceFactoryClassEmitter() 1528 { 1529 if (resourceFactoryClassEmitter == null) 1530 { 1531 resourceFactoryClassEmitter = createJETEmitter(resourceFactoryTemplateName); 1532 setMethod(resourceFactoryClassEmitter, "org.eclipse.emf.codegen.ecore.templates.model.ResourceFactoryClass"); 1533 } 1534 return resourceFactoryClassEmitter; 1535 } 1536 1537 protected boolean hasModelSupport() 1538 { 1539 return !isBlank(getModelDirectory()); 1540 } 1542 1543 public boolean canGenerate() 1544 { 1545 return canGenerate && hasModelSupport(); 1546 } 1547 1548 public void setCanGenerate(boolean canGenerate) 1549 { 1550 this.canGenerate = canGenerate; 1551 } 1552 1553 public IStatus validate() 1554 { 1555 MultiStatus status = 1556 new MultiStatus 1557 (CodeGenEcorePlugin.INSTANCE.getSymbolicName(), 1558 0, 1559 CodeGenEcorePlugin.INSTANCE.getString("_UI_ProblemsEncounteredInTheModel_message"), 1560 null); 1561 1562 List all = new ArrayList (getGenPackages()); 1563 1564 all.addAll(getUsedGenPackages()); 1565 for (Iterator i = new ArrayList (all).iterator(); i.hasNext(); ) 1566 { 1567 GenPackage genPackage = (GenPackage)i.next(); 1568 EObject root = EcoreUtil.getRootContainer(genPackage.getEcorePackage()); 1569 if (!all.contains(root)) 1570 { 1571 all.add(root); 1572 } 1573 } 1574 1575 Map map = EcoreUtil.UnresolvedProxyCrossReferencer.find(all); 1576 if (!map.isEmpty()) 1577 { 1578 for (Iterator i = map.entrySet().iterator(); i.hasNext(); ) 1579 { 1580 Map.Entry entry = (Map.Entry )i.next(); 1581 EObject unresolvedProxy = (EObject)entry.getKey(); 1582 1583 MultiStatus nestedStatus = 1584 new MultiStatus 1585 (CodeGenEcorePlugin.INSTANCE.getSymbolicName(), 1586 0, 1587 CodeGenEcorePlugin.INSTANCE.getString 1588 ("_UI_UnableToResolveProxy_message", new Object [] { EcoreUtil.getURI(unresolvedProxy) }), 1589 null); 1590 1591 for (Iterator j = ((List )entry.getValue()).iterator(); j.hasNext(); ) 1592 { 1593 EStructuralFeature.Setting setting = (EStructuralFeature.Setting)j.next(); 1594 nestedStatus.add 1595 (new Status 1596 (IStatus.ERROR, 1597 CodeGenEcorePlugin.INSTANCE.getSymbolicName(), 1598 0, 1599 CodeGenEcorePlugin.INSTANCE.getString 1600 ("_UI_ItsUseIsBy_message", new Object [] { EcoreUtil.getURI(setting.getEObject()) }), 1601 null)); 1602 } 1603 1604 status.add(nestedStatus); 1605 } 1606 } 1607 else 1608 { 1609 List referencedEPackages = new UniqueEList(); 1610 for (Iterator i = all.iterator(); i.hasNext(); ) 1611 { 1612 Object object = i.next(); 1613 if (object instanceof EPackage) 1614 { 1615 EPackage ePackage = (EPackage)object; 1616 for (Iterator j = ePackage.eAllContents(); j.hasNext();) 1617 { 1618 EObject eObject = (EObject)j.next(); 1619 for (Iterator k = eObject.eCrossReferences().iterator(); k.hasNext(); ) 1620 { 1621 Object o = k.next(); 1622 if (o instanceof EClassifier) 1623 { 1624 EClassifier eClassifier = (EClassifier)o; 1625 referencedEPackages.add(eClassifier.getEPackage()); 1626 } 1627 } 1628 } 1629 } 1630 } 1631 1632 for (Iterator i = referencedEPackages.iterator(); i.hasNext(); ) 1633 { 1634 EPackage ePackage = (EPackage)i.next(); 1635 GenPackage genPackage = findGenPackage(ePackage); 1636 if (genPackage == null) 1637 { 1638 status.add 1639 (new Status 1640 (IStatus.ERROR, 1641 CodeGenEcorePlugin.INSTANCE.getSymbolicName(), 1642 0, 1643 CodeGenEcorePlugin.INSTANCE.getString("_UI_ThePackageIsNeeded_message", new Object [] { EcoreUtil.getURI(ePackage) }), 1644 null)); 1645 } 1646 else if (genPackage.getEcorePackage() != ePackage) 1647 { 1648 status.add 1649 (new Status 1650 (IStatus.ERROR, 1651 CodeGenEcorePlugin.INSTANCE.getSymbolicName(), 1652 0, 1653 CodeGenEcorePlugin.INSTANCE.getString 1654 ("_UI_ThePackageHasTheSameNamespaceURI", 1655 new Object [] { EcoreUtil.getURI(ePackage), ePackage.getNsURI(), EcoreUtil.getURI(genPackage.getEcorePackage()) }), 1656 null)); 1657 } 1658 } 1659 } 1660 1661 return status; 1662 } 1663 1664 protected ExtendedMetaData extendedMetaData; 1665 public ExtendedMetaData getExtendedMetaData() 1666 { 1667 if (extendedMetaData == null) 1668 { 1669 extendedMetaData = 1670 eResource() == null || eResource().getResourceSet() == null ? 1671 ExtendedMetaData.INSTANCE : 1672 new BasicExtendedMetaData(eResource().getResourceSet().getPackageRegistry()); 1673 populateExtendedMetaData(getGenPackages()); 1674 populateExtendedMetaData(getStaticGenPackages()); 1675 populateExtendedMetaData(getUsedGenPackages()); 1676 } 1677 return extendedMetaData; 1678 } 1679 1680 protected void populateExtendedMetaData(List genPackages) 1681 { 1682 for (Iterator i = genPackages.iterator(); i.hasNext(); ) 1683 { 1684 GenPackage genPackage = (GenPackage)i.next(); 1685 EPackage ePackage = genPackage.getEcorePackage(); 1686 if (ePackage != null) { 1688 if (!EcorePackage.eNS_URI.equals(ePackage.getNsURI()) && ! GenModelPackage.eNS_URI.equals(ePackage.getNsURI())) 1689 { 1690 extendedMetaData.putPackage(ePackage.getNsURI(), ePackage); 1691 } 1692 populateExtendedMetaData(genPackage.getSubGenPackages()); 1693 } 1694 } 1695 } 1696 1697 public boolean hasPluginSupport() 1698 { 1699 return !isBlank(getModelPluginID()); 1700 } 1701 1702 public void generate(IProgressMonitor progressMonitor) 1703 { 1704 try 1705 { 1706 if (!canGenerate()) return; 1707 1708 getStaticGenPackages(); 1709 1710 progressMonitor.beginTask("", getGenPackages().size() + 3); 1711 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingPackages_message")); 1712 1713 if (isUpdateClasspath()) 1716 { 1717 findOrCreateContainer 1718 (new SubProgressMonitor(progressMonitor, 1), 1719 Generator.EMF_MODEL_PROJECT_STYLE, 1720 getEffectiveModelPluginVariables(), 1721 new Path(getModelDirectory()), true); 1722 } 1723 1724 for (Iterator iter = getGenPackages().iterator(); iter.hasNext(); ) 1725 { 1726 GenPackage genPackage = (GenPackage)iter.next(); 1727 progressMonitor.subTask 1728 (CodeGenEcorePlugin.INSTANCE.getString 1729 ("_UI_GeneratingJavaPackage_message", new Object [] { genPackage.getInterfacePackageName() })); 1730 genPackage.generate(new SubProgressMonitor(progressMonitor, 1)); 1731 } 1732 1733 if (hasModelPluginClass()) 1734 { 1735 progressMonitor.subTask 1736 (CodeGenEcorePlugin.INSTANCE.getString 1737 ("_UI_GeneratingJavaClass_message", new Object [] { getQualifiedModelPluginClassName() })); 1738 generate 1739 (new SubProgressMonitor(progressMonitor, 1), 1740 Generator.EMF_MODEL_PROJECT_STYLE, 1741 getEffectiveModelPluginVariables(), 1742 getModelDirectory(), 1743 getModelPluginPackageName(), 1744 getModelPluginClassName(), 1745 getModelPluginClassEmitter()); 1746 } 1747 1748 if (hasPluginSupport()) 1749 { 1750 if (!sameModelEditProject() && !sameModelEditorProject()) 1751 { 1752 if (isBundleManifest()) 1753 { 1754 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingModelManifestMF_message")); 1755 generate 1756 (new SubProgressMonitor(progressMonitor, 1), 1757 Generator.EMF_MODEL_PROJECT_STYLE, 1758 getEffectiveModelPluginVariables(), 1759 getModelProjectDirectory() + "/META-INF/MANIFEST.MF", 1760 getManifestMFEmitter()); 1761 } 1762 1763 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingModelPluginXML_message")); 1764 generate 1765 (new SubProgressMonitor(progressMonitor, 1), 1766 Generator.EMF_MODEL_PROJECT_STYLE, 1767 getEffectiveModelPluginVariables(), 1768 getModelProjectDirectory() + "/plugin.xml", 1769 getPluginXMLEmitter()); 1770 } 1771 1772 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingModelPluginProperties_message")); 1773 generate 1774 (new SubProgressMonitor(progressMonitor, 1), 1775 Generator.EMF_MODEL_PROJECT_STYLE, 1776 getEffectiveModelPluginVariables(), 1777 getModelProjectDirectory() + "/plugin.properties", 1778 getPluginPropertiesEmitter()); 1779 1780 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingModelBuildProperties_message")); 1781 generate 1782 (new SubProgressMonitor(progressMonitor, 1), 1783 Generator.EMF_MODEL_PROJECT_STYLE, 1784 getEffectiveModelPluginVariables(), 1785 getModelProjectDirectory() + "/build.properties", 1786 getBuildPropertiesEmitter()); 1787 } 1788 } 1789 finally 1790 { 1791 progressMonitor.done(); 1792 } 1793 } 1794 1795 public boolean hasEditSupport() 1796 { 1797 return 1798 hasPluginSupport() && 1799 !isBlank(getEditPluginClassToUse()) && 1800 !isBlank(getEditDirectory()); 1801 } 1802 1803 public boolean canGenerateEdit() 1804 { 1805 return canGenerate && hasEditSupport(); 1806 } 1807 1808 public void generateEdit(IProgressMonitor progressMonitor) 1809 { 1810 try 1811 { 1812 if (!canGenerateEdit()) return; 1813 1814 getStaticGenPackages(); 1815 1816 progressMonitor.beginTask("", getGenPackages().size() + 1); 1817 1818 if (isUpdateClasspath()) 1821 { 1822 findOrCreateContainer 1823 (new SubProgressMonitor(progressMonitor, 1), 1824 Generator.EMF_EDIT_PROJECT_STYLE, 1825 getEffectiveModelPluginVariables(), 1826 new Path(getEditDirectory()), 1827 true); 1828 } 1829 1830 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditPackages_message")); 1831 for (Iterator iter = getGenPackages().iterator(); iter.hasNext(); ) 1832 { 1833 GenPackage genPackage = (GenPackage)iter.next(); 1834 progressMonitor.subTask 1835 (CodeGenEcorePlugin.INSTANCE.getString 1836 ("_UI_GeneratingJavaPackage_message", new Object [] { genPackage.getInterfacePackageName() })); 1837 genPackage.generateEdit(new SubProgressMonitor(progressMonitor, 1)); 1838 } 1839 1840 if (!sameEditEditorProject()) 1841 { 1842 progressMonitor.subTask 1843 (CodeGenEcorePlugin.INSTANCE.getString 1844 ("_UI_GeneratingJavaClass_message", new Object [] { getQualifiedEditPluginClassName() })); 1845 generate 1846 (new SubProgressMonitor(progressMonitor, 1), 1847 Generator.EMF_EDIT_PROJECT_STYLE, 1848 getEffectiveModelPluginVariables(), 1849 getEditPluginDirectory(), 1850 getEditPluginPackageName(), 1851 getEditPluginClassName(), 1852 getEditPluginClassEmitter()); 1853 1854 if (isBundleManifest()) 1855 { 1856 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditManifestMF_message")); 1857 generate 1858 (new SubProgressMonitor(progressMonitor, 1), 1859 Generator.EMF_EDIT_PROJECT_STYLE, 1860 getEffectiveModelPluginVariables(), 1861 getEditProjectDirectory() + "/META-INF/MANIFEST.MF", 1862 getEditManifestMFEmitter()); 1863 } 1864 1865 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditPluginXML_message")); 1866 generate 1867 (new SubProgressMonitor(progressMonitor, 1), 1868 Generator.EMF_EDIT_PROJECT_STYLE, 1869 getEffectiveModelPluginVariables(), 1870 getEditProjectDirectory() + "/plugin.xml", 1871 getEditPluginXMLEmitter()); 1872 } 1873 1874 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditPluginProperties_message")); 1875 generate 1876 (new SubProgressMonitor(progressMonitor, 1), 1877 Generator.EMF_EDIT_PROJECT_STYLE, 1878 getEffectiveModelPluginVariables(), 1879 getEditProjectDirectory() + "/plugin.properties", 1880 getEditPluginPropertiesEmitter()); 1881 1882 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditBuildProperties_message")); 1883 generate 1884 (new SubProgressMonitor(progressMonitor, 1), 1885 Generator.EMF_EDIT_PROJECT_STYLE, 1886 getEffectiveModelPluginVariables(), 1887 getEditProjectDirectory() + "/build.properties", 1888 getEditBuildPropertiesEmitter()); 1889 } 1890 finally 1891 { 1892 progressMonitor.done(); 1893 } 1894 } 1895 1896 public boolean hasEditorSupport() 1897 { 1898 return 1899 hasPluginSupport() && 1900 !isBlank(getEditorPluginClassToUse()) && 1901 !isBlank(getEditorDirectory()); 1902 } 1903 1904 public boolean canGenerateEditor() 1905 { 1906 return canGenerate && hasEditorSupport(); 1907 } 1908 1909 public void generateEditor(IProgressMonitor progressMonitor) 1910 { 1911 try 1912 { 1913 if (!canGenerateEditor()) return; 1914 1915 getStaticGenPackages(); 1916 1917 progressMonitor.beginTask("", getGenPackages().size() + 1); 1918 1919 if (isUpdateClasspath()) 1922 { 1923 findOrCreateContainer 1924 (new SubProgressMonitor(progressMonitor, 1), 1925 Generator.EMF_EDITOR_PROJECT_STYLE, 1926 getEffectiveModelPluginVariables(), 1927 new Path(getEditorDirectory()), 1928 true); 1929 } 1930 1931 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditorPackages")); 1932 for (Iterator iter = getGenPackages().iterator(); iter.hasNext(); ) 1933 { 1934 GenPackage genPackage = (GenPackage)iter.next(); 1935 progressMonitor.subTask 1936 (CodeGenEcorePlugin.INSTANCE.getString 1937 ("_UI_GeneratingJavaPackage_message", new Object [] { genPackage.getInterfacePackageName() })); 1938 genPackage.generateEditor(new SubProgressMonitor(progressMonitor, 1)); 1939 } 1940 1941 progressMonitor.subTask 1942 (CodeGenEcorePlugin.INSTANCE.getString 1943 ("_UI_GeneratingJavaClass_message", new Object [] { getQualifiedEditorPluginClassName() })); 1944 generate 1945 (new SubProgressMonitor(progressMonitor, 1), 1946 Generator.EMF_EDITOR_PROJECT_STYLE, 1947 getEffectiveModelPluginVariables(), 1948 getEditorPluginDirectory(), 1949 getEditorPluginPackageName(), 1950 getEditorPluginClassName(), 1951 getEditorPluginClassEmitter()); 1952 1953 if (isBundleManifest()) 1954 { 1955 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditorManifestMF_message")); 1956 generate 1957 (new SubProgressMonitor(progressMonitor, 1), 1958 Generator.EMF_EDITOR_PROJECT_STYLE, 1959 getEffectiveModelPluginVariables(), 1960 getEditorProjectDirectory() + "/META-INF/MANIFEST.MF", 1961 getEditorManifestMFEmitter()); 1962 } 1963 1964 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditorPluginXML_message")); 1965 generate 1966 (new SubProgressMonitor(progressMonitor, 1), 1967 Generator.EMF_EDITOR_PROJECT_STYLE, 1968 getEffectiveModelPluginVariables(), 1969 getEditorProjectDirectory() + "/plugin.xml", 1970 getEditorPluginXMLEmitter()); 1971 1972 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditorPluginProperties_message")); 1973 generate 1974 (new SubProgressMonitor(progressMonitor, 1), 1975 Generator.EMF_EDITOR_PROJECT_STYLE, 1976 getEffectiveModelPluginVariables(), 1977 getEditorProjectDirectory() + "/plugin.properties", 1978 getEditorPluginPropertiesEmitter()); 1979 1980 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingEditorBuildProperties_message")); 1981 generate 1982 (new SubProgressMonitor(progressMonitor, 1), 1983 Generator.EMF_EDITOR_PROJECT_STYLE, 1984 getEffectiveModelPluginVariables(), 1985 getEditorProjectDirectory() + "/build.properties", 1986 getEditorBuildPropertiesEmitter()); 1987 1988 if (getGenModel().isRichClientPlatform()) 1989 { 1990 progressMonitor.subTask 1991 (CodeGenEcorePlugin.INSTANCE.getString 1992 ("_UI_GeneratingJavaClass_message", new Object [] { getQualifiedEditorAdvisorClassName() })); 1993 generate 1994 (new SubProgressMonitor(progressMonitor, 1), 1995 Generator.EMF_EDITOR_PROJECT_STYLE, 1996 getEffectiveModelPluginVariables(), 1997 getEditorPluginDirectory(), 1998 getEditorPluginPackageName(), 1999 getEditorAdvisorClassName(), 2000 getEditorAdvisorEmitter()); 2001 } 2002 } 2003 finally 2004 { 2005 progressMonitor.done(); 2006 } 2007 } 2008 2009 public boolean canGenerateSchema() 2010 { 2011 return canGenerate(); 2012 } 2013 2014 public void generateSchema(IProgressMonitor progressMonitor) 2015 { 2016 for (Iterator i = getGenPackages().iterator(); i.hasNext();) 2017 { 2018 ((GenPackage)i.next()).generateSchema(new SubProgressMonitor(progressMonitor, 1)); 2019 } 2020 } 2021 2022 public boolean hasTestSupport() 2023 { 2024 return hasModelSupport() && !isBlank(getTestsDirectory()); 2025 } 2026 2027 public boolean canGenerateTests() 2028 { 2029 return canGenerate && hasTestSupport(); 2030 } 2031 2032 public void generateTests(IProgressMonitor progressMonitor) 2033 { 2034 try 2035 { 2036 if (!canGenerateTests()) 2037 return; 2038 2039 progressMonitor.beginTask("", getGenPackages().size() + 4); 2040 2041 if (isUpdateClasspath()) 2042 { 2043 findOrCreateContainer( 2044 new SubProgressMonitor(progressMonitor, 1), 2045 Generator.EMF_TESTS_PROJECT_STYLE, 2046 getEffectiveModelPluginVariables(), 2047 new Path(getTestsDirectory()), 2048 true); 2049 } 2050 2051 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingTestsPackages_message")); 2052 for (Iterator genPackages = getGenPackages().iterator(); genPackages.hasNext();) 2053 { 2054 GenPackage genPackage = (GenPackage)genPackages.next(); 2055 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString( 2056 "_UI_GeneratingJavaPackage_message", 2057 new Object []{ genPackage.getTestsPackageName() })); 2058 genPackage.generateTests(new SubProgressMonitor(progressMonitor, 1)); 2059 } 2060 2061 if (!isBlank(getTestSuiteClass())) 2062 { 2063 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString( 2064 "_UI_GeneratingJavaClass_message", 2065 new Object []{ getQualifiedTestSuiteClassName() })); 2066 generate( 2067 new SubProgressMonitor(progressMonitor, 1), 2068 Generator.EMF_TESTS_PROJECT_STYLE, 2069 getEffectiveModelPluginVariables(), 2070 getTestsDirectory(), 2071 getTestSuitePackageName(), 2072 getTestSuiteClassName(), 2073 getModelTestSuiteEmitter()); 2074 } 2075 2076 if (!sameModelTestsProject()) 2077 { 2078 if (isBundleManifest()) 2079 { 2080 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingTestsManifestMF_message")); 2081 generate 2082 (new SubProgressMonitor(progressMonitor, 1), 2083 Generator.EMF_TESTS_PROJECT_STYLE, 2084 getEffectiveModelPluginVariables(), 2085 getTestsProjectDirectory() + "/META-INF/MANIFEST.MF", 2086 getTestsManifestMFEmitter()); 2087 } 2088 2089 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingTestsPluginXML_message")); 2090 generate( 2091 new SubProgressMonitor(progressMonitor, 1), 2092 Generator.EMF_TESTS_PROJECT_STYLE, 2093 getEffectiveModelPluginVariables(), 2094 getTestsProjectDirectory() + "/plugin.xml", 2095 getTestsPluginXMLEmitter()); 2096 2097 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingTestsPluginProperties_message")); 2098 generate( 2099 new SubProgressMonitor(progressMonitor, 1), 2100 Generator.EMF_TESTS_PROJECT_STYLE, 2101 getEffectiveModelPluginVariables(), 2102 getTestsProjectDirectory() + "/plugin.properties", 2103 getTestsPluginPropertiesEmitter()); 2104 2105 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_GeneratingTestsBuildProperties_message")); 2106 generate( 2107 new SubProgressMonitor(progressMonitor, 1), 2108 Generator.EMF_TESTS_PROJECT_STYLE, 2109 getEffectiveModelPluginVariables(), 2110 getTestsProjectDirectory() + "/build.properties", 2111 getTestsBuildPropertiesEmitter()); 2112 } 2113 } 2114 finally 2115 { 2116 progressMonitor.done(); 2117 } 2118 } 2119 2120 2124 protected String itemProviderTemplateName = "edit/ItemProvider.javajet"; 2125 protected String itemProviderAdapterFactoryTemplateName = "edit/ItemProviderAdapterFactory.javajet"; 2126 protected String editPluginTemplateName = "edit/Plugin.javajet"; 2127 protected String editPluginXMLTemplateName = "edit/plugin.xmljet"; 2128 protected String editManifestMFTemplateName = "edit/manifest.mfjet"; 2129 protected String editPluginPropertiesTemplateName = "edit/plugin.propertiesjet"; 2130 protected String editBuildPropertiesTemplateName = "edit/build.propertiesjet"; 2131 protected String itemGIFName = "edit/Item.gif"; 2132 protected String createChildGIFName = "edit/CreateChild.gif"; 2133 2134 protected String editorTemplateName = "editor/Editor.javajet"; 2135 protected String actionBarContributorTemplateName = "editor/ActionBarContributor.javajet"; 2136 protected String modelWizardTemplateName = "editor/ModelWizard.javajet"; 2137 protected String advisorTemplateName = "editor/Advisor.javajet"; 2138 protected String editorPluginTemplateName = "editor/Plugin.javajet"; 2139 protected String editorPluginXMLTemplateName = "editor/plugin.xmljet"; 2140 protected String editorManifestMFTemplateName = "editor/manifest.mfjet"; 2141 protected String editorPluginPropertiesTemplateName = "editor/plugin.propertiesjet"; 2142 protected String editorBuildPropertiesTemplateName = "editor/build.propertiesjet"; 2143 protected String modelGIFName = "editor/ModelFile.gif"; 2144 protected String modelWizardGIFName = "editor/NewModel.gif"; 2145 2146 protected JETEmitter itemProviderEmitter = null; 2147 protected JETEmitter itemProviderAdapterFactoryEmitter = null; 2149 protected JETEmitter editPluginClassEmitter = null; 2150 protected JETEmitter editPluginXMLEmitter = null; 2151 protected JETEmitter editManifestMFEmitter = null; 2152 protected JETEmitter editPluginPropertiesEmitter = null; 2153 protected JETEmitter editBuildPropertiesEmitter = null; 2154 protected GIFEmitter itemGIFEmitter = null; 2155 protected GIFEmitter createChildGIFEmitter = null; 2156 2157 protected JETEmitter editorEmitter = null; 2158 protected JETEmitter actionBarContributorEmitter = null; 2159 protected JETEmitter modelWizardEmitter = null; 2160 protected JETEmitter advisorEmitter = null; 2161 protected JETEmitter editorPluginClassEmitter = null; 2162 protected JETEmitter editorManifestMFEmitter = null; 2163 protected JETEmitter editorPluginXMLEmitter = null; 2164 protected JETEmitter editorPluginPropertiesEmitter = null; 2165 protected JETEmitter editorBuildPropertiesEmitter = null; 2166 protected GIFEmitter modelGIFEmitter = null; 2167 protected GIFEmitter modelWizardGIFEmitter = null; 2168 2169 public JETEmitter getItemProviderEmitter() 2170 { 2171 if (itemProviderEmitter == null) 2172 { 2173 itemProviderEmitter = createJETEmitter(itemProviderTemplateName); 2174 setMethod(itemProviderEmitter, "org.eclipse.emf.codegen.ecore.templates.edit.ItemProvider"); 2175 } 2176 return itemProviderEmitter; 2177 } 2178 2179 2189 public JETEmitter getItemProviderAdapterFactoryEmitter() 2190 { 2191 if (itemProviderAdapterFactoryEmitter == null) 2192 { 2193 itemProviderAdapterFactoryEmitter = createJETEmitter(itemProviderAdapterFactoryTemplateName); 2194 setMethod(itemProviderAdapterFactoryEmitter, "org.eclipse.emf.codegen.ecore.templates.edit.ItemProviderAdapterFactory"); 2195 } 2196 return itemProviderAdapterFactoryEmitter; 2197 } 2198 2199 public JETEmitter getEditPluginClassEmitter() 2200 { 2201 if (editPluginClassEmitter == null) 2202 { 2203 editPluginClassEmitter = createJETEmitter(editPluginTemplateName); 2204 setMethod(editPluginClassEmitter, "org.eclipse.emf.codegen.ecore.templates.edit.Plugin"); 2205 } 2206 return editPluginClassEmitter; 2207 } 2208 2209 public JETEmitter getEditPluginXMLEmitter() 2210 { 2211 if (editPluginXMLEmitter == null) 2212 { 2213 editPluginXMLEmitter = createJETEmitter(editPluginXMLTemplateName); 2214 setMethod(editPluginXMLEmitter, "org.eclipse.emf.codegen.ecore.templates.edit.PluginXML"); 2215 } 2216 return editPluginXMLEmitter; 2217 } 2218 2219 public JETEmitter getEditManifestMFEmitter() 2220 { 2221 if (editManifestMFEmitter == null) 2222 { 2223 editManifestMFEmitter = createJETEmitter(editManifestMFTemplateName); 2224 setMethod(editManifestMFEmitter, "org.eclipse.emf.codegen.ecore.templates.edit.ManifestMF"); 2225 } 2226 2227 return editManifestMFEmitter; 2228 } 2229 2230 public JETEmitter getEditPluginPropertiesEmitter() 2231 { 2232 if (editPluginPropertiesEmitter == null) 2233 { 2234 editPluginPropertiesEmitter = createJETEmitter(editPluginPropertiesTemplateName); 2235 setMethod(editPluginPropertiesEmitter, "org.eclipse.emf.codegen.ecore.templates.edit.PluginProperties"); 2236 } 2237 return editPluginPropertiesEmitter; 2238 } 2239 2240 public JETEmitter getEditBuildPropertiesEmitter() 2241 { 2242 if (editBuildPropertiesEmitter == null) 2243 { 2244 editBuildPropertiesEmitter = createJETEmitter(editBuildPropertiesTemplateName); 2245 setMethod(editBuildPropertiesEmitter, "org.eclipse.emf.codegen.ecore.templates.edit.BuildProperties"); 2246 } 2247 return editBuildPropertiesEmitter; 2248 } 2249 2250 public GIFEmitter getItemGIFEmitter() 2251 { 2252 if (itemGIFEmitter == null) 2253 { 2254 itemGIFEmitter = new GIFEmitter(JETCompiler.find(getTemplatePath(), itemGIFName)); 2255 } 2256 return itemGIFEmitter; 2257 } 2258 2259 public GIFEmitter getCreateChildGIFEmitter() 2260 { 2261 if (createChildGIFEmitter == null) 2262 { 2263 createChildGIFEmitter = new GIFEmitter(JETCompiler.find(getTemplatePath(), createChildGIFName)); 2264 } 2265 return createChildGIFEmitter; 2266 } 2267 2268 public GIFEmitter getModelGIFEmitter() 2269 { 2270 if (modelGIFEmitter == null) 2271 { 2272 modelGIFEmitter = new GIFEmitter(JETCompiler.find(getTemplatePath(), modelGIFName)); 2273 } 2274 return modelGIFEmitter; 2275 } 2276 2277 public GIFEmitter getModelWizardGIFEmitter() 2278 { 2279 if (modelWizardGIFEmitter == null) 2280 { 2281 modelWizardGIFEmitter = new GIFEmitter(JETCompiler.find(getTemplatePath(), modelWizardGIFName)); 2282 } 2283 return modelWizardGIFEmitter; 2284 } 2285 2286 public JETEmitter getEditorEmitter() 2287 { 2288 if (editorEmitter == null) 2289 { 2290 editorEmitter = createJETEmitter(editorTemplateName); 2291 setMethod(editorEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.Editor"); 2292 } 2293 return editorEmitter; 2294 } 2295 2296 public JETEmitter getActionBarContributorEmitter() 2297 { 2298 if (actionBarContributorEmitter == null) 2299 { 2300 actionBarContributorEmitter = createJETEmitter(actionBarContributorTemplateName); 2301 setMethod(actionBarContributorEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.ActionBarContributor"); 2302 } 2303 return actionBarContributorEmitter; 2304 } 2305 2306 public JETEmitter getModelWizardEmitter() 2307 { 2308 if (modelWizardEmitter == null) 2309 { 2310 modelWizardEmitter = createJETEmitter(modelWizardTemplateName); 2311 setMethod(modelWizardEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.ModelWizard"); 2312 } 2313 return modelWizardEmitter; 2314 } 2315 2316 public JETEmitter getEditorAdvisorEmitter() 2317 { 2318 if (advisorEmitter == null) 2319 { 2320 advisorEmitter = createJETEmitter(advisorTemplateName); 2321 setMethod(advisorEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.Advisor"); 2322 } 2323 return advisorEmitter; 2324 } 2325 2326 public JETEmitter getEditorPluginClassEmitter() 2327 { 2328 if (editorPluginClassEmitter == null) 2329 { 2330 editorPluginClassEmitter = createJETEmitter(editorPluginTemplateName); 2331 setMethod(editorPluginClassEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.Plugin"); 2332 } 2333 return editorPluginClassEmitter; 2334 } 2335 2336 public JETEmitter getEditorPluginXMLEmitter() 2337 { 2338 if (editorPluginXMLEmitter == null) 2339 { 2340 editorPluginXMLEmitter = createJETEmitter(editorPluginXMLTemplateName); 2341 setMethod(editorPluginXMLEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.PluginXML"); 2342 } 2343 return editorPluginXMLEmitter; 2344 } 2345 2346 public JETEmitter getEditorManifestMFEmitter() 2347 { 2348 if (editorManifestMFEmitter == null) 2349 { 2350 editorManifestMFEmitter = createJETEmitter(editorManifestMFTemplateName); 2351 setMethod(editorManifestMFEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.ManifestMF"); 2352 } 2353 2354 return editorManifestMFEmitter; 2355 } 2356 2357 public JETEmitter getEditorPluginPropertiesEmitter() 2358 { 2359 if (editorPluginPropertiesEmitter == null) 2360 { 2361 editorPluginPropertiesEmitter = createJETEmitter(editorPluginPropertiesTemplateName); 2362 setMethod(editorPluginPropertiesEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.PluginProperties"); 2363 } 2364 return editorPluginPropertiesEmitter; 2365 } 2366 2367 public JETEmitter getEditorBuildPropertiesEmitter() 2368 { 2369 if (editorBuildPropertiesEmitter == null) 2370 { 2371 editorBuildPropertiesEmitter = createJETEmitter(editorBuildPropertiesTemplateName); 2372 setMethod(editorBuildPropertiesEmitter, "org.eclipse.emf.codegen.ecore.templates.editor.BuildProperties"); 2373 } 2374 return editorBuildPropertiesEmitter; 2375 } 2376 2377 2381 protected String testCaseTemplateName = "model.tests/TestCase.javajet"; 2382 protected String modelTestSuiteTemplateName = "model.tests/ModelTestSuite.javajet"; 2383 protected String packageTestSuiteTemplateName = "model.tests/PackageTestSuite.javajet"; 2384 protected String packageExampleTemplateName = "model.tests/PackageExample.javajet"; 2385 protected String testsPluginXMLTemplateName = "model.tests/plugin.xmljet"; 2386 protected String testsManifestMFTemplateName = "model.tests/manifest.mfjet"; 2387 protected String testsPluginPropertiesTemplateName = "model.tests/plugin.propertiesjet"; 2388 protected String testsBuildPropertiesTemplateName = "model.tests/build.propertiesjet"; 2389 2390 protected JETEmitter testCaseEmitter = null; 2391 protected JETEmitter modelTestSuiteEmitter = null; 2392 protected JETEmitter packageTestSuiteEmitter = null; 2393 protected JETEmitter packageExampleEmitter = null; 2394 protected JETEmitter testsPluginXMLEmitter = null; 2395 protected JETEmitter testsManifestMFEmitter = null; 2396 protected JETEmitter testsPluginPropertiesEmitter = null; 2397 protected JETEmitter testsBuildPropertiesEmitter = null; 2398 2399 public JETEmitter getTestCaseEmitter() 2400 { 2401 if (testCaseEmitter == null) 2402 { 2403 testCaseEmitter = createJETEmitter(testCaseTemplateName); 2404 setMethod(testCaseEmitter, "org.eclipse.emf.codegen.ecore.templates.model.tests.TestCase"); 2405 } 2406 2407 return testCaseEmitter; 2408 } 2409 2410 public JETEmitter getModelTestSuiteEmitter() 2411 { 2412 if (modelTestSuiteEmitter == null) 2413 { 2414 modelTestSuiteEmitter = createJETEmitter(modelTestSuiteTemplateName); 2415 setMethod(modelTestSuiteEmitter, "org.eclipse.emf.codegen.ecore.templates.model.tests.ModelTestSuite"); 2416 } 2417 2418 return modelTestSuiteEmitter; 2419 } 2420 2421 public JETEmitter getPackageTestSuiteEmitter() 2422 { 2423 if (packageTestSuiteEmitter == null) 2424 { 2425 packageTestSuiteEmitter = createJETEmitter(packageTestSuiteTemplateName); 2426 setMethod(packageTestSuiteEmitter, "org.eclipse.emf.codegen.ecore.templates.model.tests.PackageTestSuite"); 2427 } 2428 2429 return packageTestSuiteEmitter; 2430 } 2431 2432 public JETEmitter getPackageExampleEmitter() 2433 { 2434 if (packageExampleEmitter == null) 2435 { 2436 packageExampleEmitter = createJETEmitter(packageExampleTemplateName); 2437 setMethod(packageExampleEmitter, "org.eclipse.emf.codegen.ecore.templates.model.tests.PackageExample"); 2438 } 2439 2440 return packageExampleEmitter; 2441 } 2442 2443 public JETEmitter getTestsPluginXMLEmitter() 2444 { 2445 if (testsPluginXMLEmitter == null) 2446 { 2447 testsPluginXMLEmitter = createJETEmitter(testsPluginXMLTemplateName); 2448 setMethod(testsPluginXMLEmitter, "org.eclipse.emf.codegen.ecore.templates.model.tests.PluginXML"); 2449 } 2450 2451 return testsPluginXMLEmitter; 2452 } 2453 2454 public JETEmitter getTestsManifestMFEmitter() 2455 { 2456 if (testsManifestMFEmitter == null) 2457 { 2458 testsManifestMFEmitter = createJETEmitter(testsManifestMFTemplateName); 2459 setMethod(testsManifestMFEmitter, "org.eclipse.emf.codegen.ecore.templates.model.tests.ManifestMF"); 2460 } 2461 2462 return testsManifestMFEmitter; 2463 } 2464 2465 public JETEmitter getTestsPluginPropertiesEmitter() 2466 { 2467 if (testsPluginPropertiesEmitter == null) 2468 { 2469 testsPluginPropertiesEmitter = createJETEmitter(testsPluginPropertiesTemplateName); 2470 setMethod(testsPluginPropertiesEmitter, "org.eclipse.emf.codegen.ecore.templates.model.tests.PluginProperties"); 2471 } 2472 2473 return testsPluginPropertiesEmitter; 2474 } 2475 2476 public JETEmitter getTestsBuildPropertiesEmitter() 2477 { 2478 if (testsBuildPropertiesEmitter == null) 2479 { 2480 testsBuildPropertiesEmitter = createJETEmitter(testsBuildPropertiesTemplateName); 2481 setMethod(testsBuildPropertiesEmitter, "org.eclipse.emf.codegen.ecore.templates.model.tests.BuildProperties"); 2482 } 2483 2484 return testsBuildPropertiesEmitter; 2485 } 2486 2487 protected String getPluginDirectory(boolean isSet, String baseDirectory, String suffix) 2488 { 2489 if (!isSet) 2490 { 2491 String modelProject = getModelProject(); 2492 if (modelProject != null) 2493 { 2494 return new StringBuffer ("/").append(modelProject).append(suffix).append(getSourceFragmentPath()).toString(); 2495 } 2496 } 2497 return baseDirectory; 2498 } 2499 2500 public String getEditDirectory() 2501 { 2502 return getPluginDirectory(isSetEditDirectory(), getEditDirectoryGen(), ".edit/"); 2503 } 2504 2505 2510 public String getEditDirectoryGen() 2511 { 2512 return editDirectory; 2513 } 2514 2515 2520 public void setEditDirectory(String newEditDirectory) 2521 { 2522 String oldEditDirectory = editDirectory; 2523 editDirectory = newEditDirectory; 2524 boolean oldEditDirectoryESet = editDirectoryESet; 2525 editDirectoryESet = true; 2526 if (eNotificationRequired()) 2527 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__EDIT_DIRECTORY, oldEditDirectory, editDirectory, !oldEditDirectoryESet)); 2528 } 2529 2530 2535 public void unsetEditDirectory() 2536 { 2537 String oldEditDirectory = editDirectory; 2538 boolean oldEditDirectoryESet = editDirectoryESet; 2539 editDirectory = EDIT_DIRECTORY_EDEFAULT; 2540 editDirectoryESet = false; 2541 if (eNotificationRequired()) 2542 eNotify(new ENotificationImpl(this, Notification.UNSET, GenModelPackage.GEN_MODEL__EDIT_DIRECTORY, oldEditDirectory, EDIT_DIRECTORY_EDEFAULT, oldEditDirectoryESet)); 2543 } 2544 2545 2550 public boolean isSetEditDirectory() 2551 { 2552 return editDirectoryESet; 2553 } 2554 2555 public String getEditorDirectory() 2556 { 2557 return getPluginDirectory(isSetEditorDirectory(), getEditorDirectoryGen(), ".editor/"); 2558 } 2559 2560 2565 public String getEditorDirectoryGen() 2566 { 2567 return editorDirectory; 2568 } 2569 2570 2575 public void setEditorDirectory(String newEditorDirectory) 2576 { 2577 String oldEditorDirectory = editorDirectory; 2578 editorDirectory = newEditorDirectory; 2579 boolean oldEditorDirectoryESet = editorDirectoryESet; 2580 editorDirectoryESet = true; 2581 if (eNotificationRequired()) 2582 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__EDITOR_DIRECTORY, oldEditorDirectory, editorDirectory, !oldEditorDirectoryESet)); 2583 } 2584 2585 2590 public void unsetEditorDirectory() 2591 { 2592 String oldEditorDirectory = editorDirectory; 2593 boolean oldEditorDirectoryESet = editorDirectoryESet; 2594 editorDirectory = EDITOR_DIRECTORY_EDEFAULT; 2595 editorDirectoryESet = false; 2596 if (eNotificationRequired()) 2597 eNotify(new ENotificationImpl(this, Notification.UNSET, GenModelPackage.GEN_MODEL__EDITOR_DIRECTORY, oldEditorDirectory, EDITOR_DIRECTORY_EDEFAULT, oldEditorDirectoryESet)); 2598 } 2599 2600 2605 public boolean isSetEditorDirectory() 2606 { 2607 return editorDirectoryESet; 2608 } 2609 2610 2615 public String getModelPluginID() 2616 { 2617 return modelPluginID; 2618 } 2619 2620 2625 public void setModelPluginID(String newModelPluginID) 2626 { 2627 String oldModelPluginID = modelPluginID; 2628 modelPluginID = newModelPluginID; 2629 if (eNotificationRequired()) 2630 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__MODEL_PLUGIN_ID, oldModelPluginID, modelPluginID)); 2631 } 2632 2633 2638 public String getTemplateDirectory() 2639 { 2640 return templateDirectory; 2641 } 2642 2643 2648 public void setTemplateDirectory(String newTemplateDirectory) 2649 { 2650 String oldTemplateDirectory = templateDirectory; 2651 templateDirectory = newTemplateDirectory; 2652 if (eNotificationRequired()) 2653 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__TEMPLATE_DIRECTORY, oldTemplateDirectory, templateDirectory)); 2654 } 2655 2656 2661 public boolean isRuntimeJar() 2662 { 2663 return runtimeJar; 2664 } 2665 2666 2671 public void setRuntimeJar(boolean newRuntimeJar) 2672 { 2673 boolean oldRuntimeJar = runtimeJar; 2674 runtimeJar = newRuntimeJar; 2675 if (eNotificationRequired()) 2676 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__RUNTIME_JAR, oldRuntimeJar, runtimeJar)); 2677 } 2678 2679 2684 public EList getForeignModel() 2685 { 2686 if (foreignModel == null) 2687 { 2688 foreignModel = new EDataTypeUniqueEList(String .class, this, GenModelPackage.GEN_MODEL__FOREIGN_MODEL); 2689 } 2690 return foreignModel; 2691 } 2692 2693 2698 public boolean isDynamicTemplates() 2699 { 2700 return dynamicTemplates; 2701 } 2702 2703 2708 public void setDynamicTemplates(boolean newDynamicTemplates) 2709 { 2710 boolean oldDynamicTemplates = dynamicTemplates; 2711 dynamicTemplates = newDynamicTemplates; 2712 if (eNotificationRequired()) 2713 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__DYNAMIC_TEMPLATES, oldDynamicTemplates, dynamicTemplates)); 2714 } 2715 2716 2721 public String getRedirection() 2722 { 2723 return redirection; 2724 } 2725 2726 2731 public void setRedirection(String newRedirection) 2732 { 2733 String oldRedirection = redirection; 2734 redirection = newRedirection; 2735 if (eNotificationRequired()) 2736 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__REDIRECTION, oldRedirection, redirection)); 2737 } 2738 2739 2744 public boolean isForceOverwrite() 2745 { 2746 return forceOverwrite; 2747 } 2748 2749 2754 public void setForceOverwrite(boolean newForceOverwrite) 2755 { 2756 boolean oldForceOverwrite = forceOverwrite; 2757 forceOverwrite = newForceOverwrite; 2758 if (eNotificationRequired()) 2759 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__FORCE_OVERWRITE, oldForceOverwrite, forceOverwrite)); 2760 } 2761 2762 2767 public String getNonExternalizedStringTag() 2768 { 2769 return nonExternalizedStringTag; 2770 } 2771 2772 2777 public void setNonExternalizedStringTagGen(String newNonExternalizedStringTag) 2778 { 2779 String oldNonExternalizedStringTag = nonExternalizedStringTag; 2780 nonExternalizedStringTag = newNonExternalizedStringTag; 2781 if (eNotificationRequired()) 2782 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__NON_EXTERNALIZED_STRING_TAG, oldNonExternalizedStringTag, nonExternalizedStringTag)); 2783 } 2784 2785 public void setNonExternalizedStringTag(String newNonExternalizedStringTag) 2786 { 2787 setNonNLSMarkersGen(newNonExternalizedStringTag != null); 2788 setNonExternalizedStringTagGen(null); 2789 } 2790 2791 public String getName() 2792 { 2793 return getModelName(); 2794 } 2795 2796 2801 public String getModelName() 2802 { 2803 return modelName; 2804 } 2805 2806 2811 public void setModelName(String newModelName) 2812 { 2813 String oldModelName = modelName; 2814 modelName = newModelName; 2815 if (eNotificationRequired()) 2816 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__MODEL_NAME, oldModelName, modelName)); 2817 } 2818 2819 2824 public String getModelPluginClass() 2825 { 2826 return modelPluginClass; 2827 } 2828 2829 protected String getPluginClass(boolean isSet, String baseName, String packageSuffix, String classSuffix) 2830 { 2831 if (!isSet) 2832 { 2833 String modelName = getModelName(); 2834 if (!isBlank(modelName)) 2835 { 2836 String mainPackage = getMainPackage(); 2837 if (mainPackage != null) 2838 { 2839 StringBuffer pluginClass = new StringBuffer (mainPackage); 2840 if (!isBlank(packageSuffix)) 2841 { 2842 pluginClass.append(".").append(packageSuffix); 2843 } 2844 pluginClass.append(".").append(CodeGenUtil.validJavaIdentifier(modelName)). append(classSuffix); 2845 return pluginClass.toString(); 2846 } 2847 } 2848 } 2849 return baseName; 2850 } 2851 2852 2857 public void setModelPluginClass(String newModelPluginClass) 2858 { 2859 String oldModelPluginClass = modelPluginClass; 2860 modelPluginClass = newModelPluginClass; 2861 if (eNotificationRequired()) 2862 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__MODEL_PLUGIN_CLASS, oldModelPluginClass, modelPluginClass)); 2863 } 2864 2865 public String getEditPluginClass() 2866 { 2867 String suffix = GenPackageImpl.PROVIDER_PACKAGE_SUFFIX_EDEFAULT; 2868 GenPackage genPackage = getMainGenPackage(); 2869 if (genPackage != null) 2870 { 2871 suffix = genPackage.getProviderPackageSuffix(); 2872 } 2873 return getPluginClass(isSetEditPluginClass(), getEditPluginClassGen(), suffix, "EditPlugin"); 2874 } 2875 2876 2881 public String getEditPluginClassGen() 2882 { 2883 return editPluginClass; 2884 } 2885 2886 protected String getModelProject() 2887 { 2888 String modelDirectory = getModelDirectory(); 2889 if (!isBlank(modelDirectory)) 2890 { 2891 return URI.createURI(modelDirectory).segment(0); 2892 } 2893 return null; 2894 } 2895 2896 protected String getMainPackage() 2897 { 2898 GenPackage genPackage = getMainGenPackage(); 2899 return genPackage != null ? genPackage.getQualifiedPackageName() : getModelDirectory(); 2900 } 2901 2902 protected GenPackage getMainGenPackage() 2903 { 2904 if (!getGenPackages().isEmpty()) 2905 { 2906 GenPackage genPackage = (GenPackage)getGenPackages().get(0); 2907 while (genPackage.getGenClassifiers().isEmpty() && !genPackage.getNestedGenPackages().isEmpty()) 2908 { 2909 genPackage = (GenPackage)genPackage.getNestedGenPackages().get(0); 2910 } 2911 return genPackage; 2912 } 2913 return null; 2914 } 2915 2916 2921 public void setEditPluginClass(String newEditPluginClass) 2922 { 2923 String oldEditPluginClass = editPluginClass; 2924 editPluginClass = newEditPluginClass; 2925 boolean oldEditPluginClassESet = editPluginClassESet; 2926 editPluginClassESet = true; 2927 if (eNotificationRequired()) 2928 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__EDIT_PLUGIN_CLASS, oldEditPluginClass, editPluginClass, !oldEditPluginClassESet)); 2929 } 2930 2931 2936 public void unsetEditPluginClass() 2937 { 2938 String oldEditPluginClass = editPluginClass; 2939 boolean oldEditPluginClassESet = editPluginClassESet; 2940 editPluginClass = EDIT_PLUGIN_CLASS_EDEFAULT; 2941 editPluginClassESet = false; 2942 if (eNotificationRequired()) 2943 eNotify(new ENotificationImpl(this, Notification.UNSET, GenModelPackage.GEN_MODEL__EDIT_PLUGIN_CLASS, oldEditPluginClass, EDIT_PLUGIN_CLASS_EDEFAULT, oldEditPluginClassESet)); 2944 } 2945 2946 2951 public boolean isSetEditPluginClass() 2952 { 2953 return editPluginClassESet; 2954 } 2955 2956 public String getEditorPluginClass() 2957 { 2958 String suffix = GenPackageImpl.PRESENTATION_PACKAGE_SUFFIX_EDEFAULT; 2959 GenPackage genPackage = getMainGenPackage(); 2960 if (genPackage != null) 2961 { 2962 suffix = genPackage.getPresentationPackageSuffix(); 2963 } 2964 return getPluginClass(isSetEditorPluginClass(), getEditorPluginClassGen(), suffix, "EditorPlugin"); 2965 } 2966 2967 2972 public String getEditorPluginClassGen() 2973 { 2974 return editorPluginClass; 2975 } 2976 2977 2982 public void setEditorPluginClass(String newEditorPluginClass) 2983 { 2984 String oldEditorPluginClass = editorPluginClass; 2985 editorPluginClass = newEditorPluginClass; 2986 boolean oldEditorPluginClassESet = editorPluginClassESet; 2987 editorPluginClassESet = true; 2988 if (eNotificationRequired()) 2989 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__EDITOR_PLUGIN_CLASS, oldEditorPluginClass, editorPluginClass, !oldEditorPluginClassESet)); 2990 } 2991 2992 2997 public void unsetEditorPluginClass() 2998 { 2999 String oldEditorPluginClass = editorPluginClass; 3000 boolean oldEditorPluginClassESet = editorPluginClassESet; 3001 editorPluginClass = EDITOR_PLUGIN_CLASS_EDEFAULT; 3002 editorPluginClassESet = false; 3003 if (eNotificationRequired()) 3004 eNotify(new ENotificationImpl(this, Notification.UNSET, GenModelPackage.GEN_MODEL__EDITOR_PLUGIN_CLASS, oldEditorPluginClass, EDITOR_PLUGIN_CLASS_EDEFAULT, oldEditorPluginClassESet)); 3005 } 3006 3007 3012 public boolean isSetEditorPluginClass() 3013 { 3014 return editorPluginClassESet; 3015 } 3016 3017 3022 public boolean isUpdateClasspath() 3023 { 3024 return updateClasspath; 3025 } 3026 3027 3032 public void setUpdateClasspath(boolean newUpdateClasspath) 3033 { 3034 boolean oldUpdateClasspath = updateClasspath; 3035 updateClasspath = newUpdateClasspath; 3036 if (eNotificationRequired()) 3037 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__UPDATE_CLASSPATH, oldUpdateClasspath, updateClasspath)); 3038 } 3039 3040 3045 public boolean isGenerateSchema() 3046 { 3047 return generateSchema; 3048 } 3049 3050 3055 public void setGenerateSchema(boolean newGenerateSchema) 3056 { 3057 boolean oldGenerateSchema = generateSchema; 3058 generateSchema = newGenerateSchema; 3059 if (eNotificationRequired()) 3060 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__GENERATE_SCHEMA, oldGenerateSchema, generateSchema)); 3061 } 3062 3063 3068 public boolean isNonNLSMarkers() 3069 { 3070 return nonNLSMarkers; 3071 } 3072 3073 3078 public void setNonNLSMarkersGen(boolean newNonNLSMarkers) 3079 { 3080 boolean oldNonNLSMarkers = nonNLSMarkers; 3081 nonNLSMarkers = newNonNLSMarkers; 3082 if (eNotificationRequired()) 3083 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__NON_NLS_MARKERS, oldNonNLSMarkers, nonNLSMarkers)); 3084 } 3085 3086 public void setNonNLSMarkers(boolean newNonNLSMarkers) 3087 { 3088 setNonNLSMarkersGen(newNonNLSMarkers); 3089 setNonExternalizedStringTagGen(null); 3090 } 3091 3092 3097 public EList getStaticPackages() 3098 { 3099 if (staticPackages == null) 3100 { 3101 staticPackages = 3102 new EDataTypeUniqueEList(String .class, this, GenModelPackage.GEN_MODEL__STATIC_PACKAGES) 3103 { 3104 protected void didChange() 3105 { 3106 super.didChange(); 3107 staticGenPackages = null; 3108 } 3109 }; 3110 } 3111 return staticPackages; 3112 } 3113 3114 3119 public EList getModelPluginVariables() 3120 { 3121 if (modelPluginVariables == null) 3122 { 3123 modelPluginVariables = new EDataTypeUniqueEList(String .class, this, GenModelPackage.GEN_MODEL__MODEL_PLUGIN_VARIABLES); 3124 } 3125 return modelPluginVariables; 3126 } 3127 3128 3133 public String getRootExtendsInterface() 3134 { 3135 return rootExtendsInterface; 3136 } 3137 3138 3143 public void setRootExtendsInterface(String newRootExtendsInterface) 3144 { 3145 String oldRootExtendsInterface = rootExtendsInterface; 3146 rootExtendsInterface = newRootExtendsInterface; 3147 if (eNotificationRequired()) 3148 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__ROOT_EXTENDS_INTERFACE, oldRootExtendsInterface, rootExtendsInterface)); 3149 } 3150 3151 3156 public String getRootExtendsClass() 3157 { 3158 return rootExtendsClass; 3159 } 3160 3161 3166 public void setRootExtendsClass(String newRootExtendsClass) 3167 { 3168 String oldRootExtendsClass = rootExtendsClass; 3169 rootExtendsClass = newRootExtendsClass; 3170 if (eNotificationRequired()) 3171 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__ROOT_EXTENDS_CLASS, oldRootExtendsClass, rootExtendsClass)); 3172 } 3173 3174 3179 public String getRootImplementsInterface() 3180 { 3181 return rootImplementsInterface; 3182 } 3183 3184 protected GenClass rootImplementsInterfaceGenClass; 3185 3186 public GenClass getRootImplementsInterfaceGenClass() 3187 { 3188 if (rootImplementsInterfaceGenClass == null) 3189 { 3190 for (Iterator i = getAllGenUsedAndStaticGenPackagesWithClassifiers().iterator(); i.hasNext(); ) 3191 { 3192 GenPackage genPackage = (GenPackage)i.next(); 3193 for (Iterator j = genPackage.getGenClasses().iterator(); j.hasNext(); ) 3194 { 3195 GenClass genClass = (GenClass)j.next(); 3196 if (genClass.getQualifiedInterfaceName().equals(rootImplementsInterface)) 3197 { 3198 return rootImplementsInterfaceGenClass = genClass; 3199 } 3200 } 3201 } 3202 } 3203 3204 return rootImplementsInterfaceGenClass; 3205 } 3206 3207 3212 public void setRootImplementsInterfaceGen(String newRootImplementsInterface) 3213 { 3214 String oldRootImplementsInterface = rootImplementsInterface; 3215 rootImplementsInterface = newRootImplementsInterface; 3216 if (eNotificationRequired()) 3217 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__ROOT_IMPLEMENTS_INTERFACE, oldRootImplementsInterface, rootImplementsInterface)); 3218 } 3219 3220 public void setRootImplementsInterface(String newRootImplementsInterface) 3221 { 3222 setRootImplementsInterfaceGen(newRootImplementsInterface); 3223 rootImplementsInterfaceGenClass = null; 3224 } 3225 3226 public List getEffectiveModelPluginVariables() 3227 { 3228 return getModelPluginVariables(); 3229 } 3230 3231 public List getEffectiveModelPluginIDs() 3232 { 3233 List result = new ArrayList (getModelPluginVariables()); 3234 for (ListIterator i = result.listIterator(); i.hasNext(); ) 3235 { 3236 Object item = i.next(); 3237 if (item instanceof String ) 3238 { 3239 String variable = (String )item; 3240 int index = variable.indexOf("="); 3241 if (index != -1) 3242 { 3243 i.set(variable.substring(index + 1)); 3244 } 3245 } 3246 else 3247 { 3248 i.remove(); 3249 } 3250 } 3251 3252 return result; 3253 } 3254 3255 3260 public boolean isSuppressEMFTypes() 3261 { 3262 return suppressEMFTypes; 3263 } 3264 3265 3270 public void setSuppressEMFTypes(boolean newSuppressEMFTypes) 3271 { 3272 boolean oldSuppressEMFTypes = suppressEMFTypes; 3273 suppressEMFTypes = newSuppressEMFTypes; 3274 if (eNotificationRequired()) 3275 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__SUPPRESS_EMF_TYPES, oldSuppressEMFTypes, suppressEMFTypes)); 3276 } 3277 3278 3283 public String getFeatureMapWrapperInterface() 3284 { 3285 return featureMapWrapperInterface; 3286 } 3287 3288 3293 public void setFeatureMapWrapperInterface(String newFeatureMapWrapperInterface) 3294 { 3295 String oldFeatureMapWrapperInterface = featureMapWrapperInterface; 3296 featureMapWrapperInterface = newFeatureMapWrapperInterface; 3297 if (eNotificationRequired()) 3298 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERFACE, oldFeatureMapWrapperInterface, featureMapWrapperInterface)); 3299 } 3300 3301 3306 public String getFeatureMapWrapperInternalInterface() 3307 { 3308 return featureMapWrapperInternalInterface; 3309 } 3310 3311 3316 public void setFeatureMapWrapperInternalInterface(String newFeatureMapWrapperInternalInterface) 3317 { 3318 String oldFeatureMapWrapperInternalInterface = featureMapWrapperInternalInterface; 3319 featureMapWrapperInternalInterface = newFeatureMapWrapperInternalInterface; 3320 if (eNotificationRequired()) 3321 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE, oldFeatureMapWrapperInternalInterface, featureMapWrapperInternalInterface)); 3322 } 3323 3324 3329 public String getFeatureMapWrapperClass() 3330 { 3331 return featureMapWrapperClass; 3332 } 3333 3334 3339 public void setFeatureMapWrapperClass(String newFeatureMapWrapperClass) 3340 { 3341 String oldFeatureMapWrapperClass = featureMapWrapperClass; 3342 featureMapWrapperClass = newFeatureMapWrapperClass; 3343 if (eNotificationRequired()) 3344 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_CLASS, oldFeatureMapWrapperClass, featureMapWrapperClass)); 3345 } 3346 3347 3352 public boolean isRuntimeCompatibility() 3353 { 3354 return runtimeCompatibility; 3355 } 3356 3357 public boolean needsRuntimeCompatibility() 3358 { 3359 return isRuntimeCompatibility() && !isRichClientPlatform(); 3360 } 3361 3362 3367 public void setRuntimeCompatibility(boolean newRuntimeCompatibility) 3368 { 3369 boolean oldRuntimeCompatibility = runtimeCompatibility; 3370 runtimeCompatibility = newRuntimeCompatibility; 3371 if (eNotificationRequired()) 3372 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__RUNTIME_COMPATIBILITY, oldRuntimeCompatibility, runtimeCompatibility)); 3373 } 3374 3375 3380 public boolean isRichClientPlatform() 3381 { 3382 return richClientPlatform; 3383 } 3384 3385 3390 public void setRichClientPlatform(boolean newRichClientPlatform) 3391 { 3392 boolean oldRichClientPlatform = richClientPlatform; 3393 richClientPlatform = newRichClientPlatform; 3394 if (eNotificationRequired()) 3395 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__RICH_CLIENT_PLATFORM, oldRichClientPlatform, richClientPlatform)); 3396 } 3397 3398 3403 public boolean isReflectiveDelegation() 3404 { 3405 return reflectiveDelegation; 3406 } 3407 3408 3413 public void setReflectiveDelegation(boolean newReflectiveDelegation) 3414 { 3415 boolean oldReflectiveDelegation = reflectiveDelegation; 3416 reflectiveDelegation = newReflectiveDelegation; 3417 if (eNotificationRequired()) 3418 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__REFLECTIVE_DELEGATION, oldReflectiveDelegation, reflectiveDelegation)); 3419 } 3420 3421 3426 public boolean isCodeFormatting() 3427 { 3428 return codeFormatting; 3429 } 3430 3431 3436 public void setCodeFormatting(boolean newCodeFormatting) 3437 { 3438 boolean oldCodeFormatting = codeFormatting; 3439 codeFormatting = newCodeFormatting; 3440 if (eNotificationRequired()) 3441 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__CODE_FORMATTING, oldCodeFormatting, codeFormatting)); 3442 } 3443 3444 public String getTestsDirectory() 3445 { 3446 return getPluginDirectory(isSetTestsDirectory(), getTestsDirectoryGen(), ".tests/"); 3447 } 3448 3449 3454 public String getTestsDirectoryGen() 3455 { 3456 return testsDirectory; 3457 } 3458 3459 3464 public void setTestsDirectory(String newTestsDirectory) 3465 { 3466 String oldTestsDirectory = testsDirectory; 3467 testsDirectory = newTestsDirectory; 3468 boolean oldTestsDirectoryESet = testsDirectoryESet; 3469 testsDirectoryESet = true; 3470 if (eNotificationRequired()) 3471 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__TESTS_DIRECTORY, oldTestsDirectory, testsDirectory, !oldTestsDirectoryESet)); 3472 } 3473 3474 3479 public void unsetTestsDirectory() 3480 { 3481 String oldTestsDirectory = testsDirectory; 3482 boolean oldTestsDirectoryESet = testsDirectoryESet; 3483 testsDirectory = TESTS_DIRECTORY_EDEFAULT; 3484 testsDirectoryESet = false; 3485 if (eNotificationRequired()) 3486 eNotify(new ENotificationImpl(this, Notification.UNSET, GenModelPackage.GEN_MODEL__TESTS_DIRECTORY, oldTestsDirectory, TESTS_DIRECTORY_EDEFAULT, oldTestsDirectoryESet)); 3487 } 3488 3489 3494 public boolean isSetTestsDirectory() 3495 { 3496 return testsDirectoryESet; 3497 } 3498 3499 public String getTestSuiteClass() 3500 { 3501 String suffix = GenPackageImpl.TESTS_PACKAGE_SUFFIX_EDEFAULT; 3502 GenPackage genPackage = getMainGenPackage(); 3503 if (genPackage != null) 3504 { 3505 suffix = genPackage.getTestsPackageSuffix(); 3506 } 3507 return getPluginClass(isSetTestSuiteClass(), getTestSuiteClassGen(), suffix, "AllTests"); 3508 } 3509 3510 3515 public String getTestSuiteClassGen() 3516 { 3517 return testSuiteClass; 3518 } 3519 3520 3525 public void setTestSuiteClass(String newTestSuiteClass) 3526 { 3527 String oldTestSuiteClass = testSuiteClass; 3528 testSuiteClass = newTestSuiteClass; 3529 boolean oldTestSuiteClassESet = testSuiteClassESet; 3530 testSuiteClassESet = true; 3531 if (eNotificationRequired()) 3532 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__TEST_SUITE_CLASS, oldTestSuiteClass, testSuiteClass, !oldTestSuiteClassESet)); 3533 } 3534 3535 3540 public void unsetTestSuiteClass() 3541 { 3542 String oldTestSuiteClass = testSuiteClass; 3543 boolean oldTestSuiteClassESet = testSuiteClassESet; 3544 testSuiteClass = TEST_SUITE_CLASS_EDEFAULT; 3545 testSuiteClassESet = false; 3546 if (eNotificationRequired()) 3547 eNotify(new ENotificationImpl(this, Notification.UNSET, GenModelPackage.GEN_MODEL__TEST_SUITE_CLASS, oldTestSuiteClass, TEST_SUITE_CLASS_EDEFAULT, oldTestSuiteClassESet)); 3548 } 3549 3550 3555 public boolean isSetTestSuiteClass() 3556 { 3557 return testSuiteClassESet; 3558 } 3559 3560 3565 public String getBooleanFlagsField() 3566 { 3567 return booleanFlagsField; 3568 } 3569 3570 3575 public void setBooleanFlagsField(String newBooleanFlagsField) 3576 { 3577 String oldBooleanFlagsField = booleanFlagsField; 3578 booleanFlagsField = newBooleanFlagsField; 3579 if (eNotificationRequired()) 3580 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_FIELD, oldBooleanFlagsField, booleanFlagsField)); 3581 } 3582 3583 3588 public int getBooleanFlagsReservedBits() 3589 { 3590 return booleanFlagsReservedBits; 3591 } 3592 3593 3598 public void setBooleanFlagsReservedBits(int newBooleanFlagsReservedBits) 3599 { 3600 int oldBooleanFlagsReservedBits = booleanFlagsReservedBits; 3601 booleanFlagsReservedBits = newBooleanFlagsReservedBits; 3602 if (eNotificationRequired()) 3603 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_RESERVED_BITS, oldBooleanFlagsReservedBits, booleanFlagsReservedBits)); 3604 } 3605 3606 3611 public String getImporterID() 3612 { 3613 return importerID; 3614 } 3615 3616 3621 public void setImporterID(String newImporterID) 3622 { 3623 String oldImporterID = importerID; 3624 importerID = newImporterID; 3625 if (eNotificationRequired()) 3626 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__IMPORTER_ID, oldImporterID, importerID)); 3627 } 3628 3629 3634 public boolean isBundleManifest() 3635 { 3636 return bundleManifest; 3637 } 3638 3639 3644 public void setBundleManifest(boolean newBundleManifest) 3645 { 3646 boolean oldBundleManifest = bundleManifest; 3647 bundleManifest = newBundleManifest; 3648 if (eNotificationRequired()) 3649 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_MODEL__BUNDLE_MANIFEST, oldBundleManifest, bundleManifest)); 3650 } 3651 3652 3657 public EList getGenPackages() 3658 { 3659 if (genPackages == null) 3660 { 3661 genPackages = new EObjectContainmentWithInverseEList(GenPackage.class, this, GenModelPackage.GEN_MODEL__GEN_PACKAGES, GenModelPackage.GEN_PACKAGE__GEN_MODEL); 3662 } 3663 return genPackages; 3664 } 3665 3666 public EList getStaticGenPackages() 3667 { 3668 if (staticGenPackages == null) 3669 { 3670 staticGenPackages = new UniqueEList(); 3671 LOOP: 3672 for (Iterator i = getStaticPackages().iterator(); i.hasNext(); ) 3673 { 3674 String nsURI = (String )i.next(); 3675 for (Iterator j = getStaticGenPackages().iterator(); j.hasNext(); ) 3676 { 3677 GenPackage staticGenPackage = (GenPackage)j.next(); 3678 if (staticGenPackage.getNSURI().equals(nsURI)) 3679 { 3680 continue LOOP; 3681 } 3682 } 3683 EPackage staticEPackage = eResource().getResourceSet().getPackageRegistry().getEPackage(nsURI); 3684 if (staticEPackage != null) 3685 { 3686 GenModel genModel = getGenModel().createGenModel(); 3687 GenPackage staticGenPackage = getGenModel().createGenPackage(); 3688 staticGenPackages.add(staticGenPackage); 3689 genModel.getGenPackages().add(staticGenPackage); 3690 staticGenPackage.initialize(staticEPackage); 3691 } 3692 } 3693 } 3694 return staticGenPackages; 3695 } 3696 3697 3702 public EList getUsedGenPackages() 3703 { 3704 if (usedGenPackages == null) 3705 { 3706 usedGenPackages = new EObjectResolvingEList(GenPackage.class, this, GenModelPackage.GEN_MODEL__USED_GEN_PACKAGES); 3707 } 3708 return usedGenPackages; 3709 } 3710 3711 3716 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 3717 { 3718 if (featureID >= 0) 3719 { 3720 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 3721 { 3722 case GenModelPackage.GEN_MODEL__GEN_PACKAGES: 3723 return ((InternalEList)getGenPackages()).basicAdd(otherEnd, msgs); 3724 default: 3725 return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); 3726 } 3727 } 3728 if (eContainer != null) 3729 msgs = eBasicRemoveFromContainer(msgs); 3730 return eBasicSetContainer(otherEnd, featureID, msgs); 3731 } 3732 3733 3738 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 3739 { 3740 if (featureID >= 0) 3741 { 3742 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 3743 { 3744 case GenModelPackage.GEN_MODEL__GEN_PACKAGES: 3745 return ((InternalEList)getGenPackages()).basicRemove(otherEnd, msgs); 3746 default: 3747 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 3748 } 3749 } 3750 return eBasicSetContainer(null, featureID, msgs); 3751 } 3752 3753 3758 public Object eGet(EStructuralFeature eFeature, boolean resolve) 3759 { 3760 switch (eDerivedStructuralFeatureID(eFeature)) 3761 { 3762 case GenModelPackage.GEN_MODEL__COPYRIGHT_TEXT: 3763 return getCopyrightText(); 3764 case GenModelPackage.GEN_MODEL__MODEL_DIRECTORY: 3765 return getModelDirectory(); 3766 case GenModelPackage.GEN_MODEL__CREATION_COMMANDS: 3767 return isCreationCommands() ? Boolean.TRUE : Boolean.FALSE; 3768 case GenModelPackage.GEN_MODEL__CREATION_ICONS: 3769 return isCreationIcons() ? Boolean.TRUE : Boolean.FALSE; 3770 case GenModelPackage.GEN_MODEL__EDIT_DIRECTORY: 3771 return getEditDirectory(); 3772 case GenModelPackage.GEN_MODEL__EDITOR_DIRECTORY: 3773 return getEditorDirectory(); 3774 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_ID: 3775 return getModelPluginID(); 3776 case GenModelPackage.GEN_MODEL__TEMPLATE_DIRECTORY: 3777 return getTemplateDirectory(); 3778 case GenModelPackage.GEN_MODEL__RUNTIME_JAR: 3779 return isRuntimeJar() ? Boolean.TRUE : Boolean.FALSE; 3780 case GenModelPackage.GEN_MODEL__FOREIGN_MODEL: 3781 return getForeignModel(); 3782 case GenModelPackage.GEN_MODEL__DYNAMIC_TEMPLATES: 3783 return isDynamicTemplates() ? Boolean.TRUE : Boolean.FALSE; 3784 case GenModelPackage.GEN_MODEL__REDIRECTION: 3785 return getRedirection(); 3786 case GenModelPackage.GEN_MODEL__FORCE_OVERWRITE: 3787 return isForceOverwrite() ? Boolean.TRUE : Boolean.FALSE; 3788 case GenModelPackage.GEN_MODEL__NON_EXTERNALIZED_STRING_TAG: 3789 return getNonExternalizedStringTag(); 3790 case GenModelPackage.GEN_MODEL__MODEL_NAME: 3791 return getModelName(); 3792 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_CLASS: 3793 return getModelPluginClass(); 3794 case GenModelPackage.GEN_MODEL__EDIT_PLUGIN_CLASS: 3795 return getEditPluginClass(); 3796 case GenModelPackage.GEN_MODEL__EDITOR_PLUGIN_CLASS: 3797 return getEditorPluginClass(); 3798 case GenModelPackage.GEN_MODEL__UPDATE_CLASSPATH: 3799 return isUpdateClasspath() ? Boolean.TRUE : Boolean.FALSE; 3800 case GenModelPackage.GEN_MODEL__GENERATE_SCHEMA: 3801 return isGenerateSchema() ? Boolean.TRUE : Boolean.FALSE; 3802 case GenModelPackage.GEN_MODEL__NON_NLS_MARKERS: 3803 return isNonNLSMarkers() ? Boolean.TRUE : Boolean.FALSE; 3804 case GenModelPackage.GEN_MODEL__STATIC_PACKAGES: 3805 return getStaticPackages(); 3806 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_VARIABLES: 3807 return getModelPluginVariables(); 3808 case GenModelPackage.GEN_MODEL__ROOT_EXTENDS_INTERFACE: 3809 return getRootExtendsInterface(); 3810 case GenModelPackage.GEN_MODEL__ROOT_EXTENDS_CLASS: 3811 return getRootExtendsClass(); 3812 case GenModelPackage.GEN_MODEL__ROOT_IMPLEMENTS_INTERFACE: 3813 return getRootImplementsInterface(); 3814 case GenModelPackage.GEN_MODEL__SUPPRESS_EMF_TYPES: 3815 return isSuppressEMFTypes() ? Boolean.TRUE : Boolean.FALSE; 3816 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERFACE: 3817 return getFeatureMapWrapperInterface(); 3818 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE: 3819 return getFeatureMapWrapperInternalInterface(); 3820 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_CLASS: 3821 return getFeatureMapWrapperClass(); 3822 case GenModelPackage.GEN_MODEL__RUNTIME_COMPATIBILITY: 3823 return isRuntimeCompatibility() ? Boolean.TRUE : Boolean.FALSE; 3824 case GenModelPackage.GEN_MODEL__RICH_CLIENT_PLATFORM: 3825 return isRichClientPlatform() ? Boolean.TRUE : Boolean.FALSE; 3826 case GenModelPackage.GEN_MODEL__REFLECTIVE_DELEGATION: 3827 return isReflectiveDelegation() ? Boolean.TRUE : Boolean.FALSE; 3828 case GenModelPackage.GEN_MODEL__CODE_FORMATTING: 3829 return isCodeFormatting() ? Boolean.TRUE : Boolean.FALSE; 3830 case GenModelPackage.GEN_MODEL__TESTS_DIRECTORY: 3831 return getTestsDirectory(); 3832 case GenModelPackage.GEN_MODEL__TEST_SUITE_CLASS: 3833 return getTestSuiteClass(); 3834 case GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_FIELD: 3835 return getBooleanFlagsField(); 3836 case GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_RESERVED_BITS: 3837 return new Integer (getBooleanFlagsReservedBits()); 3838 case GenModelPackage.GEN_MODEL__IMPORTER_ID: 3839 return getImporterID(); 3840 case GenModelPackage.GEN_MODEL__BUNDLE_MANIFEST: 3841 return isBundleManifest() ? Boolean.TRUE : Boolean.FALSE; 3842 case GenModelPackage.GEN_MODEL__GEN_PACKAGES: 3843 return getGenPackages(); 3844 case GenModelPackage.GEN_MODEL__USED_GEN_PACKAGES: 3845 return getUsedGenPackages(); 3846 } 3847 return eDynamicGet(eFeature, resolve); 3848 } 3849 3850 3855 public boolean eIsSet(EStructuralFeature eFeature) 3856 { 3857 switch (eDerivedStructuralFeatureID(eFeature)) 3858 { 3859 case GenModelPackage.GEN_MODEL__COPYRIGHT_TEXT: 3860 return COPYRIGHT_TEXT_EDEFAULT == null ? copyrightText != null : !COPYRIGHT_TEXT_EDEFAULT.equals(copyrightText); 3861 case GenModelPackage.GEN_MODEL__MODEL_DIRECTORY: 3862 return MODEL_DIRECTORY_EDEFAULT == null ? modelDirectory != null : !MODEL_DIRECTORY_EDEFAULT.equals(modelDirectory); 3863 case GenModelPackage.GEN_MODEL__CREATION_COMMANDS: 3864 return creationCommands != CREATION_COMMANDS_EDEFAULT; 3865 case GenModelPackage.GEN_MODEL__CREATION_ICONS: 3866 return creationIcons != CREATION_ICONS_EDEFAULT; 3867 case GenModelPackage.GEN_MODEL__EDIT_DIRECTORY: 3868 return isSetEditDirectory(); 3869 case GenModelPackage.GEN_MODEL__EDITOR_DIRECTORY: 3870 return isSetEditorDirectory(); 3871 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_ID: 3872 return MODEL_PLUGIN_ID_EDEFAULT == null ? modelPluginID != null : !MODEL_PLUGIN_ID_EDEFAULT.equals(modelPluginID); 3873 case GenModelPackage.GEN_MODEL__TEMPLATE_DIRECTORY: 3874 return TEMPLATE_DIRECTORY_EDEFAULT == null ? templateDirectory != null : !TEMPLATE_DIRECTORY_EDEFAULT.equals(templateDirectory); 3875 case GenModelPackage.GEN_MODEL__RUNTIME_JAR: 3876 return runtimeJar != RUNTIME_JAR_EDEFAULT; 3877 case GenModelPackage.GEN_MODEL__FOREIGN_MODEL: 3878 return foreignModel != null && !foreignModel.isEmpty(); 3879 case GenModelPackage.GEN_MODEL__DYNAMIC_TEMPLATES: 3880 return dynamicTemplates != DYNAMIC_TEMPLATES_EDEFAULT; 3881 case GenModelPackage.GEN_MODEL__REDIRECTION: 3882 return REDIRECTION_EDEFAULT == null ? redirection != null : !REDIRECTION_EDEFAULT.equals(redirection); 3883 case GenModelPackage.GEN_MODEL__FORCE_OVERWRITE: 3884 return forceOverwrite != FORCE_OVERWRITE_EDEFAULT; 3885 case GenModelPackage.GEN_MODEL__NON_EXTERNALIZED_STRING_TAG: 3886 return NON_EXTERNALIZED_STRING_TAG_EDEFAULT == null ? nonExternalizedStringTag != null : !NON_EXTERNALIZED_STRING_TAG_EDEFAULT.equals(nonExternalizedStringTag); 3887 case GenModelPackage.GEN_MODEL__MODEL_NAME: 3888 return MODEL_NAME_EDEFAULT == null ? modelName != null : !MODEL_NAME_EDEFAULT.equals(modelName); 3889 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_CLASS: 3890 return MODEL_PLUGIN_CLASS_EDEFAULT == null ? modelPluginClass != null : !MODEL_PLUGIN_CLASS_EDEFAULT.equals(modelPluginClass); 3891 case GenModelPackage.GEN_MODEL__EDIT_PLUGIN_CLASS: 3892 return isSetEditPluginClass(); 3893 case GenModelPackage.GEN_MODEL__EDITOR_PLUGIN_CLASS: 3894 return isSetEditorPluginClass(); 3895 case GenModelPackage.GEN_MODEL__UPDATE_CLASSPATH: 3896 return updateClasspath != UPDATE_CLASSPATH_EDEFAULT; 3897 case GenModelPackage.GEN_MODEL__GENERATE_SCHEMA: 3898 return generateSchema != GENERATE_SCHEMA_EDEFAULT; 3899 case GenModelPackage.GEN_MODEL__NON_NLS_MARKERS: 3900 return nonNLSMarkers != NON_NLS_MARKERS_EDEFAULT; 3901 case GenModelPackage.GEN_MODEL__STATIC_PACKAGES: 3902 return staticPackages != null && !staticPackages.isEmpty(); 3903 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_VARIABLES: 3904 return modelPluginVariables != null && !modelPluginVariables.isEmpty(); 3905 case GenModelPackage.GEN_MODEL__ROOT_EXTENDS_INTERFACE: 3906 return ROOT_EXTENDS_INTERFACE_EDEFAULT == null ? rootExtendsInterface != null : !ROOT_EXTENDS_INTERFACE_EDEFAULT.equals(rootExtendsInterface); 3907 case GenModelPackage.GEN_MODEL__ROOT_EXTENDS_CLASS: 3908 return ROOT_EXTENDS_CLASS_EDEFAULT == null ? rootExtendsClass != null : !ROOT_EXTENDS_CLASS_EDEFAULT.equals(rootExtendsClass); 3909 case GenModelPackage.GEN_MODEL__ROOT_IMPLEMENTS_INTERFACE: 3910 return ROOT_IMPLEMENTS_INTERFACE_EDEFAULT == null ? rootImplementsInterface != null : !ROOT_IMPLEMENTS_INTERFACE_EDEFAULT.equals(rootImplementsInterface); 3911 case GenModelPackage.GEN_MODEL__SUPPRESS_EMF_TYPES: 3912 return suppressEMFTypes != SUPPRESS_EMF_TYPES_EDEFAULT; 3913 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERFACE: 3914 return FEATURE_MAP_WRAPPER_INTERFACE_EDEFAULT == null ? featureMapWrapperInterface != null : !FEATURE_MAP_WRAPPER_INTERFACE_EDEFAULT.equals(featureMapWrapperInterface); 3915 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE: 3916 return FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE_EDEFAULT == null ? featureMapWrapperInternalInterface != null : !FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE_EDEFAULT.equals(featureMapWrapperInternalInterface); 3917 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_CLASS: 3918 return FEATURE_MAP_WRAPPER_CLASS_EDEFAULT == null ? featureMapWrapperClass != null : !FEATURE_MAP_WRAPPER_CLASS_EDEFAULT.equals(featureMapWrapperClass); 3919 case GenModelPackage.GEN_MODEL__RUNTIME_COMPATIBILITY: 3920 return runtimeCompatibility != RUNTIME_COMPATIBILITY_EDEFAULT; 3921 case GenModelPackage.GEN_MODEL__RICH_CLIENT_PLATFORM: 3922 return richClientPlatform != RICH_CLIENT_PLATFORM_EDEFAULT; 3923 case GenModelPackage.GEN_MODEL__REFLECTIVE_DELEGATION: 3924 return reflectiveDelegation != REFLECTIVE_DELEGATION_EDEFAULT; 3925 case GenModelPackage.GEN_MODEL__CODE_FORMATTING: 3926 return codeFormatting != CODE_FORMATTING_EDEFAULT; 3927 case GenModelPackage.GEN_MODEL__TESTS_DIRECTORY: 3928 return isSetTestsDirectory(); 3929 case GenModelPackage.GEN_MODEL__TEST_SUITE_CLASS: 3930 return isSetTestSuiteClass(); 3931 case GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_FIELD: 3932 return BOOLEAN_FLAGS_FIELD_EDEFAULT == null ? booleanFlagsField != null : !BOOLEAN_FLAGS_FIELD_EDEFAULT.equals(booleanFlagsField); 3933 case GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_RESERVED_BITS: 3934 return booleanFlagsReservedBits != BOOLEAN_FLAGS_RESERVED_BITS_EDEFAULT; 3935 case GenModelPackage.GEN_MODEL__IMPORTER_ID: 3936 return IMPORTER_ID_EDEFAULT == null ? importerID != null : !IMPORTER_ID_EDEFAULT.equals(importerID); 3937 case GenModelPackage.GEN_MODEL__BUNDLE_MANIFEST: 3938 return bundleManifest != BUNDLE_MANIFEST_EDEFAULT; 3939 case GenModelPackage.GEN_MODEL__GEN_PACKAGES: 3940 return genPackages != null && !genPackages.isEmpty(); 3941 case GenModelPackage.GEN_MODEL__USED_GEN_PACKAGES: 3942 return usedGenPackages != null && !usedGenPackages.isEmpty(); 3943 } 3944 return eDynamicIsSet(eFeature); 3945 } 3946 3947 3952 public void eSet(EStructuralFeature eFeature, Object newValue) 3953 { 3954 switch (eDerivedStructuralFeatureID(eFeature)) 3955 { 3956 case GenModelPackage.GEN_MODEL__COPYRIGHT_TEXT: 3957 setCopyrightText((String )newValue); 3958 return; 3959 case GenModelPackage.GEN_MODEL__MODEL_DIRECTORY: 3960 setModelDirectory((String )newValue); 3961 return; 3962 case GenModelPackage.GEN_MODEL__CREATION_COMMANDS: 3963 setCreationCommands(((Boolean )newValue).booleanValue()); 3964 return; 3965 case GenModelPackage.GEN_MODEL__CREATION_ICONS: 3966 setCreationIcons(((Boolean )newValue).booleanValue()); 3967 return; 3968 case GenModelPackage.GEN_MODEL__EDIT_DIRECTORY: 3969 setEditDirectory((String )newValue); 3970 return; 3971 case GenModelPackage.GEN_MODEL__EDITOR_DIRECTORY: 3972 setEditorDirectory((String )newValue); 3973 return; 3974 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_ID: 3975 setModelPluginID((String )newValue); 3976 return; 3977 case GenModelPackage.GEN_MODEL__TEMPLATE_DIRECTORY: 3978 setTemplateDirectory((String )newValue); 3979 return; 3980 case GenModelPackage.GEN_MODEL__RUNTIME_JAR: 3981 setRuntimeJar(((Boolean )newValue).booleanValue()); 3982 return; 3983 case GenModelPackage.GEN_MODEL__FOREIGN_MODEL: 3984 getForeignModel().clear(); 3985 getForeignModel().addAll((Collection )newValue); 3986 return; 3987 case GenModelPackage.GEN_MODEL__DYNAMIC_TEMPLATES: 3988 setDynamicTemplates(((Boolean )newValue).booleanValue()); 3989 return; 3990 case GenModelPackage.GEN_MODEL__REDIRECTION: 3991 setRedirection((String )newValue); 3992 return; 3993 case GenModelPackage.GEN_MODEL__FORCE_OVERWRITE: 3994 setForceOverwrite(((Boolean )newValue).booleanValue()); 3995 return; 3996 case GenModelPackage.GEN_MODEL__NON_EXTERNALIZED_STRING_TAG: 3997 setNonExternalizedStringTag((String )newValue); 3998 return; 3999 case GenModelPackage.GEN_MODEL__MODEL_NAME: 4000 setModelName((String )newValue); 4001 return; 4002 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_CLASS: 4003 setModelPluginClass((String )newValue); 4004 return; 4005 case GenModelPackage.GEN_MODEL__EDIT_PLUGIN_CLASS: 4006 setEditPluginClass((String )newValue); 4007 return; 4008 case GenModelPackage.GEN_MODEL__EDITOR_PLUGIN_CLASS: 4009 setEditorPluginClass((String )newValue); 4010 return; 4011 case GenModelPackage.GEN_MODEL__UPDATE_CLASSPATH: 4012 setUpdateClasspath(((Boolean )newValue).booleanValue()); 4013 return; 4014 case GenModelPackage.GEN_MODEL__GENERATE_SCHEMA: 4015 setGenerateSchema(((Boolean )newValue).booleanValue()); 4016 return; 4017 case GenModelPackage.GEN_MODEL__NON_NLS_MARKERS: 4018 setNonNLSMarkers(((Boolean )newValue).booleanValue()); 4019 return; 4020 case GenModelPackage.GEN_MODEL__STATIC_PACKAGES: 4021 getStaticPackages().clear(); 4022 getStaticPackages().addAll((Collection )newValue); 4023 return; 4024 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_VARIABLES: 4025 getModelPluginVariables().clear(); 4026 getModelPluginVariables().addAll((Collection )newValue); 4027 return; 4028 case GenModelPackage.GEN_MODEL__ROOT_EXTENDS_INTERFACE: 4029 setRootExtendsInterface((String )newValue); 4030 return; 4031 case GenModelPackage.GEN_MODEL__ROOT_EXTENDS_CLASS: 4032 setRootExtendsClass((String )newValue); 4033 return; 4034 case GenModelPackage.GEN_MODEL__ROOT_IMPLEMENTS_INTERFACE: 4035 setRootImplementsInterface((String )newValue); 4036 return; 4037 case GenModelPackage.GEN_MODEL__SUPPRESS_EMF_TYPES: 4038 setSuppressEMFTypes(((Boolean )newValue).booleanValue()); 4039 return; 4040 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERFACE: 4041 setFeatureMapWrapperInterface((String )newValue); 4042 return; 4043 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE: 4044 setFeatureMapWrapperInternalInterface((String )newValue); 4045 return; 4046 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_CLASS: 4047 setFeatureMapWrapperClass((String )newValue); 4048 return; 4049 case GenModelPackage.GEN_MODEL__RUNTIME_COMPATIBILITY: 4050 setRuntimeCompatibility(((Boolean )newValue).booleanValue()); 4051 return; 4052 case GenModelPackage.GEN_MODEL__RICH_CLIENT_PLATFORM: 4053 setRichClientPlatform(((Boolean )newValue).booleanValue()); 4054 return; 4055 case GenModelPackage.GEN_MODEL__REFLECTIVE_DELEGATION: 4056 setReflectiveDelegation(((Boolean )newValue).booleanValue()); 4057 return; 4058 case GenModelPackage.GEN_MODEL__CODE_FORMATTING: 4059 setCodeFormatting(((Boolean )newValue).booleanValue()); 4060 return; 4061 case GenModelPackage.GEN_MODEL__TESTS_DIRECTORY: 4062 setTestsDirectory((String )newValue); 4063 return; 4064 case GenModelPackage.GEN_MODEL__TEST_SUITE_CLASS: 4065 setTestSuiteClass((String )newValue); 4066 return; 4067 case GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_FIELD: 4068 setBooleanFlagsField((String )newValue); 4069 return; 4070 case GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_RESERVED_BITS: 4071 setBooleanFlagsReservedBits(((Integer )newValue).intValue()); 4072 return; 4073 case GenModelPackage.GEN_MODEL__IMPORTER_ID: 4074 setImporterID((String )newValue); 4075 return; 4076 case GenModelPackage.GEN_MODEL__BUNDLE_MANIFEST: 4077 setBundleManifest(((Boolean )newValue).booleanValue()); 4078 return; 4079 case GenModelPackage.GEN_MODEL__GEN_PACKAGES: 4080 getGenPackages().clear(); 4081 getGenPackages().addAll((Collection )newValue); 4082 return; 4083 case GenModelPackage.GEN_MODEL__USED_GEN_PACKAGES: 4084 getUsedGenPackages().clear(); 4085 getUsedGenPackages().addAll((Collection )newValue); 4086 return; 4087 } 4088 eDynamicSet(eFeature, newValue); 4089 } 4090 4091 4096 public void eUnset(EStructuralFeature eFeature) 4097 { 4098 switch (eDerivedStructuralFeatureID(eFeature)) 4099 { 4100 case GenModelPackage.GEN_MODEL__COPYRIGHT_TEXT: 4101 setCopyrightText(COPYRIGHT_TEXT_EDEFAULT); 4102 return; 4103 case GenModelPackage.GEN_MODEL__MODEL_DIRECTORY: 4104 setModelDirectory(MODEL_DIRECTORY_EDEFAULT); 4105 return; 4106 case GenModelPackage.GEN_MODEL__CREATION_COMMANDS: 4107 setCreationCommands(CREATION_COMMANDS_EDEFAULT); 4108 return; 4109 case GenModelPackage.GEN_MODEL__CREATION_ICONS: 4110 setCreationIcons(CREATION_ICONS_EDEFAULT); 4111 return; 4112 case GenModelPackage.GEN_MODEL__EDIT_DIRECTORY: 4113 unsetEditDirectory(); 4114 return; 4115 case GenModelPackage.GEN_MODEL__EDITOR_DIRECTORY: 4116 unsetEditorDirectory(); 4117 return; 4118 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_ID: 4119 setModelPluginID(MODEL_PLUGIN_ID_EDEFAULT); 4120 return; 4121 case GenModelPackage.GEN_MODEL__TEMPLATE_DIRECTORY: 4122 setTemplateDirectory(TEMPLATE_DIRECTORY_EDEFAULT); 4123 return; 4124 case GenModelPackage.GEN_MODEL__RUNTIME_JAR: 4125 setRuntimeJar(RUNTIME_JAR_EDEFAULT); 4126 return; 4127 case GenModelPackage.GEN_MODEL__FOREIGN_MODEL: 4128 getForeignModel().clear(); 4129 return; 4130 case GenModelPackage.GEN_MODEL__DYNAMIC_TEMPLATES: 4131 setDynamicTemplates(DYNAMIC_TEMPLATES_EDEFAULT); 4132 return; 4133 case GenModelPackage.GEN_MODEL__REDIRECTION: 4134 setRedirection(REDIRECTION_EDEFAULT); 4135 return; 4136 case GenModelPackage.GEN_MODEL__FORCE_OVERWRITE: 4137 setForceOverwrite(FORCE_OVERWRITE_EDEFAULT); 4138 return; 4139 case GenModelPackage.GEN_MODEL__NON_EXTERNALIZED_STRING_TAG: 4140 setNonExternalizedStringTag(NON_EXTERNALIZED_STRING_TAG_EDEFAULT); 4141 return; 4142 case GenModelPackage.GEN_MODEL__MODEL_NAME: 4143 setModelName(MODEL_NAME_EDEFAULT); 4144 return; 4145 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_CLASS: 4146 setModelPluginClass(MODEL_PLUGIN_CLASS_EDEFAULT); 4147 return; 4148 case GenModelPackage.GEN_MODEL__EDIT_PLUGIN_CLASS: 4149 unsetEditPluginClass(); 4150 return; 4151 case GenModelPackage.GEN_MODEL__EDITOR_PLUGIN_CLASS: 4152 unsetEditorPluginClass(); 4153 return; 4154 case GenModelPackage.GEN_MODEL__UPDATE_CLASSPATH: 4155 setUpdateClasspath(UPDATE_CLASSPATH_EDEFAULT); 4156 return; 4157 case GenModelPackage.GEN_MODEL__GENERATE_SCHEMA: 4158 setGenerateSchema(GENERATE_SCHEMA_EDEFAULT); 4159 return; 4160 case GenModelPackage.GEN_MODEL__NON_NLS_MARKERS: 4161 setNonNLSMarkers(NON_NLS_MARKERS_EDEFAULT); 4162 return; 4163 case GenModelPackage.GEN_MODEL__STATIC_PACKAGES: 4164 getStaticPackages().clear(); 4165 return; 4166 case GenModelPackage.GEN_MODEL__MODEL_PLUGIN_VARIABLES: 4167 getModelPluginVariables().clear(); 4168 return; 4169 case GenModelPackage.GEN_MODEL__ROOT_EXTENDS_INTERFACE: 4170 setRootExtendsInterface(ROOT_EXTENDS_INTERFACE_EDEFAULT); 4171 return; 4172 case GenModelPackage.GEN_MODEL__ROOT_EXTENDS_CLASS: 4173 setRootExtendsClass(ROOT_EXTENDS_CLASS_EDEFAULT); 4174 return; 4175 case GenModelPackage.GEN_MODEL__ROOT_IMPLEMENTS_INTERFACE: 4176 setRootImplementsInterface(ROOT_IMPLEMENTS_INTERFACE_EDEFAULT); 4177 return; 4178 case GenModelPackage.GEN_MODEL__SUPPRESS_EMF_TYPES: 4179 setSuppressEMFTypes(SUPPRESS_EMF_TYPES_EDEFAULT); 4180 return; 4181 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERFACE: 4182 setFeatureMapWrapperInterface(FEATURE_MAP_WRAPPER_INTERFACE_EDEFAULT); 4183 return; 4184 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE: 4185 setFeatureMapWrapperInternalInterface(FEATURE_MAP_WRAPPER_INTERNAL_INTERFACE_EDEFAULT); 4186 return; 4187 case GenModelPackage.GEN_MODEL__FEATURE_MAP_WRAPPER_CLASS: 4188 setFeatureMapWrapperClass(FEATURE_MAP_WRAPPER_CLASS_EDEFAULT); 4189 return; 4190 case GenModelPackage.GEN_MODEL__RUNTIME_COMPATIBILITY: 4191 setRuntimeCompatibility(RUNTIME_COMPATIBILITY_EDEFAULT); 4192 return; 4193 case GenModelPackage.GEN_MODEL__RICH_CLIENT_PLATFORM: 4194 setRichClientPlatform(RICH_CLIENT_PLATFORM_EDEFAULT); 4195 return; 4196 case GenModelPackage.GEN_MODEL__REFLECTIVE_DELEGATION: 4197 setReflectiveDelegation(REFLECTIVE_DELEGATION_EDEFAULT); 4198 return; 4199 case GenModelPackage.GEN_MODEL__CODE_FORMATTING: 4200 setCodeFormatting(CODE_FORMATTING_EDEFAULT); 4201 return; 4202 case GenModelPackage.GEN_MODEL__TESTS_DIRECTORY: 4203 unsetTestsDirectory(); 4204 return; 4205 case GenModelPackage.GEN_MODEL__TEST_SUITE_CLASS: 4206 unsetTestSuiteClass(); 4207 return; 4208 case GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_FIELD: 4209 setBooleanFlagsField(BOOLEAN_FLAGS_FIELD_EDEFAULT); 4210 return; 4211 case GenModelPackage.GEN_MODEL__BOOLEAN_FLAGS_RESERVED_BITS: 4212 setBooleanFlagsReservedBits(BOOLEAN_FLAGS_RESERVED_BITS_EDEFAULT); 4213 return; 4214 case GenModelPackage.GEN_MODEL__IMPORTER_ID: 4215 setImporterID(IMPORTER_ID_EDEFAULT); 4216 return; 4217 case GenModelPackage.GEN_MODEL__BUNDLE_MANIFEST: 4218 setBundleManifest(BUNDLE_MANIFEST_EDEFAULT); 4219 return; 4220 case GenModelPackage.GEN_MODEL__GEN_PACKAGES: 4221 getGenPackages().clear(); 4222 return; 4223 case GenModelPackage.GEN_MODEL__USED_GEN_PACKAGES: 4224 getUsedGenPackages().clear(); 4225 return; 4226 } 4227 eDynamicUnset(eFeature); 4228 } 4229 4230 4235 public String toString() 4236 { 4237 if (eIsProxy()) return super.toString(); 4238 4239 StringBuffer result = new StringBuffer (super.toString()); 4240 result.append(" (copyrightText: "); 4241 result.append(copyrightText); 4242 result.append(", modelDirectory: "); 4243 result.append(modelDirectory); 4244 result.append(", creationCommands: "); 4245 result.append(creationCommands); 4246 result.append(", creationIcons: "); 4247 result.append(creationIcons); 4248 result.append(", editDirectory: "); 4249 if (editDirectoryESet) result.append(editDirectory); else result.append("<unset>"); 4250 result.append(", editorDirectory: "); 4251 if (editorDirectoryESet) result.append(editorDirectory); else result.append("<unset>"); 4252 result.append(", modelPluginID: "); 4253 result.append(modelPluginID); 4254 result.append(", templateDirectory: "); 4255 result.append(templateDirectory); 4256 result.append(", runtimeJar: "); 4257 result.append(runtimeJar); 4258 result.append(", foreignModel: "); 4259 result.append(foreignModel); 4260 result.append(", dynamicTemplates: "); 4261 result.append(dynamicTemplates); 4262 result.append(", redirection: "); 4263 result.append(redirection); 4264 result.append(", forceOverwrite: "); 4265 result.append(forceOverwrite); 4266 result.append(", nonExternalizedStringTag: "); 4267 result.append(nonExternalizedStringTag); 4268 result.append(", modelName: "); 4269 result.append(modelName); 4270 result.append(", modelPluginClass: "); 4271 result.append(modelPluginClass); 4272 result.append(", editPluginClass: "); 4273 if (editPluginClassESet) result.append(editPluginClass); else result.append("<unset>"); 4274 result.append(", editorPluginClass: "); 4275 if (editorPluginClassESet) result.append(editorPluginClass); else result.append("<unset>"); 4276 result.append(", updateClasspath: "); 4277 result.append(updateClasspath); 4278 result.append(", generateSchema: "); 4279 result.append(generateSchema); 4280 result.append(", nonNLSMarkers: "); 4281 result.append(nonNLSMarkers); 4282 result.append(", staticPackages: "); 4283 result.append(staticPackages); 4284 result.append(", modelPluginVariables: "); 4285 result.append(modelPluginVariables); 4286 result.append(", rootExtendsInterface: "); 4287 result.append(rootExtendsInterface); 4288 result.append(", rootExtendsClass: "); 4289 result.append(rootExtendsClass); 4290 result.append(", rootImplementsInterface: "); 4291 result.append(rootImplementsInterface); 4292 result.append(", suppressEMFTypes: "); 4293 result.append(suppressEMFTypes); 4294 result.append(", featureMapWrapperInterface: "); 4295 result.append(featureMapWrapperInterface); 4296 result.append(", featureMapWrapperInternalInterface: "); 4297 result.append(featureMapWrapperInternalInterface); 4298 result.append(", featureMapWrapperClass: "); 4299 result.append(featureMapWrapperClass); 4300 result.append(", runtimeCompatibility: "); 4301 result.append(runtimeCompatibility); 4302 result.append(", richClientPlatform: "); 4303 result.append(richClientPlatform); 4304 result.append(", reflectiveDelegation: "); 4305 result.append(reflectiveDelegation); 4306 result.append(", codeFormatting: "); 4307 result.append(codeFormatting); 4308 result.append(", testsDirectory: "); 4309 if (testsDirectoryESet) result.append(testsDirectory); else result.append("<unset>"); 4310 result.append(", testSuiteClass: "); 4311 if (testSuiteClassESet) result.append(testSuiteClass); else result.append("<unset>"); 4312 result.append(", booleanFlagsField: "); 4313 result.append(booleanFlagsField); 4314 result.append(", booleanFlagsReservedBits: "); 4315 result.append(booleanFlagsReservedBits); 4316 result.append(", importerID: "); 4317 result.append(importerID); 4318 result.append(", bundleManifest: "); 4319 result.append(bundleManifest); 4320 result.append(')'); 4321 return result.toString(); 4322 } 4323 4324 static protected String getProjectPath(String path) 4325 { 4326 int beginIndex = path.startsWith("/") ? 1 : 0; 4327 int endIndex = path.indexOf("/", beginIndex); 4328 if (endIndex != -1) 4329 { 4330 return path.substring(0, endIndex); 4331 } 4332 else 4333 { 4334 return path; 4335 } 4336 } 4337 4338 public String getModelProjectDirectory() 4339 { 4340 return getProjectPath(getModelDirectory()); 4341 } 4342 4343 public String getEditProjectDirectory() 4344 { 4345 return getProjectPath(getEditDirectory()); 4346 } 4347 4348 public String getEditorProjectDirectory() 4349 { 4350 return getProjectPath(getEditorDirectory()); 4351 } 4352 4353 public String getTestsProjectDirectory() 4354 { 4355 return getProjectPath(getTestsDirectory()); 4356 } 4357 4358 public boolean sameModelEditProject() 4359 { 4360 return getModelProjectDirectory().equals(getEditProjectDirectory()); 4361 } 4362 4363 public boolean sameEditEditorProject() 4364 { 4365 return getEditProjectDirectory().equals(getEditorProjectDirectory()); 4366 } 4367 4368 public boolean sameModelEditorProject() 4369 { 4370 return getModelProjectDirectory().equals(getEditorProjectDirectory()); 4371 } 4372 4373 public boolean sameModelTestsProject() 4374 { 4375 return getTestsDirectory() == null ? false : getModelProjectDirectory().equals(getTestsProjectDirectory()); 4378 } 4379 4380 public String getEditIconsDirectory() 4381 { 4382 return getEditProjectDirectory() + "/icons"; 4383 } 4384 4385 public String getEditorIconsDirectory() 4386 { 4387 return getEditorProjectDirectory() + "/icons"; 4388 } 4389 4390 public String getEditPluginID() 4391 { 4392 if (sameModelEditProject()) 4393 { 4394 return getModelPluginID(); 4395 } 4396 else 4397 { 4398 return getModelPluginID() + ".edit"; 4399 } 4400 } 4401 4402 public String getEditorPluginID() 4403 { 4404 if (sameEditEditorProject()) 4405 { 4406 return getEditPluginID(); 4407 } 4408 else 4409 { 4410 return getModelPluginID() + ".editor"; 4411 } 4412 } 4413 4414 public String getTestsPluginID() 4415 { 4416 if (sameModelTestsProject()) 4417 { 4418 return getModelPluginID(); 4419 } 4420 else 4421 { 4422 return getModelPluginID() + ".tests"; 4423 } 4424 } 4425 4426 public boolean hasModelPluginClass() 4427 { 4428 return !sameModelEditProject() && !sameModelEditorProject() && 4429 !isBlank(getModelPluginClass()); 4430 } 4431 4432 protected String getModelPluginClassToUse() 4433 { 4434 String result = getModelPluginClass(); 4435 if (isBlank(result) && sameModelEditProject()) 4436 { 4437 result = getEditPluginClass(); 4438 } 4439 if (isBlank(result) && sameModelEditorProject()) 4440 { 4441 result = getEditorPluginClass(); 4442 } 4443 return result; 4444 } 4445 4446 protected String getEditPluginClassToUse() 4447 { 4448 String result = null; 4449 if (sameModelEditProject()) 4450 { 4451 result = getModelPluginClass(); 4452 } 4453 if (isBlank(result)) 4454 { 4455 result = getEditPluginClass(); 4456 } 4457 if (isBlank(result) && sameEditEditorProject()) 4458 { 4459 result = getEditorPluginClass(); 4460 } 4461 return result; 4462 } 4463 4464 protected String getEditPluginDirectory() 4465 { 4466 String result = getEditDirectory(); 4467 String plugin = null; 4468 if (sameModelEditProject()) 4469 { 4470 plugin = getModelPluginClass(); 4471 result = getModelDirectory(); 4472 } 4473 if (isBlank(plugin)) 4474 { 4475 plugin = getEditPluginClass(); 4476 result = getEditDirectory(); 4477 } 4478 if (isBlank(plugin) && sameEditEditorProject()) 4479 { 4480 plugin = getEditorPluginClass(); 4481 result = getEditorDirectory(); 4482 } 4483 return result; 4484 } 4485 4486 protected String getEditorPluginClassToUse() 4487 { 4488 String result = null; 4489 if (sameModelEditorProject()) 4490 { 4491 result = getModelPluginClass(); 4492 } 4493 if (isBlank(result) && sameEditEditorProject()) 4494 { 4495 result = getEditPluginClass(); 4496 } 4497 if (isBlank(result)) 4498 { 4499 result = getEditorPluginClass(); 4500 } 4501 return result; 4502 } 4503 4504 protected String getEditorPluginDirectory() 4505 { 4506 String result = getEditorDirectory(); 4507 String plugin = null; 4508 if (sameModelEditorProject()) 4509 { 4510 plugin = getModelPluginClass(); 4511 result = getModelDirectory(); 4512 } 4513 if (isBlank(plugin) && sameEditEditorProject()) 4514 { 4515 plugin = getEditPluginClass(); 4516 result = getEditDirectory(); 4517 } 4518 if (isBlank(plugin)) 4519 { 4520 plugin = getEditorPluginClass(); 4521 result = getEditorDirectory(); 4522 } 4523 return result; 4524 } 4525 4526 protected String getPluginClassName(String baseName, String defaultSuffix) 4527 { 4528 if (baseName == null) 4529 { 4530 String modelName = getModelName(); 4531 baseName = (isBlank(modelName) ? "" : modelName) + defaultSuffix; 4532 } 4533 else 4534 { 4535 baseName = CodeGenUtil.getSimpleClassName(baseName); 4536 } 4537 return baseName; 4538 } 4539 4540 protected String getPluginPackageName(String baseName, String pluginID) 4541 { 4542 if (baseName == null) 4543 { 4544 baseName = createPackageName(pluginID); 4545 } 4546 else 4547 { 4548 int index = baseName.lastIndexOf("."); 4549 if (index == -1) 4550 { 4551 baseName = createPackageName(pluginID); 4552 } 4553 else 4554 { 4555 baseName = CodeGenUtil.getPackageName(baseName); 4556 } 4557 } 4558 return baseName; 4559 } 4560 4561 protected String createPackageName(String text) 4562 { 4563 return text != null ? text.toLowerCase() : ""; 4564 } 4565 4566 public String getModelPluginPackageName() 4567 { 4568 return getPluginPackageName(getModelPluginClassToUse(), getModelPluginID()); 4569 } 4570 4571 public String getModelPluginClassName() 4572 { 4573 return getPluginClassName(getModelPluginClassToUse(), "Plugin"); 4574 } 4575 4576 public String getQualifiedModelPluginClassName() 4577 { 4578 return getModelPluginPackageName() + "." + getModelPluginClassName(); 4579 } 4580 4581 public String getEditPluginPackageName() 4582 { 4583 return getPluginPackageName(getEditPluginClassToUse(), getEditPluginID()); 4584 } 4585 4586 public String getEditPluginClassName() 4587 { 4588 return getPluginClassName(getEditPluginClassToUse(), "EditPlugin"); 4589 } 4590 4591 public String getQualifiedEditPluginClassName() 4592 { 4593 return getEditPluginPackageName() + "." + getEditPluginClassName(); 4594 } 4595 4596 public String getEditorPluginPackageName() 4597 { 4598 return getPluginPackageName(getEditorPluginClassToUse(), getEditorPluginID()); 4599 } 4600 4601 public String getEditorPluginClassName() 4602 { 4603 return getPluginClassName(getEditorPluginClassToUse(), "EditorPlugin"); 4604 } 4605 4606 public String getQualifiedEditorPluginClassName() 4607 { 4608 return getEditorPluginPackageName() + "." + getEditorPluginClassName(); 4609 } 4610 4611 public String getQualifiedEditorAdvisorClassName() 4612 { 4613 return getEditorPluginPackageName() + "." + getEditorAdvisorClassName(); 4614 } 4615 4616 public String getEditorAdvisorClassName() 4617 { 4618 String modelName = getModelName(); 4619 return (modelName != null ? getModelName() : "") + "EditorAdvisor"; 4620 } 4621 4622 public String getTestSuitePackageName() 4623 { 4624 return getPluginPackageName(getTestSuiteClass(), getTestsPluginID()); 4625 } 4626 4627 public String getTestSuiteClassName() 4628 { 4629 return getPluginClassName(getTestSuiteClass(), "AllTests"); 4630 } 4631 4632 public String getQualifiedTestSuiteClassName() 4633 { 4634 return getTestSuitePackageName() + "." + getTestSuiteClassName(); 4635 } 4636 4637 protected void getAllGenPackagesWithClassifiersHelper(List result, List genPackages) 4638 { 4639 for (Iterator i = genPackages.iterator(); i.hasNext(); ) 4640 { 4641 GenPackage genPackage = (GenPackage)i.next(); 4642 if (genPackage.hasClassifiers()) 4643 { 4644 result.add(genPackage); 4645 } 4646 getAllGenPackagesWithClassifiersHelper(result, genPackage.getNestedGenPackages()); 4647 } 4648 } 4649 4650 public List getAllGenPackagesWithClassifiers() 4651 { 4652 List result = new ArrayList (); 4653 getAllGenPackagesWithClassifiersHelper(result, getGenPackages()); 4654 return result; 4655 } 4656 4657 public List getAllUsedGenPackagesWithClassifiers() 4658 { 4659 List result = new ArrayList (); 4660 getAllGenPackagesWithClassifiersHelper(result, getUsedGenPackages()); 4661 return result; 4662 } 4663 4664 public List getAllGenAndUsedGenPackagesWithClassifiers() 4665 { 4666 List result = new ArrayList (); 4667 getAllGenPackagesWithClassifiersHelper(result, getGenPackages()); 4668 getAllGenPackagesWithClassifiersHelper(result, getUsedGenPackages()); 4669 return result; 4670 } 4671 4672 public List getAllGenUsedAndStaticGenPackagesWithClassifiers() 4673 { 4674 List result = new ArrayList (); 4675 getAllGenPackagesWithClassifiersHelper(result, getGenPackages()); 4676 getAllGenPackagesWithClassifiersHelper(result, getUsedGenPackages()); 4677 getAllGenPackagesWithClassifiersHelper(result, getStaticGenPackages()); 4678 return result; 4679 } 4680 4681 public List getModelQualifiedPackageNames() 4682 { 4683 EList packageNames = sameModelTestsProject() ? 4684 (EList)getTestsQualifiedPackageNames() : 4685 new UniqueEList(); 4686 4687 TreeIterator genPackagesIterator = new AbstractTreeIterator(getGenPackages(), false) 4688 { 4689 protected Iterator getChildren(Object object) 4690 { 4691 return object instanceof Collection ? 4692 ((Collection )object).iterator() : 4693 ((GenPackage)object).getNestedGenPackages().iterator(); 4694 } 4695 }; 4696 while(genPackagesIterator.hasNext()) 4697 { 4698 GenPackage genPackage = (GenPackage)genPackagesIterator.next(); 4699 addQualifiedModelPackageNames(packageNames, genPackage); 4700 } 4701 4702 String pluginClassPackage = CodeGenUtil.getPackageName(getModelPluginClassToUse()); 4703 if (!isBlank(pluginClassPackage)) 4704 { 4705 packageNames.add(pluginClassPackage); 4706 } 4707 4708 ECollections.sort(packageNames); 4709 return packageNames; 4710 } 4711 4712 protected void addQualifiedModelPackageNames(List packageNames, GenPackage genPackage) 4713 { 4714 if (genPackage.hasClassifiers()) 4715 { 4716 packageNames.add(genPackage.getInterfacePackageName()); 4717 packageNames.add(genPackage.getClassPackageName()); 4718 packageNames.add(genPackage.getUtilitiesPackageName()); 4719 } 4720 } 4721 4722 public List getModelRequiredPlugins() 4723 { 4724 List result = new UniqueEList(); 4725 result.add(needsRuntimeCompatibility() ? "org.eclipse.core.runtime.compatibility" : "org.eclipse.core.runtime"); 4726 result.add("org.eclipse.emf.ecore"); 4727 result.addAll(getEffectiveModelPluginIDs()); 4728 for (Iterator i = getGenPackages().iterator(); i.hasNext(); ) 4729 { 4730 GenPackage genPackage = (GenPackage)i.next(); 4731 if (genPackage.getResource() != GenResourceKind.NONE_LITERAL || genPackage.isLoadingInitialization()) 4732 { 4733 result.add("org.eclipse.emf.ecore.xmi"); 4734 break; 4735 } 4736 } 4737 for (Iterator i = getUsedGenPackages().iterator(); i.hasNext(); ) 4738 { 4739 GenPackage genPackage = (GenPackage)i.next(); 4740 result.add(genPackage.getGenModel().getModelPluginID()); 4741 } 4742 4743 if (sameModelTestsProject()) 4744 { 4745 result.add("org.junit"); 4746 } 4747 4748 return result; 4749 } 4750 4751 public List getEditQualifiedPackageNames() 4752 { 4753 EList packageNames = sameModelEditProject() ? 4754 (EList)getModelQualifiedPackageNames() : 4755 new UniqueEList(); 4756 4757 TreeIterator genPackagesIterator = new AbstractTreeIterator(getGenPackages(), false) 4758 { 4759 protected Iterator getChildren(Object object) 4760 { 4761 return object instanceof Collection ? 4762 ((Collection )object).iterator() : 4763 ((GenPackage)object).getNestedGenPackages().iterator(); 4764 } 4765 }; 4766 while(genPackagesIterator.hasNext()) 4767 { 4768 GenPackage genPackage = (GenPackage)genPackagesIterator.next(); 4769 addQualifiedEditPackageNames(packageNames, genPackage); 4770 } 4771 4772 String pluginClassPackage = CodeGenUtil.getPackageName(getEditPluginClassToUse()); 4773 if (!isBlank(pluginClassPackage)) 4774 { 4775 packageNames.add(pluginClassPackage); 4776 } 4777 4778 ECollections.sort(packageNames); 4779 return packageNames; 4780 } 4781 4782 protected void addQualifiedEditPackageNames(List packageNames, GenPackage genPackage) 4783 { 4784 if (genPackage.hasClassifiers()) 4785 { 4786 packageNames.add(genPackage.getProviderPackageName()); 4787 } 4788 } 4789 4790 public List getEditRequiredPlugins() 4791 { 4792 List result = new UniqueEList(); 4793 result.add(needsRuntimeCompatibility() ? "org.eclipse.core.runtime.compatibility" : "org.eclipse.core.runtime"); 4794 4795 if (!sameModelEditProject()) 4796 { 4797 for (Iterator i = getGenPackages().iterator(); i.hasNext(); ) 4798 { 4799 GenPackage genPackage = (GenPackage)i.next(); 4800 result.add(genPackage.getGenModel().getModelPluginID()); 4801 } 4802 } 4803 else 4804 { 4805 result.addAll(getModelRequiredPlugins()); 4806 } 4807 4808 result.add("org.eclipse.emf.edit"); 4809 4810 for (Iterator i = getUsedGenPackages().iterator(); i.hasNext(); ) 4811 { 4812 GenPackage genPackage = (GenPackage)i.next(); 4813 GenModel genModel = genPackage.getGenModel(); 4814 result.add(genModel.getModelPluginID()); 4815 if (genModel.hasEditSupport()) 4816 { 4817 result.add(genModel.getEditPluginID()); 4818 } 4819 } 4820 return result; 4821 } 4822 4823 public List getEditorQualifiedPackageNames() 4824 { 4825 EList packageNames = sameModelEditorProject() || sameEditEditorProject() ? 4826 (EList)getEditQualifiedPackageNames() : 4827 new UniqueEList(); 4828 4829 TreeIterator genPackagesIterator = new AbstractTreeIterator(getGenPackages(), false) 4830 { 4831 protected Iterator getChildren(Object object) 4832 { 4833 return object instanceof Collection ? 4834 ((Collection )object).iterator() : 4835 ((GenPackage)object).getNestedGenPackages().iterator(); 4836 } 4837 }; 4838 while(genPackagesIterator.hasNext()) 4839 { 4840 GenPackage genPackage = (GenPackage)genPackagesIterator.next(); 4841 addQualifiedEditorPackageNames(packageNames, genPackage); 4842 } 4843 4844 String pluginClassPackage = CodeGenUtil.getPackageName(getEditorPluginClassToUse()); 4845 if (!isBlank(pluginClassPackage)) 4846 { 4847 packageNames.add(pluginClassPackage); 4848 } 4849 4850 ECollections.sort(packageNames); 4851 return packageNames; 4852 } 4853 4854 protected void addQualifiedEditorPackageNames(List packageNames, GenPackage genPackage) 4855 { 4856 if (genPackage.hasClassifiers() && genPackage.hasConcreteClasses()) 4857 { 4858 packageNames.add(genPackage.getPresentationPackageName()); 4859 } 4860 } 4861 4862 public List getEditorRequiredPlugins() 4863 { 4864 List result = new UniqueEList(); 4865 result.add(needsRuntimeCompatibility() ? "org.eclipse.core.runtime.compatibility" : "org.eclipse.core.runtime"); 4866 if (!isRichClientPlatform()) 4867 { 4868 result.add("org.eclipse.core.resources"); 4869 } 4870 4871 if (!sameEditEditorProject()) 4872 { 4873 for (Iterator i = getGenPackages().iterator(); i.hasNext(); ) 4874 { 4875 GenPackage genPackage = (GenPackage)i.next(); 4876 GenModel genModel = genPackage.getGenModel(); 4877 if (genModel.hasEditSupport()) 4878 { 4879 result.add(genModel.getEditPluginID()); 4880 } 4881 } 4882 } 4883 else 4884 { 4885 result.addAll(getEditRequiredPlugins()); 4886 } 4887 result.add("org.eclipse.emf.ecore.xmi"); 4888 result.add("org.eclipse.emf.edit.ui"); 4889 if (!isRichClientPlatform()) 4890 { 4891 result.add("org.eclipse.ui.ide"); 4892 } 4893 for (Iterator i = getUsedGenPackages().iterator(); i.hasNext(); ) 4894 { 4895 GenPackage genPackage = (GenPackage)i.next(); 4896 GenModel genModel = genPackage.getGenModel(); 4897 if (genModel.hasEditSupport()) 4898 { 4899 result.add(genModel.getEditPluginID()); 4900 } 4901 } 4902 return result; 4903 } 4904 4905 public List getTestsQualifiedPackageNames() 4906 { 4907 EList packageNames = new UniqueEList(); 4908 4909 TreeIterator genPackagesIterator = new AbstractTreeIterator(getGenPackages(), false) 4910 { 4911 protected Iterator getChildren(Object object) 4912 { 4913 return object instanceof Collection ? 4914 ((Collection )object).iterator() : 4915 ((GenPackage)object).getNestedGenPackages().iterator(); 4916 } 4917 }; 4918 while(genPackagesIterator.hasNext()) 4919 { 4920 GenPackage genPackage = (GenPackage)genPackagesIterator.next(); 4921 addQualifiedTestsPackageNames(packageNames, genPackage); 4922 } 4923 4924 String pluginClassPackage = CodeGenUtil.getPackageName(getTestSuiteClass()); 4925 if (!isBlank(pluginClassPackage)) 4926 { 4927 packageNames.add(pluginClassPackage); 4928 } 4929 4930 ECollections.sort(packageNames); 4931 return packageNames; 4932 } 4933 4934 protected void addQualifiedTestsPackageNames(List packageNames, GenPackage genPackage) 4935 { 4936 if (genPackage.hasClassifiers()) 4937 { 4938 packageNames.add(genPackage.getTestsPackageName()); 4939 } 4940 } 4941 4942 public List getTestsRequiredPlugins() 4943 { 4944 List result = new UniqueEList(); 4945 result.add(needsRuntimeCompatibility() ? "org.eclipse.core.runtime.compatibility" : "org.eclipse.core.runtime"); 4946 4947 result.add(getModelPluginID()); 4948 for (Iterator i = getUsedGenPackages().iterator(); i.hasNext();) 4949 { 4950 GenPackage genPackage = (GenPackage)i.next(); 4951 GenModel genModel = genPackage.getGenModel(); 4952 result.add(genModel.getModelPluginID()); 4953 } 4954 4955 result.add("org.eclipse.emf.ecore.xmi"); 4956 4957 result.add("org.junit"); 4958 4959 return result; 4960 } 4961 4962 public List getEditResourceDelegateImportedPluginClassNames() 4963 { 4964 List result = new UniqueEList(); 4965 for (Iterator i = getUsedGenPackages().iterator(); i.hasNext(); ) 4966 { 4967 GenPackage genPackage = (GenPackage)i.next(); 4968 GenModel genModel = genPackage.getGenModel(); 4969 if (genModel.hasEditSupport()) 4970 { 4971 result.add(genModel.getImportedName(genModel.getQualifiedEditPluginClassName())); 4972 } 4973 } 4974 return result; 4975 } 4976 4977 public boolean reconcile(GenModel oldGenModelVersion) 4978 { 4979 boolean result = false; 4980 if (oldGenModelVersion != null) 4981 { 4982 for (Iterator i = getGenPackages().iterator(); i.hasNext(); ) 4983 { 4984 GenPackage genPackage = (GenPackage)i.next(); 4985 for (Iterator j = oldGenModelVersion.getGenPackages().iterator(); j.hasNext(); ) 4986 { 4987 GenPackage oldGenPackageVersion = (GenPackage)j.next(); 4988 if (genPackage.reconcile(oldGenPackageVersion)) 4989 { 4990 result = true; 4991 break; 4992 } 4993 } 4994 } 4995 4996 reconcileSettings(oldGenModelVersion); 4997 } 4998 4999 return result; 5000 } 5001 5002 protected void reconcileSettings(GenModel oldGenModelVersion) 5003 { 5004 if (oldGenModelVersion.isSetEditDirectory()) 5005 { 5006 setEditDirectory(oldGenModelVersion.getEditDirectory()); 5007 } 5008 else 5009 { 5010 unsetEditDirectory(); 5011 } 5012 if (oldGenModelVersion.isSetEditPluginClass()) 5013 { 5014 setEditPluginClass(oldGenModelVersion.getEditPluginClass()); 5015 } 5016 else 5017 { 5018 unsetEditPluginClass(); 5019 } 5020 if (oldGenModelVersion.isSetEditorDirectory()) 5021 { 5022 setEditorDirectory(oldGenModelVersion.getEditorDirectory()); 5023 } 5024 else 5025 { 5026 unsetEditorDirectory(); 5027 } 5028 if (oldGenModelVersion.isSetEditorPluginClass()) 5029 { 5030 setEditorPluginClass(oldGenModelVersion.getEditorPluginClass()); 5031 } 5032 else 5033 { 5034 unsetEditorPluginClass(); 5035 } 5036 if (oldGenModelVersion.isSetTestsDirectory()) 5037 { 5038 setTestsDirectory(oldGenModelVersion.getTestsDirectory()); 5039 } 5040 else 5041 { 5042 unsetTestsDirectory(); 5043 } 5044 if (oldGenModelVersion.isSetTestSuiteClass()) 5045 { 5046 setTestSuiteClass(oldGenModelVersion.getTestSuiteClass()); 5047 } 5048 else 5049 { 5050 unsetTestSuiteClass(); 5051 } 5052 5053 setCopyrightText(oldGenModelVersion.getCopyrightText()); 5054 setModelDirectory(oldGenModelVersion.getModelDirectory()); 5055 setCreationCommands(oldGenModelVersion.isCreationCommands()); 5056 setCreationIcons(oldGenModelVersion.isCreationIcons()); 5057 setModelPluginID(oldGenModelVersion.getModelPluginID()); 5058 setTemplateDirectory(oldGenModelVersion.getTemplateDirectory()); 5059 setRuntimeJar(oldGenModelVersion.isRuntimeJar()); 5060 setBundleManifest(oldGenModelVersion.isBundleManifest()); 5061 5062 5065 setDynamicTemplates(oldGenModelVersion.isDynamicTemplates()); 5066 setRedirection(oldGenModelVersion.getRedirection()); 5067 setForceOverwrite(oldGenModelVersion.isForceOverwrite()); 5068 setNonExternalizedStringTag(oldGenModelVersion.getNonExternalizedStringTag()); 5069 5070 setModelName(oldGenModelVersion.getModelName()); 5071 5072 setModelPluginClass(oldGenModelVersion.getModelPluginClass()); 5073 setUpdateClasspath(oldGenModelVersion.isUpdateClasspath()); 5074 setGenerateSchema(oldGenModelVersion.isGenerateSchema()); 5075 setNonNLSMarkers(oldGenModelVersion.isNonNLSMarkers()); 5076 getModelPluginVariables().addAll(oldGenModelVersion.getModelPluginVariables()); 5077 getStaticPackages().addAll(oldGenModelVersion.getStaticPackages()); 5078 setRootExtendsInterface(oldGenModelVersion.getRootExtendsInterface()); 5079 setRootImplementsInterface(oldGenModelVersion.getRootImplementsInterface()); 5080 setRootExtendsClass(oldGenModelVersion.getRootExtendsClass()); 5081 setSuppressEMFTypes(oldGenModelVersion.isSuppressEMFTypes()); 5082 setFeatureMapWrapperInterface(oldGenModelVersion.getFeatureMapWrapperInterface()); 5083 setFeatureMapWrapperInternalInterface(oldGenModelVersion.getFeatureMapWrapperInternalInterface()); 5084 setFeatureMapWrapperClass(oldGenModelVersion.getFeatureMapWrapperClass()); 5085 5086 setRuntimeCompatibility(oldGenModelVersion.isRuntimeCompatibility()); 5087 setRichClientPlatform(oldGenModelVersion.isRichClientPlatform()); 5088 setCodeFormatting(oldGenModelVersion.isCodeFormatting()); 5089 5090 setBooleanFlagsField(oldGenModelVersion.getBooleanFlagsField()); 5091 setBooleanFlagsReservedBits(oldGenModelVersion.getBooleanFlagsReservedBits()); 5092 } 5093 5094 public boolean reconcile() 5095 { 5096 for (Iterator i = getGenPackages().iterator(); i.hasNext(); ) 5097 { 5098 GenPackage genPackage = (GenPackage)i.next(); 5099 if (!genPackage.reconcile()) 5100 { 5101 i.remove(); 5102 } 5103 } 5104 for (Iterator i = getUsedGenPackages().iterator(); i.hasNext(); ) 5105 { 5106 GenPackage genPackage = (GenPackage)i.next(); 5107 if (!genPackage.reconcile()) 5108 { 5109 i.remove(); 5110 } 5111 } 5112 getUsedGenPackages().addAll(computeMissingUsedGenPackages()); 5113 5114 return !getGenPackages().isEmpty(); 5115 } 5116 5117 public List computeMissingUsedGenPackages() 5118 { 5119 List missingEPackages = getMissingPackages(); 5120 if (!missingEPackages.isEmpty()) 5121 { 5122 List allGenModels = new UniqueEList.FastCompare(); 5123 allGenModels.add(this); 5124 for (int i = 0; i < allGenModels.size(); i++) 5125 { 5126 GenModel genModel = (GenModel)allGenModels.get(i); 5127 for (int j = 0; j < genModel.getUsedGenPackages().size(); j++) 5128 { 5129 GenPackage genPackage = (GenPackage)genModel.getUsedGenPackages().get(j); 5130 allGenModels.add(genPackage.getGenModel()); 5131 } 5132 } 5133 5134 List usedGenPackages = new UniqueEList.FastCompare(); 5135 for (int i = 0; i < missingEPackages.size(); i++) 5136 { 5137 EPackage ePackage = (EPackage)missingEPackages.get(i); 5138 for (int j = 0; j < allGenModels.size(); j++) 5139 { 5140 GenModel genModel = (GenModel)allGenModels.get(j); 5141 GenPackage genPackage = genModel.findGenPackage(ePackage); 5142 if (genPackage != null) 5143 { 5144 usedGenPackages.add(genPackage); 5145 getMissingPackagesHelper(missingEPackages, Collections.singletonList(genPackage)); 5146 break; 5147 } 5148 } 5149 } 5150 return usedGenPackages; 5151 } 5152 else 5153 { 5154 return Collections.EMPTY_LIST; 5155 } 5156 } 5157 5158 public List getMissingPackages() 5159 { 5160 List ePackages = new UniqueEList(); 5161 getMissingPackagesHelper(ePackages, getGenPackages()); 5162 getMissingPackagesHelper(ePackages, getUsedGenPackages()); 5163 return ePackages; 5164 } 5165 5166 protected void getMissingPackagesHelper(List ePackages, List genPackages) 5167 { 5168 for (Iterator i = genPackages.iterator(); i.hasNext(); ) 5169 { 5170 GenPackage genPackage = (GenPackage)i.next(); 5171 EPackage ePackage = genPackage.getEcorePackage(); 5172 if (ePackage != null) 5173 { 5174 for (Iterator j = ePackage.eAllContents(); j.hasNext();) 5175 { 5176 EObject eObject = (EObject)j.next(); 5177 for (Iterator k = eObject.eCrossReferences().iterator(); k.hasNext(); ) 5178 { 5179 Object o = k.next(); 5180 if (o instanceof EClassifier) 5181 { 5182 EClassifier eClassifier = (EClassifier)o; 5183 if (findGenClassifier(eClassifier) == null) 5184 { 5185 ePackages.add(eClassifier.getEPackage()); 5186 } 5187 } 5188 } 5189 } 5190 } 5191 } 5192 } 5193 5194 5195 public boolean hasXMLDependency() 5196 { 5197 for (Iterator i = getAllGenPackagesWithClassifiers().iterator(); i.hasNext(); ) 5198 { 5199 GenPackage genPackage = (GenPackage)i.next(); 5200 switch (genPackage.getResource().getValue()) 5201 { 5202 case GenResourceKind.XML: 5203 case GenResourceKind.XMI: 5204 { 5205 return true; 5206 } 5207 } 5208 } 5209 return false; 5210 } 5211 5212 public String getXMLEncodingChoices() 5213 { 5214 return CodeGenEcorePlugin.INSTANCE.getString("_UI_XMLEncodingChoices"); 5215 } 5216 5217 public String getIndentation(StringBuffer stringBuffer) 5218 { 5219 int index = stringBuffer.length(); 5220 LOOP: 5221 while (--index >= 0) 5222 { 5223 switch (stringBuffer.charAt(index)) 5224 { 5225 case '\n': 5226 case '\r': 5227 { 5228 break LOOP; 5229 } 5230 } 5231 } 5232 return stringBuffer.substring(index + 1); 5233 } 5234 5235 public EModelElement getEcoreModelElement() 5236 { 5237 return ((GenPackage)getGenPackages().get(0)).getEcorePackage(); 5238 } 5239 5240 public List getAllGenFeatures() 5241 { 5242 List result = new ArrayList (); 5243 5244 List delegated = new ArrayList (); 5247 5248 for (Iterator iter = getAllGenAndUsedGenPackagesWithClassifiers().iterator(); iter.hasNext(); ) 5249 { 5250 GenPackage genPackage = (GenPackage)iter.next(); 5251 if (genPackage.getGenModel() == this || !genPackage.getGenModel().hasEditSupport()) 5252 { 5253 for (Iterator fIter = genPackage.getAllGenFeatures().iterator(); fIter.hasNext(); ) 5254 { 5255 GenFeature genFeature = (GenFeature)fIter.next(); 5256 List addTo = genFeature.getGenPackage() == genPackage ? result : delegated; 5257 addTo.add(genFeature); 5258 } 5259 } 5260 } 5261 5262 if (!delegated.isEmpty()) 5265 { 5266 addNonDuplicates(result, delegated, null); 5267 } 5268 return result; 5269 } 5270 5271 public List getFilteredAllGenFeatures() 5272 { 5273 ArrayList result = new ArrayList (); 5274 5275 Set noDupSet = new HashSet (); 5280 for (Iterator iter = getAllGenFeatures().iterator(); iter.hasNext(); ) 5281 { 5282 GenFeature genFeature = (GenFeature)iter.next(); 5283 if (isCreationCommands() || genFeature.isProperty()) 5284 { 5285 if (noDupSet.add(genFeature.getGenClass().getName() + "_" + genFeature.getName())) 5286 { 5287 result.add(genFeature); 5288 } 5289 } 5290 } 5291 return result; 5292 } 5293 5294 protected Map codeFormatterOptions = null; 5295 5296 public void setCodeFormatterOptions(Map options) 5297 { 5298 codeFormatterOptions = options; 5299 } 5300 5301 public CodeFormatter createCodeFormatter() 5302 { 5303 return ToolFactory.createCodeFormatter(codeFormatterOptions); 5304 } 5305 5306 public boolean isBooleanFlagsEnabled() 5307 { 5308 return !isBlank(getBooleanFlagsField()) && !isReflectiveDelegation(); 5309 } 5310 5311 public GenModel createGenModel() 5312 { 5313 return GenModelFactory.eINSTANCE.createGenModel(); 5314 } 5315 5316 public GenPackage createGenPackage() 5317 { 5318 return GenModelFactory.eINSTANCE.createGenPackage(); 5319 } 5320 5321 public GenClass createGenClass() 5322 { 5323 return GenModelFactory.eINSTANCE.createGenClass(); 5324 } 5325 5326 public GenFeature createGenFeature() 5327 { 5328 return GenModelFactory.eINSTANCE.createGenFeature(); 5329 } 5330 5331 public GenEnum createGenEnum() 5332 { 5333 return GenModelFactory.eINSTANCE.createGenEnum(); 5334 } 5335 5336 public GenEnumLiteral createGenEnumLiteral() 5337 { 5338 return GenModelFactory.eINSTANCE.createGenEnumLiteral(); 5339 } 5340 5341 public GenDataType createGenDataType() 5342 { 5343 return GenModelFactory.eINSTANCE.createGenDataType(); 5344 } 5345 5346 public GenOperation createGenOperation() 5347 { 5348 return GenModelFactory.eINSTANCE.createGenOperation(); 5349 } 5350 5351 public GenParameter createGenParameter() 5352 { 5353 return GenModelFactory.eINSTANCE.createGenParameter(); 5354 } 5355 5356 public Set getPropertyCategories() 5357 { 5358 Set categories = new HashSet (); 5359 for (Iterator i = getFilteredAllGenFeatures().iterator(); i.hasNext();) 5360 { 5361 String category = ((GenFeature)i.next()).getPropertyCategory(); 5362 5363 if (!isBlank(category)) 5364 { 5365 categories.add(category); 5366 } 5367 } 5368 return categories; 5369 } 5370 5371 public boolean hasLocalGenModel() 5372 { 5373 if (eResource() != null && eResource().getURI() != null) 5374 { 5375 URI genModelURI = eResource().getURI(); 5376 URI modelDirectory = URI.createURI(getModelDirectory()); 5377 return 5378 "platform".equals(genModelURI.scheme()) && 5379 genModelURI.segmentCount() > 1 && 5380 "resource".equals(genModelURI.segment(0)) && 5381 modelDirectory.segmentCount() > 0 && 5382 genModelURI.segment(1).equals(modelDirectory.segment(0)); 5383 } 5384 else 5385 { 5386 return false; 5387 } 5388 } 5389 5390 public String getRelativeGenModelLocation() 5391 { 5392 URI genModelURI = eResource().getURI(); 5393 String result = genModelURI.deresolve(genModelURI.trimSegments(genModelURI.segmentCount() - 3)).toString(); 5394 return result; 5395 } 5396 5397 public String getPropertyCategoryKey(String category) 5398 { 5399 return "_UI_" + CodeGenUtil.validJavaIdentifier(category) + "PropertyCategory"; 5400 } 5401 5402} | Popular Tags |