Actions 'Close all to the left/right': fix test; support left/right tab placement

This commit is contained in:
Vassiliy.Kudryashov
2018-07-25 18:56:53 +03:00
parent e469e567c2
commit cddef8e814
5 changed files with 29 additions and 1 deletions
@@ -2,6 +2,8 @@
package com.intellij.ide.actions;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.ui.UISettings;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.fileEditor.impl.EditorComposite;
@@ -10,6 +12,8 @@ import com.intellij.openapi.fileEditor.impl.EditorWithProviderComposite;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.VirtualFile;
import javax.swing.*;
public class CloseAllEditorsToTheLeftAction extends CloseEditorsActionBase {
@Override
@@ -35,6 +39,19 @@ public class CloseAllEditorsToTheLeftAction extends CloseEditorsActionBase {
return Comparing.equal(cursorFile, candidateFile);//candidate is located before the clicked one
}
@Override
public void update(AnActionEvent event) {
super.update(event);
int tabPlacement = UISettings.getInstance().getEditorTabPlacement();
if (tabPlacement == SwingConstants.LEFT || tabPlacement == SwingConstants.RIGHT) {
event.getPresentation().setText(IdeBundle.message(getAlternativeTextKey()));
}
}
protected String getAlternativeTextKey() {
return "action.close.all.editors.above";
}
@Override
protected String getPresentationText(boolean inSplitter) {
return IdeBundle.message("action.close.all.editors.to.the.left");
@@ -11,6 +11,11 @@ public class CloseAllEditorsToTheRightAction extends CloseAllEditorsToTheLeftAct
return Comparing.equal(cursorFile, contextFile);//candidate is located after the clicked one
}
@Override
protected String getAlternativeTextKey() {
return "action.close.all.editors.below";
}
@Override
protected String getPresentationText(boolean inSplitter) {
return IdeBundle.message("action.close.all.editors.to.the.right");
@@ -974,6 +974,10 @@ action.CloseAllUnmodifiedEditors.text=Close _Unmodified
action.CloseAllUnmodifiedEditors.description=Close all non-modified editors
action.CloseAllUnpinnedEditors.text=Close All but Pinned
action.CloseAllUnpinnedEditors.description=Close all editors which are not pinned
action.CloseAllToTheRight.text=Close All to the Right
action.CloseAllToTheRight.description=Close all editor to the right
action.CloseAllToTheLeft.text=Close All to the Left
action.CloseAllToTheLeft.description=Close all editor to the left
action.CloseContent.text=_Close
action.CloseContent.description=Close currently focused content
group.EditorTabsGroup.text=Editor _Tabs
@@ -359,6 +359,8 @@ action.close.all.unpinned.editors.in.tab.group=Close All but Pinned In Group
action.close.all.unpinned.editors=Close All but Pinned
action.close.all.editors.to.the.right=Close All to the Right
action.close.all.editors.to.the.left=Close All to the Left
action.close.all.editors.above=Close All Above
action.close.all.editors.below=Close All Below
action.copy.path=C_opy Path
action.copy.paths=C_opy Paths
message.reference.to.fqn.has.been.copied=Reference to ''{0}'' has been copied.
@@ -503,8 +503,8 @@
<action id="CloseAllEditorsButActive" class="com.intellij.ide.actions.CloseAllEditorsButActiveAction"/>
<action id="CloseAllEditors" class="com.intellij.ide.actions.CloseAllEditorsAction"/>
<action id="CloseAllUnpinnedEditors" class="com.intellij.ide.actions.CloseAllUnpinnedEditorsAction"/>
<action id="CloseAllToTheRight" class="com.intellij.ide.actions.CloseAllEditorsToTheRightAction"/>
<action id="CloseAllToTheLeft" class="com.intellij.ide.actions.CloseAllEditorsToTheLeftAction"/>
<action id="CloseAllToTheRight" class="com.intellij.ide.actions.CloseAllEditorsToTheRightAction"/>
</group>
<separator/>
<action id="ReopenClosedTab" class="com.intellij.openapi.fileEditor.impl.ReopenClosedTabAction" />