How I code the DiagramGenerator to generator SModel

When I finish the xtext-based language server, I want to integrate sprotty.
first, I code DigramGenerator xtend class.
However, I do not know how to code, how this xtext-model to generate SModel.
When I try to code, the import element form language server is error
error: import org.xtext.example.mydsl1.mydsl.UseCase
error: import org.xtext.example.mydsl1.mydsl.Actor
why the program has this import errors?

[original thread by username123wy]

cc @spoenemann @jankoehnlein


Could you provide a bit more context? Are you coding the generator in Xtend or Java? Are Actor and UseCase classes of your Ecore model? Are you using a generated Ecore model or an imported one in the grammar? In case of the former, did you run the Xtext generator (mwe2 workflow) to generate the Java classes from the Ecore classes?