Search in sources :

Example 1 with PsiViewerPanel

use of idea.plugin.psiviewer.view.PsiViewerPanel in project psiviewer by cmf.

the class BaseGlobalAction method actionPerformed.

public void actionPerformed(AnActionEvent event) {
    Project project = ActionEventUtil.getProject(event);
    PsiDocumentManager.getInstance(project).commitAllDocuments();
    PsiViewerPanel viewer = PsiViewerProjectComponent.getInstance(project).getViewerPanel();
    if (getTargetElement(event) == null)
        return;
    viewer.selectRootElement(getTargetElement(event), getToolWindowTitle());
    ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(PsiViewerConstants.ID_TOOL_WINDOW);
    toolWindow.activate(viewer);
}
Also used : Project(com.intellij.openapi.project.Project) ToolWindow(com.intellij.openapi.wm.ToolWindow) PsiViewerPanel(idea.plugin.psiviewer.view.PsiViewerPanel)

Example 2 with PsiViewerPanel

use of idea.plugin.psiviewer.view.PsiViewerPanel in project psiviewer by cmf.

the class PsiViewerProjectComponent method initToolWindow.

public void initToolWindow() {
    _viewerPanel = new PsiViewerPanel(this);
    _viewerPanel.addPropertyChangeListener("ancestor", new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            handleCurrentState();
        }
    });
    ActionManager actionManager = ActionManager.getInstance();
    DefaultActionGroup actionGroup = new DefaultActionGroup(ID_ACTION_GROUP, false);
    actionGroup.add(new PropertyToggleAction("Filter Whitespace", "Remove whitespace elements", Helpers.getIcon(ICON_FILTER_WHITESPACE), this, "filterWhitespace"));
    actionGroup.add(new PropertyToggleAction("Highlight", "Highlight selected PSI element", Helpers.getIcon(ICON_TOGGLE_HIGHLIGHT), this, "highlighted"));
    actionGroup.add(new PropertyToggleAction("Properties", "Show PSI element properties", AllIcons.General.Settings, this, "showProperties"));
    actionGroup.add(new PropertyToggleAction("Autoscroll to Source", "Autoscroll to Source", AllIcons.General.AutoscrollToSource, this, "autoScrollToSource"));
    actionGroup.add(new PropertyToggleAction("Autoscroll from Source", "Autoscroll from Source111", AllIcons.General.AutoscrollFromSource, this, "autoScrollFromSource"));
    ActionToolbar toolBar = actionManager.createActionToolbar(ID_ACTION_TOOLBAR, actionGroup, true);
    JPanel panel = new JPanel(new HorizontalLayout(0));
    panel.add(toolBar.getComponent());
    myLanguagesComboBox = new ComboBox();
    panel.add(myLanguagesComboBox);
    updateLanguagesList(Collections.<Language>emptyList());
    _viewerPanel.add(panel, BorderLayout.NORTH);
    ToolWindow toolWindow = getToolWindow();
    toolWindow.setIcon(Helpers.getIcon(ICON_TOOL_WINDOW));
    _viewerPanel.setToolWindow(toolWindow);
    _editorListener = new EditorListener(_viewerPanel, _project);
}
Also used : ActionManager(com.intellij.openapi.actionSystem.ActionManager) ToolWindow(com.intellij.openapi.wm.ToolWindow) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) PsiViewerPanel(idea.plugin.psiviewer.view.PsiViewerPanel) ComboBox(com.intellij.openapi.ui.ComboBox) PropertyToggleAction(idea.plugin.psiviewer.controller.actions.PropertyToggleAction) ActionToolbar(com.intellij.openapi.actionSystem.ActionToolbar) DefaultActionGroup(com.intellij.openapi.actionSystem.DefaultActionGroup) HorizontalLayout(com.intellij.ui.components.panels.HorizontalLayout)

Aggregations

ToolWindow (com.intellij.openapi.wm.ToolWindow)2 PsiViewerPanel (idea.plugin.psiviewer.view.PsiViewerPanel)2 ActionManager (com.intellij.openapi.actionSystem.ActionManager)1 ActionToolbar (com.intellij.openapi.actionSystem.ActionToolbar)1 DefaultActionGroup (com.intellij.openapi.actionSystem.DefaultActionGroup)1 Project (com.intellij.openapi.project.Project)1 ComboBox (com.intellij.openapi.ui.ComboBox)1 HorizontalLayout (com.intellij.ui.components.panels.HorizontalLayout)1 PropertyToggleAction (idea.plugin.psiviewer.controller.actions.PropertyToggleAction)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1