提交 12a48be8 编写于 作者: M Matt Bierner

More simple conditional guards for getSearchView

上级 c34fa1b1
......@@ -84,8 +84,10 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary: KeyMod.CtrlCmd | KeyCode.UpArrow,
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
if (searchView) {
searchView.focusPreviousInputBox();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
......@@ -98,9 +100,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
},
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
if (searchView) {
const tree: WorkbenchObjectTree<RenderableMatch> = searchView.getControl();
searchView.open(<FileMatchOrMatch>tree.getFocus()[0], false, true, true);
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
......@@ -110,8 +114,10 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary: KeyCode.Escape,
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
if (searchView) {
searchView.cancelSearch();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
......@@ -124,9 +130,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
},
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
if (searchView) {
const tree: WorkbenchObjectTree<RenderableMatch> = searchView.getControl();
accessor.get(IInstantiationService).createInstance(RemoveAction, tree, tree.getFocus()[0]).run();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
......@@ -136,9 +144,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
primary: KeyMod.Shift | KeyMod.CtrlCmd | KeyCode.KEY_1,
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
if (searchView) {
const tree: WorkbenchObjectTree<RenderableMatch> = searchView.getControl();
accessor.get(IInstantiationService).createInstance(ReplaceAction, tree, tree.getFocus()[0], searchView).run();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
......@@ -149,9 +159,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter],
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
if (searchView) {
const tree: WorkbenchObjectTree<RenderableMatch> = searchView.getControl();
accessor.get(IInstantiationService).createInstance(ReplaceAllAction, searchView, tree.getFocus()[0]).run();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
......@@ -162,9 +174,11 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.Enter],
handler: (accessor, args: any) => {
const searchView = getSearchView(accessor.get(IViewletService), accessor.get(IPanelService));
if (searchView) {
const tree: WorkbenchObjectTree<RenderableMatch> = searchView.getControl();
accessor.get(IInstantiationService).createInstance(ReplaceAllInFolderAction, tree, tree.getFocus()[0]).run();
}
}
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册