1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/src/Tools/isac/jEditC/build/.scala_dependencies Thu Sep 02 21:57:03 2010 +0200
1.3 @@ -0,0 +1,3 @@
1.4 +/usr/local/isac-jedit/src/Tools/isac/jEditC/contrib/jEdit/build/jEdit.jar:/usr/local/isabisac/contrib/jedit-4.3.2/jars/Pure.jar:/usr/local/isabisac/contrib/jedit-4.3.2/jars/cobra.jar:/usr/local/isabisac/contrib/jedit-4.3.2/jars/js.jar:/usr/local/isabisac/contrib/jedit-4.3.2/jars/ErrorList.jar:/usr/local/isabisac/contrib/jedit-4.3.2/jars/Hyperlinks.jar:/usr/local/isabisac/contrib/jedit-4.3.2/jars/SideKick.jar:/usr/local/isabisac/contrib/jedit-4.3.2/jars/Console.jar:/usr/local/isabisac/contrib/jedit-4.3.2/jars/scala-compiler.jar:/usr/share/scala-2.8.0.final/lib/jline.jar:/usr/share/scala-2.8.0.final/lib/scala-compiler.jar:/usr/share/scala-2.8.0.final/lib/scala-dbc.jar:/usr/share/scala-2.8.0.final/lib/scala-library.jar:/usr/share/scala-2.8.0.final/lib/scala-swing.jar:/usr/share/scala-2.8.0.final/lib/scalap.jar:/usr/local/isac-jedit/src/Tools/isac/jEditC/build/classes
1.5 +-------
1.6 +-------
2.1 --- a/src/Tools/isac/jEditC/nbproject/private/private.xml Tue Aug 31 21:15:03 2010 +0200
2.2 +++ b/src/Tools/isac/jEditC/nbproject/private/private.xml Thu Sep 02 21:57:03 2010 +0200
2.3 @@ -1,9 +1,4 @@
2.4 <?xml version="1.0" encoding="UTF-8"?>
2.5 <project-private xmlns="http://www.netbeans.org/ns/project-private/1">
2.6 <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
2.7 - <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
2.8 - <file>file:/usr/local/isac-jedit/src/Tools/isac/jEditC/build.xml</file>
2.9 - <file>file:/usr/local/isac-jedit/src/Tools/isac/jEditC/src/jedit/IsacPlugin.java</file>
2.10 - <file>file:/usr/local/isac-jedit/src/Tools/isac/jEditC/src/jedit/Isac.java</file>
2.11 - </open-files>
2.12 </project-private>
3.1 --- a/src/Tools/isac/jEditC/src/jedit/Isac.java Tue Aug 31 21:15:03 2010 +0200
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,245 +0,0 @@
3.4 -/*
3.5 - * Isac.java
3.6 - * part of the Isac plugin for the jEdit text editor
3.7 - * Copyright (C) 2001 John Gellene
3.8 - * jgellene@nyc.rr.com
3.9 - *
3.10 - * This program is free software; you can redistribute it and/or
3.11 - * modify it under the terms of the GNU General Public License
3.12 - * as published by the Free Software Foundation; either version 2
3.13 - * of the License, or any later version.
3.14 - *
3.15 - * This program is distributed in the hope that it will be useful,
3.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
3.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3.18 - * GNU General Public License for more details.
3.19 - *
3.20 - * You should have received a copy of the GNU General Public License
3.21 - * along with this program; if not, write to the Free Software
3.22 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
3.23 - *
3.24 - * $Id: Isac.java 12504 2008-04-22 23:12:43Z ezust $
3.25 - */
3.26 -
3.27 -// {{{ imports
3.28 -import java.awt.BorderLayout;
3.29 -import java.awt.Dimension;
3.30 -import java.awt.Font;
3.31 -import java.io.BufferedReader;
3.32 -import java.io.File;
3.33 -import java.io.FileNotFoundException;
3.34 -import java.io.FileReader;
3.35 -import java.io.FileWriter;
3.36 -import java.io.IOException;
3.37 -
3.38 -import javax.swing.JFileChooser;
3.39 -import javax.swing.JPanel;
3.40 -import javax.swing.JScrollPane;
3.41 -
3.42 -import org.gjt.sp.jedit.EBComponent;
3.43 -import org.gjt.sp.jedit.EBMessage;
3.44 -import org.gjt.sp.jedit.EditBus;
3.45 -import org.gjt.sp.jedit.GUIUtilities;
3.46 -import org.gjt.sp.jedit.View;
3.47 -import org.gjt.sp.jedit.jEdit;
3.48 -import org.gjt.sp.jedit.gui.DefaultFocusComponent;
3.49 -import org.gjt.sp.jedit.gui.DockableWindowManager;
3.50 -import org.gjt.sp.jedit.msg.PropertiesChanged;
3.51 -import org.gjt.sp.util.Log;
3.52 -import org.gjt.sp.util.StandardUtilities;
3.53 -// }}}
3.54 -
3.55 -// {{{ Isac class
3.56 -/**
3.57 - *
3.58 - * Isac - a dockable JPanel, a demonstration of a jEdit plugin.
3.59 - *
3.60 - */
3.61 -public class Isac extends JPanel
3.62 - implements EBComponent, IsacActions, DefaultFocusComponent {
3.63 -
3.64 - // {{{ Instance Variables
3.65 - private static final long serialVersionUID = 6412255692894321789L;
3.66 -
3.67 - private String filename;
3.68 -
3.69 - private String defaultFilename;
3.70 -
3.71 - private View view;
3.72 -
3.73 - private boolean floating;
3.74 -
3.75 - private IsacTextArea textArea;
3.76 -
3.77 - private IsacToolPanel toolPanel;
3.78 - // }}}
3.79 -
3.80 - // {{{ Constructor
3.81 - /**
3.82 - *
3.83 - * @param view the current jedit window
3.84 - * @param position a variable passed in from the script in actions.xml,
3.85 - * which can be DockableWindowManager.FLOATING, TOP, BOTTOM, LEFT, RIGHT, etc.
3.86 - * see @ref DockableWindowManager for possible values.
3.87 - */
3.88 - public Isac(View view, String position) {
3.89 - super(new BorderLayout());
3.90 - this.view = view;
3.91 - this.floating = position.equals(DockableWindowManager.FLOATING);
3.92 -
3.93 - if (jEdit.getSettingsDirectory() != null) {
3.94 - this.filename = jEdit.getProperty(IsacPlugin.OPTION_PREFIX
3.95 - + "filepath");
3.96 - if (this.filename == null || this.filename.length() == 0) {
3.97 - this.filename = new String(jEdit.getSettingsDirectory()
3.98 - + File.separator + "qn.txt");
3.99 - jEdit.setProperty(
3.100 - IsacPlugin.OPTION_PREFIX + "filepath",
3.101 - this.filename);
3.102 - }
3.103 - this.defaultFilename = this.filename;
3.104 - }
3.105 -
3.106 - this.toolPanel = new IsacToolPanel(this);
3.107 - add(BorderLayout.NORTH, this.toolPanel);
3.108 -
3.109 - if (floating)
3.110 - this.setPreferredSize(new Dimension(500, 250));
3.111 -
3.112 - textArea = new IsacTextArea();
3.113 - textArea.setFont(IsacOptionPane.makeFont());
3.114 -
3.115 - JScrollPane pane = new JScrollPane(textArea);
3.116 - add(BorderLayout.CENTER, pane);
3.117 -
3.118 - readFile();
3.119 - }
3.120 - // }}}
3.121 -
3.122 - // {{{ Member Functions
3.123 -
3.124 - // {{{ focusOnDefaultComponent
3.125 - public void focusOnDefaultComponent() {
3.126 - textArea.requestFocus();
3.127 - }
3.128 - // }}}
3.129 -
3.130 - // {{{ getFileName
3.131 - public String getFilename() {
3.132 - return filename;
3.133 - }
3.134 - // }}}
3.135 -
3.136 - // EBComponent implementation
3.137 -
3.138 - // {{{ handleMessage
3.139 - public void handleMessage(EBMessage message) {
3.140 - if (message instanceof PropertiesChanged) {
3.141 - propertiesChanged();
3.142 - }
3.143 - }
3.144 - // }}}
3.145 -
3.146 - // {{{ propertiesChanged
3.147 - private void propertiesChanged() {
3.148 - String propertyFilename = jEdit
3.149 - .getProperty(IsacPlugin.OPTION_PREFIX + "filepath");
3.150 - if (!StandardUtilities.objectsEqual(defaultFilename, propertyFilename)) {
3.151 - saveFile();
3.152 - toolPanel.propertiesChanged();
3.153 - defaultFilename = propertyFilename;
3.154 - filename = defaultFilename;
3.155 - readFile();
3.156 - }
3.157 - Font newFont = IsacOptionPane.makeFont();
3.158 - if (!newFont.equals(textArea.getFont())) {
3.159 - textArea.setFont(newFont);
3.160 - }
3.161 - }
3.162 - // }}}
3.163 -
3.164 - // These JComponent methods provide the appropriate points
3.165 - // to subscribe and unsubscribe this object to the EditBus.
3.166 -
3.167 - // {{{ addNotify
3.168 - public void addNotify() {
3.169 - super.addNotify();
3.170 - EditBus.addToBus(this);
3.171 - }
3.172 - // }}}
3.173 -
3.174 - // {{{ removeNotify
3.175 - public void removeNotify() {
3.176 - saveFile();
3.177 - super.removeNotify();
3.178 - EditBus.removeFromBus(this);
3.179 - }
3.180 - // }}}
3.181 -
3.182 - // IsacActions implementation
3.183 -
3.184 - // {{{
3.185 - public void saveFile() {
3.186 - if (filename == null || filename.length() == 0)
3.187 - return;
3.188 - try {
3.189 - FileWriter out = new FileWriter(filename);
3.190 - out.write(textArea.getText());
3.191 - out.close();
3.192 - } catch (IOException ioe) {
3.193 - Log.log(Log.ERROR, Isac.class,
3.194 - "Could not write notepad text to " + filename);
3.195 - }
3.196 - }
3.197 - // }}}
3.198 -
3.199 - // {{{ chooseFile
3.200 - public void chooseFile() {
3.201 - String[] paths = GUIUtilities.showVFSFileDialog(view, null,
3.202 - JFileChooser.OPEN_DIALOG, false);
3.203 - if (paths != null && !paths[0].equals(filename)) {
3.204 - saveFile();
3.205 - filename = paths[0];
3.206 - toolPanel.propertiesChanged();
3.207 - readFile();
3.208 - }
3.209 - }
3.210 - // }}}
3.211 -
3.212 - // {{{ copyToBuffer
3.213 - public void copyToBuffer() {
3.214 - jEdit.newFile(view);
3.215 - //GAdei Test view.getEditPane().getTextArea().setText(textArea.getText());
3.216 - view.getEditPane().getTextArea().setText("New Project: Gadei the king! LOOOOOOOOL");
3.217 - }
3.218 - // }}}
3.219 - // {{{ readFile()
3.220 - /**
3.221 - * Helper method
3.222 - */
3.223 - private void readFile() {
3.224 - if (filename == null || filename.length() == 0)
3.225 - return;
3.226 -
3.227 - BufferedReader bf = null;
3.228 - try {
3.229 - bf = new BufferedReader(new FileReader(filename));
3.230 - StringBuffer sb = new StringBuffer(2048);
3.231 - String str;
3.232 - while ((str = bf.readLine()) != null) {
3.233 - sb.append(str).append('\n');
3.234 - }
3.235 - bf.close();
3.236 - textArea.setText(sb.toString());
3.237 - } catch (FileNotFoundException fnf) {
3.238 - Log.log(Log.ERROR, Isac.class, "notepad file " + filename
3.239 - + " does not exist");
3.240 - } catch (IOException ioe) {
3.241 - Log.log(Log.ERROR, Isac.class,
3.242 - "could not read notepad file " + filename);
3.243 - }
3.244 - }
3.245 - // }}}
3.246 - // }}}
3.247 -}
3.248 -// }}}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/src/Tools/isac/jEditC/src/jedit/Isac.scala Thu Sep 02 21:57:03 2010 +0200
4.3 @@ -0,0 +1,207 @@
4.4 +/*
4.5 + * Isac.java
4.6 + * gadei
4.7 + */
4.8 +
4.9 +package isac.jedit
4.10 +
4.11 +
4.12 +// {{{ imports
4.13 +import java.awt.BorderLayout;
4.14 +import java.awt.Dimension;
4.15 +import java.awt.Font;
4.16 +import java.io.BufferedReader;
4.17 +import java.io.File;
4.18 +import java.io.FileNotFoundException;
4.19 +import java.io.FileReader;
4.20 +import java.io.FileWriter;
4.21 +import java.io.IOException;
4.22 +
4.23 +import javax.swing.JFileChooser;
4.24 +import javax.swing.JPanel;
4.25 +import javax.swing.JScrollPane;
4.26 +
4.27 +import org.gjt.sp.jedit.EBComponent;
4.28 +import org.gjt.sp.jedit.EBMessage;
4.29 +import org.gjt.sp.jedit.EditBus;
4.30 +import org.gjt.sp.jedit.GUIUtilities;
4.31 +import org.gjt.sp.jedit.View;
4.32 +import org.gjt.sp.jedit.jEdit;
4.33 +import org.gjt.sp.jedit.gui.DefaultFocusComponent;
4.34 +import org.gjt.sp.jedit.gui.DockableWindowManager;
4.35 +import org.gjt.sp.jedit.msg.PropertiesChanged;
4.36 +import org.gjt.sp.util.Log;
4.37 +import org.gjt.sp.util.StandardUtilities;
4.38 +// }}}
4.39 +
4.40 +// {{{ Isac class
4.41 +/**
4.42 + *
4.43 + * Isac - a dockable JPanel, a demonstration of a jEdit plugin.
4.44 + *
4.45 + */
4.46 +
4.47 +class Isac(view: View, position: String) extends JPanel(new BorderLayout)
4.48 +{
4.49 + private final val serialVersionUID = 6412255692894321789L
4.50 +
4.51 + var filename: String
4.52 +
4.53 + var defaultFilename: String
4.54 +
4.55 + var floating= position.equals(DockableWindowManager.FLOATING): Boolean
4.56 +
4.57 + var textArea: IsacTextArea
4.58 +
4.59 + var toolPanel: IsacToolPanel
4.60 +
4.61 + if (jEdit.getSettingsDirectory() != null) {
4.62 + filename = jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "filepath")
4.63 +
4.64 + if (this.filename == null || this.filename.length() == 0) {
4.65 + this.filename = new String(jEdit.getSettingsDirectory()
4.66 + + File.separator + "qn.txt")
4.67 +
4.68 + jEdit.setProperty(
4.69 + IsacPlugin.OPTION_PREFIX + "filepath",
4.70 + this.filename)
4.71 +
4.72 + }
4.73 + this.defaultFilename = this.filename
4.74 + }
4.75 +
4.76 + this.toolPanel = new IsacToolPanel(this)
4.77 + add(BorderLayout.NORTH, this.toolPanel)
4.78 +
4.79 + if (floating)
4.80 + this.setPreferredSize(new Dimension(500, 250))
4.81 +
4.82 + textArea = new IsacTextArea()
4.83 + textArea.setFont(IsacOptionPane.makeFont())
4.84 +
4.85 + val pane = new JScrollPane(textArea)
4.86 + add(BorderLayout.CENTER, pane)
4.87 +
4.88 + this.readFile()
4.89 +
4.90 +
4.91 +// {{{ Member Functions
4.92 +
4.93 +// {{{ focusOnDefaultComponent
4.94 + override def focusOnDefaultComponent() {
4.95 + textArea.requestFocus()
4.96 + }
4.97 +// }}}
4.98 +
4.99 +// {{{ getFileName
4.100 + override def getFilename(): String {
4.101 + val str = "filename": String
4.102 + }
4.103 +// }}}
4.104 +
4.105 + // EBComponent implementation
4.106 +
4.107 +// {{{ handleMessage
4.108 + override def handleMessage(message: EBMessage) {
4.109 + if (message.instanceof PropertiesChanged) {
4.110 + propertiesChanged();
4.111 + }
4.112 + }
4.113 +// }}}
4.114 +
4.115 +// {{{ propertiesChanged
4.116 + private def propertiesChanged() {
4.117 + val propertyFilename = jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "filepath");
4.118 + if (!StandardUtilities.objectsEqual(defaultFilename, propertyFilename)) {
4.119 + saveFile()
4.120 + toolPanel.propertiesChanged()
4.121 + defaultFilename = propertyFilename
4.122 + filename = defaultFilename
4.123 + readFile()
4.124 + }
4.125 + val newFont = IsacOptionPane.makeFont(): Font
4.126 + if (!newFont.equals(textArea.getFont())) {
4.127 + textArea.setFont(newFont);
4.128 + }
4.129 + }
4.130 +// }}}
4.131 +
4.132 + // These JComponent methods provide the appropriate points
4.133 + // to subscribe and unsubscribe this object to the EditBus.
4.134 +
4.135 +// {{{ addNotify
4.136 + override def addNotify() {
4.137 + super.addNotify()
4.138 + EditBus.addToBus(this)
4.139 + }
4.140 + // }}}
4.141 +
4.142 + override def saveFile() {
4.143 + if (filename == null || filename.length() == 0) {
4.144 +
4.145 + }
4.146 + else
4.147 + {
4.148 + val out = new FileWriter(filename)
4.149 + out.write(textArea.getText())
4.150 + out.close()
4.151 + }
4.152 + }
4.153 +
4.154 +// {{{ removeNotify
4.155 + override def removeNotify() {
4.156 + saveFile()
4.157 + super.removeNotify()
4.158 + EditBus.removeFromBus(this)
4.159 + }
4.160 +// }}}
4.161 +
4.162 +
4.163 +// {{{ chooseFile
4.164 + override def chooseFile() {
4.165 + val paths = GUIUtilities.showVFSFileDialog(view, null,
4.166 + JFileChooser.OPEN_DIALOG, false);
4.167 + if (paths != null && !paths(0).equals(filename)) {
4.168 + saveFile();
4.169 + filename = paths(0);
4.170 + toolPanel.propertiesChanged();
4.171 + readFile();
4.172 + }
4.173 + }
4.174 + // }}}
4.175 +
4.176 + // {{{ copyToBuffer
4.177 + override def copyToBuffer() {
4.178 + jEdit.newFile(view)
4.179 + //GAdei Test view.getEditPane().getTextArea().setText(textArea.getText());
4.180 + view.getEditPane().getTextArea().setText("New Project: Gadei the king! BIIIIIG LOOOOOOOOL")
4.181 + }
4.182 + // }}}
4.183 + // {{{ readFile()
4.184 + /**
4.185 + * Helper method
4.186 + */
4.187 + override def readFile() {
4.188 + if (filename == null || filename.length() == 0)
4.189 + {
4.190 +
4.191 + }
4.192 + else
4.193 + {
4.194 + var bf = null: BufferedReader
4.195 +
4.196 + bf = new BufferedReader(new FileReader(filename));
4.197 + val sb = new StringBuffer(2048);
4.198 + var str="": String;
4.199 + while ((str = bf.readLine()) != null) {
4.200 + sb.append(str).append('\n');
4.201 + }
4.202 + bf.close();
4.203 + textArea.setText(sb.toString());
4.204 +
4.205 + }
4.206 +
4.207 + }
4.208 +
4.209 +}
4.210 +// }}}
5.1 --- a/src/Tools/isac/jEditC/src/jedit/IsacActions.java Tue Aug 31 21:15:03 2010 +0200
5.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
5.3 @@ -1,30 +0,0 @@
5.4 -/*
5.5 - * IsacActions.java
5.6 - * part of the Isac plugin for the jEdit text editor
5.7 - * Copyright Gadei
5.8 - * jgellene@nyc.rr.com
5.9 - *
5.10 - * This program is free software; you can redistribute it and/or
5.11 - * modify it under the terms of the GNU General Public License
5.12 - * as published by the Free Software Foundation; either version 2
5.13 - * of the License, or any later version.
5.14 - *
5.15 - * This program is distributed in the hope that it will be useful,
5.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
5.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5.18 - * GNU General Public License for more details.
5.19 - *
5.20 - * You should have received a copy of the GNU General Public License
5.21 - * along with this program; if not, write to the Free Software
5.22 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
5.23 - *
5.24 - * $Id: IsacActions.java 12504 2008-04-22 23:12:43Z ezust $
5.25 - */
5.26 -
5.27 -interface IsacActions {
5.28 - void chooseFile();
5.29 -
5.30 - void saveFile();
5.31 -
5.32 - void copyToBuffer();
5.33 -}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/src/Tools/isac/jEditC/src/jedit/IsacActions.scala Thu Sep 02 21:57:03 2010 +0200
6.3 @@ -0,0 +1,15 @@
6.4 +/*
6.5 + * IsacActions.java
6.6 + * gadei
6.7 + */
6.8 +
6.9 +package isac.jedit
6.10 +
6.11 +
6.12 +trait IsacActions {
6.13 + void chooseFile();
6.14 +
6.15 + void saveFile();
6.16 +
6.17 + void copyToBuffer();
6.18 +}
7.1 --- a/src/Tools/isac/jEditC/src/jedit/IsacOptionPane.java Tue Aug 31 21:15:03 2010 +0200
7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
7.3 @@ -1,127 +0,0 @@
7.4 -/*
7.5 - * IsacOptionPane.java
7.6 - * part of the Isac plugin for the jEdit text editor
7.7 - * Copyright (C) 2001 John Gellene
7.8 - * jgellene@nyc.rr.com
7.9 - *
7.10 - * This program is free software; you can redistribute it and/or
7.11 - * modify it under the terms of the GNU General Public License
7.12 - * as published by the Free Software Foundation; either version 2
7.13 - * of the License, or any later version.
7.14 - *
7.15 - * This program is distributed in the hope that it will be useful,
7.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
7.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7.18 - * GNU General Public License for more details.
7.19 - *
7.20 - * You should have received a copy of the GNU General Public License
7.21 - * along with this program; if not, write to the Free Software
7.22 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
7.23 - *
7.24 - * $Id: IsacOptionPane.java 12504 2008-04-22 23:12:43Z ezust $
7.25 - */
7.26 -
7.27 -import java.awt.BorderLayout;
7.28 -import java.awt.Font;
7.29 -import java.awt.event.ActionEvent;
7.30 -import java.awt.event.ActionListener;
7.31 -
7.32 -import javax.swing.JButton;
7.33 -import javax.swing.JCheckBox;
7.34 -import javax.swing.JFileChooser;
7.35 -import javax.swing.JPanel;
7.36 -import javax.swing.JTextField;
7.37 -
7.38 -import org.gjt.sp.jedit.AbstractOptionPane;
7.39 -import org.gjt.sp.jedit.GUIUtilities;
7.40 -import org.gjt.sp.jedit.jEdit;
7.41 -import org.gjt.sp.jedit.gui.FontSelector;
7.42 -
7.43 -public class IsacOptionPane extends AbstractOptionPane implements
7.44 - ActionListener {
7.45 - private JCheckBox showPath;
7.46 -
7.47 - private JTextField pathName;
7.48 -
7.49 - private FontSelector font;
7.50 -
7.51 - public IsacOptionPane() {
7.52 - super(IsacPlugin.NAME);
7.53 - }
7.54 -
7.55 - public void _init() {
7.56 - showPath = new JCheckBox(jEdit
7.57 - .getProperty(IsacPlugin.OPTION_PREFIX
7.58 - + "show-filepath.title"), jEdit.getProperty(
7.59 - IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
7.60 - "true"));
7.61 - addComponent(showPath);
7.62 -
7.63 - pathName = new JTextField(jEdit
7.64 - .getProperty(IsacPlugin.OPTION_PREFIX + "filepath"));
7.65 - JButton pickPath = new JButton(jEdit
7.66 - .getProperty(IsacPlugin.OPTION_PREFIX + "choose-file"));
7.67 - pickPath.addActionListener(this);
7.68 -
7.69 - JPanel pathPanel = new JPanel(new BorderLayout(0, 0));
7.70 - pathPanel.add(pathName, BorderLayout.CENTER);
7.71 - pathPanel.add(pickPath, BorderLayout.EAST);
7.72 -
7.73 - addComponent(jEdit.getProperty(IsacPlugin.OPTION_PREFIX
7.74 - + "file"), pathPanel);
7.75 -
7.76 - font = new FontSelector(makeFont());
7.77 - addComponent(jEdit.getProperty(IsacPlugin.OPTION_PREFIX
7.78 - + "choose-font"), font);
7.79 - }
7.80 -
7.81 - public void _save() {
7.82 - jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "filepath",
7.83 - pathName.getText());
7.84 - Font _font = font.getFont();
7.85 - jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "font", _font
7.86 - .getFamily());
7.87 - jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "fontsize", String
7.88 - .valueOf(_font.getSize()));
7.89 - jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "fontstyle",
7.90 - String.valueOf(_font.getStyle()));
7.91 - jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "show-filepath",
7.92 - String.valueOf(showPath.isSelected()));
7.93 - }
7.94 -
7.95 - // end AbstractOptionPane implementation
7.96 -
7.97 - // begin ActionListener implementation
7.98 - public void actionPerformed(ActionEvent evt) {
7.99 - String[] paths = GUIUtilities.showVFSFileDialog(null, null,
7.100 - JFileChooser.OPEN_DIALOG, false);
7.101 - if (paths != null) {
7.102 - pathName.setText(paths[0]);
7.103 - }
7.104 - }
7.105 -
7.106 - // helper method to get Font from plugin properties
7.107 - static public Font makeFont() {
7.108 - int style, size;
7.109 - String family = jEdit.getProperty(IsacPlugin.OPTION_PREFIX
7.110 - + "font");
7.111 - try {
7.112 - size = Integer
7.113 - .parseInt(jEdit
7.114 - .getProperty(IsacPlugin.OPTION_PREFIX
7.115 - + "fontsize"));
7.116 - } catch (NumberFormatException nf) {
7.117 - size = 14;
7.118 - }
7.119 - try {
7.120 - style = Integer
7.121 - .parseInt(jEdit
7.122 - .getProperty(IsacPlugin.OPTION_PREFIX
7.123 - + "fontstyle"));
7.124 - } catch (NumberFormatException nf) {
7.125 - style = Font.PLAIN;
7.126 - }
7.127 - return new Font(family, style, size);
7.128 - }
7.129 -
7.130 -}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/src/Tools/isac/jEditC/src/jedit/IsacOptionPane.scala Thu Sep 02 21:57:03 2010 +0200
8.3 @@ -0,0 +1,86 @@
8.4 +/*
8.5 + * IsacOptionPane.java
8.6 + * gadei
8.7 + */
8.8 +
8.9 +package isac.jedit
8.10 +
8.11 +
8.12 +
8.13 +import java.awt.BorderLayout;
8.14 +import java.awt.Font;
8.15 +import java.awt.event.ActionEvent;
8.16 +import java.awt.event.ActionListener;
8.17 +
8.18 +import javax.swing.JButton;
8.19 +import javax.swing.JCheckBox;
8.20 +import javax.swing.JFileChooser;
8.21 +import javax.swing.JPanel;
8.22 +import javax.swing.JTextField;
8.23 +
8.24 +import org.gjt.sp.jedit.AbstractOptionPane;
8.25 +import org.gjt.sp.jedit.GUIUtilities;
8.26 +import org.gjt.sp.jedit.jEdit;
8.27 +import org.gjt.sp.jedit.gui.FontSelector;
8.28 +
8.29 +class IsacOptionPane extends AbstractOptionPane("isac"){
8.30 +
8.31 + private var showPath = new JCheckBox()
8.32 +
8.33 + private var pathName = new JTextField()
8.34 +
8.35 + val font: FontSelector
8.36 +
8.37 +
8.38 + override def _init() {
8.39 + showPath = new JCheckBox(jEdit.getProperty(IsacPlugin.OPTION_PREFIX
8.40 + + "show-filepath.title"), jEdit.getProperty(
8.41 + IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
8.42 + "true"))
8.43 + addComponent(showPath)
8.44 +
8.45 + pathName = new JTextField(jEdit
8.46 + .getProperty(IsacPlugin.OPTION_PREFIX + "filepath"))
8.47 +
8.48 + val pickPath = new JButton(jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "choose-file"))
8.49 +
8.50 + pickPath.addActionListener(this)
8.51 +
8.52 + val pathPanel = new JPanel(new BorderLayout(0, 0))
8.53 + pathPanel.add(pathName, BorderLayout.CENTER)
8.54 + pathPanel.add(pickPath, BorderLayout.EAST)
8.55 +
8.56 + addComponent(jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "file"), pathPanel)
8.57 +
8.58 + this.font = new FontSelector(makeFont())
8.59 + addComponent(jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "choose-font"), font)
8.60 + }
8.61 +
8.62 + override def _save() {
8.63 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "filepath",
8.64 + pathName.getText())
8.65 + val _font = font.getFont()
8.66 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "font", _font
8.67 + .getFamily())
8.68 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "fontsize", String
8.69 + .valueOf(_font.getSize()))
8.70 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "fontstyle",
8.71 + String.valueOf(_font.getStyle()))
8.72 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "show-filepath",
8.73 + String.valueOf(showPath.isSelected()))
8.74 + }
8.75 +
8.76 + // end AbstractOptionPane implementation
8.77 +
8.78 +
8.79 + // helper method to get Font from plugin properties
8.80 + def makeFont(): Font ={
8.81 + var style = Integer.parseInt(jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "fontstyle"))
8.82 + var size = Integer.parseInt(jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "fontsize"))
8.83 + val family = jEdit.getProperty(IsacPlugin.OPTION_PREFIX
8.84 + + "font"): String
8.85 + //size = Integer.parseInt(jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "fontsize"));#
8.86 + //style = Integer.parseInt(jEdit.getProperty(IsacPlugin.OPTION_PREFIX + "fontstyle"));
8.87 + val ff = new Font(family, style, size)
8.88 + }
8.89 +}
9.1 --- a/src/Tools/isac/jEditC/src/jedit/IsacPlugin.java Tue Aug 31 21:15:03 2010 +0200
9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
9.3 @@ -1,34 +0,0 @@
9.4 -/*
9.5 - * IsacPlugin.java
9.6 - * part of the Isac plugin for the jEdit text editor
9.7 - * Copyright (C) 2001 John Gellene
9.8 - * jgellene@nyc.rr.com
9.9 - *
9.10 - * This program is free software; you can redistribute it and/or
9.11 - * modify it under the terms of the GNU General Public License
9.12 - * as published by the Free Software Foundation; either version 2
9.13 - * of the License, or any later version.
9.14 - *
9.15 - * This program is distributed in the hope that it will be useful,
9.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
9.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9.18 - * GNU General Public License for more details.
9.19 - *
9.20 - * You should have received a copy of the GNU General Public License
9.21 - * along with this program; if not, write to the Free Software
9.22 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
9.23 - *
9.24 - * $Id: IsacPlugin.java 12504 2008-04-22 23:12:43Z ezust $
9.25 - */
9.26 -
9.27 -import org.gjt.sp.jedit.EditPlugin;
9.28 -
9.29 -/**
9.30 - * The Isac plugin
9.31 - *
9.32 - * @author gadei
9.33 - */
9.34 -public class IsacPlugin extends EditPlugin {
9.35 - public static final String NAME = "isac";
9.36 - public static final String OPTION_PREFIX = "options.isac.";
9.37 -}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/src/Tools/isac/jEditC/src/jedit/IsacPlugin.scala Thu Sep 02 21:57:03 2010 +0200
10.3 @@ -0,0 +1,22 @@
10.4 +/*
10.5 + * IsacPlugin.java
10.6 + * gadei
10.7 + */
10.8 +
10.9 +package isac.jedit
10.10 +
10.11 +import org.gjt.sp.jedit.EditPlugin;
10.12 +
10.13 +/**
10.14 + * The Isac plugin
10.15 + *
10.16 + * @author gadei
10.17 + */
10.18 +class IsacPlugin extends EditPlugin {
10.19 + val NAME = "isac"
10.20 + private val OPTION_PREFIX = "options.isac."
10.21 +
10.22 + def getOptionPrefix(): String{
10.23 + OPTION_PREFIX
10.24 + }
10.25 +}
11.1 --- a/src/Tools/isac/jEditC/src/jedit/IsacTextArea.java Tue Aug 31 21:15:03 2010 +0200
11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
11.3 @@ -1,34 +0,0 @@
11.4 -/*
11.5 - * IsacTextArea.java
11.6 - * part of the Isac plugin for the jEditTextArea
11.7 - * Gadei
11.8 - *
11.9 - * jgellene@nyc.rr.com
11.10 - *
11.11 - * This program is free software; you can redistribute it and/or
11.12 - * modify it under the terms of the GNU General Public License
11.13 - * as published by the Free Software Foundation; either version 2
11.14 - * of the License, or any later version.
11.15 - *
11.16 - * This program is distributed in the hope that it will be useful,
11.17 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
11.18 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11.19 - * GNU General Public License for more details.
11.20 - *
11.21 - * You should have received a copy of the GNU General Public License
11.22 - * along with this program; if not, write to the Free Software
11.23 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
11.24 - *
11.25 - * $Id: IsacTextArea.java 12504 2008-04-22 23:12:43Z ezust $
11.26 - */
11.27 -
11.28 -import javax.swing.JTextArea;
11.29 -
11.30 -public class IsacTextArea extends JTextArea {
11.31 - public IsacTextArea() {
11.32 - super();
11.33 - setLineWrap(true);
11.34 - setWrapStyleWord(true);
11.35 - setTabSize(4);
11.36 - }
11.37 -}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/src/Tools/isac/jEditC/src/jedit/IsacTextArea.scala Thu Sep 02 21:57:03 2010 +0200
12.3 @@ -0,0 +1,16 @@
12.4 +/*
12.5 + * IsacTextArea.java
12.6 + * gadei
12.7 + */
12.8 +
12.9 +package isac.jedit
12.10 +
12.11 +
12.12 +import javax.swing.JTextArea;
12.13 +
12.14 +class IsacTextArea extends JTextArea {
12.15 +
12.16 + setLineWrap(true)
12.17 + setWrapStyleWord(true)
12.18 + setTabSize(4)
12.19 +}
13.1 --- a/src/Tools/isac/jEditC/src/jedit/IsacToolPanel.java Tue Aug 31 21:15:03 2010 +0200
13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
13.3 @@ -1,100 +0,0 @@
13.4 -/*
13.5 - * IsacToolPanel.java
13.6 - * part of the Isac plugin for the jEdit text editor
13.7 - * Copyright Gadei
13.8 - * jgellene@nyc.rr.com
13.9 - *
13.10 - * This program is free software; you can redistribute it and/or
13.11 - * modify it under the terms of the GNU General Public License
13.12 - * as published by the Free Software Foundation; either version 2
13.13 - * of the License, or any later version.
13.14 - *
13.15 - * This program is distributed in the hope that it will be useful,
13.16 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
13.17 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13.18 - * GNU General Public License for more details.
13.19 - *
13.20 - * You should have received a copy of the GNU General Public License
13.21 - * along with this program; if not, write to the Free Software
13.22 - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
13.23 - *
13.24 - * $Id: IsacToolPanel.java 12504 2008-04-22 23:12:43Z ezust $
13.25 - */
13.26 -
13.27 -import java.awt.event.ActionEvent;
13.28 -import java.awt.event.ActionListener;
13.29 -
13.30 -import javax.swing.AbstractButton;
13.31 -import javax.swing.Box;
13.32 -import javax.swing.BoxLayout;
13.33 -import javax.swing.JLabel;
13.34 -import javax.swing.JPanel;
13.35 -
13.36 -import org.gjt.sp.jedit.GUIUtilities;
13.37 -import org.gjt.sp.jedit.jEdit;
13.38 -import org.gjt.sp.jedit.gui.RolloverButton;
13.39 -
13.40 -public class IsacToolPanel extends JPanel {
13.41 - private Isac pad;
13.42 -
13.43 - private JLabel label;
13.44 -
13.45 - public IsacToolPanel(Isac qnpad) {
13.46 - setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
13.47 - pad = qnpad;
13.48 -
13.49 - Box labelBox = new Box(BoxLayout.Y_AXIS);
13.50 - labelBox.add(Box.createGlue());
13.51 -
13.52 - label = new JLabel(pad.getFilename());
13.53 - label.setVisible(jEdit.getProperty(
13.54 - IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
13.55 - "true"));
13.56 -
13.57 - labelBox.add(label);
13.58 - labelBox.add(Box.createGlue());
13.59 -
13.60 - add(labelBox);
13.61 -
13.62 - add(Box.createGlue());
13.63 -
13.64 - add(makeCustomButton("isac.choose-file", new ActionListener() {
13.65 - public void actionPerformed(ActionEvent evt) {
13.66 - IsacToolPanel.this.pad.chooseFile();
13.67 - }
13.68 - }));
13.69 - add(makeCustomButton("isac.save-file", new ActionListener() {
13.70 - public void actionPerformed(ActionEvent evt) {
13.71 - IsacToolPanel.this.pad.saveFile();
13.72 - }
13.73 - }));
13.74 - add(makeCustomButton("isac.copy-to-buffer",
13.75 - new ActionListener() {
13.76 - public void actionPerformed(ActionEvent evt) {
13.77 - IsacToolPanel.this.pad.copyToBuffer();
13.78 - }
13.79 - }));
13.80 - }
13.81 -
13.82 - void propertiesChanged() {
13.83 - label.setText(pad.getFilename());
13.84 - label.setVisible(jEdit.getProperty(
13.85 - IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
13.86 - "true"));
13.87 - }
13.88 -
13.89 - private AbstractButton makeCustomButton(String name, ActionListener listener) {
13.90 - String toolTip = jEdit.getProperty(name.concat(".label"));
13.91 - AbstractButton b = new RolloverButton(GUIUtilities.loadIcon(jEdit
13.92 - .getProperty(name + ".icon")));
13.93 - if (listener != null) {
13.94 - b.addActionListener(listener);
13.95 - b.setEnabled(true);
13.96 - } else {
13.97 - b.setEnabled(false);
13.98 - }
13.99 - b.setToolTipText(toolTip);
13.100 - return b;
13.101 - }
13.102 -
13.103 -}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/src/Tools/isac/jEditC/src/jedit/IsacToolPanel.scala Thu Sep 02 21:57:03 2010 +0200
14.3 @@ -0,0 +1,90 @@
14.4 +/*
14.5 + * IsacToolPanel.java
14.6 + * gadei
14.7 + */
14.8 +
14.9 +package isac.jedit
14.10 +
14.11 +
14.12 +import java.awt.event.ActionEvent;
14.13 +import java.awt.event.ActionListener;
14.14 +
14.15 +import javax.swing.AbstractButton;
14.16 +import javax.swing.Box;
14.17 +import javax.swing.BoxLayout;
14.18 +import javax.swing.JLabel;
14.19 +import javax.swing.JPanel;
14.20 +
14.21 +import org.gjt.sp.jedit.GUIUtilities;
14.22 +import org.gjt.sp.jedit.jEdit;
14.23 +import org.gjt.sp.jedit.gui.RolloverButton;
14.24 +
14.25 +class IsacToolPanel(qnpad: Isac) extends JPanel {
14.26 + var pad: Isac
14.27 +
14.28 + var label: JLabel
14.29 +
14.30 + setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
14.31 + pad = qnpad
14.32 +
14.33 + val labelBox = new Box(BoxLayout.Y_AXIS): Box
14.34 + labelBox.add(Box.createGlue())
14.35 +
14.36 + label = new JLabel(pad.getFilename())
14.37 + label.setVisible(jEdit.getProperty(
14.38 + IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
14.39 + "true"))
14.40 +
14.41 + labelBox.add(label)
14.42 + labelBox.add(Box.createGlue())
14.43 +
14.44 + add(labelBox)
14.45 +
14.46 + add(Box.createGlue())
14.47 +/*
14.48 + add(makeCustomButton("isac.choose-file", new ActionListener() {
14.49 + def actionPerformed(evt: ActionEvent) {
14.50 + IsacToolPanel.this.pad.chooseFile()
14.51 + }))
14.52 +
14.53 +
14.54 + add(makeCustomButton("isac.save-file", new ActionListener() {
14.55 + /*
14.56 + public void actionPerformed(ActionEvent evt) {
14.57 + IsacToolPanel.this.pad.saveFile()
14.58 + }
14.59 + */
14.60 + }))
14.61 +
14.62 + add(makeCustomButton("isac.copy-to-buffer", new ActionListener() {
14.63 + /*
14.64 + public void actionPerformed(ActionEvent evt) {
14.65 + IsacToolPanel.this.pad.copyToBuffer()
14.66 + }
14.67 + */
14.68 + }))
14.69 +
14.70 +*/
14.71 + override def propertiesChanged() {
14.72 + label.setText(pad.getFilename());
14.73 + label.setVisible(jEdit.getProperty(
14.74 + IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
14.75 + "true"))
14.76 + }
14.77 +
14.78 + override def makeCustomButton(name: String, listener: ActionListener){
14.79 + val toolTip = jEdit.getProperty(name.concat(".label")): String
14.80 + val b = new RolloverButton(GUIUtilities.loadIcon(jEdit.getProperty(name + ".icon"))): AbstractButton
14.81 +
14.82 + if (listener != null) {
14.83 + b.addActionListener(listener);
14.84 + b.setEnabled(true);
14.85 + } else {
14.86 + b.setEnabled(false);
14.87 + }
14.88 +
14.89 + b.setToolTipText(toolTip)
14.90 +
14.91 + }
14.92 +
14.93 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/src/Tools/isac/jedit (copy)/Isac.java Thu Sep 02 21:57:03 2010 +0200
15.3 @@ -0,0 +1,245 @@
15.4 +/*
15.5 + * Isac.java
15.6 + * part of the Isac plugin for the jEdit text editor
15.7 + * Copyright (C) 2001 John Gellene
15.8 + * jgellene@nyc.rr.com
15.9 + *
15.10 + * This program is free software; you can redistribute it and/or
15.11 + * modify it under the terms of the GNU General Public License
15.12 + * as published by the Free Software Foundation; either version 2
15.13 + * of the License, or any later version.
15.14 + *
15.15 + * This program is distributed in the hope that it will be useful,
15.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
15.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15.18 + * GNU General Public License for more details.
15.19 + *
15.20 + * You should have received a copy of the GNU General Public License
15.21 + * along with this program; if not, write to the Free Software
15.22 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15.23 + *
15.24 + * $Id: Isac.java 12504 2008-04-22 23:12:43Z ezust $
15.25 + */
15.26 +
15.27 +// {{{ imports
15.28 +import java.awt.BorderLayout;
15.29 +import java.awt.Dimension;
15.30 +import java.awt.Font;
15.31 +import java.io.BufferedReader;
15.32 +import java.io.File;
15.33 +import java.io.FileNotFoundException;
15.34 +import java.io.FileReader;
15.35 +import java.io.FileWriter;
15.36 +import java.io.IOException;
15.37 +
15.38 +import javax.swing.JFileChooser;
15.39 +import javax.swing.JPanel;
15.40 +import javax.swing.JScrollPane;
15.41 +
15.42 +import org.gjt.sp.jedit.EBComponent;
15.43 +import org.gjt.sp.jedit.EBMessage;
15.44 +import org.gjt.sp.jedit.EditBus;
15.45 +import org.gjt.sp.jedit.GUIUtilities;
15.46 +import org.gjt.sp.jedit.View;
15.47 +import org.gjt.sp.jedit.jEdit;
15.48 +import org.gjt.sp.jedit.gui.DefaultFocusComponent;
15.49 +import org.gjt.sp.jedit.gui.DockableWindowManager;
15.50 +import org.gjt.sp.jedit.msg.PropertiesChanged;
15.51 +import org.gjt.sp.util.Log;
15.52 +import org.gjt.sp.util.StandardUtilities;
15.53 +// }}}
15.54 +
15.55 +// {{{ Isac class
15.56 +/**
15.57 + *
15.58 + * Isac - a dockable JPanel, a demonstration of a jEdit plugin.
15.59 + *
15.60 + */
15.61 +public class Isac extends JPanel
15.62 + implements EBComponent, IsacActions, DefaultFocusComponent {
15.63 +
15.64 + // {{{ Instance Variables
15.65 + private static final long serialVersionUID = 6412255692894321789L;
15.66 +
15.67 + private String filename;
15.68 +
15.69 + private String defaultFilename;
15.70 +
15.71 + private View view;
15.72 +
15.73 + private boolean floating;
15.74 +
15.75 + private IsacTextArea textArea;
15.76 +
15.77 + private IsacToolPanel toolPanel;
15.78 + // }}}
15.79 +
15.80 + // {{{ Constructor
15.81 + /**
15.82 + *
15.83 + * @param view the current jedit window
15.84 + * @param position a variable passed in from the script in actions.xml,
15.85 + * which can be DockableWindowManager.FLOATING, TOP, BOTTOM, LEFT, RIGHT, etc.
15.86 + * see @ref DockableWindowManager for possible values.
15.87 + */
15.88 + public Isac(View view, String position) {
15.89 + super(new BorderLayout());
15.90 + this.view = view;
15.91 + this.floating = position.equals(DockableWindowManager.FLOATING);
15.92 +
15.93 + if (jEdit.getSettingsDirectory() != null) {
15.94 + this.filename = jEdit.getProperty(IsacPlugin.OPTION_PREFIX
15.95 + + "filepath");
15.96 + if (this.filename == null || this.filename.length() == 0) {
15.97 + this.filename = new String(jEdit.getSettingsDirectory()
15.98 + + File.separator + "qn.txt");
15.99 + jEdit.setProperty(
15.100 + IsacPlugin.OPTION_PREFIX + "filepath",
15.101 + this.filename);
15.102 + }
15.103 + this.defaultFilename = this.filename;
15.104 + }
15.105 +
15.106 + this.toolPanel = new IsacToolPanel(this);
15.107 + add(BorderLayout.NORTH, this.toolPanel);
15.108 +
15.109 + if (floating)
15.110 + this.setPreferredSize(new Dimension(500, 250));
15.111 +
15.112 + textArea = new IsacTextArea();
15.113 + textArea.setFont(IsacOptionPane.makeFont());
15.114 +
15.115 + JScrollPane pane = new JScrollPane(textArea);
15.116 + add(BorderLayout.CENTER, pane);
15.117 +
15.118 + readFile();
15.119 + }
15.120 + // }}}
15.121 +
15.122 + // {{{ Member Functions
15.123 +
15.124 + // {{{ focusOnDefaultComponent
15.125 + public void focusOnDefaultComponent() {
15.126 + textArea.requestFocus();
15.127 + }
15.128 + // }}}
15.129 +
15.130 + // {{{ getFileName
15.131 + public String getFilename() {
15.132 + return filename;
15.133 + }
15.134 + // }}}
15.135 +
15.136 + // EBComponent implementation
15.137 +
15.138 + // {{{ handleMessage
15.139 + public void handleMessage(EBMessage message) {
15.140 + if (message instanceof PropertiesChanged) {
15.141 + propertiesChanged();
15.142 + }
15.143 + }
15.144 + // }}}
15.145 +
15.146 + // {{{ propertiesChanged
15.147 + private void propertiesChanged() {
15.148 + String propertyFilename = jEdit
15.149 + .getProperty(IsacPlugin.OPTION_PREFIX + "filepath");
15.150 + if (!StandardUtilities.objectsEqual(defaultFilename, propertyFilename)) {
15.151 + saveFile();
15.152 + toolPanel.propertiesChanged();
15.153 + defaultFilename = propertyFilename;
15.154 + filename = defaultFilename;
15.155 + readFile();
15.156 + }
15.157 + Font newFont = IsacOptionPane.makeFont();
15.158 + if (!newFont.equals(textArea.getFont())) {
15.159 + textArea.setFont(newFont);
15.160 + }
15.161 + }
15.162 + // }}}
15.163 +
15.164 + // These JComponent methods provide the appropriate points
15.165 + // to subscribe and unsubscribe this object to the EditBus.
15.166 +
15.167 + // {{{ addNotify
15.168 + public void addNotify() {
15.169 + super.addNotify();
15.170 + EditBus.addToBus(this);
15.171 + }
15.172 + // }}}
15.173 +
15.174 + // {{{ removeNotify
15.175 + public void removeNotify() {
15.176 + saveFile();
15.177 + super.removeNotify();
15.178 + EditBus.removeFromBus(this);
15.179 + }
15.180 + // }}}
15.181 +
15.182 + // IsacActions implementation
15.183 +
15.184 + // {{{
15.185 + public void saveFile() {
15.186 + if (filename == null || filename.length() == 0)
15.187 + return;
15.188 + try {
15.189 + FileWriter out = new FileWriter(filename);
15.190 + out.write(textArea.getText());
15.191 + out.close();
15.192 + } catch (IOException ioe) {
15.193 + Log.log(Log.ERROR, Isac.class,
15.194 + "Could not write notepad text to " + filename);
15.195 + }
15.196 + }
15.197 + // }}}
15.198 +
15.199 + // {{{ chooseFile
15.200 + public void chooseFile() {
15.201 + String[] paths = GUIUtilities.showVFSFileDialog(view, null,
15.202 + JFileChooser.OPEN_DIALOG, false);
15.203 + if (paths != null && !paths[0].equals(filename)) {
15.204 + saveFile();
15.205 + filename = paths[0];
15.206 + toolPanel.propertiesChanged();
15.207 + readFile();
15.208 + }
15.209 + }
15.210 + // }}}
15.211 +
15.212 + // {{{ copyToBuffer
15.213 + public void copyToBuffer() {
15.214 + jEdit.newFile(view);
15.215 + //GAdei Test view.getEditPane().getTextArea().setText(textArea.getText());
15.216 + view.getEditPane().getTextArea().setText("New Project: Gadei the king! BIIIIIG LOOOOOOOOL");
15.217 + }
15.218 + // }}}
15.219 + // {{{ readFile()
15.220 + /**
15.221 + * Helper method
15.222 + */
15.223 + private void readFile() {
15.224 + if (filename == null || filename.length() == 0)
15.225 + return;
15.226 +
15.227 + BufferedReader bf = null;
15.228 + try {
15.229 + bf = new BufferedReader(new FileReader(filename));
15.230 + StringBuffer sb = new StringBuffer(2048);
15.231 + String str;
15.232 + while ((str = bf.readLine()) != null) {
15.233 + sb.append(str).append('\n');
15.234 + }
15.235 + bf.close();
15.236 + textArea.setText(sb.toString());
15.237 + } catch (FileNotFoundException fnf) {
15.238 + Log.log(Log.ERROR, Isac.class, "notepad file " + filename
15.239 + + " does not exist");
15.240 + } catch (IOException ioe) {
15.241 + Log.log(Log.ERROR, Isac.class,
15.242 + "could not read notepad file " + filename);
15.243 + }
15.244 + }
15.245 + // }}}
15.246 + // }}}
15.247 +}
15.248 +// }}}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/src/Tools/isac/jedit (copy)/IsacActions.java Thu Sep 02 21:57:03 2010 +0200
16.3 @@ -0,0 +1,30 @@
16.4 +/*
16.5 + * IsacActions.java
16.6 + * part of the Isac plugin for the jEdit text editor
16.7 + * Copyright Gadei
16.8 + * jgellene@nyc.rr.com
16.9 + *
16.10 + * This program is free software; you can redistribute it and/or
16.11 + * modify it under the terms of the GNU General Public License
16.12 + * as published by the Free Software Foundation; either version 2
16.13 + * of the License, or any later version.
16.14 + *
16.15 + * This program is distributed in the hope that it will be useful,
16.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
16.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16.18 + * GNU General Public License for more details.
16.19 + *
16.20 + * You should have received a copy of the GNU General Public License
16.21 + * along with this program; if not, write to the Free Software
16.22 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16.23 + *
16.24 + * $Id: IsacActions.java 12504 2008-04-22 23:12:43Z ezust $
16.25 + */
16.26 +
16.27 +interface IsacActions {
16.28 + void chooseFile();
16.29 +
16.30 + void saveFile();
16.31 +
16.32 + void copyToBuffer();
16.33 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/src/Tools/isac/jedit (copy)/IsacOptionPane.java Thu Sep 02 21:57:03 2010 +0200
17.3 @@ -0,0 +1,111 @@
17.4 +/*
17.5 + * IsacOptionPane.java
17.6 + * gadei
17.7 + */
17.8 +
17.9 +package isac.jedit
17.10 +
17.11 +import java.awt.BorderLayout;
17.12 +import java.awt.Font;
17.13 +import java.awt.event.ActionEvent;
17.14 +import java.awt.event.ActionListener;
17.15 +
17.16 +import javax.swing.JButton;
17.17 +import javax.swing.JCheckBox;
17.18 +import javax.swing.JFileChooser;
17.19 +import javax.swing.JPanel;
17.20 +import javax.swing.JTextField;
17.21 +
17.22 +import org.gjt.sp.jedit.AbstractOptionPane;
17.23 +import org.gjt.sp.jedit.GUIUtilities;
17.24 +import org.gjt.sp.jedit.jEdit;
17.25 +import org.gjt.sp.jedit.gui.FontSelector;
17.26 +
17.27 +public class IsacOptionPane extends AbstractOptionPane implements
17.28 + ActionListener {
17.29 + private JCheckBox showPath;
17.30 +
17.31 + private JTextField pathName;
17.32 +
17.33 + private FontSelector font;
17.34 +
17.35 + public IsacOptionPane() {
17.36 + super(IsacPlugin.NAME);
17.37 + }
17.38 +
17.39 + public void _init() {
17.40 + showPath = new JCheckBox(jEdit
17.41 + .getProperty(IsacPlugin.OPTION_PREFIX
17.42 + + "show-filepath.title"), jEdit.getProperty(
17.43 + IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
17.44 + "true"));
17.45 + addComponent(showPath);
17.46 +
17.47 + pathName = new JTextField(jEdit
17.48 + .getProperty(IsacPlugin.OPTION_PREFIX + "filepath"));
17.49 + JButton pickPath = new JButton(jEdit
17.50 + .getProperty(IsacPlugin.OPTION_PREFIX + "choose-file"));
17.51 + pickPath.addActionListener(this);
17.52 +
17.53 + JPanel pathPanel = new JPanel(new BorderLayout(0, 0));
17.54 + pathPanel.add(pathName, BorderLayout.CENTER);
17.55 + pathPanel.add(pickPath, BorderLayout.EAST);
17.56 +
17.57 + addComponent(jEdit.getProperty(IsacPlugin.OPTION_PREFIX
17.58 + + "file"), pathPanel);
17.59 +
17.60 + font = new FontSelector(makeFont());
17.61 + addComponent(jEdit.getProperty(IsacPlugin.OPTION_PREFIX
17.62 + + "choose-font"), font);
17.63 + }
17.64 +
17.65 + public void _save() {
17.66 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "filepath",
17.67 + pathName.getText());
17.68 + Font _font = font.getFont();
17.69 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "font", _font
17.70 + .getFamily());
17.71 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "fontsize", String
17.72 + .valueOf(_font.getSize()));
17.73 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "fontstyle",
17.74 + String.valueOf(_font.getStyle()));
17.75 + jEdit.setProperty(IsacPlugin.OPTION_PREFIX + "show-filepath",
17.76 + String.valueOf(showPath.isSelected()));
17.77 + }
17.78 +
17.79 + // end AbstractOptionPane implementation
17.80 +
17.81 + // begin ActionListener implementation
17.82 + public void actionPerformed(ActionEvent evt) {
17.83 + String[] paths = GUIUtilities.showVFSFileDialog(null, null,
17.84 + JFileChooser.OPEN_DIALOG, false);
17.85 + if (paths != null) {
17.86 + pathName.setText(paths[0]);
17.87 + }
17.88 + }
17.89 +
17.90 + // helper method to get Font from plugin properties
17.91 + static public Font makeFont() {
17.92 + int style, size;
17.93 + String family = jEdit.getProperty(IsacPlugin.OPTION_PREFIX
17.94 + + "font");
17.95 + try {
17.96 + size = Integer
17.97 + .parseInt(jEdit
17.98 + .getProperty(IsacPlugin.OPTION_PREFIX
17.99 + + "fontsize"));
17.100 + } catch (NumberFormatException nf) {
17.101 + size = 14;
17.102 + }
17.103 + try {
17.104 + style = Integer
17.105 + .parseInt(jEdit
17.106 + .getProperty(IsacPlugin.OPTION_PREFIX
17.107 + + "fontstyle"));
17.108 + } catch (NumberFormatException nf) {
17.109 + style = Font.PLAIN;
17.110 + }
17.111 + return new Font(family, style, size);
17.112 + }
17.113 +
17.114 +}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/src/Tools/isac/jedit (copy)/IsacPlugin.java Thu Sep 02 21:57:03 2010 +0200
18.3 @@ -0,0 +1,34 @@
18.4 +/*
18.5 + * IsacPlugin.java
18.6 + * part of the Isac plugin for the jEdit text editor
18.7 + * Copyright (C) 2001 John Gellene
18.8 + * jgellene@nyc.rr.com
18.9 + *
18.10 + * This program is free software; you can redistribute it and/or
18.11 + * modify it under the terms of the GNU General Public License
18.12 + * as published by the Free Software Foundation; either version 2
18.13 + * of the License, or any later version.
18.14 + *
18.15 + * This program is distributed in the hope that it will be useful,
18.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
18.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18.18 + * GNU General Public License for more details.
18.19 + *
18.20 + * You should have received a copy of the GNU General Public License
18.21 + * along with this program; if not, write to the Free Software
18.22 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18.23 + *
18.24 + * $Id: IsacPlugin.java 12504 2008-04-22 23:12:43Z ezust $
18.25 + */
18.26 +
18.27 +import org.gjt.sp.jedit.EditPlugin;
18.28 +
18.29 +/**
18.30 + * The Isac plugin
18.31 + *
18.32 + * @author gadei
18.33 + */
18.34 +public class IsacPlugin extends EditPlugin {
18.35 + public static final String NAME = "isac";
18.36 + public static final String OPTION_PREFIX = "options.isac.";
18.37 +}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/src/Tools/isac/jedit (copy)/IsacTextArea.java Thu Sep 02 21:57:03 2010 +0200
19.3 @@ -0,0 +1,34 @@
19.4 +/*
19.5 + * IsacTextArea.java
19.6 + * part of the Isac plugin for the jEditTextArea
19.7 + * Gadei
19.8 + *
19.9 + * jgellene@nyc.rr.com
19.10 + *
19.11 + * This program is free software; you can redistribute it and/or
19.12 + * modify it under the terms of the GNU General Public License
19.13 + * as published by the Free Software Foundation; either version 2
19.14 + * of the License, or any later version.
19.15 + *
19.16 + * This program is distributed in the hope that it will be useful,
19.17 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
19.18 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19.19 + * GNU General Public License for more details.
19.20 + *
19.21 + * You should have received a copy of the GNU General Public License
19.22 + * along with this program; if not, write to the Free Software
19.23 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19.24 + *
19.25 + * $Id: IsacTextArea.java 12504 2008-04-22 23:12:43Z ezust $
19.26 + */
19.27 +
19.28 +import javax.swing.JTextArea;
19.29 +
19.30 +public class IsacTextArea extends JTextArea {
19.31 + public IsacTextArea() {
19.32 + super();
19.33 + setLineWrap(true);
19.34 + setWrapStyleWord(true);
19.35 + setTabSize(4);
19.36 + }
19.37 +}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
20.2 +++ b/src/Tools/isac/jedit (copy)/IsacToolPanel.java Thu Sep 02 21:57:03 2010 +0200
20.3 @@ -0,0 +1,100 @@
20.4 +/*
20.5 + * IsacToolPanel.java
20.6 + * part of the Isac plugin for the jEdit text editor
20.7 + * Copyright Gadei
20.8 + * jgellene@nyc.rr.com
20.9 + *
20.10 + * This program is free software; you can redistribute it and/or
20.11 + * modify it under the terms of the GNU General Public License
20.12 + * as published by the Free Software Foundation; either version 2
20.13 + * of the License, or any later version.
20.14 + *
20.15 + * This program is distributed in the hope that it will be useful,
20.16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
20.17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20.18 + * GNU General Public License for more details.
20.19 + *
20.20 + * You should have received a copy of the GNU General Public License
20.21 + * along with this program; if not, write to the Free Software
20.22 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20.23 + *
20.24 + * $Id: IsacToolPanel.java 12504 2008-04-22 23:12:43Z ezust $
20.25 + */
20.26 +
20.27 +import java.awt.event.ActionEvent;
20.28 +import java.awt.event.ActionListener;
20.29 +
20.30 +import javax.swing.AbstractButton;
20.31 +import javax.swing.Box;
20.32 +import javax.swing.BoxLayout;
20.33 +import javax.swing.JLabel;
20.34 +import javax.swing.JPanel;
20.35 +
20.36 +import org.gjt.sp.jedit.GUIUtilities;
20.37 +import org.gjt.sp.jedit.jEdit;
20.38 +import org.gjt.sp.jedit.gui.RolloverButton;
20.39 +
20.40 +public class IsacToolPanel extends JPanel {
20.41 + private Isac pad;
20.42 +
20.43 + private JLabel label;
20.44 +
20.45 + public IsacToolPanel(Isac qnpad) {
20.46 + setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
20.47 + pad = qnpad;
20.48 +
20.49 + Box labelBox = new Box(BoxLayout.Y_AXIS);
20.50 + labelBox.add(Box.createGlue());
20.51 +
20.52 + label = new JLabel(pad.getFilename());
20.53 + label.setVisible(jEdit.getProperty(
20.54 + IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
20.55 + "true"));
20.56 +
20.57 + labelBox.add(label);
20.58 + labelBox.add(Box.createGlue());
20.59 +
20.60 + add(labelBox);
20.61 +
20.62 + add(Box.createGlue());
20.63 +
20.64 + add(makeCustomButton("isac.choose-file", new ActionListener() {
20.65 + public void actionPerformed(ActionEvent evt) {
20.66 + IsacToolPanel.this.pad.chooseFile();
20.67 + }
20.68 + }));
20.69 + add(makeCustomButton("isac.save-file", new ActionListener() {
20.70 + public void actionPerformed(ActionEvent evt) {
20.71 + IsacToolPanel.this.pad.saveFile();
20.72 + }
20.73 + }));
20.74 + add(makeCustomButton("isac.copy-to-buffer",
20.75 + new ActionListener() {
20.76 + public void actionPerformed(ActionEvent evt) {
20.77 + IsacToolPanel.this.pad.copyToBuffer();
20.78 + }
20.79 + }));
20.80 + }
20.81 +
20.82 + void propertiesChanged() {
20.83 + label.setText(pad.getFilename());
20.84 + label.setVisible(jEdit.getProperty(
20.85 + IsacPlugin.OPTION_PREFIX + "show-filepath").equals(
20.86 + "true"));
20.87 + }
20.88 +
20.89 + private AbstractButton makeCustomButton(String name, ActionListener listener) {
20.90 + String toolTip = jEdit.getProperty(name.concat(".label"));
20.91 + AbstractButton b = new RolloverButton(GUIUtilities.loadIcon(jEdit
20.92 + .getProperty(name + ".icon")));
20.93 + if (listener != null) {
20.94 + b.addActionListener(listener);
20.95 + b.setEnabled(true);
20.96 + } else {
20.97 + b.setEnabled(false);
20.98 + }
20.99 + b.setToolTipText(toolTip);
20.100 + return b;
20.101 + }
20.102 +
20.103 +}
21.1 --- a/src/Tools/jEdit/src/jedit/plugin.scala Tue Aug 31 21:15:03 2010 +0200
21.2 +++ b/src/Tools/jEdit/src/jedit/plugin.scala Thu Sep 02 21:57:03 2010 +0200
21.3 @@ -40,7 +40,7 @@
21.4 /* properties */
21.5
21.6 val OPTION_PREFIX = "options.isabelle."
21.7 -
21.8 +//////////////////////
21.9 object Property
21.10 {
21.11 def apply(name: String): String =
21.12 @@ -209,7 +209,7 @@
21.13 val text_area = edit_pane.getTextArea
21.14
21.15 def init_view()
21.16 - {
21.17 +{
21.18 Document_Model(buffer) match {
21.19 case Some(model) => Document_View.init(model, text_area)
21.20 case None =>