|
1 |
| -import { injectable, inject } from '@theia/core/shared/inversify'; |
2 |
| -import { EditorWidget } from '@theia/editor/lib/browser'; |
3 |
| -import { MessageService } from '@theia/core/lib/common/message-service'; |
4 |
| -import { OutputWidget } from '@theia/output/lib/browser/output-widget'; |
5 |
| -import { |
6 |
| - ConnectionStatusService, |
7 |
| - ConnectionStatus, |
8 |
| -} from '@theia/core/lib/browser/connection-status-service'; |
9 | 1 | import {
|
10 | 2 | ApplicationShell as TheiaApplicationShell,
|
11 | 3 | DockPanel,
|
12 | 4 | DockPanelRenderer as TheiaDockPanelRenderer,
|
13 | 5 | Panel,
|
| 6 | + SaveOptions, |
| 7 | + SHELL_TABBAR_CONTEXT_MENU, |
14 | 8 | TabBar,
|
15 | 9 | Widget,
|
16 |
| - SHELL_TABBAR_CONTEXT_MENU, |
17 |
| - SaveOptions, |
18 | 10 | } from '@theia/core/lib/browser';
|
19 |
| -import { Sketch } from '../../../common/protocol'; |
20 | 11 | import {
|
21 |
| - CurrentSketch, |
22 |
| - SketchesServiceClientImpl, |
23 |
| -} from '../../../common/protocol/sketches-service-client-impl'; |
24 |
| -import { nls } from '@theia/core/lib/common'; |
25 |
| -import URI from '@theia/core/lib/common/uri'; |
| 12 | + ConnectionStatus, |
| 13 | + ConnectionStatusService, |
| 14 | +} from '@theia/core/lib/browser/connection-status-service'; |
| 15 | +import { nls } from '@theia/core/lib/common/nls'; |
| 16 | +import { MessageService } from '@theia/core/lib/common/message-service'; |
| 17 | +import { inject, injectable } from '@theia/core/shared/inversify'; |
26 | 18 | import { ToolbarAwareTabBar } from './tab-bars';
|
27 | 19 |
|
28 | 20 | @injectable()
|
29 | 21 | export class ApplicationShell extends TheiaApplicationShell {
|
30 | 22 | @inject(MessageService)
|
31 | 23 | private readonly messageService: MessageService;
|
32 | 24 |
|
33 |
| - @inject(SketchesServiceClientImpl) |
34 |
| - private readonly sketchesServiceClient: SketchesServiceClientImpl; |
35 |
| - |
36 | 25 | @inject(ConnectionStatusService)
|
37 | 26 | private readonly connectionStatusService: ConnectionStatusService;
|
38 | 27 |
|
39 |
| - protected override track(widget: Widget): void { |
40 |
| - super.track(widget); |
41 |
| - if (widget instanceof OutputWidget) { |
42 |
| - widget.title.closable = false; // TODO: https://arduino.slack.com/archives/C01698YT7S4/p1598011990133700 |
43 |
| - } |
44 |
| - if (widget instanceof EditorWidget) { |
45 |
| - // Make the editor un-closeable asynchronously. |
46 |
| - this.sketchesServiceClient.currentSketch().then((sketch) => { |
47 |
| - if (CurrentSketch.isValid(sketch)) { |
48 |
| - if (!this.isSketchFile(widget.editor.uri, sketch.uri)) { |
49 |
| - return; |
50 |
| - } |
51 |
| - if (Sketch.isInSketch(widget.editor.uri, sketch)) { |
52 |
| - widget.title.closable = false; |
53 |
| - } |
54 |
| - } |
55 |
| - }); |
56 |
| - } |
57 |
| - } |
58 |
| - |
59 |
| - private isSketchFile(uri: URI, sketchUriString: string): boolean { |
60 |
| - const sketchUri = new URI(sketchUriString); |
61 |
| - if (uri.parent.isEqual(sketchUri)) { |
62 |
| - return true; |
63 |
| - } |
64 |
| - return false; |
65 |
| - } |
66 |
| - |
67 | 28 | override async addWidget(
|
68 | 29 | widget: Widget,
|
69 | 30 | options: Readonly<TheiaApplicationShell.WidgetOptions> = {}
|
|
0 commit comments