Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 226732 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/ide/WorkbenchActionBuilder.java (-69 / +192 lines)
Lines 37-42 Link Here
37
import org.eclipse.swt.SWT;
37
import org.eclipse.swt.SWT;
38
import org.eclipse.swt.widgets.Shell;
38
import org.eclipse.swt.widgets.Shell;
39
import org.eclipse.ui.IPageListener;
39
import org.eclipse.ui.IPageListener;
40
import org.eclipse.ui.ISharedImages;
40
import org.eclipse.ui.IWorkbenchActionConstants;
41
import org.eclipse.ui.IWorkbenchActionConstants;
41
import org.eclipse.ui.IWorkbenchPage;
42
import org.eclipse.ui.IWorkbenchPage;
42
import org.eclipse.ui.IWorkbenchWindow;
43
import org.eclipse.ui.IWorkbenchWindow;
Lines 50-61 Link Here
50
import org.eclipse.ui.ide.IDEActionFactory;
51
import org.eclipse.ui.ide.IDEActionFactory;
51
import org.eclipse.ui.ide.IIDEActionConstants;
52
import org.eclipse.ui.ide.IIDEActionConstants;
52
import org.eclipse.ui.internal.IPreferenceConstants;
53
import org.eclipse.ui.internal.IPreferenceConstants;
54
import org.eclipse.ui.internal.IWorkbenchHelpContextIds;
55
import org.eclipse.ui.internal.WorkbenchMessages;
53
import org.eclipse.ui.internal.WorkbenchPlugin;
56
import org.eclipse.ui.internal.WorkbenchPlugin;
54
import org.eclipse.ui.internal.ide.actions.BuildSetMenu;
57
import org.eclipse.ui.internal.ide.actions.BuildSetMenu;
55
import org.eclipse.ui.internal.ide.actions.BuildUtilities;
58
import org.eclipse.ui.internal.ide.actions.BuildUtilities;
56
import org.eclipse.ui.internal.ide.actions.QuickMenuAction;
59
import org.eclipse.ui.internal.ide.actions.QuickMenuAction;
57
import org.eclipse.ui.internal.ide.actions.RetargetActionWithDefault;
60
import org.eclipse.ui.internal.ide.actions.RetargetActionWithDefault;
58
import org.eclipse.ui.internal.provisional.application.IActionBarConfigurer2;
61
import org.eclipse.ui.internal.provisional.application.IActionBarConfigurer2;
62
import org.eclipse.ui.menus.CommandContributionItem;
63
import org.eclipse.ui.menus.CommandContributionItemParameter;
59
import org.eclipse.ui.menus.IMenuService;
64
import org.eclipse.ui.menus.IMenuService;
60
65
61
/**
66
/**
Lines 144-174 Link Here
144
149
145
    private IWorkbenchAction redoAction;
150
    private IWorkbenchAction redoAction;
146
151
147
    private IWorkbenchAction cutAction;
152
    private CommandContributionItem cutItem;
148
153
149
    private IWorkbenchAction copyAction;
154
    private CommandContributionItem copyItem;
150
155
151
    private IWorkbenchAction pasteAction;
156
    private CommandContributionItem pasteItem;
152
157
153
    private IWorkbenchAction deleteAction;
158
    private CommandContributionItem deleteItem;
154
159
155
    private IWorkbenchAction selectAllAction;
160
    private CommandContributionItem selectAllItem;
156
161
157
    private IWorkbenchAction findAction;
162
    private CommandContributionItem findItem;
158
163
159
    private IWorkbenchAction printAction;
164
    private CommandContributionItem printMenuItem;
165
    private CommandContributionItem printToolItem;
160
166
161
    private IWorkbenchAction revertAction;
167
    private CommandContributionItem revertItem;
162
168
163
    private IWorkbenchAction refreshAction;
169
    private CommandContributionItem refreshItem;
164
170
165
    private IWorkbenchAction propertiesAction;
171
    private CommandContributionItem propertiesItem;
166
172
167
    private IWorkbenchAction quitAction;
173
    private IWorkbenchAction quitAction;
168
174
169
    private IWorkbenchAction moveAction;
175
    private CommandContributionItem moveItem;
170
176
171
    private IWorkbenchAction renameAction;
177
    private CommandContributionItem renameItem;
172
178
173
    private IWorkbenchAction goIntoAction;
179
    private IWorkbenchAction goIntoAction;
174
180
Lines 389-395 Link Here
389
            fileToolBar.add(saveAction);
395
            fileToolBar.add(saveAction);
390
            fileToolBar
396
            fileToolBar
391
                    .add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
397
                    .add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
392
            fileToolBar.add(printAction);
398
            fileToolBar.add(printToolItem);
393
            fileToolBar
399
            fileToolBar
394
                    .add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
400
                    .add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
395
401
Lines 484-498 Link Here
484
        menu.add(saveAction);
490
        menu.add(saveAction);
485
        menu.add(saveAsAction);
491
        menu.add(saveAsAction);
486
        menu.add(saveAllAction);
492
        menu.add(saveAllAction);
487
        menu.add(revertAction);
493
        menu.add(revertItem);
488
        menu.add(new Separator());
494
        menu.add(new Separator());
489
        menu.add(moveAction);
495
        menu.add(moveItem);
490
        menu.add(renameAction);
496
        menu.add(renameItem);
491
        menu.add(refreshAction);
497
        menu.add(refreshItem);
492
498
493
        menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
499
        menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
494
        menu.add(new Separator());
500
        menu.add(new Separator());
495
        menu.add(printAction);
501
        menu.add(printMenuItem);
496
        menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
502
        menu.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
497
        menu.add(new Separator());
503
        menu.add(new Separator());
498
        menu.add(openWorkspaceAction);
504
        menu.add(openWorkspaceAction);
Lines 504-510 Link Here
504
        menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
510
        menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
505
511
506
        menu.add(new Separator());
512
        menu.add(new Separator());
507
        menu.add(propertiesAction);
513
        menu.add(propertiesItem);
508
514
509
        menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow()));
515
        menu.add(ContributionItemFactory.REOPEN_EDITORS.create(getWindow()));
510
        menu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
516
        menu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
Lines 534-550 Link Here
534
        menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
540
        menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
535
        menu.add(new Separator());
541
        menu.add(new Separator());
536
542
537
        menu.add(cutAction);
543
        menu.add(cutItem);
538
        menu.add(copyAction);
544
        menu.add(copyItem);
539
        menu.add(pasteAction);
545
        menu.add(pasteItem);
540
        menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
546
        menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
541
        menu.add(new Separator());
547
        menu.add(new Separator());
542
548
543
        menu.add(deleteAction);
549
        menu.add(deleteItem);
544
        menu.add(selectAllAction);
550
        menu.add(selectAllItem);
545
        menu.add(new Separator());
551
        menu.add(new Separator());
546
552
547
        menu.add(findAction);
553
        menu.add(findItem);
548
        menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
554
        menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
549
        menu.add(new Separator());
555
        menu.add(new Separator());
550
556
Lines 861-879 Link Here
861
        forwardHistoryAction = null;
867
        forwardHistoryAction = null;
862
        undoAction = null;
868
        undoAction = null;
863
        redoAction = null;
869
        redoAction = null;
864
        cutAction = null;
870
        cutItem = null;
865
        copyAction = null;
871
        copyItem = null;
866
        pasteAction = null;
872
        pasteItem = null;
867
        deleteAction = null;
873
        deleteItem = null;
868
        selectAllAction = null;
874
        selectAllItem = null;
869
        findAction = null;
875
        findItem = null;
870
        printAction = null;
876
        printMenuItem = null;
871
        revertAction = null;
877
        printToolItem = null;
872
        refreshAction = null;
878
        revertItem = null;
873
        propertiesAction = null;
879
        refreshItem = null;
880
        propertiesItem = null;
874
        quitAction = null;
881
        quitAction = null;
875
        moveAction = null;
882
        moveItem = null;
876
        renameAction = null;
883
        renameItem = null;
877
        goIntoAction = null;
884
        goIntoAction = null;
878
        backAction = null;
885
        backAction = null;
879
        forwardAction = null;
886
        forwardAction = null;
Lines 954-959 Link Here
954
     * Creates actions (and contribution items) for the menu bar, toolbar and status line.
961
     * Creates actions (and contribution items) for the menu bar, toolbar and status line.
955
     */
962
     */
956
    protected void makeActions(final IWorkbenchWindow window) {
963
    protected void makeActions(final IWorkbenchWindow window) {
964
    	ISharedImages sharedImages = window.getWorkbench().getSharedImages();
957
965
958
        // @issue should obtain from ConfigurationItemFactory
966
        // @issue should obtain from ConfigurationItemFactory
959
        statusLineItem = new StatusLineContributionItem("ModeContributionItem"); //$NON-NLS-1$
967
        statusLineItem = new StatusLineContributionItem("ModeContributionItem"); //$NON-NLS-1$
Lines 1003-1025 Link Here
1003
        redoAction = ActionFactory.REDO.create(window);
1011
        redoAction = ActionFactory.REDO.create(window);
1004
        register(redoAction);
1012
        register(redoAction);
1005
1013
1006
        cutAction = ActionFactory.CUT.create(window);
1014
        CommandContributionItemParameter cutParm = new CommandContributionItemParameter(
1007
        register(cutAction);
1015
				window,
1008
1016
				ActionFactory.CUT.getId(),
1009
        copyAction = ActionFactory.COPY.create(window);
1017
				"org.eclipse.ui.edit.cut", //$NON-NLS-1$
1010
        register(copyAction);
1018
				null,
1011
1019
				sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_CUT),
1012
        pasteAction = ActionFactory.PASTE.create(window);
1020
				sharedImages
1013
        register(pasteAction);
1021
						.getImageDescriptor(ISharedImages.IMG_TOOL_CUT_DISABLED),
1014
1022
				null, WorkbenchMessages.Workbench_cut, null,
1015
        printAction = ActionFactory.PRINT.create(window);
1023
				WorkbenchMessages.Workbench_cutToolTip,
1016
        register(printAction);
1024
				CommandContributionItem.STYLE_PUSH, null, false);
1017
1025
        cutItem = new CommandContributionItem(cutParm);
1018
        selectAllAction = ActionFactory.SELECT_ALL.create(window);
1026
1019
        register(selectAllAction);
1027
        CommandContributionItemParameter copyParm = new CommandContributionItemParameter(
1020
1028
				window,
1021
        findAction = ActionFactory.FIND.create(window);
1029
				ActionFactory.COPY.getId(),
1022
        register(findAction);
1030
				"org.eclipse.ui.edit.copy", //$NON-NLS-1$
1031
				null,
1032
				sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY),
1033
				sharedImages
1034
						.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED),
1035
				null, WorkbenchMessages.Workbench_copy, null,
1036
				WorkbenchMessages.Workbench_copyToolTip,
1037
				CommandContributionItem.STYLE_PUSH, null, false);
1038
		copyItem = new CommandContributionItem(copyParm);
1039
1040
		CommandContributionItemParameter pasteParm = new CommandContributionItemParameter(
1041
				window,
1042
				ActionFactory.PASTE.getId(),
1043
				"org.eclipse.ui.edit.paste", //$NON-NLS-1$
1044
				null,
1045
				sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE),
1046
				sharedImages
1047
						.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED),
1048
				null, WorkbenchMessages.Workbench_paste, null,
1049
				WorkbenchMessages.Workbench_pasteToolTip,
1050
				CommandContributionItem.STYLE_PUSH, null, false);
1051
        pasteItem = new CommandContributionItem(pasteParm);
1052
1053
        CommandContributionItemParameter printParm = new CommandContributionItemParameter(
1054
				window,
1055
				ActionFactory.PRINT.getId(),
1056
				"org.eclipse.ui.file.print", //$NON-NLS-1$
1057
				null,
1058
				sharedImages.getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT),
1059
				sharedImages
1060
						.getImageDescriptor(ISharedImages.IMG_ETOOL_PRINT_EDIT_DISABLED),
1061
				null, WorkbenchMessages.Workbench_print, null,
1062
				WorkbenchMessages.Workbench_printToolTip,
1063
				CommandContributionItem.STYLE_PUSH, null, false);
1064
        printMenuItem = new CommandContributionItem(printParm);
1065
        printToolItem = new CommandContributionItem(printParm);
1066
1067
        CommandContributionItemParameter selectAllParm = new CommandContributionItemParameter(
1068
				window,
1069
				ActionFactory.SELECT_ALL.getId(),
1070
				"org.eclipse.ui.edit.selectAll", //$NON-NLS-1$
1071
				null,
1072
				null,
1073
				null,
1074
				null, WorkbenchMessages.Workbench_selectAll, null,
1075
				WorkbenchMessages.Workbench_selectAllToolTip,
1076
				CommandContributionItem.STYLE_PUSH, null, false);
1077
        selectAllItem = new CommandContributionItem(selectAllParm);
1078
1079
        CommandContributionItemParameter findParm = new CommandContributionItemParameter(
1080
				window,
1081
				ActionFactory.FIND.getId(),
1082
				"org.eclipse.ui.edit.findReplace", //$NON-NLS-1$
1083
				null,
1084
				null,
1085
				null,
1086
				null, WorkbenchMessages.Workbench_findReplace, null,
1087
				WorkbenchMessages.Workbench_findReplaceToolTip,
1088
				CommandContributionItem.STYLE_PUSH, null, false);
1089
        findItem = new CommandContributionItem(findParm);
1023
1090
1024
        closeAction = ActionFactory.CLOSE.create(window);
1091
        closeAction = ActionFactory.CLOSE.create(window);
1025
        register(closeAction);
1092
        register(closeAction);
Lines 1057-1064 Link Here
1057
        addTaskAction = IDEActionFactory.ADD_TASK.create(window);
1124
        addTaskAction = IDEActionFactory.ADD_TASK.create(window);
1058
        register(addTaskAction);
1125
        register(addTaskAction);
1059
1126
1060
        deleteAction = ActionFactory.DELETE.create(window);
1127
        CommandContributionItemParameter deleteParm = new CommandContributionItemParameter(
1061
        register(deleteAction);
1128
				window,
1129
				ActionFactory.DELETE.getId(),
1130
				"org.eclipse.ui.edit.delete", //$NON-NLS-1$
1131
				null,
1132
				sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE),
1133
				sharedImages
1134
						.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED),
1135
				null, WorkbenchMessages.Workbench_delete, null,
1136
				WorkbenchMessages.Workbench_deleteToolTip,
1137
				CommandContributionItem.STYLE_PUSH, 
1138
				IWorkbenchHelpContextIds.DELETE_RETARGET_ACTION, false);
1139
        deleteItem = new CommandContributionItem(deleteParm);
1062
1140
1063
        makeFeatureDependentActions(window);
1141
        makeFeatureDependentActions(window);
1064
1142
Lines 1139-1161 Link Here
1139
                .create(window);
1217
                .create(window);
1140
        register(backwardHistoryAction);
1218
        register(backwardHistoryAction);
1141
1219
1142
        revertAction = ActionFactory.REVERT.create(window);
1220
        CommandContributionItemParameter revertParm = new CommandContributionItemParameter(
1143
        register(revertAction);
1221
				window,
1144
1222
				ActionFactory.REVERT.getId(),
1145
        refreshAction = ActionFactory.REFRESH.create(window);
1223
				"org.eclipse.ui.file.revert", //$NON-NLS-1$
1146
        register(refreshAction);
1224
				null,
1147
1225
				null,
1148
        propertiesAction = ActionFactory.PROPERTIES.create(window);
1226
				null,
1149
        register(propertiesAction);
1227
				null, WorkbenchMessages.Workbench_revert, null,
1228
				WorkbenchMessages.Workbench_revertToolTip,
1229
				CommandContributionItem.STYLE_PUSH, null, false);
1230
        revertItem = new CommandContributionItem(revertParm);
1231
1232
        CommandContributionItemParameter refreshParm = new CommandContributionItemParameter(
1233
				window,
1234
				ActionFactory.REFRESH.getId(),
1235
				"org.eclipse.ui.file.refresh", //$NON-NLS-1$
1236
				null,
1237
				null,
1238
				null,
1239
				null, WorkbenchMessages.Workbench_refresh, null,
1240
				WorkbenchMessages.Workbench_refreshToolTip,
1241
				CommandContributionItem.STYLE_PUSH, null, false);
1242
        refreshItem = new CommandContributionItem(refreshParm);
1243
1244
        CommandContributionItemParameter propertiesParm = new CommandContributionItemParameter(
1245
				window,
1246
				ActionFactory.PROPERTIES.getId(),
1247
				"org.eclipse.ui.file.properties", //$NON-NLS-1$
1248
				null,
1249
				null,
1250
				null,
1251
				null, WorkbenchMessages.Workbench_properties, null,
1252
				WorkbenchMessages.Workbench_propertiesToolTip,
1253
				CommandContributionItem.STYLE_PUSH, null, false);
1254
        propertiesItem = new CommandContributionItem(propertiesParm);
1150
1255
1151
        quitAction = ActionFactory.QUIT.create(window);
1256
        quitAction = ActionFactory.QUIT.create(window);
1152
        register(quitAction);
1257
        register(quitAction);
1153
1258
1154
        moveAction = ActionFactory.MOVE.create(window);
1259
        CommandContributionItemParameter moveParm = new CommandContributionItemParameter(
1155
        register(moveAction);
1260
				window,
1156
1261
				ActionFactory.MOVE.getId(),
1157
        renameAction = ActionFactory.RENAME.create(window);
1262
				"org.eclipse.ui.edit.move", //$NON-NLS-1$
1158
        register(renameAction);
1263
				null,
1264
				null,
1265
				null,
1266
				null, WorkbenchMessages.Workbench_move, null,
1267
				WorkbenchMessages.Workbench_moveToolTip,
1268
				CommandContributionItem.STYLE_PUSH, null, false);
1269
        moveItem = new CommandContributionItem(moveParm);
1270
1271
        CommandContributionItemParameter renameParm = new CommandContributionItemParameter(
1272
				window,
1273
				ActionFactory.RENAME.getId(),
1274
				"org.eclipse.ui.edit.rename", //$NON-NLS-1$
1275
				null,
1276
				null,
1277
				null,
1278
				null, WorkbenchMessages.Workbench_rename, null,
1279
				WorkbenchMessages.Workbench_renameToolTip,
1280
				CommandContributionItem.STYLE_PUSH, null, false);
1281
        renameItem = new CommandContributionItem(renameParm);
1159
1282
1160
        goIntoAction = ActionFactory.GO_INTO.create(window);
1283
        goIntoAction = ActionFactory.GO_INTO.create(window);
1161
        register(goIntoAction);
1284
        register(goIntoAction);

Return to bug 226732