add update all extensions global command

fixes #11161
This commit is contained in:
Joao Moreno 2016-08-31 15:21:25 +02:00
parent 746f66a6e7
commit 2f8e7a9e18
4 changed files with 12 additions and 4 deletions

View file

@ -21,7 +21,7 @@ import { IEditorRegistry, Extensions as EditorExtensions } from 'vs/workbench/co
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { VIEWLET_ID, IExtensionsWorkbenchService } from './extensions';
import { ExtensionsWorkbenchService } from './extensionsWorkbenchService';
import { OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowInstalledExtensionsAction } from './extensionsActions';
import { OpenExtensionsViewletAction, InstallExtensionsAction, ShowOutdatedExtensionsAction, ShowRecommendedExtensionsAction, ShowPopularExtensionsAction, ShowInstalledExtensionsAction, UpdateAllAction } from './extensionsActions';
import { ExtensionsInput } from './extensionsInput';
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { ExtensionEditor } from './extensionEditor';
@ -109,6 +109,9 @@ actionRegistry.registerWorkbenchAction(popularActionDescriptor, `Extensions: ${
const installedActionDescriptor = new SyncActionDescriptor(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL);
actionRegistry.registerWorkbenchAction(installedActionDescriptor, `Extensions: ${ ShowInstalledExtensionsAction.LABEL }`, ExtensionsLabel);
const updateAllActionDescriptor = new SyncActionDescriptor(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL);
actionRegistry.registerWorkbenchAction(updateAllActionDescriptor, `Extensions: ${ UpdateAllAction.LABEL }`, ExtensionsLabel);
Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration)
.registerConfiguration({
id: 'extensions',

View file

@ -264,12 +264,17 @@ export class EnableAction extends Action {
export class UpdateAllAction extends Action {
static ID = 'extensions.update-all';
static LABEL = localize('updateAll', "Update All Extensions");
private disposables: IDisposable[] = [];
constructor(
id = UpdateAllAction.ID,
label = UpdateAllAction.LABEL,
@IExtensionsWorkbenchService private extensionsWorkbenchService: IExtensionsWorkbenchService
) {
super('extensions.update-all', localize('updateAll', "Update All Extensions"), '', false);
super(id, label, '', false);
this.disposables.push(this.extensionsWorkbenchService.onChange(() => this.update()));
this.update();

View file

@ -164,7 +164,7 @@ export class ExtensionsViewlet extends Viewlet implements IExtensionsViewlet {
getSecondaryActions(): IAction[] {
if (!this.secondaryActions) {
this.secondaryActions = [
this.instantiationService.createInstance(UpdateAllAction),
this.instantiationService.createInstance(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL),
new Separator(),
this.instantiationService.createInstance(ShowInstalledExtensionsAction, ShowInstalledExtensionsAction.ID, ShowInstalledExtensionsAction.LABEL),
this.instantiationService.createInstance(ShowOutdatedExtensionsAction, ShowOutdatedExtensionsAction.ID, ShowOutdatedExtensionsAction.LABEL),

View file

@ -316,7 +316,7 @@ export class ExtensionsWorkbenchService implements IExtensionsWorkbenchService {
return;
}
const action = this.instantiationService.createInstance(UpdateAllAction);
const action = this.instantiationService.createInstance(UpdateAllAction, UpdateAllAction.ID, UpdateAllAction.LABEL);
return action.enabled && action.run();
});
}