@theia/scm-extra 1.53.0-next.4 → 1.53.0-next.55
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 +32 -32
- package/package.json +8 -8
- package/src/browser/history/index.ts +21 -21
- package/src/browser/history/scm-history-constants.ts +69 -69
- package/src/browser/history/scm-history-contribution.ts +90 -90
- package/src/browser/history/scm-history-frontend-module.ts +36 -36
- package/src/browser/history/scm-history-provider.ts +27 -27
- package/src/browser/history/scm-history-widget.tsx +571 -571
- package/src/browser/scm-extra-contribution.ts +18 -18
- package/src/browser/scm-extra-frontend-module.ts +27 -27
- package/src/browser/scm-extra-layout-migrations.ts +32 -32
- package/src/browser/scm-file-change-label-provider.ts +73 -73
- package/src/browser/scm-file-change-node.ts +45 -45
- package/src/browser/scm-navigable-list-widget.tsx +197 -197
- package/src/browser/style/history.css +164 -164
package/README.md
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
-
|
|
7
|
-
<h2>ECLIPSE THEIA - SCM-EXTRA EXTENSION</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Description
|
|
14
|
-
|
|
15
|
-
The `@theia/scm-extra` extension contributes additional functionality compared to the base `@theia/scm` extension.
|
|
16
|
-
This includes:
|
|
17
|
-
- `SCM History`: a dedicated view to visualize a repository's commit history.
|
|
18
|
-
|
|
19
|
-
## Additional Information
|
|
20
|
-
|
|
21
|
-
- [API documentation for `@theia/scm-extra`](https://eclipse-theia.github.io/theia/docs/next/modules/scm_extra.html)
|
|
22
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
23
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
24
|
-
|
|
25
|
-
## License
|
|
26
|
-
|
|
27
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
28
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
29
|
-
|
|
30
|
-
## Trademark
|
|
31
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
32
|
-
https://www.eclipse.org/theia
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - SCM-EXTRA EXTENSION</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
The `@theia/scm-extra` extension contributes additional functionality compared to the base `@theia/scm` extension.
|
|
16
|
+
This includes:
|
|
17
|
+
- `SCM History`: a dedicated view to visualize a repository's commit history.
|
|
18
|
+
|
|
19
|
+
## Additional Information
|
|
20
|
+
|
|
21
|
+
- [API documentation for `@theia/scm-extra`](https://eclipse-theia.github.io/theia/docs/next/modules/scm_extra.html)
|
|
22
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
23
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
24
|
+
|
|
25
|
+
## License
|
|
26
|
+
|
|
27
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
28
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
29
|
+
|
|
30
|
+
## Trademark
|
|
31
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
32
|
+
https://www.eclipse.org/theia
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/scm-extra",
|
|
3
|
-
"version": "1.53.0-next.
|
|
3
|
+
"version": "1.53.0-next.55+d1a989a68c",
|
|
4
4
|
"description": "Theia - Source control extras Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.53.0-next.
|
|
7
|
-
"@theia/editor": "1.53.0-next.
|
|
8
|
-
"@theia/filesystem": "1.53.0-next.
|
|
9
|
-
"@theia/navigator": "1.53.0-next.
|
|
10
|
-
"@theia/scm": "1.53.0-next.
|
|
6
|
+
"@theia/core": "1.53.0-next.55+d1a989a68c",
|
|
7
|
+
"@theia/editor": "1.53.0-next.55+d1a989a68c",
|
|
8
|
+
"@theia/filesystem": "1.53.0-next.55+d1a989a68c",
|
|
9
|
+
"@theia/navigator": "1.53.0-next.55+d1a989a68c",
|
|
10
|
+
"@theia/scm": "1.53.0-next.55+d1a989a68c",
|
|
11
11
|
"tslib": "^2.6.2"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
@@ -43,10 +43,10 @@
|
|
|
43
43
|
"watch": "theiaext watch"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@theia/ext-scripts": "1.
|
|
46
|
+
"@theia/ext-scripts": "1.53.0"
|
|
47
47
|
},
|
|
48
48
|
"nyc": {
|
|
49
49
|
"extends": "../../configs/nyc.json"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
|
|
52
52
|
}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 Arm 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
|
-
export * from './scm-history-provider';
|
|
18
|
-
import { ScmHistorySupport } from './scm-history-widget';
|
|
19
|
-
|
|
20
|
-
export { ScmHistorySupport };
|
|
21
|
-
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 Arm 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
|
+
export * from './scm-history-provider';
|
|
18
|
+
import { ScmHistorySupport } from './scm-history-widget';
|
|
19
|
+
|
|
20
|
+
export { ScmHistorySupport };
|
|
21
|
+
|
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 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 { Command, Event, nls } from '@theia/core';
|
|
18
|
-
import { OpenViewArguments } from '@theia/core/lib/browser';
|
|
19
|
-
import { ScmFileChangeNode, ScmHistoryCommit } from '../scm-file-change-node';
|
|
20
|
-
|
|
21
|
-
export const SCM_HISTORY_ID = 'scm-history';
|
|
22
|
-
export const SCM_HISTORY_LABEL = nls.localize('theia/scm/history', 'History');
|
|
23
|
-
export const SCM_HISTORY_TOGGLE_KEYBINDING = 'alt+h';
|
|
24
|
-
export const SCM_HISTORY_MAX_COUNT = 100;
|
|
25
|
-
|
|
26
|
-
export namespace ScmHistoryCommands {
|
|
27
|
-
export const OPEN_FILE_HISTORY: Command = {
|
|
28
|
-
id: 'scm-history:open-file-history',
|
|
29
|
-
};
|
|
30
|
-
export const OPEN_BRANCH_HISTORY: Command = {
|
|
31
|
-
id: 'scm-history:open-branch-history',
|
|
32
|
-
label: SCM_HISTORY_LABEL
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export interface ScmHistoryOpenViewArguments extends OpenViewArguments {
|
|
37
|
-
uri: string | undefined;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const ScmHistorySupport = Symbol('scm-history-support');
|
|
41
|
-
export interface ScmHistorySupport {
|
|
42
|
-
getCommitHistory(options?: HistoryWidgetOptions): Promise<ScmHistoryCommit[]>;
|
|
43
|
-
readonly onDidChangeHistory: Event<void>;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface ScmCommitNode {
|
|
47
|
-
commitDetails: ScmHistoryCommit;
|
|
48
|
-
authorAvatar: string;
|
|
49
|
-
fileChangeNodes: ScmFileChangeNode[];
|
|
50
|
-
expanded: boolean;
|
|
51
|
-
selected: boolean;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export namespace ScmCommitNode {
|
|
55
|
-
export function is(node: unknown): node is ScmCommitNode {
|
|
56
|
-
return !!node && typeof node === 'object' && 'commitDetails' in node && 'expanded' in node && 'selected' in node;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export interface HistoryWidgetOptions {
|
|
61
|
-
range?: {
|
|
62
|
-
toRevision?: string;
|
|
63
|
-
fromRevision?: string;
|
|
64
|
-
};
|
|
65
|
-
uri?: string;
|
|
66
|
-
maxCount?: number;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export type ScmHistoryListNode = (ScmCommitNode | ScmFileChangeNode);
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 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 { Command, Event, nls } from '@theia/core';
|
|
18
|
+
import { OpenViewArguments } from '@theia/core/lib/browser';
|
|
19
|
+
import { ScmFileChangeNode, ScmHistoryCommit } from '../scm-file-change-node';
|
|
20
|
+
|
|
21
|
+
export const SCM_HISTORY_ID = 'scm-history';
|
|
22
|
+
export const SCM_HISTORY_LABEL = nls.localize('theia/scm/history', 'History');
|
|
23
|
+
export const SCM_HISTORY_TOGGLE_KEYBINDING = 'alt+h';
|
|
24
|
+
export const SCM_HISTORY_MAX_COUNT = 100;
|
|
25
|
+
|
|
26
|
+
export namespace ScmHistoryCommands {
|
|
27
|
+
export const OPEN_FILE_HISTORY: Command = {
|
|
28
|
+
id: 'scm-history:open-file-history',
|
|
29
|
+
};
|
|
30
|
+
export const OPEN_BRANCH_HISTORY: Command = {
|
|
31
|
+
id: 'scm-history:open-branch-history',
|
|
32
|
+
label: SCM_HISTORY_LABEL
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface ScmHistoryOpenViewArguments extends OpenViewArguments {
|
|
37
|
+
uri: string | undefined;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const ScmHistorySupport = Symbol('scm-history-support');
|
|
41
|
+
export interface ScmHistorySupport {
|
|
42
|
+
getCommitHistory(options?: HistoryWidgetOptions): Promise<ScmHistoryCommit[]>;
|
|
43
|
+
readonly onDidChangeHistory: Event<void>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ScmCommitNode {
|
|
47
|
+
commitDetails: ScmHistoryCommit;
|
|
48
|
+
authorAvatar: string;
|
|
49
|
+
fileChangeNodes: ScmFileChangeNode[];
|
|
50
|
+
expanded: boolean;
|
|
51
|
+
selected: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export namespace ScmCommitNode {
|
|
55
|
+
export function is(node: unknown): node is ScmCommitNode {
|
|
56
|
+
return !!node && typeof node === 'object' && 'commitDetails' in node && 'expanded' in node && 'selected' in node;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface HistoryWidgetOptions {
|
|
61
|
+
range?: {
|
|
62
|
+
toRevision?: string;
|
|
63
|
+
fromRevision?: string;
|
|
64
|
+
};
|
|
65
|
+
uri?: string;
|
|
66
|
+
maxCount?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type ScmHistoryListNode = (ScmCommitNode | ScmFileChangeNode);
|
|
@@ -1,90 +1,90 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 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 { MenuModelRegistry, CommandRegistry, SelectionService } from '@theia/core';
|
|
18
|
-
import { AbstractViewContribution } from '@theia/core/lib/browser';
|
|
19
|
-
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
20
|
-
import { NavigatorContextMenu } from '@theia/navigator/lib/browser/navigator-contribution';
|
|
21
|
-
import { UriCommandHandler, UriAwareCommandHandler } from '@theia/core/lib/common/uri-command-handler';
|
|
22
|
-
import URI from '@theia/core/lib/common/uri';
|
|
23
|
-
import { ScmHistoryWidget } from './scm-history-widget';
|
|
24
|
-
import { ScmService } from '@theia/scm/lib/browser/scm-service';
|
|
25
|
-
import { EDITOR_CONTEXT_MENU_SCM } from '../scm-extra-contribution';
|
|
26
|
-
import { SCM_HISTORY_ID, SCM_HISTORY_LABEL, ScmHistoryCommands, SCM_HISTORY_TOGGLE_KEYBINDING, ScmHistoryOpenViewArguments } from './scm-history-constants';
|
|
27
|
-
export { SCM_HISTORY_ID, SCM_HISTORY_LABEL, ScmHistoryCommands, SCM_HISTORY_TOGGLE_KEYBINDING, ScmHistoryOpenViewArguments };
|
|
28
|
-
|
|
29
|
-
@injectable()
|
|
30
|
-
export class ScmHistoryContribution extends AbstractViewContribution<ScmHistoryWidget> {
|
|
31
|
-
|
|
32
|
-
@inject(SelectionService)
|
|
33
|
-
protected readonly selectionService: SelectionService;
|
|
34
|
-
@inject(ScmService)
|
|
35
|
-
protected readonly scmService: ScmService;
|
|
36
|
-
|
|
37
|
-
constructor() {
|
|
38
|
-
super({
|
|
39
|
-
widgetId: SCM_HISTORY_ID,
|
|
40
|
-
widgetName: SCM_HISTORY_LABEL,
|
|
41
|
-
defaultWidgetOptions: {
|
|
42
|
-
area: 'left',
|
|
43
|
-
rank: 500
|
|
44
|
-
},
|
|
45
|
-
toggleCommandId: ScmHistoryCommands.OPEN_BRANCH_HISTORY.id,
|
|
46
|
-
toggleKeybinding: SCM_HISTORY_TOGGLE_KEYBINDING
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
override async openView(args?: Partial<ScmHistoryOpenViewArguments>): Promise<ScmHistoryWidget> {
|
|
51
|
-
const widget = await super.openView(args);
|
|
52
|
-
this.refreshWidget(args!.uri);
|
|
53
|
-
return widget;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
override registerMenus(menus: MenuModelRegistry): void {
|
|
57
|
-
menus.registerMenuAction(NavigatorContextMenu.SEARCH, {
|
|
58
|
-
commandId: ScmHistoryCommands.OPEN_FILE_HISTORY.id,
|
|
59
|
-
label: SCM_HISTORY_LABEL
|
|
60
|
-
});
|
|
61
|
-
menus.registerMenuAction(EDITOR_CONTEXT_MENU_SCM, {
|
|
62
|
-
commandId: ScmHistoryCommands.OPEN_FILE_HISTORY.id,
|
|
63
|
-
label: SCM_HISTORY_LABEL
|
|
64
|
-
});
|
|
65
|
-
super.registerMenus(menus);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
override registerCommands(commands: CommandRegistry): void {
|
|
69
|
-
commands.registerCommand(ScmHistoryCommands.OPEN_FILE_HISTORY, this.newUriAwareCommandHandler({
|
|
70
|
-
isEnabled: (uri: URI) => !!this.scmService.findRepository(uri),
|
|
71
|
-
isVisible: (uri: URI) => !!this.scmService.findRepository(uri),
|
|
72
|
-
execute: async uri => this.openView({ activate: true, uri: uri.toString() }),
|
|
73
|
-
}));
|
|
74
|
-
super.registerCommands(commands);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
protected async refreshWidget(uri: string | undefined): Promise<void> {
|
|
78
|
-
const widget = this.tryGetWidget();
|
|
79
|
-
if (!widget) {
|
|
80
|
-
// the widget doesn't exist, so don't wake it up
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
await widget.setContent({ uri });
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
protected newUriAwareCommandHandler(handler: UriCommandHandler<URI>): UriAwareCommandHandler<URI> {
|
|
87
|
-
return UriAwareCommandHandler.MonoSelect(this.selectionService, handler);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 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 { MenuModelRegistry, CommandRegistry, SelectionService } from '@theia/core';
|
|
18
|
+
import { AbstractViewContribution } from '@theia/core/lib/browser';
|
|
19
|
+
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
20
|
+
import { NavigatorContextMenu } from '@theia/navigator/lib/browser/navigator-contribution';
|
|
21
|
+
import { UriCommandHandler, UriAwareCommandHandler } from '@theia/core/lib/common/uri-command-handler';
|
|
22
|
+
import URI from '@theia/core/lib/common/uri';
|
|
23
|
+
import { ScmHistoryWidget } from './scm-history-widget';
|
|
24
|
+
import { ScmService } from '@theia/scm/lib/browser/scm-service';
|
|
25
|
+
import { EDITOR_CONTEXT_MENU_SCM } from '../scm-extra-contribution';
|
|
26
|
+
import { SCM_HISTORY_ID, SCM_HISTORY_LABEL, ScmHistoryCommands, SCM_HISTORY_TOGGLE_KEYBINDING, ScmHistoryOpenViewArguments } from './scm-history-constants';
|
|
27
|
+
export { SCM_HISTORY_ID, SCM_HISTORY_LABEL, ScmHistoryCommands, SCM_HISTORY_TOGGLE_KEYBINDING, ScmHistoryOpenViewArguments };
|
|
28
|
+
|
|
29
|
+
@injectable()
|
|
30
|
+
export class ScmHistoryContribution extends AbstractViewContribution<ScmHistoryWidget> {
|
|
31
|
+
|
|
32
|
+
@inject(SelectionService)
|
|
33
|
+
protected readonly selectionService: SelectionService;
|
|
34
|
+
@inject(ScmService)
|
|
35
|
+
protected readonly scmService: ScmService;
|
|
36
|
+
|
|
37
|
+
constructor() {
|
|
38
|
+
super({
|
|
39
|
+
widgetId: SCM_HISTORY_ID,
|
|
40
|
+
widgetName: SCM_HISTORY_LABEL,
|
|
41
|
+
defaultWidgetOptions: {
|
|
42
|
+
area: 'left',
|
|
43
|
+
rank: 500
|
|
44
|
+
},
|
|
45
|
+
toggleCommandId: ScmHistoryCommands.OPEN_BRANCH_HISTORY.id,
|
|
46
|
+
toggleKeybinding: SCM_HISTORY_TOGGLE_KEYBINDING
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override async openView(args?: Partial<ScmHistoryOpenViewArguments>): Promise<ScmHistoryWidget> {
|
|
51
|
+
const widget = await super.openView(args);
|
|
52
|
+
this.refreshWidget(args!.uri);
|
|
53
|
+
return widget;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
override registerMenus(menus: MenuModelRegistry): void {
|
|
57
|
+
menus.registerMenuAction(NavigatorContextMenu.SEARCH, {
|
|
58
|
+
commandId: ScmHistoryCommands.OPEN_FILE_HISTORY.id,
|
|
59
|
+
label: SCM_HISTORY_LABEL
|
|
60
|
+
});
|
|
61
|
+
menus.registerMenuAction(EDITOR_CONTEXT_MENU_SCM, {
|
|
62
|
+
commandId: ScmHistoryCommands.OPEN_FILE_HISTORY.id,
|
|
63
|
+
label: SCM_HISTORY_LABEL
|
|
64
|
+
});
|
|
65
|
+
super.registerMenus(menus);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
override registerCommands(commands: CommandRegistry): void {
|
|
69
|
+
commands.registerCommand(ScmHistoryCommands.OPEN_FILE_HISTORY, this.newUriAwareCommandHandler({
|
|
70
|
+
isEnabled: (uri: URI) => !!this.scmService.findRepository(uri),
|
|
71
|
+
isVisible: (uri: URI) => !!this.scmService.findRepository(uri),
|
|
72
|
+
execute: async uri => this.openView({ activate: true, uri: uri.toString() }),
|
|
73
|
+
}));
|
|
74
|
+
super.registerCommands(commands);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
protected async refreshWidget(uri: string | undefined): Promise<void> {
|
|
78
|
+
const widget = this.tryGetWidget();
|
|
79
|
+
if (!widget) {
|
|
80
|
+
// the widget doesn't exist, so don't wake it up
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
await widget.setContent({ uri });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
protected newUriAwareCommandHandler(handler: UriCommandHandler<URI>): UriAwareCommandHandler<URI> {
|
|
87
|
+
return UriAwareCommandHandler.MonoSelect(this.selectionService, handler);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2019 Arm 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 { ScmHistoryContribution, SCM_HISTORY_ID } from './scm-history-contribution';
|
|
19
|
-
import { WidgetFactory, bindViewContribution, ApplicationShellLayoutMigration } from '@theia/core/lib/browser';
|
|
20
|
-
import { ScmHistoryWidget } from './scm-history-widget';
|
|
21
|
-
import { ScmExtraLayoutVersion4Migration } from '../scm-extra-layout-migrations';
|
|
22
|
-
|
|
23
|
-
import '../../../src/browser/style/history.css';
|
|
24
|
-
|
|
25
|
-
export function bindScmHistoryModule(bind: interfaces.Bind): void {
|
|
26
|
-
|
|
27
|
-
bind(ScmHistoryWidget).toSelf();
|
|
28
|
-
bind(WidgetFactory).toDynamicValue(ctx => ({
|
|
29
|
-
id: SCM_HISTORY_ID,
|
|
30
|
-
createWidget: () => ctx.container.get<ScmHistoryWidget>(ScmHistoryWidget)
|
|
31
|
-
}));
|
|
32
|
-
|
|
33
|
-
bindViewContribution(bind, ScmHistoryContribution);
|
|
34
|
-
|
|
35
|
-
bind(ApplicationShellLayoutMigration).to(ScmExtraLayoutVersion4Migration).inSingletonScope();
|
|
36
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2019 Arm 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 { ScmHistoryContribution, SCM_HISTORY_ID } from './scm-history-contribution';
|
|
19
|
+
import { WidgetFactory, bindViewContribution, ApplicationShellLayoutMigration } from '@theia/core/lib/browser';
|
|
20
|
+
import { ScmHistoryWidget } from './scm-history-widget';
|
|
21
|
+
import { ScmExtraLayoutVersion4Migration } from '../scm-extra-layout-migrations';
|
|
22
|
+
|
|
23
|
+
import '../../../src/browser/style/history.css';
|
|
24
|
+
|
|
25
|
+
export function bindScmHistoryModule(bind: interfaces.Bind): void {
|
|
26
|
+
|
|
27
|
+
bind(ScmHistoryWidget).toSelf();
|
|
28
|
+
bind(WidgetFactory).toDynamicValue(ctx => ({
|
|
29
|
+
id: SCM_HISTORY_ID,
|
|
30
|
+
createWidget: () => ctx.container.get<ScmHistoryWidget>(ScmHistoryWidget)
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
bindViewContribution(bind, ScmHistoryContribution);
|
|
34
|
+
|
|
35
|
+
bind(ApplicationShellLayoutMigration).to(ScmExtraLayoutVersion4Migration).inSingletonScope();
|
|
36
|
+
}
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 Arm 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 { ScmProvider } from '@theia/scm/lib/browser/scm-provider';
|
|
18
|
-
import { ScmHistorySupport } from './scm-history-constants';
|
|
19
|
-
|
|
20
|
-
export interface ScmHistoryProvider extends ScmProvider {
|
|
21
|
-
historySupport?: ScmHistorySupport;
|
|
22
|
-
}
|
|
23
|
-
export namespace ScmHistoryProvider {
|
|
24
|
-
export function is(scmProvider: ScmProvider | undefined): scmProvider is ScmHistoryProvider {
|
|
25
|
-
return !!scmProvider && 'historySupport' in scmProvider;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 Arm 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 { ScmProvider } from '@theia/scm/lib/browser/scm-provider';
|
|
18
|
+
import { ScmHistorySupport } from './scm-history-constants';
|
|
19
|
+
|
|
20
|
+
export interface ScmHistoryProvider extends ScmProvider {
|
|
21
|
+
historySupport?: ScmHistorySupport;
|
|
22
|
+
}
|
|
23
|
+
export namespace ScmHistoryProvider {
|
|
24
|
+
export function is(scmProvider: ScmProvider | undefined): scmProvider is ScmHistoryProvider {
|
|
25
|
+
return !!scmProvider && 'historySupport' in scmProvider;
|
|
26
|
+
}
|
|
27
|
+
}
|