提交 21dcd2be 编写于 作者: B Benjamin Pasero

do not offer "unpin" for now

上级 a5427dfa
......@@ -33,7 +33,7 @@ import {SyncActionDescriptor} from 'vs/platform/actions/common/actions';
import {SyncDescriptor} from 'vs/platform/instantiation/common/descriptors';
import {KeyMod, KeyCode} from 'vs/base/common/keyCodes';
import {EditorStacksModel} from 'vs/workbench/common/editor/editorStacksModel';
import {CloseEditorsInGroupAction, CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, PinEditorAction, UnpinEditorAction, CloseOtherEditorsInGroupAction, OpenToSideAction,
import {CloseEditorsInGroupAction, CloseEditorsInOtherGroupsAction, CloseAllEditorsAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, PinEditorAction, CloseOtherEditorsInGroupAction, OpenToSideAction,
NavigateBetweenGroupsAction, FocusFirstGroupAction, FocusSecondGroupAction, FocusThirdGroupAction, EvenGroupWidthsAction, MaximizeGroupAction, MinimizeOtherGroupsAction, FocusPreviousGroup, FocusNextGroup, ShowEditorsInLeftGroupAction,
toEditorQuickOpenEntry, CloseLeftEditorsInGroupAction, CloseRightEditorsInGroupAction, OpenNextEditor, OpenPreviousEditor, NavigateBackwardsAction, NavigateForwardAction, ReopenClosedEditorAction, OpenPreviousEditorInGroupAction, NAVIGATE_IN_LEFT_GROUP_PREFIX,
GlobalQuickOpenAction, OpenPreviousEditorFromHistoryAction, QuickOpenNavigateNextAction, QuickOpenNavigatePreviousAction, ShowAllEditorsAction, NAVIGATE_ALL_EDITORS_GROUP_PREFIX, ClearEditorHistoryAction, ShowEditorsInCenterGroupAction,
......@@ -356,7 +356,6 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(OpenPreviousEditor, Op
}), 'View: Open Previous Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(ReopenClosedEditorAction, ReopenClosedEditorAction.ID, ReopenClosedEditorAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_T }), 'View: Reopen Closed Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(PinEditorAction, PinEditorAction.ID, PinEditorAction.LABEL, { primary: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.Enter) }), 'View: Pin Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(UnpinEditorAction, UnpinEditorAction.ID, UnpinEditorAction.LABEL), 'View: Unpin Editor', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseAllEditorsAction, CloseAllEditorsAction.ID, CloseAllEditorsAction.LABEL, { primary: KeyMod.chord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_W) }), 'View: Close All Editors', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseLeftEditorsInGroupAction, CloseLeftEditorsInGroupAction.ID, CloseLeftEditorsInGroupAction.LABEL), 'View: Close Editors to the Left', category);
registry.registerWorkbenchAction(new SyncActionDescriptor(CloseRightEditorsInGroupAction, CloseRightEditorsInGroupAction.ID, CloseRightEditorsInGroupAction.LABEL), 'View: Close Editors to the Right', category);
......
......@@ -793,30 +793,6 @@ export class PinEditorAction extends Action {
}
}
export class UnpinEditorAction extends Action {
public static ID = 'workbench.action.unpinEditor';
public static LABEL = nls.localize('unpinEditor', "Unpin Editor");
constructor(
id: string,
label: string,
@IEditorGroupService private editorGroupService: IEditorGroupService,
@IWorkbenchEditorService private editorService: IWorkbenchEditorService
) {
super(id, label);
}
public run(context?: IEditorContext): TPromise<any> {
let target = getTarget(this.editorService, this.editorGroupService, context);
if (target) {
this.editorGroupService.unpinEditor(target.position, target.input);
}
return TPromise.as(true);
}
}
function getTarget(editorService: IWorkbenchEditorService, editorGroupService: IEditorGroupService, context?: IEditorContext): { input: IEditorInput, position: Position } {
if (context) {
return { input: context.editor, position: editorGroupService.getStacksModel().positionOfGroup(context.group) };
......
......@@ -270,6 +270,7 @@ export class TabsTitleControl extends TitleControl {
// Enablement
this.closeOtherEditorsAction.enabled = group.count > 1;
this.pinEditorAction.enabled = !group.isPinned(editor);
// Actions
return [
......@@ -277,7 +278,7 @@ export class TabsTitleControl extends TitleControl {
this.closeOtherEditorsAction,
this.closeAllEditorsAction,
new Separator(),
(group.isPinned(editor)) ? this.unpinEditorAction : this.pinEditorAction
this.pinEditorAction
];
}
......
......@@ -29,7 +29,7 @@ import {ITelemetryService} from 'vs/platform/telemetry/common/telemetry';
import {IInstantiationService} from 'vs/platform/instantiation/common/instantiation';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {ShowEditorsInLeftGroupAction, ShowAllEditorsAction, ShowEditorsInCenterGroupAction, ShowEditorsInRightGroupAction, CloseEditorsInGroupAction, MoveGroupLeftAction,
MoveGroupRightAction, SplitEditorAction, CloseEditorAction, PinEditorAction, UnpinEditorAction, CloseOtherEditorsInGroupAction, CloseAllEditorsInGroupAction}
MoveGroupRightAction, SplitEditorAction, CloseEditorAction, PinEditorAction, CloseOtherEditorsInGroupAction, CloseAllEditorsInGroupAction}
from 'vs/workbench/browser/parts/editor/editorActions';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
......@@ -52,7 +52,6 @@ export abstract class TitleControl {
protected closeEditorAction: CloseEditorAction;
protected pinEditorAction: PinEditorAction;
protected unpinEditorAction: UnpinEditorAction;
protected closeOtherEditorsAction: CloseOtherEditorsInGroupAction;
protected closeAllEditorsAction: CloseAllEditorsInGroupAction;
protected showEditorsOfLeftGroup: QuickOpenAction;
......@@ -104,7 +103,6 @@ export abstract class TitleControl {
this.closeEditorAction = this.instantiationService.createInstance(CloseEditorAction, CloseEditorAction.ID, nls.localize('close', "Close"));
this.closeOtherEditorsAction = this.instantiationService.createInstance(CloseOtherEditorsInGroupAction, CloseOtherEditorsInGroupAction.ID, nls.localize('closeOthers', "Close Others"));
this.closeAllEditorsAction = this.instantiationService.createInstance(CloseAllEditorsInGroupAction, CloseAllEditorsInGroupAction.ID, nls.localize('closeAll', "Close All"));
this.unpinEditorAction =this.instantiationService.createInstance(UnpinEditorAction, UnpinEditorAction.ID, nls.localize('unpin', "Unpin Editor"));
this.pinEditorAction = this.instantiationService.createInstance(PinEditorAction, PinEditorAction.ID, nls.localize('pin', "Pin Editor"));
this.showAllEditorsAction = this.instantiationService.createInstance(ShowAllEditorsAction, ShowAllEditorsAction.ID, nls.localize('showEditors', "Show Editors"));
this.splitEditorAction = this.instantiationService.createInstance(SplitEditorAction, SplitEditorAction.ID, SplitEditorAction.LABEL);
......@@ -301,7 +299,6 @@ export abstract class TitleControl {
this.showEditorsOfRightGroup,
this.closeEditorAction,
this.pinEditorAction,
this.unpinEditorAction,
this.closeOtherEditorsAction,
this.closeAllEditorsAction,
this.moveGroupLeftAction,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册