mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[yaml, kubernetes] corrections upon review IDEA-CR-29807
This commit is contained in:
@@ -16,6 +16,7 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.yaml.YAMLLanguage;
|
import org.jetbrains.yaml.YAMLLanguage;
|
||||||
import org.jetbrains.yaml.meta.model.Field;
|
import org.jetbrains.yaml.meta.model.Field;
|
||||||
|
import org.jetbrains.yaml.meta.model.TypeFieldPair;
|
||||||
import org.jetbrains.yaml.meta.model.YamlMetaType;
|
import org.jetbrains.yaml.meta.model.YamlMetaType;
|
||||||
import org.jetbrains.yaml.meta.model.YamlMetaType.ForcedCompletionPath;
|
import org.jetbrains.yaml.meta.model.YamlMetaType.ForcedCompletionPath;
|
||||||
import org.jetbrains.yaml.psi.YAMLKeyValue;
|
import org.jetbrains.yaml.psi.YAMLKeyValue;
|
||||||
@@ -57,8 +58,8 @@ public abstract class YamlDocumentationProviderBase extends AbstractDocumentatio
|
|||||||
if (object instanceof ForcedCompletionPath) { // deep completion
|
if (object instanceof ForcedCompletionPath) { // deep completion
|
||||||
return createFromCompletionPath((ForcedCompletionPath)object, contextElement);
|
return createFromCompletionPath((ForcedCompletionPath)object, contextElement);
|
||||||
}
|
}
|
||||||
else if (object instanceof YamlMetaTypeProvider.MetaTypeProxy) { // basic completion with Field object
|
else if (object instanceof TypeFieldPair) { // basic completion with Field object
|
||||||
return createFromField((YamlMetaTypeProvider.MetaTypeProxy)object, contextElement);
|
return createFromField((TypeFieldPair)object, contextElement);
|
||||||
}
|
}
|
||||||
else if (object instanceof String) { // basic completion with plain string
|
else if (object instanceof String) { // basic completion with plain string
|
||||||
return createFromString((String)object, contextElement);
|
return createFromString((String)object, contextElement);
|
||||||
@@ -184,7 +185,7 @@ public abstract class YamlDocumentationProviderBase extends AbstractDocumentatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private DocumentationElement createFromField(YamlMetaTypeProvider.MetaTypeProxy field, @NotNull PsiElement contextElement) {
|
private DocumentationElement createFromField(@NotNull TypeFieldPair field, @NotNull PsiElement contextElement) {
|
||||||
return new DocumentationElement(contextElement.getManager(), field.getMetaType(), field.getField());
|
return new DocumentationElement(contextElement.getManager(), field.getMetaType(), field.getField());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import org.jetbrains.annotations.ApiStatus;
|
|||||||
import org.jetbrains.annotations.Contract;
|
import org.jetbrains.annotations.Contract;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.jetbrains.yaml.meta.impl.YamlMetaTypeProvider;
|
|
||||||
import org.jetbrains.yaml.psi.YAMLKeyValue;
|
import org.jetbrains.yaml.psi.YAMLKeyValue;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -223,21 +222,7 @@ public class Field {
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
final YamlMetaTypeProvider.MetaTypeProxy lookupObject = new YamlMetaTypeProvider.MetaTypeProxy() {
|
LookupElementBuilder lookup = LookupElementBuilder.create(new TypeFieldPair(ownerClass, this), getName())
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public YamlMetaType getMetaType() {
|
|
||||||
return ownerClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@Override
|
|
||||||
public Field getField() {
|
|
||||||
return Field.this;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
LookupElementBuilder lookup = LookupElementBuilder.create(lookupObject, getName())
|
|
||||||
.withTypeText(myMainType.getDisplayName(), true)
|
.withTypeText(myMainType.getDisplayName(), true)
|
||||||
.withIcon(getLookupIcon())
|
.withIcon(getLookupIcon())
|
||||||
.withStrikeoutness(isDeprecated());
|
.withStrikeoutness(isDeprecated());
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||||
|
package org.jetbrains.yaml.meta.model;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class TypeFieldPair {
|
||||||
|
@NotNull
|
||||||
|
private final Field myField;
|
||||||
|
@NotNull
|
||||||
|
private final YamlMetaClass myOwnerClass;
|
||||||
|
|
||||||
|
public TypeFieldPair(@NotNull YamlMetaClass ownerClass, @NotNull Field field) {
|
||||||
|
myField = field;
|
||||||
|
myOwnerClass = ownerClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public YamlMetaType getMetaType() {
|
||||||
|
return myOwnerClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public Field getField() {
|
||||||
|
return myField;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user