• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CommonShortcuts类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.openapi.actionSystem.CommonShortcuts的典型用法代码示例。如果您正苦于以下问题:Java CommonShortcuts类的具体用法?Java CommonShortcuts怎么用?Java CommonShortcuts使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CommonShortcuts类属于com.intellij.openapi.actionSystem包,在下文中一共展示了CommonShortcuts类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: TipManager

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public TipManager(final JComponent component, TipFactory factory) {
  myTipFactory = factory;
  myComponent = component;

  new UiNotifyConnector.Once(component, new Activatable() {
    @Override
    public void showNotify() {
      installListeners();
    }

    @Override
    public void hideNotify() {
    }
  });

  final HideTooltipAction hide = new HideTooltipAction();
  hide.registerCustomShortcutSet(CommonShortcuts.ESCAPE, myComponent);
  Disposer.register(this, new Disposable() {
    @Override
    public void dispose() {
      hide.unregisterCustomShortcutSet(myComponent);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:TipManager.java


示例2: createCenterPanel

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
protected JComponent createCenterPanel() {
  myTextArea = new JTextArea(10, 50);
  myTextArea.setText(getText());
  myTextArea.setWrapStyleWord(true);
  myTextArea.setLineWrap(true);
  myTextArea.getDocument().addDocumentListener(new DocumentAdapter() {
    public void textChanged(DocumentEvent event) {
      if (myChangeListener != null) {
        myChangeListener.run();
      }
    }
  });

  new AnAction() {
    public void actionPerformed(AnActionEvent e) {
      doOKAction();
    }
  }.registerCustomShortcutSet(CommonShortcuts.ENTER, myTextArea);

  return ScrollPaneFactory.createScrollPane(myTextArea);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:AbstractFieldPanel.java


示例3: createPopup

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
@NotNull
JBPopup createPopup() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.add(myTextField, BorderLayout.CENTER);
  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField)
    .setCancelOnClickOutside(true)
    .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
    .setRequestFocus(true)
    .setResizable(true)
    .setMayBeParent(true);

  final JBPopup popup = builder.createPopup();
  popup.setMinimumSize(new Dimension(200, 90));
  AnAction okAction = new DumbAwareAction() {
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      unregisterCustomShortcutSet(popup.getContent());
      popup.closeOk(e.getInputEvent());
    }
  };
  okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent());
  return popup;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:MultilinePopupBuilder.java


示例4: addCloseOnEsc

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
private void addCloseOnEsc(final RootPaneContainer frame) {
  new DumbAwareAction() {
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      MenuSelectionManager menuSelectionManager = MenuSelectionManager.defaultManager();
      MenuElement[] selectedPath = menuSelectionManager.getSelectedPath();
      if (selectedPath.length > 0) { // hide popup menu if any
        menuSelectionManager.clearSelectedPath();
      } else {
        // if you remove this line problems will start happen on Mac OS X
        // 2 projects opened, call Cmd+D on the second opened project and then Esc.
        // Weird situation: 2nd IdeFrame will be active, but focus will be somewhere inside the 1st IdeFrame
        // App is unusable until Cmd+Tab, Cmd+tab
        FrameWrapper.this.myFrame.setVisible(false);
        close();
      }
    }
  }.registerCustomShortcutSet(CommonShortcuts.ESCAPE, myComponent, this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:FrameWrapper.java


示例5: MyEditor

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public MyEditor(final Project project) {
  myProject = project;
  myEditorTextField = new EditorTextField("", project, StdFileTypes.JAVA) {
    protected boolean shouldHaveBorder() {
      return false;
    }
  };
  myActionListener = new MyActionListener();
  myTfWithButton = new ComponentWithBrowseButton<EditorTextField>(myEditorTextField, myActionListener);
  myEditorTextField.setBorder(null);
  new MyCancelEditingAction().registerCustomShortcutSet(CommonShortcuts.ESCAPE, myTfWithButton);
  /*
  myEditorTextField.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        fireValueCommitted();
      }
    }
  );
  */
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ClassToBindProperty.java


示例6: MyEditor

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public MyEditor(final Project project) {
  myProject = project;
  myEditorTextField = new EditorTextField("", project, JavaFileType.INSTANCE) {
    protected boolean shouldHaveBorder() {
      return false;
    }
  };
  myActionListener = new MyActionListener();
  myTfWithButton = new ComponentWithBrowseButton<EditorTextField>(myEditorTextField, myActionListener);
  myEditorTextField.setBorder(null);
  new MyCancelEditingAction().registerCustomShortcutSet(CommonShortcuts.ESCAPE, myTfWithButton);
  /*
  myEditorTextField.addActionListener(
    new ActionListener() {
      public void actionPerformed(final ActionEvent e) {
        fireValueCommitted();
      }
    }
  );
  */
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:22,代码来源:ClassToBindProperty.java


示例7: createActions

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
@Override
@Nullable
protected ArrayList<AnAction> createActions(boolean fromPopup) {
    ArrayList<AnAction> result = new ArrayList<AnAction>();
    result.add(new AnAction("Add", "Add", IconUtil.getAddIcon()) {
        {
            registerCustomShortcutSet(CommonShortcuts.INSERT, myTree);
        }

        public void actionPerformed(AnActionEvent event) {
            final VirtualFile sdk = NuxeoSDKChooser.chooseNuxeoSDK(project);
            if (sdk == null)
                return;

            final String name = askForNuxeoSDKName("Register Nuxeo SDK", "");
            if (name == null)
                return;
            final NuxeoSDK nuxeoSDK = new NuxeoSDK(name, sdk.getPath());
            addNuxeoSDKNode(nuxeoSDK);
        }
    });
    result.add(new MyDeleteAction(forAll(Conditions.alwaysTrue())));
    return result;
}
 
开发者ID:troger,项目名称:nuxeo-intellij,代码行数:25,代码来源:NuxeoSDKsPanel.java


示例8: createPopup

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
@Nonnull
JBPopup createPopup() {
  JPanel panel = new JPanel(new BorderLayout());
  panel.add(myTextField, BorderLayout.CENTER);
  ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, myTextField)
          .setCancelOnClickOutside(true)
          .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
          .setRequestFocus(true)
          .setResizable(true)
          .setMayBeParent(true);

  final JBPopup popup = builder.createPopup();
  popup.setMinimumSize(new JBDimension(200, 90));
  AnAction okAction = new DumbAwareAction() {
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      unregisterCustomShortcutSet(popup.getContent());
      popup.closeOk(e.getInputEvent());
    }
  };
  okAction.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, popup.getContent());
  return popup;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:MultilinePopupBuilder.java


示例9: addCloseOnEsc

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
private void addCloseOnEsc(final RootPaneContainer frame) {
  JRootPane rootPane = frame.getRootPane();
  ActionListener closeAction = new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      if (!PopupUtil.handleEscKeyEvent()) {
        // if you remove this line problems will start happen on Mac OS X
        // 2 projects opened, call Cmd+D on the second opened project and then Esc.
        // Weird situation: 2nd IdeFrame will be active, but focus will be somewhere inside the 1st IdeFrame
        // App is unusable until Cmd+Tab, Cmd+tab
        FrameWrapper.this.myFrame.setVisible(false);
        close();
      }
    }
  };
  rootPane.registerKeyboardAction(closeAction, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
  ActionUtil.registerForEveryKeyboardShortcut(rootPane, closeAction, CommonShortcuts.getCloseActiveWindow());
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:FrameWrapper.java


示例10: InspectPanel

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public InspectPanel(Project project, DebuggerStateManager stateManager, @NotNull NodeDescriptorImpl inspectDescriptor) {
  super(project, stateManager);

  getInspectTree().setInspectDescriptor(inspectDescriptor);

  add(ScrollPaneFactory.createScrollPane(getInspectTree()), BorderLayout.CENTER);
  registerDisposable(DebuggerAction.installEditAction(getInspectTree(), DebuggerActions.EDIT_NODE_SOURCE));

  overrideShortcut(getInspectTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy());
  setUpdateEnabled(true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:InspectPanel.java


示例11: init

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
protected void init() {
  if (myWrapper != null) return;

  myProcessor = createProcessor();

  String dialogGroupKey = myProcessor.getContextUserData(DiffUserDataKeys.DIALOG_GROUP_KEY);
  if (dialogGroupKey == null) dialogGroupKey = "DiffContextDialog";

  myWrapper = new WindowWrapperBuilder(DiffUtil.getWindowMode(myHints), new MyPanel(myProcessor.getComponent()))
    .setProject(myProject)
    .setParent(myHints.getParent())
    .setDimensionServiceKey(dialogGroupKey)
    .setOnShowCallback(new Runnable() {
      @Override
      public void run() {
        myProcessor.updateRequest();
        myProcessor.requestFocus(); // TODO: not needed for modal dialogs. Make a flag in WindowWrapperBuilder ?
      }
    })
    .build();
  myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png"));
  Disposer.register(myWrapper, myProcessor);

  new DumbAwareAction() {
    public void actionPerformed(final AnActionEvent e) {
      myWrapper.close();
    }
  }.registerCustomShortcutSet(CommonShortcuts.getCloseActiveWindow(), myProcessor.getComponent(), myWrapper);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:DiffWindowBase.java


示例12: installMoveEndAction

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public static void installMoveEndAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveEnd(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveEnd(list);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ScrollingUtil.java


示例13: installMoveHomeAction

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public static void installMoveHomeAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveHome(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveHome(list);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ScrollingUtil.java


示例14: installMovePageDownAction

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public static void installMovePageDownAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMovePageDown(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      movePageDown(list);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ScrollingUtil.java


示例15: installMovePageUpAction

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public static void installMovePageUpAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMovePageUp(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      movePageUp(list);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ScrollingUtil.java


示例16: installMoveDownAction

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public static void installMoveDownAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveDown(), focusParent == null ? list : focusParent){
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveDown(list, 0);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ScrollingUtil.java


示例17: installMoveUpAction

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public static void installMoveUpAction(final JList list, @Nullable JComponent focusParent) {
  new ListScrollAction(CommonShortcuts.getMoveUp(), focusParent == null ? list : focusParent) {
    @Override
    public void actionPerformed(AnActionEvent e) {
      moveUp(list, 0);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ScrollingUtil.java


示例18: showNotePopup

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
private void showNotePopup(Project project,
                           final DnDAwareTree tree,
                           final Consumer<String> after, final String initText) {
  final JTextArea textArea = new JTextArea(3, 50);
  textArea.setFont(UIUtil.getTreeFont());
  textArea.setText(initText);
  final JBScrollPane pane = new JBScrollPane(textArea);
  final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(pane, textArea)
    .setCancelOnClickOutside(true)
    .setAdText(KeymapUtil.getShortcutsText(CommonShortcuts.CTRL_ENTER.getShortcuts()) + " to finish")
    .setTitle("Comment")
    .setMovable(true)
    .setRequestFocus(true).setResizable(true).setMayBeParent(true);
  final JBPopup popup = builder.createPopup();
  final JComponent content = popup.getContent();
  final AnAction action = new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      popup.closeOk(e.getInputEvent());
      unregisterCustomShortcutSet(content);
      after.consume(textArea.getText());
    }
  };
  action.registerCustomShortcutSet(CommonShortcuts.CTRL_ENTER, content);
  ApplicationManager.getApplication().invokeLater(new Runnable() {
    @Override
    public void run() {
      popup.showInCenterOf(tree);
    }
  }, ModalityState.NON_MODAL, project.getDisposed());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:TaskDefaultFavoriteListProvider.java


示例19: AntBuildFilePropertiesAction

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
public AntBuildFilePropertiesAction(AntExplorer antExplorer) {
  super(AntBundle.message("build.file.properties.action.name"),
        AntBundle.message("build.file.properties.action.description"),
        AntIcons.Properties);
  myAntExplorer = antExplorer;
  registerCustomShortcutSet(CommonShortcuts.ALT_ENTER, myAntExplorer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AntBuildFilePropertiesAction.java


示例20: addActionsTo

import com.intellij.openapi.actionSystem.CommonShortcuts; //导入依赖的package包/类
@Override
protected void addActionsTo(DefaultActionGroup group) {
  super.addActionsTo(group);
  ShowAllAffectedGenericAction showCommit = ShowAllAffectedGenericAction.getInstance();
  showCommit.registerCustomShortcutSet(new CustomShortcutSet(
    CommonShortcuts.DOUBLE_CLICK_1.getShortcuts()[0]), myTree);
  group.addAction(showCommit);

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GitSkippedCommits.java



注:本文中的com.intellij.openapi.actionSystem.CommonShortcuts类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BaseDexBuffer类代码示例发布时间:2022-05-22
下一篇:
Java AudioSampleEntry类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap