Example usage for com.intellij.openapi.actionSystem IdeActions ACTION_GOTO_DECLARATION

List of usage examples for com.intellij.openapi.actionSystem IdeActions ACTION_GOTO_DECLARATION

Introduction

In this page you can find the example usage for com.intellij.openapi.actionSystem IdeActions ACTION_GOTO_DECLARATION.

Prototype

String ACTION_GOTO_DECLARATION

To view the source code for com.intellij.openapi.actionSystem IdeActions ACTION_GOTO_DECLARATION.

Click Source Link

Usage

From source file:org.moe.designer.designSurface.IOSDesignerActionPanel.java

License:Apache License

private ActionGroup getRhsActions() {
    DefaultActionGroup group = new DefaultActionGroup();

    group.add(new ToggleAction(null, "Zoom to Fit (0)", AndroidIcons.ZoomFit) {
        @Override//from w ww. j  a  v a2 s  . c  o m
        public boolean isSelected(AnActionEvent e) {
            return ((IOSDesignerEditorPanel) myDesigner).isZoomToFit();
        }

        @Override
        public void setSelected(AnActionEvent e, boolean state) {
            myDesigner.zoom(ZoomType.FIT);
        }
    });
    group.add(new AnAction(null, "Reset Zoom to 100% (1)", AndroidIcons.ZoomActual) {
        @Override
        public void actionPerformed(AnActionEvent e) {
            myDesigner.zoom(ZoomType.ACTUAL);
        }
    });
    group.addSeparator();
    group.add(new AnAction(null, "Zoom In (+)", AndroidIcons.ZoomIn) {
        @Override
        public void actionPerformed(AnActionEvent e) {
            myDesigner.zoom(ZoomType.IN);
        }
    });
    group.add(new AnAction(null, "Zoom Out (-)", AndroidIcons.ZoomOut) {
        @Override
        public void actionPerformed(AnActionEvent e) {
            myDesigner.zoom(ZoomType.OUT);
        }
    });

    String description = "Jump to Source";
    KeyboardShortcut shortcut = ActionManager.getInstance()
            .getKeyboardShortcut(IdeActions.ACTION_GOTO_DECLARATION);
    if (shortcut != null) {
        description += " (" + KeymapUtil.getShortcutText(shortcut) + ")";
    }
    // Use FilesTypes.Text rather than FileTypes.Xml here to avoid having the icon from
    // the tab bar replicated right below it
    group.add(new AnAction(null, description, AllIcons.FileTypes.Text) {
        @Override
        public void actionPerformed(AnActionEvent e) {
            List<RadComponent> selection = myDesigner.getSurfaceArea().getSelection();
            if (!selection.isEmpty()) {
                RadViewComponent component = (RadViewComponent) selection.get(0);
                PsiNavigateUtil.navigate(component.getTag());
            }
        }

        @Override
        public void update(AnActionEvent e) {
            List<RadComponent> selection = myDesigner.getSurfaceArea().getSelection();
            e.getPresentation().setEnabled(!selection.isEmpty());
        }
    });

    IOSDesignerEditorPanel designer = (IOSDesignerEditorPanel) myDesigner;
    group.add(new RefreshRenderAction(designer));

    return group;
}