mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-08 20:06:32 +00:00
PROEDITOR-20: Restored the dirt flag in editor tab
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
cf44fe2ad0
commit
d6637c44e5
@ -46,8 +46,6 @@ import { SilentMonacoStatusBarContribution } from './customization/silent-monaco
|
|||||||
import { ApplicationShell } from '@theia/core/lib/browser';
|
import { ApplicationShell } from '@theia/core/lib/browser';
|
||||||
import { CustomApplicationShell } from './customization/custom-application-shell';
|
import { CustomApplicationShell } from './customization/custom-application-shell';
|
||||||
import { CustomFrontendApplication } from './customization/custom-frontend-application';
|
import { CustomFrontendApplication } from './customization/custom-frontend-application';
|
||||||
import { EditorWidgetFactory } from '@theia/editor/lib/browser/editor-widget-factory';
|
|
||||||
import { CustomEditorWidgetFactory } from './customization/custom-editor-widget-factory';
|
|
||||||
import { SelectBoardDialog, SelectBoardDialogProps } from './boards/select-board-dialog';
|
import { SelectBoardDialog, SelectBoardDialogProps } from './boards/select-board-dialog';
|
||||||
import { SelectBoardDialogWidget } from './boards/select-board-dialog-widget';
|
import { SelectBoardDialogWidget } from './boards/select-board-dialog-widget';
|
||||||
|
|
||||||
@ -152,6 +150,4 @@ export default new ContainerModule((bind: interfaces.Bind, unbind: interfaces.Un
|
|||||||
bind(ApplicationShell).to(CustomApplicationShell).inSingletonScope();
|
bind(ApplicationShell).to(CustomApplicationShell).inSingletonScope();
|
||||||
unbind(FrontendApplication);
|
unbind(FrontendApplication);
|
||||||
bind(FrontendApplication).to(CustomFrontendApplication).inSingletonScope();
|
bind(FrontendApplication).to(CustomFrontendApplication).inSingletonScope();
|
||||||
unbind(EditorWidgetFactory);
|
|
||||||
bind(EditorWidgetFactory).to(CustomEditorWidgetFactory).inSingletonScope();
|
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,33 @@
|
|||||||
import { ApplicationShell } from "@theia/core/lib/browser";
|
import { ApplicationShell, Widget, Saveable, FocusTracker, Message } from '@theia/core/lib/browser';
|
||||||
|
import { EditorWidget } from '@theia/editor/lib/browser';
|
||||||
|
|
||||||
export class CustomApplicationShell extends ApplicationShell {
|
export class CustomApplicationShell extends ApplicationShell {
|
||||||
|
|
||||||
protected refreshBottomPanelToggleButton() {
|
protected refreshBottomPanelToggleButton() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async track(widget: Widget): Promise<void> {
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private disableClose(widget: Widget | undefined): void {
|
||||||
|
if (widget instanceof EditorWidget) {
|
||||||
|
const onCloseRequest = (_: Message) => {
|
||||||
|
// NOOP
|
||||||
|
};
|
||||||
|
(widget as any).onCloseRequest = onCloseRequest.bind(widget);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,22 +0,0 @@
|
|||||||
import { injectable } from "inversify";
|
|
||||||
import { EditorWidgetFactory } from "@theia/editor/lib/browser/editor-widget-factory";
|
|
||||||
import URI from "@theia/core/lib/common/uri";
|
|
||||||
import { EditorWidget } from "@theia/editor/lib/browser";
|
|
||||||
|
|
||||||
@injectable()
|
|
||||||
export class CustomEditorWidgetFactory extends EditorWidgetFactory {
|
|
||||||
|
|
||||||
protected async createEditor(uri: URI): Promise<EditorWidget> {
|
|
||||||
const icon = await this.labelProvider.getIcon(uri);
|
|
||||||
return this.editorProvider(uri).then(textEditor => {
|
|
||||||
const newEditor = new EditorWidget(textEditor, this.selectionService);
|
|
||||||
newEditor.id = this.id + ':' + uri.toString();
|
|
||||||
newEditor.title.closable = false;
|
|
||||||
newEditor.title.label = this.labelProvider.getName(uri);
|
|
||||||
newEditor.title.iconClass = icon + ' file-icon';
|
|
||||||
newEditor.title.caption = this.labelProvider.getLongName(uri);
|
|
||||||
return newEditor;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
13
arduino-ide-extension/src/browser/style/editor.css
Normal file
13
arduino-ide-extension/src/browser/style/editor.css
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
/* Do not show the `close` icon for editor, but show the dirty state. */
|
||||||
|
.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable:hover > .p-TabBar-tabCloseIcon,
|
||||||
|
.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-current > .p-TabBar-tabCloseIcon {
|
||||||
|
background-image: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable.theia-mod-dirty:hover > .p-TabBar-tabCloseIcon,
|
||||||
|
.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;
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
@import './list-widget.css';
|
@import './list-widget.css';
|
||||||
@import './board-select-dialog.css';
|
@import './board-select-dialog.css';
|
||||||
@import './main.css';
|
@import './main.css';
|
||||||
|
@import './editor.css';
|
Loading…
x
Reference in New Issue
Block a user