コード例 #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()) {
     SolutionPropertiesEditionPart basePart = (SolutionPropertiesEditionPart) editingPart;
     if (ArmPackage.eINSTANCE.getModelElement_Identifier().equals(msg.getFeature())
         && basePart != null
         && isAccessible(GsnViewsRepository.Solution.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(GsnViewsRepository.Solution.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(GsnViewsRepository.Solution.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(GsnViewsRepository.Solution.Properties.isTagged))
       basePart.updateIsTagged();
     if (ArmPackage.eINSTANCE.getArgumentLink_Target().equals(msg.getFeature())
         && isAccessible(GsnViewsRepository.Solution.Properties.target)) basePart.updateTarget();
     if (ArmPackage.eINSTANCE.getArgumentLink_Source().equals(msg.getFeature())
         && isAccessible(GsnViewsRepository.Solution.Properties.source)) basePart.updateSource();
     if (GsnPackage.eINSTANCE.getSolution_SolutionEvidence().equals(msg.getFeature())
         && isAccessible(GsnViewsRepository.Solution.Properties.solutionEvidence))
       basePart.updateSolutionEvidence();
     if (GsnPackage.eINSTANCE.getSolution_SolutionContexts().equals(msg.getFeature())
         && isAccessible(GsnViewsRepository.Solution.Properties.solutionContexts))
       basePart.updateSolutionContexts();
   }
 }
コード例 #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 Solution solution = (Solution) elt;
      final SolutionPropertiesEditionPart basePart = (SolutionPropertiesEditionPart) editingPart;
      // init values
      if (solution.getIdentifier() != null
          && isAccessible(GsnViewsRepository.Solution.Properties.identifier))
        basePart.setIdentifier(
            EEFConverterUtil.convertToString(
                ArmPackage.eINSTANCE.getString(), solution.getIdentifier()));

      if (solution.getDescription() != null
          && isAccessible(GsnViewsRepository.Solution.Properties.description))
        basePart.setDescription(
            EEFConverterUtil.convertToString(
                ArmPackage.eINSTANCE.getString(), solution.getDescription()));

      if (solution.getContent() != null
          && isAccessible(GsnViewsRepository.Solution.Properties.content))
        basePart.setContent(
            EEFConverterUtil.convertToString(
                ArmPackage.eINSTANCE.getString(), solution.getContent()));

      if (isAccessible(GsnViewsRepository.Solution.Properties.isTagged)) {
        isTaggedSettings =
            new ReferencesTableSettings(solution, ArmPackage.eINSTANCE.getModelElement_IsTagged());
        basePart.initIsTagged(isTaggedSettings);
      }
      if (isAccessible(GsnViewsRepository.Solution.Properties.target)) {
        targetSettings =
            new ReferencesTableSettings(solution, ArmPackage.eINSTANCE.getArgumentLink_Target());
        basePart.initTarget(targetSettings);
      }
      if (isAccessible(GsnViewsRepository.Solution.Properties.source)) {
        sourceSettings =
            new ReferencesTableSettings(solution, ArmPackage.eINSTANCE.getArgumentLink_Source());
        basePart.initSource(sourceSettings);
      }
      if (isAccessible(GsnViewsRepository.Solution.Properties.solutionEvidence)) {
        solutionEvidenceSettings =
            new ReferencesTableSettings(
                solution, GsnPackage.eINSTANCE.getSolution_SolutionEvidence());
        basePart.initSolutionEvidence(solutionEvidenceSettings);
      }
      if (isAccessible(GsnViewsRepository.Solution.Properties.solutionContexts)) {
        solutionContextsSettings =
            new ReferencesTableSettings(
                solution, GsnPackage.eINSTANCE.getSolution_SolutionContexts());
        basePart.initSolutionContexts(solutionContextsSettings);
      }
      // 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.addFilterToTarget(
          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.isContainedInTargetTable((EObject) element));
              return element instanceof Resource;
            }
          });
      basePart.addFilterToTarget(new EObjectFilter(ArmPackage.eINSTANCE.getModelElement()));
      // Start of user code for additional businessfilters for target

      // End of user code

      basePart.addFilterToSource(
          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.isContainedInSourceTable((EObject) element));
              return element instanceof Resource;
            }
          });
      basePart.addFilterToSource(new EObjectFilter(ArmPackage.eINSTANCE.getModelElement()));
      // Start of user code for additional businessfilters for source

      // End of user code

      basePart.addFilterToSolutionEvidence(
          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 Evidence); // $NON-NLS-1$
            }
          });
      // Start of user code for additional businessfilters for solutionEvidence

      // End of user code

      basePart.addFilterToSolutionContexts(
          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 Context); // $NON-NLS-1$
            }
          });
      // Start of user code for additional businessfilters for solutionContexts

      // End of user code

      // init values for referenced views

      // init filters for referenced views

    }
    setInitializing(false);
  }