Skip to content

Commit

Permalink
Merge branch 'java17'
Browse files Browse the repository at this point in the history
  • Loading branch information
rjolly committed Sep 25, 2024
2 parents 4290cb4 + 8500efd commit 9c8f72a
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 49 deletions.
3 changes: 3 additions & 0 deletions bin/linoleum
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions bin/linoleum.bat
Original file line number Diff line number Diff line change
@@ -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
44 changes: 1 addition & 43 deletions init.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 3 additions & 0 deletions notepad/src/linoleum/notepad/Frame.form
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" value="Next"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
Expand All @@ -81,6 +82,7 @@
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" value="Replace"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
Expand All @@ -89,6 +91,7 @@
<Component class="javax.swing.JButton" name="jButton3">
<Properties>
<Property name="text" type="java.lang.String" value="Replace all"/>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton3ActionPerformed"/>
Expand Down
38 changes: 34 additions & 4 deletions notepad/src/linoleum/notepad/Frame.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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/*");
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -733,20 +758,23 @@ 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);
}
});

jButton2.setText("Replace");
jButton2.setEnabled(false);
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(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);
Expand Down Expand Up @@ -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();
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/linoleum/Desktop.form
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
</Property>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="jSeparator1">
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="restartMenuItem">
<Properties>
<Property name="action" type="javax.swing.Action" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="restartAction" type="code"/>
</Property>
</Properties>
</MenuItem>
<MenuItem class="javax.swing.JPopupMenu$Separator" name="separator">
</MenuItem>
<MenuItem class="javax.swing.JMenuItem" name="exitMenuItem">
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/linoleum/Desktop.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/linoleum/DesktopPane.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/linoleum/FileManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9c8f72a

Please sign in to comment.