mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-14 14:56:33 +00:00
ATL-667: Show dirty indicator on unclosable widget
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
41eeb337f9
commit
ca1b288706
@ -33,7 +33,9 @@ import {
|
|||||||
ApplicationShell as TheiaApplicationShell,
|
ApplicationShell as TheiaApplicationShell,
|
||||||
ShellLayoutRestorer as TheiaShellLayoutRestorer,
|
ShellLayoutRestorer as TheiaShellLayoutRestorer,
|
||||||
CommonFrontendContribution as TheiaCommonFrontendContribution,
|
CommonFrontendContribution as TheiaCommonFrontendContribution,
|
||||||
KeybindingRegistry as TheiaKeybindingRegistry
|
KeybindingRegistry as TheiaKeybindingRegistry,
|
||||||
|
TabBarRendererFactory,
|
||||||
|
ContextMenuRenderer
|
||||||
} from '@theia/core/lib/browser';
|
} from '@theia/core/lib/browser';
|
||||||
import { MenuContribution } from '@theia/core/lib/common/menu';
|
import { MenuContribution } from '@theia/core/lib/common/menu';
|
||||||
import { ApplicationShell } from './theia/core/application-shell';
|
import { ApplicationShell } from './theia/core/application-shell';
|
||||||
@ -120,6 +122,8 @@ import { OutputServicePath, OutputService } from '../common/protocol/output-serv
|
|||||||
import { NotificationCenter } from './notification-center';
|
import { NotificationCenter } from './notification-center';
|
||||||
import { NotificationServicePath, NotificationServiceServer } from '../common/protocol';
|
import { NotificationServicePath, NotificationServiceServer } from '../common/protocol';
|
||||||
import { About } from './contributions/about';
|
import { About } from './contributions/about';
|
||||||
|
import { IconThemeService } from '@theia/core/lib/browser/icon-theme-service';
|
||||||
|
import { TabBarRenderer } from './theia/core/tab-bars';
|
||||||
|
|
||||||
const ElementQueries = require('css-element-queries/src/ElementQueries');
|
const ElementQueries = require('css-element-queries/src/ElementQueries');
|
||||||
|
|
||||||
@ -329,4 +333,12 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|||||||
|
|
||||||
bind(NotificationCenter).toSelf().inSingletonScope();
|
bind(NotificationCenter).toSelf().inSingletonScope();
|
||||||
bind(NotificationServiceServer).toDynamicValue(context => WebSocketConnectionProvider.createProxy(context.container, NotificationServicePath)).inSingletonScope();
|
bind(NotificationServiceServer).toDynamicValue(context => WebSocketConnectionProvider.createProxy(context.container, NotificationServicePath)).inSingletonScope();
|
||||||
|
|
||||||
|
// Enable the dirty indicator on uncloseable widgets.
|
||||||
|
rebind(TabBarRendererFactory).toFactory(context => () => {
|
||||||
|
const contextMenuRenderer = context.container.get<ContextMenuRenderer>(ContextMenuRenderer);
|
||||||
|
const decoratorService = context.container.get<TabBarDecoratorService>(TabBarDecoratorService);
|
||||||
|
const iconThemeService = context.container.get<IconThemeService>(IconThemeService);
|
||||||
|
return new TabBarRenderer(contextMenuRenderer, decoratorService, iconThemeService);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
6
arduino-ide-extension/src/browser/style/editor.css
Normal file
6
arduino-ide-extension/src/browser/style/editor.css
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/* Show the dirty indicator on unclosable widgets. On hover, it should still show the dot instead of the X. */
|
||||||
|
/* https://github.com/arduino/arduino-pro-ide/issues/380 */
|
||||||
|
.p-TabBar.theia-app-centers .p-TabBar-tab.p-mod-closable.theia-mod-dirty > .p-TabBar-tabCloseIcon:hover {
|
||||||
|
background-size: 13px;
|
||||||
|
background-image: var(--theia-icon-circle);
|
||||||
|
}
|
@ -5,6 +5,7 @@
|
|||||||
@import './arduino-select.css';
|
@import './arduino-select.css';
|
||||||
@import './status-bar.css';
|
@import './status-bar.css';
|
||||||
@import './terminal.css';
|
@import './terminal.css';
|
||||||
|
@import './editor.css';
|
||||||
|
|
||||||
.theia-input.warning:focus {
|
.theia-input.warning:focus {
|
||||||
outline-width: 1px;
|
outline-width: 1px;
|
||||||
|
15
arduino-ide-extension/src/browser/theia/core/tab-bars.ts
Normal file
15
arduino-ide-extension/src/browser/theia/core/tab-bars.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
import { TabBar } from '@phosphor/widgets';
|
||||||
|
import { Saveable } from '@theia/core/lib/browser/saveable';
|
||||||
|
import { TabBarRenderer as TheiaTabBarRenderer } from '@theia/core/lib/browser/shell/tab-bars';
|
||||||
|
|
||||||
|
export class TabBarRenderer extends TheiaTabBarRenderer {
|
||||||
|
|
||||||
|
createTabClass(data: TabBar.IRenderData<any>): string {
|
||||||
|
let className = super.createTabClass(data);
|
||||||
|
if (!data.title.closable && Saveable.isDirty(data.title.owner)) {
|
||||||
|
className += ' p-mod-closable';
|
||||||
|
}
|
||||||
|
return className;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user