Search in sources :

Example 1 with GraphLayoutComboAction

use of com.lsfusion.dependencies.GraphLayoutComboAction in project plugin-idea by lsfusion.

the class DependenciesView method createToolbar.

private ActionToolbar createToolbar() {
    SimpleActionGroup actions = new SimpleActionGroup();
    actions.add(new AnAction(null, "Refresh", LSFIcons.Design.REFRESH) {

        @Override
        public void actionPerformed(AnActionEvent e) {
            redrawCurrent();
        }
    });
    showRequiringAction = new CheckboxAction(getDependentTitle()) {

        @Override
        public boolean isSelected(AnActionEvent e) {
            return showRequiring;
        }

        @Override
        public void setSelected(AnActionEvent e, boolean state) {
            showRequiring = state;
            if (!showRequired && !showRequiring) {
                showRequiredAction.setSelected(e, true);
            } else {
                redrawCurrent();
            }
        }
    };
    showRequiredAction = new CheckboxAction(getDependencyTitle()) {

        @Override
        public boolean isSelected(AnActionEvent e) {
            return showRequired;
        }

        @Override
        public void setSelected(AnActionEvent e, boolean state) {
            showRequired = state;
            if (!showRequired && !showRequiring) {
                showRequiringAction.setSelected(e, true);
            } else {
                redrawCurrent();
            }
        }
    };
    actions.add(showRequiredAction);
    actions.add(showRequiringAction);
    actions.add(new CheckboxAction("All edges") {

        @Override
        public boolean isSelected(AnActionEvent e) {
            return allEdges;
        }

        @Override
        public void setSelected(AnActionEvent e, boolean state) {
            allEdges = state;
            redrawCurrent();
        }
    });
    layoutAction = new GraphLayoutComboAction("Layout:") {

        @Override
        protected void changeLayout(boolean update) {
            DependenciesView.this.changeLayout(update);
        }
    };
    actions.add(layoutAction);
    if (showPathToElement()) {
        actions.add(new CheckboxAction("Path to element") {

            @Override
            public boolean isSelected(AnActionEvent e) {
                return showDeclPath;
            }

            @Override
            public void setSelected(AnActionEvent e, boolean state) {
                showDeclPath = state;
                if (!showDeclPath) {
                    latestTargetElementInPath = null;
                    recolorGraph(false);
                } else {
                    findAndColorPath();
                }
            }
        });
    }
    actions.add(new AnAction(LSFIcons.DEPENDENCY_ZOOM_OUT) {

        @Override
        public void actionPerformed(AnActionEvent e) {
            zoom(1);
        }
    });
    actions.add(new AnAction(LSFIcons.DEPENDENCY_ACTUAL_ZOOM) {

        @Override
        public void actionPerformed(AnActionEvent e) {
            zoom(0);
        }
    });
    actions.add(new AnAction(LSFIcons.DEPENDENCY_ZOOM_IN) {

        @Override
        public void actionPerformed(AnActionEvent e) {
            zoom(-1);
        }
    });
    actions.add(new AnAction(LSFIcons.GRAPH_EXPORT) {

        @Override
        public void actionPerformed(AnActionEvent e) {
            if (jgraph != null) {
                new SVGExporter().exportSVG(jgraph);
            }
        }
    });
    return ActionManager.getInstance().createActionToolbar(ActionPlaces.UNKNOWN, actions, true);
}
Also used : SimpleActionGroup(com.intellij.tools.SimpleActionGroup) GraphLayoutComboAction(com.lsfusion.dependencies.GraphLayoutComboAction) CheckboxAction(com.intellij.openapi.actionSystem.ex.CheckboxAction)

Aggregations

CheckboxAction (com.intellij.openapi.actionSystem.ex.CheckboxAction)1 SimpleActionGroup (com.intellij.tools.SimpleActionGroup)1 GraphLayoutComboAction (com.lsfusion.dependencies.GraphLayoutComboAction)1