FileDocCategorySizeDatePackage
Rose_98_Export.javaAPI DocExample1938Tue Dec 08 01:21:00 GMT 1998oisoft.togetherx.scripts

Rose_98_Export.java

//------------------------------------------------------------------------------
// Copyright (c) 1998 Object International Software GmbH.  All rights reserved.
// Author: Eugene Belyaev
//------------------------------------------------------------------------------

package oisoft.togetherx.scripts;

import oisoft.togetherx.scriptapi.*;
import oisoft.togetherx.scriptapi.UML.*;
import oisoft.togetherx.scriptapi.UML.enums.*;

import oisoft.togetherx.scripts.Rose98Export.*;

/**
 *  Exports current project to Rose 98 model file
 *  @author  Eugene Belyaev
 *  @version 2.1.0
 */
public class Rose_98_Export implements Script, ScriptResources {
	Optioner optioner = new Optioner();
	ModelExporter modelExporter = null;

	/**
	 *  Main extry point for Script API to call the script
	 *  @param manager The Script API manager
	 */
	public void doIt( APIManager manager ) {
		UMLModel myModel = manager.getUMLModel();
		if(myModel!=null) {
			optioner.manager = manager;
			if (myModel.getRootPackage()!=null)
			{
        String outName = manager.getOutputStream( ".mdl" );
        optioner.output_stream = ( outName == null ? null : new java.io.File( outName ));

				if ( optioner.output_stream != null && !optioner.output_stream.isDirectory() )
				{
					modelExporter = new ModelExporter(myModel, optioner);
					// Simple debug statistics
					Reporter.Info("Package count = " + optioner.packageCount);
				}
				else  // Some error catching...
				{
					Reporter.Error("Filename not specified");
					manager.createMessage("Rose98Export error: model filename not specified" );
				}
			} else
			{
				manager.createMessage("Rose98Export error: No model loaded" );
			}
		} else
		{
			Reporter.Error("No model");
		}
	}

	/**
	 *  This method returns the default string for the Tools menu
	 */
	public String getMenuItem()
	{
    return "Rose 98 Export...";
	}
}