Skip to content
Snippets Groups Projects
Commit 58854dab authored by Johannes Mey's avatar Johannes Mey
Browse files

rename attribute superclasses

parent c33a37af
No related branches found
No related tags found
1 merge request!5Resolve "Structure View Support"
...@@ -86,13 +86,13 @@ aspect_interface_member_declaration ::= ( aspect_nested_class_declaration ...@@ -86,13 +86,13 @@ aspect_interface_member_declaration ::= ( aspect_nested_class_declaration
aspect_interface_syn_attribute_declaration ::= annotation* SYN LAZY? FINAL? aspect_type attribute_name LPAREN (type parameter_name (COMMA type parameter_name)* )? RPAREN (CIRCULAR LBRACKET expression RBRACKET)? SEMICOLON aspect_interface_syn_attribute_declaration ::= annotation* SYN LAZY? FINAL? aspect_type attribute_name LPAREN (type parameter_name (COMMA type parameter_name)* )? RPAREN (CIRCULAR LBRACKET expression RBRACKET)? SEMICOLON
{ {
implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute" implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute"
extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectSynAttributeImpl" extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectAspectSynAttributeDeclarationImplExtension"
} }
aspect_interface_inh_attribute_declaration ::= annotation* INH LAZY? FINAL? aspect_type attribute_name LPAREN (type parameter_name (COMMA type parameter_name)* )? RPAREN (CIRCULAR LBRACKET expression RBRACKET)? SEMICOLON aspect_interface_inh_attribute_declaration ::= annotation* INH LAZY? FINAL? aspect_type attribute_name LPAREN (type parameter_name (COMMA type parameter_name)* )? RPAREN (CIRCULAR LBRACKET expression RBRACKET)? SEMICOLON
{ {
implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute" implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute"
extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectInhAttributeImpl" extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectAspectInhAttributeDeclarationImplExtension"
} }
aspect_interface_method_declaration ::= (PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED )* aspect_result_type method_declarator (THROWS name_list)? SEMICOLON aspect_interface_method_declaration ::= (PUBLIC | PROTECTED | PRIVATE | STATIC | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED )* aspect_result_type method_declarator (THROWS name_list)? SEMICOLON
...@@ -118,13 +118,13 @@ aspect_field_declaration ::= modifiers aspect_type ast_type_name DOT variable_de ...@@ -118,13 +118,13 @@ aspect_field_declaration ::= modifiers aspect_type ast_type_name DOT variable_de
aspect_syn_attribute_declaration ::= annotation* SYN NTA? LAZY? FINAL? aspect_type ast_type_name DOT attribute_name LPAREN (type parameter_name (COMMA type parameter_name)* )? RPAREN (CIRCULAR LBRACKET expression RBRACKET)? ( ASSIGN expression SEMICOLON | block | SEMICOLON ) aspect_syn_attribute_declaration ::= annotation* SYN NTA? LAZY? FINAL? aspect_type ast_type_name DOT attribute_name LPAREN (type parameter_name (COMMA type parameter_name)* )? RPAREN (CIRCULAR LBRACKET expression RBRACKET)? ( ASSIGN expression SEMICOLON | block | SEMICOLON )
{ {
implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute" implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute"
extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectSynAttributeImpl" extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectAspectSynAttributeDeclarationImplExtension"
} }
aspect_inh_attribute_declaration ::= annotation* INH NTA? LAZY? FINAL? aspect_type ast_type_name DOT attribute_name LPAREN (type parameter_name (COMMA type parameter_name)* )? RPAREN (CIRCULAR LBRACKET expression RBRACKET)? SEMICOLON aspect_inh_attribute_declaration ::= annotation* INH NTA? LAZY? FINAL? aspect_type ast_type_name DOT attribute_name LPAREN (type parameter_name (COMMA type parameter_name)* )? RPAREN (CIRCULAR LBRACKET expression RBRACKET)? SEMICOLON
{ {
implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute" implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute"
extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectInhAttributeImpl" extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectAspectInhAttributeDeclarationImplExtension"
} }
// FIXME parentheses are not required around the WHEN expression? // FIXME parentheses are not required around the WHEN expression?
...@@ -141,7 +141,7 @@ aspect_refine_inh_equation ::= REFINE aspect_name EQUATION ast_type_name DOT att ...@@ -141,7 +141,7 @@ aspect_refine_inh_equation ::= REFINE aspect_name EQUATION ast_type_name DOT att
collection_attribute ::= annotation* COLL aspect_type ast_type_name DOT attribute_name LPAREN RPAREN CIRCULAR? (LBRACKET expression RBRACKET)? (WITH method_name)? (ROOT ast_type_name)? SEMICOLON collection_attribute ::= annotation* COLL aspect_type ast_type_name DOT attribute_name LPAREN RPAREN CIRCULAR? (LBRACKET expression RBRACKET)? (WITH method_name)? (ROOT ast_type_name)? SEMICOLON
{ {
implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute" implements="org.jastadd.tooling.aspect.psi.JastAddAspectAttribute"
extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectCollAttributeImpl" extends="org.jastadd.tooling.aspect.psi.impl.JastAddAspectCollectionAttributeImplExtension"
} }
collection_contribution ::= annotation* ast_type_name CONTRIBUTES ( NTA expression TO ast_type_name DOT attribute_name LPAREN RPAREN | EACH? expression (WHEN expression)? TO ast_type_name DOT attribute_name LPAREN RPAREN (FOR EACH? expression)? | block TO ast_type_name DOT attribute_name LPAREN RPAREN ) SEMICOLON collection_contribution ::= annotation* ast_type_name CONTRIBUTES ( NTA expression TO ast_type_name DOT attribute_name LPAREN RPAREN | EACH? expression (WHEN expression)? TO ast_type_name DOT attribute_name LPAREN RPAREN (FOR EACH? expression)? | block TO ast_type_name DOT attribute_name LPAREN RPAREN ) SEMICOLON
......
...@@ -4,4 +4,7 @@ import com.intellij.psi.PsiElement; ...@@ -4,4 +4,7 @@ import com.intellij.psi.PsiElement;
import org.jastadd.tooling.grammar.psi.GrammarNamedElement; import org.jastadd.tooling.grammar.psi.GrammarNamedElement;
public interface JastAddAspectAttribute extends PsiElement, GrammarNamedElement { public interface JastAddAspectAttribute extends PsiElement, GrammarNamedElement {
String signature();
} }
...@@ -52,15 +52,9 @@ public class JastAddAspectAspectDeclarationImplExtension extends GrammarNamedEle ...@@ -52,15 +52,9 @@ public class JastAddAspectAspectDeclarationImplExtension extends GrammarNamedEle
return "aspect " + getName(); return "aspect " + getName();
} }
@Override
public String getLocationString() {
Document document = FileDocumentManager.getInstance().getDocument(getNode().getPsi().getContainingFile().getVirtualFile());
return document != null ? "l." + document.getLineNumber(getTextRange().getStartOffset() + 1) : "";
}
@Override @Override
public Icon getIcon(boolean unused) { public Icon getIcon(boolean unused) {
return JastAddIcons.FILE; return JastAddIcons.ASPECT;
} }
}; };
} }
......
...@@ -9,6 +9,7 @@ import com.intellij.psi.PsiElement; ...@@ -9,6 +9,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.util.IncorrectOperationException; import com.intellij.util.IncorrectOperationException;
import org.jastadd.tooling.aspect.psi.AspectTypes; import org.jastadd.tooling.aspect.psi.AspectTypes;
import org.jastadd.tooling.aspect.psi.JastAddAspectAspectInhAttributeDeclaration; import org.jastadd.tooling.aspect.psi.JastAddAspectAspectInhAttributeDeclaration;
import org.jastadd.tooling.aspect.psi.JastAddAspectAspectSynAttributeDeclaration;
import org.jastadd.tooling.aspect.psi.JastAddAspectAttribute; import org.jastadd.tooling.aspect.psi.JastAddAspectAttribute;
import org.jastadd.tooling.grammar.psi.impl.GrammarNamedElementImpl; import org.jastadd.tooling.grammar.psi.impl.GrammarNamedElementImpl;
import org.jastadd.tooling.util.JastAddIcons; import org.jastadd.tooling.util.JastAddIcons;
...@@ -16,9 +17,10 @@ import org.jetbrains.annotations.NotNull; ...@@ -16,9 +17,10 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.util.stream.Collectors;
public abstract class JastAddAspectInhAttributeImpl extends GrammarNamedElementImpl implements JastAddAspectAttribute { public abstract class JastAddAspectAspectInhAttributeDeclarationImplExtension extends GrammarNamedElementImpl implements JastAddAspectAttribute {
public JastAddAspectInhAttributeImpl(@NotNull ASTNode node) { public JastAddAspectAspectInhAttributeDeclarationImplExtension(@NotNull ASTNode node) {
super(node); super(node);
} }
...@@ -47,19 +49,19 @@ public abstract class JastAddAspectInhAttributeImpl extends GrammarNamedElementI ...@@ -47,19 +49,19 @@ public abstract class JastAddAspectInhAttributeImpl extends GrammarNamedElementI
return this; return this;
} }
@Override
public String signature() {
JastAddAspectAspectInhAttributeDeclaration decl = (JastAddAspectAspectInhAttributeDeclaration) this;
return "inh " + decl.getAstTypeName().getText() + "." + decl.getAttributeName().getText() + "(" + decl.getTypeList().stream().map(PsiElement::getText).collect(Collectors.joining(", ")) + ") : " + decl.getAspectType().getText();
}
@Override @Override
public ItemPresentation getPresentation() { public ItemPresentation getPresentation() {
return new ItemPresentation() { return new ItemPresentation() {
@Nullable @Nullable
@Override @Override
public String getPresentableText() { public String getPresentableText() {
return "inh " + getName(); return signature();
}
@Override
public String getLocationString() {
Document document = FileDocumentManager.getInstance().getDocument(getNode().getPsi().getContainingFile().getVirtualFile());
return document != null ? "l." + document.getLineNumber(getTextRange().getStartOffset() + 1) : "";
} }
@Override @Override
......
...@@ -16,9 +16,10 @@ import org.jetbrains.annotations.NotNull; ...@@ -16,9 +16,10 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
import java.util.stream.Collectors;
public abstract class JastAddAspectSynAttributeImpl extends GrammarNamedElementImpl implements JastAddAspectAttribute { public abstract class JastAddAspectAspectSynAttributeDeclarationImplExtension extends GrammarNamedElementImpl implements JastAddAspectAttribute {
public JastAddAspectSynAttributeImpl(@NotNull ASTNode node) { public JastAddAspectAspectSynAttributeDeclarationImplExtension(@NotNull ASTNode node) {
super(node); super(node);
} }
...@@ -48,19 +49,19 @@ public abstract class JastAddAspectSynAttributeImpl extends GrammarNamedElementI ...@@ -48,19 +49,19 @@ public abstract class JastAddAspectSynAttributeImpl extends GrammarNamedElementI
return this; return this;
} }
@Override
public String signature() {
JastAddAspectAspectSynAttributeDeclaration decl = (JastAddAspectAspectSynAttributeDeclaration) this;
return "syn " + decl.getAstTypeName().getText() + "." + decl.getAttributeName().getText() + "(" + decl.getTypeList().stream().map(PsiElement::getText).collect(Collectors.joining(", ")) + ") : " + decl.getAspectType().getText();
}
@Override @Override
public ItemPresentation getPresentation() { public ItemPresentation getPresentation() {
return new ItemPresentation() { return new ItemPresentation() {
@Nullable @Nullable
@Override @Override
public String getPresentableText() { public String getPresentableText() {
return "syn " + getName(); return signature();
}
@Override
public String getLocationString() {
Document document = FileDocumentManager.getInstance().getDocument(getNode().getPsi().getContainingFile().getVirtualFile());
return document != null ? "l." + document.getLineNumber(getTextRange().getStartOffset() + 1) : "";
} }
@Override @Override
......
...@@ -2,8 +2,6 @@ package org.jastadd.tooling.aspect.psi.impl; ...@@ -2,8 +2,6 @@ package org.jastadd.tooling.aspect.psi.impl;
import com.intellij.lang.ASTNode; import com.intellij.lang.ASTNode;
import com.intellij.navigation.ItemPresentation; import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.util.NlsSafe; import com.intellij.openapi.util.NlsSafe;
import com.intellij.psi.PsiElement; import com.intellij.psi.PsiElement;
import com.intellij.util.IncorrectOperationException; import com.intellij.util.IncorrectOperationException;
...@@ -17,8 +15,8 @@ import org.jetbrains.annotations.Nullable; ...@@ -17,8 +15,8 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*; import javax.swing.*;
public abstract class JastAddAspectCollAttributeImpl extends GrammarNamedElementImpl implements JastAddAspectAttribute { public abstract class JastAddAspectCollectionAttributeImplExtension extends GrammarNamedElementImpl implements JastAddAspectAttribute {
public JastAddAspectCollAttributeImpl(@NotNull ASTNode node) { public JastAddAspectCollectionAttributeImplExtension(@NotNull ASTNode node) {
super(node); super(node);
} }
...@@ -47,19 +45,19 @@ public abstract class JastAddAspectCollAttributeImpl extends GrammarNamedElement ...@@ -47,19 +45,19 @@ public abstract class JastAddAspectCollAttributeImpl extends GrammarNamedElement
return this; return this;
} }
@Override
public String signature() {
JastAddAspectCollectionAttribute decl = (JastAddAspectCollectionAttribute) this;
return "coll " + decl.getAstTypeNameList().get(0).getText() + "." + decl.getAttributeName().getText() + "() : " + decl.getAspectType().getText();
}
@Override @Override
public ItemPresentation getPresentation() { public ItemPresentation getPresentation() {
return new ItemPresentation() { return new ItemPresentation() {
@Nullable @Nullable
@Override @Override
public String getPresentableText() { public String getPresentableText() {
return "coll " + getName(); return signature();
}
@Override
public String getLocationString() {
Document document = FileDocumentManager.getInstance().getDocument(getNode().getPsi().getContainingFile().getVirtualFile());
return document != null ? "l." + document.getLineNumber(getTextRange().getStartOffset() + 1) : "";
} }
@Override @Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment