提交 2c2958b6 编写于 作者: J Joao Moreno

bring back ext install

fixes #7973
上级 79b65f32
......@@ -28,6 +28,8 @@ import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, To
import { ExtensionEditor } from './extensionEditor';
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQuickOpenRegistry, Extensions, QuickOpenHandlerDescriptor } from 'vs/workbench/browser/quickopen';
// class ExtensionsInputFactory implements IEditorInputFactory {
......@@ -55,6 +57,18 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench)
Registry.as<IOutputChannelRegistry>(OutputExtensions.OutputChannels)
.registerChannel(ExtensionsChannelId, ExtensionsLabel);
Registry.as<IQuickOpenRegistry>(Extensions.Quickopen).registerQuickOpenHandler(
new QuickOpenHandlerDescriptor(
'vs/workbench/parts/extensions/electron-browser/extensionsQuickOpen',
'GalleryExtensionsHandler',
'ext install ',
localize('galleryExtensionsCommands', "Install Gallery Extensions"),
true
)
);
// Registry.as<IEditorRegistry>(EditorExtensions.Editors)
// .registerEditorInputFactory(ExtensionsInput.ID, ExtensionsInputFactory);
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import nls = require('vs/nls');
import { TPromise } from 'vs/base/common/winjs.base';
import { ThrottledDelayer } from 'vs/base/common/async';
import { IAutoFocus, Mode, IModel } from 'vs/base/parts/quickopen/common/quickOpen';
import { QuickOpenEntry, QuickOpenModel } from 'vs/base/parts/quickopen/browser/quickOpenModel';
import { QuickOpenHandler } from 'vs/workbench/browser/quickopen';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IExtensionsViewlet } from './extensions';
import { IViewletService } from 'vs/workbench/services/viewlet/common/viewletService';
class SearchExtensionEntry extends QuickOpenEntry {
constructor(
private text: string,
@IViewletService private viewletService: IViewletService
) {
super();
}
getLabel(): string {
return nls.localize('searchFor', "Press Enter to search for '{0}' in the Marketplace.", this.text);
}
getAriaLabel(): string {
return this.getLabel();
}
run(mode:Mode):boolean {
if (mode === Mode.PREVIEW) {
return false;
}
this.viewletService.openViewlet('workbench.viewlet.extensions', true)
.then(viewlet => viewlet as IExtensionsViewlet)
.done(viewlet => {
viewlet.search(this.text, true);
viewlet.focus();
});
return true;
}
}
export class GalleryExtensionsHandler extends QuickOpenHandler {
private delayer: ThrottledDelayer<any>;
constructor(
@IInstantiationService private instantiationService: IInstantiationService
) {
super();
this.delayer = new ThrottledDelayer(500);
}
getResults(text: string): TPromise<IModel<any>> {
const entries = [];
if (text) {
entries.push(this.instantiationService.createInstance(SearchExtensionEntry, text));
}
return TPromise.as(new QuickOpenModel(entries));
}
getEmptyLabel(input: string): string {
return nls.localize('noExtensionsToInstall', "Type an extension name");
}
getAutoFocus(searchValue: string): IAutoFocus {
return { autoFocusFirstEntry: true };
}
}
\ No newline at end of file
......@@ -39,6 +39,7 @@ export class ExtensionsWorkbenchExtension implements IWorkbenchContribution {
if (options.extensionsToInstall && options.extensionsToInstall.length) {
this.install(options.extensionsToInstall).done(null, onUnexpectedError);
}
//actionRegistry.registerWorkbenchAction(new SyncActionDescriptor(InstallExtensionAction, InstallExtensionAction.ID, InstallExtensionAction.LABEL), 'Extensions: Install Extension', ExtensionsLabel);
}
private registerListeners(): void {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册