Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions arduino-ide-extension/src/browser/theia/core/application-shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Sketch } from '../../../common/protocol';
import { SaveAsSketch } from '../../contributions/save-as-sketch';
import { SketchesServiceClientImpl } from '../../../common/protocol/sketches-service-client-impl';
import { nls } from '@theia/core/lib/common';
import URI from '@theia/core/lib/common/uri';

@injectable()
export class ApplicationShell extends TheiaApplicationShell {
Expand All @@ -41,6 +42,9 @@ export class ApplicationShell extends TheiaApplicationShell {
// Make the editor un-closeable asynchronously.
this.sketchesServiceClient.currentSketch().then((sketch) => {
if (sketch) {
if (!this.isSketchFile(widget.editor.uri, sketch.uri)) {
return;
}
if (Sketch.isInSketch(widget.editor.uri, sketch)) {
widget.title.closable = false;
}
Expand All @@ -49,6 +53,14 @@ export class ApplicationShell extends TheiaApplicationShell {
}
}

private isSketchFile(uri: URI, sketchUriString: string): boolean {
const sketchUri = new URI(sketchUriString);
if (uri.parent.isEqual(sketchUri)) {
return true;
}
return false;
}

async addWidget(
widget: Widget,
options: Readonly<TheiaApplicationShell.WidgetOptions> = {}
Expand Down