i18n: Add bundle for idea-jvm

This commit is contained in:
Yan Zhulanow
2020-02-19 22:58:07 +09:00
committed by Dmitry Gridin
parent 40bdc099e3
commit 4cc19d3fda
25 changed files with 196 additions and 75 deletions
@@ -216,9 +216,6 @@ suppress.warnings.family=Suppress Warnings
suppress.warning.for=Suppress ''{0}'' for {1} {2}
reflection.not.found=Reflection not found in the classpath
add.reflection.to.classpath=Add kotlin-reflect.jar to the classpath
add.test.to.classpath=Add kotlin-test.jar to the classpath
add.script.runtime.to.classpath=Add kotlin-script-runtime.jar to the classpath
# Kotlin Compiler Settings Tab
@@ -9,7 +9,6 @@ import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerEvaluationBundle
import java.util.*
object KotlinGradleNativeBundle : KotlinBundleBase() {
@@ -20,6 +19,6 @@ object KotlinGradleNativeBundle : KotlinBundleBase() {
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(KotlinDebuggerEvaluationBundle.bundle, key, *params)
return CommonBundle.message(bundle, key, *params)
}
}
@@ -0,0 +1,69 @@
classpath.add.reflection=Add ''kotlin-reflect.jar'' to the classpath
classpath.add.script.runtime=Add ''kotlin-script-runtime.jar'' to the classpath
classpath.add.kotlin.test=Add ''kotlin-test.jar'' to the classpath
scratch.clear.button=Clear results
scratch.inlay.output.mode=Inlay output mode\n\nThe output is shown in the code editor right next to the expression. Well suited for a short single-line output.
scratch.inlay.output.mode.description=Inlay output mode
scratch.side.panel.output.mode=Side panel output mode\n\nThe output is shown in the separate panel. Useful if the output is long or multi-line.
scratch.side.panel.output.mode.description=Side panel output mode
scratch.module.combobox=Use classpath of module
scratch.run.button=Run Scratch File
scratch.run.from.here.button=Run Scratch From Here
scratch.stop.button=Stop scratch execution
scratch.is.repl.checkbox=Use REPL
scratch.is.repl.checkbox.description=Runs in the Kotlin REPL. Executes only the new expressions added to the end of the scratch
scratch.is.interactive.checkbox=Interactive mode
scratch.is.interactive.checkbox.description=Runs after you stop typing for {0} seconds
scratch.make.before.run.checkbox=Make module before Run
scratch.make.before.run.checkbox.description=Make module {0} before running scratch. Only compiled code is reachable from this scope
incompatible.api.report=Report as Incompatible API
choose.module.modules={0}, {1} and <a href="#">{2,number,#} other modules</a>
choose.module.modules.with.kotlin=Modules with Kotlin Files
choose.path.title=Choose Destination Folder
choose.path.description=Choose folder
configure.kotlin.title=Configure Kotlin with {0}
configure.kotlin.find.maven.versions=Find Kotlin Maven plugin versions
configure.kotlin.loading=loading…
configure.kotlin.cant.load.versions=Couldn't load versions list from search.maven.org
copy.into.title=Copy Into…
copy.into.description=Choose folder where files will be copied
file.exists.single=File ''{0}'' already exists in {1}. Do you want to overwrite it?
file.exists=Files already exist: \n{0}\nDo you want to overwrite them?
file.overwrite.title=Overwrite file
file.overwrite.overwrite=Overwrite
file.overwrite.cancel=Cancel
file.destination.folder=Destination folder
file.error.new.folder=Error during folder creation: {0}
file.error.copy=Error during copying {0}
frameworks.remove.conflict.title=Framework Conflict
frameworks.remove.conflict.question=Current module is already configured with ''{0}'' framework.\nDo you want to remove it?
library.label.jvm=Kotlin runtime
library.label.javascript=Kotlin JS library
library.no.kotlin.library.title=No Kotlin Runtime Specified
library.no.kotlin.library.question=Do you want to continue with no Kotlin Runtime library?
run.configuration.error.no.module=Module not specified
run.configuration.error.no.main.class=No main class specified
run.configuration.error.class.not.found=Class ''{0}'' not found in module ''{1}''
run.configuration.error.class.no.main.method=Class ''{0}'' has no ''main()'' method
run.configuration.error.main.not.found=Function ''main()'' not found in class ''{0}''
run.configuration.error.main.not.found.top.level=Top-level function ''main()'' not found in package ''{0}''
script.choose.file=Choose script file
editor.editor.only=Editor only
editor.preview.only=Preview only
editor.editor.and.preview=Editor and preview
@@ -0,0 +1,24 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.idea
import com.intellij.CommonBundle
import org.jetbrains.annotations.NonNls
import org.jetbrains.annotations.PropertyKey
import org.jetbrains.kotlin.idea.core.util.KotlinBundleBase
import java.util.*
object KotlinJvmBundle : KotlinBundleBase() {
@NonNls
private const val BUNDLE = "org.jetbrains.kotlin.idea.KotlinJvmBundle"
override fun createBundle(): ResourceBundle = ResourceBundle.getBundle(BUNDLE)
@JvmStatic
fun message(@NonNls @PropertyKey(resourceBundle = BUNDLE) key: String, vararg params: Any?): String {
return CommonBundle.message(bundle, key, *params)
}
}
@@ -25,6 +25,7 @@ import com.intellij.openapi.roots.libraries.LibraryKind;
import com.intellij.openapi.roots.ui.configuration.libraries.LibraryPresentationManager;
import com.intellij.openapi.ui.Messages;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import java.util.ArrayList;
import java.util.Arrays;
@@ -54,10 +55,11 @@ public class FrameworksCompatibilityUtils {
}
}
removeWithConfirm(rootModel, existingEntries,
String.format("Current module is already configured with '%s' framework.\nDo you want to remove it?",
presentableName),
"Framework Conflict");
removeWithConfirm(
rootModel, existingEntries,
KotlinJvmBundle.message("frameworks.remove.conflict.question", presentableName),
KotlinJvmBundle.message("frameworks.remove.conflict.title")
);
}
private static void removeWithConfirm(ModifiableRootModel rootModel, List<OrderEntry> orderEntries, String message, String title) {
@@ -44,6 +44,7 @@ import kotlin.collections.ArraysKt;
import kotlin.jvm.functions.Function1;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import org.jetbrains.kotlin.idea.formatter.KotlinStyleGuideCodeStyle;
import org.jetbrains.kotlin.idea.formatter.ProjectCodeStyleImporter;
import org.jetbrains.kotlin.platform.TargetPlatform;
@@ -140,8 +141,8 @@ public class KotlinModuleSettingStep extends ModuleWizardStep {
@NotNull
protected String getLibraryLabelText() {
if (JvmPlatformKt.isJvm(targetPlatform)) return "Kotlin runtime";
if (JsPlatformKt.isJs(targetPlatform)) return "Kotlin JS library";
if (JvmPlatformKt.isJvm(targetPlatform)) return KotlinJvmBundle.message("library.label.jvm");
if (JsPlatformKt.isJs(targetPlatform)) return KotlinJvmBundle.message("library.label.javascript");
throw new IllegalStateException("Only JS and JVM target are supported");
}
@@ -167,8 +168,8 @@ public class KotlinModuleSettingStep extends ModuleWizardStep {
Boolean selected = isLibrarySelected();
if (selected != null && !selected) {
if (Messages.showDialog(
"Do you want to continue with no Kotlin Runtime library?",
"No Kotlin Runtime Specified",
KotlinJvmBundle.message("library.no.kotlin.library.question"),
KotlinJvmBundle.message("library.no.kotlin.library.title"),
new String[] {CommonBundle.getYesButtonText(), CommonBundle.getNoButtonText()}, 1,
Messages.getWarningIcon()) != Messages.YES) {
return false;
@@ -26,6 +26,7 @@ import com.intellij.ui.HyperlinkLabel;
import com.intellij.util.Function;
import com.intellij.xml.util.XmlUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
import org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator;
@@ -78,13 +79,15 @@ public class ChooseModulePanel {
allModulesRadioButton.addActionListener(listener);
if (modulesWithKtFiles.size() > 2) {
allModulesWithKtNames.setHtmlText("<html>" + XmlUtil.escape(modulesWithKtFiles.get(0).getName()) + ", " +
XmlUtil.escape(modulesWithKtFiles.get(1).getName()) +
" and <a href=\"#\">" + (modulesWithKtFiles.size() - 2) + " other modules</a>");
String firstName = modulesWithKtFiles.get(0).getName();
String secondName = modulesWithKtFiles.get(1).getName();
String message = KotlinJvmBundle.message("choose.module.modules", firstName, secondName, modulesWithKtFiles.size() - 2);
allModulesWithKtNames.setHtmlText("<html>" + message);
allModulesWithKtNames.addHyperlinkListener(new HyperlinkListener() {
@Override
public void hyperlinkUpdate(HyperlinkEvent event) {
JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<Module>("Modules with Kotlin Files", modulesWithKtFiles) {
String title = KotlinJvmBundle.message("choose.module.modules.with.kotlin");
JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep<Module>(title, modulesWithKtFiles) {
@NotNull
@Override
public String getTextFor(Module value) {
@@ -26,6 +26,7 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import org.jdesktop.swingx.VerticalLayout;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import javax.swing.*;
@@ -61,7 +62,11 @@ class ChoosePathDialog extends DialogWrapper {
field.getField().setColumns(25);
myPathField = new TextFieldWithBrowseButton(field.getField());
myPathField.addBrowseFolderListener("Choose Destination Folder", "Choose folder", myProject, descriptor);
myPathField.addBrowseFolderListener(
KotlinJvmBundle.message("choose.path.title"),
KotlinJvmBundle.message("choose.path.description"),
myProject, descriptor
);
myPathField.setText(defaultPath);
panel.add(myPathField);
@@ -35,6 +35,7 @@ import com.intellij.util.ui.AsyncProcessIcon;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import org.jetbrains.kotlin.idea.KotlinPluginUtil;
import org.jetbrains.kotlin.idea.configuration.ConfigureKotlinInProjectUtilsKt;
import org.jetbrains.kotlin.idea.configuration.KotlinProjectConfigurator;
@@ -76,12 +77,14 @@ public class ConfigureDialogWithModulesAndVersion extends DialogWrapper {
) {
super(project);
setTitle("Configure Kotlin with " + configurator.getPresentableText());
setTitle(KotlinJvmBundle.message("configure.kotlin.title", configurator.getPresentableText()));
this.minimumVersion = minimumVersion;
init();
ProgressManager.getInstance().run(new Task.Backgroundable(project, "Find Kotlin Maven plugin versions", false) {
ProgressManager.getInstance().run(new Task.Backgroundable(
project, KotlinJvmBundle.message("configure.kotlin.find.maven.versions"), false
) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
loadKotlinVersions();
@@ -95,7 +98,7 @@ public class ConfigureDialogWithModulesAndVersion extends DialogWrapper {
}
});
kotlinVersionComboBox.addItem("loading...");
kotlinVersionComboBox.addItem(KotlinJvmBundle.message("configure.kotlin.loading"));
kotlinVersionComboBox.setEnabled(false);
processIcon.resume();
@@ -150,7 +153,7 @@ public class ConfigureDialogWithModulesAndVersion extends DialogWrapper {
public void run() {
infoPanel.remove(processIcon);
infoPanel.add(new JLabel(UIUtil.getBalloonWarningIcon()), BorderLayout.CENTER);
infoPanel.setToolTipText("Couldn't load versions list from search.maven.org");
infoPanel.setToolTipText(KotlinJvmBundle.message("configure.kotlin.cant.load.versions"));
infoPanel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
infoPanel.updateUI();
}
@@ -24,6 +24,7 @@ import com.intellij.util.EventDispatcher;
import kotlin.Unit;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import org.jetbrains.kotlin.idea.core.util.UiUtilsKt;
import javax.swing.*;
@@ -45,8 +46,9 @@ public class CopyIntoPanel {
public CopyIntoPanel(@Nullable Project project, @NotNull String defaultPath, @Nullable String labelText) {
copyIntoField.addBrowseFolderListener(
"Copy Into...", "Choose folder where files will be copied", project,
FileChooserDescriptorFactory.createSingleFolderDescriptor());
KotlinJvmBundle.message("copy.into.title"),
KotlinJvmBundle.message("copy.into.description"),
project, FileChooserDescriptorFactory.createSingleFolderDescriptor());
UiUtilsKt.onTextChange(
copyIntoField.getTextField(),
(DocumentEvent e) -> {
@@ -28,6 +28,7 @@ import com.intellij.util.PathUtil;
import kotlin.collections.CollectionsKt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import javax.swing.*;
import java.io.File;
@@ -83,20 +84,22 @@ public class FileUIUtils {
if (existentFiles.size() == 1) {
File conflictingFile = existentFiles.iterator().next().getValue();
message = String.format("File \"%s\" already exists in %s.\nDo you want to overwrite it?", conflictingFile.getName(),
conflictingFile.getParentFile().getAbsolutePath());
message = KotlinJvmBundle.message(
"file.exists.single",
conflictingFile.getName(), conflictingFile.getParentFile().getAbsolutePath())
;
}
else {
Collection<File> conflictFiles = CollectionsKt.map(existentFiles, Map.Entry::getValue);
message = String.format("Files already exist:\n%s\nDo you want to overwrite them?", StringUtil.join(conflictFiles, "\n"));
message = KotlinJvmBundle.message("file.exists", StringUtil.join(conflictFiles, "\n"));
}
int replaceIfExist = Messages.showYesNoDialog(
null,
message,
messagesTitle + ". Replace File",
"Overwrite",
"Cancel",
messagesTitle + KotlinJvmBundle.message("file.overwrite.title"),
KotlinJvmBundle.message("file.overwrite.overwrite"),
KotlinJvmBundle.message("file.overwrite.cancel"),
Messages.getWarningIcon());
if (replaceIfExist != JOptionPane.YES_OPTION) {
@@ -107,8 +110,8 @@ public class FileUIUtils {
for (Map.Entry<File, File> sourceToTarget : targetFiles.entrySet()) {
try {
String destinationPath = sourceToTarget.getValue().getParentFile().getAbsolutePath();
if (!ProjectWizardUtil.createDirectoryIfNotExists("Destination folder", destinationPath, false)) {
Messages.showErrorDialog(String.format("Error during folder creating '%s'", destinationPath), messagesTitle + ". Error");
if (!ProjectWizardUtil.createDirectoryIfNotExists(KotlinJvmBundle.message("file.destination.folder"), destinationPath, false)) {
Messages.showErrorDialog(KotlinJvmBundle.message("file.error.new.folder", destinationPath), messagesTitle);
return null;
}
@@ -116,7 +119,7 @@ public class FileUIUtils {
LocalFileSystem.getInstance().refreshAndFindFileByIoFile(sourceToTarget.getValue());
}
catch (IOException e) {
Messages.showErrorDialog("Error with copy file " + sourceToTarget.getKey().getName(), messagesTitle + ". Error");
Messages.showErrorDialog(KotlinJvmBundle.message("file.error.copy", sourceToTarget.getKey().getName()), messagesTitle);
return null;
}
}
@@ -14,7 +14,7 @@ import com.intellij.openapi.roots.ProjectRootManager
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.kotlin.diagnostics.Diagnostic
import org.jetbrains.kotlin.diagnostics.Errors
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.configuration.findApplicableConfigurator
import org.jetbrains.kotlin.idea.facet.getCleanRuntimeLibraryVersion
import org.jetbrains.kotlin.idea.quickfix.KotlinQuickFixAction
@@ -33,7 +33,7 @@ class AddReflectionQuickFix(element: KtElement) : AddKotlinLibQuickFix(
LibraryJarDescriptor.REFLECT_SRC_JAR
)
) {
override fun getText() = KotlinBundle.message("add.reflection.to.classpath")
override fun getText() = KotlinJvmBundle.message("classpath.add.reflection")
override fun getFamilyName() = text
override fun getLibraryDescriptor(module: Module) = MavenExternalLibraryDescriptor(
@@ -47,7 +47,7 @@ class AddReflectionQuickFix(element: KtElement) : AddKotlinLibQuickFix(
}
class AddScriptRuntimeQuickFix(element: KtElement) : AddKotlinLibQuickFix(element, listOf(LibraryJarDescriptor.SCRIPT_RUNTIME_JAR)) {
override fun getText() = KotlinBundle.message("add.script.runtime.to.classpath")
override fun getText() = KotlinJvmBundle.message("classpath.add.script.runtime")
override fun getFamilyName() = text
override fun getLibraryDescriptor(module: Module) = MavenExternalLibraryDescriptor(
@@ -68,7 +68,7 @@ class AddTestLibQuickFix(element: KtElement) : AddKotlinLibQuickFix(
LibraryJarDescriptor.TEST_SRC_JAR
)
) {
override fun getText() = KotlinBundle.message("add.test.to.classpath")
override fun getText() = KotlinJvmBundle.message("classpath.add.kotlin.test")
override fun getFamilyName() = text
override fun getLibraryDescriptor(module: Module) = MavenExternalLibraryDescriptor(
@@ -11,6 +11,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import javax.swing.*;
import java.awt.*;
@@ -27,7 +28,7 @@ public class AddToIncompatibleApiDialog extends DialogWrapper {
this.project = project;
setModal(true);
setTitle("Report as Incompatible API");
setTitle(KotlinJvmBundle.message("incompatible.api.report"));
referenceTextField.setText(qualifiedReference);
init();
@@ -53,6 +53,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.asJava.classes.KtLightClassForSourceDeclaration;
import org.jetbrains.kotlin.asJava.elements.KtLightMethod;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import org.jetbrains.kotlin.idea.MainFunctionDetector;
import org.jetbrains.kotlin.idea.caches.resolve.ResolutionUtils;
import org.jetbrains.kotlin.idea.core.FileIndexUtilsKt;
@@ -208,17 +209,20 @@ public class KotlinRunConfiguration extends JetRunConfiguration {
Module module = getConfigurationModule().getModule();
if (module == null) {
throw new RuntimeConfigurationError("Module not specified");
throw new RuntimeConfigurationError(KotlinJvmBundle.message("run.configuration.error.no.module"));
}
if (StringUtil.isEmpty(MAIN_CLASS_NAME)) {
throw new RuntimeConfigurationError("No main class specified");
throw new RuntimeConfigurationError(KotlinJvmBundle.message("run.configuration.error.no.main.class"));
}
PsiClass psiClass = JavaExecutionUtil.findMainClass(module, MAIN_CLASS_NAME);
if (psiClass == null) {
throw new RuntimeConfigurationWarning("Class '" + MAIN_CLASS_NAME + "' not found in module " + getConfigurationModule().getModuleName());
String moduleName = getConfigurationModule().getModuleName();
throw new RuntimeConfigurationWarning(
KotlinJvmBundle.message("run.configuration.error.class.not.found", MAIN_CLASS_NAME, moduleName)
);
}
if (findMainFun(psiClass) == null) {
throw new RuntimeConfigurationWarning("The class " + MAIN_CLASS_NAME + " has no main method");
throw new RuntimeConfigurationWarning(KotlinJvmBundle.message("run.configuration.error.class.no.main.method", MAIN_CLASS_NAME));
}
}
@@ -398,9 +402,9 @@ public class KotlinRunConfiguration extends JetRunConfiguration {
//noinspection ConstantConditions
FqName classFqName = new FqName(psiClass.getQualifiedName());
if (psiClass instanceof KtLightClassForSourceDeclaration) {
return String.format("Function 'main' not found in class '%s'", classFqName);
return KotlinJvmBundle.message("run.configuration.error.main.not.found", classFqName);
}
return String.format("Top-level function 'main' not found in package '%s'", classFqName.parent());
return KotlinJvmBundle.message("run.configuration.error.main.not.found.top.level", classFqName.parent());
}
private static void setupModulePath(JavaParameters params, JavaRunConfigurationModule module) {
@@ -21,6 +21,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.PanelWithAnchor;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import org.jetbrains.kotlin.parsing.KotlinParserDefinition;
import javax.swing.*;
@@ -49,7 +50,10 @@ public class KotlinStandaloneScriptRunConfigurationEditor extends SettingsEditor
})
.withTreeRootVisible(true);
chooseScriptFileTextField.addBrowseFolderListener("Choose script file", null, project, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
chooseScriptFileTextField.addBrowseFolderListener(
KotlinJvmBundle.message("script.choose.file"),
null, project, descriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT
);
}
@Override
@@ -20,11 +20,11 @@ import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.fileEditor.FileEditorManager
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.scratch.ui.findScratchFileEditorWithPreview
class ClearScratchAction : ScratchAction(
KotlinBundle.message("scratch.clear.button"),
KotlinJvmBundle.message("scratch.clear.button"),
AllIcons.Actions.GC
) {
override fun actionPerformed(e: AnActionEvent) {
@@ -25,13 +25,13 @@ import com.intellij.task.ProjectTaskContext
import com.intellij.task.ProjectTaskManager
import com.intellij.task.ProjectTaskNotification
import com.intellij.task.ProjectTaskResult
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.scratch.*
import org.jetbrains.kotlin.idea.scratch.printDebugMessage
import org.jetbrains.kotlin.idea.scratch.LOG as log
class RunScratchAction : ScratchAction(
KotlinBundle.message("scratch.run.button"),
KotlinJvmBundle.message("scratch.run.button"),
AllIcons.Actions.Execute
) {
@@ -22,13 +22,13 @@ import com.intellij.openapi.keymap.KeymapManager
import com.intellij.openapi.keymap.KeymapUtil
import com.intellij.openapi.project.DumbService
import com.intellij.task.ProjectTaskManager
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.scratch.*
import org.jetbrains.kotlin.idea.scratch.printDebugMessage
import org.jetbrains.kotlin.idea.scratch.LOG as log
class RunScratchAction : ScratchAction(
KotlinBundle.message("scratch.run.button"),
KotlinJvmBundle.message("scratch.run.button"),
AllIcons.Actions.Execute
) {
@@ -7,12 +7,12 @@ package org.jetbrains.kotlin.idea.scratch.actions
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.AnActionEvent
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.scratch.ScratchFile
import org.jetbrains.kotlin.idea.scratch.getScratchFileFromSelectedEditor
class RunScratchFromHereAction : ScratchAction(
KotlinBundle.message("scratch.run.from.here.button"),
KotlinJvmBundle.message("scratch.run.from.here.button"),
AllIcons.Diff.ArrowRight
) {
@@ -7,11 +7,11 @@ package org.jetbrains.kotlin.idea.scratch.actions
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.AnActionEvent
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.scratch.getScratchFileFromSelectedEditor
class StopScratchAction : ScratchAction(
KotlinBundle.message("scratch.stop.button"),
KotlinJvmBundle.message("scratch.stop.button"),
AllIcons.Actions.Suspend
) {
@@ -29,7 +29,7 @@ import com.intellij.openapi.vfs.VirtualFile
import com.intellij.pom.Navigatable
import com.intellij.psi.PsiManager
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.core.util.getLineNumber
import org.jetbrains.kotlin.idea.scratch.*
import org.jetbrains.kotlin.idea.scratch.output.*
@@ -171,13 +171,13 @@ class KtScratchFileEditorWithPreview private constructor(
* That's why we set long and descriptive [Presentation.getText], but short [Presentation.getDescription].
*/
override fun getShowEditorAction(): ToggleAction = super.getShowEditorAction().apply {
templatePresentation.text = KotlinBundle.message("scratch.inlay.output.mode")
templatePresentation.description = KotlinBundle.message("scratch.inlay.output.mode.description")
templatePresentation.text = KotlinJvmBundle.message("scratch.inlay.output.mode")
templatePresentation.description = KotlinJvmBundle.message("scratch.inlay.output.mode.description")
}
override fun getShowEditorAndPreviewAction(): ToggleAction = super.getShowEditorAndPreviewAction().apply {
templatePresentation.text = KotlinBundle.message("scratch.side.panel.output.mode")
templatePresentation.description = KotlinBundle.message("scratch.side.panel.output.mode.description")
templatePresentation.text = KotlinJvmBundle.message("scratch.side.panel.output.mode")
templatePresentation.description = KotlinJvmBundle.message("scratch.side.panel.output.mode.description")
}
override fun setLayout(newLayout: Layout) {
@@ -16,14 +16,16 @@ import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.vcs.changes.committed.LabeledComboBoxAction
import com.intellij.util.ui.UIUtil
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.caches.project.productionSourceInfo
import org.jetbrains.kotlin.idea.caches.project.testSourceInfo
import org.jetbrains.kotlin.idea.scratch.ScratchFile
import org.jetbrains.kotlin.idea.scratch.isKotlinWorksheet
import javax.swing.JComponent
class ModulesComboBoxAction(private val scratchFile: ScratchFile) : LabeledComboBoxAction(KotlinBundle.message("scratch.module.combobox")) {
class ModulesComboBoxAction(private val scratchFile: ScratchFile) :
LabeledComboBoxAction(KotlinJvmBundle.message("scratch.module.combobox"))
{
override fun createPopupActionGroup(button: JComponent): DefaultActionGroup {
val actionGroup = DefaultActionGroup()
actionGroup.add(ModuleIsNotSelectedAction(ConfigurationModuleSelector.NO_MODULE_TEXT))
@@ -19,7 +19,7 @@ package org.jetbrains.kotlin.idea.scratch.ui
import com.intellij.openapi.actionSystem.*
import com.intellij.openapi.application.ApplicationManager
import org.jetbrains.kotlin.idea.KotlinBundle
import org.jetbrains.kotlin.idea.KotlinJvmBundle
import org.jetbrains.kotlin.idea.scratch.ScratchFile
import org.jetbrains.kotlin.idea.scratch.ScratchFileAutoRunner
import org.jetbrains.kotlin.idea.scratch.actions.ClearScratchAction
@@ -77,12 +77,12 @@ class ScratchTopPanel(val scratchFile: ScratchFile) {
}
}
private inner class IsMakeBeforeRunAction : SmallBorderCheckboxAction(KotlinBundle.message("scratch.make.before.run.checkbox")) {
private inner class IsMakeBeforeRunAction : SmallBorderCheckboxAction(KotlinJvmBundle.message("scratch.make.before.run.checkbox")) {
override fun update(e: AnActionEvent) {
super.update(e)
e.presentation.isVisible = scratchFile.module != null
e.presentation.description = scratchFile.module?.let { selectedModule ->
KotlinBundle.message("scratch.make.before.run.checkbox.description", selectedModule.name)
KotlinJvmBundle.message("scratch.make.before.run.checkbox.description", selectedModule.name)
}
}
@@ -96,8 +96,8 @@ class ScratchTopPanel(val scratchFile: ScratchFile) {
}
private inner class IsInteractiveCheckboxAction : SmallBorderCheckboxAction(
text = KotlinBundle.message("scratch.is.interactive.checkbox"),
description = KotlinBundle.message("scratch.is.interactive.checkbox.description", ScratchFileAutoRunner.AUTO_RUN_DELAY_IN_SECONDS)
text = KotlinJvmBundle.message("scratch.is.interactive.checkbox"),
description = KotlinJvmBundle.message("scratch.is.interactive.checkbox.description", ScratchFileAutoRunner.AUTO_RUN_DELAY_IN_SECONDS)
) {
override fun isSelected(e: AnActionEvent): Boolean {
return scratchFile.options.isInteractiveMode
@@ -109,8 +109,8 @@ class ScratchTopPanel(val scratchFile: ScratchFile) {
}
private inner class IsReplCheckboxAction : SmallBorderCheckboxAction(
text = KotlinBundle.message("scratch.is.repl.checkbox"),
description = KotlinBundle.message("scratch.is.repl.checkbox.description")
text = KotlinJvmBundle.message("scratch.is.repl.checkbox"),
description = KotlinJvmBundle.message("scratch.is.repl.checkbox.description")
) {
override fun isSelected(e: AnActionEvent): Boolean {
return scratchFile.options.isRepl
@@ -25,6 +25,7 @@ import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import javax.swing.*;
import java.awt.*;
@@ -388,9 +389,9 @@ public class TextEditorWithPreview extends UserDataHolderBase implements FileEdi
}
public enum Layout {
SHOW_EDITOR("Editor only", AllIcons.General.LayoutEditorOnly),
SHOW_PREVIEW("Preview only", AllIcons.General.LayoutPreviewOnly),
SHOW_EDITOR_AND_PREVIEW("Editor and Preview", AllIcons.General.LayoutEditorPreview);
SHOW_EDITOR(KotlinJvmBundle.message("editor.editor.only"), AllIcons.General.LayoutEditorOnly),
SHOW_PREVIEW(KotlinJvmBundle.message("editor.preview.only"), AllIcons.General.LayoutPreviewOnly),
SHOW_EDITOR_AND_PREVIEW(KotlinJvmBundle.message("editor.editor.and.preview"), AllIcons.General.LayoutEditorPreview);
private final String myName;
private final Icon myIcon;
@@ -24,6 +24,7 @@ import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.idea.KotlinJvmBundle;
import javax.swing.*;
import java.awt.*;
@@ -387,9 +388,9 @@ public class TextEditorWithPreview extends UserDataHolderBase implements FileEdi
}
public enum Layout {
SHOW_EDITOR("Editor only", AllIcons.General.LayoutEditorOnly),
SHOW_PREVIEW("Preview only", AllIcons.General.LayoutPreviewOnly),
SHOW_EDITOR_AND_PREVIEW("Editor and Preview", AllIcons.General.LayoutEditorPreview);
SHOW_EDITOR(KotlinJvmBundle.message("editor.editor.only"), AllIcons.General.LayoutEditorOnly),
SHOW_PREVIEW(KotlinJvmBundle.message("editor.preview.only"), AllIcons.General.LayoutPreviewOnly),
SHOW_EDITOR_AND_PREVIEW(KotlinJvmBundle.message("editor.editor.and.preview"), AllIcons.General.LayoutEditorPreview);
private final String myName;
private final Icon myIcon;