use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class SvnTestCase method imitUpdate.
protected static void imitUpdate(final Project project) {
ProjectLevelVcsManagerEx.getInstanceEx(project).getOptions(VcsConfiguration.StandardOption.UPDATE).setValue(false);
final CommonUpdateProjectAction action = new CommonUpdateProjectAction();
action.getTemplatePresentation().setText("1");
action.actionPerformed(new AnActionEvent(null, dataId -> {
if (CommonDataKeys.PROJECT.is(dataId)) {
return project;
}
return null;
}, "test", new Presentation(), ActionManager.getInstance(), 0));
final ChangeListManager clManager = ChangeListManager.getInstance(project);
clManager.ensureUpToDate(false);
// wait for after-events like annotations recalculation
clManager.ensureUpToDate(false);
// zipper updater
sleep(100);
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class SvnAnnotationIsClosedTest method testClosedChangedByUpdateInIdea.
@Test
public void testClosedChangedByUpdateInIdea() throws Exception {
final SubTree tree = new SubTree(myWorkingCopyDir);
//#1
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3\n4\n");
//#2
checkin();
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1\n2\n3**\n4\n");
//#3
checkin();
// take #2
runInAndVerifyIgnoreOutput("up", "-r", "2");
final VcsAnnotationLocalChangesListener listener = ProjectLevelVcsManager.getInstance(myProject).getAnnotationLocalChangesListener();
final FileAnnotation annotation = createTestAnnotation(myVcs.getAnnotationProvider(), tree.myS1File);
annotation.setCloser(() -> {
myIsClosed = true;
listener.unregisterAnnotation(tree.myS1File, annotation);
});
listener.registerAnnotation(tree.myS1File, annotation);
VcsTestUtil.editFileInCommand(myProject, tree.myS1File, "1+\n2\n3\n4\n");
myDirtyScopeManager.markEverythingDirty();
myChangeListManager.ensureUpToDate(false);
Assert.assertFalse(myIsClosed);
ProjectLevelVcsManagerEx.getInstanceEx(myProject).getOptions(VcsConfiguration.StandardOption.UPDATE).setValue(false);
final CommonUpdateProjectAction action = new CommonUpdateProjectAction();
action.getTemplatePresentation().setText("1");
action.actionPerformed(new AnActionEvent(null, dataId -> {
if (CommonDataKeys.PROJECT.is(dataId)) {
return myProject;
}
return null;
}, "test", new Presentation(), ActionManager.getInstance(), 0));
myChangeListManager.ensureUpToDate(false);
// wait for after-events like annotations recalculation
myChangeListManager.ensureUpToDate(false);
// zipper updater
sleep(100);
Assert.assertTrue(myIsClosed);
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class PythonPathEditor method addToolbarButtons.
@Override
protected void addToolbarButtons(ToolbarDecorator toolbarDecorator) {
AnActionButton reloadButton = new AnActionButton(PyBundle.message("sdk.paths.dialog.reload.paths"), AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(AnActionEvent e) {
onReloadButtonClicked();
}
};
toolbarDecorator.addExtraAction(reloadButton);
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class GroovyCreateClassDialog method createCenterPanel.
@Override
@Nullable
protected JComponent createCenterPanel() {
myPackageTextField.getDocument().addDocumentListener(new DocumentAdapter() {
@Override
public void documentChanged(DocumentEvent e) {
PsiNameHelper nameHelper = PsiNameHelper.getInstance(myProject);
String packageName = getPackageName();
getOKAction().setEnabled(nameHelper.isQualifiedName(packageName) || packageName != null && packageName.isEmpty());
}
});
new AnAction() {
@Override
public void actionPerformed(AnActionEvent e) {
myPackageChooseButton.doClick();
}
}.registerCustomShortcutSet(new CustomShortcutSet(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, InputEvent.SHIFT_DOWN_MASK)), myPackageTextField);
return myContentPane;
}
use of com.intellij.openapi.actionSystem.AnActionEvent in project intellij-community by JetBrains.
the class HgCachingCommittedChangesProvider method createActions.
public VcsCommittedViewAuxiliary createActions(DecoratorManager decoratorManager, RepositoryLocation repositoryLocation) {
AnAction copyHashAction = new AnAction("Copy &Hash", "Copy hash to clipboard", PlatformIcons.COPY_ICON) {
@Override
public void actionPerformed(AnActionEvent e) {
ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS);
if (changeLists != null && changeLists[0] instanceof HgCommittedChangeList) {
HgRevisionNumber revisionNumber = ((HgCommittedChangeList) changeLists[0]).getRevisionNumber();
CopyPasteManager.getInstance().setContents(new StringSelection(revisionNumber.getChangeset()));
}
}
};
return new VcsCommittedViewAuxiliary(Collections.singletonList(copyHashAction), new Runnable() {
public void run() {
}
}, Collections.singletonList(copyHashAction));
}
Aggregations