本文整理汇总了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);
}
});
}
示例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);
}
示例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;
}
示例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);
}
示例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();
}
}
);
*/
}
示例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();
}
}
);
*/
}
示例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;
}
示例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;
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
};
}
示例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);
}
};
}
示例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);
}
};
}
示例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);
}
};
}