mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-05 08:06:56 +07:00
IJPL-159596 cleanup - sort modifiers
GitOrigin-RevId: 8e1586a79038e569be73ee956807c4959f21e5ff
This commit is contained in:
committed by
intellij-monorepo-bot
parent
035d071d3c
commit
69851d9ee9
@@ -1,4 +1,4 @@
|
||||
// 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.
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.psi.meta;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -12,11 +12,10 @@ public abstract class MetaDataRegistrar {
|
||||
/**
|
||||
* Associates elements matching given filter with metadata class.
|
||||
* @param filter on element for finding metadata matches
|
||||
* @param metadataDescriptorClass class of metadata, should be instantiable without parameters
|
||||
* @param metadataDescriptorClass class of metadata should be instantiable without parameters
|
||||
*/
|
||||
public abstract <T extends PsiMetaData> void registerMetaData(ElementFilter filter, Class<T> metadataDescriptorClass);
|
||||
|
||||
|
||||
public static MetaDataRegistrar getInstance() {
|
||||
return ApplicationManager.getApplication().getService(MetaDataRegistrar.class);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.html;
|
||||
|
||||
import com.intellij.html.RelaxedHtmlNSDescriptor;
|
||||
@@ -69,7 +55,7 @@ public class RelaxedHtmlFromRngNSDescriptor extends RngNsDescriptor implements R
|
||||
}
|
||||
|
||||
@Override
|
||||
public XmlElementDescriptor @NotNull [] getRootElementsDescriptors(@Nullable final XmlDocument doc) {
|
||||
public XmlElementDescriptor @NotNull [] getRootElementsDescriptors(final @Nullable XmlDocument doc) {
|
||||
final XmlElementDescriptor[] descriptors = super.getRootElementsDescriptors(doc);
|
||||
List<XmlElementDescriptor> rootElements = ContainerUtil.append(
|
||||
ContainerUtil.filter(descriptors, descriptor -> isRootTag((RelaxedHtmlFromRngElementDescriptor)descriptor)),
|
||||
|
||||
@@ -73,8 +73,7 @@ public class GotoSymbolContributor implements ChooseByNameContributorEx {
|
||||
}, parameters.getSearchScope());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static NavigationItem wrap(@Nullable PsiElement item) {
|
||||
static @Nullable NavigationItem wrap(@Nullable PsiElement item) {
|
||||
if (!(item instanceof NavigationItem)) return null;
|
||||
PsiMetaData metaData0 = item instanceof PsiMetaOwner ? ((PsiMetaOwner)item).getMetaData() : null;
|
||||
PsiPresentableMetaData metaData = metaData0 instanceof PsiPresentableMetaData ? (PsiPresentableMetaData)metaData0 : null;
|
||||
@@ -84,21 +83,18 @@ public class GotoSymbolContributor implements ChooseByNameContributorEx {
|
||||
return metaData.getName();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getLocationString() {
|
||||
public @NotNull String getLocationString() {
|
||||
return MyNavigationItem.getLocationString(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Icon getIcon(boolean open) {
|
||||
public @Nullable Icon getIcon(boolean open) {
|
||||
return metaData.getIcon();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TextAttributesKey getTextAttributesKey() {
|
||||
public @Nullable TextAttributesKey getTextAttributesKey() {
|
||||
ItemPresentation p = ((NavigationItem)item).getPresentation();
|
||||
return p instanceof ColoredItemPresentation ? ((ColoredItemPresentation)p).getTextAttributesKey() : null;
|
||||
}
|
||||
@@ -111,7 +107,7 @@ public class GotoSymbolContributor implements ChooseByNameContributorEx {
|
||||
final ItemPresentation myPresentation;
|
||||
final String myLocationString;
|
||||
|
||||
private MyNavigationItem(NavigationItem item, @NotNull final ItemPresentation presentation) {
|
||||
private MyNavigationItem(NavigationItem item, final @NotNull ItemPresentation presentation) {
|
||||
myItem = item;
|
||||
myPresentation = presentation;
|
||||
myLocationString = getLocationString((PsiElement)myItem);
|
||||
@@ -123,8 +119,7 @@ public class GotoSymbolContributor implements ChooseByNameContributorEx {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getLocationString() {
|
||||
public @Nullable String getLocationString() {
|
||||
return myLocationString;
|
||||
}
|
||||
|
||||
@@ -133,13 +128,11 @@ public class GotoSymbolContributor implements ChooseByNameContributorEx {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Icon getIcon(boolean open) {
|
||||
public @Nullable Icon getIcon(boolean open) {
|
||||
return myPresentation.getIcon(open);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public TextAttributesKey getTextAttributesKey() {
|
||||
public @Nullable TextAttributesKey getTextAttributesKey() {
|
||||
return myPresentation instanceof ColoredItemPresentation ? ((ColoredItemPresentation)myPresentation).getTextAttributesKey() : null;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,15 +53,13 @@ public final class RelaxNgMetaDataContributor implements MetaDataContributor {
|
||||
),
|
||||
RngNsDescriptor.class);
|
||||
|
||||
registrar.registerMetaData(
|
||||
new ClassFilter(RncDocument.class),
|
||||
RngNsDescriptor.class);
|
||||
registrar.registerMetaData(new ClassFilter(RncDocument.class), RngNsDescriptor.class);
|
||||
|
||||
registrar.registerMetaData(new ElementFilter() {
|
||||
@Override
|
||||
public boolean isAcceptable(Object element, PsiElement context) {
|
||||
if (element instanceof XmlTag tag) {
|
||||
final DomElement domElement = DomManager.getDomManager(tag.getProject()).getDomElement(tag);
|
||||
DomElement domElement = DomManager.getDomManager(tag.getProject()).getDomElement(tag);
|
||||
return domElement instanceof RngDefine;
|
||||
}
|
||||
return false;
|
||||
@@ -74,8 +72,7 @@ public final class RelaxNgMetaDataContributor implements MetaDataContributor {
|
||||
}, RngDefineMetaData.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<Class<? extends LocalInspectionTool>> getInspectionClasses() {
|
||||
public static @NotNull List<Class<? extends LocalInspectionTool>> getInspectionClasses() {
|
||||
return Arrays.asList(RngDomInspection.class, UnusedDefineInspection.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.plugins.relaxNG;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
@@ -42,9 +28,8 @@ public class RncFileReferenceManipulator extends AbstractElementManipulator<RncF
|
||||
return element;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TextRange getRangeInElement(@NotNull RncFileReference element) {
|
||||
public @NotNull TextRange getRangeInElement(@NotNull RncFileReference element) {
|
||||
return element.getReferenceRange();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,12 +40,10 @@ import java.util.Set;
|
||||
final class RngDocumentationProvider implements DocumentationProvider {
|
||||
private static final Logger LOG = Logger.getInstance(RngDocumentationProvider.class);
|
||||
|
||||
@NonNls
|
||||
private static final String COMPATIBILITY_ANNOTATIONS_1_0 = "http://relaxng.org/ns/compatibility/annotations/1.0";
|
||||
private static final @NonNls String COMPATIBILITY_ANNOTATIONS_1_0 = "http://relaxng.org/ns/compatibility/annotations/1.0";
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public @Nls String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
|
||||
public @Nullable @Nls String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
|
||||
final XmlElement c = PsiTreeUtil.getParentOfType(originalElement, XmlTag.class, XmlAttribute.class);
|
||||
if (c != null && c.getManager() == null) {
|
||||
LOG.warn("Invalid context element passed to generateDoc()", new Throwable("<stack trace>"));
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.plugins.relaxNG.compact;
|
||||
|
||||
import com.intellij.lang.ASTNode;
|
||||
@@ -37,8 +23,7 @@ class RncElementTypeEx<C extends RncElement> extends RncElementType implements N
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public final C fun(ASTNode node) {
|
||||
public final @NotNull C fun(ASTNode node) {
|
||||
try {
|
||||
return myConstructor.newInstance(node);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -36,22 +36,17 @@ public final class RncFileType extends LanguageFileType {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNls
|
||||
public String getName() {
|
||||
public @NotNull @NonNls String getName() {
|
||||
return "RNG Compact";
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDescription() {
|
||||
public @NotNull String getDescription() {
|
||||
return RelaxngBundle.message("filetype.relaxng.compact-syntax.description");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNls
|
||||
public String getDefaultExtension() {
|
||||
public @NotNull @NonNls String getDefaultExtension() {
|
||||
return "rnc";
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
package org.intellij.plugins.relaxNG.compact;
|
||||
|
||||
import com.intellij.lexer.Lexer;
|
||||
import com.intellij.openapi.editor.HighlighterColors;
|
||||
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
|
||||
import com.intellij.openapi.editor.HighlighterColors;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
@@ -30,8 +30,7 @@ import java.util.Map;
|
||||
|
||||
public class RncHighlighter extends SyntaxHighlighterBase {
|
||||
@Override
|
||||
@NotNull
|
||||
public Lexer getHighlightingLexer() {
|
||||
public @NotNull Lexer getHighlightingLexer() {
|
||||
return new CompactSyntaxLexerAdapter();
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,7 @@ public class RncParserDefinition implements ParserDefinition {
|
||||
private static final IFileElementType FILE_ELEMENT_TYPE = new IFileElementType(RngCompactLanguage.INSTANCE);
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Lexer createLexer(Project project) {
|
||||
public @NotNull Lexer createLexer(Project project) {
|
||||
return new CompactSyntaxLexerAdapter();
|
||||
}
|
||||
|
||||
@@ -56,27 +55,23 @@ public class RncParserDefinition implements ParserDefinition {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public TokenSet getWhitespaceTokens() {
|
||||
public @NotNull TokenSet getWhitespaceTokens() {
|
||||
return TokenSet.create(TokenType.WHITE_SPACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public TokenSet getCommentTokens() {
|
||||
public @NotNull TokenSet getCommentTokens() {
|
||||
return TokenSet.orSet(RncTokenTypes.COMMENTS, RncTokenTypes.DOC_TOKENS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public TokenSet getStringLiteralElements() {
|
||||
public @NotNull TokenSet getStringLiteralElements() {
|
||||
return TokenSet.create(RncTokenTypes.LITERAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@SuppressWarnings({ "unchecked" })
|
||||
public PsiElement createElement(ASTNode node) {
|
||||
@SuppressWarnings({"unchecked"})
|
||||
public @NotNull PsiElement createElement(ASTNode node) {
|
||||
final IElementType type = node.getElementType();
|
||||
|
||||
if (type instanceof NotNullFunction) {
|
||||
|
||||
@@ -60,16 +60,14 @@ public final class RncTokenTypes {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static IElementType get(int i) {
|
||||
public static @NotNull IElementType get(int i) {
|
||||
assert !ourTokenTypes.isEmpty();
|
||||
final IElementType type = ourTokenTypes.get(i);
|
||||
assert type != null : "Unknown token kind: " + i;
|
||||
return type;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static IElementType get(final String name) {
|
||||
private static @NotNull IElementType get(final String name) {
|
||||
assert !ourTokenTypes.isEmpty();
|
||||
for (IElementType iElementType : ourTokenTypes.values()) {
|
||||
if (iElementType.toString().equals(name)) {
|
||||
|
||||
@@ -47,20 +47,17 @@ public final class RngCompactLanguage extends Language {
|
||||
|
||||
public static class MyCommenter implements Commenter {
|
||||
@Override
|
||||
@Nullable
|
||||
public String getLineCommentPrefix() {
|
||||
public @Nullable String getLineCommentPrefix() {
|
||||
return "#";
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getBlockCommentPrefix() {
|
||||
public @Nullable String getBlockCommentPrefix() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getBlockCommentSuffix() {
|
||||
public @Nullable String getBlockCommentSuffix() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -117,8 +114,7 @@ public final class RngCompactLanguage extends Language {
|
||||
public static class MyDocumentationProvider implements DocumentationProvider {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public @Nls String generateDoc(PsiElement element, PsiElement originalElement) {
|
||||
public @Nullable @Nls String generateDoc(PsiElement element, PsiElement originalElement) {
|
||||
if (element instanceof RncElement) {
|
||||
PsiElement comment = element.getPrevSibling();
|
||||
while (comment instanceof PsiWhiteSpace) {
|
||||
|
||||
@@ -113,8 +113,7 @@ public class RncFoldingBuilder implements FoldingBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ASTNode checkNodeAndSiblings(@Nullable ASTNode node, TokenSet tokens, ArrayList<? super FoldingDescriptor> regions, Document document) {
|
||||
private static @Nullable ASTNode checkNodeAndSiblings(@Nullable ASTNode node, TokenSet tokens, ArrayList<? super FoldingDescriptor> regions, Document document) {
|
||||
if (node != null && tokens.contains(node.getElementType())) {
|
||||
final ASTNode start = node;
|
||||
ASTNode end = start;
|
||||
|
||||
@@ -41,14 +41,12 @@ class RncBlock implements Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public TextRange getTextRange() {
|
||||
public @NotNull TextRange getTextRange() {
|
||||
return myNode.getTextRange();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<Block> getSubBlocks() {
|
||||
public @NotNull List<Block> getSubBlocks() {
|
||||
final List<Block> list = new ArrayList<>();
|
||||
ASTNode node = myNode.getFirstChildNode();
|
||||
while (node != null) {
|
||||
@@ -61,15 +59,13 @@ class RncBlock implements Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Wrap getWrap() {
|
||||
public @Nullable Wrap getWrap() {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Indent getIndent() {
|
||||
public @Nullable Indent getIndent() {
|
||||
if (myNode.getTreeParent() == null) return null;
|
||||
if (isTopLevel()) {
|
||||
return Indent.getAbsoluteNoneIndent();
|
||||
@@ -88,15 +84,13 @@ class RncBlock implements Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Alignment getAlignment() {
|
||||
public @Nullable Alignment getAlignment() {
|
||||
// TODO
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Spacing getSpacing(Block child1, @NotNull Block child2) {
|
||||
public @Nullable Spacing getSpacing(Block child1, @NotNull Block child2) {
|
||||
if (child1 == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -121,8 +115,7 @@ class RncBlock implements Block {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ChildAttributes getChildAttributes(int newChildIndex) {
|
||||
public @NotNull ChildAttributes getChildAttributes(int newChildIndex) {
|
||||
return new ChildAttributes(null, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +126,8 @@ public final class CompactSyntaxLexerAdapter extends LexerBase {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public CharSequence getBufferSequence() {
|
||||
public @NotNull CharSequence getBufferSequence() {
|
||||
return myBuffer;
|
||||
}
|
||||
|
||||
@@ -157,8 +156,7 @@ public final class CompactSyntaxLexerAdapter extends LexerBase {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public IElementType getTokenType() {
|
||||
public @Nullable IElementType getTokenType() {
|
||||
if (myCurrentToken == null) {
|
||||
return null;
|
||||
} else {
|
||||
|
||||
@@ -27,8 +27,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
public class RncParser implements PsiParser {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public ASTNode parse(@NotNull IElementType root, PsiBuilder builder) {
|
||||
public @NotNull ASTNode parse(@NotNull IElementType root, PsiBuilder builder) {
|
||||
final PsiBuilder.Marker fileMarker = builder.mark();
|
||||
final PsiBuilder.Marker docMarker = builder.mark();
|
||||
|
||||
|
||||
@@ -55,9 +55,8 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function
|
||||
super(ref);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TextRange getRangeInElement() {
|
||||
public @NotNull TextRange getRangeInElement() {
|
||||
final ASTNode node = findNameNode();
|
||||
if (node == null) return TextRange.from(0, 0);
|
||||
final int offset = myElement.getTextOffset();
|
||||
@@ -71,8 +70,7 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement resolve() {
|
||||
public @Nullable PsiElement resolve() {
|
||||
final ResolveResult[] results = multiResolve(false);
|
||||
return results.length == 1 ? results[0].getElement() : null;
|
||||
}
|
||||
@@ -96,14 +94,12 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function
|
||||
return element != null ? new PsiElementResolveResult(element) : EmptyResolveResult.INSTANCE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected RncGrammar getScope() {
|
||||
protected @Nullable RncGrammar getScope() {
|
||||
return PsiTreeUtil.getParentOfType(myElement, RncGrammar.class, true, PsiFile.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getCanonicalText() {
|
||||
public @NotNull String getCanonicalText() {
|
||||
final ASTNode node = findNameNode();
|
||||
return node != null ? EscapeUtil.unescapeText(node) : "";
|
||||
}
|
||||
@@ -141,8 +137,7 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getUnresolvedMessagePattern() {
|
||||
public @NotNull String getUnresolvedMessagePattern() {
|
||||
//noinspection UnresolvedPropertyKey
|
||||
return RelaxngBundle.message("relaxng.annotator.unresolved-pattern-reference");
|
||||
}
|
||||
@@ -157,21 +152,19 @@ class PatternReference extends PsiReferenceBase.Poly<RncRef> implements Function
|
||||
|
||||
static class CreatePatternFix implements LocalQuickFix {
|
||||
|
||||
@IntentionName private final String myName;
|
||||
private final @IntentionName String myName;
|
||||
|
||||
CreatePatternFix(PatternReference reference) {
|
||||
myName = RelaxngBundle.message("relaxng.quickfix.create-pattern.name", reference.getCanonicalText());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return RelaxngBundle.message("relaxng.quickfix.create-pattern.family");
|
||||
}
|
||||
|
||||
|
||||
@@ -34,15 +34,13 @@ public class RncAnnotationImpl extends RncElementImpl implements RncAnnotation {
|
||||
visitor.visitAnnotation(this);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public IElementType getTokenType() {
|
||||
public @NotNull IElementType getTokenType() {
|
||||
return getNode().getElementType();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public RncName getNameElement() {
|
||||
public @Nullable RncName getNameElement() {
|
||||
return findChildByClass(RncName.class);
|
||||
}
|
||||
}
|
||||
@@ -68,8 +68,7 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO
|
||||
return getNameNode().getPsi();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ASTNode getNameNode() {
|
||||
public @NotNull ASTNode getNameNode() {
|
||||
final ASTNode node = getNode().findChildByType(RncTokenTypes.IDENTIFIERS);
|
||||
assert node != null;
|
||||
return node;
|
||||
@@ -83,8 +82,7 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public RncPattern getPattern() {
|
||||
public @Nullable RncPattern getPattern() {
|
||||
return findChildByClass(RncPattern.class);
|
||||
}
|
||||
|
||||
@@ -122,8 +120,7 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Icon getIcon(int flags) {
|
||||
public @Nullable Icon getIcon(int flags) {
|
||||
return IconManager.getInstance().getPlatformIcon(PlatformIcons.Property);
|
||||
}
|
||||
|
||||
@@ -132,8 +129,7 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiMetaData getMetaData() {
|
||||
public @Nullable PsiMetaData getMetaData() {
|
||||
return new MyMetaData();
|
||||
}
|
||||
|
||||
@@ -143,8 +139,7 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO
|
||||
}*/
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public Icon getIcon() {
|
||||
public @Nullable Icon getIcon() {
|
||||
return RncDefineImpl.this.getIcon(0);
|
||||
}
|
||||
|
||||
@@ -159,14 +154,12 @@ public class RncDefineImpl extends RncElementImpl implements RncDefine, PsiMetaO
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getName(PsiElement context) {
|
||||
public @NonNls String getName(PsiElement context) {
|
||||
return RncDefineImpl.this.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getName() {
|
||||
public @NonNls String getName() {
|
||||
return RncDefineImpl.this.getName();
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,7 @@ public class RncDocument extends RncElementImpl implements XmlDocument {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public XmlTag getRootTag() {
|
||||
public @Nullable XmlTag getRootTag() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -62,8 +61,7 @@ public class RncDocument extends RncElementImpl implements XmlDocument {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiMetaData getMetaData() {
|
||||
public @Nullable PsiMetaData getMetaData() {
|
||||
return MetaRegistry.getMeta(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,14 +47,12 @@ public class RncFileImpl extends PsiFileBase implements RncFile, XmlFile {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public FileType getFileType() {
|
||||
public @NotNull FileType getFileType() {
|
||||
return RncFileType.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public XmlDocument getDocument() {
|
||||
public @NotNull XmlDocument getDocument() {
|
||||
// this needs to be a seperate child element because of com.intellij.util.xml.impl.ExternalChangeProcessor.visitDocumentChanged()
|
||||
final XmlDocument document = findChildByClass(XmlDocument.class);
|
||||
assert document != null;
|
||||
@@ -98,9 +96,8 @@ public class RncFileImpl extends PsiFileBase implements RncFile, XmlFile {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public GlobalSearchScope getFileResolveScope() {
|
||||
public @NotNull GlobalSearchScope getFileResolveScope() {
|
||||
return ProjectScope.getAllScope(getProject());
|
||||
}
|
||||
|
||||
|
||||
@@ -66,8 +66,7 @@ abstract class RncFileReferenceImpl extends RncElementImpl implements RncFileRef
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getFileReference() {
|
||||
public @Nullable String getFileReference() {
|
||||
final ASTNode element = getNode().findChildByType(RncTokenTypes.LITERAL);
|
||||
if (element == null) return null;
|
||||
final String s = EscapeUtil.unescapeText(element);
|
||||
|
||||
@@ -66,15 +66,13 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getPrefix() {
|
||||
public @Nullable String getPrefix() {
|
||||
final String[] parts = EscapeUtil.unescapeText(getNode()).split(":", 2);
|
||||
return parts.length == 2 ? parts[0] : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getLocalPart() {
|
||||
public @NotNull String getLocalPart() {
|
||||
final String[] parts = EscapeUtil.unescapeText(getNode()).split(":", 2);
|
||||
return parts.length == 1 ? parts[0] : parts[1];
|
||||
}
|
||||
@@ -89,21 +87,18 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference
|
||||
return getPrefix() == null ? null : this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElement getElement() {
|
||||
public @NotNull PsiElement getElement() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public TextRange getRangeInElement() {
|
||||
public @NotNull TextRange getRangeInElement() {
|
||||
return TextRange.from(0, getText().indexOf(':'));
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement resolve() {
|
||||
public @Nullable PsiElement resolve() {
|
||||
final MyResolver resolver = new MyResolver(getPrefix(), getKind());
|
||||
getContainingFile().processDeclarations(resolver, ResolveState.initial(), this, this);
|
||||
return resolver.getResult();
|
||||
@@ -119,8 +114,7 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getCanonicalText() {
|
||||
public @NotNull String getCanonicalText() {
|
||||
return getRangeInElement().substring(getText());
|
||||
}
|
||||
|
||||
@@ -149,8 +143,7 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getUnresolvedMessagePattern() {
|
||||
public @NotNull String getUnresolvedMessagePattern() {
|
||||
//The format substitution is performed at the call site
|
||||
//noinspection UnresolvedPropertyKey
|
||||
return RelaxngBundle.message("relaxng.annotator.unresolved-namespace-prefix");
|
||||
@@ -215,14 +208,12 @@ public class RncNameImpl extends RncElementImpl implements RncName, PsiReference
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return XmlPsiBundle.message("xml.quickfix.create.namespace.declaration.family");
|
||||
}
|
||||
|
||||
|
||||
@@ -50,8 +50,7 @@ public class RncParentRefImpl extends RncRefImpl implements RncParentRef {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiReference getReference() {
|
||||
public @Nullable PsiReference getReference() {
|
||||
return new PatternReference(this) {
|
||||
@Override
|
||||
protected RncGrammar getScope() {
|
||||
|
||||
@@ -32,8 +32,7 @@ public class RncRefImpl extends RncElementImpl implements RncRef {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public RncDefine getPattern() {
|
||||
public @Nullable RncDefine getPattern() {
|
||||
final PsiReference ref = getReference();
|
||||
// TODO: honor combine & return virtual element if multiResolve().length > 0
|
||||
return ref instanceof PatternReference ? (RncDefine)ref.resolve() : null;
|
||||
|
||||
@@ -25,8 +25,7 @@ public final class PsiFunction implements NotNullFunction<ASTNode, PsiElement> {
|
||||
public static final PsiFunction INSTANCE = new PsiFunction();
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElement fun(ASTNode astNode) {
|
||||
public @NotNull PsiElement fun(ASTNode astNode) {
|
||||
return astNode.getPsi();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,8 +44,7 @@ public final class RenameUtil {
|
||||
private RenameUtil() {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static ASTNode createIdentifierNode(PsiManager manager, String name) throws IncorrectOperationException {
|
||||
public static @NotNull ASTNode createIdentifierNode(PsiManager manager, String name) throws IncorrectOperationException {
|
||||
if (isKeyword(name)) {
|
||||
name = "\\" + name;
|
||||
} else if (!isIdentifier(name)) {
|
||||
@@ -98,8 +97,7 @@ public final class RenameUtil {
|
||||
return astNode;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static ASTNode findFirstGrammarNode(RncFile file) {
|
||||
private static @NotNull ASTNode findFirstGrammarNode(RncFile file) {
|
||||
final RncGrammar grammar = file.getGrammar();
|
||||
assert grammar != null;
|
||||
final ASTNode grammarNode = grammar.getNode();
|
||||
|
||||
@@ -38,24 +38,15 @@ import java.awt.event.ItemListener;
|
||||
import java.util.*;
|
||||
|
||||
public class AdvancedDtdOptions implements AdvancedOptions {
|
||||
@NonNls
|
||||
private static final String COLON_REPLACEMENT = "colon-replacement";
|
||||
@NonNls
|
||||
private static final String ELEMENT_DEFINE = "element-define";
|
||||
@NonNls
|
||||
private static final String ATTLIST_DEFINE = "attlist-define";
|
||||
@NonNls
|
||||
private static final String INLINE_ATTLIST = "inline-attlist";
|
||||
@NonNls
|
||||
private static final String ANY_NAME = "any-name";
|
||||
@NonNls
|
||||
private static final String STRICT_ANY = "strict-any";
|
||||
@NonNls
|
||||
private static final String ANNOTATION_PREFIX = "annotation-prefix";
|
||||
@NonNls
|
||||
private static final String GENERATE_START = "generate-start";
|
||||
@NonNls
|
||||
private static final String XMLNS = "xmlns";
|
||||
private static final @NonNls String COLON_REPLACEMENT = "colon-replacement";
|
||||
private static final @NonNls String ELEMENT_DEFINE = "element-define";
|
||||
private static final @NonNls String ATTLIST_DEFINE = "attlist-define";
|
||||
private static final @NonNls String INLINE_ATTLIST = "inline-attlist";
|
||||
private static final @NonNls String ANY_NAME = "any-name";
|
||||
private static final @NonNls String STRICT_ANY = "strict-any";
|
||||
private static final @NonNls String ANNOTATION_PREFIX = "annotation-prefix";
|
||||
private static final @NonNls String GENERATE_START = "generate-start";
|
||||
private static final @NonNls String XMLNS = "xmlns";
|
||||
|
||||
private JComponent myRoot;
|
||||
|
||||
|
||||
@@ -48,8 +48,7 @@ public class AdvancedOptionsDialog extends DialogWrapper {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected JComponent createCenterPanel() {
|
||||
protected @Nullable JComponent createCenterPanel() {
|
||||
JComponent root;
|
||||
if (myInputOptions != null && myOutputOptions != null) {
|
||||
root = new JBTabbedPane();
|
||||
|
||||
@@ -24,12 +24,9 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class AdvancedXsdOptions implements AdvancedOptions {
|
||||
@NonNls
|
||||
private static final String DISABLE_ABSTRACT_ELEMENTS = "disable-abstract-elements";
|
||||
@NonNls
|
||||
private static final String ANY_PROCESS_CONTENTS = "any-process-contents";
|
||||
@NonNls
|
||||
private static final String ANY_ATTRIBUTE_PROCESS_CONTENTS = "any-attribute-process-contents";
|
||||
private static final @NonNls String DISABLE_ABSTRACT_ELEMENTS = "disable-abstract-elements";
|
||||
private static final @NonNls String ANY_PROCESS_CONTENTS = "any-process-contents";
|
||||
private static final @NonNls String ANY_ATTRIBUTE_PROCESS_CONTENTS = "any-attribute-process-contents";
|
||||
|
||||
private JComponent myRoot;
|
||||
|
||||
|
||||
@@ -67,8 +67,7 @@ public class ConvertSchemaDialog extends DialogWrapper implements PropertyChange
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected JComponent createCenterPanel() {
|
||||
protected @Nullable JComponent createCenterPanel() {
|
||||
return mySettings.getRoot();
|
||||
}
|
||||
|
||||
|
||||
@@ -167,8 +167,7 @@ public class ConvertSchemaSettingsImpl implements ConvertSchemaSettings {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public SchemaType getOutputType() {
|
||||
public @NotNull SchemaType getOutputType() {
|
||||
if (myOutputRng.isSelected()) {
|
||||
return SchemaType.RNG;
|
||||
} else if (myOutputRnc.isSelected()) {
|
||||
|
||||
@@ -100,9 +100,8 @@ public abstract class BaseInspection extends XmlSuppressableInspectionTool {
|
||||
|
||||
private SuppressQuickFix[] getXmlOnlySuppressions(PsiElement element) {
|
||||
return ContainerUtil.map(super.getBatchSuppressActions(element), action -> new SuppressQuickFix() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return action.getName();
|
||||
}
|
||||
|
||||
@@ -120,8 +119,7 @@ public abstract class BaseInspection extends XmlSuppressableInspectionTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return action.getFamilyName();
|
||||
}
|
||||
|
||||
@@ -167,8 +165,7 @@ public abstract class BaseInspection extends XmlSuppressableInspectionTool {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public abstract RncElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly);
|
||||
public abstract @NotNull RncElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly);
|
||||
|
||||
private abstract class SuppressAction implements SuppressQuickFix {
|
||||
private final String myLocation;
|
||||
@@ -177,15 +174,13 @@ public abstract class BaseInspection extends XmlSuppressableInspectionTool {
|
||||
myLocation = location;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return RelaxngBundle.message("relaxng.suppress.action.name", myLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return getDisplayName();
|
||||
}
|
||||
|
||||
|
||||
@@ -55,8 +55,7 @@ import static com.intellij.util.ObjectUtils.doIfNotNull;
|
||||
public class UnusedDefineInspection extends BaseInspection {
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public RncElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
|
||||
public @NotNull RncElementVisitor buildVisitor(@NotNull ProblemsHolder holder, boolean isOnTheFly) {
|
||||
return new MyElementVisitor(holder);
|
||||
}
|
||||
|
||||
@@ -183,8 +182,7 @@ public class UnusedDefineInspection extends BaseInspection {
|
||||
|
||||
private static class MyFix<T extends PsiElement> implements LocalQuickFix {
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return RelaxngBundle.message("relaxng.quickfix.remove-define");
|
||||
}
|
||||
|
||||
|
||||
@@ -46,14 +46,12 @@ class OverriddenDefineRenderer extends GutterIconRenderer implements DumbAware {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Icon getIcon() {
|
||||
public @NotNull Icon getIcon() {
|
||||
return AllIcons.Gutter.OverridenMethod;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AnAction getClickAction() {
|
||||
public @Nullable AnAction getClickAction() {
|
||||
return new AnAction() {
|
||||
@Override
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
@@ -86,8 +84,7 @@ class OverriddenDefineRenderer extends GutterIconRenderer implements DumbAware {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getTooltipText() {
|
||||
public @Nullable String getTooltipText() {
|
||||
return RelaxngBundle.message("relaxng.gutter.is-overridden");
|
||||
}
|
||||
|
||||
|
||||
@@ -51,8 +51,7 @@ class OverridingDefineRenderer extends GutterIconRenderer implements DumbAware {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Icon getIcon() {
|
||||
public @NotNull Icon getIcon() {
|
||||
return AllIcons.Gutter.OverridingMethod;
|
||||
}
|
||||
|
||||
@@ -62,14 +61,12 @@ class OverridingDefineRenderer extends GutterIconRenderer implements DumbAware {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public AnAction getClickAction() {
|
||||
public @Nullable AnAction getClickAction() {
|
||||
return new MyClickAction();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getTooltipText() {
|
||||
public @Nullable String getTooltipText() {
|
||||
return myMessage;
|
||||
}
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class RngElementDescriptor implements XmlElementDescriptor {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final XmlAttributeDescriptor[] getAttributesDescriptors(@Nullable final XmlTag context) {
|
||||
public final XmlAttributeDescriptor[] getAttributesDescriptors(final @Nullable XmlTag context) {
|
||||
if (context != null) {
|
||||
return getCachedValue(context, this, ATTRS_KEY, p -> {
|
||||
final XmlAttributeDescriptor[] value = p.collectAttributeDescriptors(context);
|
||||
@@ -281,8 +281,40 @@ public class RngElementDescriptor implements XmlElementDescriptor {
|
||||
return AstLoadingFilter.forceAllowTreeLoading(file, () -> getDeclarationImpl(project, decl, location, file));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static PsiElement getDeclarationImpl(@NotNull Project project, PsiElement decl, Locator location, PsiFile file) {
|
||||
@Override
|
||||
public @NonNls String getName(PsiElement context) {
|
||||
final QName qName = getQName();
|
||||
if (qName == null) {
|
||||
return "#unknown";
|
||||
}
|
||||
final XmlTag xmlTag = PsiTreeUtil.getParentOfType(context, XmlTag.class, false);
|
||||
final String prefix = xmlTag != null ? xmlTag.getPrefixByNamespace(qName.getNamespaceURI()) : null;
|
||||
return format(qName, prefix != null ? prefix : qName.getPrefix());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NonNls String getName() {
|
||||
final QName qName = getQName();
|
||||
if (qName == null) {
|
||||
return "#unknown";
|
||||
}
|
||||
return qName.getLocalPart();
|
||||
}
|
||||
|
||||
private @Nullable QName getQName() {
|
||||
final Iterator<QName> iterator = myElementPattern.getName().listNames().iterator();
|
||||
if (!iterator.hasNext()) {
|
||||
return null;
|
||||
}
|
||||
return iterator.next();
|
||||
}
|
||||
|
||||
private static String format(QName qName, String p) {
|
||||
final String localPart = qName.getLocalPart();
|
||||
return p.length() > 0 ? p + ":" + localPart : localPart;
|
||||
}
|
||||
|
||||
private static @Nullable PsiElement getDeclarationImpl(@NotNull Project project, PsiElement decl, Locator location, PsiFile file) {
|
||||
final int column = location.getColumnNumber();
|
||||
final int line = location.getLineNumber();
|
||||
|
||||
@@ -308,42 +340,6 @@ public class RngElementDescriptor implements XmlElementDescriptor {
|
||||
return PsiTreeUtil.getParentOfType(at, XmlTag.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getName(PsiElement context) {
|
||||
final QName qName = getQName();
|
||||
if (qName == null) {
|
||||
return "#unknown";
|
||||
}
|
||||
final XmlTag xmlTag = PsiTreeUtil.getParentOfType(context, XmlTag.class, false);
|
||||
final String prefix = xmlTag != null ? xmlTag.getPrefixByNamespace(qName.getNamespaceURI()) : null;
|
||||
return format(qName, prefix != null ? prefix : qName.getPrefix());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getName() {
|
||||
final QName qName = getQName();
|
||||
if (qName == null) {
|
||||
return "#unknown";
|
||||
}
|
||||
return qName.getLocalPart();
|
||||
}
|
||||
|
||||
private static String format(QName qName, String p) {
|
||||
final String localPart = qName.getLocalPart();
|
||||
return p.length() > 0 ? p + ":" + localPart : localPart;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private QName getQName() {
|
||||
final Iterator<QName> iterator = myElementPattern.getName().listNames().iterator();
|
||||
if (!iterator.hasNext()) {
|
||||
return null;
|
||||
}
|
||||
return iterator.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(PsiElement element) {
|
||||
|
||||
@@ -437,15 +433,13 @@ public class RngElementDescriptor implements XmlElementDescriptor {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public HtmlSymbolDeclaration.Kind getKind() {
|
||||
public @NotNull HtmlSymbolDeclaration.Kind getKind() {
|
||||
return myKind;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public PsiElement getNavigationElement() {
|
||||
public @NotNull PsiElement getNavigationElement() {
|
||||
final PsiElement rncElement = myFile.findElementAt(myStartOffset + myColumn);
|
||||
final ASTNode pattern = rncElement != null ? TreeUtil.findParent(rncElement.getNode(), RncElementTypes.PATTERN) : null;
|
||||
final ASTNode nameClass = pattern != null ? pattern.findChildByType(RncElementTypes.NAME_CLASS) : null;
|
||||
|
||||
@@ -65,8 +65,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator {
|
||||
private PsiManager myManager;
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
|
||||
public @Nullable XmlElementDescriptor getElementDescriptor(@NotNull XmlTag tag) {
|
||||
if (myPattern == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -188,8 +187,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public XmlFile getDescriptorFile() {
|
||||
public @NotNull XmlFile getDescriptorFile() {
|
||||
return myFile;
|
||||
}
|
||||
|
||||
@@ -210,14 +208,12 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getName(PsiElement context) {
|
||||
public @NonNls String getName(PsiElement context) {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getName() {
|
||||
public @NonNls String getName() {
|
||||
return getDescriptorFile().getName();
|
||||
}
|
||||
|
||||
@@ -254,7 +250,7 @@ public class RngNsDescriptor implements XmlNSDescriptorEx, Validator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(@NotNull PsiElement context, @NotNull final ValidationHost host) {
|
||||
public void validate(@NotNull PsiElement context, final @NotNull ValidationHost host) {
|
||||
final XmlDocument doc = PsiTreeUtil.getContextOfType(context, XmlDocument.class, false);
|
||||
if (doc == null) {
|
||||
return;
|
||||
|
||||
@@ -40,8 +40,7 @@ import javax.xml.namespace.QName;
|
||||
import java.util.*;
|
||||
|
||||
public final class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor {
|
||||
@NonNls
|
||||
private static final QName UNKNOWN = new QName("", "#unknown");
|
||||
private static final @NonNls QName UNKNOWN = new QName("", "#unknown");
|
||||
|
||||
private static final HashingStrategy<Locator> HASHING_STRATEGY = new HashingStrategy<>() {
|
||||
@Override
|
||||
@@ -135,8 +134,7 @@ public final class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getDefaultValue() {
|
||||
public @Nullable String getDefaultValue() {
|
||||
return isFixed() ? myValues.keySet().iterator().next() : null;
|
||||
}
|
||||
|
||||
@@ -172,8 +170,7 @@ public final class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<PsiElement> getDeclarations() {
|
||||
public @NotNull Collection<PsiElement> getDeclarations() {
|
||||
return ContainerUtil.map(myDeclarations, locator -> myElementDescriptor.getDeclaration(locator));
|
||||
}
|
||||
|
||||
@@ -202,8 +199,7 @@ public final class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getName() {
|
||||
public @NonNls String getName() {
|
||||
return myName.getLocalPart();
|
||||
}
|
||||
|
||||
@@ -242,9 +238,8 @@ public final class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor
|
||||
public PsiReference[] getValueReferences(final XmlElement element, @NotNull String text) {
|
||||
if (element.getContainingFile() instanceof HtmlCompatibleFile) {
|
||||
return new PsiReference[]{new HtmlEnumeratedValueReference(element, this, null) {
|
||||
@Nullable
|
||||
@Override
|
||||
public PsiElement resolve() {
|
||||
public @Nullable PsiElement resolve() {
|
||||
if (isTokenDatatype(getValue())) {
|
||||
return getElement();
|
||||
}
|
||||
@@ -254,9 +249,8 @@ public final class RngXmlAttributeDescriptor extends BasicXmlAttributeDescriptor
|
||||
}
|
||||
else {
|
||||
return new PsiReference[]{new XmlEnumeratedValueReference(element, this) {
|
||||
@Nullable
|
||||
@Override
|
||||
public PsiElement resolve() {
|
||||
public @Nullable PsiElement resolve() {
|
||||
if (isTokenDatatype(getValue())) {
|
||||
return getElement();
|
||||
}
|
||||
|
||||
@@ -122,8 +122,7 @@ public final class DefinitionResolver extends CommonElement.Visitor implements
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Set<Define> resolve(Grammar scope, final String value) {
|
||||
public static @Nullable Set<Define> resolve(Grammar scope, final String value) {
|
||||
final Map<String, Set<Define>> map = getAllVariants(scope);
|
||||
if (map == null) {
|
||||
return null;
|
||||
@@ -147,8 +146,7 @@ public final class DefinitionResolver extends CommonElement.Visitor implements
|
||||
return set;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Map<String, Set<Define>> getAllVariants(Grammar scope) {
|
||||
public static @Nullable Map<String, Set<Define>> getAllVariants(Grammar scope) {
|
||||
final PsiElement psiElement = scope.getPsiElement();
|
||||
if (psiElement == null || !psiElement.isValid()) return null;
|
||||
|
||||
@@ -207,8 +205,7 @@ public final class DefinitionResolver extends CommonElement.Visitor implements
|
||||
return myResult == null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Set<Define> getResult() {
|
||||
public @Nullable Set<Define> getResult() {
|
||||
return myResult != null ? Collections.singleton(myResult) : null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public final class GrammarFactory {
|
||||
@Nullable
|
||||
public static Grammar getGrammar(@NotNull XmlFile element) {
|
||||
public static @Nullable Grammar getGrammar(@NotNull XmlFile element) {
|
||||
if (element instanceof RncFile) {
|
||||
return ((RncFile)element).getGrammar();
|
||||
}
|
||||
|
||||
@@ -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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.plugins.relaxNG.model.resolve;
|
||||
|
||||
import com.intellij.ide.highlighter.XmlFileType;
|
||||
@@ -21,9 +21,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class RelaxIncludeProvider extends FileIncludeProvider {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getId() {
|
||||
public @NotNull String getId() {
|
||||
return "relax-ng";
|
||||
}
|
||||
|
||||
|
||||
@@ -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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.plugins.relaxNG.model.resolve;
|
||||
|
||||
import com.intellij.ide.highlighter.XmlFileType;
|
||||
@@ -26,19 +26,16 @@ import java.util.Map;
|
||||
public class RelaxSymbolIndex extends ScalarIndexExtension<String> {
|
||||
public static final ID<String, Void> NAME = ID.create("RelaxSymbolIndex");
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public ID<String, Void> getName() {
|
||||
public @NotNull ID<String, Void> getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public DataIndexer<String, Void, FileContent> getIndexer() {
|
||||
public @NotNull DataIndexer<String, Void, FileContent> getIndexer() {
|
||||
return new DataIndexer<>() {
|
||||
@Override
|
||||
@NotNull
|
||||
public Map<String, Void> map(@NotNull FileContent inputData) {
|
||||
public @NotNull Map<String, Void> map(@NotNull FileContent inputData) {
|
||||
final HashMap<String, Void> map = new HashMap<>();
|
||||
if (inputData.getFileType() == XmlFileType.INSTANCE) {
|
||||
CharSequence inputDataContentAsText = inputData.getContentAsText();
|
||||
@@ -103,15 +100,13 @@ public class RelaxSymbolIndex extends ScalarIndexExtension<String> {
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public KeyDescriptor<String> getKeyDescriptor() {
|
||||
public @NotNull KeyDescriptor<String> getKeyDescriptor() {
|
||||
return EnumeratorStringDescriptor.INSTANCE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public FileBasedIndex.InputFilter getInputFilter() {
|
||||
public @NotNull FileBasedIndex.InputFilter getInputFilter() {
|
||||
return new DefaultFileTypeSpecificInputFilter(XmlFileType.INSTANCE, RncFileType.getInstance()) {
|
||||
@Override
|
||||
public boolean acceptInput(@NotNull VirtualFile file) {
|
||||
|
||||
@@ -62,8 +62,7 @@ public class PrefixReferenceProvider extends PsiReferenceProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement resolve() {
|
||||
public @Nullable PsiElement resolve() {
|
||||
final String prefix = getCanonicalText();
|
||||
XmlTag tag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class);
|
||||
while (tag != null) {
|
||||
@@ -106,8 +105,7 @@ public class PrefixReferenceProvider extends PsiReferenceProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getUnresolvedMessagePattern() {
|
||||
public @NotNull String getUnresolvedMessagePattern() {
|
||||
//The format substitution is performed at the call site
|
||||
//noinspection UnresolvedPropertyKey
|
||||
return RelaxngBundle.message("relaxng.annotator.unresolved-namespace-prefix");
|
||||
|
||||
@@ -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-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.plugins.relaxNG.validation;
|
||||
|
||||
import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel;
|
||||
@@ -62,8 +62,7 @@ public class RngValidateHandler implements ValidateXmlHandler {
|
||||
return getRngSchema(file) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static XmlFile getRngSchema(XmlFile file) {
|
||||
private static @Nullable XmlFile getRngSchema(XmlFile file) {
|
||||
final RngElementDescriptor descriptor = getRootDescriptor(file);
|
||||
if (descriptor == null) return null;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class XmlInstanceValidator {
|
||||
private XmlInstanceValidator() {
|
||||
}
|
||||
|
||||
public static void doValidation(@NotNull final XmlDocument doc, final Validator.ValidationHost host, final XmlFile descriptorFile) {
|
||||
public static void doValidation(final @NotNull XmlDocument doc, final Validator.ValidationHost host, final XmlFile descriptorFile) {
|
||||
try {
|
||||
final Schema schema = RngParser.getCachedSchema(descriptorFile);
|
||||
if (schema == null) {
|
||||
@@ -110,8 +110,7 @@ public final class XmlInstanceValidator {
|
||||
});
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ErrorHandler create(XmlDocument doc, Validator.ValidationHost host) {
|
||||
public static @Nullable ErrorHandler create(XmlDocument doc, Validator.ValidationHost host) {
|
||||
final XmlTag rootTag = doc.getRootTag();
|
||||
if (rootTag == null) {
|
||||
return null;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.intellij.plugins.relaxNG.xml;
|
||||
|
||||
import com.intellij.xml.Html5SchemaProvider;
|
||||
@@ -6,21 +7,18 @@ import org.jetbrains.annotations.NotNull;
|
||||
import java.net.URL;
|
||||
|
||||
public class RngHtml5SchemaProvider extends Html5SchemaProvider {
|
||||
@NotNull
|
||||
@Override
|
||||
public URL getHtmlSchemaLocation() {
|
||||
public @NotNull URL getHtmlSchemaLocation() {
|
||||
return RngHtml5SchemaProvider.class.getResource("/resources/html5-schema/html5.rnc");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public URL getXhtmlSchemaLocation() {
|
||||
public @NotNull URL getXhtmlSchemaLocation() {
|
||||
return RngHtml5SchemaProvider.class.getResource("/resources/html5-schema/xhtml5.rnc");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public URL getCharsLocation() {
|
||||
public @NotNull URL getCharsLocation() {
|
||||
return RngHtml5SchemaProvider.class.getResource("/resources/html5-schema/html5chars.ent");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,20 +46,17 @@ class CreatePatternFix implements IntentionAction, LocalQuickFix {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getText() {
|
||||
public @NotNull String getText() {
|
||||
return RelaxngBundle.message("relaxng.quickfix.create-pattern.name", myReference.getCanonicalText());
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return RelaxngBundle.message("relaxng.quickfix.create-pattern.family");
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return getText();
|
||||
}
|
||||
|
||||
|
||||
@@ -76,8 +76,7 @@ public class DefinitionReference extends PsiReferenceBase.Poly<XmlAttributeValue
|
||||
return ContainerUtil.map2Array(set, ResolveResult.class, this);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public RngGrammar getScope() {
|
||||
public @Nullable RngGrammar getScope() {
|
||||
RngGrammar scope = myValue.getParentOfType(RngGrammar.class, true);
|
||||
if (scope == null) {
|
||||
return null;
|
||||
@@ -137,8 +136,7 @@ public class DefinitionReference extends PsiReferenceBase.Poly<XmlAttributeValue
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getUnresolvedMessagePattern() {
|
||||
public @NotNull String getUnresolvedMessagePattern() {
|
||||
//noinspection UnresolvedPropertyKey
|
||||
return RelaxngBundle.message("relaxng.annotator.unresolved-pattern-reference");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user