Add Xtext content to toolbar [message #1815971] |
Wed, 16 October 2019 07:37  |
Eclipse User |
|
|
|
Hello everyone,
I have followed this example and I was able to add a preference setting "icon" to the toolbor.
Now, I wish to further extend this. I have created a new file wizard and new project wizard.
I wish to create dedicated icons for these functionalities on the toolbar.
My question is: How can I create command for MyDslProjectTemplateProvider and MyDslFileTemplateProvider or how to call them in the execute method of MyAbstractHandlerImplementation? (As shown here.)
|
|
|
|
|
|
|
Re: Add Xtext content to toolbar [message #1816059 is a reply to message #1816027] |
Fri, 18 October 2019 06:52   |
Eclipse User |
|
|
|
Sorry, I was unclear beforehand... Let me rephrase the question:
I have added fileWizard and projectWizard {generate=true} to the mwe2 file of my language.
This generated org.eclipse.xtext.mydsl.ui.wizard package with MyDslFileTemplateProvider and MyDslProjectTemplateProvider in it (implementing IFileTemplateProvider and IProjectTemplateProvider respectively).
This is working fine, if I select the New -> Other... option, then I can select MyDsl -> MyDsl File and MyDsl Project in it. The files and projects are created properly after selection.
I want to create dedicated buttons on the toolbar for these two selections (wizards).
My question is: How can I do this?
-My first idea was to create a package, where I invoke the MyDslFileTemplateProvider. This is the point, where I have no idea how to do this.
-Afterwards, I have followed the idea of @Tamas and created a parametrized command, Here, I have replaced the org.eclipse.xtext.example.fowlerdsl.ui.wizard.StatemachineNewProjectWizard with org.eclipse.xtext.mydsl.ui.wizard.MyDslFileTemplateProvider, but this unfortunately resulted Eclipse error ("Unable to generate parametrized command..."). However, the icon is on the toolbar, but it is deactivated.
My guess would be that the parametrized command also expects to invoke somehow MyDslFileTemplateProvider. Am I correct here? (I guess this leads to my previous point.)
[Updated on: Fri, 18 October 2019 06:54] by Moderator
|
|
|
|
|
|
Re: Add Xtext content to toolbar [message #1816079 is a reply to message #1816069] |
Sat, 19 October 2019 06:42  |
Eclipse User |
|
|
|
Actually the Xtext team tries to give its best to provide APIs that are self-explanatory. However, if something is understandable for us, it does not mean that it is directly understandable to our users.
That's why such feedbacks from the Xtext users are very valuable to us to know how to improve the Xtext framework in the future!
I created an Xtext issue to extend the Wizard Fragment be able to generate such toolbar buttons for the New Project Wizard / New File Wizard.
[Updated on: Sat, 19 October 2019 06:44] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.04031 seconds