diff --git a/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactLoadingErrorDescription.java b/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactLoadingErrorDescription.java index 76384f66c51e..8bc75b033218 100644 --- a/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactLoadingErrorDescription.java +++ b/java/compiler/impl/src/com/intellij/packaging/impl/artifacts/ArtifactLoadingErrorDescription.java @@ -1,48 +1,45 @@ -/* - * Copyright 2000-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2020 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.packaging.impl.artifacts; import com.intellij.openapi.application.WriteAction; +import com.intellij.openapi.compiler.JavaCompilerBundle; import com.intellij.openapi.module.ConfigurationErrorDescription; import com.intellij.openapi.module.ConfigurationErrorType; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.NlsSafe; import com.intellij.packaging.artifacts.ArtifactManager; import com.intellij.packaging.artifacts.ModifiableArtifactModel; +import com.intellij.projectModel.ProjectModelBundle; +import org.jetbrains.annotations.Nls; +import org.jetbrains.annotations.NotNull; public class ArtifactLoadingErrorDescription extends ConfigurationErrorDescription { - private static final ConfigurationErrorType INVALID_ARTIFACT = new ConfigurationErrorType("artifact", false); + private static final ConfigurationErrorType ARTIFACT_ERROR = new ConfigurationErrorType(false) { + @Override + public @Nls @NotNull String getErrorText(int errorCount, @NlsSafe String firstElementName) { + return JavaCompilerBundle.message("artifact.configuration.problem.text", errorCount, firstElementName); + } + }; + private final Project myProject; private final InvalidArtifact myArtifact; public ArtifactLoadingErrorDescription(Project project, InvalidArtifact artifact) { - super(artifact.getName(), artifact.getErrorMessage(), INVALID_ARTIFACT); + super(artifact.getName(), artifact.getErrorMessage(), ARTIFACT_ERROR); myProject = project; myArtifact = artifact; } @Override public void ignoreInvalidElement() { - final ModifiableArtifactModel model = ArtifactManager.getInstance(myProject).createModifiableModel(); + ModifiableArtifactModel model = ArtifactManager.getInstance(myProject).createModifiableModel(); model.removeArtifact(myArtifact); WriteAction.run(() -> model.commit()); } @Override - public String getIgnoreConfirmationMessage() { - return "Would you like to remove artifact '" + myArtifact.getName() + "?"; + public @NotNull String getIgnoreConfirmationMessage() { + return JavaCompilerBundle.message("unknown.artifact.remove.confirmation", myArtifact.getName()); } @Override diff --git a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties index c6c092465f64..b78f81c243ad 100644 --- a/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties +++ b/java/compiler/openapi/resources/messages/JavaCompilerBundle.properties @@ -239,6 +239,8 @@ jar.from.modules.presentable.name=From modules with dependencies... unknown.artifact.type.0=Unknown artifact type: {0} unknown.element.0=Unknown element: {0} unknown.artifact.properties.0=Unknown artifact properties: {0} +artifact.configuration.problem.text={0, choice, 1#artifact {1}|2#{0} artifacts} +unknown.artifact.remove.confirmation=Would you like to remove artifact ''{0}''? show.content.of.included.artifacts=Show Content of Included Artifacts show.library.files=Show Library Files directory.copy.element.type.name=Directory Content @@ -278,4 +280,4 @@ ArtifactPropertiesEditor.tab.post.processing=Post-processing ArtifactPropertiesEditor.tab.pre.processing=Pre-processing reference.projectsettings.compiler.excludes=Excludes reference.projectsettings.compiler.annotationProcessors=Annotation Processors -affected.tests.counts=\ / {0} {1, choice, 0#test|1#tests} \ No newline at end of file +affected.tests.counts=\ / {0} {1, choice, 0#test|1#tests} diff --git a/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java b/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java index ec73ea7acf2f..10fd0222da0d 100644 --- a/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java +++ b/platform/lang-api/src/com/intellij/ide/util/projectWizard/ModuleBuilder.java @@ -363,7 +363,7 @@ public abstract class ModuleBuilder extends AbstractModuleBuilder { @Nls(capitalization = Nls.Capitalization.Title) protected String getModuleTypeName() { String name = getModuleType().getName(); - return StringUtil.trimEnd(name, " Module"); + return StringUtil.trimEnd(name, " Module"); // NON-NLS } public String getGroupName() { diff --git a/platform/lang-impl/src/com/intellij/facet/impl/FacetLoadingErrorDescription.java b/platform/lang-impl/src/com/intellij/facet/impl/FacetLoadingErrorDescription.java index 175f1d3912d0..354a0f66cc0b 100644 --- a/platform/lang-impl/src/com/intellij/facet/impl/FacetLoadingErrorDescription.java +++ b/platform/lang-impl/src/com/intellij/facet/impl/FacetLoadingErrorDescription.java @@ -21,8 +21,19 @@ import com.intellij.facet.impl.invalid.InvalidFacetManager; import com.intellij.openapi.module.ConfigurationErrorDescription; import com.intellij.openapi.module.ConfigurationErrorType; import com.intellij.openapi.project.ProjectBundle; +import com.intellij.openapi.util.NlsSafe; +import com.intellij.projectModel.ProjectModelBundle; +import org.jetbrains.annotations.Nls; +import org.jetbrains.annotations.NotNull; public class FacetLoadingErrorDescription extends ConfigurationErrorDescription { + private static final ConfigurationErrorType FACET_ERROR = new ConfigurationErrorType(true) { + @Override + public @Nls @NotNull String getErrorText(int errorCount, @NlsSafe String firstElementName) { + return ProjectBundle.message("facet.configuration.problem.text", errorCount, firstElementName); + } + }; + private final InvalidFacet myFacet; public FacetLoadingErrorDescription(final InvalidFacet facet) { @@ -32,7 +43,7 @@ public class FacetLoadingErrorDescription extends ConfigurationErrorDescription } @Override - public String getIgnoreConfirmationMessage() { + public @NotNull String getIgnoreConfirmationMessage() { return ProjectBundle.message("confirmation.message.would.you.like.to.ignore.facet", myFacet.getName(), myFacet.getModule().getName()); } diff --git a/platform/lang-impl/src/com/intellij/facet/impl/invalid/InvalidFacet.java b/platform/lang-impl/src/com/intellij/facet/impl/invalid/InvalidFacet.java index ae37dbfd5c61..2e41f2f3ee93 100644 --- a/platform/lang-impl/src/com/intellij/facet/impl/invalid/InvalidFacet.java +++ b/platform/lang-impl/src/com/intellij/facet/impl/invalid/InvalidFacet.java @@ -1,22 +1,9 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2020 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.facet.impl.invalid; import com.intellij.facet.Facet; import com.intellij.openapi.module.Module; +import com.intellij.openapi.util.NlsContexts; public class InvalidFacet extends Facet { public InvalidFacet(InvalidFacetType invalidFacetType, @@ -27,7 +14,7 @@ public class InvalidFacet extends Facet { super(invalidFacetType, module, name, configuration, underlyingFacet); } - public String getErrorMessage() { + public @NlsContexts.DialogMessage String getErrorMessage() { return getConfiguration().getErrorMessage(); } } diff --git a/platform/lang-impl/src/com/intellij/facet/impl/invalid/InvalidFacetConfiguration.java b/platform/lang-impl/src/com/intellij/facet/impl/invalid/InvalidFacetConfiguration.java index 0f373e1b7e53..58888e9b3f56 100644 --- a/platform/lang-impl/src/com/intellij/facet/impl/invalid/InvalidFacetConfiguration.java +++ b/platform/lang-impl/src/com/intellij/facet/impl/invalid/InvalidFacetConfiguration.java @@ -1,18 +1,4 @@ -/* - * Copyright 2000-2010 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2020 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.facet.impl.invalid; import com.intellij.facet.FacetConfiguration; @@ -44,7 +30,7 @@ public class InvalidFacetConfiguration implements FacetConfiguration { }; } - public String getErrorMessage() { + public @NlsContexts.DialogMessage String getErrorMessage() { return myErrorMessage; } } diff --git a/platform/lang-impl/src/com/intellij/openapi/module/WebModuleBuilder.java b/platform/lang-impl/src/com/intellij/openapi/module/WebModuleBuilder.java index c996173208f7..d887eed8c636 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/WebModuleBuilder.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/WebModuleBuilder.java @@ -1,4 +1,4 @@ -// Copyright 2000-2019 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. +// Copyright 2000-2020 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.openapi.module; import com.intellij.icons.AllIcons; @@ -49,11 +49,6 @@ public class WebModuleBuilder extends ModuleBuilder { return WebModuleTypeBase.getInstance(); } - @Override - public String getPresentableName() { - return getGroupName(); - } - @Override public boolean isTemplateBased() { return true; diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/AutomaticModuleUnloader.kt b/platform/lang-impl/src/com/intellij/openapi/module/impl/AutomaticModuleUnloader.kt index 2a12300e9668..c1037efc1e03 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/AutomaticModuleUnloader.kt +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/AutomaticModuleUnloader.kt @@ -11,6 +11,7 @@ import com.intellij.openapi.components.* import com.intellij.openapi.module.ModuleDescription import com.intellij.openapi.module.ModuleManager import com.intellij.openapi.project.Project +import com.intellij.openapi.project.ProjectBundle import com.intellij.openapi.roots.ui.configuration.ConfigureUnloadedModulesDialog import com.intellij.openapi.util.NlsContexts import com.intellij.util.xmlb.annotations.XCollection @@ -68,58 +69,37 @@ class AutomaticModuleUnloader(private val project: Project) : SimplePersistentSt val messages = mutableListOf() val actions = mutableListOf() - populateNotification(change.toUnload, messages, actions, "Load", {"Load $it back"}, change.toLoad.isEmpty(), {"unloaded"}) { - it.removeAll(change.toUnload.map { it.moduleName }) + + if (change.toUnload.isNotEmpty()) { + val modules = change.toUnload + val args = arrayOf(modules.size, modules[0].moduleName, modules.getOrElse(2) { modules.size - 1 }) + messages += ProjectBundle.message("auto.unloaded.notification", *args) + val text = ProjectBundle.message(if (change.toUnload.isEmpty()) "auto.unloaded.revert.short" else "auto.unloaded.revert.full", *args) + actions += createAction(text) { list -> list.removeAll(modules.map { it.moduleName }) } } - populateNotification(change.toLoad, messages, actions, "Unload", {"Unload $it"}, change.toUnload.isEmpty(), {"loaded because some other modules depend on $it"}) { list -> - list.addAll(change.toLoad.map { it.moduleName }) + + if (change.toLoad.isNotEmpty()) { + val modules = change.toLoad + val args = arrayOf(modules.size, modules[0].moduleName, modules.getOrElse(2) { modules.size - 1 }) + messages += ProjectBundle.message("auto.loaded.notification", *args) + val action = ProjectBundle.message(if (change.toUnload.isEmpty()) "auto.loaded.revert.short" else "auto.loaded.revert.full", *args) + actions += createAction(action) { list -> list.addAll(modules.map { it.moduleName }) } } - actions.add(object : NotificationAction("Configure Unloaded Modules") { + + actions += object : NotificationAction(ProjectBundle.message("configure.unloaded.modules")) { override fun actionPerformed(e: AnActionEvent, notification: Notification) { - val ok = ConfigureUnloadedModulesDialog(project, null).showAndGet() - if (ok) { + if (ConfigureUnloadedModulesDialog(project, null).showAndGet()) { notification.expire() } } - }) + } - val notification = NOTIFICATION_GROUP.createNotification("New Modules are Added", - XmlStringUtil.wrapInHtml(messages.joinToString("
")), - NotificationType.INFORMATION, null) + val content = XmlStringUtil.wrapInHtml(messages.joinToString("
")) + val notification = NOTIFICATION_GROUP.createNotification(ProjectBundle.message("modules.added.notification.title"), content, NotificationType.INFORMATION, null) notification.addActions(actions) notification.notify(project) } - private fun populateNotification(modules: List, - messages: MutableList, - actions: MutableList, - revertActionName: String, - revertActionShortText: (String) -> String, - useShortActionText: Boolean, - statusDescription: (String) -> String, - revertAction: (MutableList) -> Unit) { - when { - modules.size == 1 -> { - val moduleName = modules.single().moduleName - messages.add("Newly added module '$moduleName' was automatically ${statusDescription("it")}.") - val text = if (useShortActionText) revertActionShortText("it") else "$revertActionName '$moduleName' module" - actions.add(createAction(text, revertAction)) - } - modules.size == 2 -> { - val names = "'${modules[0].moduleName}' and '${modules[1].moduleName}'" - messages.add("Newly added modules $names were automatically ${statusDescription("them")}.") - val text = if (useShortActionText) revertActionShortText("them") else "$revertActionName modules $names" - actions.add(createAction(text, revertAction)) - } - modules.size > 2 -> { - val names = "'${modules.first().moduleName}' and ${modules.size - 1} more modules" - messages.add("$names were automatically ${statusDescription("them")}.") - val text = if (useShortActionText) revertActionShortText("them") else "$revertActionName $names" - actions.add(createAction(text, revertAction)) - } - } - } - fun createAction(@NlsContexts.NotificationContent text: String, action: (MutableList) -> Unit): NotificationAction = object : NotificationAction(text) { override fun actionPerformed(e: AnActionEvent, notification: Notification) { val unloaded = ArrayList() diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/ProjectLoadingErrorsNotifierImpl.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/ProjectLoadingErrorsNotifierImpl.java index d0b75da667d3..a5cd23aaaccd 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/ProjectLoadingErrorsNotifierImpl.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/ProjectLoadingErrorsNotifierImpl.java @@ -76,7 +76,7 @@ public class ProjectLoadingErrorsNotifierImpl extends ProjectLoadingErrorsNotifi } ConfigurationErrorType type = entry.getKey(); - String invalidElements = getInvalidElementsString(type, descriptions); + String invalidElements = type.getErrorText(descriptions.size(), descriptions.iterator().next().getElementName()); String errorText = ProjectBundle.message("error.message.configuration.cannot.load", invalidElements); new Notification( NotificationGroup.createIdWithTitle("Project Loading Error", ProjectBundle.message("notification.group.project.loading.error")), @@ -92,11 +92,4 @@ public class ProjectLoadingErrorsNotifierImpl extends ProjectLoadingErrorsNotifi }).notify(myProject); } } - - private static String getInvalidElementsString(ConfigurationErrorType type, Collection descriptions) { - if (descriptions.size() == 1) { - return type.getElementKind() + " " + ContainerUtil.getFirstItem(descriptions).getElementName(); - } - return descriptions.size() + " " + StringUtil.pluralize(type.getElementKind()); - } } diff --git a/platform/lang-impl/src/com/intellij/openapi/module/impl/RemoveInvalidElementsDialog.java b/platform/lang-impl/src/com/intellij/openapi/module/impl/RemoveInvalidElementsDialog.java index 8c913b653896..55e66e413f6c 100644 --- a/platform/lang-impl/src/com/intellij/openapi/module/impl/RemoveInvalidElementsDialog.java +++ b/platform/lang-impl/src/com/intellij/openapi/module/impl/RemoveInvalidElementsDialog.java @@ -12,6 +12,7 @@ import com.intellij.openapi.ui.VerticalFlowLayout; import com.intellij.openapi.util.NlsContexts; import com.intellij.openapi.util.text.StringUtil; import com.intellij.xml.util.XmlStringUtil; +import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import javax.swing.*; @@ -29,15 +30,17 @@ public final class RemoveInvalidElementsDialog extends DialogWrapper { private RemoveInvalidElementsDialog(@NlsContexts.DialogTitle String title, ConfigurationErrorType type, - String invalidElements, - final Project project, + @Nls String invalidElements, + Project project, List errors) { super(project, true); setTitle(title); - myDescriptionLabel.setText(ProjectBundle.message(type.canIgnore() ? "label.text.0.cannot.be.loaded.ignore" : "label.text.0.cannot.be.loaded.remove", invalidElements)); + myDescriptionLabel.setText(ProjectBundle.message( + type.canIgnore() ? "label.text.0.cannot.be.loaded.ignore" : "label.text.0.cannot.be.loaded.remove", + invalidElements)); myContentPanel.setLayout(new VerticalFlowLayout()); for (ConfigurationErrorDescription error : errors) { - JCheckBox checkBox = new JCheckBox(error.getElementName() + "."); + JCheckBox checkBox = new JCheckBox(error.getElementName()); checkBox.setSelected(true); myCheckboxes.put(checkBox, error); JPanel panel = new JPanel(new GridBagLayout()); @@ -57,12 +60,14 @@ public final class RemoveInvalidElementsDialog extends DialogWrapper { setCancelButtonText(ProjectBundle.message("button.text.keep.all")); } - /** * @return {@code true} if the problems are resolved */ - public static boolean showDialog(@NotNull Project project, @NotNull @NlsContexts.DialogTitle String title, ConfigurationErrorType type, - @NotNull String invalidElements, @NotNull List errors) { + public static boolean showDialog(@NotNull Project project, + @NlsContexts.DialogTitle @NotNull String title, + @NotNull ConfigurationErrorType type, + @Nls @NotNull String invalidElements, + @NotNull List errors) { if (errors.isEmpty()) { return true; } diff --git a/platform/platform-api/resources/messages/ProjectBundle.properties b/platform/platform-api/resources/messages/ProjectBundle.properties index 57b2a6ae2bbc..0c386289f2dd 100644 --- a/platform/platform-api/resources/messages/ProjectBundle.properties +++ b/platform/platform-api/resources/messages/ProjectBundle.properties @@ -130,7 +130,7 @@ module.source.roots.not.configured.error=No Source Roots configured for module { module.source.roots.not.configured.title=No Source Roots Configured module.unknown.type.single.error=Cannot determine module type (\"{1}\") for the following module:\"{0}\"
The module will be treated as a Unknown module. module.unknown.type.multiple.error=Cannot determine module type for the following modules:\n{0}\nAll mentioned modules will be treated as Unknown modules. -module.unknown.type.title=Unknown Module Type +module.unknown.type.title=Unknown module type module.web.title=Web Module module.web.description=Empty project for developing apps using JavaScript, HTML, CSS, and Node.js. project.settings.display.name=Project Structure @@ -152,8 +152,19 @@ error.message.plugin.for.facets.unloaded=Plugin{0} which provides support for '' button.text.remove.selected=Remove Selected button.text.ignore.selected=Ignore Selected button.text.keep.all=Keep All +facet.configuration.problem.text={0, choice, 1#facet {1}|2#{0} facets} confirmation.message.would.you.like.to.ignore.facet=Would you like to ignore facet ''{0}'' from module ''{1}''? -element.kind.name.facet=facet + +modules.added.notification.title=New modules are added +configure.unloaded.modules=Configure unloaded modules +auto.unloaded.notification={0,choice,1#Newly added module ''''{1}''''|2#Newly added modules ''''{1}'''', ''''{2}''''|3#''''{1}'''' and {2} more modules} {0,choice,1#was|2#were} \ + automatically unloaded +auto.unloaded.revert.short=Load {0,choice,1#it|2#them} back +auto.unloaded.revert.full=Load {0,choice,1#module ''''{1}''''|2#modules ''''{1}'''', ''''{2}''''|3#''''{1}'''' and {2} more modules} +auto.loaded.notification={0,choice,1#Newly added module ''''{1}''''|2#Newly added modules ''''{1}'''', ''''{2}''''|3#''''{1}'''' and {2} more modules} {0,choice,1#was|2#were} \ + automatically loaded because some other modules depend on {0,choice,1#it|2#them} +auto.loaded.revert.short=Unload {0,choice,1#it|2#them} +auto.loaded.revert.full=Unload {0,choice,1#module ''''{1}''''|2#modules ''''{1}'''', ''''{2}''''|3#''''{1}'''' and {2} more modules} error.message.configuration.cannot.load=Cannot load {0} Details... label.text.0.cannot.be.loaded.remove={0} cannot be loaded. You can remove them from the project (no files will be deleted). @@ -204,7 +215,7 @@ progress.title.detecting.sdks=Detecting SDKs chooser.title.select.library.files=Select Library Files notification.content.support.for.0.format.is.not.installed=Support for {0} format is not installed. notification.title.cannot.load.module.0=Cannot load module ''{0}'' -notification.title.error.loading.project=Error Loading Project +notification.title.error.loading.project=Error loading project notification.group.project.loading.error=Project loading error dialog.title.create.project=Create Project dialog.title.new.project=New Project @@ -239,4 +250,4 @@ progress.text.installing.jdk.1=Installing {0}... progress.text2.downloading.jdk=Downloading progress.text2.unpacking.jdk=Unpacking error.message.sdk.download.failed=Failed to download {0} -config.unknown.sdk.commandline.configure=Configures unkown project SDKs +config.unknown.sdk.commandline.configure=Configures unknown project SDKs diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectFrameAllocator.kt b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectFrameAllocator.kt index bdc6bd61e100..3714579dea19 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectFrameAllocator.kt +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectFrameAllocator.kt @@ -118,7 +118,7 @@ internal class ProjectUiFrameAllocator(private var options: OpenProjectTask, pri return result } - @NlsContexts.ProgressTitle + @NlsContexts.DialogTitle private fun getProgressTitle(): String { val projectName = options.projectName ?: (projectStoreBaseDir.fileName ?: projectStoreBaseDir).toString() return IdeUICustomization.getInstance().projectMessage("progress.title.project.loading.name", projectName) @@ -283,4 +283,4 @@ fun createNewProjectFrame(forceDisableAutoRequestFocus: Boolean): IdeFrameImpl { } frame.minimumSize = Dimension(340, frame.minimumSize.height) return frame -} \ No newline at end of file +} diff --git a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerExImpl.kt b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerExImpl.kt index cb1db92e37c6..cc9d42bcd43a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerExImpl.kt +++ b/platform/platform-impl/src/com/intellij/openapi/project/impl/ProjectManagerExImpl.kt @@ -319,14 +319,14 @@ private fun checkExistingProjectOnOpen(projectToClose: Project, private fun openProject(project: Project, indicator: ProgressIndicator?, runStartUpActivities: Boolean) { val waitEdtActivity = StartUpMeasurer.startMainActivity("placing calling projectOpened on event queue") if (indicator != null) { - indicator.text = if (ApplicationManager.getApplication().isInternal) "Waiting on event queue..." else ProjectBundle.message( - "project.preparing.workspace") + indicator.text = if (ApplicationManager.getApplication().isInternal) "Waiting on event queue..." // NON-NLS (internal mode) + else ProjectBundle.message("project.preparing.workspace") indicator.isIndeterminate = true } ApplicationManager.getApplication().invokeAndWait { waitEdtActivity.end() if (indicator != null && ApplicationManager.getApplication().isInternal) { - indicator.text = "Running project opened tasks..." + indicator.text = "Running project opened tasks..." // NON-NLS (internal mode) } ProjectManagerImpl.LOG.debug("projectOpened") @@ -413,4 +413,4 @@ private fun removeProjectDirContentOrFile(projectFile: Path) { catch (ignore: IOException) { } } -} \ No newline at end of file +} diff --git a/platform/projectModel-api/resources/messages/ProjectModelBundle.properties b/platform/projectModel-api/resources/messages/ProjectModelBundle.properties index dab6f95aff54..93c005180d0d 100644 --- a/platform/projectModel-api/resources/messages/ProjectModelBundle.properties +++ b/platform/projectModel-api/resources/messages/ProjectModelBundle.properties @@ -1,4 +1,3 @@ -element.kind.name.module=module filetype.description.idea.module=IDEA module filetype.description.idea.project=IDEA project global.library.display.name=Global {0, choice, 1#Library|2#Libraries} @@ -33,6 +32,7 @@ module.already.exists.error=Module ''{0}'' already exists in the project. module.cannot.load.error=Cannot load module file ''{0}'':\n{1} module.corrupted.file.error=Invalid or corrupted module file ''{0}'':\n{1} module.library.display.name=Module {0, choice, 1#Library|2#Libraries} +module.configuration.problem.text={0, choice, 1#module {1}|2#{0} modules} module.remove.from.project.confirmation=Would you like to remove module ''{0}'' from the project? progress.text.loading.modules=Loading modules... project.library.display.name=Project {0, choice, 1#Library|2#Libraries} @@ -40,4 +40,4 @@ project.root.module.source= dialog.title.replace.library=Replace Library button.text.replace=Replace disposed.library.title=Disposed Library -empty.library.title=Empty Library \ No newline at end of file +empty.library.title=Empty Library diff --git a/platform/projectModel-impl/src/com/intellij/openapi/module/ConfigurationErrorDescription.java b/platform/projectModel-impl/src/com/intellij/openapi/module/ConfigurationErrorDescription.java index 393b49a36187..b6ce0d231b0c 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/module/ConfigurationErrorDescription.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/module/ConfigurationErrorDescription.java @@ -1,47 +1,36 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - +// Copyright 2000-2020 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.openapi.module; +import com.intellij.openapi.util.NlsContexts.DetailedDescription; +import com.intellij.openapi.util.NlsSafe; +import org.jetbrains.annotations.NotNull; + public abstract class ConfigurationErrorDescription { private final String myElementName; - private final String myDescription; + private final @DetailedDescription String myDescription; private final ConfigurationErrorType myErrorType; - protected ConfigurationErrorDescription(String elementName, String description, ConfigurationErrorType errorType) { + protected ConfigurationErrorDescription(@NotNull String elementName, @DetailedDescription @NotNull String description, @NotNull ConfigurationErrorType errorType) { myElementName = elementName; myErrorType = errorType; myDescription = description; } - public String getElementName() { + public @NlsSafe @NotNull String getElementName() { return myElementName; } - public ConfigurationErrorType getErrorType() { + public @NotNull ConfigurationErrorType getErrorType() { return myErrorType; } - public String getDescription() { + public @DetailedDescription String getDescription() { return myDescription; } public abstract void ignoreInvalidElement(); - public abstract String getIgnoreConfirmationMessage(); + public abstract @DetailedDescription @NotNull String getIgnoreConfirmationMessage(); public boolean isValid() { return true; diff --git a/platform/projectModel-impl/src/com/intellij/openapi/module/ConfigurationErrorType.java b/platform/projectModel-impl/src/com/intellij/openapi/module/ConfigurationErrorType.java index cf3c48cd3bc5..048cfc6f9626 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/module/ConfigurationErrorType.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/module/ConfigurationErrorType.java @@ -1,32 +1,18 @@ -/* - * Copyright 2000-2012 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2020 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.openapi.module; -public class ConfigurationErrorType { - private final String myElementKind; +import com.intellij.openapi.util.NlsSafe; +import org.jetbrains.annotations.Nls; +import org.jetbrains.annotations.NotNull; + +public abstract class ConfigurationErrorType { private final boolean myCanIgnore; - public ConfigurationErrorType(String elementKind, boolean canIgnore) { - myElementKind = elementKind; + public ConfigurationErrorType(boolean canIgnore) { myCanIgnore = canIgnore; } - public String getElementKind() { - return myElementKind; - } + public abstract @Nls @NotNull String getErrorText(int errorCount, @NlsSafe String firstElementName); public boolean canIgnore() { return myCanIgnore; diff --git a/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleLoadingErrorDescription.java b/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleLoadingErrorDescription.java index 652f6bc55ce8..f3e2fb4ddd21 100644 --- a/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleLoadingErrorDescription.java +++ b/platform/projectModel-impl/src/com/intellij/openapi/module/impl/ModuleLoadingErrorDescription.java @@ -3,16 +3,25 @@ package com.intellij.openapi.module.impl; import com.intellij.openapi.module.ConfigurationErrorDescription; import com.intellij.openapi.module.ConfigurationErrorType; +import com.intellij.openapi.util.NlsContexts; +import com.intellij.openapi.util.NlsSafe; import com.intellij.projectModel.ProjectModelBundle; +import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; public final class ModuleLoadingErrorDescription extends ConfigurationErrorDescription { + private static final ConfigurationErrorType MODULE_ERROR = new ConfigurationErrorType(false) { + @Override + public @Nls @NotNull String getErrorText(int errorCount, @NlsSafe String firstElementName) { + return ProjectModelBundle.message("module.configuration.problem.text", errorCount, firstElementName); + } + }; + private final ModulePath myModulePath; private final ModuleManagerImpl myModuleManager; - ModuleLoadingErrorDescription(String description, @NotNull ModulePath modulePath, @NotNull ModuleManagerImpl moduleManager) { - super(modulePath.getModuleName(), description, new ConfigurationErrorType(ProjectModelBundle.message("element.kind.name.module"), false)); - + ModuleLoadingErrorDescription(@NlsContexts.DetailedDescription String description, @NotNull ModulePath modulePath, @NotNull ModuleManagerImpl moduleManager) { + super(modulePath.getModuleName(), description, MODULE_ERROR); myModulePath = modulePath; myModuleManager = moduleManager; } @@ -28,7 +37,7 @@ public final class ModuleLoadingErrorDescription extends ConfigurationErrorDescr } @Override - public String getIgnoreConfirmationMessage() { + public @NotNull String getIgnoreConfirmationMessage() { return ProjectModelBundle.message("module.remove.from.project.confirmation", getElementName()); } }