use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class PyUnwrapperTest method doNegativeTest.
private void doNegativeTest(final String optionName) {
String before = "refactoring/unwrap/" + getTestName(true) + "_before.py";
myFixture.configureByFile(before);
UnwrapHandler h = new UnwrapHandler() {
@Override
protected void selectOption(List<AnAction> options, Editor editor, PsiFile file) {
for (AnAction option : options) {
assertFalse("\"" + optionName + "\" is available to unwrap ", option.toString().contains(optionName));
}
}
};
h.invoke(myFixture.getProject(), myFixture.getEditor(), myFixture.getFile());
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class XmlHighlightingTest method testResolvedDtdElementReferences.
public void testResolvedDtdElementReferences() throws Exception {
configureByFile(BASE_PATH + getTestName(false) + ".dtd");
doDoTest(true, false);
final String text = myEditor.getDocument().getText();
WriteCommandAction.runWriteCommandAction(null, () -> myEditor.getSelectionModel().setSelection(0, myEditor.getDocument().getTextLength()));
AnAction action = ActionManager.getInstance().getAction(IdeActions.ACTION_COMMENT_BLOCK);
action.actionPerformed(AnActionEvent.createFromAnAction(action, null, "", DataManager.getInstance().getDataContext()));
assertNotSame(text, myEditor.getDocument().getText());
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
Collection<HighlightInfo> infos = doHighlighting();
assertEquals(0, infos.size());
action.actionPerformed(AnActionEvent.createFromAnAction(action, null, "", DataManager.getInstance().getDataContext()));
assertEquals(text, myEditor.getDocument().getText().trim());
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
infos = doHighlighting();
assertEquals(0, infos.size());
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class GroovyShellRunnerImpl method fillToolBarActions.
@Override
protected List<AnAction> fillToolBarActions(DefaultActionGroup toolbarActions, final Executor defaultExecutor, final RunContentDescriptor contentDescriptor) {
BuildAndRestartConsoleAction rebuildAction = new BuildAndRestartConsoleAction(myModule, getProject(), defaultExecutor, contentDescriptor, myStarter);
toolbarActions.add(rebuildAction);
List<AnAction> actions = super.fillToolBarActions(toolbarActions, defaultExecutor, contentDescriptor);
actions.add(rebuildAction);
return actions;
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class HgBranchPopup method getInstance.
/**
* @param currentRepository Current repository, which means the repository of the currently open or selected file.
*/
public static HgBranchPopup getInstance(@NotNull Project project, @NotNull HgRepository currentRepository) {
HgRepositoryManager manager = HgUtil.getRepositoryManager(project);
HgProjectSettings hgProjectSettings = ServiceManager.getService(project, HgProjectSettings.class);
HgMultiRootBranchConfig hgMultiRootBranchConfig = new HgMultiRootBranchConfig(manager.getRepositories());
Condition<AnAction> preselectActionCondition = new Condition<AnAction>() {
@Override
public boolean value(AnAction action) {
return false;
}
};
return new HgBranchPopup(currentRepository, manager, hgMultiRootBranchConfig, hgProjectSettings, preselectActionCondition);
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class JBTabbedTerminalWidget method convertActions.
public static void convertActions(@NotNull JComponent component, @NotNull List<TerminalAction> actions, @Nullable final Predicate<KeyEvent> elseAction) {
for (final TerminalAction action : actions) {
if (action.isHidden()) {
continue;
}
AnAction a = new DumbAwareAction() {
@Override
public void actionPerformed(AnActionEvent e) {
KeyEvent event = e.getInputEvent() instanceof KeyEvent ? (KeyEvent) e.getInputEvent() : null;
if (!action.perform(event)) {
if (elseAction != null) {
elseAction.apply(event);
}
}
}
};
a.registerCustomShortcutSet(action.getKeyCode(), action.getModifiers(), component);
}
}
Aggregations