From 60289589f25e99acb4fa9f5048baf831c856a71d Mon Sep 17 00:00:00 2001 From: Olaf Lessenich Date: Mon, 19 Dec 2022 20:10:02 +0100 Subject: [PATCH] Move ViewColumn to @theia/core The enum ViewColumn is used to specify in which column of the main area a widget is supposed to be opened. Contributed on behalf of ST Microelectronics Signed-off-by: Olaf Lessenich --- packages/core/src/common/index.ts | 1 + packages/core/src/common/view-column.ts | 33 +++++++++++ .../src/browser/base/terminal-widget.ts | 55 +------------------ .../browser/terminal-frontend-contribution.ts | 5 +- 4 files changed, 39 insertions(+), 55 deletions(-) create mode 100644 packages/core/src/common/view-column.ts diff --git a/packages/core/src/common/index.ts b/packages/core/src/common/index.ts index cedfd254d0009..257f263cc01bf 100644 --- a/packages/core/src/common/index.ts +++ b/packages/core/src/common/index.ts @@ -43,6 +43,7 @@ export * from './contribution-filter'; export * from './nls'; export * from './numbers'; export * from './performance'; +export * from './view-column'; import { environment } from '@theia/application-package/lib/environment'; export { environment }; diff --git a/packages/core/src/common/view-column.ts b/packages/core/src/common/view-column.ts new file mode 100644 index 0000000000000..0548370518db3 --- /dev/null +++ b/packages/core/src/common/view-column.ts @@ -0,0 +1,33 @@ +// ***************************************************************************** +// Copyright (C) 2022 STMicroelectronics. +// +// This program and the accompanying materials are made available under the +// terms of the Eclipse Public License v. 2.0 which is available at +// http://www.eclipse.org/legal/epl-2.0. +// +// This Source Code may also be made available under the following Secondary +// Licenses when the conditions for such availability set forth in the Eclipse +// Public License v. 2.0 are satisfied: GNU General Public License, version 2 +// with the GNU Classpath Exception which is available at +// https://www.gnu.org/software/classpath/license.html. +// +// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +// ***************************************************************************** + +/** + * Denotes a column in the editor window. + * Columns are used to show editors side by side. + */ +export enum ViewColumn { + Active = -1, + Beside = -2, + One = 1, + Two = 2, + Three = 3, + Four = 4, + Five = 5, + Six = 6, + Seven = 7, + Eight = 8, + Nine = 9 +} diff --git a/packages/terminal/src/browser/base/terminal-widget.ts b/packages/terminal/src/browser/base/terminal-widget.ts index de6a02d1d9143..e355f8312e6ae 100644 --- a/packages/terminal/src/browser/base/terminal-widget.ts +++ b/packages/terminal/src/browser/base/terminal-widget.ts @@ -14,7 +14,7 @@ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 // ***************************************************************************** -import { Event } from '@theia/core'; +import { Event, ViewColumn } from '@theia/core'; import { BaseWidget } from '@theia/core/lib/browser'; import { CommandLineOptions } from '@theia/process/lib/common/shell-command-builder'; import { TerminalSearchWidget } from '../search/terminal-search-widget'; @@ -38,7 +38,7 @@ export enum TerminalLocation { } export interface TerminalEditorLocation { - readonly viewColumn: number; + readonly viewColumn: ViewColumn; readonly preserveFocus?: boolean; } @@ -46,57 +46,6 @@ export interface TerminalSplitLocation { readonly parentTerminal: string; } -export enum ViewColumn { - /** - * A *symbolic* editor column representing the currently active column. This value - * can be used when opening editors, but the *resolved* {@link TextEditor.viewColumn viewColumn}-value - * of editors will always be `One`, `Two`, `Three`,... or `undefined` but never `Active`. - */ - Active = -1, - /** - * A *symbolic* editor column representing the column to the side of the active one. This value - * can be used when opening editors, but the *resolved* {@link TextEditor.viewColumn viewColumn}-value - * of editors will always be `One`, `Two`, `Three`,... or `undefined` but never `Beside`. - */ - Beside = -2, - /** - * The first editor column. - */ - One = 1, - /** - * The second editor column. - */ - Two = 2, - /** - * The third editor column. - */ - Three = 3, - /** - * The fourth editor column. - */ - Four = 4, - /** - * The fifth editor column. - */ - Five = 5, - /** - * The sixth editor column. - */ - Six = 6, - /** - * The seventh editor column. - */ - Seven = 7, - /** - * The eighth editor column. - */ - Eight = 8, - /** - * The ninth editor column. - */ - Nine = 9 -} - /** * Terminal UI widget. */ diff --git a/packages/terminal/src/browser/terminal-frontend-contribution.ts b/packages/terminal/src/browser/terminal-frontend-contribution.ts index 2b8a96a5888dd..60fbf57c2b52b 100644 --- a/packages/terminal/src/browser/terminal-frontend-contribution.ts +++ b/packages/terminal/src/browser/terminal-frontend-contribution.ts @@ -25,7 +25,8 @@ import { isOSX, SelectionService, Emitter, - Event + Event, + ViewColumn } from '@theia/core/lib/common'; import { ApplicationShell, KeybindingContribution, KeyCode, Key, WidgetManager, @@ -36,7 +37,7 @@ import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/li import { TERMINAL_WIDGET_FACTORY_ID, TerminalWidgetFactoryOptions, TerminalWidgetImpl } from './terminal-widget-impl'; import { TerminalKeybindingContexts } from './terminal-keybinding-contexts'; import { TerminalService } from './base/terminal-service'; -import { TerminalWidgetOptions, TerminalWidget, TerminalLocation, ViewColumn } from './base/terminal-widget'; +import { TerminalWidgetOptions, TerminalWidget, TerminalLocation } from './base/terminal-widget'; import { UriAwareCommandHandler } from '@theia/core/lib/common/uri-command-handler'; import { ShellTerminalServerProxy } from '../common/shell-terminal-protocol'; import URI from '@theia/core/lib/common/uri';