@Override public void actionPerformed(ActionEvent evt, JTextComponent target) { Caret caret = target.getCaret(); BaseDocument doc = (BaseDocument)target.getDocument(); String cmd = evt.getActionCommand(); if (cmd.length() > 0) { char c = cmd.charAt(0); if (handleInsertion(doc, caret, c)) { return; } } htmlAction.actionPerformed(evt, target); } }
public void actionPerformed(ActionEvent evt, JTextComponent target) { String cmd = evt.getActionCommand(); int mod = evt.getModifiers(); // Dirty fix for Completion shortcut on Unix !!! if (cmd != null && cmd.equals(" ") && (mod == ActionEvent.CTRL_MASK)) { // NOI18N // Ctrl + SPACE } else { Caret caret = target.getCaret(); if (caret instanceof ExtCaret) { ((ExtCaret) caret).requestMatchBraceUpdateSync(); // synced // bracket // update } super.actionPerformed(evt, target); } if ((target != null) && (evt != null)) { if ((cmd != null) && (cmd.length() == 1) && ((mod & ActionEvent.ALT_MASK) == 0 && (mod & ActionEvent.CTRL_MASK) == 0)) { // Check whether char that should reindent the line was // inserted checkIndentHotChars(target, cmd); // Check the completion checkCompletion(target, cmd); } } }
super.insertString (document, offset, caret, insertString, overwrite); caret.setDot (offset + 1); return; super.insertString (document, offset, caret, insertString, overwrite);
super.replaceSelection(target, dotPos, caret, str, overwrite);
super.insertString (document, offset, caret, insertString, overwrite);
public void actionPerformed(ActionEvent evt, JTextComponent target) { String cmd = evt.getActionCommand(); int mod = evt.getModifiers(); // Dirty fix for Completion shortcut on Unix !!! if (cmd != null && cmd.equals(" ") && (mod == ActionEvent.CTRL_MASK)) { // NOI18N // Ctrl + SPACE } else { Caret caret = target.getCaret(); if (caret instanceof ExtCaret) { ((ExtCaret)caret).requestMatchBraceUpdateSync(); // synced bracket update } super.actionPerformed(evt, target); } if ((target != null) && (evt != null)) { if ((cmd != null) && (cmd.length() == 1) && ((mod & ActionEvent.ALT_MASK) == 0 && (mod & ActionEvent.CTRL_MASK) == 0) ) { // Check whether char that should reindent the line was inserted checkIndentHotChars(target, cmd); // Check the completion checkCompletion(target, cmd); } } }
protected Action[] createActions() { Action[] extActions = new Action[] { new BuildPopupMenuAction(), new ShowPopupMenuAction(), new BuildToolTipAction(), new FindAction(), new ReplaceAction(), new GotoAction(), //new GotoDeclarationAction(), the instance will be created in extending editor... i.e. JavaKit new ToggleCaseIdentifierBeginAction(), new MatchBraceAction(matchBraceAction, false), new MatchBraceAction(selectionMatchBraceAction, true), // new CodeSelectAction(), // the actionPerformed is empty and so I'm removing the action from the list new EscapeAction(), new ExtDefaultKeyTypedAction(), new CompletionShowAction(), new CompletionHideAction(), new JDCPopupPanelHideAction(), new JDCPopupPanelShowAction() }; return TextAction.augmentList(super.createActions(), extActions); }
@Override protected void insertString(BaseDocument doc, int dotPos, Caret caret, String str, boolean overwrite) throws BadLocationException { if (completionSettingEnabled()) { KeystrokeHandler bracketCompletion = getBracketCompletion(doc, dotPos); if (bracketCompletion != null) { // TODO - check if we're in a comment etc. and if so, do nothing boolean handled = bracketCompletion.beforeCharInserted(doc, dotPos, currentTarget, str.charAt(0)); if (!handled) { super.insertString(doc, dotPos, caret, str, overwrite); handled = bracketCompletion.afterCharInserted(doc, dotPos, currentTarget, str.charAt(0)); } return; } } super.insertString(doc, dotPos, caret, str, overwrite); }
protected Action[] createActions() { Action[] extActions = new Action[] { new BuildPopupMenuAction(), new ShowPopupMenuAction(), new BuildToolTipAction(), new FindAction(), new ReplaceAction(), new GotoAction(), new GotoDeclarationAction(), new ToggleCaseIdentifierBeginAction(), new MatchBraceAction(matchBraceAction, false), new MatchBraceAction(selectionMatchBraceAction, true), // new CodeSelectAction(), // the actionPerformed is empty and // so I'm removing the action from the list new EscapeAction(), new ExtDefaultKeyTypedAction(), new ExtInsertTabAction(), new ExtInsertBreakAction(), new ExtUpAction(upAction, false), new ExtPageUpAction(pageUpAction, false), new ExtDownAction(downAction, false), new ExtPageDownAction(pageDownAction, false), new ExtBeginLineAction(beginLineAction, false), new ExtBeginLineAction(selectionBeginLineAction, true), new ExtEndLineAction(endLineAction, false), new ExtEndLineAction(selectionEndLineAction, true), new CompletionShowAction(), new CompletionHideAction(), new ShiftInsertBreakAction() }; return TextAction.augmentList(super.createActions(), extActions); }
@Override public void actionPerformed(ActionEvent evt, JTextComponent target) { currentTarget = target; super.actionPerformed(evt, target); currentTarget = null; }