use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class XsltConfigImpl method initComponent.
@Override
@SuppressWarnings({ "StringEquality" })
public void initComponent() {
final Language xmlLang = StdFileTypes.XML.getLanguage();
// intentionManager.addAction(new DeleteUnusedParameterFix());
// intentionManager.addAction(new DeleteUnusedVariableFix());
final XsltFormattingModelBuilder builder = new XsltFormattingModelBuilder(LanguageFormatting.INSTANCE.forLanguage(xmlLang));
LanguageFormatting.INSTANCE.addExplicitExtension(xmlLang, builder);
try {
// TODO: put this into com.intellij.refactoring.actions.IntroduceParameterAction, just like IntroduceVariableAction
final AnAction introduceParameter = ActionManager.getInstance().getAction("IntroduceParameter");
if (introduceParameter != null) {
introduceParameter.setInjectedContext(true);
}
} catch (Exception e) {
Logger.getInstance(XsltConfigImpl.class.getName()).error(e);
}
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class AssignShortcutAction method getGoalActionId.
@Nullable
private static String getGoalActionId(DataContext context) {
final List<String> goals = MavenDataKeys.MAVEN_GOALS.getData(context);
if (goals == null || goals.size() != 1) {
return null;
}
MavenProject project = MavenActionUtil.getMavenProject(context);
if (project == null)
return null;
String goal = goals.get(0);
final MavenShortcutsManager shortcutsManager = getShortcutsManager(context);
String actionId = shortcutsManager != null ? shortcutsManager.getActionId(project.getPath(), goal) : null;
if (actionId != null) {
AnAction action = ActionManager.getInstance().getAction(actionId);
if (action == null) {
MavenKeymapExtension.getOrRegisterAction(project, actionId, goal);
}
}
return actionId;
}
use of com.intellij.openapi.actionSystem.AnAction in project intellij-community by JetBrains.
the class BoundIconRenderer method getClickAction.
@Override
@Nullable
public AnAction getClickAction() {
return new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
List<PsiFile> formFiles = getBoundFormFiles();
if (formFiles.size() > 0) {
final VirtualFile virtualFile = formFiles.get(0).getVirtualFile();
if (virtualFile == null) {
return;
}
Project project = myElement.getProject();
FileEditor[] editors = FileEditorManager.getInstance(project).openFile(virtualFile, true);
if (myElement instanceof PsiField) {
for (FileEditor editor : editors) {
if (editor instanceof UIFormEditor) {
((UIFormEditor) editor).selectComponent(((PsiField) myElement).getName());
}
}
}
}
}
};
}
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;
}
Aggregations