i18n: javafx

GitOrigin-RevId: 965b90ad8ee53204f2598d762bd218fb18a91f24
This commit is contained in:
Anna Kozlova
2020-08-25 09:07:09 +00:00
committed by intellij-monorepo-bot
parent bb48a83198
commit 2b3482d76b
22 changed files with 119 additions and 70 deletions
@@ -1,6 +1,8 @@
// Copyright 2000-2018 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 org.jetbrains.plugins.javaFX.packaging;
import com.intellij.openapi.util.NlsSafe;
public class JavaFxManifestAttribute {
private String myName;
private String myValue;
@@ -13,6 +15,7 @@ public class JavaFxManifestAttribute {
myValue = value;
}
@NlsSafe
public String getName() {
return myName;
}
@@ -21,6 +24,7 @@ public class JavaFxManifestAttribute {
myName = name;
}
@NlsSafe
public String getValue() {
return myValue;
}
@@ -17,7 +17,6 @@ import com.intellij.psi.PsiFile;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.javaFX.codeInsight.JavaFxFieldToPropertyIntention;
import org.jetbrains.plugins.javaFX.fxml.AbstractJavaFXTestCase;
import org.jetbrains.plugins.javaFX.packaging.JavaFxApplicationArtifactType;
@@ -27,7 +26,6 @@ import java.util.List;
* @author Pavel.Dolgov
*/
public class JavaFxFieldToPropertyTest extends DaemonAnalyzerTestCase {
private static final String actionName = JavaFxFieldToPropertyIntention.FAMILY_NAME;
@Override
protected void setUpModule() {
@@ -95,7 +93,7 @@ public class JavaFxFieldToPropertyTest extends DaemonAnalyzerTestCase {
final List<HighlightInfo> infos = doHighlighting();
final Editor editor = getEditor();
final PsiFile file = getFile();
return findIntentionAction(infos, actionName, editor, file);
return findIntentionAction(infos, JavaFXBundle.message("intention.family.name.convert.to.javafx.property"), editor, file);
}
protected boolean isArtifactNeeded() {
@@ -80,7 +80,7 @@ javafx.entry.point.javafx.app=JavaFX Applications
javafx.expand.attribute.to.tag.intention=Expand ''{0}'' to tag
javafx.expand.attribute.to.tag.intention.family.name=Expand attribute to tag
javafx.failed.to.start.scene.builder.error=Failed to start SceneBuilder: {0}
javafx.field.to.property.intention.search.for.usages=Searching for usages of ''{0}''
javafx.field.to.property.intention.search.for.usages=Searching for Usages of ''{0}''
javafx.inject.page.language.intention.family.name=Specify page language
javafx.preloader.artifact.properties.editor.preloader.class=&Preloader class:
javafx.project.sdk.setup.validator.runtime.not.configured.error=The JavaFX runtime is not configured. Either use a JDK that has the JavaFX built in, or add a JavaFX library to the classpath
@@ -109,4 +109,34 @@ inspection.java.fx.unresolved.fx.id.reference.display.name=Unresolved fx:id attr
inspection.java.fx.default.tag.display.name=Unnecessary default tag
action.OpenInSceneBuilder.text=Open In SceneBuilder
javafx.application.title=JavaFx application
javafx.preloader.title=JavaFx preloader
javafx.preloader.title=JavaFx preloader
intention.family.name.convert.to.javafx.property=Convert to JavaFX property
command.name.convert.to.javafx.property=Convert ''{0}'' to JavaFX Property
popup.title.choose.component.with.fx.id=<html>Choose component with fx:id <b>{0}<b></html>
intention.name.change.parameter.type.to=Change parameter type of ''{0}'' to {1}
conversion.between.unrelated.types.error=Conversion between unrelated types, {0} to {1}
unable.to.coerce.error=Unable to coerce {0} to {1}
inspection.message.copy.constructor.not.found=Copy constructor not found for ''{0}''
inspection.message.fx.controller.can.only.be.applied.to.root.element='fx:controller' can only be applied to root element
unable.to.instantiate=Unable to instantiate
spaces.not.allowed.before.property.or.expression=Spaces aren't allowed before property or expression
invalid.value.unable.to.coerce=Invalid value: unable to coerce to {0}
no.controller.specified.for.top.level.element=No controller specified for top level element
incorrect.expression.syntax=Incorrect expression syntax
unable.to.coerce=Unable to coerce to {0}
invalid.enumerated.value=Invalid enumerated value
inspection.message.fx.root.valid.only.as.root.node.fxml.document='<fx:root>' is valid only as the root node of an FXML document
label.selected.module.output.would.to.be.included.in.artifact=Selected module output would to be included in the artifact
dialog.title.select.module.for.artifact=Select Module
action.from.module.artifact.text=From module...
action.from.modules.artifact.text=From module ''{0}''
dialog.title.choose.preloader.class=Choose Preloader Class
dialog.title.choose.application.class=Choose Application Class
column.name.artifact.manifest.property.name=Name
column.name.artifact.manifest.property.value=Value
java.fx.artifacts.tab.name=Java FX
javafx.preloader.tab.name=JavaFX Preloader
scene.builder.editor.tab.name=Scene Builder
constant.not.found=Constant ''{0}'' is not found
cannot.class.name.to.field.name=Cannot set {0} to field ''{1}''
enum.constant.not.found=No enum constant ''{0}'' in {1}
@@ -30,7 +30,6 @@ import com.intellij.util.IncorrectOperationException;
import com.intellij.util.containers.ContainerUtil;
import com.siyeh.ig.psiutils.ParenthesesUtils;
import gnu.trove.THashSet;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
@@ -46,19 +45,17 @@ import java.util.Set;
*/
public class JavaFxFieldToPropertyIntention extends PsiElementBaseIntentionAction implements LowPriorityAction {
private static final Logger LOG = Logger.getInstance(JavaFxFieldToPropertyIntention.class);
public static final String FAMILY_NAME = "Convert to JavaFX property";
@Nls
@NotNull
@Override
public String getFamilyName() {
return FAMILY_NAME;
return JavaFXBundle.message("intention.family.name.convert.to.javafx.property");
}
@NotNull
@Override
public String getText() {
return FAMILY_NAME;
return JavaFXBundle.message("intention.family.name.convert.to.javafx.property");
}
@Override
@@ -108,7 +105,7 @@ public class JavaFxFieldToPropertyIntention extends PsiElementBaseIntentionActio
});
});
WriteCommandAction
.runWriteCommandAction(myProject, "Convert '" + myProperty.myFieldName + "' to JavaFX property", null,
.runWriteCommandAction(myProject, JavaFXBundle.message("command.name.convert.to.javafx.property", myProperty.myFieldName), null,
this::replaceOccurrences, myFiles.toArray(PsiFile.EMPTY_ARRAY));
}
@@ -5,6 +5,7 @@ import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.daemon.Validator;
import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtil;
import com.intellij.codeInsight.daemon.impl.analysis.JavaGenericsUtil;
import com.intellij.codeInspection.util.InspectionMessage;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.lang.ASTNode;
import com.intellij.lang.xml.XMLLanguage;
@@ -29,10 +30,8 @@ import com.intellij.xml.XmlAttributeDescriptor;
import com.intellij.xml.XmlElementDescriptor;
import gnu.trove.THashMap;
import gnu.trove.THashSet;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.*;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
import org.jetbrains.plugins.javaFX.fxml.descriptors.JavaFxClassTagDescriptorBase;
import org.jetbrains.plugins.javaFX.fxml.descriptors.JavaFxPropertyTagDescriptor;
import org.jetbrains.plugins.javaFX.indexing.JavaFxControllerClassIndex;
@@ -470,7 +469,7 @@ public final class JavaFxPsiUtil {
final PsiMethod valueOf = findValueOfMethod(psiClass);
if (valueOf == null) {
if (!hasBuilder(psiClass)) {
messageConsumer.accept("Unable to instantiate");
messageConsumer.accept(JavaFXBundle.message("unable.to.instantiate"));
return false;
}
}
@@ -626,16 +625,17 @@ public final class JavaFxPsiUtil {
private static boolean unableToCoerceError(@NotNull PsiType targetType, @NotNull PsiClass fromClass,
@NotNull BiConsumer<? super String, ? super Validator.ValidationHost.ErrorType> messageConsumer) {
messageConsumer.accept("Unable to coerce " + HighlightUtil.formatClass(fromClass) + " to " + targetType.getCanonicalText(),
Validator.ValidationHost.ErrorType.ERROR);
messageConsumer.accept(
JavaFXBundle.message("unable.to.coerce.error", HighlightUtil.formatClass(fromClass), targetType.getCanonicalText()),
Validator.ValidationHost.ErrorType.ERROR);
return false;
}
private static boolean unrelatedTypesWarning(@NotNull PsiType targetType, @NotNull PsiClass fromClass,
@NotNull BiConsumer<? super String, ? super Validator.ValidationHost.ErrorType> messageConsumer) {
messageConsumer.accept("Conversion between unrelated types, " + HighlightUtil.formatClass(fromClass) +
" to " + targetType.getCanonicalText(),
Validator.ValidationHost.ErrorType.WARNING);
@NotNull BiConsumer<? super @InspectionMessage String, ? super Validator.ValidationHost.ErrorType> messageConsumer) {
messageConsumer.accept(
JavaFXBundle.message("conversion.between.unrelated.types.error", HighlightUtil.formatClass(fromClass), targetType.getCanonicalText()),
Validator.ValidationHost.ErrorType.WARNING);
return true;
}
@@ -1105,7 +1105,7 @@ public final class JavaFxPsiUtil {
}
@Nullable
public static String validateEnumConstant(@NotNull PsiClass enumClass, @NonNls @Nullable String name) {
public static @Nls String validateEnumConstant(@NotNull PsiClass enumClass, @NonNls @Nullable String name) {
if (!enumClass.isEnum() || name == null) return null;
final Set<String> constantNames = CachedValuesManager.getCachedValue(enumClass, () ->
CachedValueProvider.Result.create(Arrays.stream(enumClass.getFields())
@@ -1115,7 +1115,7 @@ public final class JavaFxPsiUtil {
.collect(Collectors.toCollection(THashSet::new)),
PsiModificationTracker.MODIFICATION_COUNT));
if (!constantNames.contains(StringUtil.toUpperCase(name))) {
return "No enum constant '" + name + "' in " + enumClass.getQualifiedName();
return JavaFXBundle.message("enum.constant.not.found", name, enumClass.getQualifiedName());
}
return null;
}
@@ -34,6 +34,7 @@ import com.intellij.ui.awt.RelativePoint;
import com.intellij.util.Function;
import com.intellij.util.Functions;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
import org.jetbrains.plugins.javaFX.fxml.JavaFxFileTypeFactory;
import org.jetbrains.plugins.javaFX.fxml.JavaFxPsiUtil;
@@ -114,7 +115,8 @@ public class JavaFxRelatedItemLineMarkerProvider extends RelatedItemLineMarkerPr
return;
}
final JBPopup popup = NavigationUtil
.getPsiElementPopup(relatedItems.toArray(PsiElement.EMPTY_ARRAY), "<html>Choose component with fx:id <b>" + fieldName.getText() + "<b></html>");
.getPsiElementPopup(relatedItems.toArray(PsiElement.EMPTY_ARRAY),
JavaFXBundle.message("popup.title.choose.component.with.fx.id", fieldName.getText()));
popup.show(new RelativePoint(e));
}
}
@@ -7,6 +7,7 @@ import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.*;
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
import com.intellij.codeInspection.util.IntentionName;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
@@ -170,13 +171,12 @@ public class JavaFxEventHandlerInspection extends XmlSuppressableInspectionTool
}
private static class ChangeParameterTypeQuickFix extends LocalQuickFixOnPsiElement {
final String myText;
final @IntentionName String myText;
ChangeParameterTypeQuickFix(@NotNull XmlAttribute attribute, @NotNull PsiMethod method,
@NotNull PsiType suggestedParameterType) {
super(attribute);
myText = "Change parameter type of '" + JavaHighlightUtil.formatMethod(method) +
"' to " + suggestedParameterType.getPresentableText();
myText = JavaFXBundle.message("intention.name.change.parameter.type.to", JavaHighlightUtil.formatMethod(method), suggestedParameterType.getPresentableText());
}
@Override
@@ -8,6 +8,7 @@ import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.xml.XmlAttributeValue;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
import org.jetbrains.plugins.javaFX.fxml.JavaFxPsiUtil;
@@ -83,7 +84,7 @@ public class JavaFxBuiltInAttributeDescriptor extends JavaFxPropertyAttributeDes
if (tagClass != null) {
final PsiField field = controllerClass.findFieldByName(value, true);
if (field != null && !InheritanceUtil.isInheritorOrSelf(tagClass, PsiUtil.resolveClassInType(field.getType()), true)) {
return "Cannot set " + tagClass.getQualifiedName() + " to field '" + field.getName() + "'";
return JavaFXBundle.message("cannot.class.name.to.field.name", tagClass.getQualifiedName(), field.getName());
}
}
}
@@ -127,7 +128,7 @@ public class JavaFxBuiltInAttributeDescriptor extends JavaFxPropertyAttributeDes
}
final PsiMethod method = JavaFxPsiUtil.findValueOfMethod(tagClass);
if (method == null) {
return "Unable to coerce '" + value + "' to " + tagClass.getQualifiedName() + ".";
return JavaFXBundle.message("unable.to.coerce.error",value, tagClass.getQualifiedName());
}
}
return validateLiteral(xmlAttributeValue, value);
@@ -167,7 +168,7 @@ public class JavaFxBuiltInAttributeDescriptor extends JavaFxPropertyAttributeDes
if (tagClass != null) {
final PsiField constField = tagClass.findFieldByName(value, true);
if (constField == null || !isConstant(constField)) {
return "Constant '" + value + "' is not found";
return JavaFXBundle.message("constant.not.found", value);
}
}
return null;
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.javaFX.fxml.descriptors;
import com.intellij.codeInsight.daemon.Validator;
import com.intellij.codeInspection.util.InspectionMessage;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
@@ -30,6 +31,7 @@ import com.intellij.xml.XmlNSDescriptor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
import org.jetbrains.plugins.javaFX.fxml.JavaFxPsiUtil;
@@ -234,7 +236,7 @@ public class JavaFxBuiltInTagDescriptor implements XmlElementDescriptor, Validat
final PsiElement declaration = descriptor.getDeclaration();
if (declaration instanceof PsiClass) {
final PsiClass psiClass = (PsiClass)declaration;
JavaFxPsiUtil.isClassAcceptable(context.getParentTag(), psiClass, (errorMessage, errorType) ->
JavaFxPsiUtil.isClassAcceptable(context.getParentTag(), psiClass, (@InspectionMessage var errorMessage, var errorType) ->
host.addMessage(context.getNavigationElement(), errorMessage, errorType));
final String contextName = context.getName();
if (FxmlConstants.FX_COPY.equals(contextName)) {
@@ -247,7 +249,8 @@ public class JavaFxBuiltInTagDescriptor implements XmlElementDescriptor, Validat
}
}
if (!copyConstructorFound) {
host.addMessage(context.getNavigationElement(), "Copy constructor not found for '" + psiClass.getName() + "'",
host.addMessage(context.getNavigationElement(),
JavaFXBundle.message("inspection.message.copy.constructor.not.found", psiClass.getName()),
ValidationHost.ErrorType.ERROR);
}
}
@@ -3,6 +3,7 @@ package org.jetbrains.plugins.javaFX.fxml.descriptors;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.daemon.Validator;
import com.intellij.codeInspection.util.InspectionMessage;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
@@ -19,6 +20,7 @@ import com.intellij.xml.XmlNSDescriptor;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
import org.jetbrains.plugins.javaFX.fxml.JavaFxCommonNames;
import org.jetbrains.plugins.javaFX.fxml.JavaFxPsiUtil;
@@ -304,16 +306,17 @@ public abstract class JavaFxClassTagDescriptorBase implements XmlElementDescript
if (parentTag != null) {
final XmlAttribute attribute = context.getAttribute(FxmlConstants.FX_CONTROLLER);
if (attribute != null) {
host.addMessage(attribute.getNameElement(), "fx:controller can only be applied to root element", ValidationHost.ErrorType.ERROR); //todo add delete/move to upper tag fix
host.addMessage(attribute.getNameElement(),
JavaFXBundle.message("inspection.message.fx.controller.can.only.be.applied.to.root.element"), ValidationHost.ErrorType.ERROR); //todo add delete/move to upper tag fix
}
}
final Pair<PsiClass, Boolean> tagValueClassInfo = JavaFxPsiUtil.getTagValueClass(context, getPsiClass());
final PsiClass aClass = tagValueClassInfo.getFirst();
JavaFxPsiUtil.isClassAcceptable(parentTag, aClass, (errorMessage, errorType) ->
JavaFxPsiUtil.isClassAcceptable(parentTag, aClass, (@InspectionMessage var errorMessage, var errorType) ->
host.addMessage(context.getNavigationElement(), errorMessage, errorType));
boolean needInstantiate = !tagValueClassInfo.getSecond();
if (needInstantiate && aClass != null && aClass.isValid()) {
JavaFxPsiUtil.isAbleToInstantiate(aClass, errorMessage ->
JavaFxPsiUtil.isAbleToInstantiate(aClass, (@InspectionMessage var errorMessage) ->
host.addMessage(context, errorMessage, ValidationHost.ErrorType.ERROR));
}
}
@@ -1,6 +1,7 @@
// 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.
package org.jetbrains.plugins.javaFX.fxml.descriptors;
import com.intellij.codeInspection.util.InspectionMessage;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.util.InheritanceUtil;
@@ -9,8 +10,10 @@ import com.intellij.psi.xml.*;
import com.intellij.util.ArrayUtilRt;
import com.intellij.xml.XmlAttributeDescriptor;
import com.intellij.xml.impl.BasicXmlAttributeDescriptor;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
import org.jetbrains.plugins.javaFX.fxml.FxmlConstants;
import org.jetbrains.plugins.javaFX.fxml.JavaFxCommonNames;
import org.jetbrains.plugins.javaFX.fxml.JavaFxPsiUtil;
@@ -120,7 +123,7 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
}
@Nullable
protected String validateAttributeValue(@NotNull XmlAttributeValue xmlAttributeValue, @NotNull String value) {
protected @Nls String validateAttributeValue(@NotNull XmlAttributeValue xmlAttributeValue, @NotNull String value) {
final PsiElement parent = xmlAttributeValue.getParent();
if (parent instanceof XmlAttribute && JavaFxPsiUtil.isEventHandlerProperty((XmlAttribute)parent)) {
return validateAttributeHandler(xmlAttributeValue, value);
@@ -129,7 +132,7 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
return validatePropertyExpression(xmlAttributeValue, value);
}
else if (StringUtil.trimLeading(value).startsWith("$")) {
return "Spaces aren't allowed before property or expression";
return JavaFXBundle.message("spaces.not.allowed.before.property.or.expression");
}
else if (value.startsWith("%")) {
return null;
@@ -140,30 +143,30 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
}
@Nullable
private static String validateAttributeHandler(@NotNull XmlElement context, @NotNull String value) {
private static @Nls String validateAttributeHandler(@NotNull XmlElement context, @NotNull String value) {
if (value.startsWith("#")) {
if (JavaFxPsiUtil.getControllerClass(context.getContainingFile()) == null) {
return "No controller specified for top level element";
return JavaFXBundle.message("no.controller.specified.for.top.level.element");
}
}
else {
if (JavaFxPsiUtil.parseInjectedLanguages((XmlFile)context.getContainingFile()).isEmpty()) {
return "Page language not specified.";
return JavaFXBundle.message("javafx.annotator.page.language.not.specified");
}
}
return null;
}
@Nullable
private static String validatePropertyExpression(@NotNull XmlAttributeValue xmlAttributeValue, @NotNull String value) {
private static @Nls String validatePropertyExpression(@NotNull XmlAttributeValue xmlAttributeValue, @NotNull String value) {
if (JavaFxPsiUtil.isIncorrectExpressionBinding(value)) {
return "Incorrect expression syntax";
return JavaFXBundle.message("incorrect.expression.syntax");
}
final List<String> propertyNames = JavaFxPsiUtil.isExpressionBinding(value)
? StringUtil.split(value.substring(2, value.length() - 1), ".", true, false)
: Collections.singletonList(value.substring(1));
if (isIncompletePropertyChain(propertyNames)) {
return "Incorrect expression syntax";
return JavaFXBundle.message("incorrect.expression.syntax");
}
if (FxmlConstants.NULL_EXPRESSION.equals(value)) return null;
@@ -171,7 +174,7 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
final PsiType targetPropertyType = JavaFxPsiUtil.getWritablePropertyType(xmlAttributeValue);
if (FxmlConstants.isNullValue(value)) {
if (JavaFxPsiUtil.isPrimitiveOrBoxed(targetPropertyType)) {
return "Unable to coerce to " + targetPropertyType.getPresentableText();
return JavaFXBundle.message("unable.to.coerce", targetPropertyType.getPresentableText());
}
return null;
}
@@ -190,7 +193,7 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
aClass = JavaFxPsiUtil.getPropertyClass(JavaFxPsiUtil.getReadablePropertyType(member), xmlAttributeValue);
}
if (aClass != null && !InheritanceUtil.isInheritorOrSelf(aClass, targetPropertyClass, true)) {
return "Invalid value: unable to coerce to " + targetPropertyClass.getQualifiedName();
return JavaFXBundle.message("invalid.value.unable.to.coerce", targetPropertyClass.getQualifiedName());
}
}
return null;
@@ -201,7 +204,7 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
}
@Nullable
protected static String validateLiteral(@NotNull XmlAttributeValue xmlAttributeValue, @NotNull String value) {
protected static @Nls String validateLiteral(@NotNull XmlAttributeValue xmlAttributeValue, @NotNull String value) {
final PsiClass tagClass = JavaFxPsiUtil.getTagClass(xmlAttributeValue);
final PsiElement declaration = JavaFxPsiUtil.getAttributeDeclaration(xmlAttributeValue);
final String boxedQName;
@@ -235,7 +238,7 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
}
}
}
return "Invalid value: unable to coerce to " + boxedQName;
return JavaFXBundle.message("invalid.value.unable.to.coerce", boxedQName);
}
}
catch (Throwable ignore) {
@@ -244,6 +247,7 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
return null;
}
@InspectionMessage
@Nullable
public static String validateLiteralOrEnumConstant(@NotNull XmlAttributeValue xmlAttributeValue, @NotNull String value) {
final PsiElement parent = xmlAttributeValue.getParent();
@@ -254,7 +258,7 @@ public class JavaFxPropertyAttributeDescriptor extends BasicXmlAttributeDescript
if (aClass != null) {
final PsiField field = aClass.findFieldByName(value, true);
if (field == null || !((JavaFxPropertyAttributeDescriptor)descriptor).isConstant(field)) {
return "Invalid enumerated value";
return JavaFXBundle.message("invalid.enumerated.value");
}
return null;
}
@@ -60,7 +60,8 @@ public class JavaFxRootTagDescriptor extends JavaFxClassTagDescriptorBase {
super.validate(context, host);
if (context.getParentTag() != null) {
host.addMessage(context.getNavigationElement(), "<fx:root> is valid only as the root node of an FXML document",
host.addMessage(context.getNavigationElement(),
JavaFXBundle.message("inspection.message.fx.root.valid.only.as.root.node.fxml.document"),
ValidationHost.ErrorType.ERROR);
}
}
@@ -85,9 +85,9 @@ public class JavaFxApplicationArtifactType extends ArtifactType {
@Override
public String getPresentableName() {
if (myModules.size() == 1) {
return "From module '" + myModules.get(0).getName() + "'";
return JavaFXBundle.message("action.from.modules.artifact.text", myModules.get(0).getName());
}
return "From module...";
return JavaFXBundle.message("action.from.module.artifact.text");
}
@Override
@@ -97,8 +97,9 @@ public class JavaFxApplicationArtifactType extends ArtifactType {
module = myModules.get(0);
} else {
final ChooseModulesDialog dialog = new ChooseModulesDialog(myModules.get(0).getProject(), myModules,
"Select Module",
"Selected module output would to be included in the artifact");
JavaFXBundle.message("dialog.title.select.module.for.artifact"),
JavaFXBundle.message(
"label.selected.module.output.would.to.be.included.in.artifact"));
dialog.setSingleSelectionMode();
if (dialog.showAndGet()) {
final List<Module> elements = dialog.getChosenElements();
@@ -13,6 +13,7 @@ import com.intellij.packaging.impl.artifacts.ArtifactUtil;
import com.intellij.psi.PsiClass;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.InheritanceUtil;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
import javax.swing.*;
import java.util.Collections;
@@ -56,10 +57,10 @@ public class JavaFxApplicationClassBrowser extends ClassBrowser<JTextField> {
}
public static JavaFxApplicationClassBrowser appClassBrowser(Project project, Artifact artifact) {
return new JavaFxApplicationClassBrowser(project, "Choose Application Class", "javafx.application.Application", artifact);
return new JavaFxApplicationClassBrowser(project, JavaFXBundle.message("dialog.title.choose.application.class"), "javafx.application.Application", artifact);
}
public static JavaFxApplicationClassBrowser preloaderClassBrowser(Project project, Artifact artifact) {
return new JavaFxApplicationClassBrowser(project, "Choose Preloader Class", "javafx.application.Preloader", artifact);
return new JavaFxApplicationClassBrowser(project, JavaFXBundle.message("dialog.title.choose.preloader.class"), "javafx.application.Preloader", artifact);
}
}
@@ -10,6 +10,7 @@ import com.intellij.openapi.projectRoots.JavaSdk;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactManager;
import com.intellij.packaging.artifacts.ArtifactProperties;
@@ -303,7 +304,7 @@ public class JavaFxArtifactProperties extends ArtifactProperties<JavaFxArtifactP
return null;
}
public String getNativeBundle() {
public @NlsSafe String getNativeBundle() {
return myNativeBundle;
}
@@ -327,7 +328,7 @@ public class JavaFxArtifactProperties extends ArtifactProperties<JavaFxArtifactP
myIcons = icons;
}
public String getMsgOutputLevel() {
public @NlsSafe String getMsgOutputLevel() {
return myMsgOutputLevel;
}
@@ -107,7 +107,7 @@ public class JavaFxArtifactPropertiesEditor extends ArtifactPropertiesEditor {
@Override
public String getTabName() {
return "Java FX";
return JavaFXBundle.message("java.fx.artifacts.tab.name");
}
@Nullable
@@ -285,7 +285,8 @@ public class JavaFxArtifactPropertiesEditor extends ArtifactPropertiesEditor {
private static class AttributesTable extends ListTableWithButtons<JavaFxManifestAttribute> {
@Override
protected ListTableModel createListModel() {
final ColumnInfo name = new ElementsColumnInfoBase<JavaFxManifestAttribute>("Name") {
final ColumnInfo name = new ElementsColumnInfoBase<JavaFxManifestAttribute>(JavaFXBundle.message(
"column.name.artifact.manifest.property.name")) {
@Nullable
@Override
public String valueOf(JavaFxManifestAttribute attribute) {
@@ -309,7 +310,7 @@ public class JavaFxArtifactPropertiesEditor extends ArtifactPropertiesEditor {
}
};
final ColumnInfo value = new ElementsColumnInfoBase<JavaFxManifestAttribute>("Value") {
final ColumnInfo value = new ElementsColumnInfoBase<JavaFxManifestAttribute>(JavaFXBundle.message("column.name.artifact.manifest.property.value")) {
@Override
public String valueOf(JavaFxManifestAttribute attr) {
return attr.getValue();
@@ -7,6 +7,7 @@ import com.intellij.openapi.util.Comparing;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.ui.ArtifactPropertiesEditor;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.javaFX.JavaFXBundle;
import org.jetbrains.plugins.javaFX.packaging.JavaFxApplicationClassBrowser;
import javax.swing.*;
@@ -24,7 +25,7 @@ public class JavaFxPreloaderArtifactPropertiesEditor extends ArtifactPropertiesE
@Override
public String getTabName() {
return "JavaFX Preloader";
return JavaFXBundle.message("javafx.preloader.tab.name");
}
@Nullable
@@ -4,6 +4,7 @@ package org.jetbrains.plugins.javaFX.resources;
import com.intellij.codeInspection.LocalInspectionToolSession;
import com.intellij.codeInspection.ProblemsHolder;
import com.intellij.codeInspection.XmlSuppressableInspectionTool;
import com.intellij.codeInspection.util.InspectionMessage;
import com.intellij.lang.properties.psi.Property;
import com.intellij.lang.properties.references.PropertyReference;
import com.intellij.psi.PsiElementVisitor;
@@ -31,7 +32,7 @@ public final class JavaFxResourcePropertyValueInspection extends XmlSuppressable
public void visitXmlAttributeValue(XmlAttributeValue xmlAttributeValue) {
super.visitXmlAttributeValue(xmlAttributeValue);
final String value = xmlAttributeValue.getValue();
if (value != null && value.startsWith("%") && value.length() > 1) {
if (value.startsWith("%") && value.length() > 1) {
final PsiReference reference = xmlAttributeValue.getReference();
if (reference instanceof PropertyReference) {
final ResolveResult[] resolveResults = ((PropertyReference)reference).multiResolve(false);
@@ -48,7 +49,7 @@ public final class JavaFxResourcePropertyValueInspection extends XmlSuppressable
.map(propertyValue -> JavaFxPropertyAttributeDescriptor.validateLiteralOrEnumConstant(xmlAttributeValue, propertyValue))
.nonNull()
.distinct()
.forEach(errorMessage -> holder.registerProblem(xmlAttributeValue, errorMessage));
.forEach((@InspectionMessage var errorMessage) -> holder.registerProblem(xmlAttributeValue, errorMessage));
}
}
}
@@ -301,7 +301,7 @@ public class SceneBuilderEditor extends UserDataHolderBase implements FileEditor
@NotNull
@Override
public String getName() {
return "Scene Builder";
return JavaFXBundle.message("scene.builder.editor.tab.name");
}
@Override
@@ -1,10 +1,10 @@
<?import javafx.scene.layout.*?>
<GridPane xmlns:fx="http://javafx.com/fxml">
<<error descr="<fx:root> is valid only as the root node of an FXML document">fx:root</error> type="javafx.scene.layout.AnchorPane"/>
<<error descr="'<fx:root>' is valid only as the root node of an FXML document">fx:root</error> type="javafx.scene.layout.AnchorPane"/>
<fx:define>
<<error descr="<fx:root> is valid only as the root node of an FXML document">fx:root</error> type="javafx.scene.layout.AnchorPane"/>
<<error descr="'<fx:root>' is valid only as the root node of an FXML document">fx:root</error> type="javafx.scene.layout.AnchorPane"/>
</fx:define>
<GridPane>
<<error descr="<fx:root> is valid only as the root node of an FXML document">fx:root</error> type="javafx.scene.layout.AnchorPane"/>
<<error descr="'<fx:root>' is valid only as the root node of an FXML document">fx:root</error> type="javafx.scene.layout.AnchorPane"/>
</GridPane>
</GridPane>
@@ -2,7 +2,7 @@
<?import javafx.scene.layout.*?>
<AnchorPane id="AnchorPane" xmlns:fx="http://javafx.com/fxml" fx:controller="<error descr="Cannot resolve class or package 'unknownPackage'">unknownPackage</error>.<error descr="Cannot resolve class 'UnknownClass'">UnknownClass</error>">
<children>
<AnchorPane id="anchorPane2" <error descr="fx:controller can only be applied to root element">fx:controller</error>="java.util.ArrayList">
<AnchorPane id="anchorPane2" <error descr="'fx:controller' can only be applied to root element">fx:controller</error>="java.util.ArrayList">
<children>
</children>
</AnchorPane>
@@ -6,7 +6,7 @@
<GridPane xmlns:fx="http://javafx.com/fxml">
<fx:define>
<FXCollections fx:factory="observableArrayList">
<ArrayList fx:value=<error descr="Unable to coerce 'A' to java.util.ArrayList.">"A"</error>/>
<ArrayList fx:value=<error descr="Unable to coerce A to java.util.ArrayList">"A"</error>/>
</FXCollections>
<FXCollections fx:factory="observableArrayList">