-
-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref: #1733 Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
- Loading branch information
Akos Kitta
committed
Feb 9, 2023
1 parent
65add68
commit 7b8538e
Showing
9 changed files
with
230 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
arduino-ide-extension/src/browser/theia/core/core-preferences.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
CorePreferenceContribution, | ||
CorePreferences, | ||
corePreferenceSchema, | ||
createCorePreferences, | ||
} from '@theia/core/lib/browser/core-preferences'; | ||
import { PreferenceContribution } from '@theia/core/lib/browser/preferences/preference-contribution'; | ||
import { PreferenceService } from '@theia/core/lib/browser/preferences/preference-service'; | ||
import { deepClone } from '@theia/core/lib/common/objects'; | ||
import { PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema'; | ||
import { interfaces } from '@theia/core/shared/inversify'; | ||
|
||
const copy = deepClone(corePreferenceSchema); | ||
copy.properties['window.menuBarVisibility'].included = true; // https://github.com/arduino/arduino-ide/issues/1733#issuecomment-1424186676 | ||
const corePreferencesSchema: PreferenceSchema = copy; | ||
|
||
export function rebindCorePreferences( | ||
bind: interfaces.Bind, | ||
rebind: interfaces.Rebind | ||
): void { | ||
rebind(CorePreferences) | ||
.toDynamicValue((ctx) => { | ||
const preferences = | ||
ctx.container.get<PreferenceService>(PreferenceService); | ||
const contribution = ctx.container.get<PreferenceContribution>( | ||
CorePreferenceContribution | ||
); | ||
return createCorePreferences(preferences, contribution.schema); | ||
}) | ||
.inSingletonScope(); | ||
rebind(CorePreferenceContribution).toConstantValue({ | ||
schema: corePreferencesSchema, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 39 additions & 31 deletions
70
arduino-ide-extension/src/electron-browser/theia/core/electron-menu-contribution.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
arduino-ide-extension/src/electron-browser/theia/core/electron-window-preferences.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { PreferenceContribution } from '@theia/core/lib/browser/preferences/preference-contribution'; | ||
import { PreferenceService } from '@theia/core/lib/browser/preferences/preference-service'; | ||
import { deepClone } from '@theia/core/lib/common/objects'; | ||
import { PreferenceSchema } from '@theia/core/lib/common/preferences/preference-schema'; | ||
import { | ||
createElectronWindowPreferences, | ||
ElectronWindowPreferenceContribution, | ||
ElectronWindowPreferences, | ||
electronWindowPreferencesSchema as theiaElectronWindowPreferencesSchema, | ||
} from '@theia/core/lib/electron-browser/window/electron-window-preferences'; | ||
import { interfaces } from '@theia/core/shared/inversify'; | ||
|
||
const copy = deepClone(theiaElectronWindowPreferencesSchema); | ||
copy.properties['window.titleBarStyle'].included = true; // https://github.com/eclipse-theia/theia/pull/10044#issuecomment-1423841453 | ||
copy.properties['window.titleBarStyle'].default = 'custom'; | ||
const electronWindowPreferencesSchema: PreferenceSchema = copy; | ||
|
||
export function rebindWindowPreferences( | ||
bind: interfaces.Bind, | ||
rebind: interfaces.Rebind | ||
): void { | ||
rebind(ElectronWindowPreferences) | ||
.toDynamicValue((ctx) => { | ||
const preferences = | ||
ctx.container.get<PreferenceService>(PreferenceService); | ||
const contribution = ctx.container.get<PreferenceContribution>( | ||
ElectronWindowPreferenceContribution | ||
); | ||
return createElectronWindowPreferences(preferences, contribution.schema); | ||
}) | ||
.inSingletonScope(); | ||
rebind(ElectronWindowPreferenceContribution).toConstantValue({ | ||
schema: electronWindowPreferencesSchema, | ||
}); | ||
} |
Oops, something went wrong.