diff --git a/csl.api/src/org/netbeans/modules/csl/api/Rule.java b/csl.api/src/org/netbeans/modules/csl/api/Rule.java --- a/csl.api/src/org/netbeans/modules/csl/api/Rule.java +++ b/csl.api/src/org/netbeans/modules/csl/api/Rule.java @@ -144,4 +144,11 @@ */ public interface SelectionRule extends Rule { } + + /** + * This kind of rule declares the scope of the errors it produces. + */ + public interface ScopeRule extends Rule { + + } } diff --git a/openide.text/src/org/openide/text/QuietEditorPane.java b/openide.text/src/org/openide/text/QuietEditorPane.java --- a/openide.text/src/org/openide/text/QuietEditorPane.java +++ b/openide.text/src/org/openide/text/QuietEditorPane.java @@ -60,6 +60,7 @@ import java.awt.dnd.DropTargetEvent; import java.awt.dnd.DropTargetListener; import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; import java.awt.im.InputContext; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -73,6 +74,7 @@ import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JEditorPane; +import javax.swing.KeyStroke; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.TransferHandler; @@ -307,24 +309,48 @@ } } -/* Commented out since virtual height is implemented in the editor (in GapDocumentView) + /* Commented out since virtual height is implemented in the editor (in GapDocumentView) @Override public Dimension getPreferredSize() { - //Avoid always typing at the bottom of the screen by - //adding some virtual height, so the last line of the file - //can always be scrolled up to the middle of the viewport - Dimension result = super.getPreferredSize(); - JViewport port = (JViewport) SwingUtilities.getAncestorOfClass( - JViewport.class, this); - if (port != null) { - int viewHeight = port.getExtentSize().height; - if (result.height > viewHeight) { - result.height += viewHeight / 2; - } + //Avoid always typing at the bottom of the screen by + //adding some virtual height, so the last line of the file + //can always be scrolled up to the middle of the viewport + Dimension result = super.getPreferredSize(); + JViewport port = (JViewport) SwingUtilities.getAncestorOfClass( + JViewport.class, this); + if (port != null) { + int viewHeight = port.getExtentSize().height; + if (result.height > viewHeight) { + result.height += viewHeight / 2; + } + } + return result; + } + */ + + /** + * If true, the immediately following KEY_TYPED event will be discarded. + * Set during KEY_PRESSED processing that results in an action, so the + * potential KEY_TYPED that corresponds to the action key combination + * is not written into the document. + */ + private boolean ignoreNextKeyTyped; + + @Override + protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { + if (e.getID() == KeyEvent.KEY_TYPED && ignoreNextKeyTyped) { + e.consume(); + return false; } - return result; + boolean action = super.processKeyBinding(ks, e, condition, pressed); + if (pressed && e.getID() == KeyEvent.KEY_PRESSED) { + ignoreNextKeyTyped = action; + } else { + ignoreNextKeyTyped = false; + } + return action; } -*/ + /** * Delegating TransferHandler. diff --git a/options.keymap/src/org/netbeans/modules/options/keymap/ButtonCellEditor.java b/options.keymap/src/org/netbeans/modules/options/keymap/ButtonCellEditor.java --- a/options.keymap/src/org/netbeans/modules/options/keymap/ButtonCellEditor.java +++ b/options.keymap/src/org/netbeans/modules/options/keymap/ButtonCellEditor.java @@ -82,7 +82,9 @@ public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { JTable table = (JTable) cell.getParent(); - table.getCellEditor().cancelCellEditing(); + if (table != null) { + table.getCellEditor().cancelCellEditing(); + } model.update(); } } diff --git a/options.keymap/src/org/netbeans/modules/options/keymap/ShortcutListener.java b/options.keymap/src/org/netbeans/modules/options/keymap/ShortcutListener.java --- a/options.keymap/src/org/netbeans/modules/options/keymap/ShortcutListener.java +++ b/options.keymap/src/org/netbeans/modules/options/keymap/ShortcutListener.java @@ -85,6 +85,8 @@ public void keyTyped(KeyEvent e) { e.consume(); + KeyStroke ks = KeyStroke.getKeyStroke((Character)e.getKeyChar(), e.getModifiers()); + System.err.println(e); } private static final Method keyEvent_getExtendedKeyCode; @@ -123,7 +125,7 @@ public void keyPressed(KeyEvent e) { assert (e.getSource() instanceof JTextField); - + System.err.println(e); if(e.getKeyCode() == KeyEvent.VK_DOWN || e.getKeyCode() == KeyEvent.VK_UP || e.getKeyCode() == KeyEvent.VK_ESCAPE) @@ -163,10 +165,12 @@ private void addKeyStroke(KeyStroke keyStroke, boolean add) { String s = Utilities.keyToString(keyStroke, true); + /* KeyStroke mappedStroke = Utilities.stringToKey(s); if (!keyStroke.equals(mappedStroke)) { return; } + */ String k = KeyStrokeUtils.getKeyStrokeAsText(keyStroke); // check if the text can be mapped back if (key.equals("")) { //NOI18N