@theia/timeline 1.53.0-next.5 → 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 +30 -30
- package/package.json +5 -5
- package/src/browser/style/index.css +49 -49
- package/src/browser/timeline-context-key-service.ts +36 -36
- package/src/browser/timeline-contribution.ts +112 -112
- package/src/browser/timeline-empty-widget.tsx +40 -40
- package/src/browser/timeline-frontend-module.ts +71 -71
- package/src/browser/timeline-service.ts +124 -124
- package/src/browser/timeline-tree-model.ts +72 -72
- package/src/browser/timeline-tree-widget.tsx +120 -120
- package/src/browser/timeline-widget.tsx +179 -179
- package/src/common/timeline-model.ts +84 -84
- package/src/package.spec.ts +29 -29
package/README.md
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
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>THEIA - TIMELINE EXTENSION</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Description
|
|
14
|
-
|
|
15
|
-
The `@theia/timeline` extension adds Timeline view for visualizing time-series events.
|
|
16
|
-
|
|
17
|
-
## Additional Information
|
|
18
|
-
|
|
19
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
20
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
21
|
-
- [VS Code Timeline Documentation](https://code.visualstudio.com/updates/v1_44#_timeline-view)
|
|
22
|
-
|
|
23
|
-
## License
|
|
24
|
-
|
|
25
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
26
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
27
|
-
|
|
28
|
-
## Trademark
|
|
29
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
30
|
-
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>THEIA - TIMELINE EXTENSION</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
The `@theia/timeline` extension adds Timeline view for visualizing time-series events.
|
|
16
|
+
|
|
17
|
+
## Additional Information
|
|
18
|
+
|
|
19
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
20
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
21
|
+
- [VS Code Timeline Documentation](https://code.visualstudio.com/updates/v1_44#_timeline-view)
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
26
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
27
|
+
|
|
28
|
+
## Trademark
|
|
29
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
30
|
+
https://www.eclipse.org/theia
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/timeline",
|
|
3
|
-
"version": "1.53.0-next.
|
|
3
|
+
"version": "1.53.0-next.55+d1a989a68c",
|
|
4
4
|
"description": "Theia - Timeline Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.53.0-next.
|
|
7
|
-
"@theia/navigator": "1.53.0-next.
|
|
6
|
+
"@theia/core": "1.53.0-next.55+d1a989a68c",
|
|
7
|
+
"@theia/navigator": "1.53.0-next.55+d1a989a68c",
|
|
8
8
|
"tslib": "^2.6.2"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"watch": "theiaext watch"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@theia/ext-scripts": "1.
|
|
43
|
+
"@theia/ext-scripts": "1.53.0"
|
|
44
44
|
},
|
|
45
45
|
"nyc": {
|
|
46
46
|
"extends": "../../configs/nyc.json"
|
|
47
47
|
},
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
|
|
49
49
|
}
|
|
@@ -1,49 +1,49 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (C) 2020 RedHat 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
|
-
.theia-timeline {
|
|
18
|
-
box-sizing: border-box;
|
|
19
|
-
height: 100%;
|
|
20
|
-
display: flex;
|
|
21
|
-
flex-direction: column;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
.theia-timeline .timeline-outer-container {
|
|
25
|
-
overflow-y: auto;
|
|
26
|
-
width: 100%;
|
|
27
|
-
flex-grow: 1;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
.theia-timeline .timeline-item {
|
|
31
|
-
font-size: var(--theia-ui-font-size1);
|
|
32
|
-
display: flex;
|
|
33
|
-
overflow: hidden;
|
|
34
|
-
align-items: center;
|
|
35
|
-
justify-content: space-between;
|
|
36
|
-
height: var(--theia-content-line-height);
|
|
37
|
-
line-height: var(--theia-content-line-height);
|
|
38
|
-
padding: 0px calc(var(--theia-ui-padding) / 2);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.theia-timeline .timeline-item:hover {
|
|
42
|
-
cursor: pointer;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.theia-timeline .timeline-item .label {
|
|
46
|
-
font-size: var(--theia-ui-font-size0);
|
|
47
|
-
margin-left: var(--theia-ui-padding);
|
|
48
|
-
opacity: 0.7;
|
|
49
|
-
}
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (C) 2020 RedHat 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
|
+
.theia-timeline {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
height: 100%;
|
|
20
|
+
display: flex;
|
|
21
|
+
flex-direction: column;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.theia-timeline .timeline-outer-container {
|
|
25
|
+
overflow-y: auto;
|
|
26
|
+
width: 100%;
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.theia-timeline .timeline-item {
|
|
31
|
+
font-size: var(--theia-ui-font-size1);
|
|
32
|
+
display: flex;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
align-items: center;
|
|
35
|
+
justify-content: space-between;
|
|
36
|
+
height: var(--theia-content-line-height);
|
|
37
|
+
line-height: var(--theia-content-line-height);
|
|
38
|
+
padding: 0px calc(var(--theia-ui-padding) / 2);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.theia-timeline .timeline-item:hover {
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.theia-timeline .timeline-item .label {
|
|
46
|
+
font-size: var(--theia-ui-font-size0);
|
|
47
|
+
margin-left: var(--theia-ui-padding);
|
|
48
|
+
opacity: 0.7;
|
|
49
|
+
}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 RedHat 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, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
19
|
-
|
|
20
|
-
@injectable()
|
|
21
|
-
export class TimelineContextKeyService {
|
|
22
|
-
|
|
23
|
-
@inject(ContextKeyService)
|
|
24
|
-
protected readonly contextKeyService: ContextKeyService;
|
|
25
|
-
|
|
26
|
-
protected _timelineItem: ContextKey<string | undefined>;
|
|
27
|
-
get timelineItem(): ContextKey<string | undefined> {
|
|
28
|
-
return this._timelineItem;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@postConstruct()
|
|
32
|
-
protected init(): void {
|
|
33
|
-
this._timelineItem = this.contextKeyService.createKey<string | undefined>('timelineItem', undefined);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 RedHat 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, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ContextKeyService, ContextKey } from '@theia/core/lib/browser/context-key-service';
|
|
19
|
+
|
|
20
|
+
@injectable()
|
|
21
|
+
export class TimelineContextKeyService {
|
|
22
|
+
|
|
23
|
+
@inject(ContextKeyService)
|
|
24
|
+
protected readonly contextKeyService: ContextKeyService;
|
|
25
|
+
|
|
26
|
+
protected _timelineItem: ContextKey<string | undefined>;
|
|
27
|
+
get timelineItem(): ContextKey<string | undefined> {
|
|
28
|
+
return this._timelineItem;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@postConstruct()
|
|
32
|
+
protected init(): void {
|
|
33
|
+
this._timelineItem = this.contextKeyService.createKey<string | undefined>('timelineItem', undefined);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
}
|
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 RedHat 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 } from '@theia/core/shared/inversify';
|
|
18
|
-
import {
|
|
19
|
-
ViewContainer,
|
|
20
|
-
WidgetManager,
|
|
21
|
-
Widget,
|
|
22
|
-
ApplicationShell,
|
|
23
|
-
Navigatable,
|
|
24
|
-
codicon
|
|
25
|
-
} from '@theia/core/lib/browser';
|
|
26
|
-
import { EXPLORER_VIEW_CONTAINER_ID } from '@theia/navigator/lib/browser';
|
|
27
|
-
import { TimelineWidget } from './timeline-widget';
|
|
28
|
-
import { TimelineService } from './timeline-service';
|
|
29
|
-
import { CommandContribution, CommandRegistry } from '@theia/core/lib/common';
|
|
30
|
-
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
31
|
-
import { toArray } from '@theia/core/shared/@phosphor/algorithm';
|
|
32
|
-
import { LOAD_MORE_COMMAND } from './timeline-tree-model';
|
|
33
|
-
|
|
34
|
-
@injectable()
|
|
35
|
-
export class TimelineContribution implements CommandContribution, TabBarToolbarContribution {
|
|
36
|
-
|
|
37
|
-
@inject(WidgetManager)
|
|
38
|
-
protected readonly widgetManager: WidgetManager;
|
|
39
|
-
@inject(TimelineService)
|
|
40
|
-
protected readonly timelineService: TimelineService;
|
|
41
|
-
@inject(CommandRegistry)
|
|
42
|
-
protected readonly commandRegistry: CommandRegistry;
|
|
43
|
-
@inject(TabBarToolbarRegistry)
|
|
44
|
-
protected readonly tabBarToolbar: TabBarToolbarRegistry;
|
|
45
|
-
@inject(ApplicationShell)
|
|
46
|
-
protected readonly shell: ApplicationShell;
|
|
47
|
-
|
|
48
|
-
/** @deprecated @since 1.28.0. Import from timeline-tree-model instead */
|
|
49
|
-
public static readonly LOAD_MORE_COMMAND = LOAD_MORE_COMMAND;
|
|
50
|
-
private readonly toolbarItem = {
|
|
51
|
-
id: 'timeline-refresh-toolbar-item',
|
|
52
|
-
command: 'timeline-refresh',
|
|
53
|
-
tooltip: 'Refresh',
|
|
54
|
-
icon: codicon('refresh')
|
|
55
|
-
};
|
|
56
|
-
registerToolbarItems(registry: TabBarToolbarRegistry): void {
|
|
57
|
-
registry.registerItem(this.toolbarItem);
|
|
58
|
-
}
|
|
59
|
-
registerCommands(commands: CommandRegistry): void {
|
|
60
|
-
const attachTimeline = async (explorer: Widget) => {
|
|
61
|
-
const timeline = await this.widgetManager.getOrCreateWidget(TimelineWidget.ID);
|
|
62
|
-
if (explorer instanceof ViewContainer && explorer.getTrackableWidgets().indexOf(timeline) === -1) {
|
|
63
|
-
explorer.addWidget(timeline, { initiallyCollapsed: true });
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
this.widgetManager.onWillCreateWidget(async event => {
|
|
67
|
-
if (event.widget.id === EXPLORER_VIEW_CONTAINER_ID && this.timelineService.getSources().length > 0) {
|
|
68
|
-
event.waitUntil(attachTimeline(event.widget));
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
this.timelineService.onDidChangeProviders(async event => {
|
|
72
|
-
const explorer = await this.widgetManager.getWidget(EXPLORER_VIEW_CONTAINER_ID);
|
|
73
|
-
if (explorer && event.added && event.added.length > 0) {
|
|
74
|
-
attachTimeline(explorer);
|
|
75
|
-
} else if (event.removed && this.timelineService.getSources().length === 0) {
|
|
76
|
-
const timeline = await this.widgetManager.getWidget(TimelineWidget.ID);
|
|
77
|
-
if (timeline) {
|
|
78
|
-
timeline.close();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
commands.registerCommand(LOAD_MORE_COMMAND, {
|
|
83
|
-
execute: async () => {
|
|
84
|
-
const widget = toArray(this.shell.mainPanel.widgets()).find(w => Navigatable.is(w) && w.isVisible && !w.isHidden);
|
|
85
|
-
if (Navigatable.is(widget)) {
|
|
86
|
-
const uri = widget.getResourceUri();
|
|
87
|
-
const timeline = await this.widgetManager.getWidget<TimelineWidget>(TimelineWidget.ID);
|
|
88
|
-
if (uri && timeline) {
|
|
89
|
-
timeline.loadTimeline(uri, false);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
commands.registerCommand({ id: this.toolbarItem.command }, {
|
|
95
|
-
execute: widget => this.checkWidget(widget, async () => {
|
|
96
|
-
const timeline = await this.widgetManager.getWidget(TimelineWidget.ID);
|
|
97
|
-
if (timeline) {
|
|
98
|
-
timeline.update();
|
|
99
|
-
}
|
|
100
|
-
}),
|
|
101
|
-
isEnabled: widget => this.checkWidget(widget, () => true),
|
|
102
|
-
isVisible: widget => this.checkWidget(widget, () => true)
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private checkWidget<T>(widget: Widget, cb: () => T): T | false {
|
|
107
|
-
if (widget instanceof TimelineWidget && widget.id === TimelineWidget.ID) {
|
|
108
|
-
return cb();
|
|
109
|
-
}
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 RedHat 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 } from '@theia/core/shared/inversify';
|
|
18
|
+
import {
|
|
19
|
+
ViewContainer,
|
|
20
|
+
WidgetManager,
|
|
21
|
+
Widget,
|
|
22
|
+
ApplicationShell,
|
|
23
|
+
Navigatable,
|
|
24
|
+
codicon
|
|
25
|
+
} from '@theia/core/lib/browser';
|
|
26
|
+
import { EXPLORER_VIEW_CONTAINER_ID } from '@theia/navigator/lib/browser';
|
|
27
|
+
import { TimelineWidget } from './timeline-widget';
|
|
28
|
+
import { TimelineService } from './timeline-service';
|
|
29
|
+
import { CommandContribution, CommandRegistry } from '@theia/core/lib/common';
|
|
30
|
+
import { TabBarToolbarContribution, TabBarToolbarRegistry } from '@theia/core/lib/browser/shell/tab-bar-toolbar';
|
|
31
|
+
import { toArray } from '@theia/core/shared/@phosphor/algorithm';
|
|
32
|
+
import { LOAD_MORE_COMMAND } from './timeline-tree-model';
|
|
33
|
+
|
|
34
|
+
@injectable()
|
|
35
|
+
export class TimelineContribution implements CommandContribution, TabBarToolbarContribution {
|
|
36
|
+
|
|
37
|
+
@inject(WidgetManager)
|
|
38
|
+
protected readonly widgetManager: WidgetManager;
|
|
39
|
+
@inject(TimelineService)
|
|
40
|
+
protected readonly timelineService: TimelineService;
|
|
41
|
+
@inject(CommandRegistry)
|
|
42
|
+
protected readonly commandRegistry: CommandRegistry;
|
|
43
|
+
@inject(TabBarToolbarRegistry)
|
|
44
|
+
protected readonly tabBarToolbar: TabBarToolbarRegistry;
|
|
45
|
+
@inject(ApplicationShell)
|
|
46
|
+
protected readonly shell: ApplicationShell;
|
|
47
|
+
|
|
48
|
+
/** @deprecated @since 1.28.0. Import from timeline-tree-model instead */
|
|
49
|
+
public static readonly LOAD_MORE_COMMAND = LOAD_MORE_COMMAND;
|
|
50
|
+
private readonly toolbarItem = {
|
|
51
|
+
id: 'timeline-refresh-toolbar-item',
|
|
52
|
+
command: 'timeline-refresh',
|
|
53
|
+
tooltip: 'Refresh',
|
|
54
|
+
icon: codicon('refresh')
|
|
55
|
+
};
|
|
56
|
+
registerToolbarItems(registry: TabBarToolbarRegistry): void {
|
|
57
|
+
registry.registerItem(this.toolbarItem);
|
|
58
|
+
}
|
|
59
|
+
registerCommands(commands: CommandRegistry): void {
|
|
60
|
+
const attachTimeline = async (explorer: Widget) => {
|
|
61
|
+
const timeline = await this.widgetManager.getOrCreateWidget(TimelineWidget.ID);
|
|
62
|
+
if (explorer instanceof ViewContainer && explorer.getTrackableWidgets().indexOf(timeline) === -1) {
|
|
63
|
+
explorer.addWidget(timeline, { initiallyCollapsed: true });
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
this.widgetManager.onWillCreateWidget(async event => {
|
|
67
|
+
if (event.widget.id === EXPLORER_VIEW_CONTAINER_ID && this.timelineService.getSources().length > 0) {
|
|
68
|
+
event.waitUntil(attachTimeline(event.widget));
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
this.timelineService.onDidChangeProviders(async event => {
|
|
72
|
+
const explorer = await this.widgetManager.getWidget(EXPLORER_VIEW_CONTAINER_ID);
|
|
73
|
+
if (explorer && event.added && event.added.length > 0) {
|
|
74
|
+
attachTimeline(explorer);
|
|
75
|
+
} else if (event.removed && this.timelineService.getSources().length === 0) {
|
|
76
|
+
const timeline = await this.widgetManager.getWidget(TimelineWidget.ID);
|
|
77
|
+
if (timeline) {
|
|
78
|
+
timeline.close();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
commands.registerCommand(LOAD_MORE_COMMAND, {
|
|
83
|
+
execute: async () => {
|
|
84
|
+
const widget = toArray(this.shell.mainPanel.widgets()).find(w => Navigatable.is(w) && w.isVisible && !w.isHidden);
|
|
85
|
+
if (Navigatable.is(widget)) {
|
|
86
|
+
const uri = widget.getResourceUri();
|
|
87
|
+
const timeline = await this.widgetManager.getWidget<TimelineWidget>(TimelineWidget.ID);
|
|
88
|
+
if (uri && timeline) {
|
|
89
|
+
timeline.loadTimeline(uri, false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
commands.registerCommand({ id: this.toolbarItem.command }, {
|
|
95
|
+
execute: widget => this.checkWidget(widget, async () => {
|
|
96
|
+
const timeline = await this.widgetManager.getWidget(TimelineWidget.ID);
|
|
97
|
+
if (timeline) {
|
|
98
|
+
timeline.update();
|
|
99
|
+
}
|
|
100
|
+
}),
|
|
101
|
+
isEnabled: widget => this.checkWidget(widget, () => true),
|
|
102
|
+
isVisible: widget => this.checkWidget(widget, () => true)
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
private checkWidget<T>(widget: Widget, cb: () => T): T | false {
|
|
107
|
+
if (widget instanceof TimelineWidget && widget.id === TimelineWidget.ID) {
|
|
108
|
+
return cb();
|
|
109
|
+
}
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 RedHat 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 } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ReactWidget } from '@theia/core/lib/browser';
|
|
19
|
-
import { AlertMessage } from '@theia/core/lib/browser/widgets/alert-message';
|
|
20
|
-
import * as React from '@theia/core/shared/react';
|
|
21
|
-
|
|
22
|
-
@injectable()
|
|
23
|
-
export class TimelineEmptyWidget extends ReactWidget {
|
|
24
|
-
|
|
25
|
-
static ID = 'timeline-empty-widget';
|
|
26
|
-
|
|
27
|
-
constructor() {
|
|
28
|
-
super();
|
|
29
|
-
this.addClass('theia-timeline-empty');
|
|
30
|
-
this.id = TimelineEmptyWidget.ID;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
protected render(): React.ReactNode {
|
|
34
|
-
return <AlertMessage
|
|
35
|
-
type='WARNING'
|
|
36
|
-
header='The active editor cannot provide timeline information.'
|
|
37
|
-
/>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 RedHat 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 } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ReactWidget } from '@theia/core/lib/browser';
|
|
19
|
+
import { AlertMessage } from '@theia/core/lib/browser/widgets/alert-message';
|
|
20
|
+
import * as React from '@theia/core/shared/react';
|
|
21
|
+
|
|
22
|
+
@injectable()
|
|
23
|
+
export class TimelineEmptyWidget extends ReactWidget {
|
|
24
|
+
|
|
25
|
+
static ID = 'timeline-empty-widget';
|
|
26
|
+
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.addClass('theia-timeline-empty');
|
|
30
|
+
this.id = TimelineEmptyWidget.ID;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
protected render(): React.ReactNode {
|
|
34
|
+
return <AlertMessage
|
|
35
|
+
type='WARNING'
|
|
36
|
+
header='The active editor cannot provide timeline information.'
|
|
37
|
+
/>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
}
|