/*****************************************************************************\

FILE:    Application.java
PURPOSE: Start a tracker dialog box either as an application or as a model program.

09-Apr-99    I-01-34     JCN   $$1   Created.
23-Jul-99    I-03-12     MSH   $$2   Renamed the file to Application.java

\*****************************************************************************/
import com.ptc.pfc.pfcGlobal.*;
import com.ptc.pfc.pfcSession.*;
import com.ptc.pfc.pfcModel.*;


import com.ptc.tracker.Tracker;


public class Application {

  public static Session session;
  public static Models models;

  /*  Static start method for the application */
  public static void app_start ()
  {
    title();

    try {
      session = pfcGlobal.GetProESession();
      
      models = session.ListModels();
    
      new Tracker(session, models);
    }

    catch (Throwable x)
      {
	printMsg("Exception caught: "+x);
	x.printStackTrace();
      }
  }

  /* Start method used for model program */
  public static void mp_start ()
  {
    title();

    try {
      
      session = pfcGlobal.GetProESession();
      
      models = Models.create();
      
      models.insert(0, session.GetCurrentModel());
      
      new Tracker (session, models);
      
      printMsg("Tracker: Complete");
    }
    catch (Throwable x)
      {
	printMsg("Exception caught: "+x);
	x.printStackTrace();
      }
  }

    

  /* Stop method used for application and model program */
  public static void stop ()
  {
    printMsg("Tracker: Stopped");
  }

  /* Prints messages to standard output */
  public static void printMsg(String Msg)
  {
    System.out.println(Msg);
  }

  /* Prints startup message */
  public static void title()
  {
    printMsg("This is the model information tracking program");
    printMsg("Created using J-Link - written in Java 1.1");
    printMsg("Stand by while the program retrieves model information");
  }

}

  
