Skip to content

Commit

Permalink
fixed PR according to reviewer comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ChayaLau committed Aug 5, 2021
1 parent 3ff1351 commit 1ea3ec1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 40 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
- [debug] `DebugSession` and `PluginDebugSession` constructors accept a `parentSession` of type `DebugSession | undefined` as their 3rd parameter, offsetting every subsequent parameter by one [#9613](https://github.com/eclipse-theia/theia/pull/9613)
- [monaco] upgraded to monaco 0.23.0 including replacement of `quickOpen` API (0.20.x) with `quickInput` API (0.23.x) [#9154](https://github.com/eclipse-theia/theia/pull/9154)
- [workspace] `WorkspaceCommandContribution.addFolderToWorkspace` no longer accepts `undefined`. `WorkspaceService.addRoot` now accepts a `URI` or a `URI[]` [#9684](https://github.com/eclipse-theia/theia/pull/9684)
-[core] `SidePanelHandler.addMenu` and `SidePanelHandler.removeMenu` no longer exists, instead added `addBottomMenu` and `addTopMenu` for adding menu, `removeTopMenu` and `removeBottomMenu` for removing menu.
`SidebarBottomMenu` interface is renamed `SidebarMenu` and handles not only bottom menu's.
`packages/core/src/browser/shell/sidebar-bottom-menu-widget.tsx` file is renamed `packages/core/src/browser/shell/sidebar-menu-widget.tsx`. `SidebarBottomMenuWidget` class is renamed `SidebarMenuWidget`.
[#9830](https://github.com/eclipse-theia/theia/pull/9830)

## v1.15.0 - 6/30/2021

Expand Down
64 changes: 33 additions & 31 deletions packages/core/src/browser/common-frontend-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ import { environment } from '@theia/application-package/lib/environment';
import { IconThemeService } from './icon-theme-service';
import { ColorContribution } from './color-application-contribution';
import { ColorRegistry, Color } from './color-registry';
import { CorePreferences } from './core-preferences';
import { CoreConfiguration, CorePreferences } from './core-preferences';
import { ThemeService } from './theming';
import { PreferenceService, PreferenceScope } from './preferences';
import { PreferenceService, PreferenceScope, PreferenceChangeEvent } from './preferences';
import { ClipboardService } from './clipboard-service';
import { EncodingRegistry } from './encoding-registry';
import { UTF8 } from '../common/encodings';
Expand Down Expand Up @@ -353,35 +353,7 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
this.updateStyles();
this.updateThemeFromPreference('workbench.colorTheme');
this.updateThemeFromPreference('workbench.iconTheme');
this.preferences.onPreferenceChanged(e => {
switch (e.preferenceName) {
case 'workbench.editor.highlightModifiedTabs': {
this.updateStyles();
break;
}
case 'workbench.colorTheme':
case 'workbench.iconTheme': {
this.updateThemeFromPreference(e.preferenceName);
break;
}
case 'window.menuBarVisibility': {
const { newValue } = e;
const mainMenuId = 'main-menu';
if (newValue === 'compact') {
app.shell.leftPanelHandler.addTopMenu({
id: mainMenuId,
iconClass: 'codicon codicon-menu',
title: 'Application Menu',
menuPath: ['menubar'],
order: 0,
});
} else {
app.shell.leftPanelHandler.removeTopMenu(mainMenuId);
}
break;
}
}
});
this.preferences.onPreferenceChanged(e => this.handlePreferenceChange(e, app));
this.themeService.onDidColorThemeChange(() => this.updateThemePreference('workbench.colorTheme'));
this.iconThemes.onDidChangeCurrent(() => this.updateThemePreference('workbench.iconTheme'));

Expand Down Expand Up @@ -442,6 +414,36 @@ export class CommonFrontendContribution implements FrontendApplicationContributi
}
}

protected handlePreferenceChange(e: PreferenceChangeEvent<CoreConfiguration>, app: FrontendApplication): void {
switch (e.preferenceName) {
case 'workbench.editor.highlightModifiedTabs': {
this.updateStyles();
break;
}
case 'workbench.colorTheme':
case 'workbench.iconTheme': {
this.updateThemeFromPreference(e.preferenceName);
break;
}
case 'window.menuBarVisibility': {
const { newValue } = e;
const mainMenuId = 'main-menu';
if (newValue === 'compact') {
app.shell.leftPanelHandler.addTopMenu({
id: mainMenuId,
iconClass: 'codicon codicon-menu',
title: 'Application Menu',
menuPath: ['menubar'],
order: 0,
});
} else {
app.shell.leftPanelHandler.removeTopMenu(mainMenuId);
}
break;
}
}
}

onStart(): void {
this.storageService.getData<{ recent: Command[] }>(RECENT_COMMANDS_STORAGE_KEY, { recent: [] })
.then(tasks => this.commandRegistry.recent = tasks.recent);
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/browser/core-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ export const corePreferenceSchema: PreferenceSchema = {
'Menu is displayed at the top of the window and only hidden in full screen mode.',
'Menu is always visible at the top of the window even in full screen mode.',
'Menu is always hidden.',
'Menu is displayed as a compact button in the sidebar. This value is ignored when `#window.titleBarStyle#` is `native`.'
'Menu is displayed as a compact button in the sidebar.'
],
default: 'classic',
scope: 'application',
markdownDescription: `Control the visibility of the menu bar. A setting of 'toggle' means that the menu bar is hidden and a single press of the Alt key will show it.
markdownDescription: `Control the visibility of the menu bar.
A setting of 'compact' will move the menu into the sidebar.`,
},
}
Expand Down
3 changes: 0 additions & 3 deletions packages/core/src/browser/menu/browser-menu-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,6 @@ export class BrowserMenuBarContribution implements FrontendApplicationContributi
@inject(ApplicationShell)
protected readonly shell: ApplicationShell;

@inject(CorePreferences)
protected readonly corePreferences: CorePreferences;

constructor(
@inject(BrowserMainMenuFactory) protected readonly factory: BrowserMainMenuFactory
) { }
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/browser/style/sidepanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@
color: var(--theia-activityBar-foreground);
}

.theia-sidebar-menu > i.codicon-menu{
.theia-sidebar-menu > i.codicon-menu {
font-size: calc(var(--theia-private-sidebar-icon-size)*0.7);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ export class ElectronMainMenuFactory {
}

createMenuBar(): Electron.Menu | null {
let preference = this.preferencesService.get<string>('window.menuBarVisibility');
preference = preference ? preference : 'classic';
if (preference && ['classic', 'visible'].includes(preference)) {
const preference = this.preferencesService.get<string>('window.menuBarVisibility') || 'classic';
if (['classic', 'visible'].includes(preference)) {
const menuModel = this.menuProvider.getMenu(MAIN_MENU_BAR);
const template = this.fillMenuTemplate([], menuModel);
if (isOSX) {
Expand Down

0 comments on commit 1ea3ec1

Please sign in to comment.