Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to build a plugin?(Just for integration into any exclipse environment)
icon5.gif  How to build a plugin? [message #555823] Sun, 29 August 2010 08:49 Go to next message
Bodo is currently offline BodoFriend
Messages: 27
Registered: August 2010
Junior Member
Now I managed to build my grammar, check the semantic via validation, and do the coding. All worked fine.

Now I wonder, how to do for generating a plugin, that can imported be other eclipse environments. This may be not a special Xtext question, but I assume that many users already did that and can give me a hint or URL with infos about plugin generation for Xtext DSLs.

Regards

Bodo
Re: How to build a plugin? [message #555858 is a reply to message #555823] Sun, 29 August 2010 17:26 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
Hi,

there are two main interpretations to the question.
1) How to have "a" plugin with the editor for the DSL that can be used by others. The two(three) projects initially created by the Xtext wizard are already plugins that can be shared with others in the standard eclipse ways (drop-in folder, update site, product export etc).

2) How do I generate a plugin that is somehow modelled using my DSL. Here the answer is. You simply have to generate all artefacts that make up a plugin, i.e. not only the java classes but also the .project, .classpath, plugin.xml etc. files.

Alex
Re: How to build a plugin? [message #556683 is a reply to message #555858] Thu, 02 September 2010 10:33 Go to previous messageGo to next message
Bodo is currently offline BodoFriend
Messages: 27
Registered: August 2010
Junior Member
I have tried hard to solve this, but didn't succeed.

I build the jar files via export and just to prove zip-ed all from the workspace (except src).

Nothing works! I checked the plugin be looking at the registery (Window-Show View-Others ... / Plug-in Development -> Plug-in Registery). Noting were in there.

Than I tried a dummy plugin and this works. But the plugin.xml of this is quit different to that of the Xtext generated one!

What shall I do to get the needed jar-file?

Any help is appreciated.

Bodo

PS: plugin.xml and the META-stuff were included.
PPS: If I tried my DSL with invoking Eclipse Application, than there is a registered plugin.

[Updated on: Thu, 02 September 2010 10:36]

Report message to a moderator

Re: How to build a plugin? [message #556690 is a reply to message #556683] Thu, 02 September 2010 10:49 Go to previous messageGo to next message
Alexander Nittka is currently offline Alexander NittkaFriend
Messages: 1193
Registered: July 2009
Senior Member
After having built the dsl jars. Into which kind of eclipse did you try to put them, because it has to contain all the plugins required by your Xtext project (they are not included in the jars).
Have you tried putting them into the dropin folder of your development eclipse (that one should contain all dependencies).

Alex
Re: How to build a plugin? [message #556694 is a reply to message #556683] Thu, 02 September 2010 11:05 Go to previous messageGo to next message
Ralf Ebert is currently offline Ralf EbertFriend
Messages: 72
Registered: July 2009
Member
Hi Bodo,

> What shall I do to get the needed jar-file?

I'd create a feature that contains all your plug-ins and has a
dependency to the feature 'org.eclipse.xtext.sdk'. You can export this
as p2 repository using 'Export > Deployable feature' and install it into
other IDE installations using a local software site. Xtext should be
installed because of the dependency to the feature automatically. Please
note that it's not supported anymore to just throw jars into the plug-in
folder of Eclipse to install things, if you want to use local folders
using jar files you have to use the dropins folder (
http://wiki.eclipse.org/Equinox_p2_Getting_Started#Dropins ), but it
wont resolve dependencies that way.

Ralf
Re: How to build a plugin? [message #556808 is a reply to message #556694] Thu, 02 September 2010 16:36 Go to previous messageGo to next message
Bodo is currently offline BodoFriend
Messages: 27
Registered: August 2010
Junior Member
Hi Ralf,

thank you very much for your reply. But I am a little confused. I build a sample plug in (after the book 'Eclipse, building commercial-quality plug-ins) and drop this in the plugins folder, and it works!
Ralf Ebert wrote on Thu, 02 September 2010 07:05
... Please
note that it's not supported anymore to just throw jars into the plug-in
folder of Eclipse to install things, ...


But it seems to be very very complicated, to generate a plug-in jar-file correctly and to install it. I wonder if any other user, already build DSLs, didn't had have this problem and solved them?

What does eclipse do, if I invoke my DSL via ran as->Eclipse Application? Where it fetched all the needed stuff and what exactly is needed?

Please, help

Bodo
Re: How to build a plugin? [message #556814 is a reply to message #556808] Thu, 02 September 2010 17:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi Ralf

You probably need to do it the correct way.

An Eclipse project is installed via an Update Site
An Update Site contains (a hierarchy of) one or more features
A feature contains one or more plugins and or features

The New Project->Plugin Development wizards will help you create
Feature and Update Site projects.

Regards

Ed Willink

On 02/09/2010 17:36, Bodo wrote:
> Hi Ralf,
>
> thank you very much for your reply. But I am a little confused. I build
> a sample plug in (after the book 'Eclipse, building commercial-quality
> plug-ins) and drop this in the plugins folder, and it works!
> Ralf Ebert wrote on Thu, 02 September 2010 07:05
>> ... Please note that it's not supported anymore to just throw jars
>> into the plug-in folder of Eclipse to install things, ...
>
>
> But it seems to be very very complicated, to generate a plug-in jar-file
> correctly and to install it. I wonder if any other user, already build
> DSLs, didn't had have this problem and solved them?
>
> What does eclipse do, if I invoke my DSL via ran as->Eclipse
> Application? Where it fetched all the needed stuff and what exactly is
> needed?
>
> Please, help
>
> Bodo
>
Re: How to build a plugin? [message #556872 is a reply to message #556808] Thu, 02 September 2010 22:41 Go to previous message
Henrik Lindberg is currently offline Henrik LindbergFriend
Messages: 2509
Registered: July 2009
Senior Member
I would use:
- a "template plugin" in source form. Copy that, and generate the code
from a .mydsl into the copy. Generate the template by using one of the
wizards in the Eclipse IDE, and remove sample code.

- a "template feature" in source form. Copy that, and make this feature
depend on the generated plugin (or possible several generated plugins
dependent on your use case). This feature represents what the user see
as "something installable" in the standard p2 ui inside Eclipse, so you
want it categorized appropriately. (It is possible to install bundles
directly using p2, but not easily via the UI - hence the use of a feature).

There are several ways to get from this point to having the features and
plugins in a p2 repository. What I would do is to create an additional
feature that represents the p2 site, and use buckminster to build the p2
repository. This feature basically just has to refer to the features
that you want included in your p2 update site.

How many features you use depends on your use cases (are you generating
one installable thing or several, is it meaningful to install many
etc.), do you want to have an update site with a growing number of
available installable things or do are they available on separate sites,
do you want an aggregate of all of them, do you want a user to be able
to install everything (including eclipse) by visiting just one site, or
do they already have eclipse, etc. etc. (Discussions about things in
this domain are best held in the Buckminster newsgroup)/forum).

The question what eclipse does when you launch a self hosted environment
is that it creates a configuration based on what you have in your target
platform, and what has been built in your workspace and then launches
that. You have control over how this is done in a launch configuration.
It is not doing a proper install of things, following dependencies etc.
you have to make sure everything required is included (which is most
often the case if using everything in the TP + workspace since you
managed to build what was there).

There are other alternative approaches - if you want code in .mydsl's to
be immediately runnable in the IDE used to edit/build them, you could
instead use an interpreter, or use ASM to generate byte codes, use
dynamically generated classes that you load yourself, or you could
generate javascript since there is good integration between java and JS.

For Eclipse b3 (the language I am developing) I picked the byte code
generation approach as what I wanted to do, but I started with an
interpreter/evaluator as it is a much convenient starting point and
easier to debug. In my case it is typically not meaningful for someone
to install what they have expressed in a .b3 file.

I hope this gives you some pointers to how you can proceed.

Regards
- henrik

On 9/2/10 6:36 PM, Bodo wrote:
> Hi Ralf,
>
> thank you very much for your reply. But I am a little confused. I build
> a sample plug in (after the book 'Eclipse, building commercial-quality
> plug-ins) and drop this in the plugins folder, and it works!
> Ralf Ebert wrote on Thu, 02 September 2010 07:05
>> ... Please note that it's not supported anymore to just throw jars
>> into the plug-in folder of Eclipse to install things, ...
>
>
> But it seems to be very very complicated, to generate a plug-in jar-file
> correctly and to install it. I wonder if any other user, already build
> DSLs, didn't had have this problem and solved them?
>
> What does eclipse do, if I invoke my DSL via ran as->Eclipse
> Application? Where it fetched all the needed stuff and what exactly is
> needed?
>
> Please, help
>
> Bodo
>
Previous Topic:Refererncing to existing items in Xtext
Next Topic:array in mwe
Goto Forum:
  


Current Time: Sat Apr 27 04:15:11 GMT 2024

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

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

Back to the top