Allow paste of multi-line expression formats

This commit is contained in:
Reinhard Pointner 2016-08-10 21:01:05 +08:00
parent 0ae7161b47
commit 985556b3f2
3 changed files with 8 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -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;