Various cosmetics for toolwindow empty text

GitOrigin-RevId: 167ceb6e6b1d64ff9748f236966cb25534854f07
This commit is contained in:
Dmitry Jemerov
2020-11-12 14:47:03 +00:00
committed by intellij-monorepo-bot
parent 9e011264ad
commit f3e022fce2
11 changed files with 69 additions and 38 deletions
@@ -281,5 +281,5 @@ configurable.name.code.cleanup.inspections=Code Cleanup Inspections
code.analysis.is.disabled.in.power.save.mode=Code analysis is disabled in power save mode
action.description.code.cleanup.options=Code Cleanup Options
#Please keep $action_inspect_code$ and $action_inspection_by_name$ non-translated
inspections.empty.state.pattern=To see inspection results, use $action_inspect_code$ or $action_inspection_by_name$
inspections.empty.state.pattern=$action_inspect_code$ or $action_inspection_by_name$
inspections.empty.state.help=Running inspections
@@ -8,7 +8,9 @@ import com.intellij.execution.ui.RunContentManagerImpl
import com.intellij.icons.AllIcons
import com.intellij.ide.actions.ToolWindowEmptyStateAction
import com.intellij.lang.LangBundle
import com.intellij.openapi.actionSystem.ActionManager
import com.intellij.openapi.help.HelpManager
import com.intellij.openapi.keymap.KeymapUtil
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindowId
import com.intellij.ui.SimpleTextAttributes
@@ -21,15 +23,28 @@ class ActivateRunToolWindowAction : ToolWindowEmptyStateAction(ToolWindowId.RUN,
}
override fun setupEmptyText(project: Project, text: StatusText) {
text.isCenterAlignText = false
text.appendLine(LangBundle.message("run.toolwindow.empty.text.0"))
text.appendLine(LangBundle.message("run.toolwindow.empty.text.1"))
text.appendLine(LangBundle.message("run.toolwindow.empty.text.2"))
text.appendLine(LangBundle.message("run.toolwindow.empty.text.3") + " ")
text.appendText(LangBundle.message("run.toolwindow.empty.text.4"), SimpleTextAttributes.LINK_ATTRIBUTES) {
EditConfigurationsDialog(project).show()
}
appendLaunchConfigurationText(text, project, "ChooseRunConfiguration")
text.appendLine("")
text.appendLine(AllIcons.General.ContextHelp, LangBundle.message("run.toolwindow.empty.text.help"), SimpleTextAttributes.LINK_ATTRIBUTES) {
text.appendLine(AllIcons.General.ContextHelp, LangBundle.message("run.toolwindow.empty.text.help"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES) {
HelpManager.getInstance().invokeHelp("procedures.running.run")
}
}
companion object {
fun appendLaunchConfigurationText(text: StatusText, project: Project, actionId: String) {
val shortcut = ActionManager.getInstance().getKeyboardShortcut(actionId)
val shortcutText = shortcut?.let { " (${KeymapUtil.getShortcutText(shortcut)})" } ?: ""
val line = LangBundle.message("run.toolwindow.empty.text.3", shortcutText)
text.appendLine(line.substringBefore('<'))
text.appendText(line.substringAfter('<').substringBefore('>'), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES) {
EditConfigurationsDialog(project).show()
}
text.appendText(line.substringAfter('>'))
}
}
}
@@ -457,11 +457,14 @@ intention.name.convert.number.to.with.text=Convert number to {0} ({1})
search.everywhere.calculator.group.name=Calculator
search.everywhere.calculator.result.0=Result: {0}
search.everywhere.calculator.shortcut.0={0} to copy to the clipboard
status.text.find.toolwindow.empty.state=Select element and invoke Edit | Find Usages | Find Usages{0} to see its usages
run.toolwindow.empty.text.1=To run your code, do one of the following:
status.text.find.toolwindow.empty.state.1=Use Find Usages{0} on a symbol in the editor, Project or Structure tool windows.
status.text.find.toolwindow.empty.state.2=Use Find in Files{0} to search for any text in the project.
run.toolwindow.empty.text.0=To run your code, do one of the following:
run.toolwindow.empty.text.1=\u2013 Click the Run icon in the editor gutter
run.toolwindow.empty.text.2=\u2013 Select "Run..." in the editor context menu
run.toolwindow.empty.text.3=\u2013 Create a
run.toolwindow.empty.text.4=run configuration
# The < and > characters delimit the part of text that becomes a link. {0} is the keyboard shortcut for the action.
run.toolwindow.empty.text.3=\u2013 Launch a <run configuration>{0}
run.toolwindow.empty.text.help=Running applications
group.preferences=Preferences
group.settings=Settings
@@ -475,11 +478,10 @@ action.fix.n.problems.text={0} ({1} {1,choice,0#problems|1#problem|2#problems})
label.n.problems={0} {0,choice,0#problems|1#problem|2#problems}:
suppressed=Suppressed
no.longer.valid=No longer valid
hierarchy.empty.text.1=Place the caret on a symbol
hierarchy.empty.text.2=and use one of the actions:
hierarchy.empty.text.type=Type Hierarchy {0}
hierarchy.empty.text.call=Call Hierarchy {0}
hierarchy.empty.text.method=Method Hierarchy {0}
hierarchy.empty.text=Use one of the actions on a symbol:
hierarchy.empty.text.type=Type Hierarchy ({0})
hierarchy.empty.text.call=Call Hierarchy ({0})
hierarchy.empty.text.method=Method Hierarchy ({0})
hierarchy.empty.text.help=Source code hierarchy
title.reader.mode.got.it.popup=Read library code easily
text.reader.mode.got.it.popup=The Reader mode shows documentation as formatted text, enables font ligatures, code vision hints, and more. Applies only to library and read-only files.
@@ -37,13 +37,13 @@ class ActivateInspectionResultsToolWindowAction : ToolWindowEmptyStateAction(Too
}
}
text.appendLine("")
text.appendLine(AllIcons.General.ContextHelp, InspectionsBundle.message("inspections.empty.state.help"), SimpleTextAttributes.LINK_ATTRIBUTES) {
text.appendLine(AllIcons.General.ContextHelp, InspectionsBundle.message("inspections.empty.state.help"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES) {
HelpManager.getInstance().invokeHelp("procedures.inspecting.running")
}
}
private fun appendActionLink(text: StatusText, project: Project, actionId: String, @Nls actionText: String) {
text.appendText(actionText, SimpleTextAttributes.LINK_ATTRIBUTES) {
text.appendText(actionText, SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES) {
val dataContext = FileEditorManager.getInstance(project).selectedEditor?.let { DataManager.getInstance().getDataContext(it.component) }
?: SimpleDataContext.getProjectContext(project)
val event = AnActionEvent.createFromDataContext(ActionPlaces.UNKNOWN, null, dataContext)
@@ -18,8 +18,14 @@ class ActivateFindToolWindowAction : ToolWindowEmptyStateAction(ToolWindowId.FIN
}
override fun setupEmptyText(project: Project, statusText: StatusText) {
val shortcut = ActionManager.getInstance().getKeyboardShortcut(IdeActions.ACTION_FIND_USAGES)
val shortcutText = shortcut?.let { " (${KeymapUtil.getShortcutText(shortcut)})"} ?: ""
statusText.appendText(LangBundle.message("status.text.find.toolwindow.empty.state", shortcutText));
appendWithActionShortcut(statusText, "status.text.find.toolwindow.empty.state.1", IdeActions.ACTION_FIND_USAGES)
statusText.appendLine("")
appendWithActionShortcut(statusText, "status.text.find.toolwindow.empty.state.2", IdeActions.ACTION_FIND_IN_PATH)
}
private fun appendWithActionShortcut(statusText: StatusText, key: String, actionId: String) {
val shortcut = ActionManager.getInstance().getKeyboardShortcut(actionId)
val shortcutText = shortcut?.let { " (${KeymapUtil.getShortcutText(shortcut)})" } ?: ""
statusText.appendLine(LangBundle.message(key, shortcutText));
}
}
@@ -19,8 +19,7 @@ import com.intellij.util.ui.StatusText
class ActivateHierarchyToolWindowAction : ToolWindowEmptyStateAction(ToolWindowId.HIERARCHY, AllIcons.Toolwindows.ToolWindowHierarchy) {
override fun setupEmptyText(project: Project, text: StatusText) {
text.clear()
text.appendLine(LangBundle.message("hierarchy.empty.text.1"))
text.appendLine(LangBundle.message("hierarchy.empty.text.2"))
text.appendLine(LangBundle.message("hierarchy.empty.text"))
if (LanguageTypeHierarchy.INSTANCE.hasAnyExtensions()) {
text.appendLine(LangBundle.message("hierarchy.empty.text.type", KeymapUtil.getShortcutText(IdeActions.ACTION_TYPE_HIERARCHY)))
}
@@ -31,7 +30,7 @@ class ActivateHierarchyToolWindowAction : ToolWindowEmptyStateAction(ToolWindowI
text.appendLine(LangBundle.message("hierarchy.empty.text.method", KeymapUtil.getShortcutText(IdeActions.ACTION_METHOD_HIERARCHY)))
}
text.appendLine("")
text.appendLine(AllIcons.General.ContextHelp, LangBundle.message("hierarchy.empty.text.help"), SimpleTextAttributes.LINK_ATTRIBUTES) {
text.appendLine(AllIcons.General.ContextHelp, LangBundle.message("hierarchy.empty.text.help"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES) {
HelpManager.getInstance().invokeHelp("procedures.viewinghierarchy")
}
}
@@ -61,6 +61,7 @@ public abstract class StatusText {
private boolean myHasActiveClickListeners; // calculated field for performance optimization
private boolean myShowAboveCenter = true;
private Font myFont = null;
private boolean myCenterAlignText = true;
protected StatusText(JComponent owner) {
this();
@@ -116,6 +117,14 @@ public abstract class StatusText {
myFont = font;
}
public boolean isCenterAlignText() {
return myCenterAlignText;
}
public void setCenterAlignText(boolean centerAlignText) {
myCenterAlignText = centerAlignText;
}
public void attachTo(@Nullable Component owner) {
attachTo(owner, owner);
}
@@ -260,7 +269,7 @@ public abstract class StatusText {
updateBounds(mySecondaryColumn);
}
private static void updateBounds(Column column) {
private void updateBounds(Column column) {
Dimension size = new Dimension();
for (int i = 0; i < column.fragments.size(); i++) {
Fragment fragment = column.fragments.get(i);
@@ -270,9 +279,11 @@ public abstract class StatusText {
if (i > 0) size.height += JBUIScale.scale(Y_GAP);
size.width = Math.max(size.width, d.width);
}
for (int i = 0; i < column.fragments.size(); i++) {
Fragment fragment = column.fragments.get(i);
fragment.boundsInColumn.x += (size.width - fragment.boundsInColumn.width)/2;
if (myCenterAlignText) {
for (int i = 0; i < column.fragments.size(); i++) {
Fragment fragment = column.fragments.get(i);
fragment.boundsInColumn.x += (size.width - fragment.boundsInColumn.width)/2;
}
}
column.preferredSize.setSize(size);
}
@@ -243,6 +243,7 @@ debugger.inline.watches.group.name=Inline Watches
debugger.inline.watches.edit.watch.expression.text=Edit Watch Expression
debugger.inline.watches.popup.action.add.as.inline.watch=Add as Inline Watch
debug.toolwindow.empty.text.1=To debug your code, do one of the following:
debug.toolwindow.empty.text.0=To debug your code, do one of the following:
debug.toolwindow.empty.text.1=\u2013 Click the Run icon in the editor gutter
debug.toolwindow.empty.text.2=\u2013 Select "Debug..." in the editor context menu
debug.toolwindow.empty.text.help=Debugging code
@@ -2,12 +2,10 @@
package com.intellij.execution.actions
import com.intellij.execution.executors.DefaultDebugExecutor
import com.intellij.execution.impl.EditConfigurationsDialog
import com.intellij.execution.ui.RunContentManager
import com.intellij.execution.ui.RunContentManagerImpl
import com.intellij.icons.AllIcons
import com.intellij.ide.actions.ToolWindowEmptyStateAction
import com.intellij.lang.LangBundle
import com.intellij.openapi.help.HelpManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.wm.ToolWindowId
@@ -22,14 +20,13 @@ class ActivateDebugToolWindowAction : ToolWindowEmptyStateAction(ToolWindowId.DE
}
override fun setupEmptyText(project: Project, text: StatusText) {
text.isCenterAlignText = false
text.appendLine(XDebuggerBundle.message("debug.toolwindow.empty.text.0"))
text.appendLine(XDebuggerBundle.message("debug.toolwindow.empty.text.1"))
text.appendLine(XDebuggerBundle.message("debug.toolwindow.empty.text.2"))
text.appendLine(LangBundle.message("run.toolwindow.empty.text.3") + " ")
text.appendText(LangBundle.message("run.toolwindow.empty.text.4"), SimpleTextAttributes.LINK_ATTRIBUTES) {
EditConfigurationsDialog(project).show()
}
ActivateRunToolWindowAction.appendLaunchConfigurationText(text, project, "ChooseDebugConfiguration")
text.appendLine("")
text.appendLine(AllIcons.General.ContextHelp, XDebuggerBundle.message("debug.toolwindow.empty.text.help"), SimpleTextAttributes.LINK_ATTRIBUTES) {
text.appendLine(AllIcons.General.ContextHelp, XDebuggerBundle.message("debug.toolwindow.empty.text.help"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES) {
HelpManager.getInstance().invokeHelp("procedures.debugging")
}
}
@@ -201,6 +201,6 @@ ant.error.unsupported.class.version=Unsupported class version {0}
ant.cannot.add.build.file.reason.file.is.not.xml=the file is not an xml file
ant.cannot.add.build.file.reason.file.not.ant.file=the file is not recognized as an Ant file
ant.empty.text.1=No build files added.
ant.empty.text.2=Add Ant build file
ant.empty.text.2=Add Ant build file...
ant.empty.text.help=Adding build file to project
add.ant.build.file=Add Ant build file
@@ -198,13 +198,13 @@ public class AntExplorer extends SimpleToolWindowPanel implements DataProvider,
private void setupEmptyText() {
StatusText emptyText = myTree.getEmptyText();
emptyText.appendLine(AntBundle.message("ant.empty.text.1"));
emptyText.appendLine(AntBundle.message("ant.empty.text.2"), SimpleTextAttributes.LINK_ATTRIBUTES,
emptyText.appendLine(AntBundle.message("ant.empty.text.2"), SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES,
e -> addBuildFile());
emptyText.appendLine("");
emptyText.appendLine(
AllIcons.General.ContextHelp,
AntBundle.message("ant.empty.text.help"),
SimpleTextAttributes.LINK_ATTRIBUTES,
SimpleTextAttributes.LINK_PLAIN_ATTRIBUTES,
e -> HelpManager.getInstance().invokeHelp("procedures.building.ant.add"));
}