当前位置: 首页>>代码示例>>Java>>正文


Java CommonShortcuts类代码示例

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


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


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