non editable editors fixed

This commit is contained in:
Honfika
2014-01-20 19:25:26 +01:00
parent 9cb75db772
commit 20f40e19f4

View File

@@ -17,6 +17,7 @@
package com.jpexs.decompiler.flash.gui.abc;
import com.jpexs.decompiler.flash.configuration.Configuration;
import java.awt.event.KeyEvent;
import javax.swing.JEditorPane;
import javax.swing.text.Document;
import jsyntaxpane.SyntaxDocument;
@@ -51,6 +52,20 @@ public class UndoFixedEditorPane extends JEditorPane {
}
}
@Override
protected void processKeyEvent(KeyEvent ke) {
if (!isEditable()) {
// disable Ctrl-E: delete line
// and Ctrl-H: Search and replace
if ((ke.getKeyCode() == KeyEvent.VK_E && ke.isControlDown()) ||
(ke.getKeyCode() == KeyEvent.VK_H && ke.isControlDown())) {
return;
}
}
super.processKeyEvent(ke);
}
public void clearUndos() {
Document doc = getDocument();
if (doc instanceof SyntaxDocument) {