From f136629645d9f11123ccac5071a7bba094d17db0 Mon Sep 17 00:00:00 2001 From: UNV Date: Sat, 4 Oct 2025 02:30:42 +0300 Subject: [PATCH 1/2] Adding @ActionImpl annotations to Main Menu actions. Refactoring and localizing. --- .../git/action}/LogContextMenuGroup.java | 5 +- .../git/action}/LogToolbarGroup.java | 2 +- .../git/action/MainMenuPatchGroup.java | 25 + .../MainMenuUncommittedChangesGroup.java | 28 + .../consulo/git/action/RebaseActionGroup.java | 25 + .../actions/GitAbstractRebaseAction.java | 22 +- .../main/java/git4idea/actions/GitAction.java | 5 + .../main/java/git4idea/actions/GitAdd.java | 3 +- .../actions/GitCreateNewBranchAction.java | 1 - .../main/java/git4idea/actions/GitFetch.java | 24 +- .../git4idea/actions/GitFileActionGroup.java | 14 +- .../actions/GitMainMenuActionGroup.java | 51 +- .../main/java/git4idea/actions/GitMerge.java | 22 +- .../main/java/git4idea/actions/GitPull.java | 63 ++- .../main/java/git4idea/actions/GitRebase.java | 14 +- .../java/git4idea/actions/GitRebaseAbort.java | 13 +- .../git4idea/actions/GitRebaseActionBase.java | 10 +- .../git4idea/actions/GitRebaseContinue.java | 15 +- .../java/git4idea/actions/GitRebaseSkip.java | 13 +- .../git4idea/actions/GitRepositoryAction.java | 52 +- .../GitRepositoryStateActionGroup.java | 20 +- .../java/git4idea/actions/GitResetHead.java | 8 + .../actions/GitResolveConflictsAction.java | 24 +- .../main/java/git4idea/actions/GitStash.java | 24 +- .../main/java/git4idea/actions/GitTag.java | 19 +- .../java/git4idea/actions/GitUnstash.java | 22 +- .../git4idea/rebase/GitRebaseProcess.java | 9 +- .../java/git4idea/rebase/GitRebaseUtils.java | 490 +++++++++--------- .../git4idea/ui/branch/GitBranchesAction.java | 9 + .../en_US/consulo.git.GitLocalize.yaml | 98 ++-- plugin/src/main/resources/META-INF/plugin.xml | 102 +--- 31 files changed, 717 insertions(+), 515 deletions(-) rename plugin/src/main/java/{git4idea/actions => consulo/git/action}/LogContextMenuGroup.java (90%) rename plugin/src/main/java/{git4idea/actions => consulo/git/action}/LogToolbarGroup.java (97%) create mode 100644 plugin/src/main/java/consulo/git/action/MainMenuPatchGroup.java create mode 100644 plugin/src/main/java/consulo/git/action/MainMenuUncommittedChangesGroup.java create mode 100644 plugin/src/main/java/consulo/git/action/RebaseActionGroup.java diff --git a/plugin/src/main/java/git4idea/actions/LogContextMenuGroup.java b/plugin/src/main/java/consulo/git/action/LogContextMenuGroup.java similarity index 90% rename from plugin/src/main/java/git4idea/actions/LogContextMenuGroup.java rename to plugin/src/main/java/consulo/git/action/LogContextMenuGroup.java index 2b7f601..56ef5be 100644 --- a/plugin/src/main/java/git4idea/actions/LogContextMenuGroup.java +++ b/plugin/src/main/java/consulo/git/action/LogContextMenuGroup.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package git4idea.actions; +package consulo.git.action; import consulo.annotation.component.ActionImpl; import consulo.annotation.component.ActionParentRef; @@ -22,6 +22,9 @@ import consulo.git.localize.GitLocalize; import consulo.ui.ex.action.AnSeparator; import consulo.ui.ex.action.DefaultActionGroup; +import git4idea.actions.GitCheckoutRevisionAction; +import git4idea.actions.GitCreateNewBranchAction; +import git4idea.actions.GitCreateTagAction; import git4idea.reset.GitResetAction; /** diff --git a/plugin/src/main/java/git4idea/actions/LogToolbarGroup.java b/plugin/src/main/java/consulo/git/action/LogToolbarGroup.java similarity index 97% rename from plugin/src/main/java/git4idea/actions/LogToolbarGroup.java rename to plugin/src/main/java/consulo/git/action/LogToolbarGroup.java index f6eb58f..365d518 100644 --- a/plugin/src/main/java/git4idea/actions/LogToolbarGroup.java +++ b/plugin/src/main/java/consulo/git/action/LogToolbarGroup.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package git4idea.actions; +package consulo.git.action; import consulo.annotation.component.ActionImpl; import consulo.annotation.component.ActionParentRef; diff --git a/plugin/src/main/java/consulo/git/action/MainMenuPatchGroup.java b/plugin/src/main/java/consulo/git/action/MainMenuPatchGroup.java new file mode 100644 index 0000000..0462c80 --- /dev/null +++ b/plugin/src/main/java/consulo/git/action/MainMenuPatchGroup.java @@ -0,0 +1,25 @@ +package consulo.git.action; + +import consulo.annotation.component.ActionImpl; +import consulo.annotation.component.ActionRef; +import consulo.application.dumb.DumbAware; +import consulo.git.localize.GitLocalize; +import consulo.ui.ex.action.DefaultActionGroup; + +/** + * @author UNV + * @since 2025-10-03 + */ +@ActionImpl( + id = "Patch.MainMenu", + children = { + @ActionRef(id = "ChangesView.CreatePatch"), + @ActionRef(id = "ChangesView.ApplyPatch"), + @ActionRef(id = "ChangesView.ApplyPatchFromClipboard") + } +) +public class MainMenuPatchGroup extends DefaultActionGroup implements DumbAware { + public MainMenuPatchGroup() { + super(GitLocalize.groupMainMenuPatchText(), true); + } +} diff --git a/plugin/src/main/java/consulo/git/action/MainMenuUncommittedChangesGroup.java b/plugin/src/main/java/consulo/git/action/MainMenuUncommittedChangesGroup.java new file mode 100644 index 0000000..bab9974 --- /dev/null +++ b/plugin/src/main/java/consulo/git/action/MainMenuUncommittedChangesGroup.java @@ -0,0 +1,28 @@ +package consulo.git.action; + +import consulo.annotation.component.ActionImpl; +import consulo.annotation.component.ActionRef; +import consulo.application.dumb.DumbAware; +import consulo.git.localize.GitLocalize; +import consulo.ui.ex.action.DefaultActionGroup;import git4idea.actions.GitStash;import git4idea.actions.GitUnstash; + +/** + * @author UNV + * @since 2025-10-03 + */ +@ActionImpl( + id = "Git.MainMenu.LocalChanges", + children = { + @ActionRef(id = "ChangesView.Shelve"), + @ActionRef(id = "Vcs.Show.Shelf"), + @ActionRef(type = GitStash.class), + @ActionRef(type = GitUnstash.class), + @ActionRef(id = "ChangesView.Revert") + //@ActionRef(id = "Vcs.UmlDiff") + } +) +public class MainMenuUncommittedChangesGroup extends DefaultActionGroup implements DumbAware { + public MainMenuUncommittedChangesGroup() { + super(GitLocalize.groupMainMenuUncommittedChangesText(), true); + } +} diff --git a/plugin/src/main/java/consulo/git/action/RebaseActionGroup.java b/plugin/src/main/java/consulo/git/action/RebaseActionGroup.java new file mode 100644 index 0000000..5d75dcf --- /dev/null +++ b/plugin/src/main/java/consulo/git/action/RebaseActionGroup.java @@ -0,0 +1,25 @@ +package consulo.git.action; + +import consulo.annotation.component.ActionImpl; +import consulo.annotation.component.ActionRef; +import consulo.git.localize.GitLocalize; +import consulo.versionControlSystem.distributed.repository.Repository; +import git4idea.actions.GitRebaseAbort;import git4idea.actions.GitRebaseContinue;import git4idea.actions.GitRebaseSkip;import git4idea.actions.GitRepositoryStateActionGroup; + +/** + * @author UNV + * @since 2025-10-03 + */ +@ActionImpl( + id = "Git.MainMenu.RebaseActions", + children = { + @ActionRef(type = GitRebaseAbort.class), + @ActionRef(type = GitRebaseContinue.class), + @ActionRef(type = GitRebaseSkip.class) + } +) +public class RebaseActionGroup extends GitRepositoryStateActionGroup { + public RebaseActionGroup() { + super(GitLocalize.groupMainMenuRebaseActionsText(), true, Repository.State.REBASING); + } +} diff --git a/plugin/src/main/java/git4idea/actions/GitAbstractRebaseAction.java b/plugin/src/main/java/git4idea/actions/GitAbstractRebaseAction.java index 5ceb1e8..d8fcc61 100644 --- a/plugin/src/main/java/git4idea/actions/GitAbstractRebaseAction.java +++ b/plugin/src/main/java/git4idea/actions/GitAbstractRebaseAction.java @@ -18,6 +18,7 @@ import consulo.application.progress.ProgressIndicator; import consulo.application.progress.ProgressManager; import consulo.application.progress.Task; +import consulo.localize.LocalizeValue; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.ui.ex.action.AnActionEvent; @@ -33,23 +34,22 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.List; -import static consulo.util.collection.ContainerUtil.newArrayList; import static consulo.util.lang.ObjectUtil.assertNotNull; import static git4idea.GitUtil.*; -abstract class GitAbstractRebaseAction extends DumbAwareAction { +public abstract class GitAbstractRebaseAction extends DumbAwareAction { + protected GitAbstractRebaseAction(@Nonnull LocalizeValue text) { + super(text); + } + @Override @RequiredUIAccess public void update(@Nonnull AnActionEvent e) { super.update(e); Project project = e.getData(Project.KEY); - if (project == null || !hasGitRepositories(project)) { - e.getPresentation().setEnabledAndVisible(false); - } - else { - e.getPresentation().setEnabledAndVisible(hasRebaseInProgress(project)); - } + e.getPresentation().setEnabledAndVisible(project != null && hasGitRepositories(project) && hasRebaseInProgress(project)); } @Override @@ -57,7 +57,7 @@ public void update(@Nonnull AnActionEvent e) { public final void actionPerformed(AnActionEvent e) { final Project project = e.getRequiredData(Project.KEY); ProgressManager progressManager = ProgressManager.getInstance(); - String progressTitle = getProgressTitle(); + LocalizeValue progressTitle = getProgressTitle(); if (getRepositoryManager(project).hasOngoingRebase()) { progressManager.run(new Task.Backgroundable(project, progressTitle) { @Override @@ -80,7 +80,7 @@ public void run(@Nonnull ProgressIndicator indicator) { } @Nonnull - protected abstract String getProgressTitle(); + protected abstract LocalizeValue getProgressTitle(); protected abstract void performActionForProject(@Nonnull Project project, @Nonnull ProgressIndicator indicator); @@ -101,7 +101,7 @@ private GitRepository chooseRepository(@Nonnull Project project, @Nonnull Collec if (repositories.size() == 1) { return firstRepo; } - ArrayList roots = newArrayList(getRootsFromRepositories(repositories)); + List roots = new ArrayList<>(getRootsFromRepositories(repositories)); GitRebaseActionDialog dialog = new GitRebaseActionDialog(project, getTemplatePresentation().getText(), roots, firstRepo.getRoot()); dialog.show(); VirtualFile root = dialog.selectRoot(); diff --git a/plugin/src/main/java/git4idea/actions/GitAction.java b/plugin/src/main/java/git4idea/actions/GitAction.java index e9bfa69..10a1eb9 100644 --- a/plugin/src/main/java/git4idea/actions/GitAction.java +++ b/plugin/src/main/java/git4idea/actions/GitAction.java @@ -15,6 +15,7 @@ */ package git4idea.actions; +import consulo.localize.LocalizeValue; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.ui.ex.action.AnActionEvent; @@ -28,6 +29,10 @@ * @author Kirill Likhodedov */ public abstract class GitAction extends DumbAwareAction { + protected GitAction(@Nonnull LocalizeValue text) { + super(text); + } + @Override @RequiredUIAccess public void update(@Nonnull AnActionEvent e) { diff --git a/plugin/src/main/java/git4idea/actions/GitAdd.java b/plugin/src/main/java/git4idea/actions/GitAdd.java index 41ed16c..8a0c223 100644 --- a/plugin/src/main/java/git4idea/actions/GitAdd.java +++ b/plugin/src/main/java/git4idea/actions/GitAdd.java @@ -17,6 +17,7 @@ import consulo.annotation.component.ActionImpl; import consulo.annotation.component.ActionRef; +import consulo.git.localize.GitLocalize; import consulo.localize.LocalizeValue; import consulo.platform.base.icon.PlatformIconGroup; import consulo.ui.ex.action.AnActionEvent; @@ -27,7 +28,7 @@ @ActionImpl(id = "Git.Add", shortcutFrom = @ActionRef(id = "ChangesView.AddUnversioned")) public class GitAdd extends ScheduleForAdditionAction { public GitAdd() { - super(LocalizeValue.localizeTODO("Add"), LocalizeValue.localizeTODO("Add"), PlatformIconGroup.generalAdd()); + super(GitLocalize.actionAddText(), LocalizeValue.empty(), PlatformIconGroup.generalAdd()); } @Override diff --git a/plugin/src/main/java/git4idea/actions/GitCreateNewBranchAction.java b/plugin/src/main/java/git4idea/actions/GitCreateNewBranchAction.java index ec141fc..768da0e 100644 --- a/plugin/src/main/java/git4idea/actions/GitCreateNewBranchAction.java +++ b/plugin/src/main/java/git4idea/actions/GitCreateNewBranchAction.java @@ -18,7 +18,6 @@ import java.util.Collections; import consulo.annotation.component.ActionImpl; -import consulo.component.ComponentManager; import consulo.git.localize.GitLocalize; import consulo.project.Project; import consulo.versionControlSystem.log.Hash; diff --git a/plugin/src/main/java/git4idea/actions/GitFetch.java b/plugin/src/main/java/git4idea/actions/GitFetch.java index 3dd41d7..ca584a9 100644 --- a/plugin/src/main/java/git4idea/actions/GitFetch.java +++ b/plugin/src/main/java/git4idea/actions/GitFetch.java @@ -15,15 +15,18 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.application.progress.ProgressIndicator; import consulo.application.progress.Task; import consulo.git.localize.GitLocalize; import consulo.localize.LocalizeValue; +import consulo.ui.annotation.RequiredUIAccess; import consulo.versionControlSystem.VcsException; import consulo.virtualFileSystem.VirtualFile; import consulo.project.Project; import git4idea.GitUtil; import git4idea.GitVcs; +import git4idea.actions.GitRepositoryAction; import git4idea.repo.GitRepositoryManager; import git4idea.update.GitFetcher; import jakarta.annotation.Nonnull; @@ -34,7 +37,12 @@ /** * Git "fetch" action */ +@ActionImpl(id = "Git.Fetch") public class GitFetch extends GitRepositoryAction { + public GitFetch() { + super(GitLocalize.actionFetchText()); + } + @Override @Nonnull protected LocalizeValue getActionName() { @@ -45,19 +53,17 @@ protected LocalizeValue getActionName() { protected void perform( @Nonnull final Project project, @Nonnull final List gitRoots, - @Nonnull final VirtualFile defaultRoot, - final Set affectedRoots, - final List exceptions + @Nonnull VirtualFile defaultRoot, + Set affectedRoots, + List exceptions ) throws VcsException { - GitVcs.runInBackground(new Task.Backgroundable(project, "Fetching...", false) { + GitVcs.runInBackground(new Task.Backgroundable(project, LocalizeValue.localizeTODO("Fetching..."), false) { @Override + @RequiredUIAccess public void run(@Nonnull ProgressIndicator indicator) { GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager(project); - new GitFetcher(project, indicator, true).fetchRootsAndNotify( - GitUtil.getRepositoriesFromRoots(repositoryManager, gitRoots), - null, - true - ); + new GitFetcher(project, indicator, true) + .fetchRootsAndNotify(GitUtil.getRepositoriesFromRoots(repositoryManager, gitRoots), null, true); } }); } diff --git a/plugin/src/main/java/git4idea/actions/GitFileActionGroup.java b/plugin/src/main/java/git4idea/actions/GitFileActionGroup.java index 08fb936..332643f 100644 --- a/plugin/src/main/java/git4idea/actions/GitFileActionGroup.java +++ b/plugin/src/main/java/git4idea/actions/GitFileActionGroup.java @@ -1,5 +1,7 @@ package git4idea.actions; +import consulo.annotation.component.ActionImpl; +import consulo.annotation.component.ActionRef; import consulo.application.dumb.DumbAware; import consulo.codeEditor.Editor; import consulo.ui.ex.action.DefaultActionGroup; @@ -16,14 +18,20 @@ import java.util.List; // from kotlin +@ActionImpl( + id = "Git.MainMenu.FileActions", + children = @ActionRef(id = "Git.FileActions") +) public class GitFileActionGroup extends DefaultActionGroup implements DumbAware { - @RequiredUIAccess + public GitFileActionGroup() { + super(GitLocalize.groupMainMenuCurrentFileText(), true); + } + @Override + @RequiredUIAccess public void update(@Nonnull AnActionEvent e) { Presentation presentation = e.getPresentation(); - presentation.setTextValue(GitLocalize.groupMainmenuVcsCurrentFileText()); - VirtualFile[] data = e.getData(VirtualFile.KEY_OF_ARRAY); if (data == null) { return; diff --git a/plugin/src/main/java/git4idea/actions/GitMainMenuActionGroup.java b/plugin/src/main/java/git4idea/actions/GitMainMenuActionGroup.java index 98f91ad..ea0d2e4 100644 --- a/plugin/src/main/java/git4idea/actions/GitMainMenuActionGroup.java +++ b/plugin/src/main/java/git4idea/actions/GitMainMenuActionGroup.java @@ -1,22 +1,65 @@ package git4idea.actions; +import consulo.annotation.component.ActionImpl; +import consulo.annotation.component.ActionParentRef; +import consulo.annotation.component.ActionRef; +import consulo.annotation.component.ActionRefAnchor; import consulo.application.dumb.DumbAware; +import consulo.git.action.*; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; -import consulo.ui.ex.action.AnActionEvent; -import consulo.ui.ex.action.DefaultActionGroup; -import consulo.ui.ex.action.Presentation; +import consulo.ui.ex.action.*; import consulo.versionControlSystem.AbstractVcs; import consulo.versionControlSystem.ProjectLevelVcsManager; import git4idea.GitVcs; +import git4idea.ui.branch.GitBranchesAction; import jakarta.annotation.Nonnull; import java.util.Objects; // from kotlin +@ActionImpl( + id = "Git.MainMenu", + children = { + @ActionRef(id = IdeActions.ACTION_CHECKIN_PROJECT), + @ActionRef(id = "Vcs.Push"), + @ActionRef(id = "Vcs.UpdateProject"), + @ActionRef(type = GitPull.class), + @ActionRef(type = GitFetch.class), + @ActionRef(type = AnSeparator.class), + @ActionRef(type = GitMerge.class), + //@ActionRef(id = "Git.MainMenu.MergeActions"), + @ActionRef(type = GitRebase.class), + @ActionRef(type = RebaseActionGroup.class), + @ActionRef(type = GitResolveConflictsAction.class), + @ActionRef(type = AnSeparator.class), + @ActionRef(type = GitBranchesAction.class), + @ActionRef(type = GitCreateNewBranchAction.class), + @ActionRef(type = GitTag.class), + @ActionRef(type = GitResetHead.class), + @ActionRef(type = AnSeparator.class), + @ActionRef(id = "Vcs.Show.Log"), + @ActionRef(type = MainMenuPatchGroup.class), + @ActionRef(type = MainMenuUncommittedChangesGroup.class), + @ActionRef(id = "Git.MainMenu.FileActions"), + @ActionRef(type = AnSeparator.class), + //@ActionRef(type = GitConfigureRemotesAction.class), + //@ActionRef(type = GitCloneAction.class), + //@ActionRef(type = AnSeparator.class), + @ActionRef(id = "Vcs.QuickListPopupAction") + //@ActionRef(type = AnSeparator.class), + //@ActionRef(type = GitAbortOperationAction$Revert.class), + //@ActionRef(type = GitAbortOperationAction$CherryPick.class) + }, + parents = @ActionParentRef( + value = @ActionRef(id = "VcsGroups"), + anchor = ActionRefAnchor.AFTER, + relatedToAction = @ActionRef(id = "Vcs.MainMenu") + ) +) public class GitMainMenuActionGroup extends DefaultActionGroup implements DumbAware { - @RequiredUIAccess @Override + @RequiredUIAccess public void update(@Nonnull AnActionEvent e) { Presentation presentation = e.getPresentation(); diff --git a/plugin/src/main/java/git4idea/actions/GitMerge.java b/plugin/src/main/java/git4idea/actions/GitMerge.java index ec0ee68..4914ea6 100644 --- a/plugin/src/main/java/git4idea/actions/GitMerge.java +++ b/plugin/src/main/java/git4idea/actions/GitMerge.java @@ -15,10 +15,12 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.git.localize.GitLocalize; import consulo.localHistory.Label; import consulo.localHistory.LocalHistory; import consulo.localize.LocalizeValue; +import consulo.platform.base.icon.PlatformIconGroup; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.versionControlSystem.VcsException; @@ -27,6 +29,7 @@ import git4idea.GitRevisionNumber; import git4idea.GitUtil; import git4idea.GitVcs; +import git4idea.actions.GitRepositoryAction; import git4idea.commands.GitHandlerUtil; import git4idea.commands.GitLineHandler; import git4idea.merge.GitMergeDialog; @@ -40,14 +43,19 @@ /** * Git "merge" action */ +@ActionImpl(id = "Git.Merge") public class GitMerge extends GitRepositoryAction { + public GitMerge() { + super(GitLocalize.actionMergeText(), LocalizeValue.empty(), PlatformIconGroup.vcsMerge()); + } + /** * {@inheritDoc} */ @Override @Nonnull protected LocalizeValue getActionName() { - return GitLocalize.mergeActionName(); + return GitLocalize.actionMergeName(); } /** @@ -56,11 +64,11 @@ protected LocalizeValue getActionName() { @Override @RequiredUIAccess protected void perform( - @Nonnull final Project project, - @Nonnull final List gitRoots, - @Nonnull final VirtualFile defaultRoot, - final Set affectedRoots, - final List exceptions + @Nonnull Project project, + @Nonnull List gitRoots, + @Nonnull VirtualFile defaultRoot, + Set affectedRoots, + List exceptions ) throws VcsException { GitVcs vcs = GitVcs.getInstance(project); if (vcs == null) { @@ -82,7 +90,7 @@ protected void perform( } Label beforeLabel = LocalHistory.getInstance().putSystemLabel(project, "Before update"); GitLineHandler lineHandler = dialog.handler(); - final VirtualFile root = dialog.getSelectedRoot(); + VirtualFile root = dialog.getSelectedRoot(); affectedRoots.add(root); GitRevisionNumber currentRev = GitRevisionNumber.resolve(project, root, "HEAD"); try { diff --git a/plugin/src/main/java/git4idea/actions/GitPull.java b/plugin/src/main/java/git4idea/actions/GitPull.java index a7192aa..1708bbe 100644 --- a/plugin/src/main/java/git4idea/actions/GitPull.java +++ b/plugin/src/main/java/git4idea/actions/GitPull.java @@ -15,12 +15,14 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.application.progress.ProgressIndicator; import consulo.application.progress.Task; import consulo.git.localize.GitLocalize; import consulo.localHistory.Label; import consulo.localHistory.LocalHistory; import consulo.localize.LocalizeValue; +import consulo.platform.base.icon.PlatformIconGroup; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.versionControlSystem.VcsException; @@ -47,9 +49,14 @@ /** * Git "pull" action */ +@ActionImpl(id = "Git.Pull") public class GitPull extends GitRepositoryAction { - @Override + public GitPull() { + super(GitLocalize.actionPullText(), LocalizeValue.empty(), PlatformIconGroup.actionsCheckout()); + } + @Nonnull + @Override protected LocalizeValue getActionName() { return GitLocalize.pullActionName(); } @@ -58,8 +65,8 @@ protected LocalizeValue getActionName() { @RequiredUIAccess protected void perform( @Nonnull final Project project, - @Nonnull final List gitRoots, - @Nonnull final VirtualFile defaultRoot, + @Nonnull List gitRoots, + @Nonnull VirtualFile defaultRoot, final Set affectedRoots, final List exceptions ) throws VcsException { @@ -74,7 +81,7 @@ protected void perform( @Override @RequiredUIAccess public void run(@Nonnull ProgressIndicator indicator) { - final GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager((Project)myProject); + final GitRepositoryManager repositoryManager = GitUtil.getRepositoryManager((Project) myProject); GitRepository repository = repositoryManager.getRepositoryForRoot(dialog.gitRoot()); assert repository != null : "Repository can't be null for root " + dialog.gitRoot(); @@ -100,30 +107,34 @@ public void run(@Nonnull ProgressIndicator indicator) { GitTask pullTask = new GitTask(project, handler, GitLocalize.pullingTitle(dialog.getRemote())); pullTask.setProgressIndicator(indicator); pullTask.setProgressAnalyzer(new GitStandardProgressAnalyzer()); - pullTask.execute(true, false, new GitTaskResultHandlerAdapter() { - @Override - protected void onSuccess() { - root.refresh(false, true); - GitMergeUtil.showUpdates( - GitPull.this, - project, - exceptions, - root, - currentRev, - beforeLabel, - getActionName(), - ActionInfo.UPDATE - ); - repositoryManager.updateRepository(root); - runFinalTasks(project, GitVcs.getInstance(project), affectedRoots, getActionName(), exceptions); - } + pullTask.execute( + true, + false, + new GitTaskResultHandlerAdapter() { + @Override + protected void onSuccess() { + root.refresh(false, true); + GitMergeUtil.showUpdates( + GitPull.this, + project, + exceptions, + root, + currentRev, + beforeLabel, + getActionName(), + ActionInfo.UPDATE + ); + repositoryManager.updateRepository(root); + runFinalTasks(project, GitVcs.getInstance(project), affectedRoots, getActionName(), exceptions); + } - @Override - protected void onFailure() { - GitUIUtil.notifyGitErrors(project, "Error pulling " + dialog.getRemote(), "", handler.errors()); - repositoryManager.updateRepository(root); + @Override + protected void onFailure() { + GitUIUtil.notifyGitErrors(project, "Error pulling " + dialog.getRemote(), "", handler.errors()); + repositoryManager.updateRepository(root); + } } - }); + ); } }.queue(); } diff --git a/plugin/src/main/java/git4idea/actions/GitRebase.java b/plugin/src/main/java/git4idea/actions/GitRebase.java index 2406e2d..de42ab3 100644 --- a/plugin/src/main/java/git4idea/actions/GitRebase.java +++ b/plugin/src/main/java/git4idea/actions/GitRebase.java @@ -15,14 +15,15 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.application.progress.ProgressIndicator; import consulo.application.progress.ProgressManager; import consulo.application.progress.Task; +import consulo.git.localize.GitLocalize; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.ui.ex.action.AnActionEvent; import consulo.ui.ex.action.DumbAwareAction; -import consulo.util.collection.ContainerUtil; import consulo.versionControlSystem.distributed.DvcsUtil; import consulo.virtualFileSystem.VirtualFile; import git4idea.rebase.GitRebaseDialog; @@ -37,7 +38,12 @@ import static git4idea.GitUtil.*; import static git4idea.rebase.GitRebaseUtils.getRebasingRepositories; +@ActionImpl(id = "Git.Rebase") public class GitRebase extends DumbAwareAction { + public GitRebase() { + super(GitLocalize.actionRebaseText()); + } + @Override @RequiredUIAccess public void update(@Nonnull AnActionEvent e) { @@ -56,13 +62,13 @@ public void update(@Nonnull AnActionEvent e) { @RequiredUIAccess public void actionPerformed(@Nonnull AnActionEvent e) { final Project project = e.getRequiredData(Project.KEY); - ArrayList repositories = ContainerUtil.newArrayList(getRepositories(project)); + List repositories = new ArrayList<>(getRepositories(project)); repositories.removeAll(getRebasingRepositories(project)); - List roots = ContainerUtil.newArrayList(getRootsFromRepositories(sortRepositories(repositories))); + List roots = new ArrayList<>(getRootsFromRepositories(sortRepositories(repositories))); VirtualFile defaultRoot = DvcsUtil.guessVcsRoot(project, e.getData(VirtualFile.KEY)); final GitRebaseDialog dialog = new GitRebaseDialog(project, roots, defaultRoot); if (dialog.showAndGet()) { - ProgressManager.getInstance().run(new Task.Backgroundable(project, "Rebasing...") { + ProgressManager.getInstance().run(new Task.Backgroundable(project, GitLocalize.taskRebasingTitle()) { @Override public void run(@Nonnull ProgressIndicator indicator) { GitRebaseUtils.rebase(project, List.of(dialog.getSelectedRepository()), dialog.getSelectedParams(), indicator); diff --git a/plugin/src/main/java/git4idea/actions/GitRebaseAbort.java b/plugin/src/main/java/git4idea/actions/GitRebaseAbort.java index 9481572..f50f974 100644 --- a/plugin/src/main/java/git4idea/actions/GitRebaseAbort.java +++ b/plugin/src/main/java/git4idea/actions/GitRebaseAbort.java @@ -15,17 +15,26 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.application.progress.ProgressIndicator; +import consulo.git.localize.GitLocalize; +import consulo.localize.LocalizeValue; import consulo.project.Project; +import git4idea.actions.GitAbstractRebaseAction; import git4idea.rebase.GitRebaseUtils; import git4idea.repo.GitRepository; import jakarta.annotation.Nonnull; +@ActionImpl(id = "Git.Rebase.Abort") public class GitRebaseAbort extends GitAbstractRebaseAction { + public GitRebaseAbort() { + super(GitLocalize.actionRebaseAbortText()); + } + @Nonnull @Override - protected String getProgressTitle() { - return "Aborting Rebase Process..."; + protected LocalizeValue getProgressTitle() { + return GitLocalize.actionRebaseAbortProgressTitle(); } @Override diff --git a/plugin/src/main/java/git4idea/actions/GitRebaseActionBase.java b/plugin/src/main/java/git4idea/actions/GitRebaseActionBase.java index bd26373..d5f6cfd 100644 --- a/plugin/src/main/java/git4idea/actions/GitRebaseActionBase.java +++ b/plugin/src/main/java/git4idea/actions/GitRebaseActionBase.java @@ -47,9 +47,9 @@ public abstract class GitRebaseActionBase extends GitRepositoryAction { @RequiredUIAccess protected void perform( @Nonnull final Project project, - @Nonnull final List gitRoots, - @Nonnull final VirtualFile defaultRoot, - final Set affectedRoots, + @Nonnull List gitRoots, + @Nonnull VirtualFile defaultRoot, + Set affectedRoots, final List exceptions ) throws VcsException { GitLineHandler h = createHandler(project, gitRoots, defaultRoot); @@ -65,7 +65,7 @@ protected void perform( affectedRoots.add(root); service.configureHandler(h, editor.getHandlerNo()); - GitTask task = new GitTask(project, h, GitLocalize.rebasingTitle()); + GitTask task = new GitTask(project, h, GitLocalize.taskRebasingTitle()); task.executeInBackground( false, new GitTaskResultHandlerAdapter() { @@ -92,7 +92,7 @@ private static void notifyAboutErrorResult( if (taskResult == GitTaskResult.CANCELLED) { return; } - final GitRebaseLineListener.Result result = resultListener.getResult(); + GitRebaseLineListener.Result result = resultListener.getResult(); switch (result.status) { case CONFLICT: Messages.showErrorDialog( diff --git a/plugin/src/main/java/git4idea/actions/GitRebaseContinue.java b/plugin/src/main/java/git4idea/actions/GitRebaseContinue.java index 4f25da8..5aaa399 100644 --- a/plugin/src/main/java/git4idea/actions/GitRebaseContinue.java +++ b/plugin/src/main/java/git4idea/actions/GitRebaseContinue.java @@ -15,17 +15,26 @@ */ package git4idea.actions; -import jakarta.annotation.Nonnull; +import consulo.annotation.component.ActionImpl; import consulo.application.progress.ProgressIndicator; +import consulo.git.localize.GitLocalize; +import consulo.localize.LocalizeValue; import consulo.project.Project; +import git4idea.actions.GitAbstractRebaseAction; import git4idea.rebase.GitRebaseUtils; import git4idea.repo.GitRepository; +import jakarta.annotation.Nonnull; +@ActionImpl(id = "Git.Rebase.Continue") public class GitRebaseContinue extends GitAbstractRebaseAction { + public GitRebaseContinue() { + super(GitLocalize.actionRebaseContinueText()); + } + @Nonnull @Override - protected String getProgressTitle() { - return GitRebaseUtils.CONTINUE_PROGRESS_TITLE; + protected LocalizeValue getProgressTitle() { + return GitLocalize.actionRebaseContinueProgressTitle(); } @Override diff --git a/plugin/src/main/java/git4idea/actions/GitRebaseSkip.java b/plugin/src/main/java/git4idea/actions/GitRebaseSkip.java index 140d892..c87165c 100644 --- a/plugin/src/main/java/git4idea/actions/GitRebaseSkip.java +++ b/plugin/src/main/java/git4idea/actions/GitRebaseSkip.java @@ -15,6 +15,10 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; +import consulo.git.localize.GitLocalize; +import consulo.localize.LocalizeValue; +import git4idea.actions.GitAbstractRebaseAction; import jakarta.annotation.Nonnull; import consulo.application.progress.ProgressIndicator; @@ -22,11 +26,16 @@ import git4idea.rebase.GitRebaseUtils; import git4idea.repo.GitRepository; +@ActionImpl(id = "Git.Rebase.Skip") public class GitRebaseSkip extends GitAbstractRebaseAction { + public GitRebaseSkip() { + super(GitLocalize.actionRebaseSkipText()); + } + @Nonnull @Override - protected String getProgressTitle() { - return "Skip Commit during Rebase..."; + protected LocalizeValue getProgressTitle() { + return GitLocalize.actionRebaseSkipProgressTitle(); } @Override diff --git a/plugin/src/main/java/git4idea/actions/GitRepositoryAction.java b/plugin/src/main/java/git4idea/actions/GitRepositoryAction.java index fb2b7f3..86c8065 100644 --- a/plugin/src/main/java/git4idea/actions/GitRepositoryAction.java +++ b/plugin/src/main/java/git4idea/actions/GitRepositoryAction.java @@ -24,6 +24,7 @@ import consulo.ui.ex.action.AnActionEvent; import consulo.ui.ex.action.DumbAwareAction; import consulo.ui.ex.awt.Messages; +import consulo.ui.image.Image; import consulo.util.collection.ArrayUtil; import consulo.versionControlSystem.ProjectLevelVcsManager; import consulo.versionControlSystem.TransactionRunnable; @@ -56,20 +57,31 @@ public abstract class GitRepositoryAction extends DumbAwareAction { */ final List myDelayedTasks = new ArrayList<>(); + protected GitRepositoryAction() { + } + + protected GitRepositoryAction(@Nonnull LocalizeValue text) { + super(text); + } + + protected GitRepositoryAction(@Nonnull LocalizeValue text, @Nonnull LocalizeValue description, @Nullable Image icon) { + super(text, description, icon); + } + @Override @RequiredUIAccess - public void actionPerformed(@Nonnull final AnActionEvent e) { + public void actionPerformed(@Nonnull AnActionEvent e) { myDelayedTasks.clear(); FileDocumentManager.getInstance().saveAllDocuments(); - final Project project = e.getRequiredData(Project.KEY); + Project project = e.getRequiredData(Project.KEY); GitVcs vcs = GitVcs.getInstance(project); - final List roots = getGitRoots(project, vcs); + List roots = getGitRoots(project, vcs); if (roots == null) { return; } - final VirtualFile defaultRoot = getDefaultRoot(project, roots, e.getData(VirtualFile.KEY_OF_ARRAY)); - final Set affectedRoots = new HashSet<>(); + VirtualFile defaultRoot = getDefaultRoot(project, roots, e.getData(VirtualFile.KEY_OF_ARRAY)); + Set affectedRoots = new HashSet<>(); List exceptions = new ArrayList<>(); try { @@ -98,11 +110,11 @@ private static VirtualFile getDefaultRoot(@Nonnull Project project, @Nonnull Lis } protected final void runFinalTasks( - @Nonnull final Project project, - @Nonnull final GitVcs vcs, - @Nonnull final Set affectedRoots, - @Nonnull final LocalizeValue actionName, - @Nonnull final List exceptions + @Nonnull Project project, + @Nonnull GitVcs vcs, + @Nonnull Set affectedRoots, + @Nonnull LocalizeValue actionName, + @Nonnull List exceptions ) { VirtualFileUtil.markDirty(true, false, ArrayUtil.toObjectArray(affectedRoots, VirtualFile.class)); LocalFileSystem.getInstance().refreshFiles( @@ -130,9 +142,9 @@ protected boolean executeFinalTasksSynchronously() { } protected static boolean isRebasing(AnActionEvent e) { - final Project project = e.getData(Project.KEY); + Project project = e.getData(Project.KEY); if (project != null) { - final VirtualFile[] files = e.getData(VirtualFile.KEY_OF_ARRAY); + VirtualFile[] files = e.getData(VirtualFile.KEY_OF_ARRAY); if (files != null) { for (VirtualFile file : files) { GitRepositoryManager manager = GitUtil.getRepositoryManager(project); @@ -199,28 +211,24 @@ public final void delayTask(@Nonnull TransactionRunnable task) { * @param defaultRoot a guessed default root (based on the currently selected file list) * @param affectedRoots a set of roots affected by the action * @param exceptions a list of exceptions from running git - * @throws VcsException if there is a problem with running git (this exception is considered to be added to the end of the exception list) + * @throws VcsException if there is a problem with running git + * (this exception is considered to be added to the end of the exception list) */ protected abstract void perform( @Nonnull Project project, @Nonnull List gitRoots, @Nonnull VirtualFile defaultRoot, - final Set affectedRoots, + Set affectedRoots, List exceptions ) throws VcsException; @Override @RequiredUIAccess - public void update(@Nonnull final AnActionEvent e) { + public void update(@Nonnull AnActionEvent e) { super.update(e); boolean enabled = isEnabled(e); e.getPresentation().setEnabled(enabled); - if (ActionPlaces.isPopupPlace(e.getPlace())) { - e.getPresentation().setVisible(enabled); - } - else { - e.getPresentation().setVisible(true); - } + e.getPresentation().setVisible(!ActionPlaces.isPopupPlace(e.getPlace()) || enabled); } protected boolean isEnabled(AnActionEvent e) { @@ -229,7 +237,7 @@ protected boolean isEnabled(AnActionEvent e) { return false; } GitVcs vcs = GitVcs.getInstance(project); - final VirtualFile[] roots = ProjectLevelVcsManager.getInstance(project).getRootsUnderVcs(vcs); + VirtualFile[] roots = ProjectLevelVcsManager.getInstance(project).getRootsUnderVcs(vcs); return roots != null && roots.length != 0; } } diff --git a/plugin/src/main/java/git4idea/actions/GitRepositoryStateActionGroup.java b/plugin/src/main/java/git4idea/actions/GitRepositoryStateActionGroup.java index 02121d4..c452f9d 100644 --- a/plugin/src/main/java/git4idea/actions/GitRepositoryStateActionGroup.java +++ b/plugin/src/main/java/git4idea/actions/GitRepositoryStateActionGroup.java @@ -1,6 +1,7 @@ package git4idea.actions; import consulo.application.dumb.DumbAware; +import consulo.localize.LocalizeValue; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.ui.ex.action.AnActionEvent; @@ -19,20 +20,23 @@ public Merge() { } } - public static class Rebase extends GitRepositoryStateActionGroup { - public Rebase() { - super(Repository.State.REBASING); - } - } - private final Repository.State myState; - private GitRepositoryStateActionGroup(Repository.State state) { + protected GitRepositoryStateActionGroup(Repository.State state) { + myState = state; + } + + public GitRepositoryStateActionGroup( + @Nonnull LocalizeValue text, + boolean popup, + Repository.State state + ) { + super(text, popup); myState = state; } - @RequiredUIAccess @Override + @RequiredUIAccess public void update(@Nonnull AnActionEvent e) { Presentation presentation = e.getPresentation(); presentation.setEnabledAndVisible(false); diff --git a/plugin/src/main/java/git4idea/actions/GitResetHead.java b/plugin/src/main/java/git4idea/actions/GitResetHead.java index 229bb70..535b434 100644 --- a/plugin/src/main/java/git4idea/actions/GitResetHead.java +++ b/plugin/src/main/java/git4idea/actions/GitResetHead.java @@ -15,13 +15,16 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.git.localize.GitLocalize; import consulo.localize.LocalizeValue; +import consulo.platform.base.icon.PlatformIconGroup; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.versionControlSystem.VcsException; import consulo.virtualFileSystem.VirtualFile; import git4idea.GitUtil; +import git4idea.actions.GitRepositoryAction; import git4idea.commands.GitHandlerUtil; import git4idea.commands.GitLineHandler; import git4idea.repo.GitRepositoryManager; @@ -34,7 +37,12 @@ /** * The reset action */ +@ActionImpl(id = "Git.Reset") public class GitResetHead extends GitRepositoryAction { + public GitResetHead() { + super(GitLocalize.actionResetText(), LocalizeValue.empty(), PlatformIconGroup.actionsRollback()); + } + /** * {@inheritDoc} */ diff --git a/plugin/src/main/java/git4idea/actions/GitResolveConflictsAction.java b/plugin/src/main/java/git4idea/actions/GitResolveConflictsAction.java index 939060b..95ad118 100644 --- a/plugin/src/main/java/git4idea/actions/GitResolveConflictsAction.java +++ b/plugin/src/main/java/git4idea/actions/GitResolveConflictsAction.java @@ -15,6 +15,8 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; +import consulo.git.localize.GitLocalize; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.ui.ex.action.ActionPlaces; @@ -27,6 +29,7 @@ import consulo.virtualFileSystem.status.FileStatus; import git4idea.GitUtil; import git4idea.GitVcs; +import git4idea.actions.GitAction; import git4idea.repo.GitRepository; import jakarta.annotation.Nonnull; @@ -35,31 +38,36 @@ /** * Git merge tool for resolving conflicts. Use IDEA built-in 3-way merge tool. */ +@ActionImpl(id = "Git.ResolveConflicts") public class GitResolveConflictsAction extends GitAction { + public GitResolveConflictsAction() { + super(GitLocalize.actionResolveConflictsText()); + } + @Override @RequiredUIAccess public void actionPerformed(@Nonnull AnActionEvent event) { - final Project project = event.getData(Project.KEY); + Project project = event.getData(Project.KEY); if (project == null) { return; } - final Set conflictedFiles = - new TreeSet<>((Comparator)(f1, f2) -> f1.getPresentableUrl().compareTo(f2.getPresentableUrl())); + Set conflictedFiles = + new TreeSet<>((Comparator) (f1, f2) -> f1.getPresentableUrl().compareTo(f2.getPresentableUrl())); for (Change change : ChangeListManager.getInstance(project).getAllChanges()) { if (change.getFileStatus() != FileStatus.MERGED_WITH_CONFLICTS) { continue; } - final ContentRevision before = change.getBeforeRevision(); - final ContentRevision after = change.getAfterRevision(); + ContentRevision before = change.getBeforeRevision(); + ContentRevision after = change.getAfterRevision(); if (before != null) { - final VirtualFile file = before.getFile().getVirtualFile(); + VirtualFile file = before.getFile().getVirtualFile(); if (file != null) { conflictedFiles.add(file); } } if (after != null) { - final VirtualFile file = after.getFile().getVirtualFile(); + VirtualFile file = after.getFile().getVirtualFile(); if (file != null) { conflictedFiles.add(file); } @@ -75,7 +83,7 @@ public void actionPerformed(@Nonnull AnActionEvent event) { @Override protected boolean isEnabled(@Nonnull AnActionEvent event) { - final Collection changes = ChangeListManager.getInstance(event.getData(Project.KEY)).getAllChanges(); + Collection changes = ChangeListManager.getInstance(event.getRequiredData(Project.KEY)).getAllChanges(); if (changes.size() > 1000) { return true; } diff --git a/plugin/src/main/java/git4idea/actions/GitStash.java b/plugin/src/main/java/git4idea/actions/GitStash.java index 1820499..48e8fe0 100644 --- a/plugin/src/main/java/git4idea/actions/GitStash.java +++ b/plugin/src/main/java/git4idea/actions/GitStash.java @@ -15,6 +15,7 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.git.localize.GitLocalize; import consulo.localize.LocalizeValue; import consulo.ui.annotation.RequiredUIAccess; @@ -23,7 +24,7 @@ import consulo.project.Project; import consulo.versionControlSystem.VcsException; import consulo.virtualFileSystem.util.VirtualFileUtil; -import git4idea.commands.GitHandlerUtil; +import git4idea.actions.GitRepositoryAction;import git4idea.commands.GitHandlerUtil; import git4idea.commands.GitLineHandler; import git4idea.ui.GitStashDialog; @@ -35,20 +36,25 @@ /** * Git stash action */ +@ActionImpl(id = "Git.Stash") public class GitStash extends GitRepositoryAction { + public GitStash() { + super(GitLocalize.actionStashText()); + } + /** * {@inheritDoc} */ @Override @RequiredUIAccess protected void perform( - @Nonnull final Project project, - @Nonnull final List gitRoots, - @Nonnull final VirtualFile defaultRoot, - final Set affectedRoots, - final List exceptions + @Nonnull Project project, + @Nonnull List gitRoots, + @Nonnull VirtualFile defaultRoot, + Set affectedRoots, + List exceptions ) throws VcsException { - final ChangeListManager changeListManager = ChangeListManager.getInstance(project); + ChangeListManager changeListManager = ChangeListManager.getInstance(project); if (changeListManager.isFreezedWithNotification("Can not stash changes now")) { return; } @@ -59,7 +65,7 @@ protected void perform( } VirtualFile root = d.getGitRoot(); affectedRoots.add(root); - final GitLineHandler h = d.handler(); + GitLineHandler h = d.handler(); GitHandlerUtil.doSynchronously(h, GitLocalize.stashingTitle(), LocalizeValue.ofNullable(h.printableCommandLine())); VirtualFileUtil.markDirtyAndRefresh(true, true, false, root); } @@ -70,6 +76,6 @@ protected void perform( @Nonnull @Override protected LocalizeValue getActionName() { - return GitLocalize.stashActionName(); + return GitLocalize.actionStashName(); } } diff --git a/plugin/src/main/java/git4idea/actions/GitTag.java b/plugin/src/main/java/git4idea/actions/GitTag.java index edd319d..8dd1e57 100644 --- a/plugin/src/main/java/git4idea/actions/GitTag.java +++ b/plugin/src/main/java/git4idea/actions/GitTag.java @@ -15,12 +15,14 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.git.localize.GitLocalize; import consulo.localize.LocalizeValue; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.versionControlSystem.VcsException; import consulo.virtualFileSystem.VirtualFile; +import git4idea.actions.GitRepositoryAction; import git4idea.ui.GitTagDialog; import jakarta.annotation.Nonnull; @@ -30,14 +32,19 @@ /** * Git "tag" action */ +@ActionImpl(id = "Git.Tag") public class GitTag extends GitRepositoryAction { + public GitTag() { + super(GitLocalize.actionTagText()); + } + /** * {@inheritDoc} */ @Override @Nonnull protected LocalizeValue getActionName() { - return GitLocalize.tagActionName(); + return GitLocalize.actionTagName(); } /** @@ -46,11 +53,11 @@ protected LocalizeValue getActionName() { @Override @RequiredUIAccess protected void perform( - @Nonnull final Project project, - @Nonnull final List gitRoots, - @Nonnull final VirtualFile defaultRoot, - final Set affectedRoots, - final List exceptions + @Nonnull Project project, + @Nonnull List gitRoots, + @Nonnull VirtualFile defaultRoot, + Set affectedRoots, + List exceptions ) throws VcsException { GitTagDialog d = new GitTagDialog(project, gitRoots, defaultRoot); d.show(); diff --git a/plugin/src/main/java/git4idea/actions/GitUnstash.java b/plugin/src/main/java/git4idea/actions/GitUnstash.java index 135c269..eb67d34 100644 --- a/plugin/src/main/java/git4idea/actions/GitUnstash.java +++ b/plugin/src/main/java/git4idea/actions/GitUnstash.java @@ -15,6 +15,7 @@ */ package git4idea.actions; +import consulo.annotation.component.ActionImpl; import consulo.git.localize.GitLocalize; import consulo.localize.LocalizeValue; import consulo.project.Project; @@ -22,7 +23,7 @@ import consulo.versionControlSystem.VcsException; import consulo.versionControlSystem.change.ChangeListManager; import consulo.virtualFileSystem.VirtualFile; -import git4idea.ui.GitUnstashDialog; +import git4idea.actions.GitRepositoryAction;import git4idea.ui.GitUnstashDialog; import jakarta.annotation.Nonnull; import java.util.List; @@ -31,14 +32,19 @@ /** * Git unstash action */ +@ActionImpl(id = "Git.Unstash") public class GitUnstash extends GitRepositoryAction { + public GitUnstash() { + super(GitLocalize.actionUnstashText()); + } + /** * {@inheritDoc} */ @Nonnull @Override protected LocalizeValue getActionName() { - return GitLocalize.unstashActionName(); + return GitLocalize.actionUnstashName(); } /** @@ -47,13 +53,13 @@ protected LocalizeValue getActionName() { @Override @RequiredUIAccess protected void perform( - @Nonnull final Project project, - @Nonnull final List gitRoots, - @Nonnull final VirtualFile defaultRoot, - final Set affectedRoots, - final List exceptions + @Nonnull Project project, + @Nonnull List gitRoots, + @Nonnull VirtualFile defaultRoot, + Set affectedRoots, + List exceptions ) throws VcsException { - final ChangeListManager changeListManager = ChangeListManager.getInstance(project); + ChangeListManager changeListManager = ChangeListManager.getInstance(project); if (changeListManager.isFreezedWithNotification("Can not unstash changes now")) { return; } diff --git a/plugin/src/main/java/git4idea/rebase/GitRebaseProcess.java b/plugin/src/main/java/git4idea/rebase/GitRebaseProcess.java index 54bb99e..0cfd127 100644 --- a/plugin/src/main/java/git4idea/rebase/GitRebaseProcess.java +++ b/plugin/src/main/java/git4idea/rebase/GitRebaseProcess.java @@ -20,6 +20,7 @@ import consulo.application.progress.ProgressManager; import consulo.application.progress.Task; import consulo.component.ProcessCanceledException; +import consulo.git.localize.GitLocalize; import consulo.ide.ServiceManager; import consulo.logging.Logger; import consulo.project.Project; @@ -49,10 +50,10 @@ import git4idea.stash.GitChangesSaver; import git4idea.util.GitFreezingProcess; import git4idea.util.GitUntrackedFilesHelper; -import org.jetbrains.annotations.Contract; - import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; +import org.jetbrains.annotations.Contract; + import javax.swing.event.HyperlinkEvent; import java.util.*; @@ -565,7 +566,7 @@ protected boolean proceedAfterAllMerged() throws VcsException { if(myCalledFromNotification) { - retry(GitRebaseUtils.CONTINUE_PROGRESS_TITLE); + retry(GitLocalize.actionRebaseContinueProgressTitle().get()); } return true; } @@ -608,7 +609,7 @@ protected void hyperlinkActivated(@Nonnull Notification notification, @Nonnull f } else if("continue".equals(href)) { - retry(GitRebaseUtils.CONTINUE_PROGRESS_TITLE); + retry(GitLocalize.actionRebaseContinueProgressTitle().get()); } else if("retry".equals(href)) { diff --git a/plugin/src/main/java/git4idea/rebase/GitRebaseUtils.java b/plugin/src/main/java/git4idea/rebase/GitRebaseUtils.java index ef1e38e..84b14a3 100644 --- a/plugin/src/main/java/git4idea/rebase/GitRebaseUtils.java +++ b/plugin/src/main/java/git4idea/rebase/GitRebaseUtils.java @@ -32,6 +32,7 @@ import jakarta.annotation.Nonnull; import jakarta.annotation.Nullable; + import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -48,278 +49,281 @@ * The utilities related to rebase functionality */ public class GitRebaseUtils { - public static final String CONTINUE_PROGRESS_TITLE = "Continue Rebase Process..."; - /** - * The logger instance - */ - private final static Logger LOG = Logger.getInstance(GitRebaseUtils.class.getName()); - - /** - * A private constructor for utility class - */ - private GitRebaseUtils() { - } + /** + * The logger instance + */ + private final static Logger LOG = Logger.getInstance(GitRebaseUtils.class.getName()); - public static void rebase(@Nonnull final Project project, - @Nonnull final List repositories, - @Nonnull final GitRebaseParams params, - @Nonnull final ProgressIndicator indicator) { - if (!isRebaseAllowed(project, repositories)) { - return; // TODO maybe move to the outside + /** + * A private constructor for utility class + */ + private GitRebaseUtils() { } - new GitRebaseProcess(project, GitRebaseSpec.forNewRebase(project, params, repositories, indicator), null).rebase(); - } - public static void continueRebase(@Nonnull Project project) { - GitRebaseSpec spec = GitUtil.getRepositoryManager(project).getOngoingRebaseSpec(); - if (spec != null) { - new GitRebaseProcess(project, spec, GitRebaseResumeMode.CONTINUE).rebase(); - } - else { - LOG.warn("Refusing to continue: no rebase spec"); - VcsNotifier.getInstance(project).notifyError("Can't Continue Rebase", "No rebase in progress"); + public static void rebase( + @Nonnull Project project, + @Nonnull List repositories, + @Nonnull GitRebaseParams params, + @Nonnull ProgressIndicator indicator + ) { + if (!isRebaseAllowed(project, repositories)) { + return; // TODO maybe move to the outside + } + new GitRebaseProcess(project, GitRebaseSpec.forNewRebase(project, params, repositories, indicator), null).rebase(); } - } - public static void continueRebase(@Nonnull Project project, @Nonnull GitRepository repository, @Nonnull ProgressIndicator indicator) { - GitRebaseSpec spec = GitRebaseSpec.forResumeInSingleRepository(project, repository, indicator); - if (spec != null) { - new GitRebaseProcess(project, spec, GitRebaseResumeMode.CONTINUE).rebase(); - } - else { - LOG.warn("Refusing to continue: no rebase spec"); - VcsNotifier.getInstance(project).notifyError("Can't Continue Rebase", "No rebase in progress"); + public static void continueRebase(@Nonnull Project project) { + GitRebaseSpec spec = GitUtil.getRepositoryManager(project).getOngoingRebaseSpec(); + if (spec != null) { + new GitRebaseProcess(project, spec, GitRebaseResumeMode.CONTINUE).rebase(); + } + else { + LOG.warn("Refusing to continue: no rebase spec"); + VcsNotifier.getInstance(project).notifyError("Can't Continue Rebase", "No rebase in progress"); + } } - } - public static void skipRebase(@Nonnull Project project) { - GitRebaseSpec spec = GitUtil.getRepositoryManager(project).getOngoingRebaseSpec(); - if (spec != null) { - new GitRebaseProcess(project, spec, GitRebaseResumeMode.SKIP).rebase(); - } - else { - LOG.warn("Refusing to skip: no rebase spec"); - VcsNotifier.getInstance(project).notifyError("Can't Continue Rebase", "No rebase in progress"); + public static void continueRebase(@Nonnull Project project, @Nonnull GitRepository repository, @Nonnull ProgressIndicator indicator) { + GitRebaseSpec spec = GitRebaseSpec.forResumeInSingleRepository(project, repository, indicator); + if (spec != null) { + new GitRebaseProcess(project, spec, GitRebaseResumeMode.CONTINUE).rebase(); + } + else { + LOG.warn("Refusing to continue: no rebase spec"); + VcsNotifier.getInstance(project).notifyError("Can't Continue Rebase", "No rebase in progress"); + } } - } - public static void skipRebase(@Nonnull Project project, @Nonnull GitRepository repository, @Nonnull ProgressIndicator indicator) { - GitRebaseSpec spec = GitRebaseSpec.forResumeInSingleRepository(project, repository, indicator); - if (spec != null) { - new GitRebaseProcess(project, spec, GitRebaseResumeMode.SKIP).rebase(); - } - else { - LOG.warn("Refusing to skip: no rebase spec"); - VcsNotifier.getInstance(project).notifyError("Can't Continue Rebase", "No rebase in progress"); + public static void skipRebase(@Nonnull Project project) { + GitRebaseSpec spec = GitUtil.getRepositoryManager(project).getOngoingRebaseSpec(); + if (spec != null) { + new GitRebaseProcess(project, spec, GitRebaseResumeMode.SKIP).rebase(); + } + else { + LOG.warn("Refusing to skip: no rebase spec"); + VcsNotifier.getInstance(project).notifyError("Can't Continue Rebase", "No rebase in progress"); + } } - } - /** - * Automatically detects the ongoing rebase process in the project and abort it. - * Optionally rollbacks repositories which were already rebased during that detected multi-root rebase process. - *

- * Does nothing if no information about ongoing rebase is available, or if this information has become obsolete. - */ - public static void abort(@Nonnull Project project, @Nonnull ProgressIndicator indicator) { - GitRebaseSpec spec = GitUtil.getRepositoryManager(project).getOngoingRebaseSpec(); - if (spec != null) { - new GitAbortRebaseProcess(project, - spec.getOngoingRebase(), - spec.getHeadPositionsToRollback(), - spec.getInitialBranchNames(), - indicator, - spec.getSaver()).abortWithConfirmation(); - } - else { - LOG.warn("Refusing to abort: no rebase spec"); - VcsNotifier.getInstance(project).notifyError("Can't Abort Rebase", "No rebase in progress"); + public static void skipRebase(@Nonnull Project project, @Nonnull GitRepository repository, @Nonnull ProgressIndicator indicator) { + GitRebaseSpec spec = GitRebaseSpec.forResumeInSingleRepository(project, repository, indicator); + if (spec != null) { + new GitRebaseProcess(project, spec, GitRebaseResumeMode.SKIP).rebase(); + } + else { + LOG.warn("Refusing to skip: no rebase spec"); + VcsNotifier.getInstance(project).notifyError("Can't Continue Rebase", "No rebase in progress"); + } } - } - /** - * Abort the ongoing rebase process in the given repository. - */ - public static void abort(@Nonnull final Project project, @Nullable final GitRepository repository, @Nonnull ProgressIndicator indicator) { - new GitAbortRebaseProcess(project, - repository, - Collections.emptyMap(), - Collections.emptyMap(), - indicator, - null).abortWithConfirmation(); - } - - private static boolean isRebaseAllowed(@Nonnull Project project, @Nonnull Collection repositories) { - // TODO links to 'rebase', 'resolve conflicts', etc. - for (GitRepository repository : repositories) { - Repository.State state = repository.getState(); - String in = GitUtil.mention(repository); - String message = null; - switch (state) { - case NORMAL: - if (repository.isFresh()) { - message = "Repository" + in + " is empty."; - } - break; - case MERGING: - message = "There is an unfinished merge process" + in + ".
You should complete the merge before starting a rebase"; - break; - case REBASING: - message = "There is an unfinished rebase process" + in + ".
You should complete it before starting another rebase"; - break; - case GRAFTING: - message = "There is an unfinished cherry-pick process" + in + ".
You should finish it before starting a rebase."; - break; - case DETACHED: - message = "You are in the detached HEAD state" + in + ".
Rebase is not possible."; - break; - default: - LOG.error("Unknown state [" + state.name() + "]"); - message = "Rebase is not possible" + in; - } - if (message != null) { - VcsNotifier.getInstance(project).notifyError("Rebase not Allowed", message); - return false; - } + /** + * Automatically detects the ongoing rebase process in the project and abort it. + * Optionally rollbacks repositories which were already rebased during that detected multi-root rebase process. + *

+ * Does nothing if no information about ongoing rebase is available, or if this information has become obsolete. + */ + public static void abort(@Nonnull Project project, @Nonnull ProgressIndicator indicator) { + GitRebaseSpec spec = GitUtil.getRepositoryManager(project).getOngoingRebaseSpec(); + if (spec != null) { + new GitAbortRebaseProcess( + project, + spec.getOngoingRebase(), + spec.getHeadPositionsToRollback(), + spec.getInitialBranchNames(), + indicator, + spec.getSaver() + ).abortWithConfirmation(); + } + else { + LOG.warn("Refusing to abort: no rebase spec"); + VcsNotifier.getInstance(project).notifyError("Can't Abort Rebase", "No rebase in progress"); + } } - return true; - } - - /** - * Checks if the rebase is in the progress for the specified git root - * - * @param project - * @param root the git root - * @return true if the rebase directory presents in the root - */ - @Deprecated - public static boolean isRebaseInTheProgress(@Nonnull Project project, @Nonnull VirtualFile root) { - return getRebaseDir(project, root) != null; - } - /** - * Get rebase directory - * - * @param root the vcs root - * @return the rebase directory or null if it does not exist. - */ - @Nullable - private static File getRebaseDir(@Nonnull Project project, @Nonnull VirtualFile root) { - GitRepository repository = assertNotNull(GitUtil.getRepositoryManager(project).getRepositoryForRoot(root)); - File f = repository.getRepositoryFiles().getRebaseApplyDir(); - if (f.exists()) { - return f; - } - f = repository.getRepositoryFiles().getRebaseMergeDir(); - if (f.exists()) { - return f; + /** + * Abort the ongoing rebase process in the given repository. + */ + public static void abort(@Nonnull Project project, @Nullable GitRepository repository, @Nonnull ProgressIndicator indicator) { + new GitAbortRebaseProcess( + project, + repository, + Collections.emptyMap(), + Collections.emptyMap(), + indicator, + null + ).abortWithConfirmation(); } - return null; - } - /** - * Get rebase directory - * - * @param project - * @param root the vcs root - * @return the commit information or null if no commit information could be detected - */ - @Nullable - public static CommitInfo getCurrentRebaseCommit(@Nonnull Project project, @Nonnull VirtualFile root) { - File rebaseDir = getRebaseDir(project, root); - if (rebaseDir == null) { - LOG.warn("No rebase dir found for " + root.getPath()); - return null; - } - File nextFile = new File(rebaseDir, "next"); - int next; - try { - next = Integer.parseInt(Files.readString(nextFile.toPath(), StandardCharsets.UTF_8).trim()); - } - catch (Exception e) { - LOG.warn("Failed to load next commit number from file " + nextFile.getPath(), e); - return null; - } - File commitFile = new File(rebaseDir, String.format("%04d", next)); - String hash = null; - String subject = null; - try { - BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(commitFile), CharsetToolkit.UTF8_CHARSET)); - try { - String line; - while ((line = in.readLine()) != null) { - if (line.startsWith("From ")) { - hash = line.substring(5, 5 + 40); - } - if (line.startsWith("Subject: ")) { - subject = line.substring("Subject: ".length()); - } - if (hash != null && subject != null) { - break; - } + private static boolean isRebaseAllowed(@Nonnull Project project, @Nonnull Collection repositories) { + // TODO links to 'rebase', 'resolve conflicts', etc. + for (GitRepository repository : repositories) { + Repository.State state = repository.getState(); + String in = GitUtil.mention(repository); + String message = null; + switch (state) { + case NORMAL: + if (repository.isFresh()) { + message = "Repository" + in + " is empty."; + } + break; + case MERGING: + message = "There is an unfinished merge process" + in + ".
You should complete the merge before starting a rebase"; + break; + case REBASING: + message = "There is an unfinished rebase process" + in + ".
You should complete it before starting another rebase"; + break; + case GRAFTING: + message = "There is an unfinished cherry-pick process" + in + ".
You should finish it before starting a rebase."; + break; + case DETACHED: + message = "You are in the detached HEAD state" + in + ".
Rebase is not possible."; + break; + default: + LOG.error("Unknown state [" + state.name() + "]"); + message = "Rebase is not possible" + in; + } + if (message != null) { + VcsNotifier.getInstance(project).notifyError("Rebase not Allowed", message); + return false; + } } - } - finally { - in.close(); - } - } - catch (Exception e) { - LOG.warn("Failed to load next commit number from file " + commitFile, e); - return null; + return true; } - if (subject == null || hash == null) { - LOG.info("Unable to extract information from " + commitFile + " " + hash + ": " + subject); - return null; - } - return new CommitInfo(new GitRevisionNumber(hash), subject); - } - - @Nonnull - static String mentionLocalChangesRemainingInStash(@Nullable GitChangesSaver saver) { - return saver != null && saver.wereChangesSaved() ? "
Note that some local changes were " + toPast(saver.getOperationName()) + " before rebase." : ""; - } - @Nonnull - private static String toPast(@Nonnull String word) { - return word.endsWith("e") ? word + "d" : word + "ed"; - } - - @Nonnull - public static Collection getRebasingRepositories(@Nonnull Project project) { - return ContainerUtil.filter(GitUtil.getRepositories(project), new Condition() { - @Override - public boolean value(@Nonnull GitRepository repository) { - return repository.getState() == Repository.State.REBASING; - } - }); - } - - /** - * Short commit info - */ - public static class CommitInfo { /** - * The commit hash + * Checks if the rebase is in the progress for the specified git root + * + * @param project + * @param root the git root + * @return true if the rebase directory presents in the root */ - public final GitRevisionNumber revision; + @Deprecated + public static boolean isRebaseInTheProgress(@Nonnull Project project, @Nonnull VirtualFile root) { + return getRebaseDir(project, root) != null; + } + /** - * The commit subject + * Get rebase directory + * + * @param root the vcs root + * @return the rebase directory or null if it does not exist. */ - public final String subject; + @Nullable + private static File getRebaseDir(@Nonnull Project project, @Nonnull VirtualFile root) { + GitRepository repository = assertNotNull(GitUtil.getRepositoryManager(project).getRepositoryForRoot(root)); + File f = repository.getRepositoryFiles().getRebaseApplyDir(); + if (f.exists()) { + return f; + } + f = repository.getRepositoryFiles().getRebaseMergeDir(); + if (f.exists()) { + return f; + } + return null; + } /** - * The constructor + * Get rebase directory * - * @param revision - * @param subject the commit subject + * @param project + * @param root the vcs root + * @return the commit information or null if no commit information could be detected */ - public CommitInfo(GitRevisionNumber revision, String subject) { - this.revision = revision; - this.subject = subject; + @Nullable + public static CommitInfo getCurrentRebaseCommit(@Nonnull Project project, @Nonnull VirtualFile root) { + File rebaseDir = getRebaseDir(project, root); + if (rebaseDir == null) { + LOG.warn("No rebase dir found for " + root.getPath()); + return null; + } + File nextFile = new File(rebaseDir, "next"); + int next; + try { + next = Integer.parseInt(Files.readString(nextFile.toPath(), StandardCharsets.UTF_8).trim()); + } + catch (Exception e) { + LOG.warn("Failed to load next commit number from file " + nextFile.getPath(), e); + return null; + } + File commitFile = new File(rebaseDir, String.format("%04d", next)); + String hash = null; + String subject = null; + try { + BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(commitFile), CharsetToolkit.UTF8_CHARSET)); + try { + String line; + while ((line = in.readLine()) != null) { + if (line.startsWith("From ")) { + hash = line.substring(5, 5 + 40); + } + if (line.startsWith("Subject: ")) { + subject = line.substring("Subject: ".length()); + } + if (hash != null && subject != null) { + break; + } + } + } + finally { + in.close(); + } + } + catch (Exception e) { + LOG.warn("Failed to load next commit number from file " + commitFile, e); + return null; + } + if (subject == null || hash == null) { + LOG.info("Unable to extract information from " + commitFile + " " + hash + ": " + subject); + return null; + } + return new CommitInfo(new GitRevisionNumber(hash), subject); + } + + @Nonnull + static String mentionLocalChangesRemainingInStash(@Nullable GitChangesSaver saver) { + return saver != null && saver.wereChangesSaved() ? "
Note that some local changes were " + toPast(saver.getOperationName()) + " before rebase." : ""; + } + + @Nonnull + private static String toPast(@Nonnull String word) { + return word.endsWith("e") ? word + "d" : word + "ed"; } - @Override - public String toString() { - return revision.toString(); + @Nonnull + public static Collection getRebasingRepositories(@Nonnull Project project) { + return ContainerUtil.filter( + GitUtil.getRepositories(project), + repository -> repository.getState() == Repository.State.REBASING + ); + } + + /** + * Short commit info + */ + public static class CommitInfo { + /** + * The commit hash + */ + public final GitRevisionNumber revision; + /** + * The commit subject + */ + public final String subject; + + /** + * The constructor + * + * @param revision + * @param subject the commit subject + */ + public CommitInfo(GitRevisionNumber revision, String subject) { + this.revision = revision; + this.subject = subject; + } + + @Override + public String toString() { + return revision.toString(); + } } - } } diff --git a/plugin/src/main/java/git4idea/ui/branch/GitBranchesAction.java b/plugin/src/main/java/git4idea/ui/branch/GitBranchesAction.java index 65ba876..90d2cf3 100644 --- a/plugin/src/main/java/git4idea/ui/branch/GitBranchesAction.java +++ b/plugin/src/main/java/git4idea/ui/branch/GitBranchesAction.java @@ -15,6 +15,10 @@ */ package git4idea.ui.branch; +import consulo.annotation.component.ActionImpl; +import consulo.git.localize.GitLocalize; +import consulo.localize.LocalizeValue; +import consulo.platform.base.icon.PlatformIconGroup; import consulo.project.Project; import consulo.ui.annotation.RequiredUIAccess; import consulo.ui.ex.action.AnActionEvent; @@ -29,7 +33,12 @@ * Invokes a {@link GitBranchPopup} to checkout and control Git branches. *

*/ +@ActionImpl(id = "Git.Branches") public class GitBranchesAction extends DumbAwareAction { + public GitBranchesAction() { + super(GitLocalize.actionBranchesText(), LocalizeValue.empty(), PlatformIconGroup.vcsBranch()); + } + @Override @RequiredUIAccess public void actionPerformed(@Nonnull AnActionEvent e) { diff --git a/plugin/src/main/resources/LOCALIZE-LIB/en_US/consulo.git.GitLocalize.yaml b/plugin/src/main/resources/LOCALIZE-LIB/en_US/consulo.git.GitLocalize.yaml index ad9432a..200e8b1 100644 --- a/plugin/src/main/resources/LOCALIZE-LIB/en_US/consulo.git.GitLocalize.yaml +++ b/plugin/src/main/resources/LOCALIZE-LIB/en_US/consulo.git.GitLocalize.yaml @@ -1,37 +1,17 @@ action.Annotate.with.Blame.text: text: A_nnotate with Git Blame -action.Git.Branches.text: - text: _Branches... -action.Git.Fetch.text: - text: Fetch -action.Git.Merge.text: - text: Merge... action.Git.Pull.text: text: Pull... -action.Git.Rebase.Abort.text: - text: Abort Rebase -action.Git.Rebase.Continue.text: - text: Continue Rebase -action.Git.Rebase.Skip.text: - text: Skip Commit -action.Git.Rebase.text: - text: Rebase... -action.Git.Reset.text: - text: Reset HEAD... -action.Git.ResolveConflicts.text: - text: Resolve Conflicts... action.Git.Stash.Silently.text: text: Stash Silently action.Git.Stash.UnstashAs.description: text: Pop or apply selected stash as new branch with or without index action.Git.Stash.UnstashAs.text: text: Unstash... -action.Git.Stash.text: - text: Stash Changes... -action.Git.Tag.text: - text: New Tag... -action.Git.Unstash.text: - text: Unstash Changes... +action.add.text: + text: Add +action.branches.text: + text: _Branches... action.checkout.revision.text: text: Checkout Revision action.create.new.branch.description: @@ -42,18 +22,58 @@ action.create.new.tag.description: text: Create new tag pointing to this commit action.create.new.tag.text: text: New Tag... +action.fetch.text: + text: Fetch action.log.deep.compare.description: text: Dims those commits which have equivalent changes in the current branch action.log.deep.compare.text: text: Highlight Non-picked Commits action.log.reset.text: text: Reset Current Branch to Here... +action.merge.name: + text: Merge +action.merge.text: + text: Merge... +action.pull.text: + text: Pull... +action.rebase.abort.progress.title: + text: Aborting rebase process... +action.rebase.abort.text: + text: Abort Rebase +action.rebase.continue.progress.title: + text: Continue rebase process... +action.rebase.continue.text: + text: Continue Rebase +action.rebase.skip.name: + text: Skip Commit in Rebasing +action.rebase.skip.progress.title: + text: Skip commit during rebase... +action.rebase.skip.text: + text: Skip Commit +action.rebase.text: + text: Rebase... +action.reset.text: + text: Reset HEAD... +action.resolve.conflicts.text: + text: Resolve Conflicts... action.selected.directory.text: text: Selected {0,choice,1#Directory|2#Directories} action.selected.file.text: text: Selected {0,choice,1#File|2#Files} +action.stash.name: + text: Stash +action.stash.text: + text: Stash Changes... +action.tag.name: + text: Tag +action.tag.text: + text: New Tag... action.text.show.all.submitted: text: Show all files changed by this commit +action.unstash.name: + text: Unstash +action.unstash.text: + text: Unstash Changes... add.action.name: text: Add add.adding: @@ -439,20 +459,20 @@ git.vcs.config.test.label: text: 'Test ' git4idea.vcs.name: text: Git -group.Git.MainMenu.LocalChanges.text: - text: _Uncommitted Changes group.Git.MainMenu.MergeActions.text: text: _Merge -group.Git.MainMenu.RebaseActions.text: - text: _Rebase -group.Patch.MainMenu.text: - text: Patch group.log.context.menu.text: text: Git Log Context Menu group.log.toolbar.text: text: Git Log Toolbar -group.mainmenu.vcs.current.file.text: +group.main.menu.current.file.text: text: Current File +group.main.menu.patch.text: + text: Patch +group.main.menu.rebase.actions.text: + text: _Rebase +group.main.menu.uncommitted.changes.text: + text: _Uncommitted Changes index.file.error: text: Updating file in the index failed init.add.root.message: @@ -469,8 +489,6 @@ init.warning.title: text: Git Init initializing.title: text: Initializing repository... -merge.action.name: - text: Merge merge.add.log.information: text: Add &log information merge.add.log.information.tooltip: @@ -677,8 +695,6 @@ rebase.branch.tooltip: text: Select branch to rebase (if branch is different from the current branch, it will be checked out first) rebase.button: text: Rebase -rebase.continue.action.name: - text: Continue Rebasing rebase.editor.action.column: text: Action rebase.editor.button: @@ -767,8 +783,6 @@ rebase.show.remote.branches.tooltip: text: If selected, remote branches are shown in drop down as well. rebase.show.tags.tooltip: text: Show tags in "from" and "onto" comboboxes. -rebase.skip.action.name: - text: Skip Commit in Rebasing rebase.title: text: Rebase branch rebase.unstructured.editor.button: @@ -795,8 +809,6 @@ rebase.validate.from: text: Va&lidate rebase.validate.from.tooltip: text: Validate "from" reference -rebasing.title: - text: Rebasing... refspec.add.all.branches: text: Add A&ll Branches refspec.add.all.branches.tooltip: @@ -927,8 +939,6 @@ ssh.password.message: text: Please enter password for user {0} ssh.password.title: text: SSH Password Login -stash.action.name: - text: Stash stash.button: text: Create Stash stash.keep.index: @@ -943,8 +953,6 @@ stash.title: text: Stash stashing.title: text: Stashing changes... -tag.action.name: - text: Tag tag.button: text: Create Tag tag.commit.label: @@ -989,10 +997,10 @@ tagging.title: text: Tagging files... task.queue.title: text: Git Operations +task.rebasing.title: + text: Rebasing... unindexed.files.changlelist.name: text: Unindexed Files -unstash.action.name: - text: UnStash unstash.branch.label: text: 'As new &branch:' unstash.branch.tooltip: diff --git a/plugin/src/main/resources/META-INF/plugin.xml b/plugin/src/main/resources/META-INF/plugin.xml index f0d98b0..c643e31 100644 --- a/plugin/src/main/resources/META-INF/plugin.xml +++ b/plugin/src/main/resources/META-INF/plugin.xml @@ -26,31 +26,28 @@ - + - - + + - - - - - - + + + + + + - - + + - - - - + + + + @@ -75,69 +72,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + From aeeb868c1b06df15c32785fc7ddae7c1e4019e98 Mon Sep 17 00:00:00 2001 From: UNV Date: Tue, 7 Oct 2025 11:44:27 +0300 Subject: [PATCH 2/2] Imports fix for RebaseActionGroup. --- .../src/main/java/consulo/git/action/RebaseActionGroup.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/src/main/java/consulo/git/action/RebaseActionGroup.java b/plugin/src/main/java/consulo/git/action/RebaseActionGroup.java index 5d75dcf..031c5eb 100644 --- a/plugin/src/main/java/consulo/git/action/RebaseActionGroup.java +++ b/plugin/src/main/java/consulo/git/action/RebaseActionGroup.java @@ -4,7 +4,10 @@ import consulo.annotation.component.ActionRef; import consulo.git.localize.GitLocalize; import consulo.versionControlSystem.distributed.repository.Repository; -import git4idea.actions.GitRebaseAbort;import git4idea.actions.GitRebaseContinue;import git4idea.actions.GitRebaseSkip;import git4idea.actions.GitRepositoryStateActionGroup; +import git4idea.actions.GitRebaseAbort; +import git4idea.actions.GitRebaseContinue; +import git4idea.actions.GitRebaseSkip; +import git4idea.actions.GitRepositoryStateActionGroup; /** * @author UNV