/* $Id: CreateShortCutAction.java 373 2011-10-01 16:30:41Z shayashi $ */
package smart_gs.drawing_tool.action;

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

import smart_gs.logical.GSResource;
import smart_gs.reasoning_web.desktop.swingui.ReasoningWebDesktop;
import smart_gs.swingui.CreateShortCutDialog;
import smart_gs.swingui.WorkspaceWindow;

public class CreateShortCutAction implements ActionListener {

	private GSResource resource;
	
	public CreateShortCutAction(GSResource resource) {
		this.resource = resource;
	}
	
	public void execute(){
		CreateShortCutDialog dialog = new CreateShortCutDialog(WorkspaceWindow.getInstance());
		
		dialog.setVisible(true);
		
		if(dialog.isCanceled()){
			return;
		}
		String name = dialog.getName();
//		String source = dialog.getSource();
//		
		ReasoningWebDesktop.getInstance().addResource(resource,name,dialog.getDocument());
	}
	public void actionPerformed(ActionEvent e) {
		this.execute();
	}
	
}
