コード例 #1
0
 /**
  * @see
  *     org.eclipse.emf.emfstore.server.model.versioning.operations.provider.AbstractOperationItemProvider#getChildren(java.lang.Object)
  */
 @Override
 public Collection<?> getChildren(Object object) {
   if (object instanceof CreateDeleteOperation) {
     CreateDeleteOperation operation = (CreateDeleteOperation) object;
     ArrayList<Object> ret = new ArrayList<Object>();
     ret.add(operation.getModelElementId());
     List<ReferenceOperation> subOps = operation.getSubOperations();
     if (subOps.size() > 0) {
       OperationGroup operationGroup = OperationsFactory.eINSTANCE.createOperationGroup();
       if (operation.isDelete()) {
         operationGroup.setName("Deleted Cross-References");
       } else {
         operationGroup.setName("Created Cross-References");
       }
       operationGroup.getOperations().addAll(subOps);
       ret.add(operationGroup);
     }
     return ret;
   }
   return super.getChildren(object);
 }
  /**
   * {@inheritDoc}
   *
   * @generated NOT
   * @see
   *     org.eclipse.emf.emfstore.server.model.versioning.operations.provider.CompositeOperationItemProvider#getChildren(java.lang.Object)
   */
  @SuppressWarnings("unchecked")
  @Override
  public Collection<?> getChildren(Object object) {
    if (object instanceof SemanticCompositeOperation) {
      SemanticCompositeOperation operation = (SemanticCompositeOperation) object;
      ArrayList<Object> result = new ArrayList<Object>();

      OperationsFactory factory = OperationsFactory.eINSTANCE;
      for (EStructuralFeature feature : operation.eClass().getEStructuralFeatures()) {
        if (feature instanceof EReference) {
          EReference reference = (EReference) feature;

          ModelElementGroup referenceGroup = factory.createModelElementGroup();
          String key =
              "_UI_"
                  + reference.getEContainingClass().getName()
                  + "_"
                  + reference.getName()
                  + "_feature";
          referenceGroup.setName(getString(key));
          if (reference.isMany()) {
            List<ModelElementId> value = (List<ModelElementId>) operation.eGet(reference);
            referenceGroup.getModelElements().addAll(value);
          } else {
            ModelElementId value = (ModelElementId) operation.eGet(reference);
            referenceGroup.getModelElements().add(value);
          }
          result.add(referenceGroup);
        }
      }

      OperationGroup detailsGroup = factory.createOperationGroup();
      detailsGroup.setName("Sub Operations");
      detailsGroup.getOperations().addAll(operation.getSubOperations());
      result.add(detailsGroup);

      return result;
    }
    return super.getChildren(object);
  }