From 1f32de29c11f398d5b1dc68213c780d94a40df42 Mon Sep 17 00:00:00 2001 From: Matt Irvine Date: Fri, 13 Jul 2018 09:03:22 -0700 Subject: [PATCH] Style SQL input box correctly when enabled/disabled (#1920) --- src/sql/base/browser/ui/inputBox/inputBox.ts | 17 +++++++++++------ .../parts/modelComponents/inputbox.component.ts | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/sql/base/browser/ui/inputBox/inputBox.ts b/src/sql/base/browser/ui/inputBox/inputBox.ts index 64b09e00fa..f772fc3a46 100644 --- a/src/sql/base/browser/ui/inputBox/inputBox.ts +++ b/src/sql/base/browser/ui/inputBox/inputBox.ts @@ -63,13 +63,13 @@ export class InputBox extends vsInputBox { this.enabledInputBorder = this.inputBorder; this.disabledInputBackground = styles.disabledInputBackground; this.disabledInputForeground = styles.disabledInputForeground; + this.updateInputEnabledDisabledColors(); + this.applyStyles(); } public enable(): void { super.enable(); - this.inputBackground = this.enabledInputBackground; - this.inputForeground = this.enabledInputForeground; - this.inputBorder = this.enabledInputBorder; + this.updateInputEnabledDisabledColors(); this.applyStyles(); } @@ -89,9 +89,7 @@ export class InputBox extends vsInputBox { public disable(): void { super.disable(); - this.inputBackground = this.disabledInputBackground; - this.inputForeground = this.disabledInputForeground; - this.inputBorder = this.disabledInputBorder; + this.updateInputEnabledDisabledColors(); this.applyStyles(); } @@ -121,4 +119,11 @@ export class InputBox extends vsInputBox { super.showMessage(message, force); } } + + private updateInputEnabledDisabledColors(): void { + let enabled = this.isEnabled(); + this.inputBackground = enabled ? this.enabledInputBackground : this.disabledInputBackground; + this.inputForeground = enabled ? this.enabledInputForeground : this.disabledInputForeground; + this.inputBorder = enabled ? this.enabledInputBorder : this.disabledInputBorder; + } } \ No newline at end of file diff --git a/src/sql/parts/modelComponents/inputbox.component.ts b/src/sql/parts/modelComponents/inputbox.component.ts index f2d8cc015a..91a0075bde 100644 --- a/src/sql/parts/modelComponents/inputbox.component.ts +++ b/src/sql/parts/modelComponents/inputbox.component.ts @@ -12,10 +12,10 @@ import * as sqlops from 'sqlops'; import { ComponentBase } from 'sql/parts/modelComponents/componentBase'; import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/parts/modelComponents/interfaces'; - import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox'; +import { attachInputBoxStyler } from 'sql/common/theme/styler'; + import { IInputOptions, MessageType } from 'vs/base/browser/ui/inputbox/inputBox'; -import { attachInputBoxStyler, attachListStyler } from 'vs/platform/theme/common/styler'; import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService'; import { IContextViewService } from 'vs/platform/contextview/browser/contextView'; import * as nls from 'vs/nls';