use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class ImportTree method createExcludeAction.
public AnAction createExcludeAction() {
return new AnAction(CvsBundle.message("import.wizard.exclude.from.import.action.name"), null, PlatformIcons.DELETE_ICON) {
public void update(AnActionEvent e) {
final VirtualFile[] selectedFiles = myFileSystemTree.getSelectedFiles();
final Presentation presentation = e.getPresentation();
presentation.setEnabled(isAtLeastOneFileIncluded(selectedFiles));
}
public void actionPerformed(AnActionEvent e) {
final VirtualFile[] selectedFiles = myFileSystemTree.getSelectedFiles();
for (VirtualFile selectedFile : selectedFiles) {
exclude(selectedFile);
}
myWizard.updateStep();
myFileSystemTree.getTree().repaint();
}
};
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class IdeMessagePanel method showErrorNotification.
private void showErrorNotification(@Nullable String notificationText, @NotNull Project project) {
Notification notification = new Notification("", AllIcons.Ide.FatalError, notificationText == null ? ERROR_TITLE : "", null, notificationText == null ? "" : notificationText, NotificationType.ERROR, null);
if (notificationText == null) {
notification.addAction(new NotificationAction(ERROR_LINK) {
@Override
public void actionPerformed(@NotNull AnActionEvent e, @NotNull Notification notification) {
notification.expire();
_openFatals(null);
}
});
}
BalloonLayout layout = myFrame.getBalloonLayout();
assert layout != null;
BalloonLayoutData layoutData = BalloonLayoutData.createEmpty();
layoutData.fadeoutTime = 5000;
layoutData.fillColor = new JBColor(0XF5E6E7, 0X593D41);
layoutData.borderColor = new JBColor(0XE0A8A9, 0X73454B);
assert myBalloon == null;
myBalloon = NotificationsManagerImpl.createBalloon(myFrame, notification, false, false, new Ref<>(layoutData), project);
Disposer.register(myBalloon, () -> myBalloon = null);
layout.add(myBalloon);
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class TabbedPaneImpl method installKeyboardNavigation.
@SuppressWarnings({ "NonStaticInitializer" })
private void installKeyboardNavigation(final PrevNextActionsDescriptor installKeyboardNavigation) {
myNextTabAction = new AnAction() {
{
setEnabledInModalContext(true);
}
@Override
public void actionPerformed(final AnActionEvent e) {
int index = getSelectedIndex() + 1;
if (index >= getTabCount()) {
index = 0;
}
setSelectedIndex(index);
}
};
final AnAction nextAction = ActionManager.getInstance().getAction(installKeyboardNavigation.getNextActionId());
LOG.assertTrue(nextAction != null, "Cannot find action with specified id: " + installKeyboardNavigation.getNextActionId());
myNextTabAction.registerCustomShortcutSet(nextAction.getShortcutSet(), this);
myPreviousTabAction = new AnAction() {
{
setEnabledInModalContext(true);
}
@Override
public void actionPerformed(final AnActionEvent e) {
int index = getSelectedIndex() - 1;
if (index < 0) {
index = getTabCount() - 1;
}
setSelectedIndex(index);
}
};
final AnAction prevAction = ActionManager.getInstance().getAction(installKeyboardNavigation.getPrevActionId());
LOG.assertTrue(prevAction != null, "Cannot find action with specified id: " + installKeyboardNavigation.getPrevActionId());
myPreviousTabAction.registerCustomShortcutSet(prevAction.getShortcutSet(), this);
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class AbstractLanguageInjectionSupport method createDefaultEditAction.
public static AnAction createDefaultEditAction(final Project project, final Factory<BaseInjection> producer) {
return new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
final BaseInjection originalInjection = producer.create();
final BaseInjection newInjection = showDefaultInjectionUI(project, originalInjection.copy());
if (newInjection != null) {
originalInjection.copyFrom(newInjection);
}
}
};
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class JavaLanguageInjectionSupport method createEditAction.
@Override
public AnAction createEditAction(final Project project, final Factory<BaseInjection> producer) {
return new AnAction() {
@Override
public void actionPerformed(final AnActionEvent e) {
final BaseInjection originalInjection = producer.create();
final MethodParameterInjection injection = createFrom(project, originalInjection, null, false);
if (injection != null) {
final boolean mergeEnabled = !project.isInitialized() || JavaPsiFacade.getInstance(project).findClass(injection.getClassName(), GlobalSearchScope.allScope(project)) == null;
final BaseInjection newInjection = showInjectionUI(project, injection);
if (newInjection != null) {
newInjection.mergeOriginalPlacesFrom(originalInjection, mergeEnabled);
originalInjection.copyFrom(newInjection);
}
} else {
createDefaultEditAction(project, producer).actionPerformed(null);
}
}
};
}
Aggregations