Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext eclipse plugin(Xtext eclipse plugin)
Xtext eclipse plugin [message #1730532] Tue, 26 April 2016 14:13 Go to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi Christian,

How to create plugin for my dsl editor? I want an option like new custom project on tool bar
Re: Xtext eclipse plugin [message #1730534 is a reply to message #1730532] Tue, 26 April 2016 14:17 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Radhakrishna Kasiraju <forums-noreply@xxxxxxxx> wrote:
> Hi Christian,
>
> How to create plugin for my dsl editor? I want an option like new custom
> project on tool bar
>

Simply use the yourdsl.ui plugin
You get that if you select eclipse plugin in the wizard


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730539 is a reply to message #1730534] Tue, 26 April 2016 14:45 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
So can I add some custom option like : right click -> run as -> dsl2bin
Re: Xtext eclipse plugin [message #1730542 is a reply to message #1730539] Tue, 26 April 2016 14:56 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
"depends". these are more or less std. eclipse extension points. do you use xbase?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730543 is a reply to message #1730542] Tue, 26 April 2016 15:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
you may start digging in https://github.com/eclipse/xtext/blob/master/plugins/org.eclipse.xtend.ide/plugin.xml

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730552 is a reply to message #1730543] Tue, 26 April 2016 15:56 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
No christian I am not using xbase
Re: Xtext eclipse plugin [message #1730601 is a reply to message #1730552] Wed, 27 April 2016 05:03 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi Christian,

I want to create custom extension point when I right click on the dsl editor.

I saw the link you pointed but it is not clear. Could you please explain what I have to do?
Re: Xtext eclipse plugin [message #1730602 is a reply to message #1730601] Wed, 27 April 2016 05:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
something like that? https://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-context-menu/

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730617 is a reply to message #1730602] Wed, 27 April 2016 07:22 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi Christian,

Yes something like this I required.

In my xtext project there is no package like: "org.xtext.example.mydsl.ui.handler".

I am using xtext 2.9.

So where can I write
public class GenerationHandler extends AbstractHandler implements IHandler {

}
Re: Xtext eclipse plugin [message #1730622 is a reply to message #1730617] Wed, 27 April 2016 08:01 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
package org.xtext.example.mydsl.ui.handler

import org.eclipse.core.commands.AbstractHandler
import org.eclipse.core.commands.IHandler
import org.eclipse.core.commands.ExecutionEvent
import org.eclipse.core.commands.ExecutionException
import org.eclipse.jface.viewers.ISelection
import org.eclipse.ui.handlers.HandlerUtil
import org.eclipse.jface.viewers.IStructuredSelection
import org.eclipse.xtext.generator.IGenerator
import com.google.inject.Inject



import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;

import org.eclipse.xtext.resource.IResourceDescriptions;
import org.eclipse.xtext.ui.resource.IResourceSetProvider;

[Updated on: Wed, 27 April 2016 18:00]

Report message to a moderator

Re: Xtext eclipse plugin [message #1730623 is a reply to message #1730622] Wed, 27 April 2016 08:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
was replaced by EclipseResourceFileSystemAccess2

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730625 is a reply to message #1730623] Wed, 27 April 2016 08:13 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
may have different methods, params as well etc ..... in xtext 2.9 IGenerator2 is used instead of iGenerator .....

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730636 is a reply to message #1730625] Wed, 27 April 2016 09:40 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
No Message Body

[Updated on: Wed, 27 April 2016 18:00]

Report message to a moderator

Re: Xtext eclipse plugin [message #1730637 is a reply to message #1730636] Wed, 27 April 2016 09:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Looking in package explorer? File extension correct?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730645 is a reply to message #1730637] Wed, 27 April 2016 10:41 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi Christian,

It is working fine.
Re: Xtext eclipse plugin [message #1730647 is a reply to message #1730645] Wed, 27 April 2016 10:45 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi Christian,

AbstractHandler and IHandler are form which package we should use I mean from import org.eclipse.ui.commands.IHandler or import org.eclipse.core.commands.IHandler?
Re: Xtext eclipse plugin [message #1730648 is a reply to message #1730647] Wed, 27 April 2016 10:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
core. the other one is Deprecated

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730650 is a reply to message #1730648] Wed, 27 April 2016 10:53 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
No Message Body

[Updated on: Wed, 27 April 2016 17:59]

Report message to a moderator

Re: Xtext eclipse plugin [message #1730657 is a reply to message #1730650] Wed, 27 April 2016 13:02 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
no isEnabled, strange package naming? difference between java and plugin.xml ?!?

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730683 is a reply to message #1730657] Wed, 27 April 2016 15:53 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Could you please tell me what this line will do

fsa.generateFile(g.name+".txt",'''Hello «g.name» «IF g.from != null»from «g.from.name»«ENDIF»!''')

?
Re: Xtext eclipse plugin [message #1730687 is a reply to message #1730683] Wed, 27 April 2016 16:05 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
It will generate a text file contains all greetings from the file you
generate from


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730691 is a reply to message #1730687] Wed, 27 April 2016 16:43 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
No Message Body

[Updated on: Wed, 27 April 2016 17:59]

Report message to a moderator

Re: Xtext eclipse plugin [message #1730692 is a reply to message #1730691] Wed, 27 April 2016 16:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Please share all needed to reproduce

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730693 is a reply to message #1730692] Wed, 27 April 2016 16:55 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
I don't understand why it is not showing up .txt files inside src-gen folder.
Re: Xtext eclipse plugin [message #1730694 is a reply to message #1730693] Wed, 27 April 2016 16:57 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
As I said I need all relevant code

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730696 is a reply to message #1730694] Wed, 27 April 2016 17:06 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
No Message Body

[Updated on: Wed, 27 April 2016 17:58]

Report message to a moderator

Re: Xtext eclipse plugin [message #1730700 is a reply to message #1730696] Wed, 27 April 2016 17:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
HI,

you should be ablte to fix the npe yourself. the error message is 1000% clear

val EclipseResourceFileSystemAccess2 fsa = fileAccessProvider.get();
fsa.monitor = new NullProgressMonitor


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext eclipse plugin [message #1730754 is a reply to message #1730700] Thu, 28 April 2016 09:51 Go to previous messageGo to next message
RamaRao Nandamuri is currently offline RamaRao NandamuriFriend
Messages: 120
Registered: April 2016
Senior Member
Hi Christian,

I am new to xtext. I am trying to fix the error but no luck. I know i am giving lot of trouble.

I just followed your blog https://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-context-menu/

Everything is working fine except it is not showing up .txt file when I click on "Generate Code" in context menu but I placed loggers at different places to find the output.

Could you please let me know what is the problem with my code?

output for: srcGenFolder.getFullPath().toString()
is /JPLEditor/src-gen

output for: fsa.generateFile(g.name+".txt",'''Hello «g.name» «IF g.from != null»from «g.from.name»«ENDIF»!''')

println("Generate file::::::::::::"+g.name+".txt"+"::::::"+'''Hello «g.name» «IF g.from != null»from «g.from.name»«ENDIF»!''')

is Generate file::::::::::::test.txt::::::Hello test !
Re: Xtext eclipse plugin [message #1730756 is a reply to message #1730754] Thu, 28 April 2016 09:55 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Please share complete code as zip

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Xtext project build with Maven Tycho
Next Topic:Undo of StandaloneSetup ..?
Goto Forum:
  


Current Time: Fri Mar 29 00:42:28 GMT 2024

Powered by FUDForum. Page generated in 0.06000 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top