use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class MavenAction method update.
@Override
public void update(AnActionEvent e) {
super.update(e);
Presentation p = e.getPresentation();
p.setEnabled(isAvailable(e));
p.setVisible(isVisible(e));
}
use of com.intellij.openapi.actionSystem.Presentation 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.Presentation 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.Presentation in project intellij-community by JetBrains.
the class RestPythonUtil method updateSphinxQuickStartRequiredAction.
public static Presentation updateSphinxQuickStartRequiredAction(final AnActionEvent e) {
final Presentation presentation = e.getPresentation();
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project != null) {
Module module = e.getData(LangDataKeys.MODULE);
if (module == null) {
Module[] modules = ModuleManager.getInstance(project).getModules();
module = modules.length == 0 ? null : modules[0];
}
if (module != null) {
final Sdk sdk = PythonSdkType.findPythonSdk(module);
if (sdk != null) {
final List<PyPackage> packages = PyPackageManager.getInstance(sdk).getPackages();
final PyPackage sphinx = packages != null ? PyPackageUtil.findPackage(packages, "Sphinx") : null;
presentation.setEnabled(sphinx != null);
}
}
}
return presentation;
}
use of com.intellij.openapi.actionSystem.Presentation in project intellij-community by JetBrains.
the class ShowHideMergePanelAction method update.
@Override
public void update(final AnActionEvent e) {
super.update(e);
final Presentation presentation = e.getPresentation();
presentation.setIcon(SvnIcons.ShowIntegratedFrom);
presentation.setText(SvnBundle.message("committed.changes.action.enable.merge.highlighting"));
presentation.setDescription(SvnBundle.message("committed.changes.action.enable.merge.highlighting.description.text"));
}
Aggregations