コード例 #1
0
 /**
  * {@inheritDoc}
  *
  * @see
  *     org.eclipse.emf.eef.runtime.impl.components.StandardPropertiesEditionComponent#updatePart(org.eclipse.emf.common.notify.Notification)
  */
 public void updatePart(Notification msg) {
   if (editingPart.isVisible()) {
     CriteriaPropertiesEditionPart basePart = (CriteriaPropertiesEditionPart) editingPart;
     if (ArmPackage.eINSTANCE.getModelElement_Identifier().equals(msg.getFeature())
         && basePart != null
         && isAccessible(EurViewsRepository.Criteria.Properties.identifier)) {
       if (msg.getNewValue() != null) {
         basePart.setIdentifier(
             EcoreUtil.convertToString(ArmPackage.eINSTANCE.getString(), msg.getNewValue()));
       } else {
         basePart.setIdentifier("");
       }
     }
     if (ArmPackage.eINSTANCE.getModelElement_Description().equals(msg.getFeature())
         && basePart != null
         && isAccessible(EurViewsRepository.Criteria.Properties.description)) {
       if (msg.getNewValue() != null) {
         basePart.setDescription(
             EcoreUtil.convertToString(ArmPackage.eINSTANCE.getString(), msg.getNewValue()));
       } else {
         basePart.setDescription("");
       }
     }
     if (ArmPackage.eINSTANCE.getModelElement_Content().equals(msg.getFeature())
         && basePart != null
         && isAccessible(EurViewsRepository.Criteria.Properties.content)) {
       if (msg.getNewValue() != null) {
         basePart.setContent(
             EcoreUtil.convertToString(ArmPackage.eINSTANCE.getString(), msg.getNewValue()));
       } else {
         basePart.setContent("");
       }
     }
     if (ArmPackage.eINSTANCE.getModelElement_IsTagged().equals(msg.getFeature())
         && isAccessible(EurViewsRepository.Criteria.Properties.isTagged))
       basePart.updateIsTagged();
     if (EurPackage.eINSTANCE.getCriteria_Context().equals(msg.getFeature())
         && isAccessible(EurViewsRepository.Criteria.Properties.context)) basePart.updateContext();
     if (EurPackage.eINSTANCE.getCriteria_Assumption().equals(msg.getFeature())
         && isAccessible(EurViewsRepository.Criteria.Properties.assumption))
       basePart.updateAssumption();
   }
 }
コード例 #2
0
  /**
   * {@inheritDoc}
   *
   * @see
   *     org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object,
   *     int, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.resource.ResourceSet)
   */
  public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
    setInitializing(true);
    if (editingPart != null && key == partKey) {
      editingPart.setContext(elt, allResource);
      final Criteria criteria = (Criteria) elt;
      final CriteriaPropertiesEditionPart basePart = (CriteriaPropertiesEditionPart) editingPart;
      // init values
      if (criteria.getIdentifier() != null
          && isAccessible(EurViewsRepository.Criteria.Properties.identifier))
        basePart.setIdentifier(
            EEFConverterUtil.convertToString(
                ArmPackage.eINSTANCE.getString(), criteria.getIdentifier()));

      if (criteria.getDescription() != null
          && isAccessible(EurViewsRepository.Criteria.Properties.description))
        basePart.setDescription(
            EEFConverterUtil.convertToString(
                ArmPackage.eINSTANCE.getString(), criteria.getDescription()));

      if (criteria.getContent() != null
          && isAccessible(EurViewsRepository.Criteria.Properties.content))
        basePart.setContent(
            EEFConverterUtil.convertToString(
                ArmPackage.eINSTANCE.getString(), criteria.getContent()));

      if (isAccessible(EurViewsRepository.Criteria.Properties.isTagged)) {
        isTaggedSettings =
            new ReferencesTableSettings(criteria, ArmPackage.eINSTANCE.getModelElement_IsTagged());
        basePart.initIsTagged(isTaggedSettings);
      }
      if (isAccessible(EurViewsRepository.Criteria.Properties.context)) {
        contextSettings =
            new ReferencesTableSettings(criteria, EurPackage.eINSTANCE.getCriteria_Context());
        basePart.initContext(contextSettings);
      }
      if (isAccessible(EurViewsRepository.Criteria.Properties.assumption)) {
        assumptionSettings =
            new ReferencesTableSettings(criteria, EurPackage.eINSTANCE.getCriteria_Assumption());
        basePart.initAssumption(assumptionSettings);
      }
      // init filters

      basePart.addFilterToIsTagged(
          new ViewerFilter() {

            /**
             * {@inheritDoc}
             *
             * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer,
             *     java.lang.Object, java.lang.Object)
             */
            public boolean select(Viewer viewer, Object parentElement, Object element) {
              return (element instanceof String && element.equals(""))
                  || (element instanceof TaggedValue); // $NON-NLS-1$
            }
          });
      // Start of user code for additional businessfilters for isTagged

      // End of user code

      basePart.addFilterToContext(
          new ViewerFilter() {

            /**
             * {@inheritDoc}
             *
             * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer,
             *     java.lang.Object, java.lang.Object)
             */
            public boolean select(Viewer viewer, Object parentElement, Object element) {
              if (element instanceof EObject)
                return (!basePart.isContainedInContextTable((EObject) element));
              return element instanceof Resource;
            }
          });
      basePart.addFilterToContext(new EObjectFilter(EurPackage.eINSTANCE.getContext()));
      // Start of user code for additional businessfilters for context

      // End of user code

      basePart.addFilterToAssumption(
          new ViewerFilter() {

            /**
             * {@inheritDoc}
             *
             * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer,
             *     java.lang.Object, java.lang.Object)
             */
            public boolean select(Viewer viewer, Object parentElement, Object element) {
              if (element instanceof EObject)
                return (!basePart.isContainedInAssumptionTable((EObject) element));
              return element instanceof Resource;
            }
          });
      basePart.addFilterToAssumption(new EObjectFilter(EurPackage.eINSTANCE.getAssumption()));
      // Start of user code for additional businessfilters for assumption

      // End of user code

      // init values for referenced views

      // init filters for referenced views

    }
    setInitializing(false);
  }