Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EEF] Custom Toolkit Widgets
[EEF] Custom Toolkit Widgets [message #622996] Wed, 16 June 2010 20:57 Go to next message
Mike Morrell is currently offline Mike Morrell
Messages: 2
Registered: June 2010
Junior Member
I have created a custom combo viewer control and I would like to use it as a custom toolkit widget for one of my properties. Is it possible to extend the code generator to use my custom widget? I created a custom.toolkit model and added my custom widget to it. I then linked to it from my *.components file. When I generate the EEF architecture the code generator throws an error when I get to the custom widget. I think it is because there is no code template for my custom widget. Is there a way to add a dynamic code generation template so my widget will be generated?
Re: [EEF] Custom Toolkit Widgets [message #623000 is a reply to message #622996] Mon, 21 June 2010 10:26 Go to previous messageGo to next message
Stephane Bouchet is currently offline Stephane Bouchet
Messages: 258
Registered: July 2009
Senior Member
Hi mike,

you have done the first part of the job.

We are writing a wiki page that will explain in details what you have to
do.
the difficult part is that you hve to create a new Acceleo generator
project and extends some of the templates with guards that are compliant
with your widget.


Sorry for the delay,

Stephane

Le 17/06/2010 02:57, Mike Morrell a écrit :
> I have created a custom combo viewer control and I would like to use it
> as a custom toolkit widget for one of my properties. Is it possible to
> extend the code generator to use my custom widget? I created a
> custom.toolkit model and added my custom widget to it. I then linked to
> it from my *.components file. When I generate the EEF architecture the
> code generator throws an error when I get to the custom widget. I think
> it is because there is no code template for my custom widget. Is there a
> way to add a dynamic code generation template so my widget will be
> generated?
Re: [EEF] Custom Toolkit Widgets [message #623141 is a reply to message #622996] Mon, 16 August 2010 13:02 Go to previous messageGo to next message
Joshua Baran is currently offline Joshua Baran
Messages: 4
Registered: August 2010
Junior Member
I'm also interested in adding some custom widgets. Is this wiki page complete yet? If so, please post a link to it.

Thanks,
Josh
Re: [EEF] Custom Toolkit Widgets [message #623144 is a reply to message #623141] Thu, 19 August 2010 07:36 Go to previous messageGo to next message
Florian Barbin is currently offline Florian Barbin
Messages: 31
Registered: August 2010
Member
Hi Josh,

Unfortunately we didn't have time to progress on that tutorial. We hope to make it available very soon.

Florian
Re: [EEF] Custom Toolkit Widgets [message #623145 is a reply to message #622996] Thu, 19 August 2010 09:49 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 522
Registered: July 2009
Senior Member
This isn't that hard actually.
You create a plug-in that has the acceleo nature.
You then have to code 4 templates for each widget.
You'll find the templates to override in org.eclipse.emf.eef.codegen.widgets.api.
The best solution is to take as exemple the existing widgets.

Once you've done that you have to use the 'org.eclipse.acceleo.engine.dynamic.templates' extension point on your plug-in and add as templates the path of the templates you defined.

The plug-in has to be loaded to be used at the generation time so you can't have it in the same workspace as your EEF project I guess. Either you have to export it in a jar format or you launch a dynamic eclipse instance and generate your EEF project in this new workspace.
Re: [EEF] Custom Toolkit Widgets [message #623146 is a reply to message #622996] Thu, 19 August 2010 15:16 Go to previous messageGo to next message
Joshua Baran is currently offline Joshua Baran
Messages: 4
Registered: August 2010
Junior Member
Great, with that help I was able to get it working.

Thanks!
Re: [EEF] Custom Toolkit Widgets [message #645488 is a reply to message #623146] Fri, 17 December 2010 07:35 Go to previous messageGo to next message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 914
Registered: July 2009
Senior Member
On 19-08-10 21:16, Joshua Baran wrote:
> Great, with that help I was able to get it working.
>

Hi Joshua, Could you share the plugin with your custom widgets?
(I am interrested in the codegen templates you use, and how you hook
them for your widget).

Thanks Christophe

> Thanks!
>
Re: [EEF] Custom Toolkit Widgets [message #662097 is a reply to message #622996] Tue, 29 March 2011 05:44 Go to previous messageGo to next message
Aur is currently offline Aur
Messages: 29
Registered: August 2010
Junior Member
Hi all,

I know that this topic is a bit old but I'm facing the same problem, so I hope someone could give a solution Smile

I'm trying to add a custom SWT Widget in the EEF generation process. So thanks to the previous message, I managed to create a .toolkits model in which I added my widget. Then I loaded this resource in the .components model and I am now able to select my widget in the representation field.

I also coded the 4 templates (xxControl, xxGettersSetters, xxSWTImpl, xxFormImpl), taking example on org.eclipse.emf.eef.codegen.widgets.impl.text templates.

But when I try to generate the project code thanks to my .eefgen model, some errors raise and I am not able to produce what I want.

Error: Problem while Organize Imports : project_path.edit/src-gen/class_using_my_widget.java

In the generated code there are many messages like:

xxPropertiesEditionPart.java :

public //FIXME ERROR INVALID CASE INTO template public toJavaType(view : ViewElement) in common.mtl module for representation EMigPropertyEditor getValue();

public void setValue(//FIXME ERROR INVALID CASE INTO template public toJavaType(view : ViewElement) in common.mtl module for representation EMigPropertyEditor newValue);

xxPropertiesEditionPartForm.java :

//FIXME INVALID CASE INTO template public widgetDeclaration(editor : ElementEditor) in viewFormUtils.mtl module


//FIXME INVALID CASE INTO template public implementation(editor : ViewElement, pec : PropertiesEditionComponent) in viewUtils.mtl module

So if someone has any idea ...

Thanks in advance

[Updated on: Thu, 31 March 2011 10:17]

Report message to a moderator

Re: [EEF] Custom Toolkit Widgets [message #662957 is a reply to message #622996] Fri, 01 April 2011 11:06 Go to previous messageGo to next message
Aur is currently offline Aur
Messages: 29
Registered: August 2010
Junior Member
It seems to be due to the statements defined in org.eclipse.emf.eef.codegen.services.common.mtl, so I decided to overrides the behavior of the template toJavaType(view : ViewElement).
I added the Java object corresponding to my view (a String) and when I start a new instance of Eclipse with my plug-ins, the EEF generation process works well.

Then I decided to package my set of plug-in thanks to an ANT task, and I tried to used acceleoCompiler task in order to compile my *.mtl modules.

But I have got several errors due to the fact that EEF modules are not found in my tasks:

Quote:
acceleo.compile:
[acceleoCompiler] commonExtension.mtl
[acceleoCompiler] 2:Module org::eclipse::emf::eef::codegen::services::common not found.
...


I don't know why modules are not found during the compilation, I added the following .jar in my ANT classpath configuration:

org.eclipse.acceleo.common
org.eclipse.acceleo.model
org.eclipse.acceleo.parser
org.eclipse.core.runtime
org.eclipse.emf.ecore
org.eclipse.emf.ecore.xmi
org.eclipse.ocl
org.eclipse.ocl.ecore
org.eclipse.emf.eef.codegen => this one containes acceleo modules I'd like to extend.

I hope someone could help me and if I find the solution I'll post it there.

Thanks in advance,

Aurélien

Re: [EEF] Custom Toolkit Widgets [message #664087 is a reply to message #622996] Thu, 07 April 2011 08:56 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane Begaudeau
Messages: 406
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Aurelien,

The support for Ant in Acceleo has been improved for Acceleo 3.1.0 M7 that will be released soon. If you want to build your project with Ant you should take example on the new version of the generation task.

<?xml version="1.0" encoding="UTF-8"?>
<project default="generateJava" name="org.eclipse.acceleo.module.example.uml2java.helios">
    <property name="ECLIPSE_HOME" value="../../"/>
    <property name="ECLIPSE_WORKSPACE" value="../"/>
    <path id="org.eclipse.acceleo.module.example.uml2java.helios.libraryclasspath">
        <pathelement location="../org.eclipse.acceleo.module.example.uml2java.helios/bin"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.6.0.v20100505.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.6.0.v20100517.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.6.0.v20100503.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.5.0.v20100515.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime.compatibility.registry_3.3.0.v20100520/runtime_registry_compatibility.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.5.0.v20100503.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.3.0.v20100503.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.4.100.v20100505-1235.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.3.0.v20100512.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.uml_3.1.0.v201006071150.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.6.1.v20100914-1218.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.6.0.v20100914-1218.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.5.0.v20100521-1846.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.uml2.common_1.5.0.v201005031530.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl_3.0.0.v201005061704.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/lpg.runtime.java_2.0.17.v201004271640.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_3.0.0.v201005061704.jar"/>
        <pathelement location="${ECLIPSE_HOME}/workspace_Traceability/org.eclipse.acceleo.model/bin"/>
        <pathelement location="${ECLIPSE_HOME}/workspace_Traceability/org.eclipse.acceleo.engine/bin"/>
        <pathelement location="${ECLIPSE_HOME}/workspace_Traceability/org.eclipse.acceleo.common/bin"/>
        <pathelement location="${ECLIPSE_HOME}/workspace_Traceability/org.eclipse.acceleo.profiler/bin"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen.ecore_2.6.1.v20100914-1218.jar"/>
        <pathelement location="${ECLIPSE_HOME}/plugins/org.eclipse.emf.codegen_2.6.0.v20100914-1218.jar"/>
    </path>
    <path id="org.eclipse.acceleo.module.example.uml2java.helios.classpath">
        <path refid="org.eclipse.acceleo.module.example.uml2java.helios.libraryclasspath"/>
    </path>

    <target name="generateJava">

        <java classname="org.eclipse.acceleo.module.example.uml2java.helios.GenerateJava" classpathref="org.eclipse.acceleo.module.example.uml2java.helios.classpath">
            <arg value="model"/>
            <arg value="target"/>
        </java>

    </target>

</project>



You should just have to replace the call to the "Generate.java" class to a call to the Acceleo compiler with your parameters.

If you want to build with the existing Ant task to deploy an Acceleo generator, you can just let Eclipse do the job, it will call the Ant task to compile with the AcceleoCompiler. In order to do that: blog

In any way, make sure that you are using the latest release of Acceleo from the Acceleo update site since we have improved the Ant compilation in the 3.0.2 release:
3.0.x -> http://download.eclipse.org/modeling/m2t/acceleo/updates/rel eases/3.0

Or you could try the latest nightly build of Acceleo 3.1 here:
3.1 -> http://download.eclipse.org/modeling/m2t/acceleo/updates/nig htly/3.1


Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Acceleo wiki: http://wiki.eclipse.org/Acceleo
Blogs: http://stephanebegaudeau.tumblr.com & http://sbegaudeau.tumblr.com




Re: [EEF] Custom Toolkit Widgets [message #664287 is a reply to message #622996] Fri, 08 April 2011 05:40 Go to previous messageGo to next message
Aur is currently offline Aur
Messages: 29
Registered: August 2010
Junior Member
Hi Stephane,

Thanks for your help, I will try to compile thanks to this example.
Re: [EEF] Custom Toolkit Widgets [message #672025 is a reply to message #664287] Thu, 19 May 2011 11:39 Go to previous message
Nathalie  is currently offline Nathalie
Messages: 22
Registered: July 2009
Junior Member
Hello,

I know the post is kind of old but I really hope to get some answers.

I would like to know if the wiki page that is mentioned above will be available soon. I need to have an editable Combo viewer for my EEF editor and I don't even know where to start.

Mike Morell said "I have created a custom combo viewer control" and "I created a custom.toolkit model and added my custom widget to it", does anyone know which steps to follow to do that?

Thank you.
Previous Topic:Set MatchEngine ?
Next Topic:EMF Compare problem comparing instances
Goto Forum:
  


Current Time: Fri Aug 29 04:14:21 EDT 2014

Powered by FUDForum. Page generated in 0.03681 seconds