Lines 71-81
Link Here
|
71 |
import javax.swing.JCheckBoxMenuItem; |
71 |
import javax.swing.JCheckBoxMenuItem; |
72 |
import java.awt.event.ItemListener; |
72 |
import java.awt.event.ItemListener; |
73 |
import java.awt.event.ItemEvent; |
73 |
import java.awt.event.ItemEvent; |
74 |
import javax.swing.ImageIcon; |
|
|
75 |
import javax.swing.JToggleButton; |
74 |
import javax.swing.JToggleButton; |
76 |
import javax.swing.event.ChangeListener; |
75 |
import javax.swing.event.ChangeListener; |
77 |
import javax.swing.text.AbstractDocument; |
76 |
import javax.swing.text.AbstractDocument; |
78 |
import javax.swing.text.View; |
77 |
import javax.swing.text.View; |
|
|
78 |
import org.netbeans.api.editor.EditorActionRegistration; |
79 |
import org.netbeans.api.editor.EditorActionRegistrations; |
79 |
import org.netbeans.api.editor.fold.Fold; |
80 |
import org.netbeans.api.editor.fold.Fold; |
80 |
import org.netbeans.api.editor.fold.FoldHierarchy; |
81 |
import org.netbeans.api.editor.fold.FoldHierarchy; |
81 |
import org.netbeans.api.editor.fold.FoldUtilities; |
82 |
import org.netbeans.api.editor.fold.FoldUtilities; |
Lines 102-114
Link Here
|
102 |
private ActionFactory() { |
103 |
private ActionFactory() { |
103 |
// no instantiation |
104 |
// no instantiation |
104 |
} |
105 |
} |
105 |
|
106 |
|
|
|
107 |
// No registration since shared instance gets created |
108 |
//@EditorActionRegistration(name = BaseKit.removeTabAction) |
106 |
public static class RemoveTabAction extends LocalBaseAction { |
109 |
public static class RemoveTabAction extends LocalBaseAction { |
107 |
|
110 |
|
108 |
static final long serialVersionUID =-1537748600593395706L; |
111 |
static final long serialVersionUID =-1537748600593395706L; |
109 |
|
112 |
|
110 |
public RemoveTabAction() { |
113 |
public RemoveTabAction() { |
111 |
super(BaseKit.removeTabAction, MAGIC_POSITION_RESET | ABBREV_RESET | WORD_MATCH_RESET); |
114 |
super(BaseKit.removeTabAction, |
|
|
115 |
MAGIC_POSITION_RESET | ABBREV_RESET | WORD_MATCH_RESET); |
112 |
} |
116 |
} |
113 |
|
117 |
|
114 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
118 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
Lines 197-206
Link Here
|
197 |
} |
201 |
} |
198 |
*/ |
202 |
*/ |
199 |
|
203 |
|
|
|
204 |
@EditorActionRegistration(name = BaseKit.removePreviousWordAction) |
200 |
public static class RemoveWordPreviousAction extends LocalBaseAction { |
205 |
public static class RemoveWordPreviousAction extends LocalBaseAction { |
201 |
|
206 |
|
202 |
public RemoveWordPreviousAction() { |
207 |
public RemoveWordPreviousAction() { |
203 |
super(BaseKit.removePreviousWordAction, MAGIC_POSITION_RESET |
208 |
super(MAGIC_POSITION_RESET |
204 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
209 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
205 |
} |
210 |
} |
206 |
|
211 |
|
Lines 233-244
Link Here
|
233 |
} |
238 |
} |
234 |
} |
239 |
} |
235 |
|
240 |
|
236 |
|
241 |
@EditorActionRegistration(name = BaseKit.removeNextWordAction) |
237 |
public static class RemoveWordNextAction extends LocalBaseAction { |
242 |
public static class RemoveWordNextAction extends LocalBaseAction { |
238 |
|
243 |
|
239 |
public RemoveWordNextAction() { |
244 |
public RemoveWordNextAction() { |
240 |
super(BaseKit.removeNextWordAction, MAGIC_POSITION_RESET |
245 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
241 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
242 |
} |
246 |
} |
243 |
|
247 |
|
244 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
248 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 271-283
Link Here
|
271 |
} |
275 |
} |
272 |
|
276 |
|
273 |
|
277 |
|
|
|
278 |
@EditorActionRegistration(name = BaseKit.removeLineBeginAction) |
274 |
public static class RemoveLineBeginAction extends LocalBaseAction { |
279 |
public static class RemoveLineBeginAction extends LocalBaseAction { |
275 |
|
280 |
|
276 |
static final long serialVersionUID =9193117196412195554L; |
281 |
static final long serialVersionUID =9193117196412195554L; |
277 |
|
282 |
|
278 |
public RemoveLineBeginAction() { |
283 |
public RemoveLineBeginAction() { |
279 |
super(BaseKit.removeLineBeginAction, MAGIC_POSITION_RESET |
284 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
280 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
281 |
} |
285 |
} |
282 |
|
286 |
|
283 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
287 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 321-333
Link Here
|
321 |
} |
325 |
} |
322 |
} |
326 |
} |
323 |
|
327 |
|
|
|
328 |
@EditorActionRegistration(name = BaseKit.removeLineAction) |
324 |
public static class RemoveLineAction extends LocalBaseAction { |
329 |
public static class RemoveLineAction extends LocalBaseAction { |
325 |
|
330 |
|
326 |
static final long serialVersionUID =-536315497241419877L; |
331 |
static final long serialVersionUID =-536315497241419877L; |
327 |
|
332 |
|
328 |
public RemoveLineAction() { |
333 |
public RemoveLineAction() { |
329 |
super(BaseKit.removeLineAction, MAGIC_POSITION_RESET |
334 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
330 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
331 |
} |
335 |
} |
332 |
|
336 |
|
333 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
337 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 359-371
Link Here
|
359 |
} |
363 |
} |
360 |
} |
364 |
} |
361 |
|
365 |
|
362 |
/* package */ static class MoveSelectionElseLineUpAction extends LocalBaseAction { |
366 |
@EditorActionRegistration(name = BaseKit.moveSelectionElseLineUpAction) |
|
|
367 |
public static class MoveSelectionElseLineUpAction extends LocalBaseAction { |
363 |
|
368 |
|
364 |
static final long serialVersionUID = 1L; |
369 |
static final long serialVersionUID = 1L; |
365 |
|
370 |
|
366 |
public MoveSelectionElseLineUpAction() { |
371 |
public MoveSelectionElseLineUpAction() { |
367 |
super(BaseKit.moveSelectionElseLineUpAction, MAGIC_POSITION_RESET |
372 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
368 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
369 |
} |
373 |
} |
370 |
|
374 |
|
371 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
375 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 455-467
Link Here
|
455 |
} |
459 |
} |
456 |
} |
460 |
} |
457 |
|
461 |
|
458 |
/* package */ static class MoveSelectionElseLineDownAction extends LocalBaseAction { |
462 |
@EditorActionRegistration(name = BaseKit.moveSelectionElseLineDownAction) |
|
|
463 |
public static class MoveSelectionElseLineDownAction extends LocalBaseAction { |
459 |
|
464 |
|
460 |
static final long serialVersionUID = 1L; |
465 |
static final long serialVersionUID = 1L; |
461 |
|
466 |
|
462 |
public MoveSelectionElseLineDownAction() { |
467 |
public MoveSelectionElseLineDownAction() { |
463 |
super(BaseKit.moveSelectionElseLineDownAction, MAGIC_POSITION_RESET |
468 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
464 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
465 |
} |
469 |
} |
466 |
|
470 |
|
467 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
471 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 552-564
Link Here
|
552 |
} |
556 |
} |
553 |
} |
557 |
} |
554 |
|
558 |
|
555 |
/* package */ static class CopySelectionElseLineUpAction extends LocalBaseAction { |
559 |
@EditorActionRegistration(name = BaseKit.copySelectionElseLineUpAction) |
|
|
560 |
public static class CopySelectionElseLineUpAction extends LocalBaseAction { |
556 |
|
561 |
|
557 |
static final long serialVersionUID = 1L; |
562 |
static final long serialVersionUID = 1L; |
558 |
|
563 |
|
559 |
public CopySelectionElseLineUpAction() { |
564 |
public CopySelectionElseLineUpAction() { |
560 |
super(BaseKit.copySelectionElseLineUpAction, MAGIC_POSITION_RESET |
565 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
561 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
562 |
} |
566 |
} |
563 |
|
567 |
|
564 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
568 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 639-651
Link Here
|
639 |
} |
643 |
} |
640 |
} |
644 |
} |
641 |
|
645 |
|
642 |
/* package */ static class CopySelectionElseLineDownAction extends LocalBaseAction { |
646 |
@EditorActionRegistration(name = BaseKit.copySelectionElseLineDownAction) |
|
|
647 |
public static class CopySelectionElseLineDownAction extends LocalBaseAction { |
643 |
|
648 |
|
644 |
static final long serialVersionUID = 1L; |
649 |
static final long serialVersionUID = 1L; |
645 |
|
650 |
|
646 |
public CopySelectionElseLineDownAction() { |
651 |
public CopySelectionElseLineDownAction() { |
647 |
super(BaseKit.copySelectionElseLineDownAction, MAGIC_POSITION_RESET |
652 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
648 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
649 |
} |
653 |
} |
650 |
|
654 |
|
651 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
655 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 727-739
Link Here
|
727 |
} |
731 |
} |
728 |
|
732 |
|
729 |
/* Useful for popup menu - remove selected block or do nothing */ |
733 |
/* Useful for popup menu - remove selected block or do nothing */ |
|
|
734 |
// No annotation registration since shared instance exists in BaseKit |
735 |
//@EditorActionRegistration(name = BaseKit.removeSelectionAction) |
730 |
public static class RemoveSelectionAction extends LocalBaseAction { |
736 |
public static class RemoveSelectionAction extends LocalBaseAction { |
731 |
|
737 |
|
732 |
static final long serialVersionUID =-1419424594746686573L; |
738 |
static final long serialVersionUID =-1419424594746686573L; |
733 |
|
739 |
|
734 |
public RemoveSelectionAction() { |
740 |
public RemoveSelectionAction() { |
735 |
super(BaseKit.removeSelectionAction, MAGIC_POSITION_RESET |
741 |
super(BaseKit.removeSelectionAction, |
736 |
| ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
742 |
MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
737 |
//#54893 putValue ("helpID", RemoveSelectionAction.class.getName ()); // NOI18N |
743 |
//#54893 putValue ("helpID", RemoveSelectionAction.class.getName ()); // NOI18N |
738 |
} |
744 |
} |
739 |
|
745 |
|
Lines 760-771
Link Here
|
760 |
} |
766 |
} |
761 |
|
767 |
|
762 |
/** Switch to overwrite mode or back to insert mode */ |
768 |
/** Switch to overwrite mode or back to insert mode */ |
|
|
769 |
@EditorActionRegistration(name = BaseKit.toggleTypingModeAction) |
763 |
public static class ToggleTypingModeAction extends LocalBaseAction { |
770 |
public static class ToggleTypingModeAction extends LocalBaseAction { |
764 |
|
771 |
|
765 |
static final long serialVersionUID =-2431132686507799723L; |
772 |
static final long serialVersionUID =-2431132686507799723L; |
766 |
|
773 |
|
767 |
public ToggleTypingModeAction() { |
774 |
public ToggleTypingModeAction() { |
768 |
super(BaseKit.toggleTypingModeAction); |
775 |
super(); |
769 |
} |
776 |
} |
770 |
|
777 |
|
771 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
778 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 916-921
Link Here
|
916 |
* @deprecated Without any replacement. This action is not used anymore. |
923 |
* @deprecated Without any replacement. This action is not used anymore. |
917 |
*/ |
924 |
*/ |
918 |
public static class StartMacroRecordingAction extends LocalBaseAction { |
925 |
public static class StartMacroRecordingAction extends LocalBaseAction { |
|
|
926 |
// Not registered by annotation since it's not actively used |
919 |
|
927 |
|
920 |
static final long serialVersionUID =1L; |
928 |
static final long serialVersionUID =1L; |
921 |
|
929 |
|
Lines 937-942
Link Here
|
937 |
* is no longer functional. |
945 |
* is no longer functional. |
938 |
*/ |
946 |
*/ |
939 |
public static class StopMacroRecordingAction extends LocalBaseAction { |
947 |
public static class StopMacroRecordingAction extends LocalBaseAction { |
|
|
948 |
// Not registered by annotation since it's not actively used |
940 |
|
949 |
|
941 |
static final long serialVersionUID =1L; |
950 |
static final long serialVersionUID =1L; |
942 |
|
951 |
|
Lines 1010-1022
Link Here
|
1010 |
|
1019 |
|
1011 |
public static class ChangeCaseAction extends LocalBaseAction { |
1020 |
public static class ChangeCaseAction extends LocalBaseAction { |
1012 |
|
1021 |
|
|
|
1022 |
@EditorActionRegistration(name = BaseKit.toUpperCaseAction) |
1023 |
public static ChangeCaseAction createToUpperCase() { |
1024 |
return new ChangeCaseAction(Utilities.CASE_UPPER); |
1025 |
} |
1026 |
|
1027 |
@EditorActionRegistration(name = BaseKit.toLowerCaseAction) |
1028 |
public static ChangeCaseAction createToLowerCase() { |
1029 |
return new ChangeCaseAction(Utilities.CASE_LOWER); |
1030 |
} |
1031 |
|
1032 |
@EditorActionRegistration(name = BaseKit.switchCaseAction) |
1033 |
public static ChangeCaseAction createSwitchCase() { |
1034 |
return new ChangeCaseAction(Utilities.CASE_SWITCH); |
1035 |
} |
1036 |
|
1013 |
int changeCaseMode; |
1037 |
int changeCaseMode; |
1014 |
|
1038 |
|
1015 |
static final long serialVersionUID =5680212865619897402L; |
1039 |
static final long serialVersionUID =5680212865619897402L; |
1016 |
|
1040 |
|
1017 |
public ChangeCaseAction(String name, int changeCaseMode) { |
1041 |
private ChangeCaseAction(int changeCaseMode) { |
1018 |
super(name, ABBREV_RESET |
1042 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
1019 |
| MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
1020 |
this.changeCaseMode = changeCaseMode; |
1043 |
this.changeCaseMode = changeCaseMode; |
1021 |
} |
1044 |
} |
1022 |
|
1045 |
|
Lines 1047-1062
Link Here
|
1047 |
} |
1070 |
} |
1048 |
} |
1071 |
} |
1049 |
|
1072 |
|
1050 |
|
1073 |
@EditorActionRegistration(name = BaseKit.findNextAction, |
|
|
1074 |
iconResource = "org/netbeans/modules/editor/resources/find_next.png") // NOI18N |
1051 |
public static class FindNextAction extends LocalBaseAction { |
1075 |
public static class FindNextAction extends LocalBaseAction { |
1052 |
|
1076 |
|
1053 |
static final long serialVersionUID =6878814427731642684L; |
1077 |
static final long serialVersionUID =6878814427731642684L; |
1054 |
|
1078 |
|
1055 |
public FindNextAction() { |
1079 |
public FindNextAction() { |
1056 |
super(BaseKit.findNextAction, ABBREV_RESET |
1080 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
1057 |
| MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
1058 |
putValue(BaseAction.ICON_RESOURCE_PROPERTY, |
1059 |
"org/netbeans/modules/editor/resources/find_next.png"); // NOI18N |
1060 |
} |
1081 |
} |
1061 |
|
1082 |
|
1062 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1083 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1066-1080
Link Here
|
1066 |
} |
1087 |
} |
1067 |
} |
1088 |
} |
1068 |
|
1089 |
|
|
|
1090 |
@EditorActionRegistration(name = BaseKit.findPreviousAction, |
1091 |
iconResource = "org/netbeans/modules/editor/resources/find_previous.png") // NOI18N |
1069 |
public static class FindPreviousAction extends LocalBaseAction { |
1092 |
public static class FindPreviousAction extends LocalBaseAction { |
1070 |
|
1093 |
|
1071 |
static final long serialVersionUID =-43746947902694926L; |
1094 |
static final long serialVersionUID =-43746947902694926L; |
1072 |
|
1095 |
|
1073 |
public FindPreviousAction() { |
1096 |
public FindPreviousAction() { |
1074 |
super(BaseKit.findPreviousAction, ABBREV_RESET |
1097 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
1075 |
| MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
1076 |
putValue(BaseAction.ICON_RESOURCE_PROPERTY, |
1077 |
"org/netbeans/modules/editor/resources/find_previous.png"); // NOI18N |
1078 |
} |
1098 |
} |
1079 |
|
1099 |
|
1080 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1100 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1087-1100
Link Here
|
1087 |
/** Finds either selection or if there's no selection it finds |
1107 |
/** Finds either selection or if there's no selection it finds |
1088 |
* the word where the cursor is standing. |
1108 |
* the word where the cursor is standing. |
1089 |
*/ |
1109 |
*/ |
|
|
1110 |
@EditorActionRegistration(name = BaseKit.findSelectionAction, |
1111 |
iconResource = "org/netbeans/modules/editor/resources/find_selection.png") // NOI18N |
1090 |
public static class FindSelectionAction extends LocalBaseAction { |
1112 |
public static class FindSelectionAction extends LocalBaseAction { |
1091 |
|
1113 |
|
1092 |
static final long serialVersionUID =-5601618936504699565L; |
1114 |
static final long serialVersionUID =-5601618936504699565L; |
1093 |
|
1115 |
|
1094 |
public FindSelectionAction() { |
1116 |
public FindSelectionAction() { |
1095 |
super(BaseKit.findSelectionAction); |
1117 |
super(); |
1096 |
putValue(BaseAction.ICON_RESOURCE_PROPERTY, |
|
|
1097 |
"org/netbeans/modules/editor/resources/find_selection.png"); // NOI18N |
1098 |
} |
1118 |
} |
1099 |
|
1119 |
|
1100 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1120 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1152-1164
Link Here
|
1152 |
} |
1172 |
} |
1153 |
} |
1173 |
} |
1154 |
|
1174 |
|
|
|
1175 |
@EditorActionRegistration(name = BaseKit.toggleHighlightSearchAction, |
1176 |
iconResource = "org/netbeans/modules/editor/resources/toggle_highlight.png") |
1155 |
public static class ToggleHighlightSearchAction extends LocalBaseAction implements Presenter.Toolbar { |
1177 |
public static class ToggleHighlightSearchAction extends LocalBaseAction implements Presenter.Toolbar { |
1156 |
|
1178 |
|
1157 |
static final long serialVersionUID =4603809175771743200L; |
1179 |
static final long serialVersionUID =4603809175771743200L; |
1158 |
|
1180 |
|
1159 |
public ToggleHighlightSearchAction() { |
1181 |
public ToggleHighlightSearchAction() { |
1160 |
super(BaseKit.toggleHighlightSearchAction, CLEAR_STATUS_TEXT); |
1182 |
super(CLEAR_STATUS_TEXT); |
1161 |
putValue(Action.SMALL_ICON, ImageUtilities.loadImageIcon("org/netbeans/modules/editor/resources/toggle_highlight.png", false)); // NOI18N |
|
|
1162 |
} |
1183 |
} |
1163 |
|
1184 |
|
1164 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1185 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1301-1322
Link Here
|
1301 |
} |
1322 |
} |
1302 |
} |
1323 |
} |
1303 |
|
1324 |
|
|
|
1325 |
@EditorActionRegistrations({ |
1326 |
@EditorActionRegistration(name = BaseKit.wordMatchNextAction, |
1327 |
iconResource = "org/netbeans/modules/editor/resources/next_matching.png"), |
1328 |
@EditorActionRegistration(name = BaseKit.wordMatchPrevAction, |
1329 |
iconResource = "org/netbeans/modules/editor/resources/previous_matching.png") |
1330 |
}) |
1304 |
public static class WordMatchAction extends LocalBaseAction { |
1331 |
public static class WordMatchAction extends LocalBaseAction { |
1305 |
|
1332 |
|
1306 |
private boolean direction; |
1333 |
private boolean matchNext; |
1307 |
|
1334 |
|
1308 |
static final long serialVersionUID =595571114685133170L; |
1335 |
static final long serialVersionUID =595571114685133170L; |
1309 |
|
1336 |
|
1310 |
public WordMatchAction(String name, boolean direction) { |
1337 |
public WordMatchAction() { |
1311 |
super(name, ABBREV_RESET |
1338 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
1312 |
| MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
1339 |
} |
1313 |
this.direction = direction; |
1340 |
|
1314 |
putValue(BaseAction.ICON_RESOURCE_PROPERTY, |
1341 |
@Override |
1315 |
direction |
1342 |
protected void actionNameUpdate(String actionName) { |
1316 |
? "org/netbeans/modules/editor/resources/next_matching.png" // NOI18N |
1343 |
super.actionNameUpdate(actionName); |
1317 |
: "org/netbeans/modules/editor/resources/previous_matching.png" // NOI18N |
1344 |
this.matchNext = BaseKit.wordMatchNextAction.equals(actionName); |
1318 |
); |
|
|
1319 |
|
1320 |
} |
1345 |
} |
1321 |
|
1346 |
|
1322 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
1347 |
public void actionPerformed(final ActionEvent evt, final JTextComponent target) { |
Lines 1336-1342
Link Here
|
1336 |
} |
1361 |
} |
1337 |
|
1362 |
|
1338 |
final int dotPos = caret.getDot(); |
1363 |
final int dotPos = caret.getDot(); |
1339 |
final String s = editorUI.getWordMatch().getMatchWord(dotPos, direction); |
1364 |
final String s = editorUI.getWordMatch().getMatchWord(dotPos, matchNext); |
1340 |
final String prevWord = editorUI.getWordMatch().getPreviousWord(); |
1365 |
final String prevWord = editorUI.getWordMatch().getPreviousWord(); |
1341 |
if (s != null) { |
1366 |
if (s != null) { |
1342 |
doc.runAtomicAsUser (new Runnable () { |
1367 |
doc.runAtomicAsUser (new Runnable () { |
Lines 1359-1382
Link Here
|
1359 |
} |
1384 |
} |
1360 |
} |
1385 |
} |
1361 |
} |
1386 |
} |
|
|
1387 |
|
1362 |
} |
1388 |
} |
1363 |
|
1389 |
|
1364 |
|
1390 |
|
|
|
1391 |
@EditorActionRegistrations({ |
1392 |
@EditorActionRegistration(name = BaseKit.shiftLineLeftAction, |
1393 |
iconResource = "org/netbeans/modules/editor/resources/shift_line_left.png"), |
1394 |
@EditorActionRegistration(name = BaseKit.shiftLineRightAction, |
1395 |
iconResource = "org/netbeans/modules/editor/resources/shift_line_right.png") |
1396 |
}) |
1365 |
public static class ShiftLineAction extends LocalBaseAction { |
1397 |
public static class ShiftLineAction extends LocalBaseAction { |
1366 |
|
1398 |
|
1367 |
boolean right; |
|
|
1368 |
|
1369 |
static final long serialVersionUID =-5124732597493699582L; |
1399 |
static final long serialVersionUID =-5124732597493699582L; |
1370 |
|
1400 |
|
1371 |
public ShiftLineAction(String name, boolean right) { |
1401 |
public ShiftLineAction() { |
1372 |
super(name, MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
1402 |
super(MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
1373 |
this.right = right; |
1403 |
} |
1374 |
putValue(BaseAction.ICON_RESOURCE_PROPERTY, |
|
|
1375 |
right |
1376 |
? "org/netbeans/modules/editor/resources/shift_line_right.png" // NOI18N |
1377 |
: "org/netbeans/modules/editor/resources/shift_line_left.png" // NOI18N |
1378 |
); |
1379 |
|
1404 |
|
|
|
1405 |
@Override |
1406 |
protected void actionNameUpdate(String actionName) { |
1407 |
super.actionNameUpdate(actionName); |
1380 |
} |
1408 |
} |
1381 |
|
1409 |
|
1382 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
1410 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 1393-1398
Link Here
|
1393 |
DocumentUtilities.setTypingModification(doc, true); |
1421 |
DocumentUtilities.setTypingModification(doc, true); |
1394 |
Formatter.pushFormattingContextDocument(doc); |
1422 |
Formatter.pushFormattingContextDocument(doc); |
1395 |
try { |
1423 |
try { |
|
|
1424 |
boolean right = BaseKit.shiftLineRightAction.equals(getValue(Action.NAME)); |
1396 |
if (Utilities.isSelectionShowing(caret)) { |
1425 |
if (Utilities.isSelectionShowing(caret)) { |
1397 |
doc.getFormatter().changeBlockIndent(doc, |
1426 |
doc.getFormatter().changeBlockIndent(doc, |
1398 |
target.getSelectionStart(), target.getSelectionEnd(), |
1427 |
target.getSelectionStart(), target.getSelectionEnd(), |
Lines 1414-1427
Link Here
|
1414 |
} |
1443 |
} |
1415 |
} |
1444 |
} |
1416 |
|
1445 |
|
|
|
1446 |
@EditorActionRegistration(name = BaseKit.reindentLineAction) |
1417 |
public static class ReindentLineAction extends LocalBaseAction { |
1447 |
public static class ReindentLineAction extends LocalBaseAction { |
1418 |
|
1448 |
|
1419 |
static final long serialVersionUID =1L; |
1449 |
static final long serialVersionUID =1L; |
1420 |
|
1450 |
|
1421 |
public ReindentLineAction() { |
1451 |
public ReindentLineAction() { |
1422 |
// TODO: figure out what these flags are all about |
1452 |
// TODO: figure out what these flags are all about |
1423 |
super(BaseKit.reindentLineAction, |
1453 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
1424 |
ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
|
|
1425 |
//putValue ("helpID", ReindentLineAction.class.getName ()); |
1454 |
//putValue ("helpID", ReindentLineAction.class.getName ()); |
1426 |
} |
1455 |
} |
1427 |
|
1456 |
|
Lines 1495-1506
Link Here
|
1495 |
|
1524 |
|
1496 |
public static class AdjustWindowAction extends LocalBaseAction { |
1525 |
public static class AdjustWindowAction extends LocalBaseAction { |
1497 |
|
1526 |
|
|
|
1527 |
@EditorActionRegistration(name = BaseKit.adjustWindowTopAction) |
1528 |
public static AdjustWindowAction createAdjustTop() { |
1529 |
return new AdjustWindowAction(0); |
1530 |
} |
1531 |
|
1532 |
@EditorActionRegistration(name = BaseKit.adjustWindowCenterAction) |
1533 |
public static AdjustWindowAction createAdjustCenter() { |
1534 |
return new AdjustWindowAction(50); |
1535 |
} |
1536 |
|
1537 |
@EditorActionRegistration(name = BaseKit.adjustWindowBottomAction) |
1538 |
public static AdjustWindowAction createAdjustBottom() { |
1539 |
return new AdjustWindowAction(100); |
1540 |
} |
1541 |
|
1498 |
int percentFromWindowTop; |
1542 |
int percentFromWindowTop; |
1499 |
|
1543 |
|
1500 |
static final long serialVersionUID =8864278998999643292L; |
1544 |
static final long serialVersionUID =8864278998999643292L; |
1501 |
|
1545 |
|
1502 |
public AdjustWindowAction(String name, int percentFromWindowTop) { |
1546 |
public AdjustWindowAction(int percentFromWindowTop) { |
1503 |
super(name); |
|
|
1504 |
this.percentFromWindowTop = percentFromWindowTop; |
1547 |
this.percentFromWindowTop = percentFromWindowTop; |
1505 |
} |
1548 |
} |
1506 |
|
1549 |
|
Lines 1513-1524
Link Here
|
1513 |
|
1556 |
|
1514 |
public static class AdjustCaretAction extends LocalBaseAction { |
1557 |
public static class AdjustCaretAction extends LocalBaseAction { |
1515 |
|
1558 |
|
|
|
1559 |
@EditorActionRegistration(name = BaseKit.adjustCaretTopAction) |
1560 |
public static AdjustCaretAction createAdjustTop() { |
1561 |
return new AdjustCaretAction(0); |
1562 |
} |
1563 |
|
1564 |
@EditorActionRegistration(name = BaseKit.adjustCaretCenterAction) |
1565 |
public static AdjustCaretAction createAdjustCenter() { |
1566 |
return new AdjustCaretAction(50); |
1567 |
} |
1568 |
|
1569 |
@EditorActionRegistration(name = BaseKit.adjustCaretBottomAction) |
1570 |
public static AdjustCaretAction createAdjustBottom() { |
1571 |
return new AdjustCaretAction(100); |
1572 |
} |
1573 |
|
1516 |
int percentFromWindowTop; |
1574 |
int percentFromWindowTop; |
1517 |
|
1575 |
|
1518 |
static final long serialVersionUID =3223383913531191066L; |
1576 |
static final long serialVersionUID =3223383913531191066L; |
1519 |
|
1577 |
|
1520 |
public AdjustCaretAction(String name, int percentFromWindowTop) { |
1578 |
public AdjustCaretAction(int percentFromWindowTop) { |
1521 |
super(name); |
|
|
1522 |
this.percentFromWindowTop = percentFromWindowTop; |
1579 |
this.percentFromWindowTop = percentFromWindowTop; |
1523 |
} |
1580 |
} |
1524 |
|
1581 |
|
Lines 1529-1541
Link Here
|
1529 |
} |
1586 |
} |
1530 |
} |
1587 |
} |
1531 |
|
1588 |
|
|
|
1589 |
@EditorActionRegistration(name = BaseKit.formatAction) |
1532 |
public static class FormatAction extends LocalBaseAction { |
1590 |
public static class FormatAction extends LocalBaseAction { |
1533 |
|
1591 |
|
1534 |
static final long serialVersionUID =-7666172828961171865L; |
1592 |
static final long serialVersionUID =-7666172828961171865L; |
1535 |
|
1593 |
|
1536 |
public FormatAction() { |
1594 |
public FormatAction() { |
1537 |
super(BaseKit.formatAction, |
1595 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
1538 |
ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
|
|
1539 |
//#54893 putValue ("helpID", FormatAction.class.getName ()); // NOI18N |
1596 |
//#54893 putValue ("helpID", FormatAction.class.getName ()); // NOI18N |
1540 |
} |
1597 |
} |
1541 |
|
1598 |
|
Lines 1619-1634
Link Here
|
1619 |
|
1676 |
|
1620 |
} |
1677 |
} |
1621 |
|
1678 |
|
|
|
1679 |
@EditorActionRegistrations({ |
1680 |
@EditorActionRegistration(name = BaseKit.firstNonWhiteAction), |
1681 |
@EditorActionRegistration(name = BaseKit.selectionFirstNonWhiteAction) |
1682 |
}) |
1622 |
public static class FirstNonWhiteAction extends LocalBaseAction { |
1683 |
public static class FirstNonWhiteAction extends LocalBaseAction { |
1623 |
|
1684 |
|
1624 |
boolean select; |
|
|
1625 |
|
1626 |
static final long serialVersionUID =-5888439539790901158L; |
1685 |
static final long serialVersionUID =-5888439539790901158L; |
1627 |
|
1686 |
|
1628 |
public FirstNonWhiteAction(String nm, boolean select) { |
1687 |
public FirstNonWhiteAction() { |
1629 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
1688 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
1630 |
| WORD_MATCH_RESET); |
|
|
1631 |
this.select = select; |
1632 |
} |
1689 |
} |
1633 |
|
1690 |
|
1634 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1691 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1638-1643
Link Here
|
1638 |
int pos = Utilities.getRowFirstNonWhite((BaseDocument)target.getDocument(), |
1695 |
int pos = Utilities.getRowFirstNonWhite((BaseDocument)target.getDocument(), |
1639 |
caret.getDot()); |
1696 |
caret.getDot()); |
1640 |
if (pos >= 0) { |
1697 |
if (pos >= 0) { |
|
|
1698 |
boolean select = BaseKit.selectionFirstNonWhiteAction.equals(getValue(Action.NAME)); |
1641 |
if (select) { |
1699 |
if (select) { |
1642 |
caret.moveDot(pos); |
1700 |
caret.moveDot(pos); |
1643 |
} else { |
1701 |
} else { |
Lines 1651-1666
Link Here
|
1651 |
} |
1709 |
} |
1652 |
} |
1710 |
} |
1653 |
|
1711 |
|
|
|
1712 |
@EditorActionRegistrations({ |
1713 |
@EditorActionRegistration(name = BaseKit.lastNonWhiteAction), |
1714 |
@EditorActionRegistration(name = BaseKit.selectionLastNonWhiteAction) |
1715 |
}) |
1654 |
public static class LastNonWhiteAction extends LocalBaseAction { |
1716 |
public static class LastNonWhiteAction extends LocalBaseAction { |
1655 |
|
1717 |
|
1656 |
boolean select; |
|
|
1657 |
|
1658 |
static final long serialVersionUID =4503533041729712917L; |
1718 |
static final long serialVersionUID =4503533041729712917L; |
1659 |
|
1719 |
|
1660 |
public LastNonWhiteAction(String nm, boolean select) { |
1720 |
public LastNonWhiteAction() { |
1661 |
super(nm, MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET |
1721 |
super(MAGIC_POSITION_RESET | ABBREV_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
1662 |
| WORD_MATCH_RESET); |
|
|
1663 |
this.select = select; |
1664 |
} |
1722 |
} |
1665 |
|
1723 |
|
1666 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1724 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1670-1675
Link Here
|
1670 |
int pos = Utilities.getRowLastNonWhite((BaseDocument)target.getDocument(), |
1728 |
int pos = Utilities.getRowLastNonWhite((BaseDocument)target.getDocument(), |
1671 |
caret.getDot()); |
1729 |
caret.getDot()); |
1672 |
if (pos >= 0) { |
1730 |
if (pos >= 0) { |
|
|
1731 |
boolean select = BaseKit.selectionLastNonWhiteAction.equals(getValue(Action.NAME)); |
1673 |
if (select) { |
1732 |
if (select) { |
1674 |
caret.moveDot(pos); |
1733 |
caret.moveDot(pos); |
1675 |
} else { |
1734 |
} else { |
Lines 1683-1694
Link Here
|
1683 |
} |
1742 |
} |
1684 |
} |
1743 |
} |
1685 |
|
1744 |
|
|
|
1745 |
@EditorActionRegistration(name = BaseKit.selectIdentifierAction) |
1686 |
public static class SelectIdentifierAction extends LocalBaseAction { |
1746 |
public static class SelectIdentifierAction extends LocalBaseAction { |
1687 |
|
1747 |
|
1688 |
static final long serialVersionUID =-7288216961333147873L; |
1748 |
static final long serialVersionUID =-7288216961333147873L; |
1689 |
|
1749 |
|
1690 |
public SelectIdentifierAction() { |
1750 |
public SelectIdentifierAction() { |
1691 |
super(BaseKit.selectIdentifierAction, MAGIC_POSITION_RESET); |
1751 |
super(MAGIC_POSITION_RESET); |
1692 |
} |
1752 |
} |
1693 |
|
1753 |
|
1694 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1754 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1712-1717
Link Here
|
1712 |
} |
1772 |
} |
1713 |
} |
1773 |
} |
1714 |
|
1774 |
|
|
|
1775 |
@EditorActionRegistration(name = BaseKit.selectNextParameterAction) |
1715 |
public static class SelectNextParameterAction extends LocalBaseAction { |
1776 |
public static class SelectNextParameterAction extends LocalBaseAction { |
1716 |
|
1777 |
|
1717 |
static final long serialVersionUID =8045372985336370934L; |
1778 |
static final long serialVersionUID =8045372985336370934L; |
Lines 1762-1767
Link Here
|
1762 |
* in the editor module. |
1823 |
* in the editor module. |
1763 |
*/ |
1824 |
*/ |
1764 |
public static class JumpListNextAction extends LocalBaseAction { |
1825 |
public static class JumpListNextAction extends LocalBaseAction { |
|
|
1826 |
// Not registered by annotation since it's not actively used |
1765 |
|
1827 |
|
1766 |
static final long serialVersionUID =6891721278404990446L; |
1828 |
static final long serialVersionUID =6891721278404990446L; |
1767 |
PropertyChangeListener pcl; |
1829 |
PropertyChangeListener pcl; |
Lines 1790-1795
Link Here
|
1790 |
* in the editor module. |
1852 |
* in the editor module. |
1791 |
*/ |
1853 |
*/ |
1792 |
public static class JumpListPrevAction extends LocalBaseAction { |
1854 |
public static class JumpListPrevAction extends LocalBaseAction { |
|
|
1855 |
// Not registered by annotation since it's not actively used |
1793 |
|
1856 |
|
1794 |
static final long serialVersionUID =7174907031986424265L; |
1857 |
static final long serialVersionUID =7174907031986424265L; |
1795 |
PropertyChangeListener pcl; |
1858 |
PropertyChangeListener pcl; |
Lines 1818-1823
Link Here
|
1818 |
* in the editor module. |
1881 |
* in the editor module. |
1819 |
*/ |
1882 |
*/ |
1820 |
public static class JumpListNextComponentAction extends LocalBaseAction { |
1883 |
public static class JumpListNextComponentAction extends LocalBaseAction { |
|
|
1884 |
// Not registered by annotation since it's not actively used |
1821 |
|
1885 |
|
1822 |
static final long serialVersionUID =-2059070050865876892L; |
1886 |
static final long serialVersionUID =-2059070050865876892L; |
1823 |
|
1887 |
|
Lines 1837-1842
Link Here
|
1837 |
* in the editor module. |
1901 |
* in the editor module. |
1838 |
*/ |
1902 |
*/ |
1839 |
public static class JumpListPrevComponentAction extends LocalBaseAction { |
1903 |
public static class JumpListPrevComponentAction extends LocalBaseAction { |
|
|
1904 |
// Not registered by annotation since it's not actively used |
1840 |
|
1905 |
|
1841 |
static final long serialVersionUID =2032230534727849525L; |
1906 |
static final long serialVersionUID =2032230534727849525L; |
1842 |
|
1907 |
|
Lines 1851-1860
Link Here
|
1851 |
} |
1916 |
} |
1852 |
} |
1917 |
} |
1853 |
|
1918 |
|
|
|
1919 |
@EditorActionRegistration(name = BaseKit.scrollUpAction) |
1854 |
public static class ScrollUpAction extends LocalBaseAction { |
1920 |
public static class ScrollUpAction extends LocalBaseAction { |
1855 |
|
1921 |
|
1856 |
public ScrollUpAction() { |
1922 |
public ScrollUpAction() { |
1857 |
super(BaseKit.scrollUpAction); |
|
|
1858 |
} |
1923 |
} |
1859 |
|
1924 |
|
1860 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1925 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1869-1878
Link Here
|
1869 |
|
1934 |
|
1870 |
} |
1935 |
} |
1871 |
|
1936 |
|
|
|
1937 |
@EditorActionRegistration(name = BaseKit.scrollDownAction) |
1872 |
public static class ScrollDownAction extends LocalBaseAction { |
1938 |
public static class ScrollDownAction extends LocalBaseAction { |
1873 |
|
1939 |
|
1874 |
public ScrollDownAction() { |
1940 |
public ScrollDownAction() { |
1875 |
super(BaseKit.scrollDownAction); |
|
|
1876 |
} |
1941 |
} |
1877 |
|
1942 |
|
1878 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1943 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1887-1899
Link Here
|
1887 |
|
1952 |
|
1888 |
} |
1953 |
} |
1889 |
|
1954 |
|
|
|
1955 |
@EditorActionRegistration(name = BaseKit.insertDateTimeAction) |
1890 |
public static class InsertDateTimeAction extends LocalBaseAction { |
1956 |
public static class InsertDateTimeAction extends LocalBaseAction { |
1891 |
|
1957 |
|
1892 |
static final long serialVersionUID =2865619897402L; |
1958 |
static final long serialVersionUID =2865619897402L; |
1893 |
|
1959 |
|
1894 |
public InsertDateTimeAction() { |
1960 |
public InsertDateTimeAction() { |
1895 |
super(BaseKit.insertDateTimeAction, |
1961 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
1896 |
ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET | WORD_MATCH_RESET); |
|
|
1897 |
} |
1962 |
} |
1898 |
|
1963 |
|
1899 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
1964 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1921-1932
Link Here
|
1921 |
} |
1986 |
} |
1922 |
|
1987 |
|
1923 |
/** Select text of whole document */ |
1988 |
/** Select text of whole document */ |
|
|
1989 |
@EditorActionRegistration(name = BaseKit.generateGutterPopupAction) |
1924 |
public static class GenerateGutterPopupAction extends LocalBaseAction { |
1990 |
public static class GenerateGutterPopupAction extends LocalBaseAction { |
1925 |
|
1991 |
|
1926 |
static final long serialVersionUID =-3502499718130556525L; |
1992 |
static final long serialVersionUID =-3502499718130556525L; |
1927 |
|
1993 |
|
1928 |
public GenerateGutterPopupAction() { |
1994 |
public GenerateGutterPopupAction() { |
1929 |
super(BaseKit.generateGutterPopupAction); |
|
|
1930 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1995 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1931 |
} |
1996 |
} |
1932 |
|
1997 |
|
Lines 1945-1950
Link Here
|
1945 |
} |
2010 |
} |
1946 |
|
2011 |
|
1947 |
/** Switch visibility of line numbers in editor */ |
2012 |
/** Switch visibility of line numbers in editor */ |
|
|
2013 |
@EditorActionRegistration(name = BaseKit.toggleLineNumbersAction) |
1948 |
public static class ToggleLineNumbersAction extends LocalBaseAction { |
2014 |
public static class ToggleLineNumbersAction extends LocalBaseAction { |
1949 |
|
2015 |
|
1950 |
static final long serialVersionUID =-3502499718130556526L; |
2016 |
static final long serialVersionUID =-3502499718130556526L; |
Lines 1952-1958
Link Here
|
1952 |
private JCheckBoxMenuItem item = null; |
2018 |
private JCheckBoxMenuItem item = null; |
1953 |
|
2019 |
|
1954 |
public ToggleLineNumbersAction() { |
2020 |
public ToggleLineNumbersAction() { |
1955 |
super(BaseKit.toggleLineNumbersAction); |
2021 |
super(BaseKit.toggleLineNumbersAction); // Due to creation from MainMenuAction |
1956 |
} |
2022 |
} |
1957 |
|
2023 |
|
1958 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2024 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 1981-1990
Link Here
|
1981 |
} |
2047 |
} |
1982 |
|
2048 |
|
1983 |
/** Cycle through annotations on the current line */ |
2049 |
/** Cycle through annotations on the current line */ |
|
|
2050 |
@EditorActionRegistration(name = BaseKit.annotationsCyclingAction) |
1984 |
public static class AnnotationsCyclingAction extends LocalBaseAction { |
2051 |
public static class AnnotationsCyclingAction extends LocalBaseAction { |
1985 |
|
2052 |
|
1986 |
public AnnotationsCyclingAction() { |
2053 |
public AnnotationsCyclingAction() { |
1987 |
super(BaseKit.annotationsCyclingAction); |
|
|
1988 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
2054 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
1989 |
} |
2055 |
} |
1990 |
|
2056 |
|
Lines 2079-2087
Link Here
|
2079 |
} |
2145 |
} |
2080 |
|
2146 |
|
2081 |
/** Collapse a fold. Depends on the current caret position. */ |
2147 |
/** Collapse a fold. Depends on the current caret position. */ |
|
|
2148 |
@EditorActionRegistration(name = BaseKit.collapseFoldAction) |
2082 |
public static class CollapseFold extends LocalBaseAction { |
2149 |
public static class CollapseFold extends LocalBaseAction { |
2083 |
public CollapseFold(){ |
2150 |
public CollapseFold(){ |
2084 |
super(BaseKit.collapseFoldAction); |
|
|
2085 |
} |
2151 |
} |
2086 |
|
2152 |
|
2087 |
private boolean dotInFoldArea(JTextComponent target, Fold fold, int dot) throws BadLocationException{ |
2153 |
private boolean dotInFoldArea(JTextComponent target, Fold fold, int dot) throws BadLocationException{ |
Lines 2121-2129
Link Here
|
2121 |
} |
2187 |
} |
2122 |
|
2188 |
|
2123 |
/** Expand a fold. Depends on the current caret position. */ |
2189 |
/** Expand a fold. Depends on the current caret position. */ |
|
|
2190 |
@EditorActionRegistration(name = BaseKit.expandFoldAction) |
2124 |
public static class ExpandFold extends LocalBaseAction { |
2191 |
public static class ExpandFold extends LocalBaseAction { |
2125 |
public ExpandFold(){ |
2192 |
public ExpandFold(){ |
2126 |
super(BaseKit.expandFoldAction); |
|
|
2127 |
} |
2193 |
} |
2128 |
|
2194 |
|
2129 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2195 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2148-2156
Link Here
|
2148 |
} |
2214 |
} |
2149 |
|
2215 |
|
2150 |
/** Collapse all existing folds in the document. */ |
2216 |
/** Collapse all existing folds in the document. */ |
|
|
2217 |
@EditorActionRegistration(name = BaseKit.collapseAllFoldsAction) |
2151 |
public static class CollapseAllFolds extends LocalBaseAction { |
2218 |
public static class CollapseAllFolds extends LocalBaseAction { |
2152 |
public CollapseAllFolds(){ |
2219 |
public CollapseAllFolds(){ |
2153 |
super(BaseKit.collapseAllFoldsAction); |
|
|
2154 |
} |
2220 |
} |
2155 |
|
2221 |
|
2156 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2222 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2161-2169
Link Here
|
2161 |
} |
2227 |
} |
2162 |
|
2228 |
|
2163 |
/** Expand all existing folds in the document. */ |
2229 |
/** Expand all existing folds in the document. */ |
|
|
2230 |
@EditorActionRegistration(name = BaseKit.expandAllFoldsAction) |
2164 |
public static class ExpandAllFolds extends LocalBaseAction { |
2231 |
public static class ExpandAllFolds extends LocalBaseAction { |
2165 |
public ExpandAllFolds(){ |
2232 |
public ExpandAllFolds(){ |
2166 |
super(BaseKit.expandAllFoldsAction); |
|
|
2167 |
} |
2233 |
} |
2168 |
|
2234 |
|
2169 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
2235 |
public void actionPerformed(ActionEvent evt, JTextComponent target) { |
Lines 2174-2183
Link Here
|
2174 |
} |
2240 |
} |
2175 |
|
2241 |
|
2176 |
/** Expand all existing folds in the document. */ |
2242 |
/** Expand all existing folds in the document. */ |
|
|
2243 |
@EditorActionRegistration(name = "dump-view-hierarchy") |
2177 |
public static class DumpViewHierarchyAction extends LocalBaseAction { |
2244 |
public static class DumpViewHierarchyAction extends LocalBaseAction { |
2178 |
|
2245 |
|
2179 |
public DumpViewHierarchyAction() { |
2246 |
public DumpViewHierarchyAction() { |
2180 |
super("dump-view-hierarchy"); // NOI18N |
|
|
2181 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
2247 |
putValue(BaseAction.NO_KEYBINDING, Boolean.TRUE); |
2182 |
} |
2248 |
} |
2183 |
|
2249 |
|
Lines 2223-2232
Link Here
|
2223 |
} |
2289 |
} |
2224 |
|
2290 |
|
2225 |
/** Starts a new line in code. */ |
2291 |
/** Starts a new line in code. */ |
|
|
2292 |
@EditorActionRegistration(name = BaseKit.startNewLineAction) |
2226 |
public static class StartNewLine extends LocalBaseAction { |
2293 |
public static class StartNewLine extends LocalBaseAction { |
2227 |
public StartNewLine(){ |
2294 |
public StartNewLine(){ |
2228 |
super( BaseKit.startNewLineAction, ABBREV_RESET |
2295 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
2229 |
| MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
|
|
2230 |
} |
2296 |
} |
2231 |
|
2297 |
|
2232 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
2298 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 2268-2289
Link Here
|
2268 |
* Cut text from the caret position to either begining or end |
2334 |
* Cut text from the caret position to either begining or end |
2269 |
* of the line with the caret. |
2335 |
* of the line with the caret. |
2270 |
*/ |
2336 |
*/ |
|
|
2337 |
@EditorActionRegistrations({ |
2338 |
@EditorActionRegistration(name = BaseKit.cutToLineBeginAction), |
2339 |
@EditorActionRegistration(name = BaseKit.cutToLineEndAction) |
2340 |
}) |
2271 |
public static class CutToLineBeginOrEndAction extends LocalBaseAction { |
2341 |
public static class CutToLineBeginOrEndAction extends LocalBaseAction { |
2272 |
|
2342 |
|
2273 |
/** |
2343 |
/** |
2274 |
* Whether cutting to line end instead of line begin. |
|
|
2275 |
*/ |
2276 |
private final boolean toLineEnd; |
2277 |
|
2278 |
/** |
2279 |
* Construct new action. |
2344 |
* Construct new action. |
2280 |
* |
2345 |
* |
2281 |
* @param toLineEnd whether cutting to line end instead of line begin. |
2346 |
* @param toLineEnd whether cutting to line end instead of line begin. |
2282 |
*/ |
2347 |
*/ |
2283 |
public CutToLineBeginOrEndAction(boolean toLineEnd) { |
2348 |
public CutToLineBeginOrEndAction() { |
2284 |
super(toLineEnd ? BaseKit.cutToLineEndAction : BaseKit.cutToLineBeginAction, |
2349 |
super(ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
2285 |
ABBREV_RESET | MAGIC_POSITION_RESET | UNDO_MERGE_RESET); |
|
|
2286 |
this.toLineEnd = toLineEnd; |
2287 |
} |
2350 |
} |
2288 |
|
2351 |
|
2289 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
2352 |
public void actionPerformed (final ActionEvent evt, final JTextComponent target) { |
Lines 2304-2309
Link Here
|
2304 |
if (actionMap != null && (cutAction = actionMap.get(DefaultEditorKit.cutAction)) != null) { |
2367 |
if (actionMap != null && (cutAction = actionMap.get(DefaultEditorKit.cutAction)) != null) { |
2305 |
Caret caret = target.getCaret(); |
2368 |
Caret caret = target.getCaret(); |
2306 |
int caretOffset = caret.getDot(); |
2369 |
int caretOffset = caret.getDot(); |
|
|
2370 |
boolean toLineEnd = BaseKit.cutToLineEndAction.equals(getValue(Action.NAME)); |
2307 |
int boundOffset = toLineEnd |
2371 |
int boundOffset = toLineEnd |
2308 |
? Utilities.getRowEnd(target, caretOffset) |
2372 |
? Utilities.getRowEnd(target, caretOffset) |
2309 |
: Utilities.getRowStart(target, caretOffset); |
2373 |
: Utilities.getRowStart(target, caretOffset); |