diff --git a/bin/linoleum b/bin/linoleum index 86a6bf5..8395e70 100755 --- a/bin/linoleum +++ b/bin/linoleum @@ -1,4 +1,7 @@ #!/bin/sh LINOLEUM=`readlink -f $0` LINOLEUM_HOME=`dirname $LINOLEUM`/.. +until java -Djava.system.class.loader=linoleum.application.ClassLoader -Dscala.usejavacp=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -jar $LINOLEUM_HOME/linoleum.jar +do : +done diff --git a/bin/linoleum.bat b/bin/linoleum.bat index 60de84c..c89fd3e 100644 --- a/bin/linoleum.bat +++ b/bin/linoleum.bat @@ -1,3 +1,5 @@ @echo off set LINOLEUM_HOME=%~dp0.. +:loop java -Dfile.encoding=UTF-8 -Djava.system.class.loader=linoleum.application.ClassLoader -Dscala.usejavacp=true -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -jar %LINOLEUM_HOME%\linoleum.jar +if %ERRORLEVEL% GTR 0 goto loop diff --git a/init.js b/init.js index 2923f86..a028ce1 100644 --- a/init.js +++ b/init.js @@ -408,7 +408,7 @@ function classpath() { return java.lang.System.getProperty("java.class.path"); } -// require org.scala-lang#scala3-compiler_3;3.3.1 +// require org.scala-lang#scala3-compiler_3;3.5.1 function dotc(srcDir, destDir, options) { if (srcDir == undefined) { @@ -440,48 +440,6 @@ function dottydoc(srcDir, destDir, options) { (new Packages.dotty.tools.scaladoc.Main).run(["-classpath", classpath(), "-d", dir].concat(options).concat(files)); } -// require org.scala-lang#scala-compiler;2.11.0-M6 - -function scalac(srcDir, destDir, options) { - if (srcDir == undefined) { - srcDir = "."; - } - if (destDir == undefined) { - destDir = srcDir; - } - if (options == undefined) { - options = []; - } - files = fileset(srcDir, ".*\.(scala|java)"); - dir = pathToFile(destDir); - Packages.scala.tools.nsc.Main.process(["-classpath", classpath(), "-d", dir].concat(options).concat(files)); -} - -function scaladoc(srcDir, destDir, options) { - if (srcDir == undefined) { - srcDir = "."; - } - if (destDir == undefined) { - destDir = srcDir; - } - if (options == undefined) { - options = []; - } - var files = fileset(srcDir, ".*\.(scala|java)"); - var dir = pathToFile(destDir); - Packages.scala.tools.nsc.ScalaDoc$.MODULE$.process(["-classpath", classpath(), "-d", dir].concat(options).concat(files)); -} - -// requires com.github.rjolly#jarlister_2.11;1.1 - -function jarlister(path, out) { - var opts = []; - if (out != undefined) { - opts = opts.concat(["-o", pathToFile(out)]); - } - Packages.scala.tools.nsc.JarLister$.MODULE$.process(opts.concat([pathToFile(path)])); -} - // requires net.sourceforge.jscl-meditor#txt2xhtml;4.1 function txt2xhtml(srcDir, destDir, stylesheet, feed, icon) { diff --git a/notepad/src/linoleum/notepad/Frame.form b/notepad/src/linoleum/notepad/Frame.form index 7b0faf8..71d5a35 100644 --- a/notepad/src/linoleum/notepad/Frame.form +++ b/notepad/src/linoleum/notepad/Frame.form @@ -73,6 +73,7 @@ + @@ -81,6 +82,7 @@ + @@ -89,6 +91,7 @@ + diff --git a/notepad/src/linoleum/notepad/Frame.java b/notepad/src/linoleum/notepad/Frame.java index e34c8f3..fe2858a 100644 --- a/notepad/src/linoleum/notepad/Frame.java +++ b/notepad/src/linoleum/notepad/Frame.java @@ -45,6 +45,8 @@ import javax.swing.SwingWorker; import javax.swing.event.CaretEvent; import javax.swing.event.CaretListener; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; import javax.swing.event.UndoableEditEvent; @@ -87,6 +89,22 @@ public class Frame extends FileSupport { public Frame() { initComponents(); dialog1.pack(); + jTextField1.getDocument().addDocumentListener(new DocumentListener() { + @Override + public void insertUpdate(final DocumentEvent e) { + changed(); + } + + @Override + public void removeUpdate(final DocumentEvent e) { + changed(); + } + + @Override + public void changedUpdate(final DocumentEvent e) { + changed(); + } + }); chooser.setFileFilter(new FileNameExtensionFilter("Text", "txt")); setIcon(new ImageIcon(getClass().getResource("/toolbarButtonGraphics/general/Edit24.gif"))); setMimeType("text/plain:text/*:application/octet-stream:application/*"); @@ -491,18 +509,25 @@ private void openDialog(final String title) { dialog1.setVisible(true); } + private void changed() { + boolean empty = jTextField1.getText().isEmpty(); + jButton1.setEnabled(!empty); + jButton2.setEnabled(!empty && jTextField2.isEnabled()); + jButton3.setEnabled(!empty && jTextField2.isEnabled()); + } + private void find() { openDialog("FindTitle"); jTextField2.setEnabled(false); - jButton2.setEnabled(false); - jButton3.setEnabled(false); + jTextField1.requestFocusInWindow(); + jTextField1.setText(editor.getSelectedText()); } private void replace() { openDialog("ReplaceTitle"); jTextField2.setEnabled(true); - jButton2.setEnabled(true); - jButton3.setEnabled(true); + jTextField1.requestFocusInWindow(); + jTextField1.setText(editor.getSelectedText()); } private void setFile(final Path file) { @@ -733,6 +758,7 @@ private void initComponents() { jLabel2.setText("Replace with :"); jButton1.setText("Next"); + jButton1.setEnabled(false); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); @@ -740,6 +766,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); jButton2.setText("Replace"); + jButton2.setEnabled(false); jButton2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton2ActionPerformed(evt); @@ -747,6 +774,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); jButton3.setText("Replace all"); + jButton3.setEnabled(false); jButton3.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton3ActionPerformed(evt); @@ -866,6 +894,8 @@ private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRS dialog1.setVisible(false); try { setSelected(true); + jTextField1.setText(null); + jTextField2.setText(null); } catch (final PropertyVetoException ex) { ex.printStackTrace(); } diff --git a/src/main/java/linoleum/Desktop.form b/src/main/java/linoleum/Desktop.form index 1034da9..57870ad 100644 --- a/src/main/java/linoleum/Desktop.form +++ b/src/main/java/linoleum/Desktop.form @@ -24,6 +24,15 @@ + + + + + + + + + diff --git a/src/main/java/linoleum/Desktop.java b/src/main/java/linoleum/Desktop.java index e0fceb9..09dfee0 100644 --- a/src/main/java/linoleum/Desktop.java +++ b/src/main/java/linoleum/Desktop.java @@ -51,6 +51,7 @@ public class Desktop extends JFrame { + "%s"; private final Action openAction = new OpenAction(); private final Action saveAction = new SaveAction(); + private final Action restartAction = new RestartAction(); private final Action exitAction = new ExitAction(); private final Action fullScreenAction = new FullScreenAction(); private final Action screenshotAction = new ScreenshotAction(); @@ -106,6 +107,19 @@ public void run() { } } + private class RestartAction extends AbstractAction { + public RestartAction() { + super("Restart"); + putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_R, InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK)); + putValue(MNEMONIC_KEY, (int) 'r'); + } + + @Override + public void actionPerformed(final ActionEvent e) { + System.exit(1); + } + } + private class ExitAction extends AbstractAction { public ExitAction() { super("Exit"); @@ -322,6 +336,8 @@ private void initComponents() { fileMenu = new javax.swing.JMenu(); openMenuItem = new javax.swing.JMenuItem(); saveMenuItem = new javax.swing.JMenuItem(); + jSeparator1 = new javax.swing.JPopupMenu.Separator(); + restartMenuItem = new javax.swing.JMenuItem(); separator = new javax.swing.JPopupMenu.Separator(); exitMenuItem = new javax.swing.JMenuItem(); viewMenu = new javax.swing.JMenu(); @@ -351,6 +367,10 @@ public void componentMoved(java.awt.event.ComponentEvent evt) { saveMenuItem.setAction(saveAction); fileMenu.add(saveMenuItem); + fileMenu.add(jSeparator1); + + restartMenuItem.setAction(restartAction); + fileMenu.add(restartMenuItem); fileMenu.add(separator); exitMenuItem.setAction(exitAction); @@ -420,8 +440,10 @@ public void run() { private javax.swing.JMenu fileMenu; private javax.swing.JCheckBoxMenuItem fullScreenMenuItem; private javax.swing.JMenu helpMenu; + private javax.swing.JPopupMenu.Separator jSeparator1; private javax.swing.JMenuBar menuBar; private javax.swing.JMenuItem openMenuItem; + private javax.swing.JMenuItem restartMenuItem; private javax.swing.JMenuItem saveMenuItem; private javax.swing.JMenuItem screenshotMenuItem; private javax.swing.JPopupMenu.Separator separator; diff --git a/src/main/java/linoleum/DesktopPane.java b/src/main/java/linoleum/DesktopPane.java index 62a4c35..de57fae 100644 --- a/src/main/java/linoleum/DesktopPane.java +++ b/src/main/java/linoleum/DesktopPane.java @@ -11,7 +11,6 @@ import java.awt.event.InputEvent; import javax.swing.AbstractAction; import javax.swing.Action; -import javax.swing.ActionMap; import javax.swing.DefaultListModel; import javax.swing.KeyStroke; import javax.swing.Icon; diff --git a/src/main/java/linoleum/FileManager.java b/src/main/java/linoleum/FileManager.java index bf248a3..aec4be4 100644 --- a/src/main/java/linoleum/FileManager.java +++ b/src/main/java/linoleum/FileManager.java @@ -578,7 +578,7 @@ public Component getListCellRendererComponent(final JList list, final Object val setForeground(list.getForeground()); } final Path path = (Path)value; - setIcon(getFileIcon(path)); + if (!closing) setIcon(getFileIcon(path)); setText(path.getFileName().toString()); setFont(list.getFont()); return this;