提交 3b5e3eaf 编写于 作者: P Pine Wu

Clean up treeExplorer's ID

上级 a6f8b945
......@@ -16,7 +16,7 @@ import { ITreeExplorerViewletService, TreeExplorerViewletService } from 'vs/work
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
import { ITreeExplorer } from 'vs/platform/extensionManagement/common/extensionManagement';
import { VIEWLET_ID_ROOT } from 'vs/workbench/parts/explorers/common/treeExplorer';
import { toCustomViewletId } from 'vs/workbench/parts/explorers/common/treeExplorer';
registerSingleton(ITreeExplorerViewletService, TreeExplorerViewletService);
......@@ -53,7 +53,7 @@ ExtensionsRegistry.registerExtensionPoint<ITreeExplorer>('explorer', [], explore
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).registerViewlet(new ViewletDescriptor(
'vs/workbench/parts/explorers/browser/treeExplorerViewlet',
'TreeExplorerViewlet',
VIEWLET_ID_ROOT + treeExplorerNodeProviderId,
toCustomViewletId(treeExplorerNodeProviderId),
treeLabel,
treeExplorerNodeProviderId,
-1, // Extension viewlets are ordered by enabling sequence, so order here doesn't matter.
......
......@@ -14,7 +14,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { TreeExplorerView } from 'vs/workbench/parts/explorers/browser/views/treeExplorerView';
import { TreeExplorerViewletState } from 'vs/workbench/parts/explorers/browser/views/treeExplorerViewer';
import { IActivityService } from 'vs/workbench/services/activity/common/activityService';
import { VIEWLET_ID_ROOT } from 'vs/workbench/parts/explorers/common/treeExplorer';
import { toCustomViewletId } from 'vs/workbench/parts/explorers/common/treeExplorer';
export class TreeExplorerViewlet extends Viewlet {
private static _idCounter = 1;
......@@ -32,7 +32,7 @@ export class TreeExplorerViewlet extends Viewlet {
@IInstantiationService private instantiationService: IInstantiationService,
@IActivityService private activityService: IActivityService
) {
super(VIEWLET_ID_ROOT + TreeExplorerViewlet._idCounter, telemetryService);
super(toCustomViewletId(TreeExplorerViewlet._idCounter.toString()), telemetryService);
this.viewletState = new TreeExplorerViewletState();
......
......@@ -4,4 +4,13 @@
*--------------------------------------------------------------------------------------------*/
'use strict';
export const VIEWLET_ID_ROOT = 'workbench.view.customTreeExplorer.';
\ No newline at end of file
const CUSTOM_VIEWLET_ID_ROOT = 'workbench.view.customExplorer.';
const CUSTOM_VIEWLET_ACTION_ID_ROOT = 'workbench.action.customExplorer.';
export function toCustomViewletId(viewletId: string): string {
return CUSTOM_VIEWLET_ID_ROOT + viewletId;
}
export function toCustomViewletActionId(viewletId: string): string {
return CUSTOM_VIEWLET_ACTION_ID_ROOT + viewletId;
}
......@@ -12,11 +12,12 @@ import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { Action } from 'vs/base/common/actions';
import { IQuickOpenService, IPickOpenEntry } from 'vs/workbench/services/quickopen/common/quickOpenService';
import { IActivityService } from 'vs/workbench/services/activity/common/activityService';
import { toCustomViewletActionId } from 'vs/workbench/parts/explorers/common/treeExplorer';
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
export class ToggleExtViewletAction extends Action {
public static ID = 'workbench.action.customTreeExplorer.toggle';
public static ID = toCustomViewletActionId('toggle');
public static LABEL = localize('toggleCustomExplorer', 'Toggle Custom Explorer');
constructor(
......
......@@ -8,11 +8,12 @@ import { TPromise } from 'vs/base/common/winjs.base';
import * as nls from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { TreeExplorerView } from 'vs/workbench/parts/explorers/browser/views/treeExplorerView';
import { toCustomViewletActionId } from 'vs/workbench/parts/explorers/common/treeExplorer';
export class RefreshViewExplorerAction extends Action {
constructor(view: TreeExplorerView) {
super('workbench.action.customTreeExplorer.refresh', nls.localize('refresh', "Refresh"), 'customTreeExplorer-action toggle', true, () => {
super(toCustomViewletActionId('refresh'), nls.localize('refresh', 'Refresh'), 'customExplorer-action toggle', true, () => {
view.updateInput();
return TPromise.as(null);
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册