mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cleanup - sort modifiers
GitOrigin-RevId: 1a7b90e5811669f73d8a4afa4729bf4b202cb1ce
This commit is contained in:
committed by
intellij-monorepo-bot
parent
568f3755d3
commit
c2a197a079
@@ -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 com.intellij.patterns;
|
||||
|
||||
import com.intellij.util.ProcessingContext;
|
||||
@@ -31,7 +17,7 @@ public class DomElementPattern<T extends DomElement,Self extends DomElementPatte
|
||||
super(aClass);
|
||||
}
|
||||
|
||||
protected DomElementPattern(@NotNull final InitialPatternCondition<T> condition) {
|
||||
protected DomElementPattern(final @NotNull InitialPatternCondition<T> condition) {
|
||||
super(condition);
|
||||
}
|
||||
|
||||
@@ -41,7 +27,7 @@ public class DomElementPattern<T extends DomElement,Self extends DomElementPatte
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DomElement[] getChildren(@NotNull final DomElement domElement) {
|
||||
protected DomElement[] getChildren(final @NotNull DomElement domElement) {
|
||||
final List<DomElement> children = new ArrayList<>();
|
||||
domElement.acceptChildren(new DomElementVisitor() {
|
||||
@Override
|
||||
@@ -59,10 +45,10 @@ public class DomElementPattern<T extends DomElement,Self extends DomElementPatte
|
||||
|
||||
}
|
||||
|
||||
public Self withChild(@NonNls @NotNull final String localName, final ElementPattern pattern) {
|
||||
public Self withChild(final @NonNls @NotNull String localName, final ElementPattern pattern) {
|
||||
return with(new PatternCondition<>("withChild") {
|
||||
@Override
|
||||
public boolean accepts(@NotNull final T t, final ProcessingContext context) {
|
||||
public boolean accepts(final @NotNull T t, final ProcessingContext context) {
|
||||
for (final AbstractDomChildrenDescription description : t.getGenericInfo().getChildrenDescriptions()) {
|
||||
if (!(description instanceof DomChildrenDescription) ||
|
||||
localName.equals(((DomChildrenDescription)description).getXmlElementName())) {
|
||||
|
||||
@@ -1,30 +1,16 @@
|
||||
/*
|
||||
* 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 com.intellij.patterns;
|
||||
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.xml.DomUtil;
|
||||
import com.intellij.util.xml.GenericDomValue;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class GenericDomValuePattern<T> extends DomElementPattern<GenericDomValue<T>, GenericDomValuePattern<T>>{
|
||||
private static final InitialPatternCondition CONDITION = new InitialPatternCondition(GenericDomValue.class) {
|
||||
@Override
|
||||
public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
|
||||
public boolean accepts(final @Nullable Object o, final ProcessingContext context) {
|
||||
return o instanceof GenericDomValue;
|
||||
}
|
||||
};
|
||||
@@ -36,7 +22,7 @@ public class GenericDomValuePattern<T> extends DomElementPattern<GenericDomValue
|
||||
protected GenericDomValuePattern(final Class<T> aClass) {
|
||||
super(new InitialPatternCondition(aClass) {
|
||||
@Override
|
||||
public boolean accepts(@Nullable final Object o, final ProcessingContext context) {
|
||||
public boolean accepts(final @Nullable Object o, final ProcessingContext context) {
|
||||
return o instanceof GenericDomValue && aClass.equals(DomUtil.getGenericValueParameter(((GenericDomValue<?>)o).getDomElementType()));
|
||||
}
|
||||
|
||||
@@ -46,20 +32,20 @@ public class GenericDomValuePattern<T> extends DomElementPattern<GenericDomValue
|
||||
public GenericDomValuePattern<T> withStringValue(final ElementPattern<String> pattern) {
|
||||
return with(new PatternCondition<>("withStringValue") {
|
||||
@Override
|
||||
public boolean accepts(@NotNull final GenericDomValue<T> genericDomValue, final ProcessingContext context) {
|
||||
public boolean accepts(final @NotNull GenericDomValue<T> genericDomValue, final ProcessingContext context) {
|
||||
return pattern.accepts(genericDomValue.getStringValue(), context);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public GenericDomValuePattern<T> withValue(@NotNull final T value) {
|
||||
public GenericDomValuePattern<T> withValue(final @NotNull T value) {
|
||||
return withValue(StandardPatterns.object(value));
|
||||
}
|
||||
|
||||
public GenericDomValuePattern<T> withValue(final ElementPattern<?> pattern) {
|
||||
return with(new PatternCondition<>("withValue") {
|
||||
@Override
|
||||
public boolean accepts(@NotNull final GenericDomValue<T> genericDomValue, final ProcessingContext context) {
|
||||
public boolean accepts(final @NotNull GenericDomValue<T> genericDomValue, final ProcessingContext context) {
|
||||
return pattern.accepts(genericDomValue.getValue(), context);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -35,14 +21,12 @@ public abstract class AbstractConvertContext extends ConvertContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public XmlElement getXmlElement() {
|
||||
public @Nullable XmlElement getXmlElement() {
|
||||
return getInvocationElement().getXmlElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public final XmlFile getFile() {
|
||||
public final @NotNull XmlFile getFile() {
|
||||
return DomUtil.getFile(getInvocationElement());
|
||||
}
|
||||
|
||||
@@ -57,8 +41,7 @@ public abstract class AbstractConvertContext extends ConvertContext {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public GlobalSearchScope getSearchScope() {
|
||||
public @Nullable GlobalSearchScope getSearchScope() {
|
||||
GlobalSearchScope scope = null;
|
||||
|
||||
Module[] modules = getConvertContextModules();
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -28,17 +14,13 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class ConvertContext {
|
||||
|
||||
@NotNull
|
||||
public abstract DomElement getInvocationElement();
|
||||
public abstract @NotNull DomElement getInvocationElement();
|
||||
|
||||
@Nullable
|
||||
public abstract XmlTag getTag();
|
||||
public abstract @Nullable XmlTag getTag();
|
||||
|
||||
@Nullable
|
||||
public abstract XmlElement getXmlElement();
|
||||
public abstract @Nullable XmlElement getXmlElement();
|
||||
|
||||
@Nullable
|
||||
public XmlElement getReferenceXmlElement() {
|
||||
public @Nullable XmlElement getReferenceXmlElement() {
|
||||
final XmlElement element = getXmlElement();
|
||||
if (element instanceof XmlTag) {
|
||||
return element;
|
||||
@@ -49,14 +31,11 @@ public abstract class ConvertContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract XmlFile getFile();
|
||||
public abstract @NotNull XmlFile getFile();
|
||||
|
||||
@Nullable
|
||||
public abstract Module getModule();
|
||||
public abstract @Nullable Module getModule();
|
||||
|
||||
@Nullable
|
||||
public abstract GlobalSearchScope getSearchScope();
|
||||
public abstract @Nullable GlobalSearchScope getSearchScope();
|
||||
|
||||
public PsiManager getPsiManager() {
|
||||
return PsiManager.getInstance(getProject());
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.codeInspection.util.InspectionMessage;
|
||||
@@ -29,19 +15,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @param <T> Type to convert from/to.
|
||||
*/
|
||||
public abstract class Converter<T> {
|
||||
@Nullable
|
||||
public abstract T fromString(@Nullable @NonNls String s, final ConvertContext context);
|
||||
@Nullable
|
||||
public abstract String toString(@Nullable T t, final ConvertContext context);
|
||||
public abstract @Nullable T fromString(@Nullable @NonNls String s, final ConvertContext context);
|
||||
public abstract @Nullable String toString(@Nullable T t, final ConvertContext context);
|
||||
|
||||
/**
|
||||
* @param s string value that couldn't be resolved
|
||||
* @param context context
|
||||
* @return error message used to highlight the errors somewhere in the UI, most often - like unresolved references in XML
|
||||
*/
|
||||
@InspectionMessage
|
||||
@Nullable
|
||||
public String getErrorMessage(@Nullable String s, final ConvertContext context) {
|
||||
public @InspectionMessage @Nullable String getErrorMessage(@Nullable String s, final ConvertContext context) {
|
||||
return XmlDomBundle.message("dom.converter.cannot.convert.default", s);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 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.util.xml;
|
||||
|
||||
import com.intellij.openapi.Disposable;
|
||||
@@ -38,22 +38,19 @@ public abstract class DomManager extends CompositeModificationTracker implements
|
||||
* If there is a {@link DomFileDescription} that is responsible for the file, but its {@link DomFileDescription#getRootElementClass()}
|
||||
* result is incompatible with domClass parameter, null is returned
|
||||
*/
|
||||
@Nullable
|
||||
public abstract <T extends DomElement> DomFileElement<T> getFileElement(XmlFile file, Class<T> domClass);
|
||||
public abstract @Nullable <T extends DomElement> DomFileElement<T> getFileElement(XmlFile file, Class<T> domClass);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getFileElement(XmlFile, Class)}
|
||||
*/
|
||||
@Nullable
|
||||
@Deprecated
|
||||
public abstract <T extends DomElement> DomFileElement<T> getFileElement(XmlFile file);
|
||||
public abstract @Nullable <T extends DomElement> DomFileElement<T> getFileElement(XmlFile file);
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #getFileElement(XmlFile, Class)}
|
||||
*/
|
||||
@NotNull
|
||||
@Deprecated(forRemoval = true)
|
||||
public abstract <T extends DomElement> DomFileElement<T> getFileElement(XmlFile file, Class<T> aClass, @NonNls String rootTagName);
|
||||
public abstract @NotNull <T extends DomElement> DomFileElement<T> getFileElement(XmlFile file, Class<T> aClass, @NonNls String rootTagName);
|
||||
|
||||
public abstract void addDomEventListener(DomEventListener listener, Disposable parentDisposable);
|
||||
|
||||
@@ -67,15 +64,13 @@ public abstract class DomManager extends CompositeModificationTracker implements
|
||||
* @param element tag
|
||||
* @return DOM element for the given tag. If DOM isn't initialized for the containing file, it will be initialized
|
||||
*/
|
||||
@Nullable
|
||||
public abstract DomElement getDomElement(@Nullable final XmlTag element);
|
||||
public abstract @Nullable DomElement getDomElement(final @Nullable XmlTag element);
|
||||
|
||||
/**
|
||||
* @param element attribute
|
||||
* @return DOM element for the given XML attribute. If DOM isn't initialized for the containing file, it will be initialized
|
||||
*/
|
||||
@Nullable
|
||||
public abstract GenericAttributeValue<?> getDomElement(final XmlAttribute element);
|
||||
public abstract @Nullable GenericAttributeValue<?> getDomElement(final XmlAttribute element);
|
||||
|
||||
/**
|
||||
* @param aClass Desired DOM element class
|
||||
@@ -120,27 +115,23 @@ public abstract class DomManager extends CompositeModificationTracker implements
|
||||
* this method to resolve DOM references. This result's subtree will be traversed recursively searching for the reference target. See
|
||||
* {@link Resolve} annotation.
|
||||
*/
|
||||
@NotNull
|
||||
public abstract DomElement getResolvingScope(GenericDomValue<?> element);
|
||||
public abstract @NotNull DomElement getResolvingScope(GenericDomValue<?> element);
|
||||
|
||||
/**
|
||||
* @param element Named DOM element
|
||||
* @return The scope within which the element's name identity will be checked by
|
||||
* {@link com.intellij.util.xml.highlighting.DomHighlightingHelper#checkNameIdentity(DomElement, com.intellij.util.xml.highlighting.DomElementAnnotationHolder)}
|
||||
*/
|
||||
@Nullable
|
||||
public abstract DomElement getIdentityScope(DomElement element);
|
||||
public abstract @Nullable DomElement getIdentityScope(DomElement element);
|
||||
|
||||
/**
|
||||
* @return {@link TypeChooserManager} instance
|
||||
*/
|
||||
public abstract TypeChooserManager getTypeChooserManager();
|
||||
|
||||
@Nullable
|
||||
public abstract AbstractDomChildrenDescription findChildrenDescription(@NotNull XmlTag templateChildTag, @NotNull DomElement parent);
|
||||
public abstract @Nullable AbstractDomChildrenDescription findChildrenDescription(@NotNull XmlTag templateChildTag, @NotNull DomElement parent);
|
||||
|
||||
@Nullable
|
||||
public final DomFileDescription<?> getDomFileDescription(final XmlFile xmlFile) {
|
||||
public final @Nullable DomFileDescription<?> getDomFileDescription(final XmlFile xmlFile) {
|
||||
final DomFileElement<DomElement> element = getFileElement(xmlFile);
|
||||
return element != null ? element.getFileDescription() : null;
|
||||
}
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -29,8 +15,7 @@ import javax.swing.*;
|
||||
|
||||
public class DomMetaData<T extends DomElement> implements PsiWritableMetaData, PsiPresentableMetaData, PsiMetaData {
|
||||
private T myElement;
|
||||
@Nullable
|
||||
private GenericDomValue myNameElement;
|
||||
private @Nullable GenericDomValue myNameElement;
|
||||
|
||||
@Override
|
||||
public final PsiElement getDeclaration() {
|
||||
@@ -42,14 +27,12 @@ public class DomMetaData<T extends DomElement> implements PsiWritableMetaData, P
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public String getName(PsiElement context) {
|
||||
public @NonNls String getName(PsiElement context) {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public final String getName() {
|
||||
public final @NonNls String getName() {
|
||||
final String s = ElementPresentationManager.getElementName(myElement);
|
||||
if (s != null) return s;
|
||||
|
||||
@@ -68,8 +51,7 @@ public class DomMetaData<T extends DomElement> implements PsiWritableMetaData, P
|
||||
myElement = element;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected GenericDomValue getNameElement(final T t) {
|
||||
protected @Nullable GenericDomValue getNameElement(final T t) {
|
||||
return myElement.getGenericInfo().getNameDomElement(t);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -29,8 +15,7 @@ public abstract class DomNameStrategy {
|
||||
* @param propertyName property name, i.e. method name without first 'get', 'set' or 'is'
|
||||
* @return XML element name
|
||||
*/
|
||||
@NotNull
|
||||
public abstract String convertName(@NotNull String propertyName);
|
||||
public abstract @NotNull String convertName(@NotNull String propertyName);
|
||||
|
||||
/**
|
||||
* Is used to get presentable DOM elements in UI
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
@@ -56,8 +56,7 @@ public final class DomReflectionUtil {
|
||||
return methods;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static JavaMethod findGetter(Class<?> aClass, String propertyName) {
|
||||
public static @Nullable JavaMethod findGetter(Class<?> aClass, String propertyName) {
|
||||
final String capitalized = StringUtil.capitalize(propertyName);
|
||||
Method method = ReflectionUtil.getMethod(aClass, "get" + capitalized);
|
||||
if (method != null) return JavaMethod.getMethod(aClass, method);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. 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.util.xml;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
@@ -31,8 +31,7 @@ public final class DomResolveConverter<T extends DomElement> extends ResolvingCo
|
||||
private final boolean myAttribute;
|
||||
private final SoftFactoryMap<DomElement, CachedValue<Map<String, DomElement>>> myResolveCache = new SoftFactoryMap<>() {
|
||||
@Override
|
||||
@NotNull
|
||||
protected CachedValue<Map<String, DomElement>> create(final @NotNull DomElement scope) {
|
||||
protected @NotNull CachedValue<Map<String, DomElement>> create(final @NotNull DomElement scope) {
|
||||
final DomManager domManager = scope.getManager();
|
||||
//noinspection ConstantConditions
|
||||
if (domManager == null) throw new AssertionError("Null DomManager for " + scope.getClass());
|
||||
@@ -109,8 +108,7 @@ public final class DomResolveConverter<T extends DomElement> extends ResolvingCo
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<? extends T> getVariants(final ConvertContext context) {
|
||||
public @NotNull Collection<? extends T> getVariants(final ConvertContext context) {
|
||||
final DomElement reference = context.getInvocationElement();
|
||||
final DomElement scope = reference.getManager().getResolvingScope((GenericDomValue)reference);
|
||||
return (Collection<T>)myResolveCache.get(scope).getValue().values();
|
||||
|
||||
@@ -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.util.xml;
|
||||
|
||||
import com.intellij.ide.structureView.StructureViewBuilder;
|
||||
@@ -33,13 +33,11 @@ public abstract class DomService {
|
||||
* @return files containing given root element
|
||||
* @see #getFileElements(Class, Project, GlobalSearchScope)
|
||||
*/
|
||||
@NotNull
|
||||
public abstract Collection<VirtualFile> getDomFileCandidates(@NotNull Class<? extends DomElement> rootElementClass,
|
||||
public abstract @NotNull Collection<VirtualFile> getDomFileCandidates(@NotNull Class<? extends DomElement> rootElementClass,
|
||||
@NotNull GlobalSearchScope scope);
|
||||
|
||||
// used externally
|
||||
@NotNull
|
||||
public Collection<VirtualFile> getDomFileCandidates(@NotNull Class<? extends DomElement> rootElementClass,
|
||||
public @NotNull Collection<VirtualFile> getDomFileCandidates(@NotNull Class<? extends DomElement> rootElementClass,
|
||||
Project project,
|
||||
@NotNull GlobalSearchScope scope) {
|
||||
return getDomFileCandidates(rootElementClass, scope);
|
||||
@@ -51,29 +49,23 @@ public abstract class DomService {
|
||||
* @param scope search scope
|
||||
* @return DOM file elements containing given root element
|
||||
*/
|
||||
@NotNull
|
||||
public abstract <T extends DomElement> List<DomFileElement<T>> getFileElements(@NotNull Class<T> rootElementClass,
|
||||
public abstract @NotNull <T extends DomElement> List<DomFileElement<T>> getFileElements(@NotNull Class<T> rootElementClass,
|
||||
@NotNull Project project,
|
||||
@Nullable GlobalSearchScope scope);
|
||||
|
||||
@NotNull
|
||||
public abstract ModelMerger createModelMerger();
|
||||
public abstract @NotNull ModelMerger createModelMerger();
|
||||
|
||||
public abstract <T extends DomElement> DomAnchor<T> createAnchor(T domElement);
|
||||
|
||||
@NotNull
|
||||
public abstract XmlFile getContainingFile(@NotNull DomElement domElement);
|
||||
public abstract @NotNull XmlFile getContainingFile(@NotNull DomElement domElement);
|
||||
|
||||
@NotNull
|
||||
public abstract EvaluatedXmlName getEvaluatedXmlName(@NotNull DomElement element);
|
||||
public abstract @NotNull EvaluatedXmlName getEvaluatedXmlName(@NotNull DomElement element);
|
||||
|
||||
@NotNull
|
||||
public abstract XmlFileHeader getXmlFileHeader(@NotNull XmlFile file);
|
||||
public abstract @NotNull XmlFileHeader getXmlFileHeader(@NotNull XmlFile file);
|
||||
|
||||
public enum StructureViewMode {
|
||||
SHOW, SHOW_CHILDREN, SKIP
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract StructureViewBuilder createSimpleStructureViewBuilder(@NotNull XmlFile file, @NotNull Function<DomElement, StructureViewMode> modeProvider);
|
||||
public abstract @NotNull StructureViewBuilder createSimpleStructureViewBuilder(@NotNull XmlFile file, @NotNull Function<DomElement, StructureViewMode> modeProvider);
|
||||
}
|
||||
|
||||
@@ -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.util.xml;
|
||||
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
@@ -26,8 +26,7 @@ public final class DomTarget extends DelegatePsiTarget implements PsiDeclaredTar
|
||||
myNameDomElement = nameElement;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static DomTarget getTarget(@NotNull DomElement element) {
|
||||
public static @Nullable DomTarget getTarget(@NotNull DomElement element) {
|
||||
final GenericDomValue nameElement = element.getGenericInfo().getNameDomElement(element);
|
||||
if (nameElement == null) {
|
||||
return null;
|
||||
@@ -36,8 +35,7 @@ public final class DomTarget extends DelegatePsiTarget implements PsiDeclaredTar
|
||||
return getTarget(element, nameElement);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static DomTarget getTarget(DomElement element, GenericDomValue nameElement) {
|
||||
public static @Nullable DomTarget getTarget(DomElement element, GenericDomValue nameElement) {
|
||||
if (nameElement instanceof GenericAttributeValue genericAttributeValue) {
|
||||
final XmlAttributeValue attributeValue = genericAttributeValue.getXmlAttributeValue();
|
||||
if (attributeValue == null) {
|
||||
@@ -80,8 +78,7 @@ public final class DomTarget extends DelegatePsiTarget implements PsiDeclaredTar
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public String getName() {
|
||||
public @Nullable String getName() {
|
||||
return myNameDomElement.getStringValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -78,8 +78,7 @@ public class DomUtil {
|
||||
return getGenericValueParameter(type) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends DomElement> T findByName(@NotNull Collection<T> list, @NonNls @NotNull String name) {
|
||||
public static @Nullable <T extends DomElement> T findByName(@NotNull Collection<T> list, @NonNls @NotNull String name) {
|
||||
for (T element: list) {
|
||||
String elementName = element.getGenericInfo().getElementName(element);
|
||||
if (elementName != null && elementName.equals(name)) {
|
||||
@@ -89,8 +88,7 @@ public class DomUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static List<JavaMethod> getFixedPath(DomElement element) {
|
||||
public static @Nullable List<JavaMethod> getFixedPath(DomElement element) {
|
||||
assert element.isValid();
|
||||
final LinkedList<JavaMethod> methods = new LinkedList<>();
|
||||
while (true) {
|
||||
@@ -108,8 +106,7 @@ public class DomUtil {
|
||||
return methods;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static JavaMethod getGetterMethod(final DomElement element, final DomElement parent) {
|
||||
private static @Nullable JavaMethod getGetterMethod(final DomElement element, final DomElement parent) {
|
||||
final String xmlElementName = element.getXmlElementName();
|
||||
final String namespace = element.getXmlElementNamespaceKey();
|
||||
final DomGenericInfo genericInfo = parent.getGenericInfo();
|
||||
@@ -128,8 +125,7 @@ public class DomUtil {
|
||||
return ourVariableSubstitutions.get(Couple.of(genericType, classType));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Class<?> getGenericValueParameter(Type type) {
|
||||
public static @Nullable Class<?> getGenericValueParameter(Type type) {
|
||||
final Class<?> aClass = ourTypeParameters.get(type);
|
||||
return aClass == DUMMY ? null : aClass;
|
||||
}
|
||||
@@ -140,8 +136,7 @@ public class DomUtil {
|
||||
ourVariableSubstitutions.clear();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static XmlElement getValueElement(GenericDomValue<?> domValue) {
|
||||
public static @Nullable XmlElement getValueElement(GenericDomValue<?> domValue) {
|
||||
if (domValue instanceof GenericAttributeValue<?> value) {
|
||||
XmlAttributeValue attributeValue = value.getXmlAttributeValue();
|
||||
return attributeValue == null ? value.getXmlAttribute() : attributeValue;
|
||||
@@ -175,7 +170,7 @@ public class DomUtil {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public static <T> List<T> getChildrenOfType(@NotNull final DomElement parent, final Class<T> type) {
|
||||
public static <T> List<T> getChildrenOfType(final @NotNull DomElement parent, final Class<T> type) {
|
||||
final List<T> result = new SmartList<>();
|
||||
parent.acceptChildren(new DomElementVisitor() {
|
||||
@Override
|
||||
@@ -188,7 +183,7 @@ public class DomUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static List<DomElement> getDefinedChildren(@NotNull final DomElement parent, final boolean tags, final boolean attributes) {
|
||||
public static List<DomElement> getDefinedChildren(final @NotNull DomElement parent, final boolean tags, final boolean attributes) {
|
||||
if (parent instanceof MergedObject) {
|
||||
final SmartList<DomElement> result = new SmartList<>();
|
||||
parent.acceptChildren(new DomElementVisitor() {
|
||||
@@ -252,16 +247,15 @@ public class DomUtil {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static <T> List<T> getDefinedChildrenOfType(@NotNull final DomElement parent, final Class<T> type, boolean tags, boolean attributes) {
|
||||
public static <T> List<T> getDefinedChildrenOfType(final @NotNull DomElement parent, final Class<T> type, boolean tags, boolean attributes) {
|
||||
return ContainerUtil.findAll(getDefinedChildren(parent, tags, attributes), type);
|
||||
}
|
||||
|
||||
public static <T> List<T> getDefinedChildrenOfType(@NotNull final DomElement parent, final Class<T> type) {
|
||||
public static <T> List<T> getDefinedChildrenOfType(final @NotNull DomElement parent, final Class<T> type) {
|
||||
return getDefinedChildrenOfType(parent, type, true, true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static DomElement findDuplicateNamedValue(DomElement element, String newName) {
|
||||
public static @Nullable DomElement findDuplicateNamedValue(DomElement element, String newName) {
|
||||
return ElementPresentationManager.findByName(getIdentitySiblings(element), newName);
|
||||
}
|
||||
|
||||
@@ -295,8 +289,7 @@ public class DomUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T> T getParentOfType(final DomElement element, final Class<T> requiredClass, final boolean strict) {
|
||||
public static @Nullable <T> T getParentOfType(final DomElement element, final Class<T> requiredClass, final boolean strict) {
|
||||
for (DomElement curElement = strict && element != null? element.getParent() : element;
|
||||
curElement != null;
|
||||
curElement = curElement.getParent()) {
|
||||
@@ -307,14 +300,12 @@ public class DomUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T> T getContextElement(@Nullable final Editor editor, Class<T> clazz) {
|
||||
public static @Nullable <T> T getContextElement(final @Nullable Editor editor, Class<T> clazz) {
|
||||
final DomElement element = getContextElement(editor);
|
||||
return getParentOfType(element, clazz, false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static DomElement getContextElement(@Nullable final Editor editor) {
|
||||
public static @Nullable DomElement getContextElement(final @Nullable Editor editor) {
|
||||
if(editor == null) return null;
|
||||
|
||||
final Project project = editor.getProject();
|
||||
@@ -328,13 +319,11 @@ public class DomUtil {
|
||||
return getDomElement(file.findElementAt(editor.getCaretModel().getOffset()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static DomElement getDomElement(@NotNull final Editor editor, @NotNull final PsiFile file) {
|
||||
public static @Nullable DomElement getDomElement(final @NotNull Editor editor, final @NotNull PsiFile file) {
|
||||
return getDomElement(file.findElementAt(editor.getCaretModel().getOffset()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static DomElement getDomElement(@Nullable final PsiElement element) {
|
||||
public static @Nullable DomElement getDomElement(final @Nullable PsiElement element) {
|
||||
if (element == null) return null;
|
||||
|
||||
final Project project = element.getProject();
|
||||
@@ -355,8 +344,7 @@ public class DomUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T extends DomElement> T getOriginalElement(@NotNull final T domElement) {
|
||||
public static @NotNull <T extends DomElement> T getOriginalElement(final @NotNull T domElement) {
|
||||
final XmlElement psiElement = domElement.getXmlElement();
|
||||
if (psiElement == null) return domElement;
|
||||
|
||||
@@ -377,7 +365,7 @@ public class DomUtil {
|
||||
return (T)current;
|
||||
}
|
||||
|
||||
public static <T extends DomElement> T addElementAfter(@NotNull final T anchor) {
|
||||
public static <T extends DomElement> T addElementAfter(final @NotNull T anchor) {
|
||||
final DomElement parent = anchor.getParent();
|
||||
final DomCollectionChildDescription childDescription = (DomCollectionChildDescription)anchor.getChildDescription();
|
||||
assert parent != null;
|
||||
@@ -387,13 +375,11 @@ public class DomUtil {
|
||||
return (T)childDescription.addValue(parent, i + 1);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends DomElement> T findDomElement(@Nullable final PsiElement element, final Class<T> beanClass) {
|
||||
public static @Nullable <T extends DomElement> T findDomElement(final @Nullable PsiElement element, final Class<T> beanClass) {
|
||||
return findDomElement(element, beanClass, true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends DomElement> T findDomElement(@Nullable final PsiElement element, final Class<T> beanClass, boolean strict) {
|
||||
public static @Nullable <T extends DomElement> T findDomElement(final @Nullable PsiElement element, final Class<T> beanClass, boolean strict) {
|
||||
if (element == null) return null;
|
||||
|
||||
XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class, strict);
|
||||
@@ -425,8 +411,7 @@ public class DomUtil {
|
||||
return fileElement;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static XmlFile getFile(@NotNull DomElement element) {
|
||||
public static @NotNull XmlFile getFile(@NotNull DomElement element) {
|
||||
return DomService.getInstance().getContainingFile(element);
|
||||
}
|
||||
|
||||
@@ -436,8 +421,7 @@ public class DomUtil {
|
||||
* If root tag has changed, file may lose its domness, so there will be no DomFileElement, but the inner DomElement's
|
||||
* will be still alive because the underlying XML tags are valid
|
||||
*/
|
||||
@NotNull
|
||||
public static DomElement getRoot(@NotNull DomElement domElement) {
|
||||
public static @NotNull DomElement getRoot(@NotNull DomElement domElement) {
|
||||
while (true) {
|
||||
final DomElement parent = domElement.getParent();
|
||||
if (parent == null) {
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.psi.xml.XmlElement;
|
||||
@@ -24,11 +10,11 @@ public class DummyEvaluatedXmlName implements EvaluatedXmlName {
|
||||
private final XmlName myXmlName;
|
||||
private final String myNamespace;
|
||||
|
||||
public DummyEvaluatedXmlName(final String localName, @NotNull final String namespace) {
|
||||
public DummyEvaluatedXmlName(final String localName, final @NotNull String namespace) {
|
||||
this(new XmlName(localName), namespace);
|
||||
}
|
||||
|
||||
public DummyEvaluatedXmlName(final XmlName xmlName, @NotNull final String namespace) {
|
||||
public DummyEvaluatedXmlName(final XmlName xmlName, final @NotNull String namespace) {
|
||||
myXmlName = xmlName;
|
||||
myNamespace = namespace;
|
||||
}
|
||||
@@ -39,7 +25,7 @@ public class DummyEvaluatedXmlName implements EvaluatedXmlName {
|
||||
}
|
||||
|
||||
@Override
|
||||
public EvaluatedXmlName evaluateChildName(@NotNull final XmlName name) {
|
||||
public EvaluatedXmlName evaluateChildName(final @NotNull XmlName name) {
|
||||
String namespaceKey = name.getNamespaceKey();
|
||||
if (namespaceKey == null) {
|
||||
return new DummyEvaluatedXmlName(name.getLocalName(), myNamespace);
|
||||
@@ -53,9 +39,7 @@ public class DummyEvaluatedXmlName implements EvaluatedXmlName {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNls
|
||||
public String getNamespace(@NotNull final XmlElement parentElement, final XmlFile file) {
|
||||
public @NotNull @NonNls String getNamespace(final @NotNull XmlElement parentElement, final XmlFile file) {
|
||||
return myNamespace;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.openapi.util.NlsSafe;
|
||||
@@ -26,15 +12,11 @@ import javax.swing.*;
|
||||
* @see ElementPresentationTemplate
|
||||
*/
|
||||
public abstract class ElementPresentation {
|
||||
@Nullable
|
||||
public abstract @NlsSafe String getElementName();
|
||||
public abstract @Nullable @NlsSafe String getElementName();
|
||||
|
||||
public abstract @NlsSafe String getTypeName();
|
||||
|
||||
@Nullable
|
||||
public abstract Icon getIcon();
|
||||
public abstract @Nullable Icon getIcon();
|
||||
|
||||
@Nls
|
||||
@Nullable
|
||||
public String getDocumentation() { return null;}
|
||||
public @Nls @Nullable String getDocumentation() { return null;}
|
||||
}
|
||||
|
||||
@@ -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.util.xml;
|
||||
|
||||
import com.intellij.ide.TypePresentationService;
|
||||
@@ -30,7 +30,7 @@ public abstract class ElementPresentationManager {
|
||||
.filter(method -> JavaMethod.getMethod(key, method).getAnnotation(NameValue.class) != null)
|
||||
.findFirst(), CollectionFactory::createConcurrentWeakKeySoftValueMap);
|
||||
|
||||
private final static Function<Object, String> DEFAULT_NAMER = element -> getElementName(element);
|
||||
private static final Function<Object, String> DEFAULT_NAMER = element -> getElementName(element);
|
||||
|
||||
public static ElementPresentationManager getInstance() {
|
||||
return ApplicationManager.getApplication().getService(ElementPresentationManager.class);
|
||||
@@ -67,8 +67,7 @@ public abstract class ElementPresentationManager {
|
||||
return (NullableFunction<T, String>)NAMER;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getElementName(@NotNull Object element) {
|
||||
public static @Nullable String getElementName(@NotNull Object element) {
|
||||
Object o = invokeNameValueMethod(element);
|
||||
if (o == null || o instanceof String) return (String)o;
|
||||
if (o instanceof GenericValue gv) {
|
||||
@@ -85,13 +84,11 @@ public abstract class ElementPresentationManager {
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static Object invokeNameValueMethod(@NotNull final Object element) {
|
||||
public static @Nullable Object invokeNameValueMethod(final @NotNull Object element) {
|
||||
return ourNameValueMethods.get(element.getClass()).map(method -> DomReflectionUtil.invokeMethod(method, element)).orElse(null);
|
||||
}
|
||||
|
||||
@NlsSafe
|
||||
public static String getTypeNameForObject(Object o) {
|
||||
public static @NlsSafe String getTypeNameForObject(Object o) {
|
||||
final Object firstImpl = ModelMergerUtil.getFirstImplementation(o);
|
||||
o = firstImpl != null ? firstImpl : o;
|
||||
String typeName = TypePresentationService.getService().getTypeName(o);
|
||||
@@ -116,19 +113,16 @@ public abstract class ElementPresentationManager {
|
||||
return getIconOld(o);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Icon getIconOld(Object o) {
|
||||
public static @Nullable Icon getIconOld(Object o) {
|
||||
return getFirst(getIconsForClass(o.getClass(), o));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static <T> T getFirst(final T @Nullable [] array) {
|
||||
private static @Nullable <T> T getFirst(final T @Nullable [] array) {
|
||||
return array == null || array.length == 0 ? null : array[0];
|
||||
}
|
||||
|
||||
|
||||
@Nullable
|
||||
public static Icon getIconForClass(Class clazz) {
|
||||
public static @Nullable Icon getIconForClass(Class clazz) {
|
||||
return getFirst(getIconsForClass(clazz, null));
|
||||
}
|
||||
|
||||
@@ -142,8 +136,7 @@ public abstract class ElementPresentationManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T> T findByName(Collection<T> collection, final String name) {
|
||||
public static @Nullable <T> T findByName(Collection<T> collection, final String name) {
|
||||
return ContainerUtil.find(collection, object -> Comparing.equal(name, getElementName(object), true));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. 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.util.xml;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
@@ -112,8 +112,7 @@ public final class EvaluatedXmlNameImpl implements EvaluatedXmlName {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NonNls
|
||||
public @NotNull String getNamespace(@NotNull XmlElement parentElement, final XmlFile file) {
|
||||
public @NonNls @NotNull String getNamespace(@NotNull XmlElement parentElement, final XmlFile file) {
|
||||
final String xmlElementNamespace = getXmlElementNamespace(parentElement);
|
||||
if (myNamespaceKey != null && !myEqualToParent) {
|
||||
final List<String> strings = getAllowedNamespaces(file);
|
||||
|
||||
@@ -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.
|
||||
// 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.util.xml;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* @author Gregory.Shrago
|
||||
@@ -34,24 +35,21 @@ public final class GenericValueUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> Collection<T> getValueCollection(final Collection<? extends GenericValue<? extends T>> collection, Collection<T> result) {
|
||||
public static @NotNull <T> Collection<T> getValueCollection(final Collection<? extends GenericValue<? extends T>> collection, Collection<T> result) {
|
||||
for (GenericValue<? extends T> o : collection) {
|
||||
ContainerUtil.addIfNotNull(result, o.getValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<String> getStringCollection(final Collection<? extends GenericValue> collection, Collection<String> result) {
|
||||
public static @NotNull Collection<String> getStringCollection(final Collection<? extends GenericValue> collection, Collection<String> result) {
|
||||
for (GenericValue o : collection) {
|
||||
ContainerUtil.addIfNotNull(result, o.getStringValue());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Collection<String> getClassStringCollection(final Collection<? extends GenericValue> collection, Collection<String> result) {
|
||||
public static @NotNull Collection<String> getClassStringCollection(final Collection<? extends GenericValue> collection, Collection<String> result) {
|
||||
for (GenericValue o : collection) {
|
||||
final String value = o.getStringValue();
|
||||
if (value != null) {
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -10,9 +10,8 @@ import org.jetbrains.annotations.NotNull;
|
||||
* e.g. getXmlElementName() will correspond to xml-element-name
|
||||
*/
|
||||
public class HyphenNameStrategy extends DomNameStrategy {
|
||||
@NotNull
|
||||
@Override
|
||||
public String convertName(@NotNull String propertyName) {
|
||||
public @NotNull String convertName(@NotNull String propertyName) {
|
||||
final String[] words = NameUtilCore.nameToWords(propertyName);
|
||||
for (int i = 0; i < words.length; i++) {
|
||||
words[i] = StringUtil.decapitalize(words[i]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. 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.util.xml;
|
||||
|
||||
import com.intellij.util.SmartFMap;
|
||||
@@ -36,8 +36,7 @@ public final class JavaMethod implements AnnotatedElement {
|
||||
return mySignature;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<Method> getHierarchy() {
|
||||
public @NotNull List<Method> getHierarchy() {
|
||||
List<Method> hierarchy = myHierarchy;
|
||||
if (hierarchy == null) {
|
||||
hierarchy = Collections.unmodifiableList(mySignature.getAllMethods(myDeclaringClass));
|
||||
@@ -78,8 +77,7 @@ public final class JavaMethod implements AnnotatedElement {
|
||||
return "JavaMethod: " + myMethod.toString();
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public String getName() {
|
||||
public @NonNls String getName() {
|
||||
return myMethod.getName();
|
||||
}
|
||||
|
||||
@@ -93,8 +91,7 @@ public final class JavaMethod implements AnnotatedElement {
|
||||
return annotation == NONE ? null : (T)annotation;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Object findAnnotation(Class<? extends Annotation> annotationClass) {
|
||||
private @NotNull Object findAnnotation(Class<? extends Annotation> annotationClass) {
|
||||
for (Method method : getHierarchy()) {
|
||||
Annotation annotation = method.getAnnotation(annotationClass);
|
||||
if (annotation != null) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 JetBrains s.r.o. and contributors. 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.util.xml;
|
||||
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -35,8 +35,7 @@ public final class JavaMethodSignature {
|
||||
return myMethodName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Method findMethod(@NotNull Class<?> aClass) {
|
||||
public @Nullable Method findMethod(@NotNull Class<?> aClass) {
|
||||
Method method = getDeclaredMethod(aClass);
|
||||
if (method == null && aClass.isInterface() && OBJECT_METHOD_NAMES.contains(myMethodName)) {
|
||||
method = ReflectionUtil.getDeclaredMethod(Object.class, myMethodName, myMethodParameters);
|
||||
@@ -44,8 +43,7 @@ public final class JavaMethodSignature {
|
||||
return method;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Method getDeclaredMethod(@NotNull Class<?> aClass) {
|
||||
private @Nullable Method getDeclaredMethod(@NotNull Class<?> aClass) {
|
||||
Method method = ReflectionUtil.getMethod(aClass, myMethodName, myMethodParameters);
|
||||
return method == null ? ReflectionUtil.getDeclaredMethod(aClass, myMethodName, myMethodParameters) : method;
|
||||
}
|
||||
@@ -65,8 +63,7 @@ public final class JavaMethodSignature {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
static Method findMethod(@NotNull Method sampleMethod, @NotNull Class<?> startFrom, @NotNull Predicate<Method> checker) {
|
||||
static @Nullable Method findMethod(@NotNull Method sampleMethod, @NotNull Class<?> startFrom, @NotNull Predicate<Method> checker) {
|
||||
String sampleMethodName = sampleMethod.getName();
|
||||
Class<?>[] sampleMethodParameters = sampleMethod.getParameterCount() == 0 ? ArrayUtil.EMPTY_CLASS_ARRAY : sampleMethod.getParameterTypes();
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
@@ -14,9 +14,8 @@ import java.util.Arrays;
|
||||
public class JavaNameStrategy extends DomNameStrategy {
|
||||
public static final Function<String,String> DECAPITALIZE_FUNCTION = s -> StringUtil.decapitalize(s);
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public final String convertName(@NotNull String propertyName) {
|
||||
public final @NotNull String convertName(@NotNull String propertyName) {
|
||||
return StringUtil.decapitalize(propertyName);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
@@ -14,16 +14,14 @@ import java.util.Set;
|
||||
public abstract class MergingFileDescription<T extends DomElement> extends DomFileDescription<T>{
|
||||
private ModelMerger myMerger;
|
||||
|
||||
protected MergingFileDescription(final Class<T> rootElementClass, @NonNls final String rootTagName) {
|
||||
protected MergingFileDescription(final Class<T> rootElementClass, final @NonNls String rootTagName) {
|
||||
super(rootElementClass, rootTagName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected abstract Set<XmlFile> getFilesToMerge(DomElement element);
|
||||
protected abstract @NotNull Set<XmlFile> getFilesToMerge(DomElement element);
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public DomElement getResolveScope(GenericDomValue<?> reference) {
|
||||
public @NotNull DomElement getResolveScope(GenericDomValue<?> reference) {
|
||||
final DomElement annotation = getScopeFromAnnotation(reference);
|
||||
if (annotation != null) return annotation;
|
||||
|
||||
@@ -67,8 +65,7 @@ public abstract class MergingFileDescription<T extends DomElement> extends DomFi
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public DomElement getIdentityScope(DomElement element) {
|
||||
public @NotNull DomElement getIdentityScope(DomElement element) {
|
||||
final DomElement annotation = getScopeFromAnnotation(element);
|
||||
if (annotation != null) return annotation;
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -42,7 +28,6 @@ public interface ModelMerger {
|
||||
}
|
||||
|
||||
abstract class MergingStrategy<T> {
|
||||
@Nullable
|
||||
public abstract T mergeChildren(Class<T> type, List<? extends T> implementations);
|
||||
public abstract @Nullable T mergeChildren(Class<T> type, List<? extends T> implementations);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml;
|
||||
|
||||
import com.intellij.util.CommonProcessors;
|
||||
@@ -13,8 +13,7 @@ import java.util.*;
|
||||
|
||||
public final class ModelMergerUtil {
|
||||
|
||||
@Nullable
|
||||
public static <T> T getFirstImplementation(final T t) {
|
||||
public static @Nullable <T> T getFirstImplementation(final T t) {
|
||||
T cur = t;
|
||||
while (cur instanceof MergedObject) {
|
||||
final List<T> implementations = ((MergedObject<T>)cur).getImplementations();
|
||||
@@ -23,8 +22,7 @@ public final class ModelMergerUtil {
|
||||
return cur;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T, V> V getImplementation(final Class<V> clazz, final Collection<T> elements) {
|
||||
public static @Nullable <T, V> V getImplementation(final Class<V> clazz, final Collection<T> elements) {
|
||||
for (final T element : elements) {
|
||||
final V implementation = getImplementation(element, clazz);
|
||||
if (implementation != null) {
|
||||
@@ -34,13 +32,11 @@ public final class ModelMergerUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T, V> V getImplementation(final Class<V> clazz, final T... elements) {
|
||||
public static @Nullable <T, V> V getImplementation(final Class<V> clazz, final T... elements) {
|
||||
return getImplementation(clazz, Arrays.asList(elements));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T, V> V getImplementation(final T element, final Class<V> clazz) {
|
||||
public static @Nullable <T, V> V getImplementation(final T element, final Class<V> clazz) {
|
||||
if (element == null) return null;
|
||||
CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<>() {
|
||||
@Override
|
||||
@@ -52,8 +48,7 @@ public final class ModelMergerUtil {
|
||||
return (V)processor.getFoundValue();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T, V> Collection<V> getImplementations(final T element, final Class<V> clazz) {
|
||||
public static @NotNull <T, V> Collection<V> getImplementations(final T element, final Class<V> clazz) {
|
||||
if (element == null) return Collections.emptyList();
|
||||
CommonProcessors.CollectProcessor<T> processor = new CommonProcessors.CollectProcessor<>() {
|
||||
@Override
|
||||
@@ -65,8 +60,7 @@ public final class ModelMergerUtil {
|
||||
return (Collection<V>)processor.getResults();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> List<T> getImplementations(T element) {
|
||||
public static @NotNull <T> List<T> getImplementations(T element) {
|
||||
if (element instanceof MergedObject) {
|
||||
final MergedObject<T> mergedObject = (MergedObject<T>)element;
|
||||
return mergedObject.getImplementations();
|
||||
@@ -79,8 +73,7 @@ public final class ModelMergerUtil {
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> List<T> getFilteredImplementations(final T element) {
|
||||
public static @NotNull <T> List<T> getFilteredImplementations(final T element) {
|
||||
if (element == null) return Collections.emptyList();
|
||||
List<T> result = new ArrayList<>();
|
||||
Processor<T> processor = Processors.cancelableCollectProcessor(result);
|
||||
@@ -88,8 +81,7 @@ public final class ModelMergerUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static <T> Processor<T> createFilteringProcessor(final Processor<? super T> processor) {
|
||||
public static @NotNull <T> Processor<T> createFilteringProcessor(final Processor<? super T> processor) {
|
||||
return new ImplementationProcessor<>(processor, false);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
import com.intellij.analysis.AnalysisBundle;
|
||||
@@ -36,9 +22,8 @@ import java.util.Set;
|
||||
*/
|
||||
public abstract class ResolvingConverter<T> extends Converter<T> implements ResolvingHint {
|
||||
|
||||
@InspectionMessage
|
||||
@Override
|
||||
public String getErrorMessage(@Nullable String s, final ConvertContext context) {
|
||||
public @InspectionMessage String getErrorMessage(@Nullable String s, final ConvertContext context) {
|
||||
return AnalysisBundle.message("error.cannot.resolve.default.message", s);
|
||||
}
|
||||
|
||||
@@ -46,15 +31,13 @@ public abstract class ResolvingConverter<T> extends Converter<T> implements Reso
|
||||
* @param context context
|
||||
* @return reference completion variants
|
||||
*/
|
||||
@NotNull
|
||||
public abstract Collection<? extends T> getVariants(final ConvertContext context);
|
||||
public abstract @NotNull Collection<? extends T> getVariants(final ConvertContext context);
|
||||
|
||||
/**
|
||||
* @return additional reference variants. They won't resolve to anywhere, but won't be highlighted as errors.
|
||||
* They will also appear in the completion dropdown.
|
||||
*/
|
||||
@NotNull
|
||||
public Set<String> getAdditionalVariants(@NotNull final ConvertContext context) {
|
||||
public @NotNull Set<String> getAdditionalVariants(final @NotNull ConvertContext context) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@@ -88,8 +71,7 @@ public abstract class ResolvingConverter<T> extends Converter<T> implements Reso
|
||||
* @param resolvedValue {@link #fromString(String, ConvertContext)} result
|
||||
* @return the PSI element to which the {@link com.intellij.psi.PsiReference} will resolve
|
||||
*/
|
||||
@Nullable
|
||||
public PsiElement getPsiElement(@Nullable T resolvedValue) {
|
||||
public @Nullable PsiElement getPsiElement(@Nullable T resolvedValue) {
|
||||
if (resolvedValue instanceof PsiElement) {
|
||||
return (PsiElement)resolvedValue;
|
||||
}
|
||||
@@ -123,8 +105,7 @@ public abstract class ResolvingConverter<T> extends Converter<T> implements Reso
|
||||
* @param context context
|
||||
* @return PSI element to resolve to. By default calls {@link #getPsiElement(Object)} method
|
||||
*/
|
||||
@Nullable
|
||||
public PsiElement resolve(final T o, final ConvertContext context) {
|
||||
public @Nullable PsiElement resolve(final T o, final ConvertContext context) {
|
||||
final PsiElement psiElement = getPsiElement(o);
|
||||
return psiElement == null && o != null ? DomUtil.getValueElement((GenericDomValue)context.getInvocationElement()) : psiElement;
|
||||
}
|
||||
@@ -146,15 +127,14 @@ public abstract class ResolvingConverter<T> extends Converter<T> implements Reso
|
||||
* @param t DOM to create lookup element for.
|
||||
* @return Lookup element.
|
||||
*/
|
||||
@Nullable
|
||||
public LookupElement createLookupElement(T t) {
|
||||
public @Nullable LookupElement createLookupElement(T t) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds {@link #getVariants(ConvertContext)} functionality to a simple String value.
|
||||
*/
|
||||
public static abstract class StringConverter extends ResolvingConverter<String> {
|
||||
public abstract static class StringConverter extends ResolvingConverter<String> {
|
||||
|
||||
@Override
|
||||
public String fromString(final String s, final ConvertContext context) {
|
||||
@@ -170,7 +150,7 @@ public abstract class ResolvingConverter<T> extends Converter<T> implements Reso
|
||||
/**
|
||||
* Adds {@link #getVariants(ConvertContext)} functionality to an existing converter.
|
||||
*/
|
||||
public static abstract class WrappedResolvingConverter<T> extends ResolvingConverter<T> {
|
||||
public abstract static class WrappedResolvingConverter<T> extends ResolvingConverter<T> {
|
||||
|
||||
private final Converter<T> myWrappedConverter;
|
||||
|
||||
@@ -196,8 +176,7 @@ public abstract class ResolvingConverter<T> extends Converter<T> implements Reso
|
||||
@Deprecated
|
||||
public static final ResolvingConverter EMPTY_CONVERTER = new ResolvingConverter() {
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection getVariants(final ConvertContext context) {
|
||||
public @NotNull Collection getVariants(final ConvertContext context) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -234,8 +213,7 @@ public abstract class ResolvingConverter<T> extends Converter<T> implements Reso
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<? extends Boolean> getVariants(final ConvertContext context) {
|
||||
public @NotNull Collection<? extends Boolean> getVariants(final ConvertContext context) {
|
||||
final DomElement element = context.getInvocationElement();
|
||||
if (element instanceof GenericDomValue) {
|
||||
final SubTag annotation = element.getAnnotation(SubTag.class);
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -31,7 +17,6 @@ public abstract class ScopeProvider {
|
||||
* Basically it's parameter element's parent: {@link ParentScopeProvider}.
|
||||
* Searches within all children of returned element.
|
||||
*/
|
||||
@Nullable
|
||||
public abstract DomElement getScope(@NotNull DomElement element);
|
||||
public abstract @Nullable DomElement getScope(@NotNull DomElement element);
|
||||
|
||||
}
|
||||
|
||||
@@ -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 com.intellij.util.xml;
|
||||
|
||||
@@ -21,7 +7,6 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -57,14 +42,12 @@ public abstract class WrappingConverter extends Converter<Object> {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<Converter> getConverters(@NotNull final GenericDomValue domElement) {
|
||||
public @NotNull List<Converter> getConverters(final @NotNull GenericDomValue domElement) {
|
||||
final Converter converter = getConverter(domElement);
|
||||
return ContainerUtil.createMaybeSingletonList(converter);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public abstract Converter getConverter(@NotNull final GenericDomValue domElement);
|
||||
public abstract @Nullable Converter getConverter(final @NotNull GenericDomValue domElement);
|
||||
|
||||
public static Converter getDeepestConverter(final Converter converter, final GenericDomValue domValue) {
|
||||
Converter cur = converter;
|
||||
|
||||
@@ -1,36 +1,35 @@
|
||||
// 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.util.xml;
|
||||
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import java.util.Objects;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class XmlName implements Comparable<XmlName> {
|
||||
private final String myLocalName;
|
||||
private final String myNamespaceKey;
|
||||
|
||||
private final int myHashCode;
|
||||
|
||||
public XmlName(@NotNull @NonNls final String localName) {
|
||||
public XmlName(final @NotNull @NonNls String localName) {
|
||||
this(localName, null);
|
||||
}
|
||||
|
||||
public XmlName(@NotNull @NonNls final String localName, @Nullable final String namespaceKey) {
|
||||
public XmlName(final @NotNull @NonNls String localName, final @Nullable String namespaceKey) {
|
||||
myLocalName = localName;
|
||||
myNamespaceKey = namespaceKey;
|
||||
|
||||
myHashCode = 31 * myLocalName.hashCode() + (myNamespaceKey != null ? myNamespaceKey.hashCode() : 0);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public final String getLocalName() {
|
||||
public final @NotNull String getLocalName() {
|
||||
return myLocalName;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public final String getNamespaceKey() {
|
||||
public final @Nullable String getNamespaceKey() {
|
||||
return myNamespaceKey;
|
||||
}
|
||||
|
||||
|
||||
+7
-10
@@ -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 com.intellij.util.xml.actions.generate;
|
||||
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
@@ -23,13 +23,13 @@ import java.util.Map;
|
||||
public abstract class AbstractDomGenerateProvider<T extends DomElement> extends DefaultGenerateElementProvider<T> {
|
||||
public static final String NAMESPACE_PREFIX_VAR = "NS_PREFIX";
|
||||
|
||||
@Nullable private final String myMappingId;
|
||||
private final @Nullable String myMappingId;
|
||||
|
||||
/**
|
||||
* @deprecated Provide both action description and text, as they have different capitalization rules.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public AbstractDomGenerateProvider(@Nls final String description, final Class<T> aClass) {
|
||||
public AbstractDomGenerateProvider(final @Nls String description, final Class<T> aClass) {
|
||||
this(description, aClass, null);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public abstract class AbstractDomGenerateProvider<T extends DomElement> extends
|
||||
* @deprecated Provide both action description and text, as they have different capitalization rules.
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public AbstractDomGenerateProvider(@Nls final String description, final Class<T> aClass, @Nullable String mappingId) {
|
||||
public AbstractDomGenerateProvider(final @Nls String description, final Class<T> aClass, @Nullable String mappingId) {
|
||||
this(description, description, aClass, mappingId);
|
||||
}
|
||||
|
||||
@@ -68,8 +68,7 @@ public abstract class AbstractDomGenerateProvider<T extends DomElement> extends
|
||||
return createNamespacePrefixMap(parentDomElement);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static Map<String, String> createNamespacePrefixMap(@Nullable DomElement domElement) {
|
||||
public static @NotNull Map<String, String> createNamespacePrefixMap(@Nullable DomElement domElement) {
|
||||
Map<String, String> vars = new HashMap<>();
|
||||
|
||||
addNamespacePrefix(domElement, vars);
|
||||
@@ -105,8 +104,7 @@ public abstract class AbstractDomGenerateProvider<T extends DomElement> extends
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected DomElement getElementToNavigate(final T t) {
|
||||
protected @Nullable DomElement getElementToNavigate(final T t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
@@ -114,8 +112,7 @@ public abstract class AbstractDomGenerateProvider<T extends DomElement> extends
|
||||
return StringUtil.join(Arrays.asList(NameUtilCore.nameToWords(aClass.getSimpleName())), " ");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getMappingId() {
|
||||
public @Nullable String getMappingId() {
|
||||
return myMappingId;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-7
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml.actions.generate;
|
||||
|
||||
@@ -33,17 +33,14 @@ public abstract class DefaultGenerateElementProvider<T extends DomElement> exten
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T generate(final Project project, final Editor editor, final PsiFile file) {
|
||||
public @Nullable T generate(final Project project, final Editor editor, final PsiFile file) {
|
||||
return generate(getParentDomElement(project, editor, file), editor);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract DomElement getParentDomElement(final Project project, final Editor editor, final PsiFile file);
|
||||
protected abstract @Nullable DomElement getParentDomElement(final Project project, final Editor editor, final PsiFile file);
|
||||
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@Nullable
|
||||
public T generate(@Nullable final DomElement parent, final Editor editor) {
|
||||
public @Nullable T generate(final @Nullable DomElement parent, final Editor editor) {
|
||||
if (parent == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -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 com.intellij.util.xml.converters;
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.*;
|
||||
|
||||
public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<T>> implements CustomReferenceConverter<List<T>> {
|
||||
|
||||
protected final static Object[] EMPTY_ARRAY = ArrayUtilRt.EMPTY_OBJECT_ARRAY;
|
||||
protected static final Object[] EMPTY_ARRAY = ArrayUtilRt.EMPTY_OBJECT_ARRAY;
|
||||
|
||||
private final String myDelimiters;
|
||||
|
||||
@@ -33,24 +33,19 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
|
||||
myDelimiters = delimiters;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract T convertString(final @Nullable String string, final ConvertContext context);
|
||||
protected abstract @Nullable T convertString(final @Nullable String string, final ConvertContext context);
|
||||
|
||||
@Nullable
|
||||
protected abstract String toString(@Nullable final T t);
|
||||
protected abstract @Nullable String toString(final @Nullable T t);
|
||||
|
||||
|
||||
protected abstract Object[] getReferenceVariants(final ConvertContext context, GenericDomValue<? extends List<T>> genericDomValue);
|
||||
|
||||
@Nullable
|
||||
protected abstract PsiElement resolveReference(@Nullable final T t, final ConvertContext context);
|
||||
protected abstract @Nullable PsiElement resolveReference(final @Nullable T t, final ConvertContext context);
|
||||
|
||||
@InspectionMessage
|
||||
protected abstract String getUnresolvedMessage(String value);
|
||||
protected abstract @InspectionMessage String getUnresolvedMessage(String value);
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<? extends List<T>> getVariants(final ConvertContext context) {
|
||||
public @NotNull Collection<? extends List<T>> getVariants(final ConvertContext context) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -74,7 +69,7 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> fromString(@Nullable final String str, final ConvertContext context) {
|
||||
public List<T> fromString(final @Nullable String str, final ConvertContext context) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -125,13 +120,12 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
|
||||
return references.toArray(PsiReference.EMPTY_ARRAY);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PsiReference createPsiReference(final PsiElement element,
|
||||
int start,
|
||||
int end,
|
||||
final ConvertContext context,
|
||||
final GenericDomValue<List<T>> genericDomValue,
|
||||
final boolean delimitersOnly) {
|
||||
protected @NotNull PsiReference createPsiReference(final PsiElement element,
|
||||
int start,
|
||||
int end,
|
||||
final ConvertContext context,
|
||||
final GenericDomValue<List<T>> genericDomValue,
|
||||
final boolean delimitersOnly) {
|
||||
|
||||
return new MyPsiReference(element, getTextRange(genericDomValue, start, end), context, genericDomValue, delimitersOnly);
|
||||
}
|
||||
@@ -175,8 +169,7 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public PsiElement resolve() {
|
||||
public @Nullable PsiElement resolve() {
|
||||
if (myDelimitersOnly) {
|
||||
return getElement();
|
||||
}
|
||||
@@ -190,7 +183,7 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement handleElementRename(@NotNull final String newElementName) throws IncorrectOperationException {
|
||||
public PsiElement handleElementRename(final @NotNull String newElementName) throws IncorrectOperationException {
|
||||
final Ref<IncorrectOperationException> ref = new Ref<>();
|
||||
PsiElement element = referenceHandleElementRename(this, newElementName, getSuperElementRenameFunction(ref));
|
||||
if (!ref.isNull()) {
|
||||
@@ -201,7 +194,7 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
|
||||
}
|
||||
|
||||
@Override
|
||||
public PsiElement bindToElement(@NotNull final PsiElement element) throws IncorrectOperationException {
|
||||
public PsiElement bindToElement(final @NotNull PsiElement element) throws IncorrectOperationException {
|
||||
final Ref<IncorrectOperationException> ref = new Ref<>();
|
||||
PsiElement bindElement =
|
||||
referenceBindToElement(this, element, getSuperBindToElementFunction(ref), getSuperElementRenameFunction(ref));
|
||||
@@ -243,8 +236,7 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
|
||||
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getUnresolvedMessagePattern() {
|
||||
public @NotNull String getUnresolvedMessagePattern() {
|
||||
return getUnresolvedMessage(getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 com.intellij.util.xml.converters;
|
||||
|
||||
@@ -32,10 +18,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class PathReferenceConverter extends Converter<PathReference> implements CustomReferenceConverter {
|
||||
public final static Converter<PathReference> INSTANCE = new PathReferenceConverter();
|
||||
public static final Converter<PathReference> INSTANCE = new PathReferenceConverter();
|
||||
|
||||
@Override
|
||||
public PathReference fromString(@Nullable final String s, final ConvertContext context) {
|
||||
public PathReference fromString(final @Nullable String s, final ConvertContext context) {
|
||||
final XmlElement element = context.getXmlElement();
|
||||
return s == null || element == null ? null : PathReferenceManager.getInstance().getPathReference(s, element);
|
||||
}
|
||||
@@ -50,7 +36,7 @@ public class PathReferenceConverter extends Converter<PathReference> implements
|
||||
return createReferences(element, true);
|
||||
}
|
||||
|
||||
public PsiReference @NotNull [] createReferences(@NotNull final PsiElement psiElement, final boolean soft) {
|
||||
public PsiReference @NotNull [] createReferences(final @NotNull PsiElement psiElement, final boolean soft) {
|
||||
return PathReferenceManager.getInstance().createReferences(psiElement, soft);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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 com.intellij.util.xml.converters;
|
||||
|
||||
@@ -41,22 +27,19 @@ public abstract class QuotedValueConverter<T> extends ResolvingConverter<T> impl
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract T convertString(@Nullable final String string, final ConvertContext context);
|
||||
protected abstract @Nullable T convertString(final @Nullable String string, final ConvertContext context);
|
||||
|
||||
@Nullable
|
||||
protected abstract String convertValue(@Nullable final T t, final ConvertContext context);
|
||||
protected abstract @Nullable String convertValue(final @Nullable T t, final ConvertContext context);
|
||||
|
||||
protected abstract Object[] getReferenceVariants(final ConvertContext context, GenericDomValue<T> genericDomValue,
|
||||
final TextRange rangeInElement);
|
||||
|
||||
protected abstract ResolveResult @NotNull [] multiResolveReference(@Nullable final T t, final ConvertContext context);
|
||||
protected abstract ResolveResult @NotNull [] multiResolveReference(final @Nullable T t, final ConvertContext context);
|
||||
|
||||
protected abstract @InspectionMessage String getUnresolvedMessage(String value);
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<? extends T> getVariants(final ConvertContext context) {
|
||||
public @NotNull Collection<? extends T> getVariants(final ConvertContext context) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@@ -88,8 +71,7 @@ public abstract class QuotedValueConverter<T> extends ResolvingConverter<T> impl
|
||||
return new PsiReference[]{createPsiReference(element, start, end, true, context, genericDomValue, unclosedQuotation)};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String unquote(final String str) {
|
||||
public static @Nullable String unquote(final String str) {
|
||||
return unquote(str, QUOTE_SIGNS);
|
||||
}
|
||||
|
||||
@@ -110,13 +92,12 @@ public abstract class QuotedValueConverter<T> extends ResolvingConverter<T> impl
|
||||
return StringUtil.isNotEmpty(str) && str.charAt(0) != str.charAt(str.length()-1);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected PsiReference createPsiReference(final PsiElement element,
|
||||
int start, int end,
|
||||
final boolean isSoft,
|
||||
final ConvertContext context,
|
||||
final GenericDomValue<T> genericDomValue,
|
||||
final boolean badQuotation) {
|
||||
protected @NotNull PsiReference createPsiReference(final PsiElement element,
|
||||
int start, int end,
|
||||
final boolean isSoft,
|
||||
final ConvertContext context,
|
||||
final GenericDomValue<T> genericDomValue,
|
||||
final boolean badQuotation) {
|
||||
|
||||
return new MyPsiReference(element, new TextRange(start, end), isSoft, context, genericDomValue, badQuotation);
|
||||
}
|
||||
@@ -148,8 +129,7 @@ public abstract class QuotedValueConverter<T> extends ResolvingConverter<T> impl
|
||||
|
||||
@SuppressWarnings("UnresolvedPropertyKey")
|
||||
@Override
|
||||
@NotNull
|
||||
public String getUnresolvedMessagePattern() {
|
||||
public @NotNull String getUnresolvedMessagePattern() {
|
||||
return myBadQuotation ? XmlDomBundle.message("dom.inspections.invalid.value.quotation") : getUnresolvedMessage(getValue());
|
||||
}
|
||||
}
|
||||
|
||||
+10
-28
@@ -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 com.intellij.util.xml.converters.values;
|
||||
|
||||
@@ -28,9 +14,9 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
public class BooleanValueConverter extends ResolvingConverter<String> {
|
||||
@NonNls private static final String BOOLEAN = "boolean";
|
||||
private static final @NonNls String BOOLEAN = "boolean";
|
||||
|
||||
@NonNls private static final String[] VARIANTS = {"false", "true"};
|
||||
private static final @NonNls String[] VARIANTS = {"false", "true"};
|
||||
|
||||
private final boolean myAllowEmpty;
|
||||
|
||||
@@ -46,8 +32,7 @@ public class BooleanValueConverter extends ResolvingConverter<String> {
|
||||
myAllowEmpty = allowEmpty;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public String[] getAllValues() {
|
||||
public @NonNls String[] getAllValues() {
|
||||
final String[] strings = ArrayUtil.mergeArrays(getTrueValues(), getFalseValues());
|
||||
|
||||
Arrays.sort(strings);
|
||||
@@ -55,13 +40,11 @@ public class BooleanValueConverter extends ResolvingConverter<String> {
|
||||
return strings;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public String[] getTrueValues() {
|
||||
public @NonNls String[] getTrueValues() {
|
||||
return new String[] {"true"};
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public String[] getFalseValues() {
|
||||
public @NonNls String[] getFalseValues() {
|
||||
return new String[] {"false"};
|
||||
}
|
||||
|
||||
@@ -70,7 +53,7 @@ public class BooleanValueConverter extends ResolvingConverter<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String fromString(@Nullable @NonNls final String stringValue, final ConvertContext context) {
|
||||
public String fromString(final @Nullable @NonNls String stringValue, final ConvertContext context) {
|
||||
if (stringValue != null && ((myAllowEmpty && stringValue.trim().length() == 0) || Arrays.binarySearch(getAllValues(), stringValue) >= 0)) {
|
||||
return stringValue;
|
||||
}
|
||||
@@ -78,18 +61,17 @@ public class BooleanValueConverter extends ResolvingConverter<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(@Nullable final String s, final ConvertContext context) {
|
||||
public String toString(final @Nullable String s, final ConvertContext context) {
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Collection<String> getVariants(final ConvertContext context) {
|
||||
public @NotNull Collection<String> getVariants(final ConvertContext context) {
|
||||
return Arrays.asList(VARIANTS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(@Nullable final String s, final ConvertContext context) {
|
||||
public String getErrorMessage(final @Nullable String s, final ConvertContext context) {
|
||||
return XmlDomBundle.message("dom.converter.format.exception", s, BOOLEAN);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-17
@@ -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 com.intellij.util.xml.converters.values;
|
||||
|
||||
import com.intellij.util.xml.ConvertContext;
|
||||
@@ -22,7 +8,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class CharacterValueConverter extends Converter<String> {
|
||||
@NonNls private static final String UNICODE_PREFIX = "\\u";
|
||||
private static final @NonNls String UNICODE_PREFIX = "\\u";
|
||||
private static final int UNICODE_LENGTH = 6;
|
||||
private final boolean myAllowEmpty;
|
||||
|
||||
@@ -59,7 +45,7 @@ public class CharacterValueConverter extends Converter<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(@Nullable final String s, final ConvertContext context) {
|
||||
public String getErrorMessage(final @Nullable String s, final ConvertContext context) {
|
||||
return XmlDomBundle.message("dom.converter.format.exception", s, "char");
|
||||
}
|
||||
}
|
||||
|
||||
+8
-25
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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 com.intellij.util.xml.converters.values;
|
||||
|
||||
@@ -33,13 +19,13 @@ public class NumberValueConverter<T extends Number> extends ResolvingConverter<T
|
||||
private final Class myNumberClass;
|
||||
private final boolean myAllowEmpty;
|
||||
|
||||
public NumberValueConverter(@NotNull final Class<T> numberClass, final boolean allowEmpty) {
|
||||
public NumberValueConverter(final @NotNull Class<T> numberClass, final boolean allowEmpty) {
|
||||
myNumberClass = numberClass;
|
||||
myAllowEmpty = allowEmpty;
|
||||
}
|
||||
|
||||
@Override
|
||||
public T fromString(@Nullable @NonNls final String s, final ConvertContext context) {
|
||||
public T fromString(final @Nullable @NonNls String s, final ConvertContext context) {
|
||||
if (s == null) return null;
|
||||
|
||||
if (myAllowEmpty && s.trim().length() == 0) {
|
||||
@@ -51,12 +37,12 @@ public class NumberValueConverter<T extends Number> extends ResolvingConverter<T
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(@Nullable final T value, final ConvertContext context) {
|
||||
public String toString(final @Nullable T value, final ConvertContext context) {
|
||||
return value == null ? null : parseText(value, myNumberClass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getErrorMessage(@Nullable final String s, final ConvertContext context) {
|
||||
public String getErrorMessage(final @Nullable String s, final ConvertContext context) {
|
||||
if (s == null) return super.getErrorMessage(null, context);
|
||||
|
||||
final boolean isEmpty = s.trim().length() == 0;
|
||||
@@ -67,14 +53,12 @@ public class NumberValueConverter<T extends Number> extends ResolvingConverter<T
|
||||
XmlDomBundle.message("dom.converter.format.exception", s, myNumberClass.getName());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public Collection<? extends T> getVariants(ConvertContext context) {
|
||||
public @NotNull Collection<? extends T> getVariants(ConvertContext context) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String parseText(@NotNull Number value, @NotNull Class targetClass) {
|
||||
public static @Nullable String parseText(@NotNull Number value, @NotNull Class targetClass) {
|
||||
if (targetClass.equals(Byte.class) || targetClass.equals(byte.class)) {
|
||||
return Byte.toString((Byte)value);
|
||||
}
|
||||
@@ -102,8 +86,7 @@ public class NumberValueConverter<T extends Number> extends ResolvingConverter<T
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Number parseNumber(@NotNull String text, @NotNull Class targetClass) {
|
||||
public static @Nullable Number parseNumber(@NotNull String text, @NotNull Class targetClass) {
|
||||
try {
|
||||
String trimmed = text.trim();
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml.events;
|
||||
|
||||
import com.intellij.util.xml.DomElement;
|
||||
@@ -25,7 +11,7 @@ public class DomEvent {
|
||||
private final DomElement myElement;
|
||||
private final boolean myDefined;
|
||||
|
||||
public DomEvent(@NotNull final DomElement element, boolean defined) {
|
||||
public DomEvent(final @NotNull DomElement element, boolean defined) {
|
||||
myDefined = defined;
|
||||
myElement = DomUtil.getFileElement(element);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 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 com.intellij.util.xml.highlighting;
|
||||
|
||||
@@ -51,13 +37,11 @@ public class AddDomElementQuickFix<T extends DomElement> implements LocalQuickFi
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@IntentionName
|
||||
private String computeName() {
|
||||
private @IntentionName String computeName() {
|
||||
final String name = myElement.getXmlElementName();
|
||||
return XmlDomBundle.message(isTag() ? "dom.quickfix.add.element.name" : "dom.quickfix.add.attribute.name", name);
|
||||
}
|
||||
@@ -67,8 +51,7 @@ public class AddDomElementQuickFix<T extends DomElement> implements LocalQuickFi
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return XmlDomBundle.message("dom.quickfix.add.element.family");
|
||||
}
|
||||
|
||||
|
||||
+2
-17
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml.highlighting;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
@@ -29,8 +15,7 @@ import java.util.List;
|
||||
public abstract class DomCustomAnnotationChecker<T extends Annotation> {
|
||||
static final ExtensionPointName<DomCustomAnnotationChecker> EP_NAME = ExtensionPointName.create("com.intellij.dom.customAnnotationChecker");
|
||||
|
||||
@NotNull
|
||||
public abstract Class<T> getAnnotationClass();
|
||||
public abstract @NotNull Class<T> getAnnotationClass();
|
||||
|
||||
public abstract List<DomElementProblemDescriptor> checkForProblems(@NotNull T t, @NotNull DomElement element, @NotNull DomElementAnnotationHolder holder, @NotNull DomHighlightingHelper helper);
|
||||
}
|
||||
|
||||
+4
-7
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 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.util.xml.highlighting;
|
||||
|
||||
@@ -19,11 +19,9 @@ public abstract class DomElementAnnotationsManager {
|
||||
return project.getService(DomElementAnnotationsManager.class);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public abstract DomElementsProblemsHolder getProblemHolder(DomElement element);
|
||||
public abstract @NotNull DomElementsProblemsHolder getProblemHolder(DomElement element);
|
||||
|
||||
@NotNull
|
||||
public abstract DomElementsProblemsHolder getCachedProblemHolder(DomElement element);
|
||||
public abstract @NotNull DomElementsProblemsHolder getCachedProblemHolder(DomElement element);
|
||||
|
||||
public abstract List<ProblemDescriptor> createProblemDescriptors(final InspectionManager manager, DomElementProblemDescriptor problemDescriptor);
|
||||
|
||||
@@ -42,8 +40,7 @@ public abstract class DomElementAnnotationsManager {
|
||||
* @param inspection inspection to run on the given file element
|
||||
* @return collected DOM problem descriptors
|
||||
*/
|
||||
@NotNull
|
||||
public abstract <T extends DomElement> List<DomElementProblemDescriptor> checkFileElement(@NotNull DomFileElement<T> element,
|
||||
public abstract @NotNull <T extends DomElement> List<DomElementProblemDescriptor> checkFileElement(@NotNull DomFileElement<T> element,
|
||||
@NotNull DomElementsInspection<T> inspection,
|
||||
boolean onTheFly);
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml.highlighting;
|
||||
|
||||
@@ -99,8 +85,7 @@ public abstract class DomElementsInspection<T extends DomElement> extends XmlSup
|
||||
/**
|
||||
* @return the classes passed earlier to the constructor
|
||||
*/
|
||||
@NotNull
|
||||
public final Set<Class<? extends T>> getDomClasses() {
|
||||
public final @NotNull Set<Class<? extends T>> getDomClasses() {
|
||||
return myDomClasses;
|
||||
}
|
||||
|
||||
@@ -124,8 +109,7 @@ public abstract class DomElementsInspection<T extends DomElement> extends XmlSup
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public HighlightDisplayLevel getDefaultLevel() {
|
||||
public @NotNull HighlightDisplayLevel getDefaultLevel() {
|
||||
return HighlightDisplayLevel.ERROR;
|
||||
}
|
||||
|
||||
@@ -137,8 +121,8 @@ public abstract class DomElementsInspection<T extends DomElement> extends XmlSup
|
||||
/**
|
||||
* not intended to be overridden or called by implementors
|
||||
*/
|
||||
protected ProblemDescriptor @Nullable [] checkDomFile(@NotNull final DomFileElement<T> domFileElement,
|
||||
@NotNull final InspectionManager manager,
|
||||
protected ProblemDescriptor @Nullable [] checkDomFile(final @NotNull DomFileElement<T> domFileElement,
|
||||
final @NotNull InspectionManager manager,
|
||||
final boolean isOnTheFly) {
|
||||
final DomElementAnnotationsManager annotationsManager = DomElementAnnotationsManager.getInstance(manager.getProject());
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// 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.
|
||||
// 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.util.xml.highlighting;
|
||||
|
||||
import com.intellij.util.SmartList;
|
||||
@@ -12,14 +12,11 @@ import java.util.List;
|
||||
|
||||
public abstract class DomHighlightingHelper {
|
||||
|
||||
@NotNull
|
||||
public abstract List<DomElementProblemDescriptor> checkRequired(DomElement element, DomElementAnnotationHolder holder);
|
||||
public abstract @NotNull List<DomElementProblemDescriptor> checkRequired(DomElement element, DomElementAnnotationHolder holder);
|
||||
|
||||
@NotNull
|
||||
public abstract List<DomElementProblemDescriptor> checkResolveProblems(GenericDomValue element, DomElementAnnotationHolder holder);
|
||||
public abstract @NotNull List<DomElementProblemDescriptor> checkResolveProblems(GenericDomValue element, DomElementAnnotationHolder holder);
|
||||
|
||||
@NotNull
|
||||
public abstract List<DomElementProblemDescriptor> checkNameIdentity(DomElement element, DomElementAnnotationHolder holder);
|
||||
public abstract @NotNull List<DomElementProblemDescriptor> checkNameIdentity(DomElement element, DomElementAnnotationHolder holder);
|
||||
|
||||
public abstract void runAnnotators(DomElement element, DomElementAnnotationHolder holder, @NotNull Class<? extends DomElement> rootClass);
|
||||
|
||||
@@ -30,8 +27,7 @@ public abstract class DomHighlightingHelper {
|
||||
* @param holder Holder instance.
|
||||
* @return Collected problem descriptors.
|
||||
*/
|
||||
@NotNull
|
||||
public List<DomElementProblemDescriptor> checkCustomAnnotations(final DomElement element, final DomElementAnnotationHolder holder) {
|
||||
public @NotNull List<DomElementProblemDescriptor> checkCustomAnnotations(final DomElement element, final DomElementAnnotationHolder holder) {
|
||||
List<DomElementProblemDescriptor> result = null;
|
||||
for (DomCustomAnnotationChecker<?> checker : DomCustomAnnotationChecker.EP_NAME.getExtensionList()) {
|
||||
final List<DomElementProblemDescriptor> list = checkAnno(element, checker, holder);
|
||||
|
||||
+3
-19
@@ -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 com.intellij.util.xml.highlighting;
|
||||
|
||||
@@ -40,14 +26,12 @@ public class RemoveDomElementQuickFix implements LocalQuickFix {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return XmlDomBundle.message(myIsTag ? "dom.quickfix.remove.element.name" : "dom.quickfix.remove.attribute.name", myName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return XmlDomBundle.message("dom.quickfix.remove.element.family");
|
||||
}
|
||||
|
||||
|
||||
+11
-32
@@ -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 com.intellij.util.xml.highlighting;
|
||||
|
||||
@@ -64,30 +50,27 @@ public class ResolvingElementQuickFix implements LocalQuickFix, IntentionAction
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getName() {
|
||||
public @NotNull String getName() {
|
||||
return XmlDomBundle.message("dom.quickfix.create.new.element.name", myTypeName, myNewName);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getText() {
|
||||
public @NotNull String getText() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
public @NotNull String getFamilyName() {
|
||||
return XmlDomBundle.message("dom.quickfix.create.new.element.family");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull final Project project, final Editor editor, final PsiFile file) {
|
||||
public boolean isAvailable(final @NotNull Project project, final Editor editor, final PsiFile file) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
|
||||
public void invoke(final @NotNull Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException {
|
||||
applyFix();
|
||||
}
|
||||
|
||||
@@ -97,7 +80,7 @@ public class ResolvingElementQuickFix implements LocalQuickFix, IntentionAction
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
|
||||
public void applyFix(final @NotNull Project project, final @NotNull ProblemDescriptor descriptor) {
|
||||
applyFix();
|
||||
}
|
||||
|
||||
@@ -132,16 +115,14 @@ public class ResolvingElementQuickFix implements LocalQuickFix, IntentionAction
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getTextFor(final DomElement value) {
|
||||
public @NotNull String getTextFor(final DomElement value) {
|
||||
return DomUtil.getFile(value).getName();
|
||||
}
|
||||
}).showInBestPositionFor(DataManager.getInstance().getDataContext());
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static <T extends DomElement> DomCollectionChildDescription getChildDescription(final List<? extends DomElement> contexts, Class<T> clazz) {
|
||||
public static @Nullable <T extends DomElement> DomCollectionChildDescription getChildDescription(final List<? extends DomElement> contexts, Class<T> clazz) {
|
||||
|
||||
if (contexts.size() == 0) {
|
||||
return null;
|
||||
@@ -158,14 +139,12 @@ public class ResolvingElementQuickFix implements LocalQuickFix, IntentionAction
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ResolvingElementQuickFix createFix(final String newName, final Class<? extends DomElement> clazz, final DomElement scope) {
|
||||
public static @Nullable ResolvingElementQuickFix createFix(final String newName, final Class<? extends DomElement> clazz, final DomElement scope) {
|
||||
final List<DomElement> parents = ModelMergerUtil.getImplementations(scope);
|
||||
return createFix(newName, clazz, parents);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ResolvingElementQuickFix createFix(final String newName, final Class<? extends DomElement> clazz, final List<? extends DomElement> parents) {
|
||||
public static @Nullable ResolvingElementQuickFix createFix(final String newName, final Class<? extends DomElement> clazz, final List<? extends DomElement> parents) {
|
||||
final DomCollectionChildDescription childDescription = getChildDescription(parents, clazz);
|
||||
if (newName.length() > 0 && childDescription != null) {
|
||||
return new ResolvingElementQuickFix(clazz, newName, parents, childDescription);
|
||||
|
||||
@@ -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 com.intellij.util.xml.model.impl;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -43,8 +29,7 @@ public abstract class BaseDomModelFactory<S extends UserDataHolder, T extends Do
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public M getModel(@NotNull C context){
|
||||
public @Nullable M getModel(@NotNull C context){
|
||||
final PsiFile psiFile = context.getContainingFile();
|
||||
if (psiFile instanceof XmlFile) {
|
||||
return getModelByConfigFile((XmlFile)psiFile);
|
||||
@@ -52,8 +37,7 @@ public abstract class BaseDomModelFactory<S extends UserDataHolder, T extends Do
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected M computeModel(@NotNull XmlFile psiFile, @Nullable S scope) {
|
||||
protected @Nullable M computeModel(@NotNull XmlFile psiFile, @Nullable S scope) {
|
||||
if (scope == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -67,9 +51,8 @@ public abstract class BaseDomModelFactory<S extends UserDataHolder, T extends Do
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public M getModelByConfigFile(@Nullable XmlFile file) {
|
||||
public @Nullable M getModelByConfigFile(@Nullable XmlFile file) {
|
||||
if (file == null) return null;
|
||||
final XmlFile originalFile = (XmlFile)file.getOriginalFile();
|
||||
final S scope = getModelScope(originalFile);
|
||||
@@ -87,8 +70,7 @@ public abstract class BaseDomModelFactory<S extends UserDataHolder, T extends Do
|
||||
|
||||
protected abstract S getModelScope(final XmlFile file);
|
||||
|
||||
@Nullable
|
||||
protected abstract List<M> computeAllModels(@NotNull S scope);
|
||||
protected abstract @Nullable List<M> computeAllModels(@NotNull S scope);
|
||||
|
||||
protected abstract M createCombinedModel(Set<XmlFile> configFiles, DomFileElement<T> mergedModel, M firstModel, final S scope);
|
||||
|
||||
@@ -108,9 +90,8 @@ public abstract class BaseDomModelFactory<S extends UserDataHolder, T extends Do
|
||||
return xmlFiles;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public M getCombinedModel(@Nullable S s) {
|
||||
public @Nullable M getCombinedModel(@Nullable S s) {
|
||||
if (s == null) return null;
|
||||
final List<M> models = getAllModels(s);
|
||||
return switch (models.size()) {
|
||||
|
||||
@@ -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 com.intellij.util.xml.model.impl;
|
||||
|
||||
@@ -31,8 +31,7 @@ public abstract class DomModelFactory<T extends DomElement, M extends DomModel<T
|
||||
return ModuleUtilCore.findModuleForPsiElement(file);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Set<XmlFile> getConfigFiles(@Nullable C context) {
|
||||
public @NotNull Set<XmlFile> getConfigFiles(@Nullable C context) {
|
||||
if (context == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml.model.impl;
|
||||
|
||||
import com.intellij.util.xml.ModelMerger;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomFileElement;
|
||||
import com.intellij.util.xml.DomManager;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.util.xml.ModelMerger;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -32,14 +18,12 @@ public class DomModelFactoryHelper<T extends DomElement> {
|
||||
myModelMerger = modelMerger;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public T getDom(@NotNull XmlFile configFile) {
|
||||
public @Nullable T getDom(@NotNull XmlFile configFile) {
|
||||
final DomFileElement<T> element = getDomRoot(configFile);
|
||||
return element == null ? null : element.getRootElement();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DomFileElement<T> getDomRoot(@NotNull XmlFile configFile) {
|
||||
public @Nullable DomFileElement<T> getDomRoot(@NotNull XmlFile configFile) {
|
||||
return DomManager.getDomManager(configFile.getProject()).getFileElement(configFile, myClass);
|
||||
}
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml.model.impl;
|
||||
|
||||
@@ -51,8 +37,7 @@ public class DomModelImpl<T extends DomElement> implements DomModel<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public T getMergedModel() {
|
||||
public @NotNull T getMergedModel() {
|
||||
if (myMergedModel == null) {
|
||||
final DomManager domManager = DomManager.getDomManager(myProject);
|
||||
return domManager.createModelMerger().mergeModels(myClass, ContainerUtil.mapNotNull(myConfigFiles,
|
||||
@@ -65,22 +50,19 @@ public class DomModelImpl<T extends DomElement> implements DomModel<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public Set<XmlFile> getConfigFiles() {
|
||||
public @NotNull Set<XmlFile> getConfigFiles() {
|
||||
return myConfigFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public List<DomFileElement<T>> getRoots() {
|
||||
public @NotNull List<DomFileElement<T>> getRoots() {
|
||||
if (myMergedModel == null) {
|
||||
return ContainerUtil.mapNotNull(myConfigFiles, (NullableFunction<XmlFile, DomFileElement<T>>)xmlFile -> DomManager.getDomManager(xmlFile.getProject()).getFileElement(xmlFile, myClass));
|
||||
}
|
||||
return myMergedModel instanceof MergedObject ? ((MergedObject) myMergedModel).getImplementations() : Collections.singletonList(myMergedModel);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Project getProject() {
|
||||
public @NotNull Project getProject() {
|
||||
return myProject;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-19
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml.reflect;
|
||||
|
||||
@@ -39,13 +25,11 @@ public interface CustomDomChildrenDescription extends AbstractDomChildrenDescrip
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PomTarget findDeclaration(DomElement parent, @NotNull EvaluatedXmlName name) {
|
||||
public @Nullable PomTarget findDeclaration(DomElement parent, @NotNull EvaluatedXmlName name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public PomTarget findDeclaration(@NotNull DomElement child) {
|
||||
public @Nullable PomTarget findDeclaration(@NotNull DomElement child) {
|
||||
return child.getChildDescription();
|
||||
}
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml.reflect;
|
||||
|
||||
import com.intellij.util.xml.DomElement;
|
||||
@@ -19,7 +19,7 @@ public abstract class DomExtender<T extends DomElement> {
|
||||
* @param t DOM element where new children may be added to
|
||||
* @param registrar a place to register your own DOM children descriptions
|
||||
*/
|
||||
public abstract void registerExtensions(@NotNull T t, @NotNull final DomExtensionsRegistrar registrar);
|
||||
public abstract void registerExtensions(@NotNull T t, final @NotNull DomExtensionsRegistrar registrar);
|
||||
|
||||
/**
|
||||
* Makes stub building for extensions available.
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.util.xml.reflect;
|
||||
|
||||
@@ -50,19 +36,19 @@ public interface DomExtensionsRegistrar {
|
||||
* @return dom extension object
|
||||
*/
|
||||
@NotNull
|
||||
DomExtension registerAttributeChildExtension(@NotNull XmlName name, @NotNull final Type type);
|
||||
DomExtension registerAttributeChildExtension(@NotNull XmlName name, final @NotNull Type type);
|
||||
|
||||
/**
|
||||
* @see com.intellij.util.xml.CustomChildren
|
||||
*/
|
||||
@NotNull
|
||||
DomExtension registerCustomChildrenExtension(@NotNull final Type type);
|
||||
DomExtension registerCustomChildrenExtension(final @NotNull Type type);
|
||||
|
||||
@NotNull
|
||||
DomExtension registerCustomChildrenExtension(@NotNull final Type type,
|
||||
DomExtension registerCustomChildrenExtension(final @NotNull Type type,
|
||||
@NotNull CustomDomChildrenDescription.TagNameDescriptor descriptor);
|
||||
|
||||
@NotNull
|
||||
DomExtension registerCustomChildrenExtension(@NotNull final Type type,
|
||||
DomExtension registerCustomChildrenExtension(final @NotNull Type type,
|
||||
@NotNull CustomDomChildrenDescription.AttributeDescriptor attributeDescriptor);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml.ui;
|
||||
|
||||
import com.intellij.codeInspection.util.InspectionMessage;
|
||||
@@ -37,14 +37,14 @@ import java.util.List;
|
||||
|
||||
public abstract class AbstractTableView<T> extends JPanel implements DataProvider {
|
||||
private final MyTableView myTable = new MyTableView();
|
||||
@NonNls private final String myHelpID;
|
||||
@Nls(capitalization = Nls.Capitalization.Sentence) private final String myEmptyPaneText;
|
||||
private final @NonNls String myHelpID;
|
||||
private final @Nls(capitalization = Nls.Capitalization.Sentence) String myEmptyPaneText;
|
||||
private final JPanel myInnerPanel;
|
||||
private final Project myProject;
|
||||
private TableCellRenderer[][] myCachedRenderers;
|
||||
private EmptyPane myEmptyPane;
|
||||
@NonNls private static final String TREE = "Tree";
|
||||
@NonNls private static final String EMPTY_PANE = "EmptyPane";
|
||||
private static final @NonNls String TREE = "Tree";
|
||||
private static final @NonNls String EMPTY_PANE = "EmptyPane";
|
||||
private final EventDispatcher<ChangeListener> myDispatcher = EventDispatcher.create(ChangeListener.class);
|
||||
private final MyListTableModel myTableModel = new MyListTableModel();
|
||||
|
||||
@@ -53,8 +53,8 @@ public abstract class AbstractTableView<T> extends JPanel implements DataProvide
|
||||
}
|
||||
|
||||
public AbstractTableView(final Project project,
|
||||
@Nls(capitalization = Nls.Capitalization.Sentence) @Nullable final String emptyPaneText,
|
||||
@NonNls @Nullable final String helpID) {
|
||||
final @Nls(capitalization = Nls.Capitalization.Sentence) @Nullable String emptyPaneText,
|
||||
final @NonNls @Nullable String helpID) {
|
||||
super(new BorderLayout());
|
||||
myProject = project;
|
||||
myTableModel.setSortable(false);
|
||||
@@ -183,8 +183,7 @@ public abstract class AbstractTableView<T> extends JPanel implements DataProvide
|
||||
return width;
|
||||
}
|
||||
|
||||
@Nls(capitalization = Nls.Capitalization.Sentence)
|
||||
protected String getEmptyPaneText() {
|
||||
protected @Nls(capitalization = Nls.Capitalization.Sentence) String getEmptyPaneText() {
|
||||
return myEmptyPaneText;
|
||||
}
|
||||
|
||||
@@ -210,9 +209,8 @@ public abstract class AbstractTableView<T> extends JPanel implements DataProvide
|
||||
return myTableModel;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
public @Nullable Object getData(@NotNull String dataId) {
|
||||
if (PlatformCoreDataKeys.HELP_ID.is(dataId)) {
|
||||
return getHelpId();
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.openapi.command.WriteCommandAction;
|
||||
@@ -104,8 +90,7 @@ public abstract class BaseControl<Bound extends JComponent, T> extends DomUICont
|
||||
updateComponent();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected JComponent getComponentToListenFocusLost(Bound component) {
|
||||
protected @Nullable JComponent getComponentToListenFocusLost(Bound component) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -243,8 +228,7 @@ public abstract class BaseControl<Bound extends JComponent, T> extends DomUICont
|
||||
public void navigate(DomElement element) {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected abstract T getValue();
|
||||
protected abstract @Nullable T getValue();
|
||||
protected abstract void setValue(T value);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.util.xml.ui;
|
||||
|
||||
@@ -58,7 +44,7 @@ public abstract class BasicDomElementComponent<T extends DomElement> extends Abs
|
||||
|
||||
DomElementAnnotationsManager.getInstance(domElement.getManager().getProject()).addHighlightingListener(new DomElementAnnotationsManager.DomHighlightingListener() {
|
||||
@Override
|
||||
public void highlightingFinished(@NotNull final DomFileElement element) {
|
||||
public void highlightingFinished(final @NotNull DomFileElement element) {
|
||||
ApplicationManager.getApplication().invokeLater(() -> {
|
||||
if (getComponent().isShowing() && element.isValid()) {
|
||||
updateHighlighting();
|
||||
@@ -114,8 +100,7 @@ public abstract class BasicDomElementComponent<T extends DomElement> extends Abs
|
||||
return null;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String convertFieldName(@NotNull String propertyName, final DomChildrenDescription description) {
|
||||
private @NotNull String convertFieldName(@NotNull String propertyName, final DomChildrenDescription description) {
|
||||
propertyName = StringUtil.trimStart(propertyName, "my");
|
||||
|
||||
String convertedName = description.getDomNameStrategy(getDomElement()).convertName(propertyName);
|
||||
|
||||
@@ -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 com.intellij.util.xml.ui;
|
||||
|
||||
@@ -71,8 +57,7 @@ public class CaptionComponent extends JPanel implements Committable, Highlightab
|
||||
myCaptionLabel.setText(text);
|
||||
}
|
||||
|
||||
@Nls
|
||||
public String getText() {
|
||||
public @Nls String getText() {
|
||||
return myCaptionLabel.getText();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml.ui;
|
||||
|
||||
import com.intellij.openapi.util.NlsContexts.ColumnName;
|
||||
@@ -18,7 +18,7 @@ public class ChildGenericValueColumnInfo<T extends DomElement> extends DomColumn
|
||||
private final DomFixedChildDescription myChildDescription;
|
||||
|
||||
public ChildGenericValueColumnInfo(final @ColumnName String name,
|
||||
@NotNull final DomFixedChildDescription description,
|
||||
final @NotNull DomFixedChildDescription description,
|
||||
final TableCellRenderer renderer,
|
||||
final TableCellEditor editor) {
|
||||
super(name, renderer);
|
||||
|
||||
@@ -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 com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.lang.annotation.HighlightSeverity;
|
||||
@@ -88,8 +74,7 @@ public class ComboControl extends BaseModifiableControl<JComboBox<Pair<String, I
|
||||
if (converter instanceof ResolvingConverter) {
|
||||
final AbstractConvertContext context = new AbstractConvertContext() {
|
||||
@Override
|
||||
@NotNull
|
||||
public DomElement getInvocationElement() {
|
||||
public @NotNull DomElement getInvocationElement() {
|
||||
return reference;
|
||||
}
|
||||
};
|
||||
@@ -231,8 +216,7 @@ public class ComboControl extends BaseModifiableControl<JComboBox<Pair<String, I
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected final String getValue() {
|
||||
protected final @Nullable String getValue() {
|
||||
final Pair<String, Icon> pair = (Pair<String, Icon>)getComponent().getSelectedItem();
|
||||
return pair == null || pair == EMPTY ? null : pair.first;
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 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.util.xml.ui;
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CommitablePanelUserActivityListener implements UserActivityListener
|
||||
}
|
||||
|
||||
@Override
|
||||
final public void stateChanged() {
|
||||
public final void stateChanged() {
|
||||
if (myApplying) return;
|
||||
cancel();
|
||||
cancelAllRequests();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml.ui;
|
||||
|
||||
import com.intellij.codeInspection.util.InspectionMessage;
|
||||
@@ -117,22 +117,19 @@ public class DomCollectionControl<T extends DomElement> extends DomUIControl imp
|
||||
myCollectionPanel.getTable().setRowSelectionInterval(index, index);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
public @Nullable Object getData(@NotNull String dataId) {
|
||||
if (DOM_COLLECTION_CONTROL.is(dataId)) {
|
||||
return this;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable @NonNls
|
||||
protected String getHelpId() {
|
||||
protected @Nullable @NonNls String getHelpId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable @Nls
|
||||
protected String getEmptyPaneText() {
|
||||
protected @Nullable @Nls String getEmptyPaneText() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -295,8 +292,7 @@ public class DomCollectionControl<T extends DomElement> extends DomUIControl imp
|
||||
};
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static DomEditorManager getDomEditorManager(DomUIControl control) {
|
||||
private static @Nullable DomEditorManager getDomEditorManager(DomUIControl control) {
|
||||
JComponent component = control.getComponent();
|
||||
while (component != null && !(component instanceof DomEditorManager)) {
|
||||
final Container parent = component.getParent();
|
||||
@@ -356,7 +352,7 @@ public class DomCollectionControl<T extends DomElement> extends DomUIControl imp
|
||||
}
|
||||
|
||||
@Override
|
||||
protected final void afterAddition(@NotNull final T newElement) {
|
||||
protected final void afterAddition(final @NotNull T newElement) {
|
||||
reset();
|
||||
afterAddition(myCollectionPanel.getTable(), myCollectionElements.size() - 1);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2021 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.util.xml.ui;
|
||||
|
||||
import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
|
||||
@@ -66,8 +66,7 @@ public class DomFileEditor<T extends BasicDomElementComponent> extends Perspecti
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JComponent getPreferredFocusedComponent() {
|
||||
public @Nullable JComponent getPreferredFocusedComponent() {
|
||||
ensureInitialized();
|
||||
return myComponent.getComponent();
|
||||
}
|
||||
@@ -77,8 +76,7 @@ public class DomFileEditor<T extends BasicDomElementComponent> extends Perspecti
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected JComponent createCustomComponent() {
|
||||
protected @NotNull JComponent createCustomComponent() {
|
||||
MnemonicHelper.init(getComponent());
|
||||
myComponent = myComponentFactory.create();
|
||||
DomUIFactory.getDomUIFactory().setupErrorOutdatingUserActivityWatcher(this, getDomElement());
|
||||
@@ -93,8 +91,7 @@ public class DomFileEditor<T extends BasicDomElementComponent> extends Perspecti
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public final String getName() {
|
||||
public final @NotNull String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.util.xml.DomElement;
|
||||
@@ -45,8 +31,7 @@ public class DomFixedWrapper<T> extends DomWrapper<T>{
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public DomElement getExistingDomElement() {
|
||||
public @NotNull DomElement getExistingDomElement() {
|
||||
return myDomElement;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.util.xml.DomElement;
|
||||
@@ -29,8 +15,7 @@ public class DomStringWrapper extends DomWrapper<String>{
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public DomElement getExistingDomElement() {
|
||||
public @NotNull DomElement getExistingDomElement() {
|
||||
return myDomElement;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataProvider;
|
||||
@@ -42,9 +28,8 @@ public class DomTableView extends AbstractTableView<DomElement> {
|
||||
myCustomDataProviders.add(provider);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(@NotNull String dataId) {
|
||||
public @Nullable Object getData(@NotNull String dataId) {
|
||||
for (DataProvider provider : myCustomDataProviders) {
|
||||
Object data = provider.getData(dataId);
|
||||
if (data != null) return data;
|
||||
@@ -53,7 +38,7 @@ public class DomTableView extends AbstractTableView<DomElement> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void wrapValueSetting(@NotNull final DomElement domElement, final Runnable valueSetter) {
|
||||
protected void wrapValueSetting(final @NotNull DomElement domElement, final Runnable valueSetter) {
|
||||
if (domElement.isValid()) {
|
||||
WriteCommandAction.writeCommandAction(getProject(), DomUtil.getFile(domElement)).run(() -> valueSetter.run());
|
||||
fireChanged();
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.util.xml.DomElement;
|
||||
@@ -40,7 +26,7 @@ public abstract class DomUIControl<T extends DomElement> implements CommittableP
|
||||
public void addDependency(final DomUIControl control) {
|
||||
control.addCommitListener(new CommitAdapter() {
|
||||
@Override
|
||||
public void afterCommit(@NotNull final DomUIControl control) {
|
||||
public void afterCommit(final @NotNull DomUIControl control) {
|
||||
reset();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml.ui;
|
||||
|
||||
import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
|
||||
@@ -86,8 +86,7 @@ public abstract class DomUIFactory {
|
||||
|
||||
protected abstract TableCellEditor createCellEditor(DomElement element, Class type);
|
||||
|
||||
@NotNull
|
||||
public abstract UserActivityWatcher createEditorAwareUserActivityWatcher();
|
||||
public abstract @NotNull UserActivityWatcher createEditorAwareUserActivityWatcher();
|
||||
|
||||
public abstract void setupErrorOutdatingUserActivityWatcher(CommittablePanel panel, DomElement... elements);
|
||||
|
||||
|
||||
@@ -1,37 +1,21 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public abstract class DomWrapper<T> {
|
||||
|
||||
@NotNull
|
||||
public abstract DomElement getExistingDomElement();
|
||||
public abstract @NotNull DomElement getExistingDomElement();
|
||||
|
||||
@Nullable
|
||||
public abstract DomElement getWrappedElement();
|
||||
public abstract @Nullable DomElement getWrappedElement();
|
||||
|
||||
public abstract void setValue(T value) throws IllegalAccessException, InvocationTargetException;
|
||||
public abstract T getValue() throws IllegalAccessException, InvocationTargetException;
|
||||
|
||||
@@ -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 com.intellij.util.xml.ui;
|
||||
|
||||
@@ -40,7 +26,7 @@ public class ErrorableTableCellRenderer<T extends DomElement> extends DefaultTab
|
||||
private final T myCellValueDomElement;
|
||||
private final DomElement myRoot;
|
||||
|
||||
public ErrorableTableCellRenderer(@Nullable final T cellValueDomElement, final TableCellRenderer renderer, @NotNull final DomElement rowDomElement) {
|
||||
public ErrorableTableCellRenderer(final @Nullable T cellValueDomElement, final TableCellRenderer renderer, final @NotNull DomElement rowDomElement) {
|
||||
myCellValueDomElement = cellValueDomElement;
|
||||
myRenderer = renderer;
|
||||
myRowDomElement = rowDomElement;
|
||||
|
||||
@@ -1,28 +1,14 @@
|
||||
/*
|
||||
* Copyright 2000-2009 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 com.intellij.util.xml.ui;
|
||||
|
||||
public class MultiLineTextPanel extends TextPanel{
|
||||
private int myRowCount = 3;
|
||||
public final class MultiLineTextPanel extends TextPanel {
|
||||
private int rowCount = 3;
|
||||
|
||||
public final int getRowCount() {
|
||||
return myRowCount;
|
||||
public int getRowCount() {
|
||||
return rowCount;
|
||||
}
|
||||
|
||||
public final void setRowCount(final int rowCount) {
|
||||
myRowCount = rowCount;
|
||||
public void setRowCount(final int rowCount) {
|
||||
this.rowCount = rowCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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 com.intellij.util.xml.ui;
|
||||
|
||||
import com.intellij.openapi.fileEditor.FileEditorPolicy;
|
||||
@@ -24,25 +10,19 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public abstract class PerspectiveFileEditorProvider extends WeighedFileEditorProvider {
|
||||
@Override
|
||||
@NotNull
|
||||
public abstract PerspectiveFileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file);
|
||||
public abstract @NotNull PerspectiveFileEditor createEditor(@NotNull Project project, @NotNull VirtualFile file);
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@NonNls
|
||||
public final String getEditorTypeId() {
|
||||
public final @NotNull @NonNls String getEditorTypeId() {
|
||||
return getComponentName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public final FileEditorPolicy getPolicy() {
|
||||
public final @NotNull FileEditorPolicy getPolicy() {
|
||||
return FileEditorPolicy.PLACE_AFTER_DEFAULT_EDITOR;
|
||||
}
|
||||
|
||||
@NonNls
|
||||
public final String getComponentName() {
|
||||
public final @NonNls String getComponentName() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml.ui;
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
import java.util.List;
|
||||
|
||||
public final class TooltipUtils {
|
||||
@NonNls private static final HtmlChunk MESSAGE_DELIMITER = HtmlChunk.hr().attr("size", "1")
|
||||
private static final @NonNls HtmlChunk MESSAGE_DELIMITER = HtmlChunk.hr().attr("size", "1")
|
||||
.attr("noshade", "noshade");
|
||||
|
||||
public static @NlsContexts.Tooltip String getTooltipText(List<? extends DomElementProblemDescriptor> annotations) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml.ui.actions;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
@@ -79,8 +79,7 @@ public abstract class AddDomElementAction extends AnAction {
|
||||
}
|
||||
}
|
||||
|
||||
@NlsActions.ActionText
|
||||
protected String getActionText(final AnActionEvent e) {
|
||||
protected @NlsActions.ActionText String getActionText(final AnActionEvent e) {
|
||||
return e.getPresentation().getText();
|
||||
}
|
||||
|
||||
@@ -146,8 +145,7 @@ public abstract class AddDomElementAction extends AnAction {
|
||||
|
||||
protected abstract DomCollectionChildDescription @NotNull [] getDomCollectionChildDescriptions(final AnActionEvent e);
|
||||
|
||||
@Nullable
|
||||
protected abstract DomElement getParentDomElement(final AnActionEvent e);
|
||||
protected abstract @Nullable DomElement getParentDomElement(final AnActionEvent e);
|
||||
|
||||
protected abstract JComponent getComponent(AnActionEvent e);
|
||||
|
||||
|
||||
@@ -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 com.intellij.util.xml.ui.actions;
|
||||
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
@@ -48,15 +48,14 @@ public abstract class DefaultAddAction<T extends DomElement> extends AnAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void actionPerformed(@NotNull final AnActionEvent e) {
|
||||
public final void actionPerformed(final @NotNull AnActionEvent e) {
|
||||
final T result = performElementAddition();
|
||||
if (result != null) {
|
||||
afterAddition(result);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected T performElementAddition() {
|
||||
protected @Nullable T performElementAddition() {
|
||||
final DomElement parent = getParentDomElement();
|
||||
final DomManager domManager = parent.getManager();
|
||||
final TypeChooser[] oldChoosers = new TypeChooser[]{null};
|
||||
|
||||
+2
-3
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// 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.util.xml.ui.actions.generate;
|
||||
|
||||
import com.intellij.codeInsight.actions.SimpleCodeInsightAction;
|
||||
@@ -38,8 +38,7 @@ public abstract class CreateDomElementAction<T extends DomElement> extends Simpl
|
||||
return getContextElement(editor) != null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected T getContextElement(Editor editor) {
|
||||
protected @Nullable T getContextElement(Editor editor) {
|
||||
return DomUtil.getContextElement(editor, myContextClass);
|
||||
}
|
||||
|
||||
|
||||
+5
-20
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
|
||||
package com.intellij.util.xml.ui.actions.generate;
|
||||
|
||||
@@ -33,7 +19,7 @@ public class GenerateDomElementAction extends CodeInsightAction {
|
||||
|
||||
protected final GenerateDomElementProvider myProvider;
|
||||
|
||||
public GenerateDomElementAction(@NotNull final GenerateDomElementProvider generateProvider, @Nullable Icon icon) {
|
||||
public GenerateDomElementAction(final @NotNull GenerateDomElementProvider generateProvider, @Nullable Icon icon) {
|
||||
getTemplatePresentation().setDescription(generateProvider.getDescription());
|
||||
getTemplatePresentation().setText(generateProvider.getText());
|
||||
getTemplatePresentation().setIcon(icon);
|
||||
@@ -47,11 +33,10 @@ public class GenerateDomElementAction extends CodeInsightAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
protected CodeInsightActionHandler getHandler() {
|
||||
protected @NotNull CodeInsightActionHandler getHandler() {
|
||||
return new CodeInsightActionHandler() {
|
||||
@Override
|
||||
public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
|
||||
public void invoke(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) {
|
||||
final Runnable runnable = () -> {
|
||||
final DomElement element = myProvider.generate(project, editor, file);
|
||||
myProvider.navigate(element);
|
||||
@@ -77,7 +62,7 @@ public class GenerateDomElementAction extends CodeInsightAction {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isValidForFile(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) {
|
||||
protected boolean isValidForFile(final @NotNull Project project, final @NotNull Editor editor, final @NotNull PsiFile file) {
|
||||
final DomElement element = DomUtil.getContextElement(editor);
|
||||
return element != null && myProvider.isAvailableForElement(element);
|
||||
}
|
||||
|
||||
+2
-17
@@ -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 com.intellij.util.xml.ui.actions.generate;
|
||||
|
||||
@@ -41,8 +27,7 @@ public abstract class GenerateDomElementProvider<T extends DomElement> {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public abstract T generate(final Project project, final Editor editor, final PsiFile file);
|
||||
public abstract @Nullable T generate(final Project project, final Editor editor, final PsiFile file);
|
||||
|
||||
public void navigate(final DomElement element) {
|
||||
if (element != null && element.isValid()) {
|
||||
|
||||
Reference in New Issue
Block a user