mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
[xml] i18n: annotate XML API interfaces with @NlsSafe
GitOrigin-RevId: f6c35f668491840445d612002591a2e00834ae69
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0e4c725da2
commit
171042ddae
@@ -1,12 +1,13 @@
|
||||
// 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.psi.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public interface XmlAttlistDecl extends XmlElement {
|
||||
XmlAttlistDecl[] EMPTY_ARRAY = new XmlAttlistDecl[0];
|
||||
|
||||
XmlElement getNameElement();
|
||||
@Nullable String getName();
|
||||
@Nullable @NlsSafe String getName();
|
||||
XmlAttributeDecl[] getAttributeDecls();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// 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.psi.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.xml.XmlAttributeDescriptor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -13,21 +13,21 @@ public interface XmlAttribute extends XmlElement, PsiNamedElement {
|
||||
XmlAttribute[] EMPTY_ARRAY = new XmlAttribute[0];
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
@NlsSafe
|
||||
@NotNull
|
||||
String getName();
|
||||
|
||||
@NonNls
|
||||
@NlsSafe
|
||||
@NotNull
|
||||
String getLocalName();
|
||||
|
||||
XmlElement getNameElement();
|
||||
|
||||
@NonNls
|
||||
@NlsSafe
|
||||
@NotNull
|
||||
String getNamespace();
|
||||
|
||||
@NonNls
|
||||
@NlsSafe
|
||||
@NotNull
|
||||
String getNamespacePrefix();
|
||||
|
||||
@@ -37,14 +37,12 @@ public interface XmlAttribute extends XmlElement, PsiNamedElement {
|
||||
/**
|
||||
* @return text inside XML attribute with quotes stripped off
|
||||
*/
|
||||
@Nullable
|
||||
String getValue();
|
||||
@Nullable @NlsSafe String getValue();
|
||||
|
||||
/**
|
||||
* @return text inside XML attribute with quotes stripped off and XML char entities replaced with corresponding characters
|
||||
*/
|
||||
@Nullable
|
||||
String getDisplayValue();
|
||||
@Nullable @NlsSafe String getDisplayValue();
|
||||
|
||||
/**
|
||||
* @param offset in string returned by {@link #getValue()} (with quotes stripped)
|
||||
@@ -77,5 +75,5 @@ public interface XmlAttribute extends XmlElement, PsiNamedElement {
|
||||
@Nullable
|
||||
XmlAttributeValue getValueElement();
|
||||
|
||||
void setValue(@NotNull String value) throws IncorrectOperationException;
|
||||
void setValue(@NotNull @NlsSafe String value) throws IncorrectOperationException;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// 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.psi.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.psi.meta.PsiMetaOwner;
|
||||
|
||||
public interface XmlAttributeDecl extends XmlElement, PsiMetaOwner, PsiNamedElement {
|
||||
XmlElement getNameElement();
|
||||
XmlAttributeValue getDefaultValue();
|
||||
String getDefaultValueText();
|
||||
@NlsSafe String getDefaultValueText();
|
||||
|
||||
boolean isAttributeRequired();
|
||||
boolean isAttributeFixed();
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// 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.psi.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public interface XmlComment extends XmlElement, PsiComment, XmlTagChild {
|
||||
|
||||
@NotNull
|
||||
String getCommentText();
|
||||
@NotNull @NlsSafe String getCommentText();
|
||||
}
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
// 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.psi.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.psi.PsiElement;
|
||||
|
||||
public interface XmlDoctype extends XmlElement {
|
||||
XmlElement getNameElement();
|
||||
String getDtdUri();
|
||||
@NlsSafe String getDtdUri();
|
||||
PsiElement getDtdUrlElement();
|
||||
XmlMarkupDecl getMarkupDecl();
|
||||
String getPublicId();
|
||||
String getSystemId();
|
||||
@NlsSafe String getPublicId();
|
||||
@NlsSafe String getSystemId();
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
package com.intellij.psi.xml;
|
||||
|
||||
import com.intellij.model.psi.PsiExternalReferenceHost;
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.xml.XmlNamedReferenceProviderBean;
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -22,6 +23,5 @@ public interface XmlNamedReferenceHost extends PsiExternalReferenceHost {
|
||||
* and uses returned string to obtain the provider.
|
||||
* In case the XML tag name is actually "foo", then the provider is queried for references.
|
||||
*/
|
||||
@Nullable
|
||||
String getHostName();
|
||||
@Nullable @NlsSafe String getHostName();
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// 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.psi.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.psi.meta.PsiMetaOwner;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.xml.XmlElementDescriptor;
|
||||
import com.intellij.xml.XmlNSDescriptor;
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -17,15 +17,15 @@ public interface XmlTag extends XmlElement, PsiNamedElement, PsiMetaOwner, XmlTa
|
||||
XmlTag[] EMPTY = new XmlTag[0];
|
||||
|
||||
@Override
|
||||
@NotNull @NonNls String getName();
|
||||
@NotNull @NonNls String getNamespace();
|
||||
@NotNull @NonNls String getLocalName();
|
||||
@NotNull @NlsSafe String getName();
|
||||
@NotNull @NlsSafe String getNamespace();
|
||||
@NotNull @NlsSafe String getLocalName();
|
||||
|
||||
@Nullable XmlElementDescriptor getDescriptor();
|
||||
|
||||
XmlAttribute @NotNull [] getAttributes();
|
||||
|
||||
@Nullable XmlAttribute getAttribute(@NonNls String name, @NonNls String namespace);
|
||||
@Nullable XmlAttribute getAttribute(@NlsSafe String name, @NlsSafe String namespace);
|
||||
|
||||
/**
|
||||
* Returns a tag attribute by qualified name.
|
||||
@@ -34,9 +34,9 @@ public interface XmlTag extends XmlElement, PsiNamedElement, PsiMetaOwner, XmlTa
|
||||
* @return null if the attribute not exist.
|
||||
* @see #getAttribute(String, String)
|
||||
*/
|
||||
@Nullable XmlAttribute getAttribute(@NonNls String qname);
|
||||
@Nullable XmlAttribute getAttribute(@NlsSafe String qname);
|
||||
|
||||
@Nullable String getAttributeValue(@NonNls String name, @NonNls String namespace);
|
||||
@Nullable @NlsSafe String getAttributeValue(@NlsSafe String name, @NlsSafe String namespace);
|
||||
|
||||
/**
|
||||
* Returns a tag attribute value by qualified name.
|
||||
@@ -45,10 +45,10 @@ public interface XmlTag extends XmlElement, PsiNamedElement, PsiMetaOwner, XmlTa
|
||||
* @return null if the attribute not exist.
|
||||
* @see #getAttributeValue(String, String)
|
||||
*/
|
||||
@Nullable String getAttributeValue(@NonNls String qname);
|
||||
@Nullable @NlsSafe String getAttributeValue(@NlsSafe String qname);
|
||||
|
||||
XmlAttribute setAttribute(@NonNls String name, @NonNls String namespace, @NonNls String value) throws IncorrectOperationException;
|
||||
XmlAttribute setAttribute(@NonNls String qname, @NonNls String value) throws IncorrectOperationException;
|
||||
XmlAttribute setAttribute(@NlsSafe String name, @NlsSafe String namespace, @NlsSafe String value) throws IncorrectOperationException;
|
||||
XmlAttribute setAttribute(@NlsSafe String qname, @NlsSafe String value) throws IncorrectOperationException;
|
||||
|
||||
/**
|
||||
* Creates a new child tag
|
||||
@@ -58,23 +58,23 @@ public interface XmlTag extends XmlElement, PsiNamedElement, PsiMetaOwner, XmlTa
|
||||
* @param enforceNamespacesDeep if you pass some xml tags to {@code bodyText} parameter, this flag sets namespace prefixes for them
|
||||
* @return created tag. Use {@link #addSubTag(XmlTag, boolean)}} to add it to parent
|
||||
*/
|
||||
XmlTag createChildTag(@NonNls String localName, @NonNls String namespace, @Nullable @NonNls String bodyText, boolean enforceNamespacesDeep);
|
||||
XmlTag createChildTag(@NlsSafe String localName, @NlsSafe String namespace, @Nullable @NlsSafe String bodyText, boolean enforceNamespacesDeep);
|
||||
XmlTag addSubTag(XmlTag subTag, boolean first);
|
||||
|
||||
XmlTag @NotNull [] getSubTags();
|
||||
XmlTag @NotNull [] findSubTags(@NonNls String qname);
|
||||
XmlTag @NotNull [] findSubTags(@NlsSafe String qname);
|
||||
|
||||
/**
|
||||
* @param localName non-qualified tag name.
|
||||
* @param namespace if null, name treated as qualified name to find.
|
||||
*/
|
||||
XmlTag @NotNull [] findSubTags(@NonNls String localName, @Nullable String namespace);
|
||||
XmlTag @NotNull [] findSubTags(@NlsSafe String localName, @Nullable @NlsSafe String namespace);
|
||||
|
||||
@Nullable XmlTag findFirstSubTag(@NonNls String qname);
|
||||
@Nullable XmlTag findFirstSubTag(@NlsSafe String qname);
|
||||
|
||||
@NotNull @NonNls String getNamespacePrefix();
|
||||
@NotNull @NonNls String getNamespaceByPrefix(@NonNls String prefix);
|
||||
@Nullable String getPrefixByNamespace(@NonNls String namespace);
|
||||
@NotNull @NlsSafe String getNamespacePrefix();
|
||||
@NotNull @NlsSafe String getNamespaceByPrefix(@NlsSafe String prefix);
|
||||
@Nullable String getPrefixByNamespace(@NlsSafe String namespace);
|
||||
String[] knownNamespaces();
|
||||
|
||||
boolean hasNamespaceDeclarations();
|
||||
@@ -86,28 +86,28 @@ public interface XmlTag extends XmlElement, PsiNamedElement, PsiMetaOwner, XmlTa
|
||||
|
||||
@NotNull XmlTagValue getValue();
|
||||
|
||||
@Nullable XmlNSDescriptor getNSDescriptor(@NonNls String namespace, boolean strict);
|
||||
@Nullable XmlNSDescriptor getNSDescriptor(@NlsSafe String namespace, boolean strict);
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
void collapseIfEmpty();
|
||||
|
||||
@Nullable @NonNls
|
||||
String getSubTagText(@NonNls String qname);
|
||||
@Nullable @NlsSafe
|
||||
String getSubTagText(@NlsSafe String qname);
|
||||
|
||||
default boolean isCaseSensitive() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
default String getRealNs(@Nullable String value) {
|
||||
default @NlsSafe String getRealNs(@Nullable String value) {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Experimental
|
||||
@Nullable
|
||||
@Override
|
||||
default String getHostName() {
|
||||
default @NlsSafe String getHostName() {
|
||||
return getLocalName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -28,8 +29,7 @@ public interface XmlTagValue {
|
||||
* @return raw tag value text
|
||||
* @see #getTrimmedText()
|
||||
*/
|
||||
@NotNull
|
||||
String getText();
|
||||
@NotNull @NlsSafe String getText();
|
||||
|
||||
@NotNull
|
||||
TextRange getTextRange();
|
||||
@@ -38,12 +38,11 @@ public interface XmlTagValue {
|
||||
* @return concatenated child XmlTexts values.
|
||||
* @see XmlText#getValue()
|
||||
*/
|
||||
@NotNull
|
||||
String getTrimmedText();
|
||||
@NotNull @NlsSafe String getTrimmedText();
|
||||
|
||||
void setText(String value);
|
||||
void setText(@NlsSafe String value);
|
||||
|
||||
void setEscapedText(String value);
|
||||
void setEscapedText(@NlsSafe String value);
|
||||
|
||||
boolean hasCDATA();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.psi.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -24,12 +25,12 @@ public interface XmlText extends XmlTagChild {
|
||||
/**
|
||||
* Substituted text
|
||||
*/
|
||||
String getValue();
|
||||
void setValue(String s) throws IncorrectOperationException;
|
||||
@NlsSafe String getValue();
|
||||
void setValue(@NlsSafe String s) throws IncorrectOperationException;
|
||||
|
||||
XmlElement insertAtOffset(XmlElement element, int displayOffset) throws IncorrectOperationException;
|
||||
|
||||
void insertText(String text, int displayOffset) throws IncorrectOperationException;
|
||||
void insertText(@NlsSafe String text, int displayOffset) throws IncorrectOperationException;
|
||||
void removeText(int displayStart, int displayEnd) throws IncorrectOperationException;
|
||||
|
||||
int physicalToDisplay(int offset);
|
||||
|
||||
Reference in New Issue
Block a user