Lines 77-82
Link Here
|
77 |
import javax.swing.text.AbstractDocument; |
77 |
import javax.swing.text.AbstractDocument; |
78 |
import javax.swing.text.EditorKit; |
78 |
import javax.swing.text.EditorKit; |
79 |
import javax.swing.text.Position; |
79 |
import javax.swing.text.Position; |
|
|
80 |
import org.netbeans.api.editor.EditorActionRegistration; |
80 |
import org.netbeans.api.editor.mimelookup.MimeLookup; |
81 |
import org.netbeans.api.editor.mimelookup.MimeLookup; |
81 |
import org.netbeans.api.editor.mimelookup.MimePath; |
82 |
import org.netbeans.api.editor.mimelookup.MimePath; |
82 |
import org.netbeans.api.editor.settings.KeyBindingSettings; |
83 |
import org.netbeans.api.editor.settings.KeyBindingSettings; |
Lines 691-699
Link Here
|
691 |
*/ |
692 |
*/ |
692 |
public static Map<String, Action> actionsToMap(Action[] actions) { |
693 |
public static Map<String, Action> actionsToMap(Action[] actions) { |
693 |
Map<String, Action> map = new HashMap<String, Action>(); |
694 |
Map<String, Action> map = new HashMap<String, Action>(); |
694 |
for (Action a : actions) { |
695 |
for (int i = 0; i < actions.length; i++) { |
|
|
696 |
Action a = actions[i]; |
697 |
if (a == null) { |
698 |
throw new IllegalStateException("actions[] contains null at index " + i + |
699 |
((i > 0) ? ". Preceding action is " + actions[i - 1] : "")); |
700 |
} |
695 |
String name = (String) a.getValue(Action.NAME); |
701 |
String name = (String) a.getValue(Action.NAME); |
696 |
map.put(((name != null) ? name : ""), a); // NOI18N |
702 |
if (name == null) { |
|
|
703 |
throw new IllegalStateException("Null Action.NAME property of action " + a); |
704 |
} |
705 |
map.put(name, a); // NOI18N |
697 |
} |
706 |
} |
698 |
return map; |
707 |
return map; |
699 |
} |
708 |
} |
Lines 824-930
Link Here
|
824 |
*/ |
833 |
*/ |
825 |
protected Action[] createActions() { |
834 |
protected Action[] createActions() { |
826 |
return new Action[] { |
835 |
return new Action[] { |
827 |
new DefaultKeyTypedAction(), |
836 |
// annotation-registration new DefaultKeyTypedAction(), |
828 |
new InsertContentAction(), |
837 |
// annotation-registration new InsertContentAction(), |
829 |
insertBreakActionDef, |
838 |
insertBreakActionDef, |
830 |
new SplitLineAction(), |
839 |
// annotation-registration new SplitLineAction(), |
831 |
insertTabActionDef, |
840 |
insertTabActionDef, |
832 |
deletePrevCharActionDef, |
841 |
deletePrevCharActionDef, |
833 |
deleteNextCharActionDef, |
842 |
deleteNextCharActionDef, |
834 |
new ReadOnlyAction(), |
843 |
// annotation-registration new ReadOnlyAction(), |
835 |
new WritableAction(), |
844 |
// annotation-registration new WritableAction(), |
836 |
cutActionDef, |
845 |
cutActionDef, |
837 |
copyActionDef, |
846 |
copyActionDef, |
838 |
pasteActionDef, |
847 |
pasteActionDef, |
839 |
new PasteAction(true), |
848 |
new PasteAction(true), |
840 |
new BeepAction(), |
849 |
// annotation-registration new BeepAction(), |
841 |
new UpAction(upAction, false), |
850 |
// annotation-registration new UpAction(upAction, false), |
842 |
new UpAction(selectionUpAction, true), |
851 |
// annotation-registration new UpAction(selectionUpAction, true), |
843 |
new PageUpAction(pageUpAction, false), |
852 |
// annotation-registration new PageUpAction(pageUpAction, false), |
844 |
new PageUpAction(selectionPageUpAction, true), |
853 |
// annotation-registration new PageUpAction(selectionPageUpAction, true), |
845 |
new DownAction(downAction, false), |
854 |
// annotation-registration new DownAction(downAction, false), |
846 |
new DownAction(selectionDownAction, true), |
855 |
// annotation-registration new DownAction(selectionDownAction, true), |
847 |
new PageDownAction(selectionPageDownAction, true), |
856 |
// annotation-registration new PageDownAction(selectionPageDownAction, true), |
848 |
new PageDownAction(pageDownAction, false), |
857 |
// annotation-registration new PageDownAction(pageDownAction, false), |
849 |
new ForwardAction(forwardAction, false), |
858 |
// annotation-registration new ForwardAction(forwardAction, false), |
850 |
new ForwardAction(selectionForwardAction, true), |
859 |
// annotation-registration new ForwardAction(selectionForwardAction, true), |
851 |
new BackwardAction(backwardAction, false), |
860 |
// annotation-registration new BackwardAction(backwardAction, false), |
852 |
new BackwardAction(selectionBackwardAction, true), |
861 |
// annotation-registration new BackwardAction(selectionBackwardAction, true), |
853 |
new BeginLineAction(lineFirstColumnAction, false, true), |
862 |
// annotation-registration new BeginLineAction(lineFirstColumnAction, false, true), |
854 |
new BeginLineAction(selectionLineFirstColumnAction, true, true), |
863 |
// annotation-registration new BeginLineAction(selectionLineFirstColumnAction, true, true), |
855 |
new BeginLineAction(beginLineAction, false), |
864 |
// annotation-registration new BeginLineAction(beginLineAction, false), |
856 |
new BeginLineAction(selectionBeginLineAction, true), |
865 |
// annotation-registration new BeginLineAction(selectionBeginLineAction, true), |
857 |
new EndLineAction(endLineAction, false), |
866 |
// annotation-registration new EndLineAction(endLineAction, false), |
858 |
new EndLineAction(selectionEndLineAction, true), |
867 |
// annotation-registration new EndLineAction(selectionEndLineAction, true), |
859 |
new BeginAction(beginAction, false), |
868 |
// annotation-registration new BeginAction(beginAction, false), |
860 |
new BeginAction(selectionBeginAction, true), |
869 |
// annotation-registration new BeginAction(selectionBeginAction, true), |
861 |
new EndAction(endAction, false), |
870 |
// annotation-registration new EndAction(endAction, false), |
862 |
new EndAction(selectionEndAction, true), |
871 |
// annotation-registration new EndAction(selectionEndAction, true), |
863 |
new NextWordAction(nextWordAction, false), |
872 |
// annotation-registration new NextWordAction(nextWordAction, false), |
864 |
new NextWordAction(selectionNextWordAction, true), |
873 |
// annotation-registration new NextWordAction(selectionNextWordAction, true), |
865 |
new PreviousWordAction(previousWordAction, false), |
874 |
// annotation-registration new PreviousWordAction(previousWordAction, false), |
866 |
new PreviousWordAction(selectionPreviousWordAction, true), |
875 |
// annotation-registration new PreviousWordAction(selectionPreviousWordAction, true), |
867 |
new BeginWordAction(beginWordAction, false), |
876 |
// annotation-registration new BeginWordAction(beginWordAction, false), |
868 |
new BeginWordAction(selectionBeginWordAction, true), |
877 |
// annotation-registration new BeginWordAction(selectionBeginWordAction, true), |
869 |
new EndWordAction(endWordAction, false), |
878 |
// annotation-registration new EndWordAction(endWordAction, false), |
870 |
new EndWordAction(selectionEndWordAction, true), |
879 |
// annotation-registration new EndWordAction(selectionEndWordAction, true), |
871 |
new SelectWordAction(), |
880 |
// annotation-registration new SelectWordAction(), |
872 |
new SelectLineAction(), |
881 |
// annotation-registration new SelectLineAction(), |
873 |
new SelectAllAction(), |
882 |
// annotation-registration new SelectAllAction(), |
874 |
new RemoveTrailingSpacesAction(), |
883 |
// annotation-registration new RemoveTrailingSpacesAction(), |
875 |
removeTabActionDef, |
884 |
removeTabActionDef, |
876 |
//new ActionFactory.RemoveWordAction(), #47709 |
885 |
//new ActionFactory.RemoveWordAction(), #47709 |
877 |
new ActionFactory.RemoveWordPreviousAction(), |
886 |
// annotation-registration new ActionFactory.RemoveWordPreviousAction(), |
878 |
new ActionFactory.RemoveWordNextAction(), |
887 |
// annotation-registration new ActionFactory.RemoveWordNextAction(), |
879 |
new ActionFactory.RemoveLineBeginAction(), |
888 |
// annotation-registration new ActionFactory.RemoveLineBeginAction(), |
880 |
new ActionFactory.RemoveLineAction(), |
889 |
// annotation-registration new ActionFactory.RemoveLineAction(), |
881 |
new ActionFactory.MoveSelectionElseLineUpAction(), |
890 |
// annotation-registration new ActionFactory.MoveSelectionElseLineUpAction(), |
882 |
new ActionFactory.MoveSelectionElseLineDownAction(), |
891 |
// annotation-registration new ActionFactory.MoveSelectionElseLineDownAction(), |
883 |
new ActionFactory.CopySelectionElseLineUpAction(), |
892 |
// annotation-registration new ActionFactory.CopySelectionElseLineUpAction(), |
884 |
new ActionFactory.CopySelectionElseLineDownAction(), |
893 |
// annotation-registration new ActionFactory.CopySelectionElseLineDownAction(), |
885 |
removeSelectionActionDef, |
894 |
removeSelectionActionDef, |
886 |
new ActionFactory.ToggleTypingModeAction(), |
895 |
// annotation-registration new ActionFactory.ToggleTypingModeAction(), |
887 |
new ActionFactory.ChangeCaseAction(toUpperCaseAction, Utilities.CASE_UPPER), |
896 |
// annotation-registration new ActionFactory.ChangeCaseAction(toUpperCaseAction, Utilities.CASE_UPPER), |
888 |
new ActionFactory.ChangeCaseAction(toLowerCaseAction, Utilities.CASE_LOWER), |
897 |
// annotation-registration new ActionFactory.ChangeCaseAction(toLowerCaseAction, Utilities.CASE_LOWER), |
889 |
new ActionFactory.ChangeCaseAction(switchCaseAction, Utilities.CASE_SWITCH), |
898 |
// annotation-registration new ActionFactory.ChangeCaseAction(switchCaseAction, Utilities.CASE_SWITCH), |
890 |
new ActionFactory.FindNextAction(), |
899 |
// annotation-registration new ActionFactory.FindNextAction(), |
891 |
new ActionFactory.FindPreviousAction(), |
900 |
// annotation-registration new ActionFactory.FindPreviousAction(), |
892 |
new ActionFactory.FindSelectionAction(), |
901 |
// annotation-registration new ActionFactory.FindSelectionAction(), |
893 |
new ActionFactory.ToggleHighlightSearchAction(), |
902 |
// annotation-registration new ActionFactory.ToggleHighlightSearchAction(), |
894 |
undoActionDef, |
903 |
undoActionDef, |
895 |
redoActionDef, |
904 |
redoActionDef, |
896 |
new ActionFactory.WordMatchAction(wordMatchNextAction, true), |
905 |
// annotation-registration new ActionFactory.WordMatchAction(wordMatchNextAction, true), |
897 |
new ActionFactory.WordMatchAction(wordMatchPrevAction, false), |
906 |
// annotation-registration new ActionFactory.WordMatchAction(wordMatchPrevAction, false), |
898 |
new ActionFactory.ReindentLineAction(), |
907 |
// annotation-registration new ActionFactory.ReindentLineAction(), |
899 |
new ActionFactory.ShiftLineAction(shiftLineLeftAction, false), |
908 |
// annotation-registration new ActionFactory.ShiftLineAction(shiftLineLeftAction, false), |
900 |
new ActionFactory.ShiftLineAction(shiftLineRightAction, true), |
909 |
// annotation-registration new ActionFactory.ShiftLineAction(shiftLineRightAction, true), |
901 |
new ActionFactory.AdjustWindowAction(adjustWindowTopAction, 0), |
910 |
// annotation-registration new ActionFactory.AdjustWindowAction(adjustWindowTopAction, 0), |
902 |
new ActionFactory.AdjustWindowAction(adjustWindowCenterAction, 50), |
911 |
// annotation-registration new ActionFactory.AdjustWindowAction(adjustWindowCenterAction, 50), |
903 |
new ActionFactory.AdjustWindowAction(adjustWindowBottomAction, 100), |
912 |
// annotation-registration new ActionFactory.AdjustWindowAction(adjustWindowBottomAction, 100), |
904 |
new ActionFactory.AdjustCaretAction(adjustCaretTopAction, 0), |
913 |
// annotation-registration new ActionFactory.AdjustCaretAction(adjustCaretTopAction, 0), |
905 |
new ActionFactory.AdjustCaretAction(adjustCaretCenterAction, 50), |
914 |
// annotation-registration new ActionFactory.AdjustCaretAction(adjustCaretCenterAction, 50), |
906 |
new ActionFactory.AdjustCaretAction(adjustCaretBottomAction, 100), |
915 |
// annotation-registration new ActionFactory.AdjustCaretAction(adjustCaretBottomAction, 100), |
907 |
new ActionFactory.FormatAction(), |
916 |
// annotation-registration new ActionFactory.FormatAction(), |
908 |
new ActionFactory.FirstNonWhiteAction(firstNonWhiteAction, false), |
917 |
// annotation-registration new ActionFactory.FirstNonWhiteAction(firstNonWhiteAction, false), |
909 |
new ActionFactory.FirstNonWhiteAction(selectionFirstNonWhiteAction, true), |
918 |
// annotation-registration new ActionFactory.FirstNonWhiteAction(selectionFirstNonWhiteAction, true), |
910 |
new ActionFactory.LastNonWhiteAction(lastNonWhiteAction, false), |
919 |
// annotation-registration new ActionFactory.LastNonWhiteAction(lastNonWhiteAction, false), |
911 |
new ActionFactory.LastNonWhiteAction(selectionLastNonWhiteAction, true), |
920 |
// annotation-registration new ActionFactory.LastNonWhiteAction(selectionLastNonWhiteAction, true), |
912 |
new ActionFactory.SelectIdentifierAction(), |
921 |
// annotation-registration new ActionFactory.SelectIdentifierAction(), |
913 |
new ActionFactory.SelectNextParameterAction(), |
922 |
// annotation-registration new ActionFactory.SelectNextParameterAction(), |
914 |
new ActionFactory.ScrollUpAction(), |
923 |
// annotation-registration new ActionFactory.ScrollUpAction(), |
915 |
new ActionFactory.ScrollDownAction(), |
924 |
// annotation-registration new ActionFactory.ScrollDownAction(), |
916 |
new ActionFactory.InsertDateTimeAction(), |
925 |
// annotation-registration new ActionFactory.InsertDateTimeAction(), |
917 |
new ActionFactory.GenerateGutterPopupAction(), |
926 |
// annotation-registration new ActionFactory.GenerateGutterPopupAction(), |
918 |
new ActionFactory.ToggleLineNumbersAction(), |
927 |
// annotation-registration new ActionFactory.ToggleLineNumbersAction(), |
919 |
new ActionFactory.AnnotationsCyclingAction(), |
928 |
// annotation-registration new ActionFactory.AnnotationsCyclingAction(), |
920 |
new ActionFactory.CollapseFold(), |
929 |
// annotation-registration new ActionFactory.CollapseFold(), |
921 |
new ActionFactory.ExpandFold(), |
930 |
// annotation-registration new ActionFactory.ExpandFold(), |
922 |
new ActionFactory.CollapseAllFolds(), |
931 |
// annotation-registration new ActionFactory.CollapseAllFolds(), |
923 |
new ActionFactory.ExpandAllFolds(), |
932 |
// annotation-registration new ActionFactory.ExpandAllFolds(), |
924 |
new ActionFactory.DumpViewHierarchyAction(), |
933 |
// annotation-registration new ActionFactory.DumpViewHierarchyAction(), |
925 |
new ActionFactory.StartNewLine(), |
934 |
// annotation-registration new ActionFactory.StartNewLine(), |
926 |
new ActionFactory.CutToLineBeginOrEndAction(false), |
935 |
// annotation-registration new ActionFactory.CutToLineBeginOrEndAction(false), |
927 |
new ActionFactory.CutToLineBeginOrEndAction(true), |
936 |
// annotation-registration new ActionFactory.CutToLineBeginOrEndAction(true), |
928 |
|
937 |
|
929 |
// Self test actions |
938 |
// Self test actions |
930 |
// new EditorDebug.SelfTestAction(), |
939 |
// new EditorDebug.SelfTestAction(), |
Lines 1033-1043
Link Here
|
1033 |
|
1042 |
|
1034 |
|
1043 |
|
1035 |
/** Default typed action */ |
1044 |
/** Default typed action */ |
|
|
1045 |
@EditorActionRegistration(name = defaultKeyTypedAction) |
1036 |
public static class DefaultKeyTypedAction extends LocalBaseAction { |
1046 |
public static class DefaultKeyTypedAction extends LocalBaseAction { |
1037 |
|
1047 |
|
1038 |
static final long serialVersionUID =3069164318144463899L; |
1048 |
static final long serialVersionUID =3069164318144463899L; |
1039 |
|
1049 |
|
1040 |
public DefaultKeyTypedAction() { |
1050 |
public DefaultKeyTypedAction() { |
|
|
1051 |
// Construct with defaultKeyTypedAction name to retain full compatibility for extending actions |
1041 |
super(defaultKeyTypedAction, MAGIC_POSITION_RESET | CLEAR_STATUS_TEXT); |
1052 |
super(defaultKeyTypedAction, MAGIC_POSITION_RESET | CLEAR_STATUS_TEXT); |
1042 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1053 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1043 |
LOG.fine("DefaultKeyTypedAction with enhanced logging, see issue #145306"); //NOI18N |
1054 |
LOG.fine("DefaultKeyTypedAction with enhanced logging, see issue #145306"); //NOI18N |
Lines 1246-1257
Link Here
|
1246 |
} |
1257 |
} |
1247 |
} |
1258 |
} |
1248 |
|
1259 |
|
|
|
1260 |
@EditorActionRegistration(name = splitLineAction) |
1249 |
public static class SplitLineAction extends LocalBaseAction { |
1261 |
public static class SplitLineAction extends LocalBaseAction { |
1250 |
|
1262 |
|
1251 |
static final long serialVersionUID =7966576342334158659L; |
1263 |
static final long serialVersionUID =7966576342334158659L; |
1252 |
|
1264 |
|
1253 |
public SplitLineAction() { |
1265 |
public SplitLineAction() { |
1254 |
super(splitLineAction, MAGIC_POSITION_RESET | ABBREV_RESET | WORD_MATCH_RESET); |
1266 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | WORD_MATCH_RESET); |
1255 |
} |
1267 |
} |
1256 |
|
1268 |
|
1257 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
1269 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
Lines 1417-1422
Link Here
|
1417 |
|
1429 |
|
1418 |
static final long serialVersionUID =8415246475764264835L; |
1430 |
static final long serialVersionUID =8415246475764264835L; |
1419 |
|
1431 |
|
|
|
1432 |
public KitCompoundAction(String actionNames[]) { |
1433 |
this(0, actionNames); |
1434 |
} |
1435 |
|
1436 |
public KitCompoundAction(int resetMask, String actionNames[]) { |
1437 |
super(resetMask); |
1438 |
this.actionNames = actionNames; |
1439 |
} |
1440 |
|
1420 |
public KitCompoundAction(String nm, String actionNames[]) { |
1441 |
public KitCompoundAction(String nm, String actionNames[]) { |
1421 |
this(nm, 0, actionNames); |
1442 |
this(nm, 0, actionNames); |
1422 |
} |
1443 |
} |
Lines 1445-1457
Link Here
|
1445 |
} |
1466 |
} |
1446 |
} |
1467 |
} |
1447 |
|
1468 |
|
|
|
1469 |
@EditorActionRegistration(name = insertContentAction) |
1448 |
public static class InsertContentAction extends LocalBaseAction { |
1470 |
public static class InsertContentAction extends LocalBaseAction { |
1449 |
|
1471 |
|
1450 |
static final long serialVersionUID =5647751370952797218L; |
1472 |
static final long serialVersionUID =5647751370952797218L; |
1451 |
|
1473 |
|
1452 |
public InsertContentAction() { |
1474 |
public InsertContentAction() { |
1453 |
super(insertContentAction, MAGIC_POSITION_RESET | ABBREV_RESET |
1475 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | WORD_MATCH_RESET); |
1454 |
| WORD_MATCH_RESET); |
|
|
1455 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1476 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1456 |
} |
1477 |
} |
1457 |
|
1478 |
|
Lines 1559-1570
Link Here
|
1559 |
} |
1580 |
} |
1560 |
} |
1581 |
} |
1561 |
|
1582 |
|
|
|
1583 |
@EditorActionRegistration(name = readOnlyAction) |
1562 |
public static class ReadOnlyAction extends LocalBaseAction { |
1584 |
public static class ReadOnlyAction extends LocalBaseAction { |
1563 |
|
1585 |
|
1564 |
static final long serialVersionUID =9204335480208463193L; |
1586 |
static final long serialVersionUID =9204335480208463193L; |
1565 |
|
1587 |
|
1566 |
public ReadOnlyAction() { |
1588 |
public ReadOnlyAction() { |
1567 |
super(readOnlyAction); |
|
|
1568 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1589 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1569 |
} |
1590 |
} |
1570 |
|
1591 |
|
Lines 1575-1586
Link Here
|
1575 |
} |
1596 |
} |
1576 |
} |
1597 |
} |
1577 |
|
1598 |
|
|
|
1599 |
@EditorActionRegistration(name = writableAction) |
1578 |
public static class WritableAction extends LocalBaseAction { |
1600 |
public static class WritableAction extends LocalBaseAction { |
1579 |
|
1601 |
|
1580 |
static final long serialVersionUID =-5982547952800937954L; |
1602 |
static final long serialVersionUID =-5982547952800937954L; |
1581 |
|
1603 |
|
1582 |
public WritableAction() { |
1604 |
public WritableAction() { |
1583 |
super(writableAction); |
|
|
1584 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1605 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1585 |
} |
1606 |
} |
1586 |
|
1607 |
|
Lines 1668-1679
Link Here
|
1668 |
public static class PasteAction extends LocalBaseAction { |
1689 |
public static class PasteAction extends LocalBaseAction { |
1669 |
|
1690 |
|
1670 |
static final long serialVersionUID =5839791453996432149L; |
1691 |
static final long serialVersionUID =5839791453996432149L; |
1671 |
private boolean formatted; |
|
|
1672 |
|
1692 |
|
1673 |
public PasteAction(boolean formated) { |
1693 |
public PasteAction(boolean formatted) { |
1674 |
super(formated ? pasteFormatedAction : pasteAction, ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
1694 |
super(formatted ? pasteFormatedAction : pasteAction, |
1675 |
//#54893 putValue ("helpID", PasteAction.class.getName ()); // NOI18N |
1695 |
ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
1676 |
this.formatted = formated; |
|
|
1677 |
} |
1696 |
} |
1678 |
|
1697 |
|
1679 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
1698 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
Lines 1694-1699
Link Here
|
1694 |
} |
1713 |
} |
1695 |
|
1714 |
|
1696 |
final Formatter formatter = doc.getFormatter(); |
1715 |
final Formatter formatter = doc.getFormatter(); |
|
|
1716 |
final boolean formatted = pasteFormatedAction.equals(getValue(Action.NAME)); |
1697 |
if (formatted) { |
1717 |
if (formatted) { |
1698 |
formatter.reformatLock(); |
1718 |
formatter.reformatLock(); |
1699 |
} |
1719 |
} |
Lines 1792-1804
Link Here
|
1792 |
} |
1812 |
} |
1793 |
|
1813 |
|
1794 |
|
1814 |
|
1795 |
|
1815 |
@EditorActionRegistration(name = beepAction) |
1796 |
public static class BeepAction extends LocalBaseAction { |
1816 |
public static class BeepAction extends LocalBaseAction { |
1797 |
|
1817 |
|
1798 |
static final long serialVersionUID =-4474054576633223968L; |
1818 |
static final long serialVersionUID =-4474054576633223968L; |
1799 |
|
1819 |
|
1800 |
public BeepAction() { |
1820 |
public BeepAction() { |
1801 |
super(beepAction); |
|
|
1802 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1821 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1803 |
} |
1822 |
} |
1804 |
|
1823 |
|
Lines 1810-1825
Link Here
|
1810 |
} |
1829 |
} |
1811 |
|
1830 |
|
1812 |
|
1831 |
|
|
|
1832 |
@EditorActionRegistration(name = { upAction, selectionUpAction }) |
1813 |
public static class UpAction extends LocalBaseAction { |
1833 |
public static class UpAction extends LocalBaseAction { |
1814 |
|
1834 |
|
1815 |
boolean select; |
|
|
1816 |
|
1817 |
static final long serialVersionUID =4621760742646981563L; |
1835 |
static final long serialVersionUID =4621760742646981563L; |
1818 |
|
1836 |
|
1819 |
public UpAction(String nm, boolean select) { |
1837 |
public UpAction() { |
1820 |
super(nm, ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET |
1838 |
super(ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
1821 |
| CLEAR_STATUS_TEXT); |
|
|
1822 |
this.select = select; |
1823 |
} |
1839 |
} |
1824 |
|
1840 |
|
1825 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1841 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1839-1844
Link Here
|
1839 |
} |
1855 |
} |
1840 |
try { |
1856 |
try { |
1841 |
dot = Utilities.getPositionAbove(target, dot, p.x); |
1857 |
dot = Utilities.getPositionAbove(target, dot, p.x); |
|
|
1858 |
boolean select = selectionUpAction.equals(getValue(Action.NAME)); |
1842 |
if (select) { |
1859 |
if (select) { |
1843 |
caret.moveDot(dot); |
1860 |
caret.moveDot(dot); |
1844 |
} else { |
1861 |
} else { |
Lines 1854-1869
Link Here
|
1854 |
} |
1871 |
} |
1855 |
} |
1872 |
} |
1856 |
|
1873 |
|
|
|
1874 |
@EditorActionRegistration(name = { downAction, selectionDownAction }) |
1857 |
public static class DownAction extends LocalBaseAction { |
1875 |
public static class DownAction extends LocalBaseAction { |
1858 |
|
1876 |
|
1859 |
boolean select; |
|
|
1860 |
|
1861 |
static final long serialVersionUID =-5635702355125266822L; |
1877 |
static final long serialVersionUID =-5635702355125266822L; |
1862 |
|
1878 |
|
1863 |
public DownAction(String nm, boolean select) { |
1879 |
public DownAction() { |
1864 |
super(nm, ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET |
1880 |
super(ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
1865 |
| CLEAR_STATUS_TEXT); |
|
|
1866 |
this.select = select; |
1867 |
} |
1881 |
} |
1868 |
|
1882 |
|
1869 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1883 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1883-1888
Link Here
|
1883 |
} |
1897 |
} |
1884 |
try { |
1898 |
try { |
1885 |
dot = Utilities.getPositionBelow(target, dot, p.x); |
1899 |
dot = Utilities.getPositionBelow(target, dot, p.x); |
|
|
1900 |
boolean select = selectionDownAction.equals(getValue(Action.NAME)); |
1886 |
if (select) { |
1901 |
if (select) { |
1887 |
caret.moveDot(dot); |
1902 |
caret.moveDot(dot); |
1888 |
} else { |
1903 |
} else { |
Lines 1899-1914
Link Here
|
1899 |
} |
1914 |
} |
1900 |
|
1915 |
|
1901 |
/** Go one page up */ |
1916 |
/** Go one page up */ |
|
|
1917 |
@EditorActionRegistration(name = { pageUpAction, selectionPageUpAction }) |
1902 |
public static class PageUpAction extends LocalBaseAction { |
1918 |
public static class PageUpAction extends LocalBaseAction { |
1903 |
|
1919 |
|
1904 |
boolean select; |
|
|
1905 |
|
1906 |
static final long serialVersionUID =-3107382148581661079L; |
1920 |
static final long serialVersionUID =-3107382148581661079L; |
1907 |
|
1921 |
|
1908 |
public PageUpAction(String nm, boolean select) { |
1922 |
public PageUpAction() { |
1909 |
super(nm, ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET |
1923 |
super(ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
1910 |
| CLEAR_STATUS_TEXT); |
|
|
1911 |
this.select = select; |
1912 |
} |
1924 |
} |
1913 |
|
1925 |
|
1914 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1926 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1985-1991
Link Here
|
1985 |
newCaretOffset = target.viewToModel(newCaretPoint); |
1997 |
newCaretOffset = target.viewToModel(newCaretPoint); |
1986 |
newCaretBounds = target.modelToView(newCaretOffset); |
1998 |
newCaretBounds = target.modelToView(newCaretOffset); |
1987 |
} |
1999 |
} |
1988 |
|
2000 |
|
|
|
2001 |
boolean select = selectionPageUpAction.equals(getValue(Action.NAME)); |
1989 |
if (select) { |
2002 |
if (select) { |
1990 |
caret.moveDot(newCaretOffset); |
2003 |
caret.moveDot(newCaretOffset); |
1991 |
} else { |
2004 |
} else { |
Lines 2003-2018
Link Here
|
2003 |
} |
2016 |
} |
2004 |
} |
2017 |
} |
2005 |
|
2018 |
|
|
|
2019 |
@EditorActionRegistration(name = { forwardAction, selectionForwardAction }) |
2006 |
public static class ForwardAction extends LocalBaseAction { |
2020 |
public static class ForwardAction extends LocalBaseAction { |
2007 |
|
2021 |
|
2008 |
boolean select; |
|
|
2009 |
|
2010 |
static final long serialVersionUID =8007293230193334414L; |
2022 |
static final long serialVersionUID =8007293230193334414L; |
2011 |
|
2023 |
|
2012 |
public ForwardAction(String nm, boolean select) { |
2024 |
public ForwardAction() { |
2013 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2025 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2014 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2026 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2015 |
this.select = select; |
|
|
2016 |
} |
2027 |
} |
2017 |
|
2028 |
|
2018 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2029 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2020-2025
Link Here
|
2020 |
Caret caret = target.getCaret(); |
2031 |
Caret caret = target.getCaret(); |
2021 |
try { |
2032 |
try { |
2022 |
int pos; |
2033 |
int pos; |
|
|
2034 |
boolean select = selectionForwardAction.equals(getValue(Action.NAME)); |
2023 |
if (!select && Utilities.isSelectionShowing(caret)) |
2035 |
if (!select && Utilities.isSelectionShowing(caret)) |
2024 |
{ |
2036 |
{ |
2025 |
pos = target.getSelectionEnd(); |
2037 |
pos = target.getSelectionEnd(); |
Lines 2048-2070
Link Here
|
2048 |
} |
2060 |
} |
2049 |
|
2061 |
|
2050 |
/** Go one page down */ |
2062 |
/** Go one page down */ |
|
|
2063 |
@EditorActionRegistration(name = { pageDownAction, selectionPageDownAction }) |
2051 |
public static class PageDownAction extends LocalBaseAction { |
2064 |
public static class PageDownAction extends LocalBaseAction { |
2052 |
|
2065 |
|
2053 |
boolean select; |
|
|
2054 |
|
2055 |
static final long serialVersionUID =8942534850985048862L; |
2066 |
static final long serialVersionUID =8942534850985048862L; |
2056 |
|
2067 |
|
2057 |
public PageDownAction(String nm, boolean select) { |
2068 |
public PageDownAction() { |
2058 |
super(nm, ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET |
2069 |
super(ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET |
2059 |
| CLEAR_STATUS_TEXT); |
2070 |
| CLEAR_STATUS_TEXT); |
2060 |
this.select = select; |
|
|
2061 |
} |
2071 |
} |
2062 |
|
2072 |
|
2063 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2073 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2064 |
if (target != null) { |
2074 |
if (target != null) { |
2065 |
try { |
2075 |
try { |
2066 |
Caret caret = target.getCaret(); |
2076 |
Caret caret = target.getCaret(); |
2067 |
BaseDocument doc = (BaseDocument)target.getDocument(); |
|
|
2068 |
int caretOffset = caret.getDot(); |
2077 |
int caretOffset = caret.getDot(); |
2069 |
Rectangle caretBounds = ((BaseTextUI)target.getUI()).modelToView(target, caretOffset); |
2078 |
Rectangle caretBounds = ((BaseTextUI)target.getUI()).modelToView(target, caretOffset); |
2070 |
if (caretBounds == null) { |
2079 |
if (caretBounds == null) { |
Lines 2129-2135
Link Here
|
2129 |
newCaretOffset = target.viewToModel(newCaretPoint); |
2138 |
newCaretOffset = target.viewToModel(newCaretPoint); |
2130 |
newCaretBounds = target.modelToView(newCaretOffset); |
2139 |
newCaretBounds = target.modelToView(newCaretOffset); |
2131 |
} |
2140 |
} |
2132 |
|
2141 |
|
|
|
2142 |
boolean select = selectionPageDownAction.equals(getValue(Action.NAME)); |
2133 |
if (select) { |
2143 |
if (select) { |
2134 |
caret.moveDot(newCaretOffset); |
2144 |
caret.moveDot(newCaretOffset); |
2135 |
} else { |
2145 |
} else { |
Lines 2147-2162
Link Here
|
2147 |
} |
2157 |
} |
2148 |
} |
2158 |
} |
2149 |
|
2159 |
|
|
|
2160 |
@EditorActionRegistration(name = { backwardAction, selectionBackwardAction }) |
2150 |
public static class BackwardAction extends LocalBaseAction { |
2161 |
public static class BackwardAction extends LocalBaseAction { |
2151 |
|
2162 |
|
2152 |
boolean select; |
|
|
2153 |
|
2154 |
static final long serialVersionUID =-3048379822817847356L; |
2163 |
static final long serialVersionUID =-3048379822817847356L; |
2155 |
|
2164 |
|
2156 |
public BackwardAction(String nm, boolean select) { |
2165 |
public BackwardAction() { |
2157 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2166 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2158 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2167 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2159 |
this.select = select; |
|
|
2160 |
} |
2168 |
} |
2161 |
|
2169 |
|
2162 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2170 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2164-2169
Link Here
|
2164 |
Caret caret = target.getCaret(); |
2172 |
Caret caret = target.getCaret(); |
2165 |
try { |
2173 |
try { |
2166 |
int pos; |
2174 |
int pos; |
|
|
2175 |
boolean select = selectionBackwardAction.equals(getValue(Action.NAME)); |
2167 |
if (!select && Utilities.isSelectionShowing(caret)) |
2176 |
if (!select && Utilities.isSelectionShowing(caret)) |
2168 |
{ |
2177 |
{ |
2169 |
pos = target.getSelectionStart(); |
2178 |
pos = target.getSelectionStart(); |
Lines 2193-2199
Link Here
|
2193 |
|
2202 |
|
2194 |
public static class BeginLineAction extends LocalBaseAction { |
2203 |
public static class BeginLineAction extends LocalBaseAction { |
2195 |
|
2204 |
|
2196 |
protected boolean select; |
2205 |
@EditorActionRegistration(name = { beginLineAction, selectionBeginLineAction }) |
|
|
2206 |
public static BeginLineAction create() { |
2207 |
return new BeginLineAction(false); |
2208 |
} |
2209 |
|
2210 |
@EditorActionRegistration(name = { lineFirstColumnAction, selectionLineFirstColumnAction }) |
2211 |
public static BeginLineAction createColumnOne() { |
2212 |
return new BeginLineAction(true); |
2213 |
} |
2197 |
|
2214 |
|
2198 |
/** Whether the action should go to the begining of |
2215 |
/** Whether the action should go to the begining of |
2199 |
* the text on the line or to the first column on the line*/ |
2216 |
* the text on the line or to the first column on the line*/ |
Lines 2201-2215
Link Here
|
2201 |
|
2218 |
|
2202 |
static final long serialVersionUID =3269462923524077779L; |
2219 |
static final long serialVersionUID =3269462923524077779L; |
2203 |
|
2220 |
|
2204 |
public BeginLineAction(String nm, boolean select) { |
2221 |
public BeginLineAction(boolean columnOne) { |
2205 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2222 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2206 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2223 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2207 |
this.select = select; |
|
|
2208 |
homeKeyColumnOne = false; |
2209 |
} |
2210 |
|
2211 |
public BeginLineAction(String nm, boolean select, boolean columnOne) { |
2212 |
this(nm, select); |
2213 |
homeKeyColumnOne = columnOne; |
2224 |
homeKeyColumnOne = columnOne; |
2214 |
} |
2225 |
} |
2215 |
|
2226 |
|
Lines 2235-2240
Link Here
|
2235 |
dot = textStartPos; |
2246 |
dot = textStartPos; |
2236 |
} |
2247 |
} |
2237 |
} |
2248 |
} |
|
|
2249 |
String actionName = (String) getValue(Action.NAME); |
2250 |
boolean select = selectionBeginLineAction.equals(actionName) |
2251 |
|| selectionLineFirstColumnAction.equals(actionName); |
2238 |
if (select) { |
2252 |
if (select) { |
2239 |
caret.moveDot(dot); |
2253 |
caret.moveDot(dot); |
2240 |
} else { |
2254 |
} else { |
Lines 2247-2262
Link Here
|
2247 |
} |
2261 |
} |
2248 |
} |
2262 |
} |
2249 |
|
2263 |
|
|
|
2264 |
@EditorActionRegistration(name = { endLineAction, selectionEndLineAction }) |
2250 |
public static class EndLineAction extends LocalBaseAction { |
2265 |
public static class EndLineAction extends LocalBaseAction { |
2251 |
|
2266 |
|
2252 |
protected boolean select; |
|
|
2253 |
|
2254 |
static final long serialVersionUID =5216077634055190170L; |
2267 |
static final long serialVersionUID =5216077634055190170L; |
2255 |
|
2268 |
|
2256 |
public EndLineAction(String nm, boolean select) { |
2269 |
public EndLineAction() { |
2257 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2270 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2258 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2271 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2259 |
this.select = select; |
|
|
2260 |
} |
2272 |
} |
2261 |
|
2273 |
|
2262 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2274 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2264-2269
Link Here
|
2264 |
Caret caret = target.getCaret(); |
2276 |
Caret caret = target.getCaret(); |
2265 |
try { |
2277 |
try { |
2266 |
int dot = Utilities.getRowEnd(target, caret.getDot()); |
2278 |
int dot = Utilities.getRowEnd(target, caret.getDot()); |
|
|
2279 |
boolean select = selectionEndLineAction.equals(getValue(Action.NAME)); |
2267 |
if (select) { |
2280 |
if (select) { |
2268 |
caret.moveDot(dot); |
2281 |
caret.moveDot(dot); |
2269 |
} else { |
2282 |
} else { |
Lines 2283-2304
Link Here
|
2283 |
} |
2296 |
} |
2284 |
} |
2297 |
} |
2285 |
|
2298 |
|
|
|
2299 |
@EditorActionRegistration(name = { beginAction, selectionBeginAction }) |
2286 |
public static class BeginAction extends LocalBaseAction { |
2300 |
public static class BeginAction extends LocalBaseAction { |
2287 |
|
2301 |
|
2288 |
boolean select; |
|
|
2289 |
|
2290 |
static final long serialVersionUID =3463563396210234361L; |
2302 |
static final long serialVersionUID =3463563396210234361L; |
2291 |
|
2303 |
|
2292 |
public BeginAction(String nm, boolean select) { |
2304 |
public BeginAction() { |
2293 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2305 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2294 |
| WORD_MATCH_RESET | SAVE_POSITION | CLEAR_STATUS_TEXT); |
2306 |
| WORD_MATCH_RESET | SAVE_POSITION | CLEAR_STATUS_TEXT); |
2295 |
this.select = select; |
|
|
2296 |
} |
2307 |
} |
2297 |
|
2308 |
|
2298 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2309 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2299 |
if (target != null) { |
2310 |
if (target != null) { |
2300 |
Caret caret = target.getCaret(); |
2311 |
Caret caret = target.getCaret(); |
2301 |
int dot = 0; // begin of document |
2312 |
int dot = 0; // begin of document |
|
|
2313 |
boolean select = selectionBeginAction.equals(getValue(Action.NAME)); |
2302 |
if (select) { |
2314 |
if (select) { |
2303 |
caret.moveDot(dot); |
2315 |
caret.moveDot(dot); |
2304 |
} else { |
2316 |
} else { |
Lines 2308-2329
Link Here
|
2308 |
} |
2320 |
} |
2309 |
} |
2321 |
} |
2310 |
|
2322 |
|
|
|
2323 |
@EditorActionRegistration(name = { endAction, selectionEndAction }) |
2311 |
public static class EndAction extends LocalBaseAction { |
2324 |
public static class EndAction extends LocalBaseAction { |
2312 |
|
2325 |
|
2313 |
boolean select; |
|
|
2314 |
|
2315 |
static final long serialVersionUID =8547506353130203657L; |
2326 |
static final long serialVersionUID =8547506353130203657L; |
2316 |
|
2327 |
|
2317 |
public EndAction(String nm, boolean select) { |
2328 |
public EndAction() { |
2318 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2329 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2319 |
| WORD_MATCH_RESET | SAVE_POSITION | CLEAR_STATUS_TEXT); |
2330 |
| WORD_MATCH_RESET | SAVE_POSITION | CLEAR_STATUS_TEXT); |
2320 |
this.select = select; |
|
|
2321 |
} |
2331 |
} |
2322 |
|
2332 |
|
2323 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2333 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2324 |
if (target != null) { |
2334 |
if (target != null) { |
2325 |
Caret caret = target.getCaret(); |
2335 |
Caret caret = target.getCaret(); |
2326 |
int dot = target.getDocument().getLength(); // end of document |
2336 |
int dot = target.getDocument().getLength(); // end of document |
|
|
2337 |
boolean select = selectionEndAction.equals(getValue(Action.NAME)); |
2327 |
if (select) { |
2338 |
if (select) { |
2328 |
caret.moveDot(dot); |
2339 |
caret.moveDot(dot); |
2329 |
} else { |
2340 |
} else { |
Lines 2333-2348
Link Here
|
2333 |
} |
2344 |
} |
2334 |
} |
2345 |
} |
2335 |
|
2346 |
|
|
|
2347 |
@EditorActionRegistration(name = { nextWordAction, selectionNextWordAction }) |
2336 |
public static class NextWordAction extends LocalBaseAction { |
2348 |
public static class NextWordAction extends LocalBaseAction { |
2337 |
|
2349 |
|
2338 |
boolean select; |
|
|
2339 |
|
2340 |
static final long serialVersionUID =-5909906947175434032L; |
2350 |
static final long serialVersionUID =-5909906947175434032L; |
2341 |
|
2351 |
|
2342 |
public NextWordAction(String nm, boolean select) { |
2352 |
public NextWordAction() { |
2343 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2353 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2344 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2354 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2345 |
this.select = select; |
|
|
2346 |
} |
2355 |
} |
2347 |
|
2356 |
|
2348 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2357 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2351-2356
Link Here
|
2351 |
try { |
2360 |
try { |
2352 |
int dotPos = caret.getDot(); |
2361 |
int dotPos = caret.getDot(); |
2353 |
dotPos = Utilities.getNextWord(target, dotPos); |
2362 |
dotPos = Utilities.getNextWord(target, dotPos); |
|
|
2363 |
boolean select = selectionNextWordAction.equals(getValue(Action.NAME)); |
2354 |
if (caret instanceof BaseCaret){ |
2364 |
if (caret instanceof BaseCaret){ |
2355 |
BaseCaret bCaret = (BaseCaret) caret; |
2365 |
BaseCaret bCaret = (BaseCaret) caret; |
2356 |
if (select) { |
2366 |
if (select) { |
Lines 2372-2387
Link Here
|
2372 |
} |
2382 |
} |
2373 |
} |
2383 |
} |
2374 |
|
2384 |
|
|
|
2385 |
@EditorActionRegistration(name = { previousWordAction, selectionPreviousWordAction }) |
2375 |
public static class PreviousWordAction extends LocalBaseAction { |
2386 |
public static class PreviousWordAction extends LocalBaseAction { |
2376 |
|
2387 |
|
2377 |
boolean select; |
|
|
2378 |
|
2379 |
static final long serialVersionUID =-5465143382669785799L; |
2388 |
static final long serialVersionUID =-5465143382669785799L; |
2380 |
|
2389 |
|
2381 |
public PreviousWordAction(String nm, boolean select) { |
2390 |
public PreviousWordAction() { |
2382 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2391 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2383 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2392 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2384 |
this.select = select; |
|
|
2385 |
} |
2393 |
} |
2386 |
|
2394 |
|
2387 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2395 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2389-2394
Link Here
|
2389 |
Caret caret = target.getCaret(); |
2397 |
Caret caret = target.getCaret(); |
2390 |
try { |
2398 |
try { |
2391 |
int dot = Utilities.getPreviousWord(target, caret.getDot()); |
2399 |
int dot = Utilities.getPreviousWord(target, caret.getDot()); |
|
|
2400 |
boolean select = selectionPreviousWordAction.equals(getValue(Action.NAME)); |
2392 |
if (caret instanceof BaseCaret){ |
2401 |
if (caret instanceof BaseCaret){ |
2393 |
BaseCaret bCaret = (BaseCaret) caret; |
2402 |
BaseCaret bCaret = (BaseCaret) caret; |
2394 |
if (select) { |
2403 |
if (select) { |
Lines 2410-2425
Link Here
|
2410 |
} |
2419 |
} |
2411 |
} |
2420 |
} |
2412 |
|
2421 |
|
|
|
2422 |
@EditorActionRegistration(name = { beginWordAction, selectionBeginAction }) |
2413 |
public static class BeginWordAction extends LocalBaseAction { |
2423 |
public static class BeginWordAction extends LocalBaseAction { |
2414 |
|
2424 |
|
2415 |
boolean select; |
|
|
2416 |
|
2417 |
static final long serialVersionUID =3991338381212491110L; |
2425 |
static final long serialVersionUID =3991338381212491110L; |
2418 |
|
2426 |
|
2419 |
public BeginWordAction(String nm, boolean select) { |
2427 |
public BeginWordAction() { |
2420 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2428 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2421 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2429 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2422 |
this.select = select; |
|
|
2423 |
} |
2430 |
} |
2424 |
|
2431 |
|
2425 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2432 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2427-2432
Link Here
|
2427 |
Caret caret = target.getCaret(); |
2434 |
Caret caret = target.getCaret(); |
2428 |
try { |
2435 |
try { |
2429 |
int dot = Utilities.getWordStart(target, caret.getDot()); |
2436 |
int dot = Utilities.getWordStart(target, caret.getDot()); |
|
|
2437 |
boolean select = selectionBeginAction.equals(getValue(Action.NAME)); |
2430 |
if (select) { |
2438 |
if (select) { |
2431 |
caret.moveDot(dot); |
2439 |
caret.moveDot(dot); |
2432 |
} else { |
2440 |
} else { |
Lines 2439-2454
Link Here
|
2439 |
} |
2447 |
} |
2440 |
} |
2448 |
} |
2441 |
|
2449 |
|
|
|
2450 |
@EditorActionRegistration(name = { endWordAction, selectionEndWordAction }) |
2442 |
public static class EndWordAction extends LocalBaseAction { |
2451 |
public static class EndWordAction extends LocalBaseAction { |
2443 |
|
2452 |
|
2444 |
boolean select; |
|
|
2445 |
|
2446 |
static final long serialVersionUID =3812523676620144633L; |
2453 |
static final long serialVersionUID =3812523676620144633L; |
2447 |
|
2454 |
|
2448 |
public EndWordAction(String nm, boolean select) { |
2455 |
public EndWordAction() { |
2449 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2456 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
2450 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2457 |
| WORD_MATCH_RESET | CLEAR_STATUS_TEXT); |
2451 |
this.select = select; |
|
|
2452 |
} |
2458 |
} |
2453 |
|
2459 |
|
2454 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2460 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2456-2461
Link Here
|
2456 |
Caret caret = target.getCaret(); |
2462 |
Caret caret = target.getCaret(); |
2457 |
try { |
2463 |
try { |
2458 |
int dot = Utilities.getWordEnd(target, caret.getDot()); |
2464 |
int dot = Utilities.getWordEnd(target, caret.getDot()); |
|
|
2465 |
boolean select = selectionEndWordAction.equals(getValue(Action.NAME)); |
2459 |
if (select) { |
2466 |
if (select) { |
2460 |
caret.moveDot(dot); |
2467 |
caret.moveDot(dot); |
2461 |
} else { |
2468 |
} else { |
Lines 2469-2481
Link Here
|
2469 |
} |
2476 |
} |
2470 |
|
2477 |
|
2471 |
/** Select word around caret */ |
2478 |
/** Select word around caret */ |
|
|
2479 |
@EditorActionRegistration(name = selectWordAction) |
2472 |
public static class SelectWordAction extends KitCompoundAction { |
2480 |
public static class SelectWordAction extends KitCompoundAction { |
2473 |
|
2481 |
|
2474 |
static final long serialVersionUID =7678848538073016357L; |
2482 |
static final long serialVersionUID =7678848538073016357L; |
2475 |
|
2483 |
|
2476 |
public SelectWordAction() { |
2484 |
public SelectWordAction() { |
2477 |
super(selectWordAction, |
2485 |
super(new String[] { |
2478 |
new String[] { |
|
|
2479 |
beginWordAction, |
2486 |
beginWordAction, |
2480 |
selectionEndWordAction |
2487 |
selectionEndWordAction |
2481 |
} |
2488 |
} |
Lines 2485-2496
Link Here
|
2485 |
} |
2492 |
} |
2486 |
|
2493 |
|
2487 |
/** Select line around caret */ |
2494 |
/** Select line around caret */ |
|
|
2495 |
@EditorActionRegistration(name = selectLineAction) |
2488 |
public static class SelectLineAction extends LocalBaseAction { |
2496 |
public static class SelectLineAction extends LocalBaseAction { |
2489 |
|
2497 |
|
2490 |
static final long serialVersionUID =-7407681863035740281L; |
2498 |
static final long serialVersionUID =-7407681863035740281L; |
2491 |
|
2499 |
|
2492 |
public SelectLineAction() { |
2500 |
public SelectLineAction() { |
2493 |
super(selectLineAction); |
|
|
2494 |
} |
2501 |
} |
2495 |
|
2502 |
|
2496 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
2503 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
Lines 2519-2531
Link Here
|
2519 |
} |
2526 |
} |
2520 |
|
2527 |
|
2521 |
/** Select text of whole document */ |
2528 |
/** Select text of whole document */ |
|
|
2529 |
@EditorActionRegistration(name = selectAllAction) |
2522 |
public static class SelectAllAction extends KitCompoundAction { |
2530 |
public static class SelectAllAction extends KitCompoundAction { |
2523 |
|
2531 |
|
2524 |
static final long serialVersionUID =-3502499718130556524L; |
2532 |
static final long serialVersionUID =-3502499718130556524L; |
2525 |
|
2533 |
|
2526 |
public SelectAllAction() { |
2534 |
public SelectAllAction() { |
2527 |
super(selectAllAction, |
2535 |
super(new String[] { |
2528 |
new String[] { |
|
|
2529 |
beginAction, |
2536 |
beginAction, |
2530 |
selectionEndAction |
2537 |
selectionEndAction |
2531 |
} |
2538 |
} |
Lines 2533-2543
Link Here
|
2533 |
} |
2540 |
} |
2534 |
|
2541 |
|
2535 |
} |
2542 |
} |
2536 |
|
2543 |
|
|
|
2544 |
@EditorActionRegistration(name = removeTrailingSpacesAction) |
2537 |
public static class RemoveTrailingSpacesAction extends LocalBaseAction { |
2545 |
public static class RemoveTrailingSpacesAction extends LocalBaseAction { |
2538 |
|
2546 |
|
2539 |
public RemoveTrailingSpacesAction() { |
2547 |
public RemoveTrailingSpacesAction() { |
2540 |
super(removeTrailingSpacesAction); |
|
|
2541 |
} |
2548 |
} |
2542 |
|
2549 |
|
2543 |
protected boolean asynchonous() { |
2550 |
protected boolean asynchonous() { |