0
votes

I use Xtext (Eclipse: Oxygen.2 Release (4.7.2), Xtext: 2.12.0.v20170519-1412). I've started with the standard example org.xtext.example.mydsl. Now I want to have a wizard in Eclipse for my DSL (like File → New → Project...). How do I do this? I found out by googling that I need to add this section to my MWE2 Workflow:

newProjectWizardForEclipse = {
            generate = true
         }

I did this, and I also get generated package org.xtext.example.mydsl.ui.wizard with source files MyDslProjectInfo.java, MyDslWizardNewProjectCreationPage.java and MyDslNewProjectWizardInitialContents.xtend. However, if I start the new Eclipse runtime instance for MyDsl, there is no option for my own wizard (but other things work as expected, i.e. I can manually create a new *.mydsl file and it's correctly handled according to my grammar etc.)

What am I doing wrong or do I misunderstand something? Here is my complete .mwe2 file.

module org.xtext.example.mydsl.GenerateMyDsl

import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*

var rootPath = ".."

Workflow {

    component = XtextGenerator {
        configuration = {
            project = StandardProjectConfig {
                baseName = "org.xtext.example.mydsl"
                rootPath = rootPath
                runtimeTest = {
                    enabled = true
                }
                eclipsePlugin = {
                    enabled = true
                }
                eclipsePluginTest = {
                    enabled = true
                }
                createEclipseMetaData = true
            }
            code = {
                encoding = "windows-1252"
                lineDelimiter = "\r\n"
                fileHeader = "/*\n * generated by Xtext \${version}\n */"
            }
        }
        language = StandardLanguage {
            name = "org.xtext.example.mydsl.MyDsl"
            fileExtensions = "mydsl"

            serializer = {
                generateStub = false
            }
            validator = {
                // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
            }

            // ---> I added this section, everyting else is standard example
            newProjectWizardForEclipse = {
               generate = true
            }
        }
    }
}
1

1 Answers

1
votes

it can be that xtext cannot merge plugin.xml automatically. then a plugin.xml_gen is generated that you have to merge manually into plugin.xml