use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class QuickChangeCodeStyleSchemeAction method fillActions.
@Override
protected void fillActions(Project project, @NotNull DefaultActionGroup group, @NotNull DataContext dataContext) {
final CodeStyleSettingsManager manager = CodeStyleSettingsManager.getInstance(project);
if (manager.PER_PROJECT_SETTINGS != null) {
//noinspection HardCodedStringLiteral
group.add(new AnAction("<project>", "", manager.USE_PER_PROJECT_SETTINGS ? ourCurrentAction : ourNotCurrentAction) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
manager.USE_PER_PROJECT_SETTINGS = true;
}
});
}
CodeStyleScheme currentScheme = CodeStyleSchemes.getInstance().getCurrentScheme();
for (CodeStyleScheme scheme : CodeStyleSchemesImpl.getSchemeManager().getAllSchemes()) {
addScheme(group, manager, currentScheme, scheme, false);
}
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class ScopesChooser method fillActionGroup.
private void fillActionGroup(final DefaultActionGroup group, final List<NamedScope> scopes, final List<Descriptor> defaultDescriptors, final InspectionProfileImpl inspectionProfile, final Set<String> excludedScopeNames) {
for (final NamedScope scope : scopes) {
final String scopeName = scope.getName();
if (excludedScopeNames.contains(scopeName)) {
continue;
}
group.add(new DumbAwareAction(scopeName) {
@Override
public void actionPerformed(final AnActionEvent e) {
for (final Descriptor defaultDescriptor : defaultDescriptors) {
inspectionProfile.addScope(defaultDescriptor.getToolWrapper().createCopy(), scope, defaultDescriptor.getLevel(), true, getEventProject(e));
}
onScopeAdded();
}
});
}
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class AutoPopupController method setupListeners.
private void setupListeners() {
ActionManagerEx.getInstanceEx().addAnActionListener(new AnActionListener() {
@Override
public void beforeActionPerformed(AnAction action, DataContext dataContext, AnActionEvent event) {
cancelAllRequest();
}
@Override
public void beforeEditorTyping(char c, DataContext dataContext) {
cancelAllRequest();
}
@Override
public void afterActionPerformed(final AnAction action, final DataContext dataContext, AnActionEvent event) {
}
}, this);
IdeEventQueue.getInstance().addActivityListener(() -> cancelAllRequest(), this);
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class FindUIHelper method registerAction.
private void registerAction(String actionName, boolean replace, FindDialog findDialog) {
AnAction action = ActionManager.getInstance().getAction(actionName);
JRootPane findDialogRootComponent = ((JDialog) (findDialog.getWindow())).getRootPane();
new AnAction() {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
myModel.setReplaceState(replace);
findDialog.updateReplaceVisibility();
}
}.registerCustomShortcutSet(action.getShortcutSet(), findDialogRootComponent);
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class ProjectSdksModel method createAddActions.
public void createAddActions(@NotNull DefaultActionGroup group, @NotNull final JComponent parent, @Nullable final Sdk selectedSdk, @NotNull final Consumer<Sdk> updateTree, @Nullable Condition<SdkTypeId> filter) {
final SdkType[] types = SdkType.getAllTypes();
for (final SdkType type : types) {
if (filter != null && !filter.value(type))
continue;
final AnAction addAction = new DumbAwareAction(type.getPresentableName(), null, type.getIconForAddAction()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
doAdd(parent, selectedSdk, type, updateTree);
}
};
group.add(addAction);
}
}
Aggregations