Example #1
0
  @Override
  public void actionPerformed(ActionEvent e) {
    super.actionPerformed(e);

    if ("AddMethod".equals(e.getActionCommand())) addMethod();
    else if ("AddAttribute".equals(e.getActionCommand())) addAttribute();
    else if ("Delete".equals(e.getActionCommand())) {
      if (SMessageDialog.showQuestionMessageYesNo(
              "Are you sur to delete this component and all its associated components?")
          == JOptionPane.NO_OPTION) return;

      if (pressedTextBox != null) removeTextBox(pressedTextBox);
      else delete();
    } else if ("ViewAttribute".equals(e.getActionCommand())) {
      parent.showAttributsForSelectedEntity(true);
      parent.showMethodsForSelectedEntity(false);
    } else if ("ViewMethods".equals(e.getActionCommand())) {
      parent.showAttributsForSelectedEntity(false);
      parent.showMethodsForSelectedEntity(true);
    } else if ("ViewAll".equals(e.getActionCommand())) {
      parent.showAttributsForSelectedEntity(true);
      parent.showMethodsForSelectedEntity(true);
    } else if ("ViewNothing".equals(e.getActionCommand())) {
      parent.showAttributsForSelectedEntity(false);
      parent.showMethodsForSelectedEntity(false);
    } else if ("ViewTypeAndName".equals(e.getActionCommand()))
      methodViewChangeClicked(ParametersViewStyle.TYPE_AND_NAME);
    else if ("ViewType".equals(e.getActionCommand()))
      methodViewChangeClicked(ParametersViewStyle.TYPE);
    else if ("ViewName".equals(e.getActionCommand()))
      methodViewChangeClicked(ParametersViewStyle.NAME);
    else if ("ViewMethodNothing".equals(e.getActionCommand()))
      methodViewChangeClicked(ParametersViewStyle.NOTHING);
    else if (Slyum.ACTION_TEXTBOX_UP.equals(e.getActionCommand())
        || Slyum.ACTION_TEXTBOX_DOWN.equals(e.getActionCommand())) {
      int offset = 1;

      if (Slyum.ACTION_TEXTBOX_UP.equals(e.getActionCommand())) offset = -1;

      if (pressedTextBox.getClass() == TextBoxAttribute.class) {
        final Attribute attribute =
            (Attribute) ((TextBoxAttribute) pressedTextBox).getAssociedComponent();
        component.moveAttributePosition(attribute, offset);
      } else if (pressedTextBox.getClass() == TextBoxMethod.class) {
        final Method method = (Method) ((TextBoxMethod) pressedTextBox).getAssociedComponent();
        component.moveMethodPosition(method, offset);
      }

      component.notifyObservers();
    }
  }
Example #2
0
 @Override
 protected void creationFailed() {
   SMessageDialog.showErrorMessage(ERROR_CREATION_MESSAGE);
 }