Search in sources :

Example 1 with CheckboxAction

use of com.intellij.openapi.actionSystem.ex.CheckboxAction in project midpoint-studio by Evolveum.

the class BrowseToolPanel method createResultsActionGroup.

private DefaultActionGroup createResultsActionGroup() {
    DefaultActionGroup group = new DefaultActionGroup();
    AnAction expandAll = MidPointUtils.createAnAction("Expand All", AllIcons.Actions.Expandall, e -> results.expandAll());
    group.add(expandAll);
    AnAction collapseAll = MidPointUtils.createAnAction("Collapse All", AllIcons.Actions.Collapseall, e -> results.collapseAll());
    group.add(collapseAll);
    group.add(new Separator());
    downloadAction = createAnAction("Download", AllIcons.Actions.Download, e -> downloadPerformed(e, false, rawDownload), e -> e.getPresentation().setEnabled(isDownloadShowEnabled()));
    group.add(downloadAction);
    showAction = createAnAction("Show", AllIcons.Actions.Show, e -> downloadPerformed(e, true, rawDownload), e -> e.getPresentation().setEnabled(isDownloadShowEnabled()));
    group.add(showAction);
    deleteAction = createAnAction("Delete", AllIcons.Vcs.Remove, e -> deletePerformed(e, rawDownload), e -> e.getPresentation().setEnabled(isDownloadShowEnabled()));
    group.add(deleteAction);
    CheckboxAction rawSearch = new CheckboxAction("Raw") {

        @Override
        public void update(AnActionEvent e) {
            e.getPresentation().setEnabled(isDownloadShowEnabled());
            super.update(e);
        }

        @Override
        public boolean isSelected(@NotNull AnActionEvent e) {
            return BrowseToolPanel.this.rawDownload;
        }

        @Override
        public void setSelected(@NotNull AnActionEvent e, boolean state) {
            BrowseToolPanel.this.rawDownload = state;
        }
    };
    group.add(rawSearch);
    group.add(new Separator());
    processAction = createAnAction("Process", AllIcons.Actions.RealIntentionBulb, e -> processPerformed(e));
    group.add(processAction);
    group.add(new Separator());
    pagingText = new TextAction() {

        @NotNull
        @Override
        public JComponent createCustomComponent(@NotNull Presentation presentation, @NotNull String place) {
            JComponent comp = super.createCustomComponent(presentation, place);
            comp.setBorder(new CompoundBorder(comp.getBorder(), JBUI.Borders.empty(0, 5)));
            return comp;
        }

        @Override
        protected String createText(AnActionEvent evt) {
            return createPagingText(evt);
        }
    };
    group.add(pagingText);
    return group;
}
Also used : AllIcons(com.intellij.icons.AllIcons) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) com.evolveum.midpoint.prism.query(com.evolveum.midpoint.prism.query) MidPointUtils.createAnAction(com.evolveum.midpoint.studio.util.MidPointUtils.createAnAction) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RunnableUtils(com.evolveum.midpoint.studio.util.RunnableUtils) StringUtils(org.apache.commons.lang3.StringUtils) Environment(com.evolveum.midpoint.studio.impl.Environment) JBTextArea(com.intellij.ui.components.JBTextArea) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) ComboObjectTypes(com.evolveum.midpoint.studio.action.browse.ComboObjectTypes) JBUI(com.intellij.util.ui.JBUI) BackgroundableTask(com.evolveum.midpoint.studio.action.task.BackgroundableTask) CompoundBorder(javax.swing.border.CompoundBorder) Pair(com.evolveum.midpoint.studio.util.Pair) AsyncAction(com.evolveum.midpoint.studio.action.AsyncAction) Logger(com.intellij.openapi.diagnostic.Logger) UIAction(org.jdesktop.swingx.UIAction) Clipboard(java.awt.datatransfer.Clipboard) MidPointLocalizationService(com.evolveum.midpoint.studio.impl.service.MidPointLocalizationService) Collectors(java.util.stream.Collectors) JBScrollPane(com.intellij.ui.components.JBScrollPane) MidPointUtils(com.evolveum.midpoint.studio.util.MidPointUtils) Objects(java.util.Objects) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel) List(java.util.List) ServiceManager(com.intellij.openapi.components.ServiceManager) ApplicationManager(com.intellij.openapi.application.ApplicationManager) QName(javax.xml.namespace.QName) DownloadAction(com.evolveum.midpoint.studio.action.browse.DownloadAction) NotNull(org.jetbrains.annotations.NotNull) ActionUtil(com.intellij.openapi.actionSystem.ex.ActionUtil) CheckboxAction(com.intellij.openapi.actionSystem.ex.CheckboxAction) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService) NodeRenderer(com.intellij.ide.util.treeView.NodeRenderer) ArrayList(java.util.ArrayList) PrismContext(com.evolveum.midpoint.prism.PrismContext) StringSelection(java.awt.datatransfer.StringSelection) ComboQueryType(com.evolveum.midpoint.studio.action.browse.ComboQueryType) Project(com.intellij.openapi.project.Project) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) AbstractRoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType) TreeUtil(com.intellij.util.ui.tree.TreeUtil) PrismParser(com.evolveum.midpoint.prism.PrismParser) PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) IOException(java.io.IOException) ActionEvent(java.awt.event.ActionEvent) JXTreeTable(org.jdesktop.swingx.JXTreeTable) java.awt(java.awt) com.intellij.openapi.actionSystem(com.intellij.openapi.actionSystem) SearchResultList(com.evolveum.midpoint.schema.SearchResultList) com.evolveum.midpoint.studio.impl.browse(com.evolveum.midpoint.studio.impl.browse) EqualFilterImpl(com.evolveum.midpoint.prism.impl.query.EqualFilterImpl) PrismConstants(com.evolveum.midpoint.prism.PrismConstants) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) SubstringFilterImpl(com.evolveum.midpoint.prism.impl.query.SubstringFilterImpl) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) DeleteAction(com.evolveum.midpoint.studio.action.transfer.DeleteAction) MidPointService(com.evolveum.midpoint.studio.impl.MidPointService) MidPointClient(com.evolveum.midpoint.studio.impl.MidPointClient) javax.swing(javax.swing) CheckboxAction(com.intellij.openapi.actionSystem.ex.CheckboxAction) MidPointUtils.createAnAction(com.evolveum.midpoint.studio.util.MidPointUtils.createAnAction) NotNull(org.jetbrains.annotations.NotNull) CompoundBorder(javax.swing.border.CompoundBorder)

Example 2 with CheckboxAction

use of com.intellij.openapi.actionSystem.ex.CheckboxAction in project midpoint-studio by Evolveum.

the class BrowseToolPanel method createQueryActionGroup.

private DefaultActionGroup createQueryActionGroup() {
    DefaultActionGroup group = new DefaultActionGroup();
    objectType = new ComboObjectTypes();
    group.add(objectType);
    queryType = new ComboQueryType() {

        @Override
        public void setSelected(Type selected) {
            super.setSelected(selected);
            if (queryType.getSelected() == null || query == null) {
                return;
            }
            switch(queryType.getSelected()) {
                case QUERY_XML:
                    if (StringUtils.isEmpty(query.getText())) {
                        query.setText(EMPTY_XML_QUERY);
                    }
                    break;
                case NAME:
                case NAME_OR_OID:
                case OID:
                    // todo file type
                    break;
                case AXIOM:
                    if (StringUtils.isEmpty(query.getText())) {
                        query.setText("");
                    }
                    break;
            }
        }
    };
    group.add(queryType);
    CheckboxAction rawSearch = new CheckboxAction("Raw") {

        @Override
        public void update(AnActionEvent e) {
            e.getPresentation().setEnabled(isSearchEnabled());
            super.update(e);
        }

        @Override
        public boolean isSelected(@NotNull AnActionEvent e) {
            return BrowseToolPanel.this.rawSearch;
        }

        @Override
        public void setSelected(@NotNull AnActionEvent e, boolean state) {
            BrowseToolPanel.this.rawSearch = state;
        }
    };
    group.add(rawSearch);
    pagingAction = createAnAction("Paging", "Paging Settings", AllIcons.General.GearPlain, e -> pagingSettingsPerformed(e), e -> e.getPresentation().setEnabled(isSearchEnabled()));
    group.add(pagingAction);
    searchAction = new AsyncAction<>("Search", AllIcons.Actions.Find) {

        @Override
        protected BackgroundableTask createTask(AnActionEvent e, Environment env) {
            return new BackgroundableTask(e.getProject(), "Searching objects", "Searching objects") {

                @Override
                protected void doRun(ProgressIndicator indicator) {
                    searchPerformed(e, indicator);
                }
            };
        }

        @Override
        protected boolean isActionEnabled(AnActionEvent evt) {
            return isSearchEnabled();
        }
    };
    group.add(searchAction);
    cancelAction = createAnAction("Cancel", AllIcons.Actions.Cancel, e -> cancelPerformed(e), e -> e.getPresentation().setEnabled(isCancelEnabled()));
    group.add(cancelAction);
    return group;
}
Also used : AllIcons(com.intellij.icons.AllIcons) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) com.evolveum.midpoint.prism.query(com.evolveum.midpoint.prism.query) MidPointUtils.createAnAction(com.evolveum.midpoint.studio.util.MidPointUtils.createAnAction) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) RunnableUtils(com.evolveum.midpoint.studio.util.RunnableUtils) StringUtils(org.apache.commons.lang3.StringUtils) Environment(com.evolveum.midpoint.studio.impl.Environment) JBTextArea(com.intellij.ui.components.JBTextArea) DefaultMutableTreeTableNode(org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode) ComboObjectTypes(com.evolveum.midpoint.studio.action.browse.ComboObjectTypes) JBUI(com.intellij.util.ui.JBUI) BackgroundableTask(com.evolveum.midpoint.studio.action.task.BackgroundableTask) CompoundBorder(javax.swing.border.CompoundBorder) Pair(com.evolveum.midpoint.studio.util.Pair) AsyncAction(com.evolveum.midpoint.studio.action.AsyncAction) Logger(com.intellij.openapi.diagnostic.Logger) UIAction(org.jdesktop.swingx.UIAction) Clipboard(java.awt.datatransfer.Clipboard) MidPointLocalizationService(com.evolveum.midpoint.studio.impl.service.MidPointLocalizationService) Collectors(java.util.stream.Collectors) JBScrollPane(com.intellij.ui.components.JBScrollPane) MidPointUtils(com.evolveum.midpoint.studio.util.MidPointUtils) Objects(java.util.Objects) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) SimpleToolWindowPanel(com.intellij.openapi.ui.SimpleToolWindowPanel) List(java.util.List) ServiceManager(com.intellij.openapi.components.ServiceManager) ApplicationManager(com.intellij.openapi.application.ApplicationManager) QName(javax.xml.namespace.QName) DownloadAction(com.evolveum.midpoint.studio.action.browse.DownloadAction) NotNull(org.jetbrains.annotations.NotNull) ActionUtil(com.intellij.openapi.actionSystem.ex.ActionUtil) CheckboxAction(com.intellij.openapi.actionSystem.ex.CheckboxAction) EnvironmentService(com.evolveum.midpoint.studio.impl.EnvironmentService) NodeRenderer(com.intellij.ide.util.treeView.NodeRenderer) ArrayList(java.util.ArrayList) PrismContext(com.evolveum.midpoint.prism.PrismContext) StringSelection(java.awt.datatransfer.StringSelection) ComboQueryType(com.evolveum.midpoint.studio.action.browse.ComboQueryType) Project(com.intellij.openapi.project.Project) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) AbstractRoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType) TreeUtil(com.intellij.util.ui.tree.TreeUtil) PrismParser(com.evolveum.midpoint.prism.PrismParser) PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) IOException(java.io.IOException) ActionEvent(java.awt.event.ActionEvent) JXTreeTable(org.jdesktop.swingx.JXTreeTable) java.awt(java.awt) com.intellij.openapi.actionSystem(com.intellij.openapi.actionSystem) SearchResultList(com.evolveum.midpoint.schema.SearchResultList) com.evolveum.midpoint.studio.impl.browse(com.evolveum.midpoint.studio.impl.browse) EqualFilterImpl(com.evolveum.midpoint.prism.impl.query.EqualFilterImpl) PrismConstants(com.evolveum.midpoint.prism.PrismConstants) OnePixelSplitter(com.intellij.ui.OnePixelSplitter) SubstringFilterImpl(com.evolveum.midpoint.prism.impl.query.SubstringFilterImpl) ObjectTypes(com.evolveum.midpoint.schema.constants.ObjectTypes) DeleteAction(com.evolveum.midpoint.studio.action.transfer.DeleteAction) MidPointService(com.evolveum.midpoint.studio.impl.MidPointService) MidPointClient(com.evolveum.midpoint.studio.impl.MidPointClient) javax.swing(javax.swing) CheckboxAction(com.intellij.openapi.actionSystem.ex.CheckboxAction) NotNull(org.jetbrains.annotations.NotNull) ComboObjectTypes(com.evolveum.midpoint.studio.action.browse.ComboObjectTypes) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ComboQueryType(com.evolveum.midpoint.studio.action.browse.ComboQueryType) QueryType(com.evolveum.prism.xml.ns._public.query_3.QueryType) AbstractRoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) ComboQueryType(com.evolveum.midpoint.studio.action.browse.ComboQueryType) BackgroundableTask(com.evolveum.midpoint.studio.action.task.BackgroundableTask) Environment(com.evolveum.midpoint.studio.impl.Environment)

Example 3 with CheckboxAction

use of com.intellij.openapi.actionSystem.ex.CheckboxAction 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)3 PrismConstants (com.evolveum.midpoint.prism.PrismConstants)2 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 PrismParser (com.evolveum.midpoint.prism.PrismParser)2 PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)2 EqualFilterImpl (com.evolveum.midpoint.prism.impl.query.EqualFilterImpl)2 SubstringFilterImpl (com.evolveum.midpoint.prism.impl.query.SubstringFilterImpl)2 com.evolveum.midpoint.prism.query (com.evolveum.midpoint.prism.query)2 SearchResultList (com.evolveum.midpoint.schema.SearchResultList)2 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)2 AsyncAction (com.evolveum.midpoint.studio.action.AsyncAction)2 ComboObjectTypes (com.evolveum.midpoint.studio.action.browse.ComboObjectTypes)2 ComboQueryType (com.evolveum.midpoint.studio.action.browse.ComboQueryType)2 DownloadAction (com.evolveum.midpoint.studio.action.browse.DownloadAction)2 BackgroundableTask (com.evolveum.midpoint.studio.action.task.BackgroundableTask)2 DeleteAction (com.evolveum.midpoint.studio.action.transfer.DeleteAction)2 Environment (com.evolveum.midpoint.studio.impl.Environment)2 EnvironmentService (com.evolveum.midpoint.studio.impl.EnvironmentService)2 MidPointClient (com.evolveum.midpoint.studio.impl.MidPointClient)2 MidPointService (com.evolveum.midpoint.studio.impl.MidPointService)2