Example #1
0
 public static String getFullName(EClass eClass) {
   EPackage ePackage = eClass.getEPackage();
   if (ePackage == null) {
     return eClass.getName();
   }
   return getFullName(ePackage) + "." + eClass.getName();
 }
  /** @{inheritDoc */
  public boolean isEnable(IPaletteEntryProxy entryProxy) {
    PaletteEntry entry = entryProxy.getEntry();

    // check unicity
    if (entryProxy instanceof IPaletteAspectToolEntryProxy) {
      List<IPostAction> postActions = ((IPaletteAspectToolEntryProxy) entryProxy).getPostActions();
      for (IPostAction action : postActions) {
        if (action instanceof AssociationEndPostAction) {
          return false;
        }
      }
    }

    // check meta-element is an association
    if (entry instanceof CombinedTemplateCreationEntry) {
      EClass eClass = PaletteUtil.getToolMetaclass((CombinedTemplateCreationEntry) entry);
      List<EClass> superClasses = eClass.getEAllSuperTypes();
      if (ASSOCIATION.equals(eClass.getName())) {
        return true;
      }
      for (EClass superClass : superClasses) {
        if (ASSOCIATION.equals(superClass.getName())) {
          return true;
        }
      }
    }
    return false;
  }
 /*
  * (non-Javadoc)
  *
  * @see
  * org.eclipse.bpel.ui.factories.AbstractUIObjectFactory#getLargeImageDescriptor
  * ()
  */
 @Override
 public ImageDescriptor getLargeImageDescriptor() {
   String path = "";
   if (modelType.getName().equals("DataInputUI")) path = UI_BPEL_Constants.DATA_INPUT_ICON_20;
   else if (modelType.getName().equals("DataOutputUI"))
     path = UI_BPEL_Constants.DATA_OUTPUT_ICON_20;
   else if (modelType.getName().equals("DataSelectionUI"))
     path = UI_BPEL_Constants.DATA_SELECTION_ICON_20;
   else if (modelType.getName().equals("OnUserEvent"))
     path = UI_BPEL_Constants.ON_USER_EVENT_ICON_20;
   else if (modelType.getName().equals("ScopeUI")) path = UI_BPEL_Constants.SCOPE_UI_ICON_20;
   else if (modelType.getName().equals("PickUI")) path = UI_BPEL_Constants.PICK_UI_ICON_20;
   else path = UI_BPEL_Constants.DEFAULT_ICON_20;
   return Activator.getDefault().getImageDescriptor(path);
 }
 private boolean isOnActivity() {
   // we can't use the isSuperTypeOF directly on EClass because they belong of different model
   // version.
   // So compare only the name
   final String activityEclassName = ProcessPackage.Literals.ACTIVITY.getName();
   if (activityEclassName.equals(containerType.getName())) {
     return true;
   }
   for (EClass superType : containerType.getEAllSuperTypes()) {
     if (activityEclassName.equals(superType.getName())) {
       return true;
     }
   }
   return false;
 }
Example #5
0
  public void handleRevisions(
      EClass eClass,
      CDOBranch branch,
      long timeStamp,
      boolean exactTime,
      CDORevisionHandler handler) {
    Query query = getObjectContainer().query();
    query.constrain(DB4ORevision.class);
    if (eClass != null) {
      query
          .descend(DB4ORevision.ATTRIBUTE_PACKAGE_NS_URI)
          .constrain(eClass.getEPackage().getNsURI());
      query.descend(DB4ORevision.ATTRIBUTE_CLASS_NAME).constrain(eClass.getName());
    }

    ObjectSet<?> revisions = query.execute();
    if (revisions.isEmpty()) {
      return;
    }

    for (Object revision : revisions.toArray()) {
      CDORevision cdoRevision = DB4ORevision.getCDORevision(getStore(), (DB4ORevision) revision);
      handler.handleRevision(cdoRevision);
    }
  }
 /**
  * Get the metaclass label (emitted by EMF Edit generation) for given object according given
  * editing domain.
  *
  * @param object_p
  * @param provider_p
  * @return <code>null</code> if one of parameters is <code>null</code> or if no label is found.
  */
 public static String getMetaclassLabel(EClass class_p, ItemProviderAdapter provider_p) {
   String label = null;
   // Preconditions.
   if ((null == class_p) || (null == provider_p)) {
     return label;
   }
   try {
     label =
         provider_p.getString(
             GENERATED_KEY_PREFIX + class_p.getName() + METACLASS_GENERATED_KEY_SUFFIX);
   } catch (MissingResourceException e) {
     label =
         "<<MissingResourceException>> [" + class_p.getName() + "]"; // $NON-NLS-1$ //$NON-NLS-2$
   }
   return label;
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case DocumentationPackage.BOOK:
       return createBook();
     case DocumentationPackage.PARAGRAPH:
       return createParagraph();
     case DocumentationPackage.SECTION:
       return createSection();
     case DocumentationPackage.TEXTUAL_VALUE:
       return createTextualValue();
     case DocumentationPackage.ITEMIZED_LIST_VALUE:
       return createItemizedListValue();
     case DocumentationPackage.ITEMIZED_LIST_VALUE_ITEM:
       return createItemizedListValueItem();
     case DocumentationPackage.EMPHASIS_VALUE:
       return createEmphasisValue();
     case DocumentationPackage.XREF_VALUE:
       return createXRefValue();
     case DocumentationPackage.INFORMAL_TABLE_VALUE:
       return createInformalTableValue();
     case DocumentationPackage.INFORMAL_TABLE_VALUE_ROW:
       return createInformalTableValueRow();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
Example #8
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case UnorderedGroupsTestPackage.MODEL:
       return createModel();
     case UnorderedGroupsTestPackage.SIMPLE_MODEL:
       return createSimpleModel();
     case UnorderedGroupsTestPackage.MANDATORY_MODEL:
       return createMandatoryModel();
     case UnorderedGroupsTestPackage.LOOPED_MODEL:
       return createLoopedModel();
     case UnorderedGroupsTestPackage.GROUP_LOOPED_MODEL:
       return createGroupLoopedModel();
     case UnorderedGroupsTestPackage.LOOPED_ALTERNATIVE_MODEL:
       return createLoopedAlternativeModel();
     case UnorderedGroupsTestPackage.BUG304681_MODEL:
       return createBug304681Model();
     case UnorderedGroupsTestPackage.BUG304681_FEATURE:
       return createBug304681Feature();
     case UnorderedGroupsTestPackage.BUG304681_ATTRIBUTE:
       return createBug304681Attribute();
     case UnorderedGroupsTestPackage.BUG304681_REFERENCE:
       return createBug304681Reference();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
 @Override
 public void run() {
   InputDialog inputDialog =
       new InputDialog(
           null,
           Messages.RenameActionProvider_ProvideNameTitle,
           Messages.RenameActionProvider_ProvideNameDescription,
           eclass.getName(),
           null);
   int open = inputDialog.open();
   if (open == Dialog.OK) {
     String newName = inputDialog.getValue();
     Resource resource = eclass.eResource();
     ResourceSet resourceSet = resource.getResourceSet();
     TransactionalEditingDomain domain =
         TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
     try {
       if (domain != null) {
         Command setCommand =
             domain.createCommand(
                 SetCommand.class,
                 new CommandParameter(
                     eclass, EcorePackage.Literals.ENAMED_ELEMENT__NAME, newName));
         domain.getCommandStack().execute(setCommand);
         try {
           resource.save(Collections.emptyMap());
         } catch (IOException e) {
           e.printStackTrace();
         }
       }
     } finally {
       domain.dispose();
     }
   }
 }
Example #10
0
 /**
  * Returns the invocation of an element or rule accessor, including the .getType() call. Example1:
  * getFooRule().getType() Example2: getBarRule().getFooAction().getType()
  */
 public String gaTypeAccessor(final TypeRef ele) {
   String _switchResult = null;
   EObject _eContainer = ele.eContainer();
   final EObject cnt = _eContainer;
   boolean _matched = false;
   if (!_matched) {
     if (cnt instanceof AbstractElement) {
       _matched = true;
       String _gaRuleElementAccessor = this.gaRuleElementAccessor(((AbstractElement) cnt));
       _switchResult = (_gaRuleElementAccessor + ".getType()");
     }
   }
   if (!_matched) {
     if (cnt instanceof AbstractRule) {
       _matched = true;
       String _gaRuleAccessor = this.gaRuleAccessor(((AbstractRule) cnt));
       _switchResult = (_gaRuleAccessor + ".getType()");
     }
   }
   if (!_matched) {
     EObject _eContainer_1 = ele.eContainer();
     EClass _eClass = _eContainer_1.eClass();
     String _name = _eClass.getName();
     String _plus = ("<error: unknown type " + _name);
     _switchResult = (_plus + ">");
   }
   return _switchResult;
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case EXTLibraryPackage.BOOK:
       return createBook();
     case EXTLibraryPackage.LIBRARY:
       return createLibrary();
     case EXTLibraryPackage.WRITER:
       return createWriter();
     case EXTLibraryPackage.PERIODICAL:
       return createPeriodical();
     case EXTLibraryPackage.BOOK_ON_TAPE:
       return createBookOnTape();
     case EXTLibraryPackage.VIDEO_CASSETTE:
       return createVideoCassette();
     case EXTLibraryPackage.BORROWER:
       return createBorrower();
     case EXTLibraryPackage.PERSON:
       return createPerson();
     case EXTLibraryPackage.EMPLOYEE:
       return createEmployee();
     default:
       throw new IllegalArgumentException(
           "The class '"
               + eClass.getName()
               + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
   }
 }
  public IReason updateNeeded(IUpdateContext context) {
    // retrieve name from pictogram model
    String pictogramName = null;
    PictogramElement pictogramElement = context.getPictogramElement();
    if (pictogramElement instanceof ContainerShape) {
      ContainerShape cs = (ContainerShape) pictogramElement;
      for (Shape shape : cs.getChildren()) {
        if (shape.getGraphicsAlgorithm() instanceof Text) {
          Text text = (Text) shape.getGraphicsAlgorithm();
          pictogramName = text.getValue();
        }
      }
    }

    // retrieve name from business model
    String businessName = null;
    Object bo = getBusinessObjectForPictogramElement(pictogramElement);
    if (bo instanceof EClass) {
      EClass eClass = (EClass) bo;
      businessName = eClass.getName();
    }

    // update needed, if names are different
    boolean updateNameNeeded =
        ((pictogramName == null && businessName != null)
            || (pictogramName != null && !pictogramName.equals(businessName)));
    if (updateNameNeeded) {
      return Reason.createTrueReason("Name is out of date");
    } else {
      return Reason.createFalseReason();
    }
  }
Example #13
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case WorkspacePackage.WORKSPACE_CONTEXT:
       return createWorkspaceContext();
     case WorkspacePackage.WS_FILE:
       return createWSFile();
     case WorkspacePackage.WS_FOLDER:
       return createWSFolder();
     case WorkspacePackage.WS_PROJECT:
       return createWSProject();
     case WorkspacePackage.WS_ROOT:
       return createWSRoot();
     case WorkspacePackage.WS_LINK:
       return createWSLink();
     case WorkspacePackage.WS_FILE_LINK:
       return createWSFileLink();
     case WorkspacePackage.WS_FOLDER_LINK:
       return createWSFolderLink();
     case WorkspacePackage.WS_PROJECT_LINK:
       return createWSProjectLink();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
Example #14
0
  /** @since 4.0 */
  protected void writeSystemValues(CDODataOutput out) throws IOException {
    EClass eClass = getEClass();
    CDOClassifierRef classRef = new CDOClassifierRef(eClass);

    if (TRACER.isEnabled()) {
      TRACER.format(
          "Writing revision: ID={0}, className={1}, version={2}, branchPoint={3}, revised={4}, resource={5}, container={6}, featureID={7}", //$NON-NLS-1$
          id,
          eClass.getName(),
          getVersion(),
          branchPoint,
          revised,
          resourceID,
          containerID,
          containingFeatureID);
    }

    out.writeCDOClassifierRef(classRef);
    out.writeCDOID(id);
    out.writeCDOBranchPoint(branchPoint);
    out.writeInt(getVersion());
    if (!id.isTemporary()) {
      out.writeLong(revised);
    }

    out.writeCDOID(resourceID);
    out.writeCDOID(out.getIDProvider().provideCDOID(containerID));
    out.writeInt(containingFeatureID);
  }
Example #15
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case RuntimePackage.WORKFLOW_CONTEXT:
       return createWorkflowContext();
     case RuntimePackage.WORKFLOW_ENGINE:
       return createWorkflowEngine();
     case RuntimePackage.WORKFLOW_STATE_MAP:
       return (EObject) createWorkflowStateMap();
     case RuntimePackage.WORKFLOW_PARAMETER_MAP:
       return (EObject) createWorkflowParameterMap();
     case RuntimePackage.WORKFLOW_PARAMETER_VALUE_PROXY:
       return createWorkflowParameterValueProxy();
     case RuntimePackage.WORKFLOW_STATE_RESOLUTION_STRATEGY:
       return createWorkflowStateResolutionStrategy();
     case RuntimePackage.WORKFLOW_RUNNABLE:
       return (EObject) createWorkflowRunnable();
     case RuntimePackage.WORKFLOW_RUNNER:
       return createWorkflowRunner();
     case RuntimePackage.WORKFLOW_LOG:
       return createWorkflowLog();
     case RuntimePackage.WORKFLOW_LOG_ENTRY:
       return createWorkflowLogEntry();
     case RuntimePackage.WORKFLOW_LOG_MAP:
       return (EObject) createWorkflowLogMap();
     case RuntimePackage.WORKFLOW_COMPONENT_EXECUTION_INFO:
       return createWorkflowComponentExecutionInfo();
     case RuntimePackage.WORKFLOW_COMPONENT_EXECUTION_INFO_MAP:
       return (EObject) createWorkflowComponentExecutionInfoMap();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
 public void testMetamodel() throws Exception {
   AbstractRule rule =
       GrammarUtil.findRuleForName(getGrammarAccess().getGrammar(), "OverridableParserRule2");
   assertNotNull("rule", rule);
   TypeRef ref = rule.getType();
   assertNotNull("ref", ref);
   final EClass clazz = (EClass) ref.getClassifier();
   assertNotNull("class", clazz);
   assertEquals("AType2", clazz.getName());
   assertEquals(2, clazz.getESuperTypes().size());
   Set<String> expectedNames =
       new HashSet<String>(Arrays.asList(new String[] {"AType", "RootRule"}));
   Iterator<String> iter =
       Iterables.transform(
               clazz.getESuperTypes(),
               new Function<EClass, String>() {
                 public String apply(EClass param) {
                   return param.getName();
                 }
               })
           .iterator();
   while (iter.hasNext()) {
     String name = iter.next();
     assertTrue("name = '" + name + "'", expectedNames.remove(name));
   }
   assertTrue(expectedNames.toString(), expectedNames.isEmpty());
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case NplPackage.DECLARATION:
       return createDeclaration();
     case NplPackage.IMAGES_COUNT:
       return createImagesCount();
     case NplPackage.FONT_SIZE:
       return createFontSize();
     case NplPackage.FORMAT:
       return createFormat();
     case NplPackage.DATE:
       return createDate();
     case NplPackage.LANGUAGE:
       return createLanguage();
     case NplPackage.PRICE:
       return createPrice();
     case NplPackage.CURRENCY:
       return createCurrency();
     case NplPackage.TOPIC:
       return createTopic();
     case NplPackage.PAIR:
       return createPair();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
Example #18
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case RuntimePackage.EXTENDET_DATA:
       return createExtendetData();
     case RuntimePackage.ENVIORMENT:
       return createEnviorment();
     case RuntimePackage.RUNTIME_CHARACTER:
       return createRuntimeCharacter();
     case RuntimePackage.TEAM:
       return createTeam();
     case RuntimePackage.GRUNT_TEAM:
       return createGruntTeam();
     case RuntimePackage.GRUNT_RUNTIME_CHARACTER:
       return createGruntRuntimeCharacter();
     case RuntimePackage.DRONE:
       return createDrone();
     case RuntimePackage.MATRIX_DEVICE:
       return createMatrixDevice();
     case RuntimePackage.RIGGER_CONSOLE:
       return createRiggerConsole();
     case RuntimePackage.CYBERDECK:
       return createCyberdeck();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case ComponentsPackage.COMPONENT:
       return createComponent();
     case ComponentsPackage.PORT:
       return createPort();
     case ComponentsPackage.CAPABILITY:
       return createCapability();
     case ComponentsPackage.REQUIREMENT:
       return createRequirement();
     case ComponentsPackage.PROPERTY:
       return createProperty();
     case ComponentsPackage.COMPONENT_ASSEMBLY:
       return createComponentAssembly();
     case ComponentsPackage.PROPERTY_CONNECTOR:
       return createPropertyConnector();
     case ComponentsPackage.PORT_CONNECTOR:
       return createPortConnector();
     case ComponentsPackage.EXTERNAL_REFERENCE:
       return createExternalReference();
     case ComponentsPackage.MONOLITHIC_IMPLEMENTATION:
       return createMonolithicImplementation();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case UiextensionmodelPackage.ACTIVITY_EXTENSION:
       return createActivityExtension();
     case UiextensionmodelPackage.CASE_EXTENSION:
       return createCaseExtension();
     case UiextensionmodelPackage.COPY_EXTENSION:
       return createCopyExtension();
     case UiextensionmodelPackage.END_NODE:
       return createEndNode();
     case UiextensionmodelPackage.LINK_EXTENSION:
       return createLinkExtension();
     case UiextensionmodelPackage.ON_ALARM_EXTENSION:
       return createOnAlarmExtension();
     case UiextensionmodelPackage.ON_EVENT_EXTENSION:
       return createOnEventExtension();
     case UiextensionmodelPackage.ON_MESSAGE_EXTENSION:
       return createOnMessageExtension();
     case UiextensionmodelPackage.PARTNER_LINK_EXTENSION:
       return createPartnerLinkExtension();
     case UiextensionmodelPackage.PROCESS_EXTENSION:
       return createProcessExtension();
     case UiextensionmodelPackage.REFERENCE_PARTNER_LINKS:
       return createReferencePartnerLinks();
     case UiextensionmodelPackage.START_NODE:
       return createStartNode();
     case UiextensionmodelPackage.VARIABLE_EXTENSION:
       return createVariableExtension();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
Example #21
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case XsdPackage.SEQUENCE:
       return createSequence();
     case XsdPackage.CHOICE:
       return createChoice();
     case XsdPackage.COMPLEX_TYPE:
       return createComplexType();
     case XsdPackage.ELEMENT_DEFINITION:
       return createElementDefinition();
     case XsdPackage.ATTRIBUTE:
       return createAttribute();
     case XsdPackage.ANY:
       return createAny();
     case XsdPackage.GROUP:
       return createGroup();
     case XsdPackage.ANNOTATION:
       return createAnnotation();
     case XsdPackage.NOTATION:
       return createNotation();
     case XsdPackage.SIMPLE_TYPE:
       return createSimpleType();
     case XsdPackage.ELEMENT_REFERENCE:
       return createElementReference();
     case XsdPackage.SIMPLE_CONTENT:
       return createSimpleContent();
     case XsdPackage.COMPLEX_CONTENT:
       return createComplexContent();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case DpdPackage.AUTHOR:
       return createAuthor();
     case DpdPackage.CHILD_HW_DEVICE:
       return createChildHwDevice();
     case DpdPackage.DEVICE_CLASS:
       return createDeviceClass();
     case DpdPackage.DEVICE_PKG:
       return createDevicePkg();
     case DpdPackage.DEVICE_PKG_REF:
       return createDevicePkgRef();
     case DpdPackage.DOCUMENT_ROOT:
       return createDocumentRoot();
     case DpdPackage.HW_DEVICE_REGISTRATION:
       return createHwDeviceRegistration();
     case DpdPackage.LOCAL_FILE:
       return createLocalFile();
     case DpdPackage.PROPERTY_FILE:
       return createPropertyFile();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case DslFilterPackage.ALL_FILTERS:
       return createAllFilters();
     case DslFilterPackage.FILTER_GROUP:
       return createFilterGroup();
     case DslFilterPackage.FILTER:
       return createFilter();
     case DslFilterPackage.CNUMBER_OPERATION:
       return createCNumberOperation();
     case DslFilterPackage.CSTRING_OPERATION:
       return createCStringOperation();
     case DslFilterPackage.CSTRUCTURAL_EOBJECT:
       return createCStructuralEObject();
     case DslFilterPackage.CLOGIC_OPERATION:
       return createCLogicOperation();
     case DslFilterPackage.INT_TO_EOBJECT_MAP:
       return (EObject) createIntToEObjectMap();
     case DslFilterPackage.BASIC_CSTRING_OPERATION:
       return createBasicCStringOperation();
     case DslFilterPackage.BASIC_CNUMBER_OPERATION:
       return createBasicCNumberOperation();
     case DslFilterPackage.BASIC_CLOGIC_OPERATION:
       return createBasicCLogicOperation();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
Example #24
0
 /**
  * Converts this Object to a dynamic object with a new type that is a subtype of the current type,
  * preserving any existing property values.
  *
  * @param newEClass the new type for this Object
  * @throws IllegalArgumentException if newEClass is not a subtype of this Object's current type
  * @see org.eclipse.emf.ecore.InternalEObject#eSetClass(org.eclipse.emf.ecore.EClass)
  */
 public void narrow(EClass newEClass) throws IllegalArgumentException {
   if (!eClass().equals(EcorePackage.eINSTANCE.getEObject())
       && !eClass().isSuperTypeOf(newEClass)) {
     throw new IllegalArgumentException(
         "The class "
             + newEClass.getName()
             + " is not a subtype of the Object's current type "
             + eClass().getName());
   }
   EPropertiesHolder props = eProperties();
   if (props.getEClass() != null && props.hasSettings()) {
     int staticSize = eStaticFeatureCount();
     int oldSize = eClass().getEAllStructuralFeatures().size() - staticSize;
     if (oldSize > 0) {
       int newSize = newEClass.getEAllStructuralFeatures().size() - staticSize;
       if (newSize > oldSize) {
         List oldValues = new ArrayList(oldSize);
         for (int i = 0; i < oldSize; i++) {
           oldValues.add(props.dynamicGet(i));
         }
         props.allocateSettings(newSize);
         for (int i = 0; i < oldSize; i++) {
           props.dynamicSet(i, oldValues.get(i));
         }
       }
     }
   }
   eSetClass(newEClass);
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case ConceptualPackage.CONCEPTUAL_MODEL:
       return createConceptualModel();
     case ConceptualPackage.TERM_UNIT:
       return createTermUnit();
     case ConceptualPackage.CONCEPTUAL_CONTAINER:
       return createConceptualContainer();
     case ConceptualPackage.FACT_UNIT:
       return createFactUnit();
     case ConceptualPackage.CONCEPTUAL_RELATIONSHIP:
       return createConceptualRelationship();
     case ConceptualPackage.BEHAVIOR_UNIT:
       return createBehaviorUnit();
     case ConceptualPackage.RULE_UNIT:
       return createRuleUnit();
     case ConceptualPackage.SCENARIO_UNIT:
       return createScenarioUnit();
     case ConceptualPackage.CONCEPTUAL_FLOW:
       return createConceptualFlow();
     case ConceptualPackage.CONCEPTUAL_ELEMENT:
       return createConceptualElement();
     case ConceptualPackage.CONCEPTUAL_ROLE:
       return createConceptualRole();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case CommandsPackageImpl.BINDING_CONTEXT:
       return (EObject) createBindingContext();
     case CommandsPackageImpl.BINDING_TABLE:
       return (EObject) createBindingTable();
     case CommandsPackageImpl.COMMAND:
       return (EObject) createCommand();
     case CommandsPackageImpl.COMMAND_PARAMETER:
       return (EObject) createCommandParameter();
     case CommandsPackageImpl.HANDLER:
       return (EObject) createHandler();
     case CommandsPackageImpl.KEY_BINDING:
       return (EObject) createKeyBinding();
     case CommandsPackageImpl.PARAMETER:
       return (EObject) createParameter();
     case CommandsPackageImpl.CATEGORY:
       return (EObject) createCategory();
     default:
       throw new IllegalArgumentException(
           "The class '"
               + eClass.getName()
               + "' is not a valid classifier"); //$NON-NLS-1$ //$NON-NLS-2$
   }
 }
Example #27
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     case WikimPackage.CATEGORY:
       return createCategory();
     case WikimPackage.WIKI_CONTENT:
       return createWikiContent();
     case WikimPackage.SECTION:
       return createSection();
     case WikimPackage.WIKI_DATABASE:
       return createWikiDatabase();
     case WikimPackage.ARTICLE:
       return createArticle();
     case WikimPackage.IMAGE:
       return createImage();
     case WikimPackage.PARAGRAPH:
       return createParagraph();
     case WikimPackage.ITEM_LIST:
       return createItemList();
     case WikimPackage.ITEM:
       return createItem();
     case WikimPackage.FILE:
       return createFile();
     case WikimPackage.USER:
       return createUser();
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
  /**
   * Returns <code>true</code> if specified class contains 'visible' attribute.
   *
   * @param clazz
   * @return
   */
  static boolean contanisVisibleElement(EClass clazz) {
    boolean contains = hasVisibleElementSet.contains(clazz.getName());
    if (contains) {
      return true;
    }
    EList<EClass> supers = clazz.getEAllSuperTypes();
    if (supers.size() > 0) {
      for (EClass eSuper : supers) {
        contains = hasVisibleElementSet.contains(eSuper.getName());
        if (contains) {
          return true;
        }
      }
    }

    return contains;
  }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public EObject create(EClass eClass) {
   switch (eClass.getClassifierID()) {
     default:
       throw new IllegalArgumentException(
           "The class '" + eClass.getName() + "' is not a valid classifier");
   }
 }
  private void setEnabledAll(boolean enabled) {
    for (EClass e : elementSet) {
      prefs.putBoolean(e.getName(), enabled);

      for (EAttribute a : e.getEAllAttributes()) {
        prefs.putBoolean(e.getName() + "." + a.getName(), enabled);
      }

      for (EReference a : e.getEAllContainments()) {
        prefs.putBoolean(e.getName() + "." + a.getName(), enabled);
      }

      for (EReference a : e.getEAllReferences()) {
        prefs.putBoolean(e.getName() + "." + a.getName(), enabled);
      }
    }
  }