Search in sources :

Example 1 with HotKeyItem

use of org.eclipse.che.ide.api.hotkeys.HotKeyItem in project che by eclipse.

the class HotKeysDialogPresenter method onPrintClicked.

@Override
public void onPrintClicked() {
    final JsoArray<Node> nodesArray = JsoArray.create();
    for (Map.Entry<String, List<HotKeyItem>> entry : categories.entrySet()) {
        nodesArray.add(wrapCategory(entry.getKey()));
        for (HotKeyItem hotKeyItem : entry.getValue()) {
            if (hotKeyItem.getActionDescription() != null) {
                nodesArray.add(wrapHotKey(hotKeyItem.getHotKey(), hotKeyItem.getActionDescription(), hotKeyItem.isGlobal()));
            }
        }
    }
    openWindowForPrinting(resources.printTemplate().getText(), nodesArray);
}
Also used : HotKeyItem(org.eclipse.che.ide.api.hotkeys.HotKeyItem) Node(com.google.gwt.dom.client.Node) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with HotKeyItem

use of org.eclipse.che.ide.api.hotkeys.HotKeyItem in project che by eclipse.

the class HotKeysDialogPresenter method getIDEHotKey.

private List<HotKeyItem> getIDEHotKey() {
    List<HotKeyItem> ideHotKeys = new ArrayList<>();
    Scheme scheme = keyBindingAgent.getScheme(selectedSchemeId);
    for (String actionId : actionManager.getActionIds("")) {
        boolean isGlobal = false;
        CharCodeWithModifiers activeCharCodeWithModifiers = scheme.getKeyBinding(actionId);
        if (activeCharCodeWithModifiers == null) {
            activeCharCodeWithModifiers = keyBindingAgent.getKeyBinding(actionId);
            isGlobal = true;
        }
        if (activeCharCodeWithModifiers != null) {
            String hotKey = KeyMapUtil.getShortcutText(activeCharCodeWithModifiers);
            String description = actionManager.getAction(actionId).getTemplatePresentation().getDescription();
            if (description != null && !description.isEmpty()) {
                ideHotKeys.add(new HotKeyItem(description, hotKey, isGlobal));
            }
        }
    }
    return ideHotKeys;
}
Also used : HotKeyItem(org.eclipse.che.ide.api.hotkeys.HotKeyItem) Scheme(org.eclipse.che.ide.api.keybinding.Scheme) CharCodeWithModifiers(org.eclipse.che.ide.util.input.CharCodeWithModifiers) ArrayList(java.util.ArrayList)

Example 3 with HotKeyItem

use of org.eclipse.che.ide.api.hotkeys.HotKeyItem in project che by eclipse.

the class HotKeysDialogPresenter method filterCategory.

private List<HotKeyItem> filterCategory(List<HotKeyItem> hotKeyItems, String expectedText) {
    List<HotKeyItem> result = new ArrayList<>();
    for (HotKeyItem hotKeyItem : hotKeyItems) {
        String description = hotKeyItem.getActionDescription();
        String keyBindings = hotKeyItem.getHotKey();
        boolean isFound = description != null && (StringUtils.containsIgnoreCase(description, expectedText) || StringUtils.containsIgnoreCase(keyBindings, expectedText));
        if (isFound) {
            result.add(hotKeyItem);
        }
    }
    return result;
}
Also used : HotKeyItem(org.eclipse.che.ide.api.hotkeys.HotKeyItem) ArrayList(java.util.ArrayList)

Example 4 with HotKeyItem

use of org.eclipse.che.ide.api.hotkeys.HotKeyItem in project che by eclipse.

the class OrionEditorWidget method getHotKeys.

@Override
public List<HotKeyItem> getHotKeys() {
    OrionTextViewOverlay orionTextViewOverlay = editorOverlay.getTextView();
    List<HotKeyItem> hotKeyItems = new ArrayList<>();
    JsArray<OrionKeyBindingsRelationOverlay> keyBindings = OrionKeyModeOverlay.getKeyBindings_(orionTextViewOverlay);
    for (int i = 0; i < keyBindings.length(); i++) {
        OrionKeyBindingsRelationOverlay key = keyBindings.get(i);
        String actionId = key.getActionId();
        String actionDescription = orionTextViewOverlay.getActionDescription(actionId);
        String hotKey = UiUtilsOverlay.getUserKeyString(uiUtilsOverlay, key.getKeyBindings());
        if (actionDescription != null) {
            hotKeyItems.add(new HotKeyItem(actionDescription, hotKey));
        }
    }
    return hotKeyItems;
}
Also used : HotKeyItem(org.eclipse.che.ide.api.hotkeys.HotKeyItem) OrionKeyBindingsRelationOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionKeyBindingsRelationOverlay) ArrayList(java.util.ArrayList) OrionTextViewOverlay(org.eclipse.che.ide.editor.orion.client.jso.OrionTextViewOverlay)

Aggregations

ArrayList (java.util.ArrayList)4 HotKeyItem (org.eclipse.che.ide.api.hotkeys.HotKeyItem)4 Node (com.google.gwt.dom.client.Node)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Scheme (org.eclipse.che.ide.api.keybinding.Scheme)1 OrionKeyBindingsRelationOverlay (org.eclipse.che.ide.editor.orion.client.jso.OrionKeyBindingsRelationOverlay)1 OrionTextViewOverlay (org.eclipse.che.ide.editor.orion.client.jso.OrionTextViewOverlay)1 CharCodeWithModifiers (org.eclipse.che.ide.util.input.CharCodeWithModifiers)1