提交 b9e8b1ea 编写于 作者: I isidor

open folder setting as command

上级 c72b67dd
......@@ -266,28 +266,6 @@ export class RemoveRootFolderAction extends Action {
}
}
export class OpenFolderSettingsAction extends Action {
static ID = 'workbench.action.openFolderSettings';
static LABEL = nls.localize('openFolderSettings', "Open Folder Settings");
constructor(
private rootUri: URI,
id: string,
label: string,
@IWorkspaceContextService private contextService: IWorkspaceContextService,
@ICommandService private commandService: ICommandService
) {
super(id, label);
}
public run(): TPromise<any> {
const workspaceFolder = this.contextService.getWorkspaceFolder(this.rootUri);
return this.commandService.executeCommand('_workbench.action.openFolderSettings', workspaceFolder);
}
}
export class SaveWorkspaceAsAction extends BaseWorkspacesAction {
static ID = 'workbench.action.saveWorkspaceAs';
......
......@@ -17,13 +17,14 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { FileStat, Model } from 'vs/workbench/parts/files/common/explorerModel';
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
import { RemoveRootFolderAction, OpenFolderSettingsAction } from 'vs/workbench/browser/actions/workspaceActions';
import { RemoveRootFolderAction } from 'vs/workbench/browser/actions/workspaceActions';
import { copyFocusedFilesExplorerViewItem, openWindowCommand, deleteFocusedFilesExplorerViewItemCommand, moveFocusedFilesExplorerViewItemToTrashCommand, renameFocusedFilesExplorerViewItemCommand, REVEAL_IN_OS_COMMAND_ID, COPY_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID } from 'vs/workbench/parts/files/electron-browser/fileCommands';
import { CommandsRegistry, ICommandHandler } from 'vs/platform/commands/common/commands';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { FilesExplorerFocusCondition, ExplorerRootContext } from 'vs/workbench/parts/files/common/files';
import { FilesExplorerFocusCondition, ExplorerRootContext, ExplorerFolderContext } from 'vs/workbench/parts/files/common/files';
import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL } from 'vs/workbench/browser/actions/workspaceCommands';
import { OPEN_FOLDER_SETTINGS_COMMAND, OPEN_FOLDER_SETTINGS_LABEL } from 'vs/workbench/parts/preferences/browser/preferencesActions';
class FilesViewerActionContributor extends ActionBarContributor {
......@@ -64,9 +65,6 @@ class FilesViewerActionContributor extends ActionBarContributor {
// Workspace Root Folder Actions
if (stat.isRoot) {
const openFolderSettingsActions = this.instantiationService.createInstance(OpenFolderSettingsAction, stat.resource, OpenFolderSettingsAction.ID, OpenFolderSettingsAction.LABEL);
openFolderSettingsActions.order = 53;
actions.push(openFolderSettingsActions);
const removeRootFolderAction = this.instantiationService.createInstance(RemoveRootFolderAction, stat.resource, RemoveRootFolderAction.ID, RemoveRootFolderAction.LABEL);
removeRootFolderAction.order = 54;
actions.push(removeRootFolderAction);
......@@ -247,3 +245,13 @@ MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
},
when: ExplorerRootContext
});
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, {
group: '2_workspace',
order: 20,
command: {
id: OPEN_FOLDER_SETTINGS_COMMAND,
title: OPEN_FOLDER_SETTINGS_LABEL
},
when: ContextKeyExpr.and(ExplorerRootContext, ExplorerFolderContext)
});
......@@ -121,10 +121,11 @@ export class OpenWorkspaceSettingsAction extends Action {
}
export const OPEN_FOLDER_SETTINGS_COMMAND = '_workbench.action.openFolderSettings';
export const OPEN_FOLDER_SETTINGS_LABEL = nls.localize('openFolderSettings', "Open Folder Settings");
export class OpenFolderSettingsAction extends Action {
public static readonly ID = 'workbench.action.openFolderSettings';
public static readonly LABEL = nls.localize('openFolderSettings', "Open Folder Settings");
public static readonly LABEL = OPEN_FOLDER_SETTINGS_LABEL;
private disposables: IDisposable[] = [];
......@@ -208,4 +209,4 @@ export class ConfigureLanguageBasedSettingsAction extends Action {
});
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册