@Override
 public void notifyChanged(Notification notification) {
   assert getHost() != null;
   if (notification.getEventType() != Notification.SET) return;
   boolean hasChanged = false;
   switch (notification.getFeatureID(GridLayoutRule.class)) {
     case SWTStylesPackage.GRID_LAYOUT_RULE__MAKE_COLUMNS_EQUAL_WIDTH:
       hasChanged =
           !CompareUtils.areEquals(
               notification.getOldBooleanValue(), notification.getNewBooleanValue());
       break;
     case SWTStylesPackage.GRID_LAYOUT_RULE__HORIZONTAL_SPACING:
     case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_BOTTOM:
     case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_HEIGHT:
     case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_LEFT:
     case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_RIGHT:
     case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_TOP:
     case SWTStylesPackage.GRID_LAYOUT_RULE__MARGIN_WIDTH:
     case SWTStylesPackage.GRID_LAYOUT_RULE__NUM_COLUMNS:
     case SWTStylesPackage.GRID_LAYOUT_RULE__VERTICAL_SPACING:
       hasChanged =
           !CompareUtils.areEquals(notification.getOldIntValue(), notification.getNewIntValue());
       break;
     default:
       super.notifyChanged(notification);
   }
   if (hasChanged && getHost().styleRuleUpdated((StyleRule) notification.getNotifier()))
     reCreateWidgetView();
 }
Example #2
0
 @Override
 public void notifyChanged(Notification notification) {
   assert getHost() != null;
   if (notification.getEventType() != Notification.SET) return;
   boolean hasChanged = false;
   switch (notification.getFeatureID(IntRule.class)) {
     case CoreStylesPackage.INT_RULE__VALUE:
       hasChanged =
           !CompareUtils.areEquals(notification.getOldIntValue(), notification.getNewIntValue());
       break;
     case CoreStylesPackage.INT_RULE__PROPERTY_NAME:
       reCreateWidgetView();
       return;
     default:
       super.notifyChanged(notification);
   }
   if (hasChanged && getHost().styleRuleUpdated((StyleRule) notification.getNotifier()))
     reCreateWidgetView();
 }
Example #3
0
  public void notifyChanged(Notification notification) {
    int type = notification.getEventType();
    int featureId = notification.getFeatureID(CoremodelPackage.class);

    if (notification.getNotifier() instanceof CoreModel) {
      if (type == Notification.REMOVE)
        switch (featureId) {
          case CoremodelPackage.CORE_MODEL__COMPONENTS:
            if (getCastedVisualModel().getDiagram() != null
                && notification.getOldValue() == getCastedSemanticModel())
              appendToLastAndExecuteCommand(getDeleteComponentCommand());

          case CoremodelPackage.CORE_MODEL__STEREOTYPES:
            if (notification.getOldValue() == getCastedSemanticModel().getStereotype()) {
              updateStereotypeName(getCastedFigure());
              refreshVisuals();
            }
        }
      return;
    }

    if (notification.getNotifier() instanceof Stereotype) {
      if (type == Notification.SET && featureId == CoremodelPackage.STEREOTYPE__NAME) {
        updateStereotypeName(getCastedFigure());
        refreshVisuals();
      }
      return;
    }

    if (notification.getNotifier() instanceof Responsibility) {
      if (type == Notification.SET && featureId == CoremodelPackage.RESPONSIBILITY__NAME) {
        updateResponsibilities(getCastedFigure());
        refreshVisuals();
      }
      return;
    }

    if (notification.getNotifier() instanceof ComponentModel) {
      switch (type) {
        case Notification.ADD:
          if (featureId == CoremodelPackage.COMPONENT_MODEL__FEATURES) {
            ((Responsibility) notification.getNewValue()).eAdapters().add(this);
            updateResponsibilities(getCastedFigure());
            refreshVisuals();
          }
          break;
        case Notification.REMOVE:
          if (featureId == CoremodelPackage.COMPONENT_MODEL__FEATURES) {
            ((Responsibility) notification.getOldValue()).eAdapters().remove(this);
            updateResponsibilities(getCastedFigure());
            refreshVisuals();
          }
          if (featureId == CoremodelPackage.COMPONENT_MODEL__OWNED_PORTS)
            notifyChildren(notification);
          break;

        case Notification.SET:
          switch (featureId) {
            case CoremodelPackage.COMPONENT_MODEL__NAME:
              getCastedFigure().setText(getCastedSemanticModel().getName());
              refreshVisuals();
              break;
            case CoremodelPackage.COMPONENT_MODEL__STEREOTYPE:
              updateStereotypeName(getCastedFigure());
              refreshVisuals();
              break;
          }
      }
      return;
    }

    // VisualModel
    featureId = notification.getFeatureID(EditormodelPackage.class);
    switch (type) {
      case Notification.ADD:
      case Notification.REMOVE:
        if (featureId == EditormodelPackage.VISUAL_MODEL__CHILDREN) refreshVisuals();
        break;
      case Notification.SET:
        if (featureId == EditormodelPackage.VISUAL_MODEL__DETAIL_LEVEL) {
          getCastedFigure()
              .showResponsibilites(notification.getNewIntValue() == VisualModel.HIGH_DETAIL);
          refreshVisuals();
        }
        break;
    }
    super.notifyChanged(notification);
  }