IDEA-118394 "Delete to line end" missing

This commit is contained in:
Dmitry Batrak
2013-12-26 09:27:38 +04:00
parent c3239504db
commit dc73830bee
3 changed files with 73 additions and 21 deletions
@@ -440,6 +440,7 @@ public class ActionsTree {
}
private class KeymapsRenderer extends ColoredTreeCellRenderer {
// Make sure that the text rendered by this method is 'searchable' via com.intellij.openapi.keymap.impl.ui.ActionsTree.filter method.
public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
final boolean showIcons = UISettings.getInstance().SHOW_ICONS_IN_MENUS;
Keymap originalKeymap = myKeymap != null ? myKeymap.getParent() : null;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -485,26 +485,18 @@ public class ActionsTreeUtil {
if (filter == null) return true;
if (action == null) return false;
final String insensitiveFilter = filter.toLowerCase();
final String text = action.getTemplatePresentation().getText();
if (text != null) {
final String lowerText = text.toLowerCase();
if (SearchUtil
.isComponentHighlighted(lowerText, insensitiveFilter, force, null)) {
return true;
}
else if (lowerText.contains(insensitiveFilter)) {
return true;
}
}
final String description = action.getTemplatePresentation().getDescription();
if (description != null) {
final String insensitiveDescription = description.toLowerCase();
if (SearchUtil
.isComponentHighlighted(insensitiveDescription, insensitiveFilter, force, null)) {
return true;
}
else if (insensitiveDescription.contains(insensitiveFilter)) {
return true;
for (String text : new String[]{action.getTemplatePresentation().getText(),
action.getTemplatePresentation().getDescription(),
action instanceof ActionStub ? ((ActionStub)action).getId() : ActionManager.getInstance().getId(action)}) {
if (text != null) {
final String lowerText = text.toLowerCase();
if (SearchUtil.isComponentHighlighted(lowerText, insensitiveFilter, force, null)) {
return true;
}
else if (lowerText.contains(insensitiveFilter)) {
return true;
}
}
}
return false;
@@ -0,0 +1,59 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.openapi.keymap.impl.ui;
import com.intellij.openapi.actionSystem.ex.QuickList;
import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.testFramework.LightPlatformCodeInsightTestCase;
public class ActionsTreeTest extends LightPlatformCodeInsightTestCase {
private static final String ACTION_WITHOUT_TEXT_AND_DESCRIPTION = "EditorDeleteToLineEnd";
private static final String ACTION_WITH_TEXT_ONLY = "EditorCutLineEnd";
private static final String ACTION_WITH_TEXT_AND_DESCRIPTION = "EditorHungryBackSpace";
private ActionsTree myActionsTree;
public void setUp() throws Exception {
super.setUp();
myActionsTree = new ActionsTree();
myActionsTree.reset(KeymapManager.getInstance().getActiveKeymap(), new QuickList[0]);
}
public void testVariousActionsArePresent() {
doTest(null,
ACTION_WITHOUT_TEXT_AND_DESCRIPTION,
ACTION_WITH_TEXT_ONLY,
ACTION_WITH_TEXT_AND_DESCRIPTION);
}
public void testFiltering() {
doTest("Editor",
// all below actions should still be present, as they contain 'Editor' in their actionId
ACTION_WITHOUT_TEXT_AND_DESCRIPTION,
ACTION_WITH_TEXT_ONLY,
ACTION_WITH_TEXT_AND_DESCRIPTION);
}
private void doTest(String filter, String... idsThatMustBePresent) {
if (filter != null) {
myActionsTree.filter(filter, new QuickList[0]);
}
for (String actionId : idsThatMustBePresent) {
assertTrue(actionId + " is absent", myActionsTree.getMainGroup().containsId(actionId));
}
}
}