Ejemplo n.º 1
0
		public virtual void ActionPerformed(ActionEvent e)
		{
			string cmd = e.GetActionCommand();
			string plaf_name = null;
			if (cmd.Equals("Load"))
			{
				string f = ChooseFile();
				if (f != null)
				{
					f = f.Replace('\\', '/');
					consoleTextArea.Eval("load(\"" + f + "\");");
				}
			}
			else
			{
				if (cmd.Equals("Exit"))
				{
					System.Environment.Exit(0);
				}
				else
				{
					if (cmd.Equals("Cut"))
					{
						consoleTextArea.Cut();
					}
					else
					{
						if (cmd.Equals("Copy"))
						{
							consoleTextArea.Copy();
						}
						else
						{
							if (cmd.Equals("Paste"))
							{
								consoleTextArea.Paste();
							}
							else
							{
								if (cmd.Equals("Metal"))
								{
									plaf_name = "javax.swing.plaf.metal.MetalLookAndFeel";
								}
								else
								{
									if (cmd.Equals("Windows"))
									{
										plaf_name = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
									}
									else
									{
										if (cmd.Equals("Motif"))
										{
											plaf_name = "com.sun.java.swing.plaf.motif.MotifLookAndFeel";
										}
									}
								}
								if (plaf_name != null)
								{
									try
									{
										UIManager.SetLookAndFeel(plaf_name);
										SwingUtilities.UpdateComponentTreeUI(this);
										consoleTextArea.PostUpdateUI();
										// updateComponentTreeUI seems to mess up the file
										// chooser dialog, so just create a new one
										CreateFileChooser();
									}
									catch (Exception exc)
									{
										JOptionPane.ShowMessageDialog(this, exc.Message, "Platform", JOptionPane.ERROR_MESSAGE);
									}
								}
							}
						}
					}
				}
			}
		}
Ejemplo n.º 2
0
            public virtual void ActionPerformed(ActionEvent e)
            {
                string com = e.GetActionCommand();

                switch (com)
                {
                case "Open File":
                {
                    File file = this._enclosing.GetFile(true);
                    if (file != null)
                    {
                        this._enclosing.OpenFile(file);
                    }
                    break;
                }

                case "Load URL":
                {
                    string url = this._enclosing.GetURL();
                    if (url != null)
                    {
                        this._enclosing.OpenURL(url);
                    }
                    break;
                }

                case "Exit":
                {
                    this._enclosing.Exit();
                    break;
                }

                case "Clear":
                {
                    this._enclosing.ClearDocument();
                    break;
                }

                case "Load CRF From File":
                {
                    File file = this._enclosing.GetFile(true);
                    if (file != null)
                    {
                        this._enclosing.LoadClassifier(file, true);
                    }
                    break;
                }

                case "Load CMM From File":
                {
                    File file = this._enclosing.GetFile(true);
                    if (file != null)
                    {
                        this._enclosing.LoadClassifier(file, false);
                    }
                    break;
                }

                case "Load Default CRF":
                {
                    this._enclosing.LoadDefaultClassifier(true);
                    break;
                }

                case "Load Default CMM":
                {
                    this._enclosing.LoadDefaultClassifier(false);
                    break;
                }

                case "Extract":
                {
                    this._enclosing.Extract();
                    break;
                }

                case "Save Untagged File":
                {
                    this._enclosing.SaveUntaggedContents(this._enclosing.loadedFile);
                    break;
                }

                case "Save Untagged File As ...":
                {
                    this._enclosing.SaveUntaggedContents(this._enclosing.GetFile(false));
                    break;
                }

                case "Save Tagged File As ...":
                {
                    NERGUI.SaveFile(this._enclosing.GetFile(false), this._enclosing.taggedContents);
                    break;
                }

                default:
                {
                    NERGUI.log.Info("Unknown Action: " + e);
                    break;
                }
                }
            }
Ejemplo n.º 3
0
            public virtual void ActionPerformed(ActionEvent e)
            {
                string com = e.GetActionCommand();

                switch (com)
                {
                case "Open File":
                {
                    File file = this._enclosing.GetFile(true);
                    if (file != null)
                    {
                        this._enclosing.OpenFile(file);
                    }
                    break;
                }

                case "Load URL":
                {
                    string url = this._enclosing.GetURL();
                    if (url != null)
                    {
                        this._enclosing.OpenURL(url);
                    }
                    break;
                }

                case "Exit":
                {
                    NERGUI.Exit();
                    break;
                }

                case "Clear":
                {
                    this._enclosing.ClearDocument();
                    break;
                }

                case "Cut":
                {
                    this._enclosing.CutDocument();
                    break;
                }

                case "Copy":
                {
                    this._enclosing.CopyDocument();
                    break;
                }

                case "Paste":
                {
                    this._enclosing.PasteDocument();
                    break;
                }

                case "Load CRF from File":
                {
                    File file = this._enclosing.GetFile(true);
                    if (file != null)
                    {
                        this._enclosing.LoadClassifier(file);
                    }
                    break;
                }

                case "Load CRF from Classpath":
                {
                    string text = JOptionPane.ShowInputDialog(this._enclosing.frame, "Enter a classpath resource for an NER classifier");
                    if (text != null)
                    {
                        // User didn't click cancel
                        this._enclosing.LoadClassifier(text);
                    }
                    break;
                }

                case "Load Default CRF":
                {
                    this._enclosing.LoadClassifier((File)null);
                    break;
                }

                case "Run NER":
                {
                    this._enclosing.Extract();
                    break;
                }

                case "Save Untagged File":
                {
                    this._enclosing.SaveUntaggedContents(this._enclosing.loadedFile);
                    break;
                }

                case "Save Untagged File As ...":
                {
                    this._enclosing.SaveUntaggedContents(this._enclosing.GetFile(false));
                    break;
                }

                case "Save Tagged File As ...":
                {
                    File f = this._enclosing.GetFile(false);
                    if (f != null)
                    {
                        // i.e., they didn't cancel out of the file dialog
                        NERGUI.SaveFile(f, this._enclosing.taggedContents);
                    }
                    break;
                }

                default:
                {
                    NERGUI.log.Info("Unknown Action: " + e);
                    break;
                }
                }
            }