Skip to content

Commit

Permalink
GH-210: Fixed issues after the messed-up rebase attempt.
Browse files Browse the repository at this point in the history
Signed-off-by: Akos Kitta <[email protected]>
  • Loading branch information
kittaakos authored and akosyakov committed Sep 1, 2017
1 parent ab481f3 commit b039076
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 23 deletions.
57 changes: 48 additions & 9 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,22 @@ import { FrontendApplication } from '../browser/frontend-application';
import { injectable, inject } from "inversify";

export namespace CommonCommands {

export const EDIT_MENU = "2_edit";
export const EDIT_MENU_UNDO_GROUP = "1_undo/redo";
export const EDIT_MENU_COPYPASTE_GROUP = "2_copy";
export const EDIT_MENU_CUT_COPY_PASTE_GROUP = "2_cut/copy/paste";
export const EDIT_MENU_FIND_REPLACE_GROUP = "3_find/replace";

export const EDIT_CUT = 'edit_cut';
export const EDIT_COPY = 'edit_copy';
export const EDIT_PASTE = 'edit_paste';
export const EDIT_CUT = 'editor.action.clipboardCutAction';
export const EDIT_COPY = 'editor.action.clipboardCopyAction';
export const EDIT_PASTE = 'editor.action.clipboardPasteAction';

export const EDIT_UNDO = 'undo';
export const EDIT_REDO = 'redo';

export const EDIT_FIND = 'actions.find';
export const EDIT_REPLACE = 'editor.action.startFindReplaceAction';

export const TAB_NEXT: Command = {
id: 'tab:next',
label: 'Switch to next tab'
Expand All @@ -44,18 +49,42 @@ export class CommonFrontendContribution implements MenuContribution, CommandCont
registerMenus(registry: MenuModelRegistry): void {
// Explicitly register the Edit Submenu
registry.registerSubmenu([MAIN_MENU_BAR], CommonCommands.EDIT_MENU, "Edit");
registry.registerMenuAction([MAIN_MENU_BAR, CommonCommands.EDIT_MENU, CommonCommands.EDIT_MENU_UNDO_GROUP], {
commandId: CommonCommands.EDIT_UNDO
});

// Undo/Redo
registry.registerMenuAction([
MAIN_MENU_BAR,
CommonCommands.EDIT_MENU,
CommonCommands.EDIT_MENU_UNDO_GROUP], {
commandId: CommonCommands.EDIT_UNDO,
order: '0'
});
registry.registerMenuAction([
MAIN_MENU_BAR,
CommonCommands.EDIT_MENU,
CommonCommands.EDIT_MENU_UNDO_GROUP], {
commandId: CommonCommands.EDIT_REDO
commandId: CommonCommands.EDIT_REDO,
order: '1'
});

// Find/Replace
registry.registerMenuAction([
MAIN_MENU_BAR,
CommonCommands.EDIT_MENU,
CommonCommands.EDIT_MENU_FIND_REPLACE_GROUP], {
commandId: CommonCommands.EDIT_FIND,
order: '0'
});
registry.registerMenuAction([
MAIN_MENU_BAR,
CommonCommands.EDIT_MENU,
CommonCommands.EDIT_MENU_FIND_REPLACE_GROUP], {
commandId: CommonCommands.EDIT_REPLACE,
order: '1'
});
}

registerCommands(commandRegistry: CommandRegistry): void {

commandRegistry.registerCommand({
id: CommonCommands.EDIT_CUT,
label: 'Cut'
Expand All @@ -68,6 +97,7 @@ export class CommonFrontendContribution implements MenuContribution, CommandCont
id: CommonCommands.EDIT_PASTE,
label: 'Paste'
});

commandRegistry.registerCommand({
id: CommonCommands.EDIT_UNDO,
label: 'Undo'
Expand All @@ -76,11 +106,20 @@ export class CommonFrontendContribution implements MenuContribution, CommandCont
id: CommonCommands.EDIT_REDO,
label: 'Redo'
});

commandRegistry.registerCommand({
id: CommonCommands.EDIT_FIND,
label: 'Find'
});
commandRegistry.registerCommand({
id: CommonCommands.EDIT_REPLACE,
label: 'Replace'
});

commandRegistry.registerCommand(CommonCommands.TAB_NEXT, {
isEnabled: () => this.app.shell.hasSelectedTab(),
execute: () => this.app.shell.activateNextTab()
});

commandRegistry.registerCommand(CommonCommands.TAB_PREVIOUS, {
isEnabled: () => this.app.shell.hasSelectedTab(),
execute: () => this.app.shell.activatePreviousTab()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
*/

import { injectable } from "inversify";
import { MenuContribution, MenuModelRegistry, MAIN_MENU_BAR, CommonCommands } from "../../common";
import { CommonCommands } from "../../browser";
import { MenuContribution, MenuModelRegistry, MAIN_MENU_BAR } from "../../common";

export namespace ElectronMenus {
export const HELP = [MAIN_MENU_BAR, "4_help"];
Expand Down
9 changes: 2 additions & 7 deletions packages/monaco/src/browser/monaco-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,10 @@

import { injectable, inject } from "inversify";
import { ProtocolToMonacoConverter } from "monaco-languageclient/lib";
<<<<<<< HEAD
import { CommandHandler, CommandContribution, CommandRegistry, SelectionService } from '@theia/core/lib/common';
import { CommonCommands } from '@theia/core/lib/browser';
import { EditorManager, TextEditorSelection, SHOW_REFERENCES } from '@theia/editor/lib/browser';
=======
>>>>>>> 9748b0e... GH-210: Registered `selection` commands, handlers and menu items.
import { Position, Location } from "@theia/languages/lib/common";
import { CommonCommands } from '@theia/core/lib/browser';
import { EditorManager, TextEditorSelection, SHOW_REFERENCES } from '@theia/editor/lib/browser';
import { CommandHandler, CommandContribution, CommandRegistry, CommonCommands, SelectionService } from '@theia/core/lib/common';
import { CommandHandler, CommandContribution, CommandRegistry, SelectionService } from '@theia/core/lib/common';
import { getCurrent, MonacoEditor } from './monaco-editor';
import MenuRegistry = monaco.actions.MenuRegistry;
import MenuId = monaco.actions.MenuId;
Expand Down
8 changes: 2 additions & 6 deletions packages/monaco/src/browser/monaco-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
*/

import { injectable } from "inversify";
<<<<<<< HEAD
import { MenuContribution, MenuModelRegistry } from "@theia/core/lib/common";
import { CommonCommands } from '@theia/core/lib/browser';
=======
import { MenuContribution, MenuModelRegistry, CommonCommands, MAIN_MENU_BAR } from "@theia/core/lib/common";
>>>>>>> 9748b0e... GH-210: Registered `selection` commands, handlers and menu items.
import { MenuContribution, MenuModelRegistry, MAIN_MENU_BAR } from "@theia/core/lib/common";
import { CommonCommands } from "@theia/core/lib/browser";
import { EDITOR_CONTEXT_MENU_ID } from "@theia/editor/lib/browser";
import { MonacoSelectionCommands } from "./monaco-command";
import MenuRegistry = monaco.actions.MenuRegistry;
Expand Down

0 comments on commit b039076

Please sign in to comment.