| 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 |