Search in sources :

Example 6 with AadlBaLocationReference

use of org.osate.ba.utils.AadlBaLocationReference in project osate2 by osate.

the class AadlBaTextPositionResolver method resolveBehaviorAnnexCrossReferencedElementAt.

private TextPositionInfo resolveBehaviorAnnexCrossReferencedElementAt(int offset) {
    Element e = this.getLinkedElement(offset);
    if (e == null)
        return new TextPositionInfo(null, offset, 0);
    AadlBaLocationReference loc = this.getSourceOffsetElement(offset);
    TextPositionInfo positionInfo;
    if (e instanceof ElementHolder) {
        ElementHolder beh = (ElementHolder) e;
        positionInfo = new TextPositionInfo(beh.getElement(), loc.getOffset(), loc.getLength());
    } else {
        positionInfo = new TextPositionInfo(e, loc.getOffset(), loc.getLength());
    }
    return positionInfo;
}
Also used : AadlBaLocationReference(org.osate.ba.utils.AadlBaLocationReference) TextPositionInfo(org.osate.annexsupport.TextPositionInfo) Element(org.osate.aadl2.Element) ElementHolder(org.osate.ba.aadlba.ElementHolder)

Example 7 with AadlBaLocationReference

use of org.osate.ba.utils.AadlBaLocationReference in project osate2 by osate.

the class XtextAadlBaHighlighter method addToHighlighting.

@Override
public void addToHighlighting(int annexOffset, Token token, String id) {
    int offset = ((CommonToken) token).getStartIndex();
    int length = token.getText().length();
    int column = token.getCharPositionInLine();
    _elementToHighlight.add(new AadlBaLocationReference(annexOffset, offset, length, column, id));
}
Also used : AadlBaLocationReference(org.osate.ba.utils.AadlBaLocationReference) CommonToken(org.antlr.v4.runtime.CommonToken)

Aggregations

AadlBaLocationReference (org.osate.ba.utils.AadlBaLocationReference)7 CommonToken (org.antlr.v4.runtime.CommonToken)2 Element (org.osate.aadl2.Element)2 TextPositionInfo (org.osate.annexsupport.TextPositionInfo)2 ElementHolder (org.osate.ba.aadlba.ElementHolder)2 CharStream (org.antlr.v4.runtime.CharStream)1 CommonTokenStream (org.antlr.v4.runtime.CommonTokenStream)1 BehaviorAnnex (org.osate.ba.aadlba.BehaviorAnnex)1 AadlAntlrErrorReporter (org.osate.ba.parser.AadlAntlrErrorReporter)1 AadlBaLexer (org.osate.ba.parser.AadlBaLexer)1 AadlBaParser (org.osate.ba.parser.AadlBaParser)1 Behavior_annexContext (org.osate.ba.parser.AadlBaParser.Behavior_annexContext)1 AadlBaParserVisitor (org.osate.ba.parser.AadlBaParserVisitor)1 AadlBaHighlighter (org.osate.ba.texteditor.AadlBaHighlighter)1 DefaultAadlBaHighlighter (org.osate.ba.texteditor.DefaultAadlBaHighlighter)1 XtextAadlBaHighlighter (org.osate.ba.texteditor.XtextAadlBaHighlighter)1 CaseInsensitiveCharStream (org.osate.ba.utils.CaseInsensitiveCharStream)1