0
아래 코드를 MySemanticHighlightingCalculator에 구현했는데 한 요소의 색이 예상대로 변경됩니다. 그러나 키워드의 자주색과 같은 기본 기본 강조 표시는 더 이상 작동하지 않았습니다.Xtext : 의미 상 예기치 않은 동작
INode root = resource.getParseResult().getRootNode();
BidiTreeIterator<INode> iterator = root.getAsTreeIterable().iterator();
while (iterator.hasNext()) {
INode node = iterator.next();
if (node.getSemanticElement() instanceof ParameterDesc) {
ParameterDesc paramdesc = (ParameterDesc) node
.getSemanticElement();
if (paramdesc.isUnselected() == true) {
acceptor.addPosition(
node.getOffset(),
node.getLength(),
MySemanticHighlightingConfiguration.PARAMETER_DESCRIPTION);
}
}
}
public static final String PARAMETER_DESCRIPTION = "Parameter_Description";
public void configure(IHighlightingConfigurationAcceptor acceptor) {
addType(acceptor, PARAMETER_DESCRIPTION, 255, 0, 0, TextAttribute.STRIKETHROUGH);
}
public void addType(IHighlightingConfigurationAcceptor acceptor, String s,
int r, int g, int b, int style) {
TextStyle textStyle = new TextStyle();
textStyle.setColor(new RGB(r, g, b));
textStyle.setStyle(style);
acceptor.acceptDefaultHighlighting(s, s, textStyle);
}
하지만 MyDSLUiModule, 다시 기본 강조하는 작업에서 MySemanticHighlightingConfiguration을 제거 할 때 :
public Class<? extends IHighlightingConfiguration> bindIHighlightingConfiguration() {
return MySemanticHighlightingConfiguration.class;
}
내가 기본 강조 오프셋 및 오프셋 사이 applyed되지 않을 것이라는 점을 알고있다 + 길이,하지만 나는 문서의 나머지 부분을 원한다.
thx, 나를 위해 일한 :) – ph09