本文整理汇总了Java中com.intellij.openapi.keymap.impl.KeymapImpl类的典型用法代码示例。如果您正苦于以下问题:Java KeymapImpl类的具体用法?Java KeymapImpl怎么用?Java KeymapImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
KeymapImpl类属于com.intellij.openapi.keymap.impl包,在下文中一共展示了KeymapImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: copyKeymap
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private void copyKeymap() {
Keymap keymap = myEditor.getModel().getSelected();
if (keymap == null) {
return;
}
KeymapImpl newKeymap = ((KeymapImpl)keymap).deriveKeymap();
String newKeymapName = KeyMapBundle.message("new.keymap.name", keymap.getPresentableName());
if (!tryNewKeymapName(newKeymapName)) {
for (int i = 0; ; i++) {
newKeymapName = KeyMapBundle.message("new.indexed.keymap.name", keymap.getPresentableName(), i);
if (tryNewKeymapName(newKeymapName)) {
break;
}
}
}
newKeymap.setName(newKeymapName);
newKeymap.setCanModify(true);
myEditor.getModel().add(newKeymap);
myEditor.getModel().setSelectedItem(newKeymap);
myEditor.getComboBox().getEditor().selectAll();
currentKeymapChanged();
}
示例2: NameEditor
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
public NameEditor() {
getField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
if (item != null && itemEditor.isEditable(item)) {
String newName = getField().getText();
if (newName.equals(itemEditor.getName(item))) {
return;
}
if (!mutated) {
mutated = true;
item = getMutable(item);
}
((KeymapImpl)item).setName(newName);
}
}
});
}
示例3: patchKeymap
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private static void patchKeymap() {
Set<String> droppedActions = ContainerUtil.newHashSet(
"AddToFavoritesPopup",
"DatabaseView.ImportDataSources",
"CompileDirty", "Compile",
// hidden
"AddNewFavoritesList", "EditFavorites", "RenameFavoritesList", "RemoveFavoritesList");
KeymapManagerEx keymapManager = KeymapManagerEx.getInstanceEx();
for (Keymap keymap : keymapManager.getAllKeymaps()) {
if (keymap.canModify()) continue;
KeymapImpl keymapImpl = (KeymapImpl)keymap;
for (String id : keymapImpl.getOwnActionIds()) {
if (droppedActions.contains(id)) keymapImpl.clearOwnActionsId(id);
}
}
}
示例4: quickListRenamed
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Override
public void quickListRenamed(final QuickList oldQuickList, final QuickList newQuickList){
for (Keymap keymap : getAllKeymaps()) {
KeymapImpl impl = (KeymapImpl)keymap;
String actionId = oldQuickList.getActionId();
String newActionId = newQuickList.getActionId();
Shortcut[] shortcuts = impl.getShortcuts(actionId);
if (shortcuts != null) {
for (Shortcut shortcut : shortcuts) {
impl.removeShortcut(actionId, shortcut);
impl.addShortcut(newActionId, shortcut);
}
}
}
myQuickListsModified = true;
}
示例5: copyKeymap
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private void copyKeymap() {
KeymapImpl keymap = getSelectedKeymap();
if(keymap == null) {
return;
}
KeymapImpl newKeymap = keymap.deriveKeymap();
String newKeymapName = KeyMapBundle.message("new.keymap.name", keymap.getPresentableName());
if(!tryNewKeymapName(newKeymapName)) {
for(int i=0; ; i++) {
newKeymapName = KeyMapBundle.message("new.indexed.keymap.name", keymap.getPresentableName(), i);
if(tryNewKeymapName(newKeymapName)) {
break;
}
}
}
newKeymap.setName(newKeymapName);
newKeymap.setCanModify(true);
myKeymapListModel.addElement(newKeymap);
myKeymapList.setSelectedItem(newKeymap);
myKeymapList.getEditor().selectAll();
processCurrentKeymapChanged(getCurrentQuickListIds());
}
示例6: fillActions
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
final KeymapManagerEx manager = (KeymapManagerEx) KeymapManager.getInstance();
final Keymap current = manager.getActiveKeymap();
for (final Keymap keymap : manager.getAllKeymaps()) {
addKeymapAction(group, manager, current, keymap, false);
}
Collection<SharedScheme<KeymapImpl>> sharedSchemes = ((KeymapManagerEx)KeymapManagerEx.getInstance()).getSchemesManager().loadSharedSchemes();
if (!sharedSchemes.isEmpty()) {
group.add(Separator.getInstance());
for (SharedScheme<KeymapImpl> sharedScheme : sharedSchemes) {
addKeymapAction(group, manager,current, sharedScheme.getScheme(), true);
}
}
}
示例7: quickListRenamed
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Override
public void quickListRenamed(final QuickList oldQuickList, final QuickList newQuickList) {
for (Keymap keymap : getAllKeymaps()) {
KeymapImpl impl = (KeymapImpl)keymap;
String actionId = oldQuickList.getActionId();
String newActionId = newQuickList.getActionId();
Shortcut[] shortcuts = impl.getShortcuts(actionId);
if (shortcuts != null) {
for (Shortcut shortcut : shortcuts) {
impl.removeShortcut(actionId, shortcut);
impl.addShortcut(newActionId, shortcut);
}
}
}
myQuickListsModified = true;
}
示例8: copyKeymap
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private void copyKeymap() {
KeymapImpl keymap = getSelectedKeymap();
if (keymap == null) {
return;
}
KeymapImpl newKeymap = keymap.deriveKeymap();
String newKeymapName = KeyMapBundle.message("new.keymap.name", keymap.getPresentableName());
if (!tryNewKeymapName(newKeymapName)) {
for (int i = 0; ; i++) {
newKeymapName = KeyMapBundle.message("new.indexed.keymap.name", keymap.getPresentableName(), i);
if (tryNewKeymapName(newKeymapName)) {
break;
}
}
}
newKeymap.setName(newKeymapName);
newKeymap.setCanModify(true);
myKeymapListModel.addElement(newKeymap);
myKeymapList.setSelectedItem(newKeymap);
myKeymapList.getEditor().selectAll();
processCurrentKeymapChanged(getCurrentQuickListIds());
}
示例9: apply
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Override
public void apply() throws ConfigurationException {
ensureNonEmptyKeymapNames();
ensureUniqueKeymapNames();
final KeymapManagerImpl keymapManager = (KeymapManagerImpl)KeymapManager.getInstance();
keymapManager.removeAllKeymapsExceptUnmodifiable();
for (int i = 0; i < myKeymapListModel.getSize(); i++) {
final Keymap modelKeymap = (Keymap)myKeymapListModel.getElementAt(i);
if (modelKeymap.canModify()) {
final KeymapImpl keymapToAdd = ((KeymapImpl)modelKeymap).copy(true);
keymapManager.addKeymap(keymapToAdd);
}
}
keymapManager.setActiveKeymap(mySelectedKeymap);
ActionToolbarImpl.updateAllToolbarsImmediately();
}
示例10: getText
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private static String getText(Shortcut shortcut) {
if (shortcut instanceof KeyboardShortcut) {
KeyStroke fst = ((KeyboardShortcut)shortcut).getFirstKeyStroke();
String s = KeymapImpl.getKeyShortcutString(fst);
KeyStroke snd = ((KeyboardShortcut)shortcut).getSecondKeyStroke();
if (snd != null) {
s += "," + KeymapImpl.getKeyShortcutString(snd);
}
return s;
}
return KeymapUtil.getShortcutText(shortcut);
}
示例11: currentKeymapChanged
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private void currentKeymapChanged() {
myResetToDefault.setEnabled(false);
Keymap selectedKeymap = myEditor.getModel().getSelected();
boolean editable = selectedKeymap != null && selectedKeymap.canModify();
myDeleteButton.setEnabled(editable);
myCopyButton.setEnabled(selectedKeymap != null);
myEditor.getComboBox().setEditable(editable);
if (selectedKeymap == null) {
myActionsTree.reset(new KeymapImpl(), myQuickLists);
return;
}
Keymap parent = selectedKeymap.getParent();
if (parent == null || !selectedKeymap.canModify()) {
myBaseKeymapLabel.setText("");
}
else {
myBaseKeymapLabel.setText(KeyMapBundle.message("based.on.keymap.label", parent.getPresentableName()));
if (selectedKeymap.canModify() && ((KeymapImpl)selectedKeymap).getOwnActionIds().length > 0) {
myResetToDefault.setEnabled(true);
}
}
myActionsTree.reset(selectedKeymap, myQuickLists);
}
示例12: resetKeymap
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private void resetKeymap() {
Keymap keymap = myEditor.getModel().getSelected();
if (keymap == null) {
return;
}
((KeymapImpl)keymap).clearOwnActionsIds();
currentKeymapChanged();
}
示例13: hasAssociatedShortcutsInHierarchy
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
private static boolean hasAssociatedShortcutsInHierarchy(String id, Keymap keymap) {
while (keymap != null) {
if (((KeymapImpl)keymap).hasOwnActionId(id)) return true;
keymap = keymap.getParent();
}
return false;
}
示例14: getActionBinding
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Nullable
private static String getActionBinding(final Keymap keymap, final String id) {
if (keymap == null) return null;
Keymap parent = keymap.getParent();
String result = ((KeymapImpl)keymap).getActionBinding(id);
if (result == null && parent != null) {
result = ((KeymapImpl)parent).getActionBinding(id);
}
return result;
}
示例15: processCurrentKeymapChanged
import com.intellij.openapi.keymap.impl.KeymapImpl; //导入依赖的package包/类
@Override
public void processCurrentKeymapChanged(QuickList[] ids) {
myQuickLists = ids;
myCopyButton.setEnabled(false);
myDeleteButton.setEnabled(false);
myResetToDefault.setEnabled(false);
if (myExportButton != null) {
myExportButton.setEnabled(false);
}
KeymapImpl selectedKeymap = getSelectedKeymap();
mySelectedKeymap = selectedKeymap;
if (selectedKeymap == null) {
myActionsTree.reset(new KeymapImpl(), getCurrentQuickListIds());
return;
}
myKeymapList.setEditable(mySelectedKeymap.canModify());
myCopyButton.setEnabled(true);
myBaseKeymapLabel.setText("");
Keymap parent = mySelectedKeymap.getParent();
if (parent != null && mySelectedKeymap.canModify()) {
myBaseKeymapLabel.setText(KeyMapBundle.message("based.on.keymap.label", parent.getPresentableName()));
if (mySelectedKeymap.canModify() && mySelectedKeymap.getOwnActionIds().length > 0){
myResetToDefault.setEnabled(true);
}
}
if(mySelectedKeymap.canModify()) {
myDeleteButton.setEnabled(true);
if (!getSchemesManager().isShared(mySelectedKeymap)) {
if (myExportButton != null) {
myExportButton.setEnabled(true);
}
}
}
myActionsTree.reset(mySelectedKeymap, getCurrentQuickListIds());
}