use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.
the class ConfigureBranchesAction method update.
public void update(final AnActionEvent e) {
final Project project = e.getProject();
final Presentation presentation = e.getPresentation();
if (project == null) {
presentation.setEnabled(false);
presentation.setVisible(false);
return;
}
presentation.setText(SvnBundle.message("configure.branches.item"));
presentation.setDescription(SvnBundle.message("configure.branches.item"));
presentation.setIcon(SvnIcons.ConfigureBranches);
presentation.setVisible(true);
final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
presentation.setEnabled((cls != null) && (cls.length > 0) && (SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) && (((SvnChangeList) cls[0]).getRoot() != null));
}
use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.
the class ConfigureBranchesAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getProject();
final ChangeList[] cls = e.getData(VcsDataKeys.CHANGE_LISTS);
if ((cls == null) || (cls.length == 0) || (!SvnVcs.getInstance(project).getName().equals(((CommittedChangeList) cls[0]).getVcs().getName())) || (((SvnChangeList) cls[0]).getRoot() == null)) {
return;
}
final SvnChangeList svnList = (SvnChangeList) cls[0];
BranchConfigurationDialog.configureBranches(project, svnList.getRoot());
}
use of com.intellij.openapi.vcs.changes.ChangeList 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));
}
use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.
the class RemoveChangeListAction method actionPerformed.
public void actionPerformed(@NotNull AnActionEvent e) {
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
final ChangeList[] selectedLists = e.getRequiredData(VcsDataKeys.CHANGE_LISTS);
//noinspection unchecked
ChangeListRemoveConfirmation.processLists(project, true, (Collection) Arrays.asList(selectedLists), new ChangeListRemoveConfirmation() {
@Override
public boolean askIfShouldRemoveChangeLists(@NotNull List<? extends LocalChangeList> lists) {
return RemoveChangeListAction.askIfShouldRemoveChangeLists(lists, project);
}
});
}
use of com.intellij.openapi.vcs.changes.ChangeList in project intellij-community by JetBrains.
the class RevertCommittedStuffAbstractAction method actionPerformed.
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getRequiredData(CommonDataKeys.PROJECT);
final VirtualFile baseDir = project.getBaseDir();
assert baseDir != null;
final Change[] changes = myForPerformConvertor.convert(e);
if (changes == null || changes.length == 0)
return;
final List<Change> changesList = new ArrayList<>();
Collections.addAll(changesList, changes);
FileDocumentManager.getInstance().saveAllDocuments();
String defaultName = null;
final ChangeList[] changeLists = e.getData(VcsDataKeys.CHANGE_LISTS);
if (changeLists != null && changeLists.length > 0) {
defaultName = VcsBundle.message("revert.changes.default.name", changeLists[0].getName());
}
final ChangeListChooser chooser = new ChangeListChooser(project, ChangeListManager.getInstance(project).getChangeListsCopy(), null, "Select Target Changelist", defaultName);
if (!chooser.showAndGet()) {
return;
}
final List<FilePatch> patches = new ArrayList<>();
ProgressManager.getInstance().run(new Task.Backgroundable(project, VcsBundle.message("revert.changes.title"), true) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
try {
final List<Change> preprocessed = ChangesPreprocess.preprocessChangesRemoveDeletedForDuplicateMoved(changesList);
patches.addAll(IdeaTextPatchBuilder.buildPatch(project, preprocessed, baseDir.getPresentableUrl(), true));
} catch (final VcsException ex) {
WaitForProgressToShow.runOrInvokeLaterAboveProgress(new Runnable() {
@Override
public void run() {
Messages.showErrorDialog(project, "Failed to revert changes: " + ex.getMessage(), VcsBundle.message("revert.changes.title"));
}
}, null, myProject);
indicator.cancel();
}
}
@Override
public void onSuccess() {
new PatchApplier<BinaryFilePatch>(project, baseDir, patches, chooser.getSelectedList(), null, null).execute();
}
});
}
Aggregations