/*------------------------------------------------------------------------------------ 
Copyright (c)2000 TogetherSoft Corporation. Patents pending. All rights reserved. 
------------------------------------------------------------------------------------*/ 

package com.togethersoft.modules.xmleditor;

import com.togethersoft.openapi.ide.*;
import com.togethersoft.openapi.ide.command.*;
import com.togethersoft.openapi.ide.project.*;
import com.togethersoft.openapi.ide.message.*;
import com.togethersoft.together.component.ide.license.*;

import com.togethersoft.modules.xmleditor.utils.*;
                                                     
/**
 * @author TogetherSoft
 */
public class XMLEditorScript implements IdeScript, IdeStartup
{
  public void run (IdeContext ideContext)
  {                
    try
    {
      XMLEditorDialog editorDialog = new XMLEditorDialog();
      editorDialog.show();
    }
    catch (Throwable e)
    {
      DebugTools.showException (null, e);
      System.out.println(e.getMessage());
    }
  }

  //--------------------------------------------------------------------
  public void autorun() 
  {
    IdeCommandConstraints constraints = new IdeCommandConstraints("parent = _ejbGroup, placeAfter = _ejbDeploy");
    IdeCommandItem item = IdeCommandManagerAccess.getCommandManager().createItem("_xmlEditor", constraints, 
           new IdeCommandListener() 
           {
             public void actionPerformed(IdeCommandEvent event) 
             {
               run (event.getElementContext());
             }
             
             public void checkStatus(IdeCommandEvent event) {}
           });         
    
    item.setText ("XML Editor...");
  }
  
}

