localize AnActionButton(String, Icon)

GitOrigin-RevId: af355aba5512e378f7780ce8407935c6b081d0ab
This commit is contained in:
Dmitry.Krasilschikov
2020-01-26 17:04:43 +00:00
committed by intellij-monorepo-bot
parent 236eb26697
commit 87fa2b967a
18 changed files with 61 additions and 26 deletions
@@ -3,6 +3,7 @@ package com.intellij.openapi.roots.ui.configuration.libraryEditor;
import com.intellij.icons.AllIcons;
import com.intellij.ide.DataManager;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.util.treeView.AbstractTreeStructure;
import com.intellij.ide.util.treeView.NodeDescriptor;
import com.intellij.openapi.Disposable;
@@ -179,7 +180,7 @@ public class LibraryRootsComponent implements Disposable, LibraryEditorComponent
}
myAddExcludedRootActionButton = new AddExcludedRootActionButton();
toolbarDecorator.addExtraAction(myAddExcludedRootActionButton);
toolbarDecorator.addExtraAction(new AnActionButton("Remove", IconUtil.getRemoveIcon()) {
toolbarDecorator.addExtraAction(new AnActionButton(() -> IdeBundle.message("action.AnActionButton.text.remove"), IconUtil.getRemoveIcon()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
final List<Object> selectedElements = getSelectedElements();
@@ -114,7 +114,8 @@ public class AnnotationsPanel {
}
final AnActionButton selectButton =
new AnActionButton("Select annotation used for code generation", AllIcons.Actions.Checked) {
new AnActionButton(() -> CodeInsightBundle.message("action.AnActionButton.text.select.annotation.used.for.code.generation"),
AllIcons.Actions.Checked) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
String selectedValue = getSelectedAnnotation();
@@ -588,7 +588,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
})
.disableDownAction()
.disableUpAction()
.addExtraAction(new AnActionButton("Duplicate", AllIcons.Actions.Copy) {
.addExtraAction(new AnActionButton(() -> CodeInsightBundle.message("action.AnActionButton.Template.list.text.duplicate"), AllIcons.Actions.Copy) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
copyRow();
@@ -598,7 +598,7 @@ public class TemplateListPanel extends JPanel implements Disposable {
public void updateButton(@NotNull AnActionEvent e) {
e.getPresentation().setEnabled(getTemplate(getSingleSelectedIndex()) != null);
}
}).addExtraAction(new AnActionButton("Restore deleted defaults", AllIcons.Actions.Rollback) {
}).addExtraAction(new AnActionButton(() -> CodeInsightBundle.message("action.AnActionButton.text.restore.deleted.defaults"), AllIcons.Actions.Rollback) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
TemplateSettings.getInstance().reset();
@@ -114,7 +114,7 @@ public class PostfixTemplatesConfigurable implements SearchableConfigurable, Edi
}
private AnActionButton duplicateAction() {
AnActionButton button = new AnActionButton("Duplicate", PlatformIcons.COPY_ICON) {
AnActionButton button = new AnActionButton(() -> CodeInsightBundle.message("action.AnActionButton.text.duplicate"), PlatformIcons.COPY_ICON) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
if (myCheckboxTree != null) {
@@ -1,6 +1,7 @@
// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.profile.codeInspection.ui;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInspection.ex.InspectionProfileImpl;
import com.intellij.icons.AllIcons;
import com.intellij.ide.util.scopeChooser.ScopeChooserConfigurable;
@@ -55,7 +56,7 @@ public class ScopesOrderDialog extends DialogWrapper {
public void run(AnActionButton anActionButton) {
ListUtil.moveSelectedItemsUp(myOptionsList);
}
}).addExtraAction(new AnActionButton("Edit Scopes", AllIcons.Actions.Edit) {
}).addExtraAction(new AnActionButton(() -> CodeInsightBundle.message("action.AnActionButton.text.edit.scopes"), AllIcons.Actions.Edit) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
ShowSettingsUtil.getInstance().editConfigurable(project, new ScopeChooserConfigurable(project));
@@ -4,6 +4,7 @@ package com.intellij.ui.tabs;
import com.intellij.codeEditor.printing.CodeEditorBundle;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.ui.UISettings;
import com.intellij.ide.util.scopeChooser.EditScopesDialog;
import com.intellij.openapi.Disposable;
@@ -80,7 +81,7 @@ public class FileColorsConfigurablePanel extends JPanel implements Disposable {
};
final JPanel panel = ToolbarDecorator.createDecorator(myLocalTable)
.addExtraAction(new AnActionButton("Share", AllIcons.Actions.Share) {
.addExtraAction(new AnActionButton(() -> IdeBundle.message("action.AnActionButton.text.share"), AllIcons.Actions.Share) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
share();
@@ -116,7 +117,7 @@ public class FileColorsConfigurablePanel extends JPanel implements Disposable {
final JPanel sharedPanel = new JPanel(new BorderLayout());
sharedPanel.setBorder(IdeBorderFactory.createTitledBorder(CodeEditorBundle.message("file.colors.shared.colors"), false, JBUI.insetsTop(8)).setShowLine(false));
final JPanel shared = ToolbarDecorator.createDecorator(mySharedTable)
.addExtraAction(new AnActionButton("Unshare", AllIcons.Actions.Unshare) {
.addExtraAction(new AnActionButton(() -> IdeBundle.message("action.AnActionButton.text.unshare"), AllIcons.Actions.Unshare) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
unshare();
@@ -3,6 +3,7 @@ package com.intellij.webcore.packaging;
import com.google.common.collect.Lists;
import com.intellij.ide.ActivityTracker;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.application.Application;
@@ -83,14 +84,14 @@ public class InstalledPackagesPanel extends JPanel {
myPackagesTable.getTableHeader().setReorderingAllowed(false);
new TableSpeedSearch(myPackagesTable);
myUpgradeButton = new DumbAwareActionButton("Upgrade", IconUtil.getMoveUpIcon()) {
myUpgradeButton = new DumbAwareActionButton(() -> IdeBundle.message("action.AnActionButton.text.upgrade"), IconUtil.getMoveUpIcon()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
PackageManagementUsageCollector.triggerUpgradePerformed(myProject, myPackageManagementService);
upgradeAction();
}
};
myInstallButton = new DumbAwareActionButton("Install", IconUtil.getAddIcon()) {
myInstallButton = new DumbAwareActionButton(() -> IdeBundle.message("action.AnActionButton.text.install"), IconUtil.getAddIcon()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
PackageManagementUsageCollector.triggerBrowseAvailablePackagesPerformed(myProject, myPackageManagementService);
@@ -101,7 +102,7 @@ public class InstalledPackagesPanel extends JPanel {
}
};
myInstallButton.setShortcut(CommonShortcuts.getNew());
myUninstallButton = new DumbAwareActionButton("Uninstall", IconUtil.getRemoveIcon()) {
myUninstallButton = new DumbAwareActionButton(() -> IdeBundle.message("action.AnActionButton.text.uninstall"), IconUtil.getRemoveIcon()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
PackageManagementUsageCollector.triggerUninstallPerformed(myProject, myPackageManagementService);
@@ -2,6 +2,7 @@
package com.intellij.webcore.packaging;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.plugins.PluginManagerMain;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.application.Application;
@@ -85,7 +86,8 @@ public class ManagePackagesDialog extends DialogWrapper {
myNotificationArea = new PackagesNotificationPanel();
myNotificationsAreaPlaceholder.add(myNotificationArea.getComponent(), BorderLayout.CENTER);
final AnActionButton reloadButton = new AnActionButton("Reload List of Packages", AllIcons.Actions.Refresh) {
final AnActionButton reloadButton =
new AnActionButton(() -> IdeBundle.message("action.AnActionButton.text.reload.list.of.packages"), AllIcons.Actions.Refresh) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
myPackages.setPaintBusy(true);
@@ -22,6 +22,7 @@ import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.function.Supplier;
/**
* @author yole
@@ -29,7 +30,11 @@ import javax.swing.*;
public abstract class ToggleActionButton extends AnActionButton implements Toggleable {
public ToggleActionButton(@Nls(capitalization = Nls.Capitalization.Title) String text,
Icon icon) {
super(text, null, icon);
super(() -> text, Presentation.NULL_STRING, icon);
}
public ToggleActionButton(@NotNull Supplier<String> text, Icon icon) {
super(text, Presentation.NULL_STRING, icon);
}
/**
@@ -344,7 +344,9 @@ public class KeymapPanel extends JPanel implements SearchableConfigurable, Confi
}
});
myShowOnlyConflictsButton = new ToggleActionButton("Show conflicts with system shortcuts", AllIcons.General.ShowWarning) {
myShowOnlyConflictsButton =
new ToggleActionButton(() -> KeyMapBundle.message("action.AnActionButton.text.show.conflicts.with.system.shortcuts"),
AllIcons.General.ShowWarning) {
@Override
public boolean isSelected(AnActionEvent e) {
return myShowOnlyConflicts;
@@ -66,7 +66,8 @@ class QuickListPanel {
}
}
})
.addExtraAction(new AnActionButton("Add Separator", AllIcons.General.SeparatorH) {
.addExtraAction(new AnActionButton(() -> KeyMapBundle.message("action.AnActionButton.text.add.separator"),
AllIcons.General.SeparatorH) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
actionsModel.add(QuickList.SEPARATOR_ID);
@@ -687,4 +687,9 @@ settings.inlay.java.inheritors=Inheritors
settings.inlay.java.method.chains=Method chains
checkbox.apply.to.the.&topmost.expression=Apply to the &topmost expression
action.DumbAware.TemplateListPanel.text.restore.defaults=Restore defaults
action.DumbAware.TemplateListPanel.description.restore.default.setting=Restore default setting for the selected templates
action.DumbAware.TemplateListPanel.description.restore.default.setting=Restore default setting for the selected templates
action.AnActionButton.text.select.annotation.used.for.code.generation=Select annotation used for code generation
action.AnActionButton.text.duplicate=Duplicate
action.AnActionButton.text.edit.scopes=Edit Scopes
action.AnActionButton.Template.list.text.duplicate=Duplicate
action.AnActionButton.text.restore.deleted.defaults=Restore deleted defaults
@@ -1705,4 +1705,11 @@ action.DumbAware.TerminalView.text.new.session=New Session
action.DumbAware.TerminalView.description.create.new.session=Create new session
action.NotificationAction.JpsCachesDummyProjectComponent.text.disable.property=Disable Property
action.NotificationAction.JpsCachesDummyProjectComponent.text.dont.ask=Don't Ask Again
action.NotificationAction.JpsOutputLoaderManager.text.update.caches=Update Caches
action.NotificationAction.JpsOutputLoaderManager.text.update.caches=Update Caches
action.AnActionButton.text.remove=Remove
action.AnActionButton.text.share=Share
action.AnActionButton.text.unshare=Unshare
action.AnActionButton.text.upgrade=Upgrade
action.AnActionButton.text.install=Install
action.AnActionButton.text.uninstall=Uninstall
action.AnActionButton.text.reload.list.of.packages=Reload List of Packages
@@ -114,3 +114,5 @@ scope.view.popup.menu=Scope View Popup Menu
navigation.bar.popup.menu=Navigation Bar Popup Menu
navigation.bar.toolbar=Navigation Bar Toolbar
keymap.show.f.on.touch.bar=Show F1, F2, etc. keys on the Touch Bar (requires restart)
action.AnActionButton.text.show.conflicts.with.system.shortcuts=Show conflicts with system shortcuts
action.AnActionButton.text.add.separator=Add Separator
@@ -723,4 +723,6 @@ action.NotificationAction.VcsRootProblemNotifier.text.configure=Configure...
action.NotificationAction.AllVcses.text.install=Install
action.NotificationAction.AllVcses.text.read.more=Read More
action.NotificationAction.AllVcses.text.open.plugin.page=Open Plugin Page
action.NotificationAction.InactiveRangesDamagedNotification.text.view.changes=View Changes...
action.NotificationAction.InactiveRangesDamagedNotification.text.view.changes=View Changes...
action.AnActionButton.text.add.jira.pattern=Add JIRA Pattern
action.AnActionButton.text.add.youtrack.pattern=Add YouTrack Pattern
@@ -100,7 +100,7 @@ public class IssueNavigationConfigurationPanel extends JPanel implements Searcha
myModel.fireTableDataChanged();
}
}
}).addExtraAction(new DumbAwareActionButton("Add JIRA Pattern", IconUtil.getAddJiraPatternIcon()) {
}).addExtraAction(new DumbAwareActionButton(() -> VcsBundle.message("action.AnActionButton.text.add.jira.pattern"), IconUtil.getAddJiraPatternIcon()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
String s = Messages.showInputDialog(IssueNavigationConfigurationPanel.this, "Enter JIRA installation URL:",
@@ -114,7 +114,8 @@ public class IssueNavigationConfigurationPanel extends JPanel implements Searcha
myLinks.add(new IssueNavigationLink("[A-Z]+\\-\\d+", s + "browse/$0"));
myModel.fireTableDataChanged();
}
}).addExtraAction(new DumbAwareActionButton("Add YouTrack Pattern", IconUtil.getAddYouTrackPatternIcon()) {
}).addExtraAction(new DumbAwareActionButton(() -> VcsBundle.message("action.AnActionButton.text.add.youtrack.pattern"),
IconUtil.getAddYouTrackPatternIcon()) {
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
String s = Messages.showInputDialog(IssueNavigationConfigurationPanel.this, "Enter YouTrack installation URL:",
@@ -1045,4 +1045,6 @@ settings.default.remote.interpreter=Default Python Remote Interpreter
action.DumbAware.PydevConsoleRunnerImpl.text.stop.console=Stop Console
action.DumbAware.PydevConsoleRunnerImpl.description.stop.python.console=Stop Python Console
action.DumbAware.ConcurrencyToolWindowPanel.text.stop.process=Stop process
action.DumbAware.ConcurrencyToolWindowPanel.description.stop.process=Stop process
action.DumbAware.ConcurrencyToolWindowPanel.description.stop.process=Stop process
action.AnActionButton.text.use.conda.package.manager=Use Conda Package Manager
action.AnActionButton.text.show.early.releases=Show Early Releases
@@ -31,10 +31,10 @@ import com.intellij.webcore.packaging.InstalledPackage;
import com.intellij.webcore.packaging.InstalledPackagesPanel;
import com.intellij.webcore.packaging.PackageManagementService;
import com.intellij.webcore.packaging.PackagesNotificationPanel;
import com.jetbrains.python.PyBundle;
import com.jetbrains.python.packaging.*;
import com.jetbrains.python.sdk.PythonSdkUtil;
import icons.PythonIcons;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -42,6 +42,7 @@ import javax.swing.*;
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
/**
* @author yole
@@ -195,7 +196,7 @@ public class PyInstalledPackagesPanel extends InstalledPackagesPanel {
@Override
protected ToggleActionButton @NotNull [] getExtraActions() {
final ToggleActionButton useCondaButton = new DumbAwareToggleActionButton("Use Conda Package Manager", PythonIcons.Python.Anaconda) {
final ToggleActionButton useCondaButton = new DumbAwareToggleActionButton(() -> PyBundle.message("action.AnActionButton.text.use.conda.package.manager"), PythonIcons.Python.Anaconda) {
@Override
public boolean isSelected(AnActionEvent e) {
final Sdk sdk = getSelectedSdk();
@@ -221,7 +222,8 @@ public class PyInstalledPackagesPanel extends InstalledPackagesPanel {
}
};
final ToggleActionButton showEarlyReleasesButton = new DumbAwareToggleActionButton("Show Early Releases", AllIcons.Actions.Show) {
final ToggleActionButton showEarlyReleasesButton =
new DumbAwareToggleActionButton(() -> PyBundle.message("action.AnActionButton.text.show.early.releases"), AllIcons.Actions.Show) {
@Override
public boolean isSelected(AnActionEvent e) {
return PyPackagingSettings.getInstance(myProject).earlyReleasesAsUpgrades;
@@ -238,8 +240,7 @@ public class PyInstalledPackagesPanel extends InstalledPackagesPanel {
}
private abstract static class DumbAwareToggleActionButton extends ToggleActionButton implements DumbAware {
private DumbAwareToggleActionButton(@Nls(capitalization = Nls.Capitalization.Title) String text,
Icon icon) {
private DumbAwareToggleActionButton(@NotNull Supplier<String> text, Icon icon) {
super(text, icon);
}
}