I have two custom MPS plugins. Plugin A defines a preference component with a single preference page. This is were I set a path to a project specific file.
Now Plugin B defines a Tool that needs to access the file via the path specified in the preference component of Plugin A.
I tried to achieve this with the following snipped inside the Tool of Plugin B with the following snippet that is also referred to in the MPS plugin documentation https://confluence.jetbrains.com/display/MPSD32/Plugin#Plugin-PreferenceComponentexpression
string path = project.preferenceComponent<CustomPrefences>.myFilepath
This, however, produces an error:
couldn't resolve reference 'baseMethodDeclaration' from getStateObject
-- cannot resolve reference by string: 'getStateObject'
-- was input: 034ff76b-1ae8-4bb0-823c-a3f81ff1996a/r:c0217f7d-91e8-4a13-bd95-b21cbfc313df(B@transient18/B.plugin@0)/8159339663038184236
-- was template: r:00000000-0000-4000-0000-011c89590369(jetbrains.mps.lang.plugin.generator.baseLanguage.template.main@generator)/5891355986060395731
Failed to replace dynamic reference 'baseMethodDeclaration' with static counterpart: no target; resolveInfo=getStateObject. Dynamic reference is left intact.
broken reference 'fieldDeclaration' in [operation] FieldReferenceOperation null in B.plugin@1_0 (target model is null)
-- -- was input node: [operation] FieldReferenceOperation null in B.plugin@1_0
broken reference 'classifier' in [actualArgument] ClassifierClassExpression null in B.plugin@1_0 (target model is null)
-- -- was input node: [actualArgument] ClassifierClassExpression null in B.plugin@1_0
model "B.plugin@1_0" has been generated with errors
generation completed with errors in 245 ms
Error executing target jetbrains.mps.lang.core.Generate.generate
"generate" target execution time: 246 ms
Other targets execution time: 1 ms; configure: 1 ms, preloadModels: 0 ms, checkParameters: 0 ms
Make failed. See previous messages for details.
The dependencies look fine to me but the generator seems not able to resolve the references. So my question is if what I want to achieve is possible and if so what am I doing wrong?