package osa.attribute.atgrammar.gui.actions;

import java.io.*;

import javax.swing.*;
import javax.swing.filechooser.*;

import javax.swing.AbstractAction;
import java.awt.event.*;

import osa.attribute.atgrammar.grammar.*;
import osa.attribute.atgrammar.grammar.symbols.*;

import osa.attribute.atgrammar.gui.images.*;

import osa.attribute.atgrammar.gui.panels.atgrammar_panels.ATGrammarTabPane;
import osa.attribute.atgrammar.gui.file_choosers.*;

import osa.attribute.atgrammar.xml.*;


/**
 * <p>Title: </p>
 * <p>Description: </p>
 * <p>Copyright: </p>
 * <p>Company: </p>
 * @author not attributable
 * @version
 */

public class LoadGrammarAction
  extends AbstractAction
  {
  public LoadGrammarAction()
    {
    this.putValue(AbstractAction.SMALL_ICON,ImageLoader.loadImage("open.gif"));
    this.putValue(AbstractAction.SHORT_DESCRIPTION,"Загрузить грамматику из XML");
    }

  public void actionPerformed(ActionEvent e)
    {
    JFileChooser project_file_chooser=FileChoosersFactory.getProjectFileChooser();
    project_file_chooser.showSaveDialog(ATGrammarTabPane.getInstance());

    File project_file=project_file_chooser.getSelectedFile();

    XMLParser project_builder=new XMLParser(osa.attribute.atgrammar.grammar.Grammar.);

    System.err.println("------------------------");
    System.err.println("------------------------");
    System.err.println("------------------------");
    project_builder.parseXMLFile(project_file);


    }
  }