/** @generated */
 protected void handleNotificationEvent(Notification event) {
   Object feature = event.getFeature();
   if (NotationPackage.eINSTANCE.getFontStyle_FontColor().equals(feature)) {
     Integer c = (Integer) event.getNewValue();
     setFontColor(DiagramColorRegistry.getInstance().getColor(c));
   } else if (NotationPackage.eINSTANCE.getFontStyle_Underline().equals(feature)) {
     refreshUnderline();
   } else if (NotationPackage.eINSTANCE.getFontStyle_StrikeThrough().equals(feature)) {
     refreshStrikeThrough();
   } else if (NotationPackage.eINSTANCE.getFontStyle_FontHeight().equals(feature)
       || NotationPackage.eINSTANCE.getFontStyle_FontName().equals(feature)
       || NotationPackage.eINSTANCE.getFontStyle_Bold().equals(feature)
       || NotationPackage.eINSTANCE.getFontStyle_Italic().equals(feature)) {
     refreshFont();
   } else {
     if (getParser() != null
         && getParser().isAffectingEvent(event, getParserOptions().intValue())) {
       refreshLabel();
     }
     if (getParser() instanceof ISemanticParser) {
       ISemanticParser modelParser = (ISemanticParser) getParser();
       if (modelParser.areSemanticElementsAffected(null, event)) {
         removeSemanticListeners();
         if (resolveSemanticElement() != null) {
           addSemanticListeners();
         }
         refreshLabel();
       }
     }
   }
   super.handleNotificationEvent(event);
 }
 @Override
 protected void refreshVisuals() {
   super.refreshVisuals();
   refreshFont();
   refreshFontColor();
   updateLabelText();
 }
Esempio n. 3
0
 /** @generated */
 protected void createDefaultEditPolicies() {
   super.createDefaultEditPolicies();
   installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
   installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new RdalTextSelectionEditPolicy());
   installEditPolicy(
       EditPolicy.PRIMARY_DRAG_ROLE, new SpecificationEditPart.LinkLabelDragPolicy());
 }
  /**
   * Returns a <code>Command</code> which sets the label's offset to its original position.
   *
   * @param request the request
   * @return the command
   */
  @Override
  public Command getCommand(Request request) {
    if (RequestConstants.REQ_SNAP_BACK.equals(request.getType())) {
      View view = (View) getHost().getModel();

      // YT - Use a snap back hint that takes into account the diagram
      // and parent view type.
      String hint = getSnapBackHint(view);

      Point offset = LabelEditPart.getSnapBackPosition(hint);
      if (offset == null) {
        return null;
      }

      TransactionalEditingDomain editingDomain =
          ((IGraphicalEditPart) getHost()).getEditingDomain();

      ICommand moveCommand =
          new SetBoundsCommand(
              editingDomain,
              DiagramUIMessages.SetLocationCommand_Label_Resize,
              new EObjectAdapter(view),
              offset);
      return new ICommandProxy(moveCommand);
    }
    return null;
  }
 /** @generated */
 protected void refreshVisuals() {
   super.refreshVisuals();
   refreshLabel();
   refreshFont();
   refreshFontColor();
   refreshUnderline();
   refreshStrikeThrough();
 }
 /** @generated */
 protected void createDefaultEditPolicies() {
   super.createDefaultEditPolicies();
   installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
   installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
   installEditPolicy(
       AppliedStereotypeLabelDisplayEditPolicy.STEREOTYPE_LABEL_POLICY,
       new AppliedStereotypeExternalNodeEditPolicy());
 }
 /** @generated */
 protected void removeSemanticListeners() {
   if (parserElements != null) {
     for (int i = 0; i < parserElements.size(); i++) {
       removeListenerFilter("SemanticModel" + i); // $NON-NLS-1$
     }
   } else {
     super.removeSemanticListeners();
   }
 }
Esempio n. 8
0
 /** @generated */
 protected void createDefaultEditPolicies() {
   super.createDefaultEditPolicies();
   installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
   installEditPolicy(
       EditPolicy.SELECTION_FEEDBACK_ROLE,
       new edu.toronto.cs.se.modelepedia.statemachine_mavo.diagram.edit.policies
           .StateMachine_MAVOTextSelectionEditPolicy());
   installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new DefaultLinkLabelDragPolicy());
 }
 /** @generated */
 protected void createDefaultEditPolicies() {
   super.createDefaultEditPolicies();
   installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
   installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
   installEditPolicy(EditPolicy.PRIMARY_DRAG_ROLE, new ModelEditPart.LinkLabelDragPolicy());
   installEditPolicy(
       IMaskManagedLabelEditPolicy.MASK_MANAGED_LABEL_EDIT_POLICY,
       new DisplayAssociationBranchEndMultiplicityEditPolicy());
 }
 /** @generated */
 protected void addSemanticListeners() {
   if (getParser() instanceof ISemanticParser) {
     EObject element = resolveSemanticElement();
     parserElements = ((ISemanticParser) getParser()).getSemanticElementsBeingParsed(element);
     for (int i = 0; i < parserElements.size(); i++) {
       addListenerFilter(
           "SemanticModel" + i, this, (EObject) parserElements.get(i)); // $NON-NLS-1$
     }
   } else {
     super.addSemanticListeners();
   }
 }
 @Override
 protected void handleNotificationEvent(final Notification notification) {
   if (notification.getNotifier() instanceof ShapeStyle) {
     refreshVisuals();
   } else if (NotationPackage.eINSTANCE
       .getFontStyle()
       .getEAllAttributes()
       .contains(notification.getFeature())) {
     refreshFont();
   } else {
     super.handleNotificationEvent(notification);
   }
 }
 /** @generated */
 protected void createDefaultEditPolicies() {
   super.createDefaultEditPolicies();
   installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
 }
 /** @generated */
 protected void createDefaultEditPolicies() {
   super.createDefaultEditPolicies();
   installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new LabelDirectEditPolicy());
   installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new UMLTextSelectionEditPolicy());
 }