Made the CLI config closeable in classic mode.

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2020-07-15 15:54:52 +02:00
parent 55ce04fe3f
commit d29141aff6
4 changed files with 8 additions and 38 deletions

View File

@ -1,10 +1,10 @@
import { injectable, inject } from 'inversify';
import { ApplicationShell, Widget, Saveable, FocusTracker, Message } from '@theia/core/lib/browser';
import { EditorWidget } from '@theia/editor/lib/browser';
import { CommandService } from '@theia/core/lib/common/command';
import { ApplicationShell, Widget } from '@theia/core/lib/browser';
import { EditorMode } from '../editor-mode';
import { CommandService } from '@theia/core';
import { ArduinoCommands } from '../arduino-commands';
import { EditorWidget } from '@theia/editor/lib/browser';
@injectable()
export class ArduinoApplicationShell extends ApplicationShell {
@ -19,18 +19,10 @@ export class ArduinoApplicationShell extends ApplicationShell {
if (this.editorMode.proMode) {
super.track(widget);
} else {
const tracker = (this as any).tracker as FocusTracker<Widget>;
tracker.add(widget);
this.disableClose(Saveable.apply(widget));
if (ApplicationShell.TrackableWidgetProvider.is(widget)) {
for (const toTrack of await widget.getTrackableWidgets()) {
tracker.add(toTrack);
this.disableClose(Saveable.apply(toTrack));
}
if (widget.onDidChangeTrackableWidgets) {
widget.onDidChangeTrackableWidgets(widgets => widgets.forEach(w => this.track(w)));
}
if (widget instanceof EditorWidget && widget.editor.uri.toString().endsWith('arduino-cli.yaml')) {
return;
}
widget.title.closable = false;
}
}
@ -39,13 +31,4 @@ export class ArduinoApplicationShell extends ApplicationShell {
await this.commandService.executeCommand(ArduinoCommands.SAVE_SKETCH_AS.id, { execOnlyIfTemp: true });
}
private disableClose(widget: Widget | undefined): void {
if (widget instanceof EditorWidget) {
const onCloseRequest = (_: Message) => {
// NOOP
};
(widget as any).onCloseRequest = onCloseRequest.bind(widget);
}
}
}

View File

@ -1,13 +0,0 @@
/* Do not show the `close` icon for editor, but show the dirty state if not in pro-mode. */
body:not(.arduino-advanced-mode) .p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable:hover > .p-TabBar-tabCloseIcon,
body:not(.arduino-advanced-mode) .p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-current > .p-TabBar-tabCloseIcon {
background-image: none;
cursor: pointer;
}
body:not(.arduino-advanced-mode) .p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable.theia-mod-dirty:hover > .p-TabBar-tabCloseIcon,
body:not(.arduino-advanced-mode) .p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable.theia-mod-dirty > .p-TabBar-tabCloseIcon:hover {
background-size: 10px;
background-image: var(--theia-icon-circle);
cursor: pointer;
}

View File

@ -1,7 +1,6 @@
@import './list-widget.css';
@import './board-select-dialog.css';
@import './main.css';
@import './editor.css';
@import './monitor.css';
@import './arduino-select.css';

View File

@ -28,7 +28,8 @@
background: var(--theia-button-hoverBackground);
}
.arduino-verify, .arduino-upload {
.arduino-verify,
.arduino-upload {
border-radius: 12px;
}