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
This commit is contained in:
nik
2020-01-30 16:07:21 +00:00
committed by intellij-monorepo-bot
parent aff748d627
commit 2ed0059552
12 changed files with 23 additions and 23 deletions
@@ -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
@@ -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);
@@ -183,7 +183,7 @@ public abstract class ProjectOpenProcessorBase<T extends ProjectImportBuilder<?>
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;
@@ -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()
@@ -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;
}
}
@@ -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() {
@@ -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
}
@@ -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;
@@ -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()
@@ -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();
@@ -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);
}
@@ -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) {