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;
}
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;
}
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);
}
Aggregations