blob: 2f5ef6a51b82963dac108bab90cdac32f6c09164 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package ai.vespa.intellij.schema.psi.impl;
import com.intellij.extapi.psi.ASTWrapperPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation;
import ai.vespa.intellij.schema.SdIcons;
import ai.vespa.intellij.schema.psi.SdTypes;
import javax.swing.Icon;
/**
* This class is used for methods' implementations for SdSummaryDefinition. Connected with "mixin" to SummaryDefinition
* rule in sd.bnf
*
* @author Shahar Ariel
*/
public abstract class SdSummaryDefinitionMixin extends ASTWrapperPsiElement {
public SdSummaryDefinitionMixin(ASTNode node) {
super(node);
}
public String getName() {
ASTNode node;
node = this.getNode().findChildByType(SdTypes.IDENTIFIER_WITH_DASH_VAL);
if (node != null) {
return node.getText();
} else {
return "";
}
}
@Override
public ItemPresentation getPresentation() {
final SdSummaryDefinitionMixin element = this;
return new ItemPresentation() {
@Override
public String getPresentableText() {
return getName();
}
@Override
public String getLocationString() {
return element.getContainingFile() != null ? element.getContainingFile().getName() : null;
}
@Override
public Icon getIcon(boolean unused) {
return SdIcons.SUMMARY;
}
};
}
}
|