use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class LevelChooserAction method createPopupActionGroup.
@NotNull
@Override
public DefaultActionGroup createPopupActionGroup(final JComponent anchor) {
final DefaultActionGroup group = new DefaultActionGroup();
for (final HighlightSeverity severity : getSeverities(mySeverityRegistrar, myIncludeDoNotShow)) {
final HighlightSeverityAction action = new HighlightSeverityAction(severity);
if (myChosen == null) {
setChosen(action.getSeverity());
}
group.add(action);
}
group.addSeparator();
group.add(new DumbAwareAction("Edit severities...") {
@Override
public void actionPerformed(@NotNull final AnActionEvent e) {
final SeverityEditorDialog dlg = new SeverityEditorDialog(anchor, myChosen, mySeverityRegistrar, true);
if (dlg.showAndGet()) {
final HighlightInfoType type = dlg.getSelectedType();
if (type != null) {
final HighlightSeverity severity = type.getSeverity(null);
setChosen(severity);
onChosen(severity);
}
}
}
});
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class ScopesChooser method createPopupActionGroup.
@NotNull
@Override
public DefaultActionGroup createPopupActionGroup(final JComponent component) {
final DefaultActionGroup group = new DefaultActionGroup();
final List<NamedScope> predefinedScopes = new ArrayList<>();
final List<NamedScope> customScopes = new ArrayList<>();
for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
Collections.addAll(customScopes, holder.getEditableScopes());
predefinedScopes.addAll(holder.getPredefinedScopes());
}
predefinedScopes.remove(CustomScopesProviderEx.getAllScope());
for (NamedScope predefinedScope : predefinedScopes) {
if (predefinedScope instanceof NonProjectFilesScope) {
predefinedScopes.remove(predefinedScope);
break;
}
}
fillActionGroup(group, predefinedScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames);
group.addSeparator();
fillActionGroup(group, customScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames);
group.addSeparator();
group.add(new DumbAwareAction("Edit Scopes Order...") {
@Override
public void actionPerformed(final AnActionEvent e) {
final ScopesOrderDialog dlg = new ScopesOrderDialog(component, myInspectionProfile, myProject);
if (dlg.showAndGet()) {
onScopesOrderChanged();
}
}
});
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class AbstractNewProjectDialog method createCenterPanel.
@Nullable
@Override
protected JComponent createCenterPanel() {
DirectoryProjectGenerator[] generators = Extensions.getExtensions(DirectoryProjectGenerator.EP_NAME);
setTitle(generators.length == 0 ? "Create Project" : "New Project");
DefaultActionGroup root = createRootStep();
Disposer.register(getDisposable(), () -> root.removeAll());
Pair<JPanel, JBList> pair = FlatWelcomeFrame.createActionGroupPanel(root, getRootPane(), null, getDisposable());
JPanel component = pair.first;
new AnAction() {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
close(CANCEL_EXIT_CODE);
}
}.registerCustomShortcutSet(KeyEvent.VK_ESCAPE, 0, component);
myPair = pair;
UiNotifyConnector.doWhenFirstShown(myPair.second, () -> ScrollingUtil.ensureSelectionExists(myPair.second));
FlatWelcomeFrame.installQuickSearch(pair.second);
return component;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class ChooseFileEncodingAction method createCharsetsActionGroup.
@NotNull
protected DefaultActionGroup createCharsetsActionGroup(@Nullable String clearItemText, @Nullable Charset alreadySelected, @NotNull Function<Charset, String> charsetFilter) {
DefaultActionGroup group = new DefaultActionGroup();
List<Charset> favorites = new ArrayList<>(EncodingManager.getInstance().getFavorites());
Collections.sort(favorites);
Charset current = myVirtualFile == null ? null : myVirtualFile.getCharset();
favorites.remove(current);
favorites.remove(alreadySelected);
if (clearItemText != null) {
String description = "Clear " + (myVirtualFile == null ? "default" : "file '" + myVirtualFile.getName() + "'") + " encoding.";
group.add(new DumbAwareAction(clearItemText, description, null) {
@Override
public void actionPerformed(AnActionEvent e) {
chosen(myVirtualFile, NO_ENCODING);
}
});
}
if (favorites.isEmpty() && clearItemText == null) {
fillCharsetActions(group, myVirtualFile, Arrays.asList(CharsetToolkit.getAvailableCharsets()), charsetFilter);
} else {
fillCharsetActions(group, myVirtualFile, favorites, charsetFilter);
DefaultActionGroup more = new DefaultActionGroup("more", true);
group.add(more);
fillCharsetActions(more, myVirtualFile, Arrays.asList(CharsetToolkit.getAvailableCharsets()), charsetFilter);
}
return group;
}
use of com.intellij.openapi.actionSystem.DefaultActionGroup in project intellij-community by JetBrains.
the class SwingHelper method createWebHyperlink.
@NotNull
public static HyperlinkLabel createWebHyperlink(@NotNull String text, @NotNull String url) {
HyperlinkLabel hyperlink = new HyperlinkLabel(text);
hyperlink.setHyperlinkTarget(url);
DefaultActionGroup actionGroup = new DefaultActionGroup();
actionGroup.add(new OpenLinkInBrowser(url));
actionGroup.add(new CopyLinkAction(url));
hyperlink.setComponentPopupMenu(ActionManager.getInstance().createActionPopupMenu("web hyperlink", actionGroup).getComponent());
return hyperlink;
}
Aggregations