package transformation.su_transformationplugin.listeners;

import transformation.associationtags.AssociationTag;
import transformation.su_transformationplugin.SU_Transformation;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;

import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class OkListener implements ActionListener{
	
	SU_Transformation transformation;
	List<AssociationTag> tags;
	List<String> resources;
	JFrame frame;
	
	public OkListener(SU_Transformation transformation, List<AssociationTag> tags, 
			List<String> resources, JFrame frame) {
		this.transformation = transformation;
		this.tags = tags;
		this.resources = resources;
		this.frame = frame;
	}

	@Override
	/**
	 * When OK is clicked, the joined tags are stored in a comment on the activity diagram.
	 */
	public void actionPerformed(ActionEvent e) {
		
		transformation.createTagComment(tags, resources);
		frame.dispose();
		
	}

}
