import java.util.List;
import java.util.Objects;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.COULD_NOT_COMPARE_WITH_BRANCH;
import static com.intellij.util.ObjectUtils.chooseNotNull;
import static com.intellij.util.containers.UtilKt.getIfSingle;
}
catch (VcsException e) {
VcsNotifier.getInstance(project).notifyImportantWarning(
- "vcs.could.not.compare.with.branch",
+ COULD_NOT_COMPARE_WITH_BRANCH,
DvcsBundle.message("notification.title.couldn.t.compare.with.branch"),
DvcsBundle.message("notification.message.couldn.t.compare.with.branch",
file.isDirectory() ? 1 : 0, file.getPresentableUrl(), compare, e.getMessage()));
import java.util.*;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.CHERRY_PICK_ERROR;
+
public final class VcsCherryPickManager {
private static final Logger LOG = Logger.getInstance(VcsCherryPickManager.class);
@NotNull private final Project myProject;
}
public void showError(@Nls @NotNull String message) {
- VcsNotifier.getInstance(myProject).notifyWeakError("vcs.cherry.pick.error", message);
+ VcsNotifier.getInstance(myProject).notifyWeakError(CHERRY_PICK_ERROR, message);
LOG.warn(message);
}
<projectService serviceImplementation="com.intellij.openapi.vcs.impl.VcsDirectoryMappingStorage" preload="true"/>
<notificationGroup id="Vcs Messages" displayType="TOOL_WINDOW" toolWindowId="Version Control"/>
<notificationGroup id="Common Version Control Messages" displayType="TOOL_WINDOW" toolWindowId="Version Control"/>
- <notificationGroup id="Vcs Important Messages" displayType="STICKY_BALLOON" notificationIds="ignored.to.exclude.synchronization.notification;
- externally.added.files.notification;project.configuration.files.added.notification;manage.ignore.files.notification"/>
+ <notificationGroup id="Vcs Important Messages" displayType="STICKY_BALLOON"/>
<notificationGroup id="Vcs Notifications" displayType="BALLOON"/>
<notificationGroup id="Vcs Silent Notifications" displayType="NONE"/>
<projectService serviceInterface="com.intellij.execution.configurations.RunConfigurationVcsSupport"
import java.util.concurrent.atomic.AtomicBoolean;
import static com.intellij.openapi.progress.ProgressManager.progress;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.*;
import static com.intellij.util.ObjectUtils.chooseNotNull;
/**
try {
labelToRevert.revert(project, project.getBaseDir());
VcsNotifier.getInstance(project)
- .notifyImportantWarning("vcs.patch.apply.aborted",
+ .notifyImportantWarning(PATCH_APPLY_ABORTED,
VcsBundle.message("patch.apply.aborted.title"),
VcsBundle.message("patch.apply.aborted.message"));
}
catch (LocalHistoryException e) {
VcsNotifier.getInstance(project)
- .notifyImportantWarning("vcs.patch.apply.rollback.failed",
+ .notifyImportantWarning(PATCH_APPLY_ROLLBACK_FAILED,
VcsBundle.message("patch.apply.rollback.failed.title"),
VcsBundle.message("patch.apply.rollback.failed.message"));
}
private static void showApplyStatus(@NotNull Project project, final ApplyPatchStatus status) {
VcsNotifier vcsNotifier = VcsNotifier.getInstance(project);
if (status == ApplyPatchStatus.ALREADY_APPLIED) {
- vcsNotifier.notifyMinorInfo("vcs.patch.apply.already.applied", VcsBundle.message("patch.apply.notification.title"), VcsBundle.message("patch.apply.already.applied"));
+ vcsNotifier.notifyMinorInfo(PATCH_ALREADY_APPLIED, VcsBundle.message("patch.apply.notification.title"), VcsBundle.message("patch.apply.already.applied"));
}
else if (status == ApplyPatchStatus.PARTIAL) {
- vcsNotifier.notifyMinorInfo("vcs.patch.apply.partially.applied", VcsBundle.message("patch.apply.notification.title"), VcsBundle.message("patch.apply.partially.applied"));
+ vcsNotifier.notifyMinorInfo(PATCH_PARTIALLY_APPLIED, VcsBundle.message("patch.apply.notification.title"), VcsBundle.message("patch.apply.partially.applied"));
}
else if (status == ApplyPatchStatus.SUCCESS) {
- vcsNotifier.notifySuccess("vcs.patch.apply.success.applied", "",
+ vcsNotifier.notifySuccess(PATCH_APPLY_SUCCESS, "",
VcsBundle.message("patch.apply.success.applied.text"));
}
}
import java.util.*;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.PATCH_APPLY_NEW_FILES_ERROR;
import static com.intellij.util.Functions.identity;
import static com.intellij.vcsUtil.VcsUtil.groupByRoots;
import static java.util.Objects.requireNonNull;
private void notifyAndLogFiles(@NotNull List<FilePath> incorrectFilePath) {
String message = VcsBundle.message("patch.apply.incorrectly.processed.warning", incorrectFilePath.size(), incorrectFilePath);
LOG.warn(message);
- VcsNotifier.getInstance(myProject).notifyImportantWarning("vcs.patch.apply.new.files.error",
+ VcsNotifier.getInstance(myProject).notifyImportantWarning(PATCH_APPLY_NEW_FILES_ERROR,
VcsBundle.message("patch.apply.new.files.warning"),
message);
}
class VcsNotificationIdsHolder : NotificationIdsHolder {
override fun getNotificationIds(): List<String> {
- return listOf(IGNORED_TO_EXCLUDE_SYNCHRONIZATION,
- EXTERNALLY_ADDED_FILES,
- PROJECT_CONFIGURATION_FILES_ADDED,
- MANAGE_IGNORE_FILES)
+ return listOf(
+ EXTERNALLY_ADDED_FILES,
+ PROJECT_CONFIGURATION_FILES_ADDED,
+ MANAGE_IGNORE_FILES,
+ CHERRY_PICK_ERROR,
+ COMMIT_CANCELED,
+ COMMIT_FAILED,
+ COMMIT_FINISHED,
+ COMMIT_FINISHED_WITH_WARNINGS,
+ COMPARE_FAILED,
+ COULD_NOT_COMPARE_WITH_BRANCH,
+ PATCH_APPLY_ABORTED,
+ PATCH_ALREADY_APPLIED,
+ PATCH_APPLY_CANNOT_FIND_PATCH_FILE,
+ PATCH_APPLY_NEW_FILES_ERROR,
+ PATCH_APPLY_NOT_PATCH_FILE,
+ PATCH_PARTIALLY_APPLIED,
+ PATCH_APPLY_ROLLBACK_FAILED,
+ PATCH_APPLY_SUCCESS,
+ PATCH_COPIED_TO_CLIPBOARD,
+ PATCH_CREATION_FAILED,
+ ROOT_ADDED,
+ ROOTS_INVALID,
+ ROOTS_REGISTERED,
+ SHELVE_DELETION_UNDO,
+ SHELVE_FAILED,
+ SHELVE_SUCCESSFUL,
+ UNCOMMITTED_CHANGES_SAVING_ERROR
+ )
}
companion object {
- const val IGNORED_TO_EXCLUDE_SYNCHRONIZATION = "ignored.to.exclude.synchronization.notification"
const val EXTERNALLY_ADDED_FILES = "externally.added.files.notification"
const val PROJECT_CONFIGURATION_FILES_ADDED = "project.configuration.files.added.notification"
const val MANAGE_IGNORE_FILES = "manage.ignore.files.notification"
+ const val CHERRY_PICK_ERROR = "vcs.cherry.pick.error"
+ const val COMMIT_CANCELED = "vcs.commit.canceled"
+ const val COMMIT_FAILED = "vcs.commit.failed"
+ const val COMMIT_FINISHED = "vcs.commit.finished"
+ const val COMMIT_FINISHED_WITH_WARNINGS = "vcs.commit.finished.with.warnings"
+ const val COMPARE_FAILED = "vcs.compare.failed"
+ const val COULD_NOT_COMPARE_WITH_BRANCH = "vcs.could.not.compare.with.branch"
+ const val PATCH_APPLY_ABORTED = "vcs.patch.apply.aborted"
+ const val PATCH_ALREADY_APPLIED = "vcs.patch.already.applied"
+ const val PATCH_APPLY_CANNOT_FIND_PATCH_FILE = "vcs.patch.apply.cannot.find.patch.file"
+ const val PATCH_APPLY_NEW_FILES_ERROR = "vcs.patch.apply.new.files.error"
+ const val PATCH_APPLY_NOT_PATCH_FILE = "vcs.patch.apply.not.patch.type.file"
+ const val PATCH_PARTIALLY_APPLIED = "vcs.patch.partially.applied"
+ const val PATCH_APPLY_ROLLBACK_FAILED = "vcs.patch.apply.rollback.failed"
+ const val PATCH_APPLY_SUCCESS = "vcs.patch.apply.success.applied"
+ const val PATCH_COPIED_TO_CLIPBOARD = "vcs.patch.copied.to.clipboard"
+ const val PATCH_CREATION_FAILED = "vcs.patch.creation.failed"
+ const val ROOT_ADDED = "vcs.root.added"
+ const val ROOTS_INVALID = "vcs.roots.invalid"
+ const val ROOTS_REGISTERED = "vcs.roots.registered"
+ const val SHELVE_DELETION_UNDO = "vcs.shelve.deletion.undo"
+ const val SHELVE_FAILED = "vcs.shelve.failed"
+ const val SHELVE_SUCCESSFUL = "vcs.shelve.successful"
+ const val UNCOMMITTED_CHANGES_SAVING_ERROR = "vcs.uncommitted.changes.saving.error"
}
}
import java.util.Collection;
import static com.intellij.openapi.util.text.StringUtil.join;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.UNCOMMITTED_CHANGES_SAVING_ERROR;
/**
* VCS-independent implementation for {@link VcsPreservingExecutor}
myOperationTitle,
join(e.getMessages()));
VcsNotifier.getInstance(myProject).notifyError(
- "vcs.uncommitted.changes.saving.error",
+ UNCOMMITTED_CHANGES_SAVING_ERROR,
VcsBundle.message("notification.title.couldn.t.save.uncommitted.changes"),
format);
return false;
import java.util.Collection;
import java.util.List;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.PATCH_CREATION_FAILED;
+
public abstract class CreatePatchFromChangesAction extends ExtendableAction implements DumbAware {
private static final Logger LOG = Logger.getInstance(CreatePatchFromChangesAction.class);
private static final ExtensionPointName<AnActionExtensionProvider> EP_NAME_DIALOG =
}
catch (IOException | VcsException exception) {
LOG.warn("Can't create patch", exception);
- VcsNotifier.getInstance(project).notifyWeakError("vcs.patch.creation.failed",
+ VcsNotifier.getInstance(project).notifyWeakError(PATCH_CREATION_FAILED,
VcsBundle.message("patch.creation.failed"),
exception.getMessage());
}
import java.util.HashSet;
import java.util.Set;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.MANAGE_IGNORE_FILES;
import static com.intellij.openapi.vcs.changes.ignore.IgnoreConfigurationProperty.ASKED_MANAGE_IGNORE_FILES_PROPERTY;
import static com.intellij.openapi.vcs.changes.ignore.IgnoreConfigurationProperty.MANAGE_IGNORE_FILES_PROPERTY;
import static java.lang.System.lineSeparator;
myIgnoreFileRootNotificationShowFor = ignoreFileRoot;
myNotification = VcsNotifier.getInstance(project).notifyMinorInfo(
- "vcs.manage.ignored.files",
+ MANAGE_IGNORE_FILES,
true,
"",
VcsBundle.message("ignored.file.manage.message",
import java.util.Collections;
import java.util.List;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.PATCH_APPLY_NOT_PATCH_FILE;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.PATCH_APPLY_CANNOT_FIND_PATCH_FILE;
import static com.intellij.openapi.vcs.changes.patch.PatchFileType.isPatchFile;
public final class ApplyPatchAction extends DumbAwareAction {
VirtualFile vFile = VfsUtil.findFileByIoFile(file, true);
String patchPath = file.getPath();
if (vFile == null) {
- VcsNotifier.getInstance(project).notifyWeakError("vcs.patch.apply.cannot.find.patch.file",
+ VcsNotifier.getInstance(project).notifyWeakError(PATCH_APPLY_CANNOT_FIND_PATCH_FILE,
VcsBundle.message("patch.apply.can.t.find.patch.file.warning", patchPath));
return false;
}
if (!isPatchFile(vFile)) {
- VcsNotifier.getInstance(project).notifyWeakError("vcs.patch.apply.not.patch.type.file",
+ VcsNotifier.getInstance(project).notifyWeakError(PATCH_APPLY_NOT_PATCH_FILE,
VcsBundle.message("patch.apply.not.patch.type.file.error", patchPath));
return false;
}
import java.util.Collections;
import java.util.List;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.PATCH_COPIED_TO_CLIPBOARD;
+
public final class CreatePatchCommitExecutor extends LocalCommitExecutor {
private static final Logger LOG = Logger.getInstance(CreatePatchCommitExecutor.class);
private static final String VCS_PATCH_PATH_KEY = "vcs.patch.path"; //NON-NLS
@NotNull CommitContext commitContext) throws VcsException, IOException {
List<FilePatch> patches = patchBuilder.buildPatches(baseDir, changes, reversePatch, honorExcludedFromCommit);
PatchWriter.writeAsPatchToClipboard(project, patches, baseDir, commitContext);
- VcsNotifier.getInstance(project).notifySuccess("vcs.patch.copied.to.clipboard", "",
+ VcsNotifier.getInstance(project).notifySuccess(PATCH_COPIED_TO_CLIPBOARD, "",
VcsBundle.message("patch.copied.to.clipboard"));
}
import java.util.function.Consumer;
import static com.intellij.openapi.util.text.StringUtil.notNullize;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.SHELVE_FAILED;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.SHELVE_SUCCESSFUL;
import static com.intellij.openapi.vcs.changes.ChangeListUtil.getChangeListNameForUnshelve;
import static com.intellij.openapi.vcs.changes.ChangeListUtil.getPredefinedChangeList;
import static com.intellij.openapi.vcs.changes.shelf.ShelvedChangeList.createShelvedChangesFromFilePatches;
@Override
public void onSuccess() {
- VcsNotifier.getInstance(myProject).notifySuccess("vcs.shelve.successful", "",
+ VcsNotifier.getInstance(myProject).notifySuccess(SHELVE_SUCCESSFUL, "",
VcsBundle.message("shelve.successful.message"));
if (result.size() == 1 && isShelfContentActive()) {
ShelvedChangesViewManager.getInstance(myProject).startEditing(result.get(0));
if (!failedChangeLists.isEmpty()) {
VcsNotifier.getInstance(myProject).notifyError(
- "vcs.shelve.failed",
+ SHELVE_FAILED,
VcsBundle.message("shelve.failed.title"),
VcsBundle.message("shelve.failed.message", failedChangeLists.size(), StringUtil.join(failedChangeLists, ",")));
}
import java.util.stream.Collectors;
import static com.intellij.icons.AllIcons.Vcs.Patch_applied;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.SHELVE_DELETION_UNDO;
import static com.intellij.openapi.vcs.changes.shelf.DiffShelvedChangesActionProvider.createAppliedTextPatch;
import static com.intellij.openapi.vcs.changes.ui.ChangesGroupingSupport.REPOSITORY_GROUPING;
import static com.intellij.openapi.vcs.changes.ui.ChangesViewContentManager.*;
myListDateMap.forEach((l, d) -> manager.restoreList(l, d));
notification.expire();
if (!cantRestoreList.isEmpty()) {
- VcsNotifier.getInstance(myProject).notifyMinorWarning("vcs.shelve.deletion.undo",
+ VcsNotifier.getInstance(myProject).notifyMinorWarning(SHELVE_DELETION_UNDO,
VcsBundle.message("shelve.undo.deletion"),
VcsBundle.message("shelve.changes.restore.error", cantRestoreList.size()));
}
import static com.intellij.diff.util.DiffUserDataKeysEx.VCS_DIFF_LEFT_CONTENT_TITLE;
import static com.intellij.diff.util.DiffUserDataKeysEx.VCS_DIFF_RIGHT_CONTENT_TITLE;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.COMPARE_FAILED;
import static com.intellij.vcsUtil.VcsUtil.getShortRevisionString;
public final class VcsDiffUtil {
String title = VcsBundle.message("history.notification.title.compare.with.failed", getShortRevisionString(targetRevNumber));
String message =
VcsBundle.message("history.notification.content.couldn.t.compare.with.revision", file,getShortRevisionString(targetRevNumber));
- VcsNotifier.getInstance(project).notifyError("vcs.compare.failed", title, message + "\n " + e.getMessage());
+ VcsNotifier.getInstance(project).notifyError(COMPARE_FAILED, title, message + "\n " + e.getMessage());
}
}
import java.util.*;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.ROOT_ADDED;
import static java.util.stream.Collectors.toList;
public abstract class VcsIntegrationEnabler {
protected void notifyAddedRoots(Collection<? extends VirtualFile> roots) {
String message = VcsBundle.message("roots.notification.content.added.vcs.name.roots", myVcs.getName(), roots.size(), joinRootsPaths(roots));
- VcsNotifier.getInstance(myProject).notifySuccess("vcs.root.added", "", message);
+ VcsNotifier.getInstance(myProject).notifySuccess(ROOT_ADDED, "", message);
}
private void addVcsRoots(@NotNull Collection<? extends VirtualFile> roots) {
import static com.intellij.openapi.util.io.FileUtil.toSystemDependentName;
import static com.intellij.openapi.util.text.StringUtil.escapeXmlEntities;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.ROOTS_INVALID;
+import static com.intellij.openapi.vcs.VcsNotificationIdsHolder.ROOTS_REGISTERED;
import static com.intellij.openapi.vcs.VcsRootError.Type.UNREGISTERED_ROOT;
import static com.intellij.util.containers.ContainerUtil.*;
import static com.intellij.util.ui.UIUtil.BR;
VcsNotifier notifier = VcsNotifier.getInstance(myProject);
myNotification = invalidRoots.isEmpty()
- ? notifier.notifyMinorInfo("vcs.roots.registered", title, description, notificationActions)
- : notifier.notifyError("vcs.roots.invalid", title, description, getConfigureNotificationAction());
+ ? notifier.notifyMinorInfo(ROOTS_REGISTERED, title, description, notificationActions)
+ : notifier.notifyError(ROOTS_INVALID, title, description, getConfigureNotificationAction());
}
}
import com.intellij.openapi.util.text.StringUtil.*
import com.intellij.openapi.vcs.VcsBundle.message
import com.intellij.openapi.vcs.VcsException
+import com.intellij.openapi.vcs.VcsNotificationIdsHolder.Companion.COMMIT_CANCELED
+import com.intellij.openapi.vcs.VcsNotificationIdsHolder.Companion.COMMIT_FAILED
+import com.intellij.openapi.vcs.VcsNotificationIdsHolder.Companion.COMMIT_FINISHED
+import com.intellij.openapi.vcs.VcsNotificationIdsHolder.Companion.COMMIT_FINISHED_WITH_WARNINGS
import com.intellij.openapi.vcs.VcsNotifier
import com.intellij.openapi.vcs.changes.CommitResultHandler
import com.intellij.util.ui.UIUtil
override fun onSuccess(commitMessage: String) = reportResult()
override fun onCancel() {
- notifier.notifyMinorWarning("vcs.commit.canceled", "", message("vcs.commit.canceled"))
+ notifier.notifyMinorWarning(COMMIT_CANCELED, "", message("vcs.commit.canceled"))
}
override fun onFailure(errors: List<VcsException>) = reportResult()
when {
errorsSize > 0 -> {
val title = message("message.text.commit.failed.with.error", errorsSize)
- notifier.notifyError("vcs.commit.failed", title, message)
+ notifier.notifyError(COMMIT_FAILED, title, message)
}
warningsSize > 0 -> {
val title = message("message.text.commit.finished.with.warning", warningsSize)
- notifier.notifyImportantWarning("vcs.commit.finished.with.warnings", title, message)
+ notifier.notifyImportantWarning(COMMIT_FINISHED_WITH_WARNINGS, title, message)
}
- else -> notifier.notifySuccess("vcs.commit.finished", "", message)
+ else -> notifier.notifySuccess(COMMIT_FINISHED, "", message)
}
}