@theia/scm 1.45.0 → 1.46.0-next.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -31
- package/lib/browser/decorations/scm-decorations-service.d.ts +14 -14
- package/lib/browser/decorations/scm-decorations-service.js +101 -101
- package/lib/browser/decorations/scm-navigator-decorator.d.ts +25 -25
- package/lib/browser/decorations/scm-navigator-decorator.js +132 -132
- package/lib/browser/decorations/scm-tab-bar-decorator.d.ts +17 -17
- package/lib/browser/decorations/scm-tab-bar-decorator.js +93 -93
- package/lib/browser/dirty-diff/content-lines.d.ts +12 -12
- package/lib/browser/dirty-diff/content-lines.js +106 -106
- package/lib/browser/dirty-diff/content-lines.spec.d.ts +1 -1
- package/lib/browser/dirty-diff/content-lines.spec.js +39 -39
- package/lib/browser/dirty-diff/diff-computer.d.ts +29 -29
- package/lib/browser/dirty-diff/diff-computer.js +102 -102
- package/lib/browser/dirty-diff/diff-computer.spec.d.ts +1 -1
- package/lib/browser/dirty-diff/diff-computer.spec.js +315 -315
- package/lib/browser/dirty-diff/dirty-diff-decorator.d.ts +14 -14
- package/lib/browser/dirty-diff/dirty-diff-decorator.js +98 -98
- package/lib/browser/dirty-diff/dirty-diff-module.d.ts +3 -3
- package/lib/browser/dirty-diff/dirty-diff-module.js +24 -24
- package/lib/browser/scm-amend-component.d.ts +123 -123
- package/lib/browser/scm-amend-component.js +463 -463
- package/lib/browser/scm-amend-widget.d.ts +20 -20
- package/lib/browser/scm-amend-widget.js +101 -101
- package/lib/browser/scm-avatar-service.d.ts +3 -3
- package/lib/browser/scm-avatar-service.js +36 -36
- package/lib/browser/scm-commit-widget.d.ts +52 -52
- package/lib/browser/scm-commit-widget.js +199 -199
- package/lib/browser/scm-context-key-service.d.ts +10 -10
- package/lib/browser/scm-context-key-service.js +58 -58
- package/lib/browser/scm-contribution.d.ts +83 -83
- package/lib/browser/scm-contribution.js +356 -356
- package/lib/browser/scm-frontend-module.d.ts +6 -6
- package/lib/browser/scm-frontend-module.js +130 -130
- package/lib/browser/scm-groups-tree-model.d.ts +14 -14
- package/lib/browser/scm-groups-tree-model.js +97 -97
- package/lib/browser/scm-input.d.ts +53 -53
- package/lib/browser/scm-input.js +127 -127
- package/lib/browser/scm-layout-migrations.d.ts +9 -9
- package/lib/browser/scm-layout-migrations.js +79 -79
- package/lib/browser/scm-no-repository-widget.d.ts +8 -8
- package/lib/browser/scm-no-repository-widget.js +49 -49
- package/lib/browser/scm-preferences.d.ts +11 -11
- package/lib/browser/scm-preferences.js +51 -51
- package/lib/browser/scm-provider.d.ts +58 -58
- package/lib/browser/scm-provider.js +19 -19
- package/lib/browser/scm-quick-open-service.d.ts +11 -11
- package/lib/browser/scm-quick-open-service.js +73 -73
- package/lib/browser/scm-repository.d.ts +17 -17
- package/lib/browser/scm-repository.js +41 -41
- package/lib/browser/scm-service.d.ts +26 -26
- package/lib/browser/scm-service.js +108 -108
- package/lib/browser/scm-tree-label-provider.d.ts +7 -7
- package/lib/browser/scm-tree-label-provider.js +57 -57
- package/lib/browser/scm-tree-model.d.ts +74 -74
- package/lib/browser/scm-tree-model.js +351 -351
- package/lib/browser/scm-tree-widget.d.ts +208 -208
- package/lib/browser/scm-tree-widget.js +703 -703
- package/lib/browser/scm-widget.d.ts +40 -40
- package/lib/browser/scm-widget.js +218 -218
- package/package.json +6 -6
- package/src/browser/decorations/scm-decorations-service.ts +78 -78
- package/src/browser/decorations/scm-navigator-decorator.ts +121 -121
- package/src/browser/decorations/scm-tab-bar-decorator.ts +83 -83
- package/src/browser/dirty-diff/content-lines.spec.ts +42 -42
- package/src/browser/dirty-diff/content-lines.ts +112 -112
- package/src/browser/dirty-diff/diff-computer.spec.ts +387 -387
- package/src/browser/dirty-diff/diff-computer.ts +129 -129
- package/src/browser/dirty-diff/dirty-diff-decorator.ts +107 -107
- package/src/browser/dirty-diff/dirty-diff-module.ts +24 -24
- package/src/browser/scm-amend-component.tsx +600 -600
- package/src/browser/scm-amend-widget.tsx +77 -77
- package/src/browser/scm-avatar-service.ts +27 -27
- package/src/browser/scm-commit-widget.tsx +215 -215
- package/src/browser/scm-context-key-service.ts +46 -46
- package/src/browser/scm-contribution.ts +361 -361
- package/src/browser/scm-frontend-module.ts +149 -149
- package/src/browser/scm-groups-tree-model.ts +78 -78
- package/src/browser/scm-input.ts +164 -164
- package/src/browser/scm-layout-migrations.ts +64 -64
- package/src/browser/scm-no-repository-widget.tsx +41 -41
- package/src/browser/scm-preferences.ts +63 -63
- package/src/browser/scm-provider.ts +91 -91
- package/src/browser/scm-quick-open-service.ts +48 -48
- package/src/browser/scm-repository.ts +52 -52
- package/src/browser/scm-service.ts +108 -108
- package/src/browser/scm-tree-label-provider.ts +44 -44
- package/src/browser/scm-tree-model.ts +405 -405
- package/src/browser/scm-tree-widget.tsx +838 -838
- package/src/browser/scm-widget.tsx +204 -204
- package/src/browser/style/dirty-diff-decorator.css +52 -52
- package/src/browser/style/dirty-diff.css +50 -50
- package/src/browser/style/index.css +271 -271
- package/src/browser/style/scm-amend-component.css +94 -94
- package/src/browser/style/scm.svg +4 -4
|
@@ -1,63 +1,63 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { interfaces } from '@theia/core/shared/inversify';
|
|
18
|
-
import {
|
|
19
|
-
createPreferenceProxy,
|
|
20
|
-
PreferenceProxy,
|
|
21
|
-
PreferenceService,
|
|
22
|
-
PreferenceSchema,
|
|
23
|
-
PreferenceContribution
|
|
24
|
-
} from '@theia/core/lib/browser/preferences';
|
|
25
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
26
|
-
|
|
27
|
-
export const scmPreferenceSchema: PreferenceSchema = {
|
|
28
|
-
type: 'object',
|
|
29
|
-
properties: {
|
|
30
|
-
'scm.defaultViewMode': {
|
|
31
|
-
type: 'string',
|
|
32
|
-
enum: ['tree', 'list'],
|
|
33
|
-
enumDescriptions: [
|
|
34
|
-
nls.localizeByDefault('Show the repository changes as a tree.'),
|
|
35
|
-
nls.localizeByDefault('Show the repository changes as a list.')
|
|
36
|
-
],
|
|
37
|
-
description: nls.localizeByDefault('Controls the default Source Control repository view mode.'),
|
|
38
|
-
default: 'list'
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export interface ScmConfiguration {
|
|
44
|
-
'scm.defaultViewMode': 'tree' | 'list'
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const ScmPreferenceContribution = Symbol('ScmPreferenceContribution');
|
|
48
|
-
export const ScmPreferences = Symbol('ScmPreferences');
|
|
49
|
-
export type ScmPreferences = PreferenceProxy<ScmConfiguration>;
|
|
50
|
-
|
|
51
|
-
export function createScmPreferences(preferences: PreferenceService, schema: PreferenceSchema = scmPreferenceSchema): ScmPreferences {
|
|
52
|
-
return createPreferenceProxy(preferences, schema);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export function bindScmPreferences(bind: interfaces.Bind): void {
|
|
56
|
-
bind(ScmPreferences).toDynamicValue((ctx: interfaces.Context) => {
|
|
57
|
-
const preferences = ctx.container.get<PreferenceService>(PreferenceService);
|
|
58
|
-
const contribution = ctx.container.get<PreferenceContribution>(ScmPreferenceContribution);
|
|
59
|
-
return createScmPreferences(preferences, contribution.schema);
|
|
60
|
-
}).inSingletonScope();
|
|
61
|
-
bind(ScmPreferenceContribution).toConstantValue({ schema: scmPreferenceSchema });
|
|
62
|
-
bind(PreferenceContribution).toService(ScmPreferenceContribution);
|
|
63
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { interfaces } from '@theia/core/shared/inversify';
|
|
18
|
+
import {
|
|
19
|
+
createPreferenceProxy,
|
|
20
|
+
PreferenceProxy,
|
|
21
|
+
PreferenceService,
|
|
22
|
+
PreferenceSchema,
|
|
23
|
+
PreferenceContribution
|
|
24
|
+
} from '@theia/core/lib/browser/preferences';
|
|
25
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
26
|
+
|
|
27
|
+
export const scmPreferenceSchema: PreferenceSchema = {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
'scm.defaultViewMode': {
|
|
31
|
+
type: 'string',
|
|
32
|
+
enum: ['tree', 'list'],
|
|
33
|
+
enumDescriptions: [
|
|
34
|
+
nls.localizeByDefault('Show the repository changes as a tree.'),
|
|
35
|
+
nls.localizeByDefault('Show the repository changes as a list.')
|
|
36
|
+
],
|
|
37
|
+
description: nls.localizeByDefault('Controls the default Source Control repository view mode.'),
|
|
38
|
+
default: 'list'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export interface ScmConfiguration {
|
|
44
|
+
'scm.defaultViewMode': 'tree' | 'list'
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export const ScmPreferenceContribution = Symbol('ScmPreferenceContribution');
|
|
48
|
+
export const ScmPreferences = Symbol('ScmPreferences');
|
|
49
|
+
export type ScmPreferences = PreferenceProxy<ScmConfiguration>;
|
|
50
|
+
|
|
51
|
+
export function createScmPreferences(preferences: PreferenceService, schema: PreferenceSchema = scmPreferenceSchema): ScmPreferences {
|
|
52
|
+
return createPreferenceProxy(preferences, schema);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function bindScmPreferences(bind: interfaces.Bind): void {
|
|
56
|
+
bind(ScmPreferences).toDynamicValue((ctx: interfaces.Context) => {
|
|
57
|
+
const preferences = ctx.container.get<PreferenceService>(PreferenceService);
|
|
58
|
+
const contribution = ctx.container.get<PreferenceContribution>(ScmPreferenceContribution);
|
|
59
|
+
return createScmPreferences(preferences, contribution.schema);
|
|
60
|
+
}).inSingletonScope();
|
|
61
|
+
bind(ScmPreferenceContribution).toConstantValue({ schema: scmPreferenceSchema });
|
|
62
|
+
bind(PreferenceContribution).toService(ScmPreferenceContribution);
|
|
63
|
+
}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 Red Hat, Inc. and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
|
-
|
|
19
|
-
import { Disposable, Event } from '@theia/core/lib/common';
|
|
20
|
-
import URI from '@theia/core/lib/common/uri';
|
|
21
|
-
|
|
22
|
-
export interface ScmProvider extends Disposable {
|
|
23
|
-
readonly id: string;
|
|
24
|
-
readonly label: string;
|
|
25
|
-
readonly rootUri: string;
|
|
26
|
-
|
|
27
|
-
readonly acceptInputCommand?: ScmCommand;
|
|
28
|
-
|
|
29
|
-
readonly groups: ScmResourceGroup[];
|
|
30
|
-
readonly onDidChange: Event<void>;
|
|
31
|
-
readonly onDidChangeResources?: Event<void>;
|
|
32
|
-
|
|
33
|
-
readonly statusBarCommands?: ScmCommand[];
|
|
34
|
-
readonly onDidChangeStatusBarCommands?: Event<ScmCommand[] | undefined>;
|
|
35
|
-
|
|
36
|
-
readonly onDidChangeCommitTemplate: Event<string>;
|
|
37
|
-
|
|
38
|
-
readonly amendSupport?: ScmAmendSupport;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const ScmResourceGroup = Symbol('ScmResourceGroup');
|
|
42
|
-
export interface ScmResourceGroup extends Disposable {
|
|
43
|
-
readonly id: string;
|
|
44
|
-
readonly label: string;
|
|
45
|
-
readonly resources: ScmResource[];
|
|
46
|
-
readonly hideWhenEmpty?: boolean;
|
|
47
|
-
|
|
48
|
-
readonly provider: ScmProvider;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface ScmResource {
|
|
52
|
-
/** The uri of the underlying resource inside the workspace. */
|
|
53
|
-
readonly sourceUri: URI;
|
|
54
|
-
readonly decorations?: ScmResourceDecorations;
|
|
55
|
-
open(): Promise<void>;
|
|
56
|
-
|
|
57
|
-
readonly group: ScmResourceGroup;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface ScmResourceDecorations {
|
|
61
|
-
icon?: string;
|
|
62
|
-
iconDark?: string;
|
|
63
|
-
tooltip?: string;
|
|
64
|
-
source?: string;
|
|
65
|
-
letter?: string;
|
|
66
|
-
color?: string;
|
|
67
|
-
strikeThrough?: boolean;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface ScmCommand {
|
|
71
|
-
title: string;
|
|
72
|
-
tooltip?: string;
|
|
73
|
-
command?: string;
|
|
74
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
-
arguments?: any[];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface ScmCommit {
|
|
79
|
-
readonly id: string; // eg Git sha or Mercurial revision number
|
|
80
|
-
readonly summary: string;
|
|
81
|
-
readonly authorName: string;
|
|
82
|
-
readonly authorEmail: string;
|
|
83
|
-
readonly authorDateRelative: string;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export interface ScmAmendSupport {
|
|
87
|
-
getInitialAmendingCommits(amendingHeadCommitId: string, latestCommitId: string | undefined): Promise<ScmCommit[]>
|
|
88
|
-
getMessage(commit: string): Promise<string>;
|
|
89
|
-
reset(commit: string): Promise<void>;
|
|
90
|
-
getLastCommit(): Promise<ScmCommit | undefined>;
|
|
91
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 Red Hat, Inc. and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
|
+
|
|
19
|
+
import { Disposable, Event } from '@theia/core/lib/common';
|
|
20
|
+
import URI from '@theia/core/lib/common/uri';
|
|
21
|
+
|
|
22
|
+
export interface ScmProvider extends Disposable {
|
|
23
|
+
readonly id: string;
|
|
24
|
+
readonly label: string;
|
|
25
|
+
readonly rootUri: string;
|
|
26
|
+
|
|
27
|
+
readonly acceptInputCommand?: ScmCommand;
|
|
28
|
+
|
|
29
|
+
readonly groups: ScmResourceGroup[];
|
|
30
|
+
readonly onDidChange: Event<void>;
|
|
31
|
+
readonly onDidChangeResources?: Event<void>;
|
|
32
|
+
|
|
33
|
+
readonly statusBarCommands?: ScmCommand[];
|
|
34
|
+
readonly onDidChangeStatusBarCommands?: Event<ScmCommand[] | undefined>;
|
|
35
|
+
|
|
36
|
+
readonly onDidChangeCommitTemplate: Event<string>;
|
|
37
|
+
|
|
38
|
+
readonly amendSupport?: ScmAmendSupport;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export const ScmResourceGroup = Symbol('ScmResourceGroup');
|
|
42
|
+
export interface ScmResourceGroup extends Disposable {
|
|
43
|
+
readonly id: string;
|
|
44
|
+
readonly label: string;
|
|
45
|
+
readonly resources: ScmResource[];
|
|
46
|
+
readonly hideWhenEmpty?: boolean;
|
|
47
|
+
|
|
48
|
+
readonly provider: ScmProvider;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface ScmResource {
|
|
52
|
+
/** The uri of the underlying resource inside the workspace. */
|
|
53
|
+
readonly sourceUri: URI;
|
|
54
|
+
readonly decorations?: ScmResourceDecorations;
|
|
55
|
+
open(): Promise<void>;
|
|
56
|
+
|
|
57
|
+
readonly group: ScmResourceGroup;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface ScmResourceDecorations {
|
|
61
|
+
icon?: string;
|
|
62
|
+
iconDark?: string;
|
|
63
|
+
tooltip?: string;
|
|
64
|
+
source?: string;
|
|
65
|
+
letter?: string;
|
|
66
|
+
color?: string;
|
|
67
|
+
strikeThrough?: boolean;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface ScmCommand {
|
|
71
|
+
title: string;
|
|
72
|
+
tooltip?: string;
|
|
73
|
+
command?: string;
|
|
74
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
75
|
+
arguments?: any[];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export interface ScmCommit {
|
|
79
|
+
readonly id: string; // eg Git sha or Mercurial revision number
|
|
80
|
+
readonly summary: string;
|
|
81
|
+
readonly authorName: string;
|
|
82
|
+
readonly authorEmail: string;
|
|
83
|
+
readonly authorDateRelative: string;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface ScmAmendSupport {
|
|
87
|
+
getInitialAmendingCommits(amendingHeadCommitId: string, latestCommitId: string | undefined): Promise<ScmCommit[]>
|
|
88
|
+
getMessage(commit: string): Promise<string>;
|
|
89
|
+
reset(commit: string): Promise<void>;
|
|
90
|
+
getLastCommit(): Promise<ScmCommit | undefined>;
|
|
91
|
+
}
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { injectable, inject, optional } from '@theia/core/shared/inversify';
|
|
18
|
-
import { MessageService } from '@theia/core/lib/common/message-service';
|
|
19
|
-
import URI from '@theia/core/lib/common/uri';
|
|
20
|
-
import { ScmService } from './scm-service';
|
|
21
|
-
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
|
|
22
|
-
import { QuickInputService } from '@theia/core/lib/browser';
|
|
23
|
-
|
|
24
|
-
@injectable()
|
|
25
|
-
export class ScmQuickOpenService {
|
|
26
|
-
|
|
27
|
-
@inject(QuickInputService) @optional() protected readonly quickInputService: QuickInputService;
|
|
28
|
-
@inject(MessageService) protected readonly messageService: MessageService;
|
|
29
|
-
@inject(LabelProvider) protected readonly labelProvider: LabelProvider;
|
|
30
|
-
@inject(ScmService) protected readonly scmService: ScmService;
|
|
31
|
-
|
|
32
|
-
async changeRepository(): Promise<void> {
|
|
33
|
-
const repositories = this.scmService.repositories;
|
|
34
|
-
if (repositories.length > 1) {
|
|
35
|
-
const items = await Promise.all(repositories.map(async repository => {
|
|
36
|
-
const uri = new URI(repository.provider.rootUri);
|
|
37
|
-
return {
|
|
38
|
-
label: this.labelProvider.getName(uri),
|
|
39
|
-
description: this.labelProvider.getLongName(uri),
|
|
40
|
-
execute: () => {
|
|
41
|
-
this.scmService.selectedRepository = repository;
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
}));
|
|
45
|
-
this.quickInputService?.showQuickPick(items, { placeholder: 'Select repository to work with:' });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable, inject, optional } from '@theia/core/shared/inversify';
|
|
18
|
+
import { MessageService } from '@theia/core/lib/common/message-service';
|
|
19
|
+
import URI from '@theia/core/lib/common/uri';
|
|
20
|
+
import { ScmService } from './scm-service';
|
|
21
|
+
import { LabelProvider } from '@theia/core/lib/browser/label-provider';
|
|
22
|
+
import { QuickInputService } from '@theia/core/lib/browser';
|
|
23
|
+
|
|
24
|
+
@injectable()
|
|
25
|
+
export class ScmQuickOpenService {
|
|
26
|
+
|
|
27
|
+
@inject(QuickInputService) @optional() protected readonly quickInputService: QuickInputService;
|
|
28
|
+
@inject(MessageService) protected readonly messageService: MessageService;
|
|
29
|
+
@inject(LabelProvider) protected readonly labelProvider: LabelProvider;
|
|
30
|
+
@inject(ScmService) protected readonly scmService: ScmService;
|
|
31
|
+
|
|
32
|
+
async changeRepository(): Promise<void> {
|
|
33
|
+
const repositories = this.scmService.repositories;
|
|
34
|
+
if (repositories.length > 1) {
|
|
35
|
+
const items = await Promise.all(repositories.map(async repository => {
|
|
36
|
+
const uri = new URI(repository.provider.rootUri);
|
|
37
|
+
return {
|
|
38
|
+
label: this.labelProvider.getName(uri),
|
|
39
|
+
description: this.labelProvider.getLongName(uri),
|
|
40
|
+
execute: () => {
|
|
41
|
+
this.scmService.selectedRepository = repository;
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}));
|
|
45
|
+
this.quickInputService?.showQuickPick(items, { placeholder: 'Select repository to work with:' });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 Red Hat, Inc. and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { Disposable, DisposableCollection, Emitter } from '@theia/core/lib/common';
|
|
18
|
-
import { ScmInput, ScmInputOptions } from './scm-input';
|
|
19
|
-
import { ScmProvider } from './scm-provider';
|
|
20
|
-
|
|
21
|
-
export interface ScmProviderOptions {
|
|
22
|
-
input?: ScmInputOptions
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export class ScmRepository implements Disposable {
|
|
26
|
-
|
|
27
|
-
protected readonly onDidChangeEmitter = new Emitter<void>();
|
|
28
|
-
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
29
|
-
protected fireDidChange(): void {
|
|
30
|
-
this.onDidChangeEmitter.fire(undefined);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
protected readonly toDispose = new DisposableCollection(this.onDidChangeEmitter);
|
|
34
|
-
|
|
35
|
-
readonly input: ScmInput;
|
|
36
|
-
|
|
37
|
-
constructor(
|
|
38
|
-
readonly provider: ScmProvider,
|
|
39
|
-
protected readonly options: ScmProviderOptions = {}
|
|
40
|
-
) {
|
|
41
|
-
this.toDispose.pushAll([
|
|
42
|
-
this.provider,
|
|
43
|
-
this.input = new ScmInput(options.input),
|
|
44
|
-
this.input.onDidChange(() => this.fireDidChange())
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
dispose(): void {
|
|
49
|
-
this.toDispose.dispose();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 Red Hat, Inc. and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { Disposable, DisposableCollection, Emitter } from '@theia/core/lib/common';
|
|
18
|
+
import { ScmInput, ScmInputOptions } from './scm-input';
|
|
19
|
+
import { ScmProvider } from './scm-provider';
|
|
20
|
+
|
|
21
|
+
export interface ScmProviderOptions {
|
|
22
|
+
input?: ScmInputOptions
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class ScmRepository implements Disposable {
|
|
26
|
+
|
|
27
|
+
protected readonly onDidChangeEmitter = new Emitter<void>();
|
|
28
|
+
readonly onDidChange = this.onDidChangeEmitter.event;
|
|
29
|
+
protected fireDidChange(): void {
|
|
30
|
+
this.onDidChangeEmitter.fire(undefined);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
protected readonly toDispose = new DisposableCollection(this.onDidChangeEmitter);
|
|
34
|
+
|
|
35
|
+
readonly input: ScmInput;
|
|
36
|
+
|
|
37
|
+
constructor(
|
|
38
|
+
readonly provider: ScmProvider,
|
|
39
|
+
protected readonly options: ScmProviderOptions = {}
|
|
40
|
+
) {
|
|
41
|
+
this.toDispose.pushAll([
|
|
42
|
+
this.provider,
|
|
43
|
+
this.input = new ScmInput(options.input),
|
|
44
|
+
this.input.onDidChange(() => this.fireDidChange())
|
|
45
|
+
]);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
dispose(): void {
|
|
49
|
+
this.toDispose.dispose();
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
}
|