From 985556b3f265db3fc377db57b1bdabc5e4cd4dca Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Wed, 10 Aug 2016 21:01:05 +0800 Subject: [PATCH] Allow paste of multi-line expression formats --- source/net/filebot/ui/list/ListPanel.java | 13 ++++--------- source/net/filebot/ui/rename/FormatDialog.java | 1 - source/net/filebot/ui/rename/PresetEditor.java | 14 ++++---------- 3 files changed, 8 insertions(+), 20 deletions(-) diff --git a/source/net/filebot/ui/list/ListPanel.java b/source/net/filebot/ui/list/ListPanel.java index 99e46383..1f35e7c0 100644 --- a/source/net/filebot/ui/list/ListPanel.java +++ b/source/net/filebot/ui/list/ListPanel.java @@ -29,8 +29,6 @@ import javax.swing.JTextField; import javax.swing.SpinnerNumberModel; import javax.swing.SwingUtilities; import javax.swing.TransferHandler; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; import org.fife.ui.rsyntaxtextarea.RSyntaxDocument; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; @@ -169,12 +167,7 @@ public class ListPanel extends JComponent { } private RSyntaxTextArea createEditor() { - RSyntaxTextArea editor = new RSyntaxTextArea(new RSyntaxDocument(SyntaxConstants.SYNTAX_STYLE_GROOVY) { - @Override - public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { - super.insertString(offs, str.replaceAll("\\R", ""), a); // FORCE SINGLE LINE - } - }, null, 1, 80); + RSyntaxTextArea editor = new RSyntaxTextArea(new RSyntaxDocument(SyntaxConstants.SYNTAX_STYLE_GROOVY), "", 1, 80); editor.setAntiAliasingEnabled(true); editor.setAnimateBracketMatching(false); @@ -187,7 +180,9 @@ public class ListPanel extends JComponent { editor.setUseFocusableTips(false); editor.setHighlightCurrentLine(false); editor.setLineWrap(false); - + editor.setPaintMarkOccurrencesBorder(false); + editor.setPaintTabLines(false); + editor.setMarkOccurrences(false); editor.setFont(new Font(MONOSPACED, PLAIN, 14)); // update format on change diff --git a/source/net/filebot/ui/rename/FormatDialog.java b/source/net/filebot/ui/rename/FormatDialog.java index 2467a8f0..2f014931 100644 --- a/source/net/filebot/ui/rename/FormatDialog.java +++ b/source/net/filebot/ui/rename/FormatDialog.java @@ -327,7 +327,6 @@ public class FormatDialog extends JDialog { editor.setPaintMarkOccurrencesBorder(false); editor.setPaintTabLines(false); editor.setMarkOccurrences(false); - editor.setFont(new Font(MONOSPACED, PLAIN, 14)); // update format on change diff --git a/source/net/filebot/ui/rename/PresetEditor.java b/source/net/filebot/ui/rename/PresetEditor.java index ca7415ea..dc851205 100644 --- a/source/net/filebot/ui/rename/PresetEditor.java +++ b/source/net/filebot/ui/rename/PresetEditor.java @@ -3,7 +3,6 @@ package net.filebot.ui.rename; import static java.awt.Font.*; import static javax.swing.BorderFactory.*; import static net.filebot.Logging.*; -import static net.filebot.similarity.Normalization.*; import static net.filebot.util.ui.SwingUI.*; import java.awt.Component; @@ -31,8 +30,6 @@ import javax.swing.JPopupMenu; import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.ListCellRenderer; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; import org.fife.ui.rsyntaxtextarea.RSyntaxDocument; import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea; @@ -205,13 +202,7 @@ public class PresetEditor extends JDialog { } private RSyntaxTextArea createEditor() { - final RSyntaxTextArea editor = new RSyntaxTextArea(new RSyntaxDocument(SyntaxConstants.SYNTAX_STYLE_GROOVY) { - - @Override - public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { - super.insertString(offs, replaceSpace(str, " "), a); // FORCE SINGLE LINE - } - }, null, 1, 80); + RSyntaxTextArea editor = new RSyntaxTextArea(new RSyntaxDocument(SyntaxConstants.SYNTAX_STYLE_GROOVY), "", 1, 80); editor.setAntiAliasingEnabled(true); editor.setAnimateBracketMatching(false); @@ -224,6 +215,9 @@ public class PresetEditor extends JDialog { editor.setUseFocusableTips(false); editor.setHighlightCurrentLine(false); editor.setLineWrap(false); + editor.setPaintMarkOccurrencesBorder(false); + editor.setPaintTabLines(false); + editor.setMarkOccurrences(false); editor.setFont(new Font(MONOSPACED, PLAIN, 14)); return editor;