diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java
index 651c30135..3938fbb2f 100644
--- a/app/src/processing/app/Base.java
+++ b/app/src/processing/app/Base.java
@@ -191,7 +191,7 @@ public class Base {
Platform.setLookAndFeel();
Platform.setInterfaceZoom();
} catch (Exception e) {
- Messages.loge("Error while setting up the interface", e); //$NON-NLS-1$
+ Messages.err("Error while setting up the interface", e); //$NON-NLS-1$
}
// long t3 = System.currentTimeMillis();
@@ -315,7 +315,7 @@ public class Base {
}
}
} catch (Exception e) {
- Messages.loge("Problem checking NVIDIA driver", e);
+ Messages.err("Problem checking NVIDIA driver", e);
}
}).start();
}
@@ -748,19 +748,19 @@ public class Base {
} catch (VerifyError | AbstractMethodError ve) {
System.err.println("\"" + tool.getMenuTitle() + "\" is not " +
"compatible with this version of Processing");
- Messages.loge("Incompatible Tool found during tool.init()", ve);
+ Messages.err("Incompatible Tool found during tool.init()", ve);
} catch (NoSuchMethodError nsme) {
System.err.println("\"" + tool.getMenuTitle() + "\" is not " +
"compatible with this version of Processing");
System.err.println("The " + nsme.getMessage() + " method no longer exists.");
- Messages.loge("Incompatible Tool found during tool.init()", nsme);
+ Messages.err("Incompatible Tool found during tool.init()", nsme);
} catch (NoClassDefFoundError ncdfe) {
System.err.println("\"" + tool.getMenuTitle() + "\" is not " +
"compatible with this version of Processing");
System.err.println("The " + ncdfe.getMessage() + " class is no longer available.");
- Messages.loge("Incompatible Tool found during tool.init()", ncdfe);
+ Messages.err("Incompatible Tool found during tool.init()", ncdfe);
} catch (Error | Exception e) {
System.err.println("An error occurred inside \"" + tool.getMenuTitle() + "\"");
@@ -858,7 +858,7 @@ public class Base {
Messages.showWarning("Tool out of date",
tool.getMenuTitle() + " is not compatible with this version of Processing.\n" +
"Try updating the Mode or contact its author for a new version.", ne);
- Messages.loge("Incompatible tool found during tool.run()", ne);
+ Messages.err("Incompatible tool found during tool.run()", ne);
item.setEnabled(false);
} catch (Exception ex) {
diff --git a/app/src/processing/app/Messages.java b/app/src/processing/app/Messages.java
index d8c78d43f..54028a2e5 100644
--- a/app/src/processing/app/Messages.java
+++ b/app/src/processing/app/Messages.java
@@ -29,8 +29,6 @@ import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
-import processing.app.ui.Editor;
-
public class Messages {
/**
* "No cookie for you" type messages. Nothing fatal or all that
@@ -190,26 +188,14 @@ public class Messages {
+ /*
// incomplete
static public int showYesNoCancelQuestion(Editor editor, String title,
String primary, String secondary) {
if (!Platform.isMacOS()) {
- int result =
- JOptionPane.showConfirmDialog(null, primary + "\n" + secondary, title,
- JOptionPane.YES_NO_CANCEL_OPTION,
- JOptionPane.QUESTION_MESSAGE);
- return result;
-// if (result == JOptionPane.YES_OPTION) {
-//
-// } else if (result == JOptionPane.NO_OPTION) {
-// return true; // ok to continue
-//
-// } else if (result == JOptionPane.CANCEL_OPTION) {
-// return false;
-//
-// } else {
-// throw new IllegalStateException();
-// }
+ return JOptionPane.showConfirmDialog(null, primary + "\n" + secondary, title,
+ JOptionPane.YES_NO_CANCEL_OPTION,
+ JOptionPane.QUESTION_MESSAGE);
} else {
// Pane formatting adapted from the Quaqua guide
@@ -236,8 +222,7 @@ public class Messages {
// on macosx, setting the destructive property places this option
// away from the others at the lefthand side
- pane.putClientProperty("Quaqua.OptionPane.destructiveOption",
- Integer.valueOf(2));
+ pane.putClientProperty("Quaqua.OptionPane.destructiveOption", 2);
JDialog dialog = pane.createDialog(editor, null);
dialog.setVisible(true);
@@ -254,6 +239,7 @@ public class Messages {
}
}
}
+ */
static public int showYesNoQuestion(Frame editor, String title,
@@ -347,19 +333,19 @@ public class Messages {
}
- static public void loge(String message, Throwable e) {
+ static public void err(String message) {
+ err(message, null);
+ }
+
+
+ static public void err(String message, Throwable e) {
if (Base.DEBUG) {
if (message != null) {
System.err.println(message);
}
- e.printStackTrace();
- }
- }
-
-
- static public void loge(String message) {
- if (Base.DEBUG) {
- System.err.println(message);
+ if (e != null) {
+ e.printStackTrace();
+ }
}
}
}
diff --git a/app/src/processing/app/Mode.java b/app/src/processing/app/Mode.java
index ab8430960..73d546619 100644
--- a/app/src/processing/app/Mode.java
+++ b/app/src/processing/app/Mode.java
@@ -1023,7 +1023,7 @@ public abstract class Mode {
// Create a fresh output folder (needed before preproc is run next)
if (!targetFolder.exists()) {
if (!targetFolder.mkdirs()) {
- Messages.loge("Could not create " + targetFolder);
+ Messages.err("Could not create " + targetFolder);
}
}
}
diff --git a/app/src/processing/app/Settings.java b/app/src/processing/app/Settings.java
index a109eb4b9..403d6587f 100644
--- a/app/src/processing/app/Settings.java
+++ b/app/src/processing/app/Settings.java
@@ -88,7 +88,7 @@ public class Settings {
}
}
} else {
- Messages.loge(additions + " could not be read");
+ Messages.err(additions + " could not be read");
}
// check for platform-specific properties in the defaults
diff --git a/app/src/processing/app/SingleInstance.java b/app/src/processing/app/SingleInstance.java
index d9409d152..405f6720c 100644
--- a/app/src/processing/app/SingleInstance.java
+++ b/app/src/processing/app/SingleInstance.java
@@ -47,7 +47,6 @@ public class SingleInstance {
* Returns true if there's an instance of Processing already running.
* Will not return true unless this code was able to successfully
* contact the already running instance to have it launch sketches.
- * @param filename Path to the PDE file that was opened, null if double-clicked
* @return true if successfully launched on the other instance
*/
static boolean alreadyRunning(String[] args) {
@@ -108,14 +107,14 @@ public class SingleInstance {
}
// }
} catch (IOException e) {
- Messages.loge("SingleInstance error while listening", e);
+ Messages.err("SingleInstance error while listening", e);
}
}
}
}, "SingleInstance Server").start();
} catch (IOException e) {
- Messages.loge("Could not create single instance server.", e);
+ Messages.err("Could not create single instance server.", e);
}
}
@@ -143,7 +142,7 @@ public class SingleInstance {
return true;
}
} catch (IOException e) {
- Messages.loge("Error sending commands to other instance", e);
+ Messages.err("Error sending commands to other instance", e);
}
Messages.log("Processing is not already running (or could not connect)");
return false;
diff --git a/app/src/processing/app/Util.java b/app/src/processing/app/Util.java
index 951474561..8e2063337 100644
--- a/app/src/processing/app/Util.java
+++ b/app/src/processing/app/Util.java
@@ -74,7 +74,7 @@ public class Util {
*/
static public StringDict readSettings(File inputFile) {
if (!inputFile.exists()) {
- Messages.loge(inputFile + " does not exist inside readSettings()");
+ Messages.err(inputFile + " does not exist inside readSettings()");
return null;
}
String lines[] = PApplet.loadStrings(inputFile);
diff --git a/app/src/processing/app/contrib/ModeContribution.java b/app/src/processing/app/contrib/ModeContribution.java
index 464941ad0..28dbd7782 100644
--- a/app/src/processing/app/contrib/ModeContribution.java
+++ b/app/src/processing/app/contrib/ModeContribution.java
@@ -66,7 +66,7 @@ public class ModeContribution extends LocalContribution {
// For the built-in modes, don't print the exception, just log it
// for debugging. This should be impossible for most users to reach,
// but it helps us load experimental mode when it's available.
- Messages.loge("ModeContribution.load() failed for " + searchName, err);
+ Messages.err("ModeContribution.load() failed for " + searchName, err);
}
}
return null;
diff --git a/app/src/processing/app/syntax/JEditTextArea.java b/app/src/processing/app/syntax/JEditTextArea.java
index 89f6dbb22..a42a3037a 100644
--- a/app/src/processing/app/syntax/JEditTextArea.java
+++ b/app/src/processing/app/syntax/JEditTextArea.java
@@ -2332,7 +2332,7 @@ public class JEditTextArea extends JComponent
try {
select(getMarkPosition(), xyToOffset(evt.getX(), evt.getY()));
} catch (ArrayIndexOutOfBoundsException e) {
- Messages.loge("xToOffset problem", e);
+ Messages.err("xToOffset problem", e);
}
} else {
int line = yToLine(evt.getY());
diff --git a/app/src/processing/app/ui/Editor.java b/app/src/processing/app/ui/Editor.java
index 754cdd303..d131e4566 100644
--- a/app/src/processing/app/ui/Editor.java
+++ b/app/src/processing/app/ui/Editor.java
@@ -2410,7 +2410,7 @@ public abstract class Editor extends JFrame implements RunnerListener {
// remove the original file, so user doesn't get confused
if (!origPdeFile.delete()) {
- Messages.loge("Could not delete " + origPdeFile);
+ Messages.err("Could not delete " + origPdeFile);
}
// update with the new path
diff --git a/app/src/processing/app/ui/PreferencesFrame.java b/app/src/processing/app/ui/PreferencesFrame.java
index 85193dc74..968817218 100644
--- a/app/src/processing/app/ui/PreferencesFrame.java
+++ b/app/src/processing/app/ui/PreferencesFrame.java
@@ -160,6 +160,12 @@ public class PreferencesFrame {
consoleFontSizeField = new JComboBox<>(FONT_SIZES);
consoleFontSizeField.setSelectedItem(Preferences.getInteger("console.font.size"));
+ // Sizing is screwed up on macOS, bug has been open since 2017
+ // https://github.com/processing/processing4/issues/232
+ // https://bugs.openjdk.java.net/browse/JDK-8179076
+ fontSizeField.setEditable(true);
+ consoleFontSizeField.setEditable(true);
+
// Interface scale: [ 100% ] (requires restart of Processing)
@@ -507,23 +513,16 @@ public class PreferencesFrame {
frame.pack();
frame.setLocationRelativeTo(null);
- // Workaround for OS X, which breaks the layout when these are set earlier
- // https://github.com/processing/processing/issues/3212
- fontSizeField.setEditable(true);
- consoleFontSizeField.setEditable(true);
-
// handle window closing commands for ctrl/cmd-W or hitting ESC.
-
pain.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- //System.out.println(e);
- KeyStroke wc = Toolkit.WINDOW_CLOSE_KEYSTROKE;
- if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) ||
- (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) {
- disposeFrame();
- }
+ public void keyPressed(KeyEvent e) {
+ KeyStroke wc = Toolkit.WINDOW_CLOSE_KEYSTROKE;
+ if ((e.getKeyCode() == KeyEvent.VK_ESCAPE) ||
+ (KeyStroke.getKeyStrokeForEvent(e).equals(wc))) {
+ disposeFrame();
}
- });
+ }
+ });
}
diff --git a/app/src/processing/app/ui/Toolkit.java b/app/src/processing/app/ui/Toolkit.java
index e80dcba0a..ea741334a 100644
--- a/app/src/processing/app/ui/Toolkit.java
+++ b/app/src/processing/app/ui/Toolkit.java
@@ -536,7 +536,7 @@ public class Toolkit {
static public ImageIcon getLibIcon(String filename) {
File file = Platform.getContentFile("lib/" + filename);
if (file == null || !file.exists()) {
- Messages.loge("does not exist: " + file);
+ Messages.err("does not exist: " + file);
return null;
}
return new ImageIcon(file.getAbsolutePath());
@@ -1032,7 +1032,7 @@ public class Toolkit {
sansBoldFont = new Font("Monospaced", Font.BOLD, size);
}
} catch (Exception e) {
- Messages.loge("Could not load mono font", e);
+ Messages.err("Could not load mono font", e);
monoFont = new Font("Monospaced", Font.PLAIN, size);
monoBoldFont = new Font("Monospaced", Font.BOLD, size);
}
@@ -1080,7 +1080,7 @@ public class Toolkit {
sansBoldFont = new Font("SansSerif", Font.BOLD, size);
}
} catch (Exception e) {
- Messages.loge("Could not load sans font", e);
+ Messages.err("Could not load sans font", e);
sansFont = new Font("SansSerif", Font.PLAIN, size);
sansBoldFont = new Font("SansSerif", Font.BOLD, size);
}
diff --git a/java/src/processing/mode/java/ASTViewer.java b/java/src/processing/mode/java/ASTViewer.java
index bac758c6f..d3f3728de 100644
--- a/java/src/processing/mode/java/ASTViewer.java
+++ b/java/src/processing/mode/java/ASTViewer.java
@@ -95,7 +95,7 @@ class ASTViewer {
void buildAndUpdateTree(PreprocSketch ps) {
CompilationUnit cu = ps.compilationUnit;
if (cu.types().isEmpty()){
- Messages.loge("No Type found in CU");
+ Messages.err("No Type found in CU");
return;
}
diff --git a/java/src/processing/mode/java/CompletionGenerator.java b/java/src/processing/mode/java/CompletionGenerator.java
index ed684d272..1bf55c64b 100644
--- a/java/src/processing/mode/java/CompletionGenerator.java
+++ b/java/src/processing/mode/java/CompletionGenerator.java
@@ -1750,7 +1750,7 @@ public class CompletionGenerator {
ASTNode testnode = parser.createAST(null);
//Base.loge("PREDICTION PARSER PROBLEMS: " + parser);
// Find closest ASTNode of the document to this word
- Messages.loge("Typed: " + phrase + "|" + " temp Node type: " + testnode.getClass().getSimpleName());
+ Messages.err("Typed: " + phrase + "|" + " temp Node type: " + testnode.getClass().getSimpleName());
if(testnode instanceof MethodInvocation){
MethodInvocation mi = (MethodInvocation)testnode;
log(mi.getName() + "," + mi.getExpression() + "," + mi.typeArguments().size());
@@ -1762,7 +1762,7 @@ public class CompletionGenerator {
// Make sure nearestNode is not NULL if couldn't find a closest node
nearestNode = astRootNode;
}
- Messages.loge(lineNumber + " Nearest ASTNode to PRED "
+ Messages.err(lineNumber + " Nearest ASTNode to PRED "
+ getNodeAsString(nearestNode));
candidates = new ArrayList<>();
@@ -1770,7 +1770,7 @@ public class CompletionGenerator {
// Determine the expression typed
if (testnode instanceof SimpleName && !noCompare) {
- Messages.loge("One word expression " + getNodeAsString(testnode));
+ Messages.err("One word expression " + getNodeAsString(testnode));
//==> Simple one word exprssion - so is just an identifier
// Bottom up traversal of the AST to look for possible definitions at
@@ -1850,7 +1850,7 @@ public class CompletionGenerator {
} else {
// ==> Complex expression of type blah.blah2().doIt,etc
// Have to resolve it by carefully traversing AST of testNode
- Messages.loge("Complex expression " + getNodeAsString(testnode));
+ Messages.err("Complex expression " + getNodeAsString(testnode));
log("candidates empty");
ASTNode childExpr = getChildExpression(testnode);
log("Parent expression : " + getParentExpression(testnode));
diff --git a/java/src/processing/mode/java/CompletionPanel.java b/java/src/processing/mode/java/CompletionPanel.java
index e6125964f..b23df460e 100644
--- a/java/src/processing/mode/java/CompletionPanel.java
+++ b/java/src/processing/mode/java/CompletionPanel.java
@@ -96,7 +96,6 @@ public class CompletionPanel {
* @param subWord - Partial word which triggered the code completion and which needs to be completed
* @param items - completion candidates
* @param location - Point location where popup list is to be displayed
- * @param dedit
*/
public CompletionPanel(final JEditTextArea textarea,
int position, String subWord,
@@ -377,7 +376,7 @@ public class CompletionPanel {
}
}
- Messages.loge(subWord + " <= subword, Inserting suggestion=> " +
+ Messages.err(subWord + " <= subword, Inserting suggestion=> " +
selectedSuggestion + " Current sub: " + currentSubword);
if (currentSubword.length() > 0) {
textarea.getDocument().remove(insertionPosition - currentSubwordLen,
diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java
index d6d7cf477..e3537db59 100644
--- a/java/src/processing/mode/java/JavaEditor.java
+++ b/java/src/processing/mode/java/JavaEditor.java
@@ -27,7 +27,6 @@ import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -1326,7 +1325,7 @@ public class JavaEditor extends Editor {
// this method gets called twice when saving sketch for the first time
// once with new name and another with old(causing NPE). Keep an eye out
// for potential issues. See #2675. TODO:
- Messages.loge("Illegal tab name to addBreakpointComments() " + tabFilename);
+ Messages.err("Illegal tab name to addBreakpointComments() " + tabFilename);
return;
}
List