package transformation.associationtags;

import com.nomagic.magicdraw.core.Application;
import com.nomagic.magicdraw.core.Project;
import com.nomagic.magicdraw.ui.actions.DefaultDiagramAction;

import java.awt.event.ActionEvent;

public class ShowAssociationTags extends DefaultDiagramAction {
	
	public ShowAssociationTags() {
		super("", "Show association tags", null, null);
	}
	
	/**
     * Overrides the DefaultDiagramAction method. 
     * Is called when the respective menu element is clicked.
     * Displays the association tags window.
     */
	public void actionPerformed(ActionEvent e) {
	    
	    Project project = Application.getInstance().getProject();
	    
	    if (project.getActiveDiagram().getDiagramType().getType().equals("Activity Diagram") == false) {
            javax.swing.JOptionPane.showMessageDialog( null, "Diagram must be an Activity Diagram");
        }
	    
	    else {
    		AssociationTagWindow window = new AssociationTagWindow();
    		window.showTags();
	    }
	}

}
