remove:移除活动栏账户管理功能.
This commit is contained in:
parent
d2cde48e99
commit
e58fe3c6a8
|
@ -250,10 +250,10 @@ export class ActivityBarCompositeBar extends PaneCompositeBar {
|
|||
}
|
||||
|
||||
// Global Composite Bar
|
||||
if (this.globalCompositeBar) {
|
||||
actions.push(new Separator());
|
||||
actions.push(...this.globalCompositeBar.getContextMenuActions());
|
||||
}
|
||||
// if (this.globalCompositeBar) {
|
||||
// actions.push(new Separator());
|
||||
// actions.push(...this.globalCompositeBar.getContextMenuActions());
|
||||
// }
|
||||
actions.push(new Separator());
|
||||
actions.push(...this.getActivityBarContextMenuActions());
|
||||
}
|
||||
|
|
|
@ -10,13 +10,15 @@ import { IActivity, IActivityService, NumberBadge } from 'vs/workbench/services/
|
|||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { DisposableStore, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { IColorTheme, IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
// import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
|
||||
// import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
// import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { CompoisteBarActionViewItem, CompositeBarAction, IActivityHoverOptions, ICompositeBarActionViewItemOptions, ICompositeBarColors } from 'vs/workbench/browser/parts/compositeBarActions';
|
||||
import { Codicon } from 'vs/base/common/codicons';
|
||||
import { ThemeIcon } from 'vs/base/common/themables';
|
||||
import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
|
||||
import { Action, IAction, Separator, SubmenuAction, toAction } from 'vs/base/common/actions';
|
||||
// import { Action, IAction, Separator, SubmenuAction, toAction } from 'vs/base/common/actions';
|
||||
import { Action, IAction, Separator, SubmenuAction } from 'vs/base/common/actions';
|
||||
import { IMenu, IMenuService, MenuId } from 'vs/platform/actions/common/actions';
|
||||
import { addDisposableListener, EventType, append, clearNode, hide, show, EventHelper, $, runWhenWindowIdle, getWindow } from 'vs/base/browser/dom';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
|
@ -45,13 +47,13 @@ import { ACTIVITY_BAR_BADGE_BACKGROUND, ACTIVITY_BAR_BADGE_FOREGROUND } from 'vs
|
|||
|
||||
export class GlobalCompositeBar extends Disposable {
|
||||
|
||||
private static readonly ACCOUNTS_ACTION_INDEX = 0;
|
||||
// private static readonly ACCOUNTS_ACTION_INDEX = 0;
|
||||
static readonly ACCOUNTS_ICON = registerIcon('accounts-view-bar-icon', Codicon.account, localize('accountsViewBarIcon', "Accounts icon in the view bar."));
|
||||
|
||||
readonly element: HTMLElement;
|
||||
|
||||
private readonly globalActivityAction = this._register(new Action(GLOBAL_ACTIVITY_ID));
|
||||
private readonly accountAction = this._register(new Action(ACCOUNTS_ACTIVITY_ID));
|
||||
// private readonly accountAction = this._register(new Action(ACCOUNTS_ACTIVITY_ID));
|
||||
private readonly globalActivityActionBar: ActionBar;
|
||||
|
||||
constructor(
|
||||
|
@ -60,8 +62,8 @@ export class GlobalCompositeBar extends Disposable {
|
|||
private readonly activityHoverOptions: IActivityHoverOptions,
|
||||
@IConfigurationService configurationService: IConfigurationService,
|
||||
@IInstantiationService private readonly instantiationService: IInstantiationService,
|
||||
@IStorageService private readonly storageService: IStorageService,
|
||||
@IExtensionService private readonly extensionService: IExtensionService,
|
||||
// @IStorageService private readonly storageService: IStorageService,
|
||||
// @IExtensionService private readonly extensionService: IExtensionService,
|
||||
) {
|
||||
super();
|
||||
|
||||
|
@ -74,22 +76,22 @@ export class GlobalCompositeBar extends Disposable {
|
|||
return this.instantiationService.createInstance(GlobalActivityActionViewItem, this.contextMenuActionsProvider, { colors: this.colors, hoverOptions: this.activityHoverOptions }, anchorAlignment, anchorAxisAlignment);
|
||||
}
|
||||
|
||||
if (action.id === ACCOUNTS_ACTIVITY_ID) {
|
||||
return this.instantiationService.createInstance(AccountsActivityActionViewItem,
|
||||
this.contextMenuActionsProvider,
|
||||
{
|
||||
colors: this.colors,
|
||||
hoverOptions: this.activityHoverOptions
|
||||
},
|
||||
anchorAlignment,
|
||||
anchorAxisAlignment,
|
||||
(actions: IAction[]) => {
|
||||
actions.unshift(...[
|
||||
toAction({ id: 'hideAccounts', label: localize('hideAccounts', "Hide Accounts"), run: () => this.storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, false, StorageScope.PROFILE, StorageTarget.USER) }),
|
||||
new Separator()
|
||||
]);
|
||||
});
|
||||
}
|
||||
// if (action.id === ACCOUNTS_ACTIVITY_ID) {
|
||||
// return this.instantiationService.createInstance(AccountsActivityActionViewItem,
|
||||
// this.contextMenuActionsProvider,
|
||||
// {
|
||||
// colors: this.colors,
|
||||
// hoverOptions: this.activityHoverOptions
|
||||
// },
|
||||
// anchorAlignment,
|
||||
// anchorAxisAlignment,
|
||||
// (actions: IAction[]) => {
|
||||
// actions.unshift(...[
|
||||
// toAction({ id: 'hideAccounts', label: localize('hideAccounts', "Hide Accounts"), run: () => this.storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, false, StorageScope.PROFILE, StorageTarget.USER) }),
|
||||
// new Separator()
|
||||
// ]);
|
||||
// });
|
||||
// }
|
||||
|
||||
throw new Error(`No view item for action '${action.id}'`);
|
||||
},
|
||||
|
@ -99,22 +101,22 @@ export class GlobalCompositeBar extends Disposable {
|
|||
preventLoopNavigation: true
|
||||
}));
|
||||
|
||||
if (this.accountsVisibilityPreference) {
|
||||
this.globalActivityActionBar.push(this.accountAction, { index: GlobalCompositeBar.ACCOUNTS_ACTION_INDEX });
|
||||
}
|
||||
// if (this.accountsVisibilityPreference) {
|
||||
// this.globalActivityActionBar.push(this.accountAction, { index: GlobalCompositeBar.ACCOUNTS_ACTION_INDEX });
|
||||
// }
|
||||
|
||||
this.globalActivityActionBar.push(this.globalActivityAction);
|
||||
|
||||
this.registerListeners();
|
||||
// this.registerListeners();
|
||||
}
|
||||
|
||||
private registerListeners(): void {
|
||||
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
|
||||
if (!this._store.isDisposed) {
|
||||
this._register(this.storageService.onDidChangeValue(StorageScope.PROFILE, AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, this._store)(() => this.toggleAccountsActivity()));
|
||||
}
|
||||
});
|
||||
}
|
||||
// private registerListeners(): void {
|
||||
// this.extensionService.whenInstalledExtensionsRegistered().then(() => {
|
||||
// if (!this._store.isDisposed) {
|
||||
// this._register(this.storageService.onDidChangeValue(StorageScope.PROFILE, AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, this._store)(() => this.toggleAccountsActivity()));
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
|
||||
create(parent: HTMLElement): void {
|
||||
parent.appendChild(this.element);
|
||||
|
@ -128,28 +130,28 @@ export class GlobalCompositeBar extends Disposable {
|
|||
return this.globalActivityActionBar.viewItems.length;
|
||||
}
|
||||
|
||||
getContextMenuActions(): IAction[] {
|
||||
return [toAction({ id: 'toggleAccountsVisibility', label: localize('accounts', "Accounts"), checked: this.accountsVisibilityPreference, run: () => this.accountsVisibilityPreference = !this.accountsVisibilityPreference })];
|
||||
}
|
||||
// getContextMenuActions(): IAction[] {
|
||||
// return [toAction({ id: 'toggleAccountsVisibility', label: localize('accounts', "Accounts"), checked: this.accountsVisibilityPreference, run: () => this.accountsVisibilityPreference = !this.accountsVisibilityPreference })];
|
||||
// }
|
||||
|
||||
private toggleAccountsActivity() {
|
||||
if (this.globalActivityActionBar.length() === 2 && this.accountsVisibilityPreference) {
|
||||
return;
|
||||
}
|
||||
if (this.globalActivityActionBar.length() === 2) {
|
||||
this.globalActivityActionBar.pull(GlobalCompositeBar.ACCOUNTS_ACTION_INDEX);
|
||||
} else {
|
||||
this.globalActivityActionBar.push(this.accountAction, { index: GlobalCompositeBar.ACCOUNTS_ACTION_INDEX });
|
||||
}
|
||||
}
|
||||
// private toggleAccountsActivity() {
|
||||
// if (this.globalActivityActionBar.length() === 2 && this.accountsVisibilityPreference) {
|
||||
// return;
|
||||
// }
|
||||
// if (this.globalActivityActionBar.length() === 2) {
|
||||
// this.globalActivityActionBar.pull(GlobalCompositeBar.ACCOUNTS_ACTION_INDEX);
|
||||
// } else {
|
||||
// this.globalActivityActionBar.push(this.accountAction, { index: GlobalCompositeBar.ACCOUNTS_ACTION_INDEX });
|
||||
// }
|
||||
// }
|
||||
|
||||
private get accountsVisibilityPreference(): boolean {
|
||||
return this.storageService.getBoolean(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, StorageScope.PROFILE, true);
|
||||
}
|
||||
// private get accountsVisibilityPreference(): boolean {
|
||||
// return this.storageService.getBoolean(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, StorageScope.PROFILE, true);
|
||||
// }
|
||||
|
||||
private set accountsVisibilityPreference(value: boolean) {
|
||||
this.storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, value, StorageScope.PROFILE, StorageTarget.USER);
|
||||
}
|
||||
// private set accountsVisibilityPreference(value: boolean) {
|
||||
// this.storageService.store(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, value, StorageScope.PROFILE, StorageTarget.USER);
|
||||
// }
|
||||
}
|
||||
|
||||
abstract class AbstractGlobalActivityActionViewItem extends CompoisteBarActionViewItem {
|
||||
|
|
|
@ -38,7 +38,8 @@ import { IHoverService } from 'vs/workbench/services/hover/browser/hover';
|
|||
import { Categories } from 'vs/platform/action/common/actionCommonCategories';
|
||||
import { WorkbenchToolBar } from 'vs/platform/actions/browser/toolbar';
|
||||
import { ACCOUNTS_ACTIVITY_ID, GLOBAL_ACTIVITY_ID } from 'vs/workbench/common/activity';
|
||||
import { SimpleAccountActivityActionViewItem, SimpleGlobalActivityActionViewItem } from 'vs/workbench/browser/parts/globalCompositeBar';
|
||||
// import { SimpleAccountActivityActionViewItem, SimpleGlobalActivityActionViewItem } from 'vs/workbench/browser/parts/globalCompositeBar';
|
||||
import { SimpleGlobalActivityActionViewItem } from 'vs/workbench/browser/parts/globalCompositeBar';
|
||||
import { HoverPosition } from 'vs/base/browser/ui/hover/hoverWidget';
|
||||
import { IEditorGroupsContainer, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { ActionRunner, IAction } from 'vs/base/common/actions';
|
||||
|
@ -495,9 +496,9 @@ export class BrowserTitlebarPart extends Part implements ITitlebarPart {
|
|||
if (action.id === GLOBAL_ACTIVITY_ID) {
|
||||
return this.instantiationService.createInstance(SimpleGlobalActivityActionViewItem, { position: () => HoverPosition.BELOW });
|
||||
}
|
||||
if (action.id === ACCOUNTS_ACTIVITY_ID) {
|
||||
return this.instantiationService.createInstance(SimpleAccountActivityActionViewItem, { position: () => HoverPosition.BELOW });
|
||||
}
|
||||
// if (action.id === ACCOUNTS_ACTIVITY_ID) {
|
||||
// return this.instantiationService.createInstance(SimpleAccountActivityActionViewItem, { position: () => HoverPosition.BELOW });
|
||||
// }
|
||||
}
|
||||
|
||||
// --- Editor Actions
|
||||
|
|
Loading…
Reference in New Issue