1 17 package org.eclipse.emf.codegen.ecore.genmodel.impl; 18 19 20 import java.util.ArrayList ; 21 import java.util.Arrays ; 22 import java.util.Collection ; 23 import java.util.Collections ; 24 import java.util.HashSet ; 25 import java.util.Iterator ; 26 import java.util.LinkedHashMap ; 27 import java.util.List ; 28 import java.util.Map ; 29 import java.util.Set ; 30 31 import org.eclipse.core.runtime.IProgressMonitor; 32 import org.eclipse.core.runtime.SubProgressMonitor; 33 import org.eclipse.emf.codegen.ecore.CodeGenEcorePlugin; 34 import org.eclipse.emf.codegen.ecore.Generator; 35 import org.eclipse.emf.codegen.ecore.genmodel.GenClass; 36 import org.eclipse.emf.codegen.ecore.genmodel.GenClassifier; 37 import org.eclipse.emf.codegen.ecore.genmodel.GenFeature; 38 import org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage; 39 import org.eclipse.emf.codegen.ecore.genmodel.GenOperation; 40 import org.eclipse.emf.codegen.ecore.genmodel.GenParameter; 41 import org.eclipse.emf.codegen.ecore.genmodel.GenProviderKind; 42 import org.eclipse.emf.common.notify.Notification; 43 import org.eclipse.emf.common.notify.NotificationChain; 44 import org.eclipse.emf.common.util.EList; 45 import org.eclipse.emf.common.util.UniqueEList; 46 import org.eclipse.emf.ecore.EAttribute; 47 import org.eclipse.emf.ecore.EClass; 48 import org.eclipse.emf.ecore.EClassifier; 49 import org.eclipse.emf.ecore.EOperation; 50 import org.eclipse.emf.ecore.EReference; 51 import org.eclipse.emf.ecore.EStructuralFeature; 52 import org.eclipse.emf.ecore.InternalEObject; 53 import org.eclipse.emf.ecore.impl.ENotificationImpl; 54 import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; 55 import org.eclipse.emf.ecore.util.ExtendedMetaData; 56 import org.eclipse.emf.ecore.util.InternalEList; 57 58 59 77 public class GenClassImpl extends GenClassifierImpl implements GenClass 78 { 79 87 protected static final GenProviderKind PROVIDER_EDEFAULT = GenProviderKind.SINGLETON_LITERAL; 88 89 97 protected GenProviderKind provider = PROVIDER_EDEFAULT; 98 99 107 protected static final boolean IMAGE_EDEFAULT = true; 108 109 117 protected boolean image = IMAGE_EDEFAULT; 118 119 127 protected EClass ecoreClass = null; 128 129 137 protected EList genFeatures = null; 138 139 147 protected EList genOperations = null; 148 149 157 protected GenFeature labelFeature = null; 158 159 164 protected GenClassImpl() 165 { 166 super(); 167 } 168 169 174 protected EClass eStaticClass() 175 { 176 return GenModelPackage.eINSTANCE.getGenClass(); 177 } 178 179 184 public GenProviderKind getProvider() 185 { 186 return provider; 187 } 188 189 public boolean isProviderSingleton() 190 { 191 return provider == GenProviderKind.SINGLETON_LITERAL; 192 } 193 194 199 public void setProvider(GenProviderKind newProvider) 200 { 201 GenProviderKind oldProvider = provider; 202 provider = newProvider == null ? PROVIDER_EDEFAULT : newProvider; 203 if (eNotificationRequired()) 204 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_CLASS__PROVIDER, oldProvider, provider)); 205 } 206 207 212 public boolean isImage() 213 { 214 return image; 215 } 216 217 222 public void setImage(boolean newImage) 223 { 224 boolean oldImage = image; 225 image = newImage; 226 if (eNotificationRequired()) 227 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_CLASS__IMAGE, oldImage, image)); 228 } 229 230 235 public EClass getEcoreClass() 236 { 237 if (ecoreClass != null && ecoreClass.eIsProxy()) 238 { 239 EClass oldEcoreClass = ecoreClass; 240 ecoreClass = (EClass)eResolveProxy((InternalEObject)ecoreClass); 241 if (ecoreClass != oldEcoreClass) 242 { 243 if (eNotificationRequired()) 244 eNotify(new ENotificationImpl(this, Notification.RESOLVE, GenModelPackage.GEN_CLASS__ECORE_CLASS, oldEcoreClass, ecoreClass)); 245 } 246 } 247 return ecoreClass; 248 } 249 250 255 public EClass basicGetEcoreClass() 256 { 257 return ecoreClass; 258 } 259 260 265 public void setEcoreClass(EClass newEcoreClass) 266 { 267 EClass oldEcoreClass = ecoreClass; 268 ecoreClass = newEcoreClass; 269 if (eNotificationRequired()) 270 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_CLASS__ECORE_CLASS, oldEcoreClass, ecoreClass)); 271 } 272 273 278 public EList getGenFeatures() 279 { 280 if (genFeatures == null) 281 { 282 genFeatures = new EObjectContainmentWithInverseEList(GenFeature.class, this, GenModelPackage.GEN_CLASS__GEN_FEATURES, GenModelPackage.GEN_FEATURE__GEN_CLASS); 283 } 284 return genFeatures; 285 } 286 287 292 public EList getGenOperations() 293 { 294 if (genOperations == null) 295 { 296 genOperations = new EObjectContainmentWithInverseEList(GenOperation.class, this, GenModelPackage.GEN_CLASS__GEN_OPERATIONS, GenModelPackage.GEN_OPERATION__GEN_CLASS); 297 } 298 return genOperations; 299 } 300 301 public EClassifier getEcoreClassifier() 302 { 303 return getEcoreClass(); 304 } 305 306 public String getImportedMetaType() 307 { 308 return getGenModel().getImportedName("org.eclipse.emf.ecore.EClass"); 309 } 310 311 public String getInterfaceName() 312 { 313 return getName(); 314 } 315 316 public String getQualifiedInterfaceName() 317 { 318 return getInternalQualifiedInterfaceName().replace('$', '.'); 319 } 320 321 protected String getInternalQualifiedInterfaceName() 322 { 323 return isExternalInterface() ? 324 getEcoreClass().getInstanceClassName() : 325 getGenPackage().getInterfacePackageName() + "." + getInterfaceName(); 326 } 327 328 public String getImportedInstanceClassName() 329 { 330 return getImportedInterfaceName(); 331 } 332 333 public String getImportedInterfaceName() 334 { 335 return getGenModel().getImportedName(getInternalQualifiedInterfaceName()); 336 } 337 338 public String getClassName() 339 { 340 return getImplClassName(getInterfaceName()); 341 } 342 343 public String getQualifiedClassName() 344 { 345 return getGenPackage().getClassPackageName() + "." + getClassName(); 346 } 347 348 public String getImportedClassName() 349 { 350 return getGenModel().getImportedName(getQualifiedClassName()); 351 } 352 353 public List getBaseGenClasses() 354 { 355 return collectGenClasses(getEcoreClass().getESuperTypes(), null); 356 } 357 358 public List getAllBaseGenClasses() 359 { 360 return collectGenClasses(getEcoreClass().getEAllSuperTypes(), null); 361 } 362 363 public List getSwitchGenClasses() 364 { 365 List result = 368 collectGenClasses 369 (getEcoreClass().getESuperTypes(), 370 new GenClassFilter() 371 { 372 public boolean accept(GenClass genClass) 373 { 374 return !genClass.isEObject(); 375 } 376 }); 377 Set resultSet = new HashSet (result); 378 379 for (int i = 0; i < result.size(); i++) 380 { 381 GenClass base = (GenClass)result.get(i); 382 for (Iterator iter = base.getBaseGenClasses().iterator(); iter.hasNext(); ) 383 { 384 GenClass baseOfBase = (GenClass)iter.next(); 385 if (!baseOfBase.isEObject() && resultSet.add(baseOfBase)) 386 { 387 result.add(baseOfBase); 388 } 389 } 390 } 391 return result; 392 } 393 394 public GenClass getBaseGenClass() 395 { 396 List s = getEcoreClass().getESuperTypes(); 397 return s.isEmpty() ? null : findGenClass((EClass)s.iterator().next()); 398 } 399 400 public GenClass getClassExtendsGenClass() 401 { 402 GenClass base = getBaseGenClass(); 403 while (base != this) 404 { 405 if (base == null || !base.isInterface()) return base; 406 base = base.getBaseGenClass(); 407 } 408 throw new RuntimeException ("inheritance loop at " + getName()); 409 } 410 411 public String getClassExtends() 412 { 413 GenClass extendsClass = getClassExtendsGenClass(); 414 if (extendsClass != null) 415 { 416 return " extends " + extendsClass.getImportedClassName(); 417 } 418 else if (!isEObject()) 419 { 420 String rootExtendsClass = getGenModel().getRootExtendsClass(); 421 if (!isBlank(rootExtendsClass)) 422 { 423 return " extends " + getGenModel().getImportedName(rootExtendsClass); 424 } 425 } 426 return ""; 427 } 428 429 public boolean needsRootImplementsInterfaceOperations() 430 { 431 if (!isMapEntry()) 432 { 433 String rootImplementsInterface = getGenModel().getRootImplementsInterface(); 434 if (!isBlank(rootImplementsInterface)) 435 { 436 GenClass extendsClass = getClassExtendsGenClass(); 437 438 if (extendsClass != null && !rootImplementsInterface.equals(extendsClass.getGenModel().getRootImplementsInterface())) 441 { 442 return true; 443 } 444 } 445 } 446 return false; 447 } 448 449 public String getClassImplements() 450 { 451 if (isMapEntry()) 452 { 453 return " implements " + getGenModel().getImportedName("org.eclipse.emf.common.util.BasicEMap$Entry"); 454 } 455 else 456 { 457 String result = " implements " + getImportedInterfaceName(); 458 String rootImplementsInterface = getGenModel().getRootImplementsInterface(); 459 if (!isBlank(rootImplementsInterface)) 460 { 461 GenClass extendsClass = getClassExtendsGenClass(); 462 463 if (extendsClass != null && !rootImplementsInterface.equals(extendsClass.getGenModel().getRootImplementsInterface())) 466 { 467 result += ", " + getGenModel().getImportedName(rootImplementsInterface); 468 } 469 } 470 471 return result; 472 } 473 } 474 475 public boolean needsRootExtendsInterfaceExtendsTag() 476 { 477 String rootExtendsInterface = getGenModel().getRootExtendsInterface(); 478 if (rootExtendsInterface == null) 479 { 480 rootExtendsInterface = ""; 481 } 482 if (isBlank(rootExtendsInterface) || getBaseGenClasses().isEmpty() && getGenPackage().isEcorePackage()) 483 { 484 return false; 485 } 486 487 for (Iterator iter = getAllBaseGenClasses().iterator(); iter.hasNext(); ) 488 { 489 GenClass genClass = (GenClass)iter.next(); 490 if (genClass.getEcoreClass().getInstanceClassName() == null && 491 rootExtendsInterface.equals(genClass.getGenModel().getRootExtendsInterface())) 492 { 493 return false; 494 } 495 } 496 497 return !rootExtendsInterface.equals("org.eclipse.emf.ecore.EObject"); 498 } 499 500 public String getInterfaceExtends() 501 { 502 String rootExtendsInterface = getGenModel().getRootExtendsInterface(); 503 if (rootExtendsInterface == null) 504 { 505 rootExtendsInterface = ""; 506 } 507 if (getBaseGenClasses().isEmpty()) 508 { 509 if (getGenPackage().isEcorePackage()) 510 { 511 return ""; 512 } 513 else 514 { 515 if (!isBlank(rootExtendsInterface)) 516 { 517 return " extends " + getGenModel().getImportedName(rootExtendsInterface); 518 } 519 else 520 { 521 return ""; 522 } 523 } 524 } 525 526 boolean needsRootExtendsInterface = true; 527 for (Iterator iter = getAllBaseGenClasses().iterator(); iter.hasNext(); ) 528 { 529 GenClass genClass = (GenClass)iter.next(); 530 if (genClass.getEcoreClass().getInstanceClassName() == null && 531 rootExtendsInterface.equals(genClass.getGenModel().getRootExtendsInterface())) 532 { 533 needsRootExtendsInterface = false; 534 break; 535 } 536 } 537 538 StringBuffer result = new StringBuffer (" extends "); 539 if (needsRootExtendsInterface) 540 { 541 if (!isBlank(rootExtendsInterface)) 542 { 543 result.append(getGenModel().getImportedName(rootExtendsInterface)); 544 result.append(", "); 545 } 546 } 547 548 for (Iterator iter = getBaseGenClasses().iterator(); iter.hasNext(); ) 549 { 550 result.append(((GenClass)iter.next()).getImportedInterfaceName()); 551 if (iter.hasNext()) result.append(", "); 552 } 553 return result.toString(); 554 } 555 556 public List getAllGenFeatures() 557 { 558 return collectGenFeatures(getAllBaseGenClasses(), getGenFeatures(), null); 559 } 560 561 public List getInheritedGenFeatures() 562 { 563 return collectGenFeatures(getAllBaseGenClasses(), null, null); 564 } 565 566 public List getAllGenOperations() 567 { 568 return collectGenOperations(getAllBaseGenClasses(), getGenOperations(), null); 569 } 570 571 public String getFeatureID(GenFeature genFeature) 572 { 573 return getClassifierID() + "__" + format(genFeature.getName(), '_', null, false).toUpperCase(); 574 } 575 576 public String getQualifiedFeatureID(GenFeature genFeature) 577 { 578 return getGenPackage().getImportedPackageInterfaceName() + "." + getFeatureID(genFeature); 579 } 580 581 public String getOperationID(GenOperation genOperation) 582 { 583 return getClassifierID() + "__" + format(genOperation.getName(), '_', null, false).toUpperCase(); 584 } 585 586 public String getFeatureValue(GenFeature genFeature) 587 { 588 List allFeatures = getAllGenFeatures(); 589 int i = allFeatures.indexOf(genFeature); 590 GenClass base = getBaseGenClass(); 591 592 if (base == null) 593 { 594 return Integer.toString(i); 595 } 596 597 int baseCount = base.getFeatureCount(); 598 if (i < baseCount) 599 { 600 return getGenPackage() == base.getGenPackage() ? 601 base.getFeatureID(genFeature) : base.getQualifiedFeatureID(genFeature); 602 } 603 604 String baseCountID = getGenPackage() == base.getGenPackage() ? 605 base.getFeatureCountID() : base.getQualifiedFeatureCountID(); 606 return baseCountID + " + " + Integer.toString(i - baseCount); 607 } 608 609 public String getLocalFeatureIndex(GenFeature genFeature) 610 { 611 return Integer.toString(getEcoreClass().getEStructuralFeatures().indexOf(genFeature.getEcoreFeature())); 612 } 613 614 public String getFlagsField(GenFeature genFeature) 615 { 616 if (isFlag(genFeature)) 617 { 618 String flagsField = getImplementedGenFeatures().contains(genFeature) ? getGenModel().getBooleanFlagsField() 619 : genFeature.getGenModel().getBooleanFlagsField(); 620 if (!isBlank(flagsField)) 621 { 622 int flagIndex = getFlagIndex(genFeature); 623 if (flagIndex / 32 > 0) 624 { 625 flagsField += String.valueOf(flagIndex / 32); 626 } 627 return flagsField; 628 } 629 } 630 return null; 631 } 632 633 public int getFlagIndex(GenFeature genFeature) 634 { 635 if (isFlag(genFeature)) 636 { 637 int reservedBooleanFlags = getImplementedGenFeatures().contains(genFeature) ? getGenModel().getBooleanFlagsReservedBits() 638 : genFeature.getGenModel().getBooleanFlagsReservedBits(); 639 int index = reservedBooleanFlags > 0 ? reservedBooleanFlags - 1 : -1; 640 641 for (Iterator otherGenFeatures = getAllGenFeatures().iterator(); otherGenFeatures.hasNext();) 642 { 643 GenFeature otherGenFeature = (GenFeature)otherGenFeatures.next(); 644 if (isFlag(otherGenFeature)) 645 { 646 index++; 647 648 if (otherGenFeature.getEcoreFeature() == genFeature.getEcoreFeature()) 649 return index; 650 } 651 if (isESetFlag(otherGenFeature)) 652 { 653 index++; 654 } 655 } 656 } 657 return -1; 658 } 659 660 public String getESetFlagsField(GenFeature genFeature) 661 { 662 if (isESetFlag(genFeature)) 663 { 664 String isSetFlagsField = getImplementedGenFeatures().contains(genFeature) ? getGenModel().getBooleanFlagsField() 665 : genFeature.getGenModel().getBooleanFlagsField(); 666 if (!isBlank(isSetFlagsField)) 667 { 668 int isSetFlagIndex = getESetFlagIndex(genFeature); 669 if (isSetFlagIndex / 32 > 0) 670 { 671 isSetFlagsField += String.valueOf(isSetFlagIndex / 32); 672 } 673 return isSetFlagsField; 674 } 675 } 676 return null; 677 } 678 679 public int getESetFlagIndex(GenFeature genFeature) 680 { 681 if (isESetFlag(genFeature)) 682 { 683 int reservedBooleanFlags = getImplementedGenFeatures().contains(genFeature) ? getGenModel().getBooleanFlagsReservedBits() 684 : genFeature.getGenModel().getBooleanFlagsReservedBits(); 685 int index = reservedBooleanFlags > 0 ? reservedBooleanFlags - 1 : -1; 686 687 for (Iterator otherGenFeatures = getAllGenFeatures().iterator(); otherGenFeatures.hasNext();) 688 { 689 GenFeature otherGenFeature = (GenFeature)otherGenFeatures.next(); 690 if (isFlag(otherGenFeature)) 691 { 692 index++; 693 } 694 if (isESetFlag(otherGenFeature)) 695 { 696 index++; 697 698 if (otherGenFeature.getEcoreFeature() == genFeature.getEcoreFeature()) 699 return index; 700 } 701 } 702 } 703 return -1; 704 } 705 706 public String getFeatureCountID() 707 { 708 return getClassifierID() + "_FEATURE_COUNT"; 709 } 710 711 public String getQualifiedFeatureCountID() 712 { 713 return getGenPackage().getImportedPackageInterfaceName() + "." + getFeatureCountID(); 714 } 715 716 public String getFeatureCountValue() 717 { 718 GenClass base = getBaseGenClass(); 719 if (base == null) 720 { 721 return Integer.toString(getFeatureCount()); 722 } 723 724 String baseCountID = getGenPackage() == base.getGenPackage() ? 725 base.getFeatureCountID() : base.getQualifiedFeatureCountID(); 726 return baseCountID + " + " + Integer.toString(getFeatureCount() - base.getFeatureCount()); 727 } 728 729 public int getFeatureCount() 730 { 731 return getAllGenFeatures().size(); 732 } 733 734 public boolean isEObject() 735 { 736 return getName().equals("EObject") && getGenPackage().isEcorePackage(); 737 } 738 739 public boolean isEObjectExtension() 740 { 741 if (isMapEntry()) 742 { 743 return false; 744 } 745 else 746 { 747 for (Iterator iter = getAllBaseGenClasses().iterator(); iter.hasNext(); ) 748 { 749 GenClass genClass = (GenClass)iter.next(); 750 if (genClass.isEObjectExtension()) 751 { 752 return true; 753 } 754 } 755 756 return getGenPackage().isEcorePackage() || "org.eclipse.emf.ecore.EObject".equals(getGenModel().getRootExtendsInterface()); 757 } 758 } 759 760 public boolean isAbstract() 761 { 762 return getEcoreClass().isAbstract() || getEcoreClass().isInterface(); 765 } 766 767 public String getAbstractFlag() 768 { 769 String result = !isAbstract() ? "!" : ""; 770 return result + "IS_ABSTRACT"; 771 } 772 773 public boolean isInterface() 774 { 775 return getEcoreClass().isInterface(); 776 } 777 778 public String getInterfaceFlag() 779 { 780 String result = !getEcoreClass().isInterface() ? "!" : ""; 781 return result + "IS_INTERFACE"; 782 } 783 784 public String getGeneratedInstanceClassFlag() 785 { 786 String result = isExternalInterface() ? "!" : ""; 787 return result + "IS_GENERATED_INSTANCE_CLASS"; 788 } 789 790 public boolean isExternalInterface() 791 { 792 return getEcoreClass().getInstanceClassName() != null; 793 } 794 795 public boolean isMapEntry() 796 { 797 return 798 isJavaUtilMapEntry(getEcoreClass().getInstanceClassName()) && 799 getEcoreClass().getEStructuralFeature("key") != null && 800 getEcoreClass().getEStructuralFeature("value") != null; 801 } 802 803 public GenFeature getMapEntryKeyFeature() 804 { 805 return findGenFeature(getEcoreClass().getEStructuralFeature("key")); 806 } 807 808 public GenFeature getMapEntryValueFeature() 809 { 810 return findGenFeature(getEcoreClass().getEStructuralFeature("value")); 811 } 812 813 public List getImplementedGenClasses() 814 { 815 List allBases = getAllBaseGenClasses(); 816 GenClass extendedBase = getClassExtendsGenClass(); 817 int i = extendedBase == null ? 0 : allBases.indexOf(extendedBase) + 1; 818 List result = new ArrayList (allBases.subList(i, allBases.size())); 819 result.add(this); 820 return result; 821 } 822 823 public List getImplementedGenFeatures() 824 { 825 return collectGenFeatures(getImplementedGenClasses(), null, null); 826 } 827 828 public List getImplementedGenOperations() 829 { 830 List implementedGenClasses = new UniqueEList(getImplementedGenClasses()); 831 if (needsRootImplementsInterfaceOperations()) 832 { 833 GenClass rootImplementsInterface = getGenModel().getRootImplementsInterfaceGenClass(); 834 if (rootImplementsInterface != null) 835 { 836 List allBaseClasses = new UniqueEList(rootImplementsInterface.getAllBaseGenClasses()); 837 for (Iterator i = allBaseClasses.iterator(); i.hasNext(); ) 838 { 839 GenClass genClass = (GenClass)i.next(); 840 if (genClass.isEObject()) 841 { 842 i.remove(); 843 } 844 } 845 allBaseClasses.add(rootImplementsInterface); 846 implementedGenClasses.addAll(allBaseClasses); 847 } 848 } 849 return 850 collectGenOperations 851 (implementedGenClasses, 852 null, 853 new CollidingGenOperationFilter()); 854 } 855 856 public List getExtendedGenClasses() 857 { 858 List allBases = getAllBaseGenClasses(); 859 GenClass extendedBase = getClassExtendsGenClass(); 860 int i = extendedBase == null ? 0 : allBases.indexOf(extendedBase) + 1; 861 return new ArrayList (allBases.subList(0, i)); 862 } 863 864 public List getExtendedGenFeatures() 865 { 866 return collectGenFeatures(getExtendedGenClasses(), null, null); 867 } 868 869 public List getExtendedGenOperations() 870 { 871 return 872 collectGenOperations 873 (getExtendedGenClasses(), 874 null, 875 new CollidingGenOperationFilter()); 876 } 877 878 public List getDeclaredGenFeatures() 879 { 880 return getGenFeatures(); 881 } 882 883 public List getDeclaredGenOperations() 884 { 885 return getGenOperations(); 886 } 887 888 public List getFlagGenFeatures() 889 { 890 return collectGenFeatures(null, getImplementedGenFeatures(), new GenFeatureFilter() 891 { 892 public boolean accept(GenFeature genFeature) 893 { 894 return isFlag(genFeature); 895 } 896 }); 897 } 898 899 public List getFlagGenFeatures(final String staticDefaultValue) 900 { 901 return collectGenFeatures(null, getFlagGenFeatures(), new GenFeatureFilter() 902 { 903 public boolean accept(GenFeature genFeature) 904 { 905 return staticDefaultValue.equalsIgnoreCase(genFeature.getStaticDefaultValue()); 906 } 907 }); 908 } 909 910 public List getESetGenFeatures() 911 { 912 return 913 collectGenFeatures 914 (getAllBaseGenClasses(), 915 getGenFeatures(), 916 new GenFeatureFilter() 917 { 918 public boolean accept(GenFeature genFeature) 919 { 920 return genFeature.isChangeable(); 921 } 922 }); 923 } 924 925 public List getEInverseAddGenFeatures() 926 { 927 return 928 collectGenFeatures 929 (getAllBaseGenClasses(), 930 getGenFeatures(), 931 new GenFeatureFilter() 932 { 933 public boolean accept(GenFeature genFeature) 934 { 935 return genFeature.isBidirectional() && !genFeature.isVolatile(); 936 } 937 }); 938 } 939 940 public List getEInverseRemoveGenFeatures() 941 { 942 return 943 collectGenFeatures 944 (getAllBaseGenClasses(), 945 getGenFeatures(), 946 new GenFeatureFilter() 947 { 948 public boolean accept(GenFeature genFeature) 949 { 950 return genFeature.isContains() || 951 (genFeature.isBidirectional() && 952 !genFeature.getReverse().isVolatile()) || 953 genFeature.isFeatureMapType(); 954 } 955 }); 956 } 957 958 public List getEBasicRemoveFromContainerGenFeatures() 959 { 960 return 961 collectGenFeatures 962 (getAllBaseGenClasses(), 963 getGenFeatures(), 964 new GenFeatureFilter() 965 { 966 public boolean accept(GenFeature genFeature) 967 { 968 return genFeature.isContainer(); 969 } 970 }); 971 } 972 973 public List getToStringGenFeatures() 974 { 975 return 976 collectGenFeatures 977 (getImplementedGenClasses(), 978 null, 979 new GenFeatureFilter() 980 { 981 public boolean accept(GenFeature genFeature) 982 { 983 return isField(genFeature) && !genFeature.isReferenceType(); 984 } 985 }); 986 } 987 988 public List getMixinGenClasses() 989 { 990 List superTypes = getEcoreClass().getESuperTypes(); 993 if (superTypes.isEmpty() || (superTypes.size() == 1 && !((EClass)superTypes.get(0)).isInterface())) 994 { 995 return Collections.EMPTY_LIST; 996 } 997 998 List allBases = getAllBaseGenClasses(); 999 List result = new ArrayList (allBases.size()); 1000 1001 GenClass baseGenClass = getBaseGenClass(); 1004 if (baseGenClass.isInterface()) 1005 { 1006 result.addAll(baseGenClass.getMixinGenClasses()); 1007 } 1008 1009 int i = allBases.indexOf(baseGenClass) + 1; 1012 result.addAll(allBases.subList(i, allBases.size())); 1013 return result; 1014 } 1015 1016 public List getMixinGenFeatures() 1017 { 1018 return collectGenFeatures(getMixinGenClasses(), null, null); 1019 } 1020 1021 public List getMixinGenOperations() 1022 { 1023 return collectGenOperations(getMixinGenClasses(), null, new CollidingGenOperationFilter()); 1024 } 1025 1026 public void initialize(EClass eClass) 1027 { 1028 if (eClass != getEcoreClass()) 1029 { 1030 setEcoreClass(eClass); 1031 1032 if (getLabelFeatureGen() != null && getLabelFeatureGen().eIsProxy()) 1033 { 1034 setLabelFeature(null); 1035 } 1036 1037 setImage(!eClass.isAbstract()); 1038 } 1039 1040 int localFeatureIndex = 0; 1041 LOOP: 1042 for (Iterator iter = eClass.getEStructuralFeatures().iterator(); iter.hasNext(); ) 1043 { 1044 EStructuralFeature eStructuralFeature = (EStructuralFeature)iter.next(); 1045 if (eStructuralFeature instanceof EAttribute) 1046 { 1047 EAttribute attribute = (EAttribute)eStructuralFeature; 1048 1049 for (Iterator j = getGenFeatures().iterator(); j.hasNext(); ) 1050 { 1051 GenFeature genFeature = (GenFeature)j.next(); 1052 if (genFeature.getEcoreFeature() == attribute) 1053 { 1054 genFeature.initialize(attribute); 1055 getGenFeatures().move(localFeatureIndex++, genFeature); 1056 continue LOOP; 1057 } 1058 } 1059 1060 GenFeature genFeature = getGenModel().createGenFeature(); 1061 getGenFeatures().add(localFeatureIndex++, genFeature); 1062 genFeature.initialize(attribute); 1063 } 1064 else 1065 { 1066 EReference reference = (EReference)eStructuralFeature; 1067 1068 for (Iterator j = getGenFeatures().iterator(); j.hasNext(); ) 1069 { 1070 GenFeature genFeature = (GenFeature)j.next(); 1071 if (genFeature.getEcoreFeature() == reference) 1072 { 1073 genFeature.initialize(reference); 1074 getGenFeatures().move(localFeatureIndex++, genFeature); 1075 continue LOOP; 1076 } 1077 } 1078 1079 GenFeature genFeature = getGenModel().createGenFeature(); 1080 getGenFeatures().add(localFeatureIndex++, genFeature); 1081 genFeature.initialize(reference); 1082 } 1083 } 1084 1085 OPERATION_LOOP: 1086 for (Iterator iter = eClass.getEOperations().iterator(); iter.hasNext(); ) 1087 { 1088 EOperation operation = (EOperation)iter.next(); 1089 1090 for (Iterator j = getGenOperations().iterator(); j.hasNext(); ) 1091 { 1092 GenOperation genOperation = (GenOperation)j.next(); 1093 if (genOperation.getEcoreOperation() == operation) 1094 { 1095 genOperation.initialize(operation); 1096 continue OPERATION_LOOP; 1097 } 1098 } 1099 1100 GenOperation genOperation = getGenModel().createGenOperation(); 1101 getGenOperations().add(genOperation); 1102 genOperation.initialize(operation); 1103 } 1104 } 1105 1106 protected boolean hasModelContribution() 1107 { 1108 return true; 1109 } 1110 1111 public void generate(IProgressMonitor progressMonitor) 1112 { 1113 try 1114 { 1115 if (!canGenerate()) return; 1116 1117 int fileCount = isInterface() ? 1 : 2; 1118 if (isExternalInterface()) fileCount--; 1119 1120 progressMonitor.beginTask("", fileCount); 1121 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_Generating_message", new Object [] { getFormattedName() })); 1122 1123 if (!isExternalInterface()) 1124 { 1125 progressMonitor.subTask 1126 (CodeGenEcorePlugin.INSTANCE.getString 1127 ("_UI_GeneratingJavaInterface_message", 1128 new Object [] { getGenPackage().getInterfacePackageName() + "." + getInterfaceName() })); 1129 generate 1130 (new SubProgressMonitor(progressMonitor, 1), 1131 Generator.EMF_MODEL_PROJECT_STYLE, 1132 getGenModel().getEffectiveModelPluginVariables(), 1133 getGenModel().getModelDirectory(), 1134 getGenPackage().getInterfacePackageName(), 1135 getInterfaceName(), getGenModel().getInterfaceEmitter()); 1136 } 1137 1138 if (!isInterface()) 1139 { 1140 progressMonitor.subTask 1141 (CodeGenEcorePlugin.INSTANCE.getString 1142 ("_UI_GeneratingJavaClass_message", new Object [] { getGenPackage().getClassPackageName() + "." + getClassName() })); 1143 generate 1144 (new SubProgressMonitor(progressMonitor, 1), 1145 Generator.EMF_MODEL_PROJECT_STYLE, 1146 getGenModel().getEffectiveModelPluginVariables(), 1147 getGenModel().getModelDirectory(), 1148 getGenPackage().getClassPackageName(), 1149 getClassName(), 1150 getGenModel().getClassEmitter()); 1151 } 1152 } 1153 finally 1154 { 1155 progressMonitor.done(); 1156 } 1157 } 1158 1159 public String getModelInfo() 1160 { 1161 StringBuffer result = new StringBuffer (); 1162 if (isMapEntry()) 1163 { 1164 StringBuffer names = new StringBuffer (); 1165 StringBuffer body = new StringBuffer (); 1166 for (Iterator i = getGenFeatures().iterator(); i.hasNext(); ) 1167 { 1168 GenFeature genFeature = (GenFeature)i.next(); 1169 appendLineBreak(body); 1170 body.append(genFeature.getQualifiedModelInfo()); 1171 body.append(' '); 1172 names.append(genFeature.getEcoreFeature().getName()); 1173 names.append(' '); 1174 } 1175 1176 String features = names.toString().trim(); 1177 if (!features.equals("key value")) 1178 { 1179 appendLineBreak(result); 1180 appendModelSetting(result, "features", features); 1181 } 1182 result.append(body); 1183 } 1184 else if (isExternalInterface()) 1185 { 1186 appendModelSetting(result, "instanceClass", getEcoreClass().getInstanceClassName()); 1187 } 1188 else 1189 { 1190 if (isInterface()) 1191 { 1192 appendModelSetting(result, "interface", "true"); 1193 } 1194 if (isAbstract()) 1195 { 1196 appendModelSetting(result, "abstract", "true"); 1197 } 1198 1199 StringBuffer suppressedNames = new StringBuffer (); 1200 StringBuffer suppressedInfo = new StringBuffer (); 1201 for (Iterator iter = getGenFeatures().iterator(); iter.hasNext(); ) 1202 { 1203 GenFeature genFeature = (GenFeature)iter.next(); 1204 if (genFeature.isSuppressedGetVisibility()) 1205 { 1206 suppressedNames.append(genFeature.getName()); 1207 suppressedNames.append(' '); 1208 appendLineBreak(suppressedInfo); 1209 suppressedInfo.append(genFeature.getQualifiedModelInfo()); 1210 suppressedInfo.append(' '); 1211 } 1212 } 1213 1214 if (suppressedNames.length() > 0) 1215 { 1216 appendLineBreak(result); 1217 appendModelSetting(result, "features", suppressedNames.toString().trim()); 1218 result.append(suppressedInfo); 1219 } 1220 } 1221 1222 appendAnnotationInfo(result, getEcoreClass()); 1223 1224 return result.toString().trim(); 1225 } 1226 1227 1231 public String getProviderClassName() 1232 { 1233 return getName() + "ItemProvider"; 1234 } 1235 1236 public String getQualifiedProviderClassName() 1237 { 1238 return getGenPackage().getProviderPackageName() + "." + getProviderClassName(); 1239 } 1240 1241 public String getImportedProviderClassName() 1242 { 1243 return getGenModel().getImportedName(getQualifiedProviderClassName()); 1244 } 1245 1246 public String getItemIconFileName() 1247 { 1248 return getGenModel().getEditIconsDirectory() + "/full/obj16/" + getName() + ".gif"; 1249 } 1250 1251 public String getCreateChildIconFileName(GenFeature feature, GenClass childClass) 1252 { 1253 GenClass parentClass = feature.getGenClass(); 1254 return getGenModel().getEditIconsDirectory() + "/full/ctool16/" + 1255 "Create" + parentClass.getName() + "_" + feature.getName() + "_" + childClass.getName() + ".gif"; 1256 } 1257 1258 protected GenClass getProviderExtendsGenClass() 1259 { 1260 GenClass baseClass = getClassExtendsGenClass(); 1261 while (baseClass != null && 1262 (baseClass.getProvider() == GenProviderKind.NONE_LITERAL || 1263 !baseClass.getGenModel().hasEditSupport())) 1264 { 1265 baseClass = baseClass.getClassExtendsGenClass(); 1266 } 1267 return baseClass; 1268 } 1269 1270 public String getProviderBaseClassName() 1271 { 1272 GenClass baseClass = getProviderExtendsGenClass(); 1273 return baseClass != null ? baseClass.getImportedProviderClassName() : null; 1274 } 1275 1276 public List getProviderImplementedGenClasses() 1277 { 1278 List allBases = getAllBaseGenClasses(); 1279 GenClass extendedBase = getProviderExtendsGenClass(); 1280 int i = extendedBase == null ? 0 : allBases.indexOf(extendedBase) + 1; 1281 List result = new ArrayList (allBases.subList(i, allBases.size())); 1282 result.add(this); 1283 return result; 1284 } 1285 1286 protected List getProviderImplementedGenFeatures() 1287 { 1288 return collectGenFeatures(getProviderImplementedGenClasses(), null, null); 1289 } 1290 1291 public List getLabelFeatureCandidates() 1292 { 1293 return 1294 collectGenFeatures 1295 (getAllBaseGenClasses(), 1296 getGenFeatures(), 1297 new GenFeatureFilter() 1298 { 1299 public boolean accept(GenFeature genFeature) 1300 { 1301 return !genFeature.isReferenceType() && !genFeature.isListType() && !genFeature.isMapType() && !genFeature.isSuppressedGetVisibility(); 1302 } 1303 }); 1304 } 1305 1306 public List getPropertyFeatures() 1307 { 1308 return 1309 collectGenFeatures 1310 (getProviderImplementedGenClasses(), 1311 null, 1312 new GenFeatureFilter() 1313 { 1314 public boolean accept(GenFeature genFeature) 1315 { 1316 return genFeature.isProperty(); 1318 } 1319 }); 1320 } 1321 1322 public List getNotifyFeatures() 1323 { 1324 return 1325 collectGenFeatures 1326 (getProviderImplementedGenClasses(), 1327 null, 1328 new GenFeatureFilter() 1329 { 1330 public boolean accept(GenFeature genFeature) 1331 { 1332 return genFeature.isNotify(); 1333 } 1334 }); 1335 } 1336 1337 public List getLabelNotifyFeatures() 1338 { 1339 return collectGenFeatures(getProviderImplementedGenClasses(), null, 1340 new GenFeatureFilter() 1341 { 1342 public boolean accept(GenFeature genFeature) 1343 { 1344 return genFeature.isNotify() && !genFeature.isChildren(); 1345 } 1346 }); 1347 } 1348 1349 public List getContentNotifyFeatures() 1350 { 1351 return collectGenFeatures(getProviderImplementedGenClasses(), null, 1352 new GenFeatureFilter() 1353 { 1354 public boolean accept(GenFeature genFeature) 1355 { 1356 return genFeature.isNotify() && genFeature.isChildren() && genFeature != getLabelFeature(); 1357 } 1358 }); 1359 } 1360 1361 public List getLabelAndContentNotifyFeatures() 1362 { 1363 GenFeature feature = getLabelFeature(); 1364 return feature != null && feature.isNotify() && feature.isChildren() ? 1365 Collections.singletonList(feature) : 1366 Collections.EMPTY_LIST; 1367 } 1368 1369 public List getChildrenFeatures() 1370 { 1371 return collectGenFeatures 1372 (getProviderImplementedGenClasses(), 1373 null, 1374 new GenFeatureFilter() 1375 { 1376 public boolean accept(GenFeature genFeature) 1377 { 1378 return genFeature.isChildren(); 1379 } 1380 }); 1381 } 1382 1383 public List getAllChildrenFeatures() 1384 { 1385 return 1386 collectGenFeatures 1387 (getAllBaseGenClasses(), 1388 getGenFeatures(), 1389 new GenFeatureFilter() 1390 { 1391 public boolean accept(GenFeature genFeature) 1392 { 1393 return genFeature.isChildren(); 1394 } 1395 }); 1396 } 1397 1398 public List getCreateChildFeatures() 1399 { 1400 List result = new ArrayList (); 1401 1402 final GenFeature mixed = getMixedGenFeature(); 1405 1406 if (mixed != null && mixed.isCreateChild()) 1407 { 1408 result.add(mixed); 1409 } 1410 1411 result.addAll(collectGenFeatures(getProviderImplementedGenClasses(), null, 1414 new GenFeatureFilter() 1415 { 1416 public boolean accept(GenFeature genFeature) 1417 { 1418 return genFeature.isCreateChild() && genFeature != mixed; 1419 } 1420 })); 1421 1422 return result; 1423 } 1424 1425 public List getAllCreateChildFeatures() 1426 { 1427 return collectGenFeatures(getAllBaseGenClasses(), getGenFeatures(), 1428 new GenFeatureFilter() 1429 { 1430 public boolean accept(GenFeature genFeature) 1431 { 1432 return genFeature.isCreateChild(); 1433 } 1434 }); 1435 } 1436 1437 protected List getAllCreateChildFeaturesIncludingDelegation() 1438 { 1439 return collectGenFeatures(getAllBaseGenClasses(), getGenFeatures(), 1440 new GenFeatureFilter() 1441 { 1442 public boolean accept(GenFeature genFeature) 1443 { 1444 while (genFeature != null) 1445 { 1446 if (genFeature.isCreateChild()) return true; 1447 genFeature = genFeature.getDelegateFeature(); 1448 } 1449 return false; 1450 } 1451 }); 1452 } 1453 1454 public List getCrossPackageCreateChildFeatures() 1455 { 1456 GenClass base = getProviderExtendsGenClass(); 1457 1458 if (base == null || base.getGenPackage() == getGenPackage() || 1462 getGenModel().getAllGenPackagesWithClassifiers().contains(base.getGenPackage())) 1463 { 1464 return Collections.EMPTY_LIST; 1465 } 1466 1467 return collectGenFeatures(base.getProviderImplementedGenClasses(), null, 1468 new GenFeatureFilter() 1469 { 1470 public boolean accept(GenFeature genFeature) 1471 { 1472 return genFeature.isCreateChild() && genFeature.isReferenceType(); 1473 } 1474 }); 1475 } 1476 1477 public List getSharedClassCreateChildFeatures() 1478 { 1479 List childrenFeatures = getAllCreateChildFeatures(); 1480 1481 Map classToFeatureMap = new LinkedHashMap (); 1483 List packages = getGenModel().getAllGenAndUsedGenPackagesWithClassifiers(); 1484 for (Iterator iter = childrenFeatures.iterator(); iter.hasNext(); ) 1485 { 1486 GenFeature f = (GenFeature)iter.next(); 1487 1488 List fl = f.isFeatureMapType() ? f.getDelegatedFeatures() : Collections.singletonList(f); 1489 for (Iterator fIter = fl.iterator(); fIter.hasNext(); ) 1490 { 1491 GenFeature genFeature = (GenFeature)fIter.next(); 1492 List genClasses = getTypeGenClasses(genFeature.getEcoreFeature().getEType(), null, packages, -1); 1493 1494 for (Iterator cIter = genClasses.iterator(); cIter.hasNext(); ) 1495 { 1496 GenClass genClass = (GenClass)cIter.next(); 1497 List genFeatures = (List )classToFeatureMap.get(genClass); 1498 if (genFeatures == null) 1499 { 1500 genFeatures = new ArrayList (5); 1501 classToFeatureMap.put(genClass, genFeatures); 1502 } 1503 genFeatures.add(genFeature); 1504 } 1505 } 1506 } 1507 1508 List result = new UniqueEList(childrenFeatures.size()); 1510 for (Iterator iter = classToFeatureMap.values().iterator(); iter.hasNext();) 1511 { 1512 List genFeatures = (List )iter.next(); 1513 if (genFeatures.size() > 1) result.addAll(genFeatures); 1514 } 1515 return result; 1516 } 1517 1518 public boolean hasFeatureMapCreateChildFeatures() 1519 { 1520 for (Iterator iter = getAllCreateChildFeatures().iterator(); iter.hasNext(); ) 1521 { 1522 GenFeature genFeature = (GenFeature)iter.next(); 1523 if (genFeature.isFeatureMapType()) return true; 1524 } 1525 return false; 1526 } 1527 1528 public List getChildrenClasses(GenFeature genFeature) 1529 { 1530 return getTypeGenClasses(genFeature.getEcoreFeature().getEType(), getGenPackage(), getGenModel().getAllGenAndUsedGenPackagesWithClassifiers(), -1); 1531 } 1532 1533 public List getCrossPackageChildrenClasses(GenFeature genFeature) 1534 { 1535 return getTypeGenClasses(genFeature.getEcoreFeature().getEType(), getGenPackage(), getGenModel().getAllGenPackagesWithClassifiers(), -1); 1536 } 1537 1538 1543 public GenFeature getLabelFeatureGen() 1544 { 1545 if (labelFeature != null && labelFeature.eIsProxy()) 1546 { 1547 GenFeature oldLabelFeature = labelFeature; 1548 labelFeature = (GenFeature)eResolveProxy((InternalEObject)labelFeature); 1549 if (labelFeature != oldLabelFeature) 1550 { 1551 if (eNotificationRequired()) 1552 eNotify(new ENotificationImpl(this, Notification.RESOLVE, GenModelPackage.GEN_CLASS__LABEL_FEATURE, oldLabelFeature, labelFeature)); 1553 } 1554 } 1555 return labelFeature; 1556 } 1557 1558 public GenFeature getLabelFeature() 1559 { 1560 GenFeature labelFeature = getLabelFeatureGen(); 1561 if (labelFeature != null) 1562 return labelFeature; 1563 1564 for (Iterator iter = getLabelFeatureCandidates().iterator(); iter.hasNext(); ) 1566 { 1567 GenFeature feature = (GenFeature) iter.next(); 1568 if (!feature.isListType()) 1569 { 1570 String featureName = feature.getName(); 1571 if (featureName != null) 1572 { 1573 if (featureName.equalsIgnoreCase("name")) 1574 { 1575 labelFeature = feature; 1576 } 1577 else if (featureName.equalsIgnoreCase("id")) 1578 { 1579 if (labelFeature == null || !labelFeature.getName().toLowerCase().endsWith("name")) 1580 { 1581 labelFeature = feature; 1582 } 1583 } 1584 else if (featureName.toLowerCase().endsWith("name")) 1585 { 1586 if (labelFeature == null || 1587 !labelFeature.getName().toLowerCase().endsWith("name") && !labelFeature.getName().equalsIgnoreCase("id")) 1588 { 1589 labelFeature = feature; 1590 } 1591 } 1592 else if (featureName.toLowerCase().indexOf("name") != -1) 1593 { 1594 if (labelFeature == null || 1595 labelFeature.getName().toLowerCase().indexOf("name") == -1 && !labelFeature.getName().equalsIgnoreCase("id")) 1596 { 1597 labelFeature = feature; 1598 } 1599 } 1600 else if (labelFeature == null) 1601 { 1602 labelFeature = feature; 1603 } 1604 } 1605 } 1606 } 1607 1608 return labelFeature; 1609 } 1610 1611 1616 public GenFeature basicGetLabelFeature() 1617 { 1618 return labelFeature; 1619 } 1620 1621 1626 public void setLabelFeature(GenFeature newLabelFeature) 1627 { 1628 GenFeature oldLabelFeature = labelFeature; 1629 labelFeature = newLabelFeature; 1630 if (eNotificationRequired()) 1631 eNotify(new ENotificationImpl(this, Notification.SET, GenModelPackage.GEN_CLASS__LABEL_FEATURE, oldLabelFeature, labelFeature)); 1632 } 1633 1634 1639 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 1640 { 1641 if (featureID >= 0) 1642 { 1643 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 1644 { 1645 case GenModelPackage.GEN_CLASS__GEN_FEATURES: 1646 return ((InternalEList)getGenFeatures()).basicAdd(otherEnd, msgs); 1647 case GenModelPackage.GEN_CLASS__GEN_OPERATIONS: 1648 return ((InternalEList)getGenOperations()).basicAdd(otherEnd, msgs); 1649 default: 1650 return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); 1651 } 1652 } 1653 if (eContainer != null) 1654 msgs = eBasicRemoveFromContainer(msgs); 1655 return eBasicSetContainer(otherEnd, featureID, msgs); 1656 } 1657 1658 1663 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 1664 { 1665 if (featureID >= 0) 1666 { 1667 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 1668 { 1669 case GenModelPackage.GEN_CLASS__GEN_FEATURES: 1670 return ((InternalEList)getGenFeatures()).basicRemove(otherEnd, msgs); 1671 case GenModelPackage.GEN_CLASS__GEN_OPERATIONS: 1672 return ((InternalEList)getGenOperations()).basicRemove(otherEnd, msgs); 1673 default: 1674 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 1675 } 1676 } 1677 return eBasicSetContainer(null, featureID, msgs); 1678 } 1679 1680 1685 public Object eGet(EStructuralFeature eFeature, boolean resolve) 1686 { 1687 switch (eDerivedStructuralFeatureID(eFeature)) 1688 { 1689 case GenModelPackage.GEN_CLASS__GEN_PACKAGE: 1690 return getGenPackage(); 1691 case GenModelPackage.GEN_CLASS__PROVIDER: 1692 return getProvider(); 1693 case GenModelPackage.GEN_CLASS__IMAGE: 1694 return isImage() ? Boolean.TRUE : Boolean.FALSE; 1695 case GenModelPackage.GEN_CLASS__ECORE_CLASS: 1696 if (resolve) return getEcoreClass(); 1697 return basicGetEcoreClass(); 1698 case GenModelPackage.GEN_CLASS__GEN_FEATURES: 1699 return getGenFeatures(); 1700 case GenModelPackage.GEN_CLASS__GEN_OPERATIONS: 1701 return getGenOperations(); 1702 case GenModelPackage.GEN_CLASS__LABEL_FEATURE: 1703 if (resolve) return getLabelFeature(); 1704 return basicGetLabelFeature(); 1705 } 1706 return eDynamicGet(eFeature, resolve); 1707 } 1708 1709 1714 public boolean eIsSet(EStructuralFeature eFeature) 1715 { 1716 switch (eDerivedStructuralFeatureID(eFeature)) 1717 { 1718 case GenModelPackage.GEN_CLASS__GEN_PACKAGE: 1719 return getGenPackage() != null; 1720 case GenModelPackage.GEN_CLASS__PROVIDER: 1721 return provider != PROVIDER_EDEFAULT; 1722 case GenModelPackage.GEN_CLASS__IMAGE: 1723 return image != IMAGE_EDEFAULT; 1724 case GenModelPackage.GEN_CLASS__ECORE_CLASS: 1725 return ecoreClass != null; 1726 case GenModelPackage.GEN_CLASS__GEN_FEATURES: 1727 return genFeatures != null && !genFeatures.isEmpty(); 1728 case GenModelPackage.GEN_CLASS__GEN_OPERATIONS: 1729 return genOperations != null && !genOperations.isEmpty(); 1730 case GenModelPackage.GEN_CLASS__LABEL_FEATURE: 1731 return labelFeature != null; 1732 } 1733 return eDynamicIsSet(eFeature); 1734 } 1735 1736 1741 public void eSet(EStructuralFeature eFeature, Object newValue) 1742 { 1743 switch (eDerivedStructuralFeatureID(eFeature)) 1744 { 1745 case GenModelPackage.GEN_CLASS__PROVIDER: 1746 setProvider((GenProviderKind)newValue); 1747 return; 1748 case GenModelPackage.GEN_CLASS__IMAGE: 1749 setImage(((Boolean )newValue).booleanValue()); 1750 return; 1751 case GenModelPackage.GEN_CLASS__ECORE_CLASS: 1752 setEcoreClass((EClass)newValue); 1753 return; 1754 case GenModelPackage.GEN_CLASS__GEN_FEATURES: 1755 getGenFeatures().clear(); 1756 getGenFeatures().addAll((Collection )newValue); 1757 return; 1758 case GenModelPackage.GEN_CLASS__GEN_OPERATIONS: 1759 getGenOperations().clear(); 1760 getGenOperations().addAll((Collection )newValue); 1761 return; 1762 case GenModelPackage.GEN_CLASS__LABEL_FEATURE: 1763 setLabelFeature((GenFeature)newValue); 1764 return; 1765 } 1766 eDynamicSet(eFeature, newValue); 1767 } 1768 1769 1774 public void eUnset(EStructuralFeature eFeature) 1775 { 1776 switch (eDerivedStructuralFeatureID(eFeature)) 1777 { 1778 case GenModelPackage.GEN_CLASS__PROVIDER: 1779 setProvider(PROVIDER_EDEFAULT); 1780 return; 1781 case GenModelPackage.GEN_CLASS__IMAGE: 1782 setImage(IMAGE_EDEFAULT); 1783 return; 1784 case GenModelPackage.GEN_CLASS__ECORE_CLASS: 1785 setEcoreClass((EClass)null); 1786 return; 1787 case GenModelPackage.GEN_CLASS__GEN_FEATURES: 1788 getGenFeatures().clear(); 1789 return; 1790 case GenModelPackage.GEN_CLASS__GEN_OPERATIONS: 1791 getGenOperations().clear(); 1792 return; 1793 case GenModelPackage.GEN_CLASS__LABEL_FEATURE: 1794 setLabelFeature((GenFeature)null); 1795 return; 1796 } 1797 eDynamicUnset(eFeature); 1798 } 1799 1800 1805 public String toString() 1806 { 1807 if (eIsProxy()) return super.toString(); 1808 1809 StringBuffer result = new StringBuffer (super.toString()); 1810 result.append(" (provider: "); 1811 result.append(provider); 1812 result.append(", image: "); 1813 result.append(image); 1814 result.append(')'); 1815 return result.toString(); 1816 } 1817 1818 public String getItemProviderAdapterFactoryClassName() 1819 { 1820 return getGenPackage().getItemProviderAdapterFactoryClassName(); 1821 } 1822 1823 public String getTestCaseClassName() 1824 { 1825 return getName() + "Test"; 1826 } 1827 1828 public String getQualifiedTestCaseClassName() 1829 { 1830 return getGenPackage().getTestsPackageName() + "." + getTestCaseClassName(); 1831 } 1832 1833 public String getImportedTestCaseClassName() 1834 { 1835 return getGenModel().getImportedName(getQualifiedTestCaseClassName()); 1836 } 1837 1838 public boolean canGenerateEdit() 1839 { 1840 return super.canGenerateEdit() && !isInterface(); 1841 } 1842 1843 public boolean canGenerateEditor() 1844 { 1845 return false; 1846 } 1847 1848 public void generateEdit(IProgressMonitor progressMonitor) 1849 { 1850 try 1851 { 1852 if (!canGenerateEdit()) return; 1853 1854 progressMonitor.beginTask("", 2 + getAllCreateChildFeatures().size()); 1855 progressMonitor.subTask 1856 (CodeGenEcorePlugin.INSTANCE.getString 1857 ("_UI_GeneratingProvider_message", new Object [] { getFormattedName() })); 1858 1859 progressMonitor.subTask 1860 (CodeGenEcorePlugin.INSTANCE.getString 1861 ("_UI_GeneratingJavaClass_message", 1862 new Object [] { getGenPackage().getProviderPackageName() + "." + getProviderClassName() })); 1863 generate 1864 (new SubProgressMonitor(progressMonitor, 1), 1865 Generator.EMF_EDIT_PROJECT_STYLE, 1866 getGenModel().getEffectiveModelPluginVariables(), 1867 getGenModel().getEditDirectory(), 1868 getGenPackage().getProviderPackageName(), 1869 getProviderClassName(), 1870 getGenModel().getItemProviderEmitter()); 1871 1872 if (isImage()) 1873 { 1874 progressMonitor.subTask 1875 (CodeGenEcorePlugin.INSTANCE.getString 1876 ("_UI_GeneratingItemIcon_message", new Object [] { getItemIconFileName() })); 1877 generate 1878 (new SubProgressMonitor(progressMonitor, 1), 1879 Generator.EMF_EDIT_PROJECT_STYLE, 1880 getGenModel().getEffectiveModelPluginVariables(), 1881 getItemIconFileName(), 1882 ((GenModelImpl)getGenModel()).getItemGIFEmitter(), 1883 getName()); 1884 } 1885 1886 if (getGenModel().isCreationCommands() && getGenModel().isCreationIcons()) 1887 { 1888 for (Iterator iter = getAllCreateChildFeaturesIncludingDelegation().iterator(); iter.hasNext(); ) 1889 { 1890 GenFeature feature = (GenFeature)iter.next(); 1891 for (Iterator cIter = getChildrenClasses(feature).iterator(); cIter.hasNext(); ) 1892 { 1893 GenClass childClass = (GenClass)cIter.next(); 1894 progressMonitor.subTask 1895 (CodeGenEcorePlugin.INSTANCE.getString 1896 ("_UI_GeneratingCreateChildIcon_message", new Object [] { getCreateChildIconFileName(feature, childClass) })); 1897 generate 1898 (new SubProgressMonitor(progressMonitor, 1), 1899 Generator.EMF_EDIT_PROJECT_STYLE, 1900 getGenModel().getEffectiveModelPluginVariables(), 1901 getCreateChildIconFileName(feature, childClass), 1902 ((GenModelImpl)getGenModel()).getCreateChildGIFEmitter(), 1903 getName(), 1904 childClass.getName()); 1905 } 1906 } 1907 } 1908 } 1909 finally 1910 { 1911 progressMonitor.done(); 1912 } 1913 } 1914 1915 public boolean hasTests() 1916 { 1917 for (Iterator i = getAllGenFeatures().iterator(); i.hasNext();) 1918 { 1919 GenFeature genFeature = (GenFeature)i.next(); 1920 if (((genFeature.isGet() && !genFeature.isSuppressedGetVisibility()) 1921 || (genFeature.isSet() && !genFeature.isSuppressedSetVisibility()) 1922 || (genFeature.isUnset() && !genFeature.isSuppressedUnsetVisibility()) 1923 || (genFeature.isIsSet() && !genFeature.isSuppressedIsSetVisibility())) 1924 && (genFeature.isVolatile() || genFeature.isDerived())) 1925 { 1926 return true; 1927 } 1928 } 1929 1930 return !getAllGenOperations().isEmpty(); 1931 } 1932 1933 public boolean canGenerateTests() 1934 { 1935 return getGenModel().canGenerateTests() && !isExternalInterface(); 1936 } 1937 1938 public void generateTests(IProgressMonitor progressMonitor) 1939 { 1940 try 1941 { 1942 if (!canGenerateTests()) 1943 return; 1944 1945 progressMonitor.beginTask("", 1); 1946 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString("_UI_Generating_message", new Object []{ getFormattedName() 1947 + " Test Case" })); 1948 1949 progressMonitor.subTask(CodeGenEcorePlugin.INSTANCE.getString( 1950 "_UI_GeneratingJavaClass_message", 1951 new Object []{ getGenPackage().getTestsPackageName() + "." + getInterfaceName() + "Test" })); 1952 generate( 1953 new SubProgressMonitor(progressMonitor, 1), 1954 Generator.EMF_TESTS_PROJECT_STYLE, 1955 Collections.EMPTY_LIST, 1956 getGenModel().getTestsDirectory(), 1957 getGenPackage().getTestsPackageName(), 1958 getInterfaceName() + "Test", 1959 getGenModel().getTestCaseEmitter()); 1960 } 1961 finally 1962 { 1963 progressMonitor.done(); 1964 } 1965 } 1966 1967 public boolean reconcile(GenClass oldGenClassVersion) 1968 { 1969 if (getEcoreClass().getName().equals(oldGenClassVersion.getEcoreClass().getName())) 1970 { 1971 for (Iterator i = getGenFeatures().iterator(); i.hasNext(); ) 1972 { 1973 GenFeature genFeature = (GenFeature)i.next(); 1974 for (Iterator j = oldGenClassVersion.getGenFeatures().iterator(); j.hasNext(); ) 1975 { 1976 GenFeature oldGenFeatureVersion = (GenFeature)j.next(); 1977 if (genFeature.reconcile(oldGenFeatureVersion)) 1978 { 1979 break; 1980 } 1981 } 1982 } 1983 1984 for (Iterator i = getGenOperations().iterator(); i.hasNext(); ) 1985 { 1986 GenOperation genOperation = (GenOperation)i.next(); 1987 for (Iterator j = oldGenClassVersion.getGenOperations().iterator(); j.hasNext(); ) 1988 { 1989 GenOperation oldGenOperation = (GenOperation)j.next(); 1990 if (genOperation.reconcile(oldGenOperation)) 1991 { 1992 break; 1993 } 1994 } 1995 } 1996 reconcileSettings(oldGenClassVersion); 1997 return true; 1998 } 1999 else 2000 { 2001 return false; 2002 } 2003 } 2004 2005 protected void reconcileSettings(GenClass oldGenClassVersion) 2006 { 2007 setProvider(oldGenClassVersion.getProvider()); 2008 setImage(oldGenClassVersion.isImage()); 2009 GenFeature oldLabelFeature = ((GenClassImpl)oldGenClassVersion).getLabelFeatureGen(); 2010 if (oldLabelFeature != null) 2011 { 2012 EStructuralFeature newLabelFeature = getEcoreClass().getEStructuralFeature(oldLabelFeature.getEcoreFeature().getName()); 2013 if (newLabelFeature != null) 2014 { 2015 setLabelFeature(findGenFeature(newLabelFeature)); 2016 } 2017 } 2018 } 2019 2020 public boolean reconcile() 2021 { 2022 EClass eClass = getEcoreClass(); 2023 if (eClass == null || eClass.eIsProxy() || eClass.eResource() == null) 2024 { 2025 return false; 2026 } 2027 else 2028 { 2029 for (Iterator i = getGenFeatures().iterator(); i.hasNext(); ) 2030 { 2031 GenFeature genFeature = (GenFeature)i.next(); 2032 if (!genFeature.reconcile()) 2033 { 2034 i.remove(); 2035 } 2036 } 2037 2038 for (Iterator i = getGenOperations().iterator(); i.hasNext(); ) 2039 { 2040 GenOperation genOperation = (GenOperation)i.next(); 2041 if (!genOperation.reconcile()) 2042 { 2043 i.remove(); 2044 } 2045 } 2046 2047 return true; 2048 } 2049 } 2050 2051 public List getGenConstraints() 2052 { 2053 List result = new UniqueEList(super.getGenConstraints()); 2054 for (Iterator i = getGenOperations().iterator(); i.hasNext(); ) 2055 { 2056 GenOperation genOperation = (GenOperation)i.next(); 2057 if (genOperation.isInvariant()) 2058 { 2059 result.add(genOperation.getName()); 2060 } 2061 } 2062 2063 return result; 2064 } 2065 2066 public static final List INTRINSIC_CONSTRAINTS = 2067 Arrays.asList 2068 (new String [] 2069 { 2070 "EveryMultiplicityConforms", 2071 "EveryDataValueConforms", 2072 "EveryReferenceIsContained", 2073 "EveryProxyResolves" 2074 }); 2075 2076 public List getAllGenConstraints() 2077 { 2078 List result = new ArrayList (INTRINSIC_CONSTRAINTS); 2079 result.addAll(collectGenConstraints(getAllBaseGenClasses(), getGenConstraints(), null)); 2080 return result; 2081 } 2082 2083 public GenClassifier getConstraintImplementor(String constraint) 2084 { 2085 if (getGenConstraints().contains(constraint)) 2086 { 2087 return this; 2088 } 2089 else 2090 { 2091 for (Iterator i = getBaseGenClasses().iterator(); i.hasNext(); ) 2092 { 2093 GenClass baseGenClass = (GenClass)i.next(); 2094 if (baseGenClass.getGenConstraints().contains(constraint)) 2095 { 2096 return baseGenClass; 2097 } 2098 else if (baseGenClass.getAllGenConstraints().contains(constraint)) 2099 { 2100 return baseGenClass.getConstraintImplementor(constraint); 2101 } 2102 } 2103 return null; 2104 } 2105 } 2106 2107 public GenClassifier getConstraintDelegate(String constraint) 2108 { 2109 for (Iterator i = getBaseGenClasses().iterator(); i.hasNext(); ) 2110 { 2111 GenClass baseGenClass = (GenClass)i.next(); 2112 if (baseGenClass.getGenConstraints().contains(constraint)) 2113 { 2114 return baseGenClass; 2115 } 2116 else if (baseGenClass.getAllGenConstraints().contains(constraint)) 2117 { 2118 return baseGenClass.getConstraintImplementor(constraint); 2119 } 2120 } 2121 return null; 2122 } 2123 2124 public boolean hasOnlyDefaultConstraints() 2125 { 2126 for (Iterator i = getAllGenConstraints().iterator(); i.hasNext(); ) 2127 { 2128 String genConstraint = (String )i.next(); 2129 if (getConstraintImplementor(genConstraint) != null) 2130 { 2131 return false; 2132 } 2133 } 2134 return true; 2135 } 2136 2137 public GenOperation getInvariantOperation(String constraint) 2138 { 2139 for (Iterator j = getGenOperations().iterator(); j.hasNext(); ) 2140 { 2141 GenOperation genOperation = (GenOperation)j.next(); 2142 if (genOperation.getName().equals(constraint) && genOperation.isInvariant()) 2143 { 2144 return genOperation; 2145 } 2146 } 2147 return null; 2148 } 2149 2150 public boolean isDocumentRoot() 2151 { 2152 return getExtendedMetaData().getDocumentRoot(getEcoreClass().getEPackage()) == getEcoreClass(); 2153 } 2154 2155 protected boolean isMixed() 2156 { 2157 return getExtendedMetaData().getContentKind(getEcoreClass()) == ExtendedMetaData.MIXED_CONTENT; 2158 } 2159 2160 public GenFeature getMixedGenFeature() 2161 { 2162 if (!isMixed()) return null; 2163 EAttribute mixedFeature = getExtendedMetaData().getMixedFeature(getEcoreClass()); 2164 return mixedFeature != null ? findGenFeature(mixedFeature) : null; 2165 } 2166 2167 public String getListConstructor(GenFeature genFeature) 2168 { 2169 StringBuffer sb = new StringBuffer (); 2170 2171 String unsettable = genFeature.isUnsettable() ? ".Unsettable" : ""; 2172 2173 if (genFeature.isMapType()) 2174 { 2175 GenClass mapGenClass = genFeature.getMapEntryTypeGenClass(); 2176 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EcoreEMap")); 2177 sb.append("("); 2178 sb.append(mapGenClass.getGenPackage().getImportedPackageInterfaceName()); 2179 sb.append(".eINSTANCE.get"); 2180 sb.append(mapGenClass.getName()); 2181 sb.append("(), "); 2182 sb.append(genFeature.getImportedMapEntryType()); 2183 sb.append(".class, this, "); 2184 sb.append(getQualifiedFeatureID(genFeature)); 2185 sb.append(")"); 2186 } 2187 else if (genFeature.isContains()) 2188 { 2189 if (genFeature.isBidirectional()) 2190 { 2191 GenFeature reverseFeature = genFeature.getReverse(); 2192 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList")); 2193 sb.append(unsettable); 2194 sb.append("("); 2195 sb.append(genFeature.getListItemType()); 2196 sb.append(".class, this, "); 2197 sb.append(getQualifiedFeatureID(genFeature)); 2198 sb.append(", "); 2199 sb.append(reverseFeature.getGenClass().getQualifiedFeatureID(reverseFeature)); 2200 sb.append(")"); 2201 } 2202 else 2203 { 2204 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EObjectContainmentEList")); 2205 sb.append(unsettable); 2206 sb.append("("); 2207 sb.append(genFeature.getListItemType()); 2208 sb.append(".class, this, "); 2209 sb.append(getQualifiedFeatureID(genFeature)); 2210 sb.append(")"); 2211 } 2212 } 2213 else if (genFeature.isReferenceType()) 2214 { 2215 if (genFeature.isBidirectional()) 2216 { 2217 GenFeature reverseFeature = genFeature.getReverse(); 2218 if (genFeature.isResolveProxies()) 2219 { 2220 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList")); 2221 } 2222 else 2223 { 2224 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EObjectWithInverseEList")); 2225 } 2226 sb.append(unsettable); 2227 if (reverseFeature.isListType()) 2228 { 2229 sb.append(".ManyInverse"); 2230 } 2231 sb.append("("); 2232 sb.append(genFeature.getListItemType()); 2233 sb.append(".class, this, "); 2234 sb.append(getQualifiedFeatureID(genFeature)); 2235 sb.append(", "); 2236 sb.append(reverseFeature.getGenClass().getQualifiedFeatureID(reverseFeature)); 2237 sb.append(")"); 2238 } 2239 else 2240 { 2241 if (genFeature.isResolveProxies()) 2242 { 2243 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EObjectResolvingEList")); 2244 } 2245 else 2246 { 2247 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EObjectEList")); 2248 } 2249 sb.append(unsettable); 2250 sb.append("("); 2251 sb.append(genFeature.getListItemType()); 2252 sb.append(".class, this, "); 2253 sb.append(getQualifiedFeatureID(genFeature)); 2254 sb.append(")"); 2255 } 2256 } 2257 else if (genFeature.isFeatureMapType()) 2258 { 2259 if (genFeature.isWrappedFeatureMapType()) 2260 { 2261 sb.append(genFeature.getImportedEffectiveFeatureMapWrapperClass()); 2262 sb.append("(new "); 2263 } 2264 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.BasicFeatureMap")); 2265 sb.append("(this, "); 2266 sb.append(getQualifiedFeatureID(genFeature)); 2267 sb.append(")"); 2268 if (genFeature.isWrappedFeatureMapType()) 2269 { 2270 sb.append(")"); 2271 } 2272 } 2273 else 2274 { if (genFeature.isUnique()) 2276 { 2277 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EDataTypeUniqueEList")); 2278 } 2279 else 2280 { 2281 sb.append(getGenModel().getImportedName("org.eclipse.emf.ecore.util.EDataTypeEList")); 2282 } 2283 sb.append(unsettable); 2284 sb.append("("); 2285 sb.append(genFeature.getListItemType()); 2286 sb.append(".class, this, "); 2287 sb.append(getQualifiedFeatureID(genFeature)); 2288 sb.append(")"); 2289 } 2290 return sb.toString(); 2291 } 2292 2293 public boolean isModelRoot() 2294 { 2295 return getClassExtendsGenClass() == null || getClassExtendsGenClass().getGenModel() != getGenModel(); 2296 } 2297 2298 public List getDeclaredFieldGenFeatures() 2299 { 2300 return getImplementedGenFeatures(); 2301 } 2302 2303 public boolean isFlag(GenFeature genFeature) 2304 { 2305 return (getImplementedGenFeatures().contains(genFeature) ? getGenModel().isBooleanFlagsEnabled() 2306 : genFeature.getGenModel().isBooleanFlagsEnabled()) && genFeature.isFlag(); 2307 } 2308 2309 public boolean isESetFlag(GenFeature genFeature) 2310 { 2311 return (getImplementedGenFeatures().contains(genFeature) ? getGenModel().isBooleanFlagsEnabled() 2312 : genFeature.getGenModel().isBooleanFlagsEnabled()) && genFeature.isESetFlag(); 2313 } 2314 2315 public boolean isField(GenFeature genFeature) 2316 { 2317 return !(getImplementedGenFeatures().contains(genFeature) ? getGenModel().isReflectiveDelegation() 2318 : genFeature.getGenModel().isReflectiveDelegation()) && genFeature.isField(); 2319 } 2320 2321 public boolean isESetField(GenFeature genFeature) 2322 { 2323 return !(getImplementedGenFeatures().contains(genFeature) ? getGenModel().isReflectiveDelegation() 2324 : genFeature.getGenModel().isReflectiveDelegation()) && genFeature.isESetField(); 2325 } 2326 2327 public class CollidingGenOperationFilter implements GenOperationFilter 2328 { 2329 protected List allGenFeatures = getAllGenFeatures(); 2330 2331 public boolean accept(GenOperation genOperation) 2332 { 2333 if ((genOperation.getName().startsWith("get") || genOperation.getName().startsWith("is")) 2334 && genOperation.getGenParameters().isEmpty()) 2335 { 2336 for (Iterator i = allGenFeatures.iterator(); i.hasNext();) 2337 { 2338 GenFeature genFeature = (GenFeature)i.next(); 2339 if (genFeature.getGetAccessor().equals(genOperation.getName())) 2340 { 2341 return false; 2342 } 2343 } 2344 } 2345 else if (genOperation.getName().startsWith("set") && genOperation.getGenParameters().size() == 1) 2346 { 2347 GenParameter genParameter = (GenParameter)genOperation.getGenParameters().get(0); 2348 for (Iterator i = allGenFeatures.iterator(); i.hasNext();) 2349 { 2350 GenFeature genFeature = (GenFeature)i.next(); 2351 if (genFeature.isChangeable() && !genFeature.isListType() && genOperation.getName().equals("set" + genFeature.getAccessorName()) 2352 && genParameter.getType().equals(genFeature.getType())) 2353 { 2354 return false; 2355 } 2356 } 2357 } 2358 else if (genOperation.getName().startsWith("unset") && genOperation.getGenParameters().isEmpty()) 2359 { 2360 for (Iterator i = allGenFeatures.iterator(); i.hasNext();) 2361 { 2362 GenFeature genFeature = (GenFeature)i.next(); 2363 if (genFeature.isChangeable() && genFeature.isUnsettable() 2364 && genOperation.getName().equals("unset" + genFeature.getAccessorName())) 2365 { 2366 return false; 2367 } 2368 } 2369 } 2370 else if (genOperation.getName().startsWith("isSet") && genOperation.getGenParameters().isEmpty()) 2371 { 2372 for (Iterator i = allGenFeatures.iterator(); i.hasNext();) 2373 { 2374 GenFeature genFeature = (GenFeature)i.next(); 2375 if (genFeature.isChangeable() && genFeature.isUnsettable() 2376 && genOperation.getName().equals("isSet" + genFeature.getAccessorName())) 2377 { 2378 return false; 2379 } 2380 } 2381 } 2382 return !genOperation.getGenClass().isEObject(); 2383 } 2384 } 2385} 2386 | Popular Tags |