10000 Merge remote-tracking branch 'origin/master' · scijava/script-editor@d76013b · GitHub
[go: up one dir, main page]

Skip to content

Commit d76013b

Browse files
committed
Merge remote-tracking branch 'origin/master'
2 parents a2ae17a + 161ea84 commit d76013b

File tree

2 files changed

+8
-30
lines changed

2 files changed

+8
-30
lines changed

src/main/java/org/scijava/ui/swing/script/ErrorParser.java

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,6 @@ private void parse(final String errorLog) {
194194
// HACK scala code seems to always be pre-pended by some 10 lines of code(!?).
195195
if ("Scala".equals(lang.getLanguageName()))
196196
lineOffset += 10;
197-
// HACK and R by one (!?)
198-
else if ("R".equals(lang.getLanguageName()))
199-
lineOffset += 1;
200197

201198
errorLines = new TreeSet<>();
202199
final StringTokenizer tokenizer = new StringTokenizer(errorLog, "\n");
@@ -228,7 +225,6 @@ private void parseNonJava(final String lineText, final Collection<Integer> error
228225
|| lineText.indexOf(".tools.nsc.") > -1 // scala
229226
|| lineText.indexOf("at bsh.") > -1 // beanshel
230227
|| lineText.indexOf("$Recompilation$") > -1 // javascript
231-
|| lineText.indexOf("at org.renjin.") > -1 // R: The only thing useful in traces are Syntax errors!?
232228
) {//
233229
return;
234230
}
@@ -242,7 +238,7 @@ private void parseNonJava(final String lineText, final Collection<Integer> error
242238
}
243239

244240
private void extractLineIndicesFromFilteredTextLines(final String lineText, final Collection<Integer> errorLines) {
245-
// System.out.println(" Section being matched: " + lineText);
241+
// System.out.println("Section being matched: " + lineText);
246242
final Pattern pattern = Pattern.compile(":(\\d+)|line\\D*(\\d+)", Pattern.CASE_INSENSITIVE);
247243
final Matcher matcher = pattern.matcher(lineText);
248244

@@ -251,8 +247,8 @@ private void extractLineIndicesFromFilteredTextLines(final String lineText, fina
251247
final String firstGroup = matcher.group(1);
252248
final String lastGroup = matcher.group(matcher.groupCount());
253249
final String group = (firstGroup == null) ? lastGroup : firstGroup;
254-
// System.out.println(" firstGroup: " + firstGroup);
255-
// System.out.println(" lastGroup: " + lastGroup);
250+
// System.out.println("firstGroup: " + firstGroup);
251+
// System.out.println("lastGroup: " + lastGroup);
256252

257253
final int lineNumber = Integer.valueOf(group.trim());
258254
if (lineNumber > 0)
@@ -302,8 +298,7 @@ private void parseJava(final String filename, final String line, final Collectio
302298
private void abort(final String msg, final boolean offsetNotice) {
303299
if (writer != null) {
304300
String finalMsg = "[WARNING] " + msg + "\n";
305-
if (offsetNotice)
306-
finalMsg += "[WARNING] Error line(s) below may not match line numbers in the editor\n";
301+
finalMsg += "[WARNING] Error line(s) below may not match line numbers in the editor\n";
307302
writer.textArea.insert(finalMsg, lengthOfJTextAreaWriter);
308303
}
309304
errorLines = null;
@@ -380,15 +375,14 @@ public static void main(final String[] args) throws Exception {
380375
final String python = "File \"New_.py\", line 51, in <module>";
381376
final String ruby = "<main> at Batch_Convert.rb:51";
382377
final String scala = " at line number 51 at column number 18";
383-
final String beanshell = "or class name: Dummy : at Line: 51 : in file: ";
378+
final String beanshell = "or class name: Systesm : at Line: 51 : in file: ";
384379
final String javascript = " at jdk.nashorn.internal.scripts.Script$15$Greeting.:program(Greeting.js:51)";
385-
final String r = "org.renjin.parser.ParseException: Syntax error at line 51 char 2: syntax error, unexpected ',', expecting '\\n' or ';'";
386-
Arrays.asList(groovy, python, ruby, scala, beanshell, javascript, r).forEach(lang -> {
380+
Arrays.asList(groovy, python, ruby, scala, beanshell, javascript).forEach(lang -> {
387381
final ErrorParser parser = new ErrorParser(new EditorPane());
388382
final TreeSet<Integer> errorLines = new TreeSet<>();
389383
parser.extractLineIndicesFromFilteredTextLines(lang, errorLines);
390384
assert (errorLines.first() == 50);
391-
System.out.println((errorLines.first() == 50) + ": " + lang);
385+
System.out.println((errorLines.first() == 50) + ": <<" + lang + ">> ");
392386
});
393387
}
394388
}

src/main/java/org/scijava/ui/swing/script/TextEditor.java

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3766,19 +3766,6 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
37663766
if (text != null) findDialog.setSearchPattern(text);
37673767
findDialog.show(false);
37683768
});
3769-
jmi = new JMenuItem("Search Script for Selected Text");
3770-
popup.add(jmi);
3771-
jmi.addActionListener(e -> {
3772-
final String text = textArea.getSelectedText();
3773-
if (text == null) {
3774-
UIManager.getLookAndFeel().provideErrorFeedback(textArea);
3775-
} else {
3776-
findDialog.setLocationRelativeTo(this);
3777-
findDialog.setRestrictToConsole(false);
3778-
if (text != null) findDialog.setSearchPattern(text);
3779-
findDialog.show(false);
3780-
}
3781-
});
37823769
popup.addSeparator();
37833770

37843771
jmi = new JMenuItem("Clear Selected Text...");
@@ -3789,8 +3776,6 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
37893776
else
37903777
textArea.replaceSelection("");
37913778
});
3792-
final DefaultHighlighter highlighter = (DefaultHighlighter)textArea.getHighlighter();
3793-
highlighter.setDrawsLayeredHighlights(false);
37943779
jmi = new JMenuItem("Highlight Selected Text...");
37953780
popup.add(jmi);
37963781
jmi.addActionListener(e -> {
@@ -3799,8 +3784,7 @@ protected void applyConsolePopupMenu(final JTextArea textArea) {
37993784
final DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(color);
38003785
textArea.getHighlighter().addHighlight(textArea.getSelectionStart(), textArea.getSelectionEnd(), painter);
38013786
textArea.setCaretPosition(textArea.getSelectionEnd());
3802-
textArea.getHighlighter();
3803-
} catch (final BadLocationException ignored) {
3787+
} catch (BadLocationException ignored) {
38043788
UIManager.getLookAndFeel().provideErrorFeedback(textArea);
38053789
}
38063790
});

0 commit comments

Comments
 (0)
0