From 2ed00595524e610b987e5cb2ebf5767d88668b20 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 30 Jan 2020 18:51:42 +0300 Subject: [PATCH] cleanup: replace usages of some properties from CommonBundle by calls of corresponding methods This simplifies code and make it easier to analyse usages of properties from CommonBundle.properties (for IDEA-203640). GitOrigin-RevId: 56c26a2dfaaffa8e2cf58406f13f6a69513977b7 --- .../com/intellij/debugger/actions/PopFrameAction.java | 2 +- .../projectRoot/ModuleStructureConfigurable.java | 8 ++++---- .../intellij/projectImport/ProjectOpenProcessorBase.java | 2 +- .../ex/GlobalJavaInspectionContextImpl.java | 4 ++-- .../intellij/ide/actions/CreatePackageInfoAction.java | 9 ++++----- .../openapi/diff/impl/dir/DirDiffTableModel.java | 3 ++- .../com/intellij/execution/impl/ExecutionManagerImpl.kt | 4 ++-- .../ide/util/projectWizard/ExistingModuleLoader.java | 2 +- .../com/intellij/ide/actions/EditCustomSettingsAction.kt | 4 ++-- .../impl/actions/ShowDelayedMessageInternalAction.java | 2 +- .../openapi/application/JBProtocolShutdownCommand.java | 2 +- .../openapi/application/impl/ApplicationImpl.java | 4 ++-- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/actions/PopFrameAction.java b/java/debugger/impl/src/com/intellij/debugger/actions/PopFrameAction.java index e909c542d09c..ba2ab186c0d2 100644 --- a/java/debugger/impl/src/com/intellij/debugger/actions/PopFrameAction.java +++ b/java/debugger/impl/src/com/intellij/debugger/actions/PopFrameAction.java @@ -119,7 +119,7 @@ public class PopFrameAction extends DebuggerAction implements DumbAware { .icon(Messages.getWarningIcon()) .yesText(DebuggerBundle.message("button.execute.finally")) .noText(DebuggerBundle.message("button.drop.anyway")) - .cancelText(CommonBundle.message("button.cancel")) + .cancelText(CommonBundle.getCancelButtonText()) .doNotAsk( new DialogWrapper.DoNotAskOption() { @Override diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java index 2fab92977103..b764784e33a1 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/projectRoot/ModuleStructureConfigurable.java @@ -926,25 +926,25 @@ public class ModuleStructureConfigurable extends BaseStructureConfigurable imple dialogBuilder.setOkOperation(() -> { final String name = component.getNameValue(); if (name.isEmpty()) { - Messages.showErrorDialog(ProjectBundle.message("enter.module.copy.name.error.message"), CommonBundle.message("title.error")); + Messages.showErrorDialog(ProjectBundle.message("enter.module.copy.name.error.message"), CommonBundle.getErrorTitle()); return; } if (getModule(name) != null) { Messages - .showErrorDialog(ProjectBundle.message("module.0.already.exists.error.message", name), CommonBundle.message("title.error")); + .showErrorDialog(ProjectBundle.message("module.0.already.exists.error.message", name), CommonBundle.getErrorTitle()); return; } if (component.getPath().isEmpty()) { Messages.showErrorDialog(IdeBundle.message("prompt.enter.project.file.location", modulePresentation), - CommonBundle.message("title.error")); + CommonBundle.getErrorTitle()); return; } if (!ProjectWizardUtil .createDirectoryIfNotExists(IdeBundle.message("directory.project.file.directory", modulePresentation), component.getPath(), true)) { Messages.showErrorDialog(ProjectBundle.message("path.0.is.invalid.error.message", component.getPath()), - CommonBundle.message("title.error")); + CommonBundle.getErrorTitle()); return; } dialogBuilder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE); diff --git a/java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.java b/java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.java index dd692694810e..718756155cc9 100644 --- a/java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.java +++ b/java/idea-ui/src/com/intellij/projectImport/ProjectOpenProcessorBase.java @@ -183,7 +183,7 @@ public abstract class ProjectOpenProcessorBase IdeBundle.message("title.open.project"), IdeBundle.message("project.import.open.existing.openExisting"), IdeBundle.message("project.import.open.existing.reimport"), - CommonBundle.message("button.cancel"), + CommonBundle.getCancelButtonText(), Messages.getQuestionIcon()); if (result == Messages.CANCEL) return null; shouldOpenExisting = result == Messages.YES; diff --git a/java/java-impl/src/com/intellij/codeInspection/ex/GlobalJavaInspectionContextImpl.java b/java/java-impl/src/com/intellij/codeInspection/ex/GlobalJavaInspectionContextImpl.java index ac6aceb748da..70b1c09182d3 100644 --- a/java/java-impl/src/com/intellij/codeInspection/ex/GlobalJavaInspectionContextImpl.java +++ b/java/java-impl/src/com/intellij/codeInspection/ex/GlobalJavaInspectionContextImpl.java @@ -110,12 +110,12 @@ public class GlobalJavaInspectionContextImpl extends GlobalJavaInspectionContext if (online) { if (modules.length == 0) { Messages.showMessageDialog(project, InspectionsBundle.message("inspection.no.modules.error.message"), - CommonBundle.message("title.error"), Messages.getErrorIcon()); + CommonBundle.getErrorTitle(), Messages.getErrorIcon()); return false; } if (isBadSdk(project, modules)) { Messages.showMessageDialog(project, InspectionsBundle.message("inspection.no.jdk.error.message"), - CommonBundle.message("title.error"), Messages.getErrorIcon()); + CommonBundle.getErrorTitle(), Messages.getErrorIcon()); SdkPopupFactory .newBuilder() diff --git a/java/java-impl/src/com/intellij/ide/actions/CreatePackageInfoAction.java b/java/java-impl/src/com/intellij/ide/actions/CreatePackageInfoAction.java index 1ffba33c57ab..68faa8e49783 100644 --- a/java/java-impl/src/com/intellij/ide/actions/CreatePackageInfoAction.java +++ b/java/java-impl/src/com/intellij/ide/actions/CreatePackageInfoAction.java @@ -27,7 +27,6 @@ import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.actionSystem.LangDataKeys; -import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.ProjectFileIndex; import com.intellij.openapi.roots.ProjectRootManager; @@ -69,10 +68,10 @@ public class CreatePackageInfoAction extends CreateFromTemplateActionBase { } else if (directory.findFile("package.html") != null) { if (Messages.showOkCancelDialog(CommonDataKeys.PROJECT.getData(dataContext), - IdeBundle.message("error.package.already.contains.package.html", aPackage.getQualifiedName()), - IdeBundle.message("error.package.html.found.title"), - IdeBundle.message("button.create"), CommonBundle.message("button.cancel"), - Messages.getQuestionIcon()) != Messages.OK) { + IdeBundle.message("error.package.already.contains.package.html", aPackage.getQualifiedName()), + IdeBundle.message("error.package.html.found.title"), + IdeBundle.message("button.create"), CommonBundle.getCancelButtonText(), + Messages.getQuestionIcon()) != Messages.OK) { return null; } } diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java index e0db4f80b856..e52546673621 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java @@ -789,7 +789,8 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode } private boolean confirmDeletion(int count) { - return MessageDialogBuilder.yesNo("Confirm Delete", "Delete " + count + " items?").project(myProject).yesText("Delete").noText(CommonBundle.message("button.cancel")).doNotAsk( + return MessageDialogBuilder.yesNo("Confirm Delete", "Delete " + count + " items?").project(myProject).yesText("Delete").noText( + CommonBundle.getCancelButtonText()).doNotAsk( new DialogWrapper.DoNotAskOption() { @Override public boolean isToBeShown() { diff --git a/platform/execution-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.kt b/platform/execution-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.kt index ec0ed69c53e3..cfda40216b13 100644 --- a/platform/execution-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.kt +++ b/platform/execution-impl/src/com/intellij/execution/impl/ExecutionManagerImpl.kt @@ -672,7 +672,7 @@ private fun userApprovesStopForSameTypeConfigurations(project: Project, configNa ExecutionBundle.message("rerun.singleton.confirmation.message", configName, instancesCount), ExecutionBundle.message("process.is.running.dialog.title", configName), ExecutionBundle.message("rerun.confirmation.button.text"), - CommonBundle.message("button.cancel"), + CommonBundle.getCancelButtonText(), Messages.getQuestionIcon(), option) == Messages.OK } @@ -718,7 +718,7 @@ private fun userApprovesStopForIncompatibleConfigurations(project: Project, configName, names.toString(), runningIncompatibleDescriptors.size), ExecutionBundle.message("incompatible.configuration.is.running.dialog.title", runningIncompatibleDescriptors.size), ExecutionBundle.message("stop.incompatible.confirmation.button.text"), - CommonBundle.message("button.cancel"), + CommonBundle.getCancelButtonText(), Messages.getQuestionIcon(), option) == Messages.OK } diff --git a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ExistingModuleLoader.java b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ExistingModuleLoader.java index 534869f8bbd3..e136ac582651 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ExistingModuleLoader.java +++ b/platform/lang-impl/src/com/intellij/ide/util/projectWizard/ExistingModuleLoader.java @@ -96,7 +96,7 @@ public class ExistingModuleLoader extends ModuleBuilder { } } else { Messages.showErrorDialog(current, IdeBundle.message("title.module.file.does.not.exist", moduleFilePath), - CommonBundle.message("title.error")); + CommonBundle.getErrorTitle()); return false; } return true; diff --git a/platform/platform-impl/src/com/intellij/ide/actions/EditCustomSettingsAction.kt b/platform/platform-impl/src/com/intellij/ide/actions/EditCustomSettingsAction.kt index cd7f1fbd060d..39492e99be41 100644 --- a/platform/platform-impl/src/com/intellij/ide/actions/EditCustomSettingsAction.kt +++ b/platform/platform-impl/src/com/intellij/ide/actions/EditCustomSettingsAction.kt @@ -58,7 +58,7 @@ abstract class EditCustomSettingsAction : DumbAwareAction() { catch (ex: IOException) { Logger.getInstance(javaClass).warn(file.path, ex) val message = IdeBundle.message("edit.custom.settings.failed", file, ex.message) - Messages.showErrorDialog(project, message, CommonBundle.message("title.error")) + Messages.showErrorDialog(project, message, CommonBundle.getErrorTitle()) return } } @@ -110,7 +110,7 @@ abstract class EditCustomSettingsAction : DumbAwareAction() { catch (ex: IOException) { Logger.getInstance(javaClass).warn(file.path, ex) val message = IdeBundle.message("edit.custom.settings.failed", file, ex.message) - Messages.showErrorDialog(this.window, message, CommonBundle.message("title.error")) + Messages.showErrorDialog(this.window, message, CommonBundle.getErrorTitle()) } } }.show() diff --git a/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java b/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java index 7a1abab77e99..8f0be247806f 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java @@ -43,7 +43,7 @@ public class ShowDelayedMessageInternalAction extends AnAction implements DumbAw //noinspection SSBasedInspection SwingUtilities.invokeLater(() -> MessageDialogBuilder.yesNo("Nothing happens after that", "Some message goes here").yesText( ApplicationBundle.message("command.exit")).noText( - CommonBundle.message("button.cancel")).show()); + CommonBundle.getCancelButtonText()).show()); } }.start(); diff --git a/platform/platform-impl/src/com/intellij/openapi/application/JBProtocolShutdownCommand.java b/platform/platform-impl/src/com/intellij/openapi/application/JBProtocolShutdownCommand.java index 8567eed53e2f..8b54772689d9 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/JBProtocolShutdownCommand.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/JBProtocolShutdownCommand.java @@ -26,7 +26,7 @@ final class JBProtocolShutdownCommand extends JBProtocolCommand { else { MessageDialogBuilder.YesNo confirmExitDialog = MessageDialogBuilder.yesNo(ApplicationBundle.message("exit.confirm.title"), target) .yesText(ApplicationBundle.message("command.exit")).noText( - CommonBundle.message("button.cancel")); + CommonBundle.getCancelButtonText()); if (confirmExitDialog.show() == Messages.YES) { ApplicationManagerEx.getApplicationEx().exit(true, true); } diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index f512aa0e0e8f..94fab1c82c40 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -723,7 +723,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App String message = ApplicationBundle.message(hasUnsafeBgTasks ? "exit.confirm.prompt.tasks" : "exit.confirm.prompt", name); int result = MessageDialogBuilder.yesNo(ApplicationBundle.message("exit.confirm.title"), message) .yesText(ApplicationBundle.message("command.exit")) - .noText(CommonBundle.message("button.cancel")) + .noText(CommonBundle.getCancelButtonText()) .doNotAsk(option).show(); if (alreadyGone.getAndSet(true)) { if (!option.isToBeShown()) { @@ -732,7 +732,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App result = MessageDialogBuilder.yesNo(ApplicationBundle.message("exit.confirm.title"), ApplicationBundle.message("exit.confirm.prompt", name)) .yesText(ApplicationBundle.message("command.exit")) - .noText(CommonBundle.message("button.cancel")) + .noText(CommonBundle.getCancelButtonText()) .doNotAsk(option).show(); } if (result != Messages.YES) {