// File: ActionDisplayCd
// Classes: ActionDisplayCd
// Author: Kedar Patankar

package edu.neu.ccs.demeter.tools.apstudio.graphedit;

public class ActionDisplayCd  extends Action
{
	public ActionDisplayCd(Editor e,Document d )
	{
		super( e,d );
	}	  
  
	public String name()
	{ 
	    return new String(" Display Current CD" ); 
	}

	public void doIt()
	{
		if ( _document !=  null )
		{	
//			TextView tv = new TextView( _editor,"Cd-File: " + _document.getDocName(),get_graph());
			TextView tv = new TextView( "Cd-File: " + _document.getDocName(),get_graph());
			tv.setVisible(true);
		}
	}

	public void undoIt() { }


	// function to convert the documents graph information to gcd format
	private String get_graph()
	{
		UGraph graph = _document.toExactGraph();
		String graphString=graph.getCdString();
		if (graphString == null)
			graphString = "--- No Data ---";
		return graphString;

//		if(graph!=null)
//			return graph.getCdString();
//		else
//			return( "--- No Data ---");
	}
} /* end class ActionDisplayCd */

