Skip to content

Commit 639d991

Browse files
committed
Some small cosmetics
1 parent 328d3b6 commit 639d991

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

app/src/processing/app/Editor.java

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import javax.swing.border.MatteBorder;
5555
import javax.swing.event.*;
5656
import javax.swing.text.BadLocationException;
57+
import javax.swing.text.Element;
5758
import javax.swing.text.PlainDocument;
5859
import javax.swing.undo.CannotRedoException;
5960
import javax.swing.undo.CannotUndoException;
@@ -338,36 +339,23 @@ public void windowDeactivated(WindowEvent e) {
338339

339340
pane.setTransferHandler(new FileDropHandler());
340341

341-
// System.out.println("t1");
342-
343342
// Finish preparing Editor (formerly found in Base)
344343
pack();
345344

346-
// System.out.println("t2");
347-
348345
// Set the window bounds and the divider location before setting it visible
349346
setPlacement(storedLocation, defaultLocation);
350347

351-
352348
// Set the minimum size for the editor window
353349
setMinimumSize(scale(new Dimension(
354350
PreferencesData.getInteger("editor.window.width.min"),
355351
PreferencesData.getInteger("editor.window.height.min"))));
356-
// System.out.println("t3");
357352

358353
// Bring back the general options for the editor
359354
applyPreferences();
360355

361-
// System.out.println("t4");
362-
363356
// Open the document that was passed in
364357
boolean loaded = handleOpenInternal(file);
365358
if (!loaded) sketch = null;
366-
367-
// System.out.println("t5");
368-
369-
// All set, now show the window
370-
//setVisible(true);
371359
}
372360

373361

@@ -1025,28 +1013,20 @@ private SketchTextArea createTextArea() throws IOException {
10251013
textArea.setAntiAliasingEnabled(PreferencesData.getBoolean("editor.antialias"));
10261014
textArea.setTabsEmulated(PreferencesData.getBoolean("editor.tabs.expand"));
10271015
textArea.setTabSize(PreferencesData.getInteger("editor.tabs.size"));
1028-
textArea.addHyperlinkListener(new HyperlinkListener() {
1029-
@Override
1030-
public void hyperlinkUpdate(HyperlinkEvent hyperlinkEvent) {
1031-
try {
1032-
platform.openURL(sketch.getFolder(), hyperlinkEvent.getURL().toExternalForm());
1033-
} catch (Exception e) {
1034-
Base.showWarning(e.getMessage(), e.getMessage(), e);
1035-
}
1016+
textArea.addHyperlinkListener(evt -> {
1017+
try {
1018+
platform.openURL(sketch.getFolder(), evt.getURL().toExternalForm());
1019+
} catch (Exception e) {
1020+
Base.showWarning(e.getMessage(), e.getMessage(), e);
10361021
}
10371022
});
1038-
textArea.addCaretListener(new CaretListener() {
1039-
1040-
@Override
1041-
public void caretUpdate(CaretEvent e) {
1042-
int lineStart = textArea.getDocument().getDefaultRootElement().getElementIndex(e.getMark());
1043-
int lineEnd = textArea.getDocument().getDefaultRootElement().getElementIndex(e.getDot());
1044-
1045-
lineStatus.set(lineStart, lineEnd);
1046-
}
1023+
textArea.addCaretListener(e -> {
1024+
Element root = textArea.getDocument().getDefaultRootElement();
1025+
int lineStart = root.getElementIndex(e.getMark());
1026+
int lineEnd = root.getElementIndex(e.getDot());
10471027

1028+
lineStatus.set(lineStart, lineEnd);
10481029
});
1049-
10501030
ToolTipManager.sharedInstance().registerComponent(textArea);
10511031

10521032
configurePopupMenu(textArea);

0 commit comments

Comments
 (0)