**I want to enable jumping to files by clicking on package path names within the files opened by the Eclipse application generated with Xtext. How can this be achieved。**
**the .xtext files below:**
grammar com.jzd.soctest.dsl.flow.FlowDsl with org.eclipse.xtext.common.Terminals
generate flowDsl "http://www.jzd.com/soctest/dsl/flow/FlowDsl"
// ================== TOP-LEVEL MODEL ==================
Model:
(imports += Import)*
(elements += AbstractElement)*;
Import:
'import' importedNamespace = QualifiedNameWithWildcard ';';
QualifiedNameWithWildcard:
QualifiedName '.*'? ;
AbstractElement:
Spec | Flow | OperatingSequence | TestSuite | Margin;
// ================== SPEC FILE ==================
Spec:
'spec' name=ID '{'
(declarations += SpecDeclaration)*
(setups += SpecSetup)*
'}';
SpecDeclaration:
name=ID '=' value=Expression ';';
SpecSetup:
'setup' setupType=ID targets=ID '{'
(assignments += Assignment)*
'}';
// ================== FLOW FILE ==================
Flow:
'flow' name=ID '{'
(setupBlock = SetupBlock)?
(executeBlock = ExecuteBlock)?
'}';
TestSuite:
'suite' name=ID 'calls' callable=[OperatingSequence|QualifiedName] '{'
(assignments += Assignment)*
'}';
SetupBlock:
'setup' '{'
(suites += TestSuite)*
'}';
Margin:
'margin' name=ID '{'
'target' '=' target=[TestSuite|ID] ';'
('resultTitle' '=' title=STRING ';')?
axes += Axis*
'}';
Axis:
'axis' '[' axisVar=ID ']' '=' '{'
('setupSignal' '=' signal=STRING ';')?
'resourceType' '=' type=('specVariable' | 'instrumentProperty') ';'
'resourceName' '=' resourceName=STRING ';'
range=Range ';'
'}';
Range:
AbsoluteRange | RelativePercentageRange;
AbsoluteRange:
'range.start' '=' start=NUMBER ';'
'range.stop' '=' stop=NUMBER ';'
'range.resolution' '=' resolution=NUMBER ';';
RelativePercentageRange:
'range.relativePercentage.start' '=' start=NUMBER ';'
'range.relativePercentage.stop' '=' stop=NUMBER ';'
'range.steps' '=' steps=INT ';';
// ================== SEQ FILE ==================
OperatingSequence:
'sequence' name=ID '{'
(declarations += VariableDeclaration)*
(steps += Step)*
'}';
VariableDeclaration:
type=Type name=ID ('=' init=Expression)? ';';
Type:
'int' | 'real' | 'string' | 'bool' | ID;
Step:
action=ID '(' (args += Expression (',' args += Expression)*)? ')' ';';
// ================== COMMON ==================
Assignment:
feature=FeaturePath '=' value=Value ';';
FeaturePath:
ID ('.' ID)*;
Value:
ReferenceValue | Expression;
ReferenceValue:
'setupRef(' refPath=[Spec|QualifiedName] ')';
// ================== EXPRESSIONS ==================
Expression:
OrExpression;
OrExpression returns Expression:
AndExpression ({InfixExpression.left=current} op=('||') right=AndExpression)*;
AndExpression returns Expression:
EqualityExpression ({InfixExpression.left=current} op=('&&') right=EqualityExpression)*;
EqualityExpression returns Expression:
RelationalExpression ({InfixExpression.left=current} op=('=='|'!=') right=RelationalExpression)*;
RelationalExpression returns Expression:
AdditiveExpression ({InfixExpression.left=current} op=('<'|'<='|'>'|'>=') right=AdditiveExpression)*;
AdditiveExpression returns Expression:
MultiplicativeExpression ({InfixExpression.left=current} op=('+'|'-') right=MultiplicativeExpression)*;
MultiplicativeExpression returns Expression:
PrimaryExpression ({InfixExpression.left=current} op=(''|'/') right=PrimaryExpression);
PrimaryExpression returns Expression:
{NumberLiteral} value=NUMBER
| {StringLiteral} value=STRING
| {BooleanLiteral} value=('true'|'false')
| {Reference} ref=[Spec|QualifiedName]
| '(' Expression ')';
ExecuteBlock:
'execute' '{'
calls += ExecuteCall+
'}';
ExecuteCall:
suite=[TestSuite|ID] '.execute()' ';';
// ================== UTIL ==================
QualifiedName:
ID ('.' ID)*;
// ================== TERMINALS ==================
terminal NUMBER:
('0'..'9')+ ('.' ('0'..'9')+)? (('e'|'E') ('+'|'-')? ('0'..'9')+)? ((' '|'\t')* UNIT)?;
terminal UNIT:
'V' | 'A' | 'ns' | 'us' | 'ms' | 's' | 'GHz' | 'MHz' | 'kHz' | 'Hz';
and other files are auto-generated.
.flow files below:
/**
Testflow to run tests that use the DC capabilities of the tester
If enabled in the test program, it runs tests showing alarm handling
/
/* Needs DPS channels */
flow DcTest_01 {
setup {
suite opSeqDC calls testMethod.MixedInstrumentsActionTest {
measurement.specification = setupRef(testSpec.MixedInstrumentDc);
//measurement.specification = setupRef(testSpec.Functional_Par3Seq2);
measurement.operatingSequence = setupRef(testOs.DcLoopback);
dcVITestSignals = "R00";
digInOutTestSignals = "D00";
}
}
execute {
opSeqDC.execute();
}
}
I want to jump to the MixedInstrumentDc file when I click on "MixedInstrumentDc" in the DcTest_01.flow file
grammar com.jzd.soctest.dsl.flow.FlowDsl with org.eclipse.xtext.common.Terminals
generate flowDsl "http://www.jzd.com/soctest/dsl/flow/FlowDsl"
// ================== TOP-LEVEL MODEL ==================
Model:
(imports += Import)*
(elements += AbstractElement)*;
Import:
'import' importedNamespace = QualifiedNameWithWildcard ';';
QualifiedNameWithWildcard:
QualifiedName '.*'? ;
AbstractElement:
Spec | Flow | OperatingSequence | TestSuite | Margin;
// ================== SPEC FILE ==================
Spec:
'spec' name=ID '{'
(declarations += SpecDeclaration)*
(setups += SpecSetup)*
'}';
SpecDeclaration:
name=ID '=' value=Expression ';';
SpecSetup:
'setup' setupType=ID targets=ID '{'
(assignments += Assignment)*
'}';
// ================== FLOW FILE ==================
Flow:
'flow' name=ID '{'
(setupBlock = SetupBlock)?
(executeBlock = ExecuteBlock)?
'}';
TestSuite:
'suite' name=ID 'calls' callable=[OperatingSequence|QualifiedName] '{'
(assignments += Assignment)*
'}';
SetupBlock:
'setup' '{'
(suites += TestSuite)*
'}';
Margin:
'margin' name=ID '{'
'target' '=' target=[TestSuite|ID] ';'
('resultTitle' '=' title=STRING ';')?
axes += Axis*
'}';
Axis:
'axis' '[' axisVar=ID ']' '=' '{'
('setupSignal' '=' signal=STRING ';')?
'resourceType' '=' type=('specVariable' | 'instrumentProperty') ';'
'resourceName' '=' resourceName=STRING ';'
range=Range ';'
'}';
Range:
AbsoluteRange | RelativePercentageRange;
AbsoluteRange:
'range.start' '=' start=NUMBER ';'
'range.stop' '=' stop=NUMBER ';'
'range.resolution' '=' resolution=NUMBER ';';
RelativePercentageRange:
'range.relativePercentage.start' '=' start=NUMBER ';'
'range.relativePercentage.stop' '=' stop=NUMBER ';'
'range.steps' '=' steps=INT ';';
// ================== SEQ FILE ==================
OperatingSequence:
'sequence' name=ID '{'
(declarations += VariableDeclaration)*
(steps += Step)*
'}';
VariableDeclaration:
type=Type name=ID ('=' init=Expression)? ';';
Type:
'int' | 'real' | 'string' | 'bool' | ID;
Step:
action=ID '(' (args += Expression (',' args += Expression)*)? ')' ';';
// ================== COMMON ==================
Assignment:
feature=FeaturePath '=' value=Value ';';
FeaturePath:
ID ('.' ID)*;
Value:
ReferenceValue | Expression;
ReferenceValue:
'setupRef(' refPath=[Spec|QualifiedName] ')';
// ================== EXPRESSIONS ==================
Expression:
OrExpression;
OrExpression returns Expression:
AndExpression ({InfixExpression.left=current} op=('||') right=AndExpression)*;
AndExpression returns Expression:
EqualityExpression ({InfixExpression.left=current} op=('&&') right=EqualityExpression)*;
EqualityExpression returns Expression:
RelationalExpression ({InfixExpression.left=current} op=('=='|'!=') right=RelationalExpression)*;
RelationalExpression returns Expression:
AdditiveExpression ({InfixExpression.left=current} op=('<'|'<='|'>'|'>=') right=AdditiveExpression)*;
AdditiveExpression returns Expression:
MultiplicativeExpression ({InfixExpression.left=current} op=('+'|'-') right=MultiplicativeExpression)*;
MultiplicativeExpression returns Expression:
PrimaryExpression ({InfixExpression.left=current} op=(''|'/') right=PrimaryExpression);
PrimaryExpression returns Expression:
{NumberLiteral} value=NUMBER
| {StringLiteral} value=STRING
| {BooleanLiteral} value=('true'|'false')
| {Reference} ref=[Spec|QualifiedName]
| '(' Expression ')';
ExecuteBlock:
'execute' '{'
calls += ExecuteCall+
'}';
ExecuteCall:
suite=[TestSuite|ID] '.execute()' ';';
// ================== UTIL ==================
QualifiedName:
ID ('.' ID)*;
// ================== TERMINALS ==================
terminal NUMBER:
('0'..'9')+ ('.' ('0'..'9')+)? (('e'|'E') ('+'|'-')? ('0'..'9')+)? ((' '|'\t')* UNIT)?;
terminal UNIT:
'V' | 'A' | 'ns' | 'us' | 'ms' | 's' | 'GHz' | 'MHz' | 'kHz' | 'Hz';
and other files are auto-generated.
.flow files below:
/**
Testflow to run tests that use the DC capabilities of the tester
If enabled in the test program, it runs tests showing alarm handling
/
/* Needs DPS channels */
flow DcTest_01 {
setup {
suite opSeqDC calls testMethod.MixedInstrumentsActionTest {
measurement.specification = setupRef(testSpec.MixedInstrumentDc);
//measurement.specification = setupRef(testSpec.Functional_Par3Seq2);
measurement.operatingSequence = setupRef(testOs.DcLoopback);
dcVITestSignals = "R00";
digInOutTestSignals = "D00";
}
}
execute {
opSeqDC.execute();
}
}
I want to jump to the MixedInstrumentDc file when I click on "MixedInstrumentDc" in the DcTest_01.flow file