cleanup of tabbed content action names (IDEA-79750)

This commit is contained in:
unknown
2012-01-10 13:58:53 +01:00
parent a93ec9f717
commit 1408cd1962
16 changed files with 158 additions and 18 deletions
@@ -29,6 +29,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.ui.UIBundle;
import com.intellij.ui.components.panels.NonOpaquePanel;
import com.intellij.ui.components.panels.Wrapper;
import com.intellij.ui.content.*;
@@ -650,6 +651,26 @@ public class RunnerContentUi implements ContentUI, Disposable, CellTransform.Fac
return true;
}
@Override
public String getCloseActionName() {
return UIBundle.message("tabbed.pane.close.tab.action.name");
}
@Override
public String getCloseAllButThisActionName() {
return UIBundle.message("tabbed.pane.close.all.tabs.but.this.action.name");
}
@Override
public String getPreviousContentActionName() {
return "Select Previous Tab";
}
@Override
public String getNextContentActionName() {
return "Select Next Tab";
}
public void dispose() {
}
@@ -91,6 +91,10 @@ public interface ContentManager extends Disposable, BusyObject {
* @since 5.1
*/
String getCloseAllButThisActionName();
String getPreviousContentActionName();
String getNextContentActionName();
List<AnAction> getAdditionalPopupActions(@NotNull Content content);
@@ -30,4 +30,9 @@ public interface ContentUI extends Disposable {
void beforeDispose();
boolean canChangeSelectionTo(Content content, boolean implicit);
String getCloseActionName();
String getCloseAllButThisActionName();
String getPreviousContentActionName();
String getNextContentActionName();
}
@@ -23,6 +23,7 @@ import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ShadowAction;
import com.intellij.openapi.wm.ToolWindow;
import com.intellij.openapi.wm.ToolWindowContentUiType;
import com.intellij.openapi.wm.ToolWindowManager;
import org.jetbrains.annotations.Nullable;
@@ -45,7 +46,11 @@ public class ShowContentAction extends AnAction implements DumbAware {
@Override
public void update(AnActionEvent e) {
e.getPresentation().setEnabled(getWindow(e) != null);
final ToolWindow window = getWindow(e);
e.getPresentation().setEnabled(window != null);
e.getPresentation().setText(window == null || window.getContentUiType() == ToolWindowContentUiType.TABBED
? "Show List of Tabs"
: "Show List of Views");
}
@Override
@@ -198,6 +198,17 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx {
public List<AnAction> getAdditionalPopupActions(@NotNull final Content content) { return Collections.emptyList(); }
public String getCloseActionName() { return "close"; }
public String getCloseAllButThisActionName() { return "closeallbutthis"; }
@Override
public String getPreviousContentActionName() {
return "previous";
}
@Override
public String getNextContentActionName() {
return "next";
}
public JComponent getComponent() { return new JLabel(); }
public Content getContent(final JComponent component) { return null; }
@Nullable
@@ -185,7 +185,7 @@ public final class ToolWindowImpl implements ToolWindowEx {
}
}
public final void hide(final Runnable runnable) {
public final void hide(@Nullable final Runnable runnable) {
ApplicationManager.getApplication().assertIsDispatchThread();
myToolWindowManager.hideToolWindow(myId, false);
if (runnable != null) {
@@ -434,7 +434,7 @@ public final class ToolWindowImpl implements ToolWindowEx {
}
public void showContentPopup(InputEvent inputEvent) {
myContentUI.toggleContentPopup(inputEvent);
myContentUI.toggleContentPopup();
}
@Override
@@ -164,4 +164,24 @@ class ComboContentLayout extends ContentLayout {
public Component getComponentFor(Content content) {
return null;
}
@Override
public String getCloseActionName() {
return "Close View";
}
@Override
public String getCloseAllButThisActionName() {
return "Close Other Views";
}
@Override
public String getPreviousContentActionName() {
return "Select Previous View";
}
@Override
public String getNextContentActionName() {
return "Select Next View";
}
}
@@ -52,7 +52,7 @@ public class ContentComboLabel extends BaseLabel {
super.processMouseEvent(e);
if (UIUtil.isActionClick(e)) {
myUi.toggleContentPopup(e);
myUi.toggleContentPopup();
}
}
@@ -101,4 +101,9 @@ abstract class ContentLayout {
public abstract Component getComponentFor(Content content);
public abstract String getCloseActionName();
public abstract String getCloseAllButThisActionName();
public abstract String getPreviousContentActionName();
public abstract String getNextContentActionName();
}
@@ -16,6 +16,7 @@
package com.intellij.openapi.wm.impl.content;
import com.intellij.openapi.ui.popup.ListPopup;
import com.intellij.ui.UIBundle;
import com.intellij.ui.awt.RelativeRectangle;
import com.intellij.ui.content.Content;
import com.intellij.ui.content.ContentManager;
@@ -459,4 +460,23 @@ class TabContentLayout extends ContentLayout {
public Component getComponentFor(Content content) {
return myContent2Tabs.get(content);
}
@Override
public String getCloseActionName() {
return UIBundle.message("tabbed.pane.close.tab.action.name");
}
@Override
public String getCloseAllButThisActionName() {
return UIBundle.message("tabbed.pane.close.all.tabs.but.this.action.name");
}
@Override
public String getPreviousContentActionName() {
return "Select Previous Tab";
}
@Override
public String getNextContentActionName() {
return "Select Next Tab";
}
}
@@ -30,6 +30,7 @@ import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.ToolWindowContentUiType;
import com.intellij.openapi.wm.impl.ToolWindowImpl;
import com.intellij.ui.PopupHandler;
import com.intellij.ui.UIBundle;
import com.intellij.ui.awt.RelativeRectangle;
import com.intellij.ui.content.*;
import com.intellij.ui.content.tabs.PinToolwindowTabAction;
@@ -259,7 +260,27 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
return true;
}
void initMouseListeners(final JComponent c, final ToolWindowContentUi ui) {
@Override
public String getCloseActionName() {
return getCurrentLayout().getCloseActionName();
}
@Override
public String getCloseAllButThisActionName() {
return getCurrentLayout().getCloseAllButThisActionName();
}
@Override
public String getPreviousContentActionName() {
return getCurrentLayout().getPreviousContentActionName();
}
@Override
public String getNextContentActionName() {
return getCurrentLayout().getNextContentActionName();
}
static void initMouseListeners(final JComponent c, final ToolWindowContentUi ui) {
if (c.getClientProperty(ui) != null) return;
@@ -311,7 +332,6 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
}
private void initActionGroup(DefaultActionGroup group, final Content content) {
group.add(myShowContent);
group.addSeparator();
group.add(new TabbedContentAction.CloseAction(content));
group.add(myCloseAllAction);
@@ -324,6 +344,7 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
group.add(myNextTabAction);
group.add(myPreviousTabAction);
group.add(myShowContent);
group.addSeparator();
}
@@ -422,7 +443,7 @@ public class ToolWindowContentUi extends JPanel implements ContentUI, PropertyCh
return getCurrentLayout() == layout;
}
public void toggleContentPopup(InputEvent inputEvent) {
public void toggleContentPopup() {
if (myShouldNotShowPopup) {
myShouldNotShowPopup = false;
return;
@@ -17,10 +17,7 @@ package com.intellij.ui.content;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.ui.PopupHandler;
import com.intellij.ui.TabbedPane;
import com.intellij.ui.TabbedPaneImpl;
import com.intellij.ui.TabbedPaneWrapper;
import com.intellij.ui.*;
import com.intellij.ui.content.tabs.PinToolwindowTabAction;
import com.intellij.ui.content.tabs.TabbedContentAction;
import com.intellij.util.IJSwingUtilities;
@@ -324,6 +321,26 @@ public class TabbedPaneContentUI implements ContentUI, PropertyChangeListener {
return true;
}
@Override
public String getCloseActionName() {
return UIBundle.message("tabbed.pane.close.tab.action.name");
}
@Override
public String getCloseAllButThisActionName() {
return UIBundle.message("tabbed.pane.close.all.tabs.but.this.action.name");
}
@Override
public String getPreviousContentActionName() {
return "Select Previous Tab";
}
@Override
public String getNextContentActionName() {
return "Select Next Tab";
}
public void dispose() {
}
}
@@ -366,12 +366,21 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
}
public String getCloseActionName() {
return UIBundle.message("tabbed.pane.close.tab.action.name");
return myUI.getCloseActionName();
}
public String getCloseAllButThisActionName() {
return UIBundle.message("tabbed.pane.close.all.tabs.but.this.action.name");
return myUI.getCloseAllButThisActionName();
}
@Override
public String getPreviousContentActionName() {
return myUI.getPreviousContentActionName();
}
@Override
public String getNextContentActionName() {
return myUI.getNextContentActionName();
}
public List<AnAction> getAdditionalPopupActions(@NotNull final Content content) {
@@ -147,6 +147,7 @@ public abstract class TabbedContentAction extends AnAction implements DumbAware
public void update(AnActionEvent e) {
e.getPresentation().setEnabled(myManager.getContentCount() > 1);
e.getPresentation().setText(myManager.getNextContentActionName());
}
}
@@ -161,6 +162,7 @@ public abstract class TabbedContentAction extends AnAction implements DumbAware
public void update(AnActionEvent e) {
e.getPresentation().setEnabled(myManager.getContentCount() > 1);
e.getPresentation().setText(myManager.getPreviousContentActionName());
}
}
@@ -736,10 +736,10 @@ action.ToggleFloatingMode.text=Floating _Mode
action.ToggleFloatingMode.description=Float/unfloat active tool window
action.ToggleSideMode.text=Split Mode
action.ToggleSideMode.description=Tool windows split mode on/off
action.ToggleContentUiTypeMode.text=Tabbed Content
action.ToggleContentUiTypeMode.text=Show Views as Tabs
action.ToggleContentUiTypeMode.description=Toggle between tabbed/combo presentation of contents
action.ShowContent.text=Show Content
action.ShowContent.description=Show tool window content popup
action.ShowContent.text=Show List of Tabs
action.ShowContent.description=Show a popup with the list of toolwindow tabs
group.ResizeToolWindowGroup.text=Resize
action.ResizeToolWindowLeft.text=Stretch to Left
action.ResizeToolWindowLeft.description=Resize active tool window to the left
@@ -33,7 +33,7 @@ tabbed.pane.close.all.but.this.action.name=Close All But This
tabbed.pane.pin.tab.action.name=Pin Tab
tabbed.pane.pin.tab.action.description=Pin tool window tab
tabbed.pane.close.tab.action.name=Close Tab
tabbed.pane.close.all.tabs.but.this.action.name=Close All Tabs But This
tabbed.pane.close.all.tabs.but.this.action.name=Close Other Tabs
file.is.read.only.message.text=File ''{0} is read-only.
files.are.read.only.message.text=Files {0} are read-only
error.dialog.title=Error