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);
}
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;
}
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;
}
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;
}
Aggregations