Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Texo] My template overrides are not being used(Odd properties problem...)
[Texo] My template overrides are not being used [message #760580] Sat, 03 December 2011 06:28 Go to next message
Ray Kelm is currently offline Ray Kelm
Messages: 20
Registered: July 2009
Junior Member
I've been using Texo for a while now with Eclipse Helios, and wanted to make sure that updating to Indigo would not cause me any headaches, so I did some testing.

I installed a fresh copy of Eclipse Indigo SR1 for Java, installed EMF, Ecore tools, and Texo. I'm running on Linux, and my default file encoding is UTF-8.

I created a new workspace, then created a new java project, added the Texo nature, pasted in a model and templates, editted the project Texo properties, and tried to generated model code.

The result was that it generated code using the built-in Texo templates, and not using my own.

I had copied the model/templates from an older project created with Eclipse Helios, which correctly uses the override templates.

With a little digging I found that in Indigo, my TEMPLATE_FOLDER is in (project)/.settings/org.eclipse.emf.texo.prefs, and is set correctly.

Oddly, in the Helios workspace, the configuration is in (workspace)/.metadata/.plugins/org.eclipse.core.resources/.indexes/properties.index.

I updated my Helios installation to the current version of Texo, and had the same behavior on Helios with a new project. After updating, I was unable to edit the Texo project properties to change the templates folder. Doing so would not let me exit the preferences window by clicking OK. Only Cancel.

Has anyone else seen this issue?

Has something changed in the past few months with regard to how Texo project settings are stored?

Am I doing something wrong?

Re: [Texo] My template overrides are not being used [message #760581 is a reply to message #760580] Sat, 03 December 2011 06:41 Go to previous messageGo to next message
Ray Kelm is currently offline Ray Kelm
Messages: 20
Registered: July 2009
Junior Member
Manually creating the ".settings" folder in my project solved the issue of being able to change the TEMPLATE_FOLDER in the preferences editor. I'll file a bug for that issue.

It's odd that I can still only successfully generate code using my templates in the original project and not in the new one, which is very nearly a duplicate.
Re: [Texo] My template overrides are not being used [message #760610 is a reply to message #760581] Sat, 03 December 2011 13:29 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Ray,
What you see is a change I did a few months back:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=315633

To store the project properties in the project itself. The advantage is that you can commit/push the project properties
to git/svn so that other developers will get the same settings.

So the issue is that if there is initially no .settings folder that the dialog can't be closed? Do you see anything in
the problems view?

Or do you have another issue that even if it is all set correctly in the .settings folder that still the code generation
does not use the custom templates?

gr. Martin

On 12/03/2011 07:41 AM, Ray Kelm wrote:
> Manually creating the ".settings" folder in my project solved the issue of being able to change the TEMPLATE_FOLDER in
> the preferences editor. I'll file a bug for that issue.
>
> It's odd that I can still only successfully generate code using my templates in the original project and not in the new
> one, which is very nearly a duplicate.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Texo] My template overrides are not being used [message #760631 is a reply to message #760610] Sat, 03 December 2011 17:55 Go to previous messageGo to next message
Ray Kelm is currently offline Ray Kelm
Messages: 20
Registered: July 2009
Junior Member
It looks like it's two distinct issues.

1. If there is no ".settings" folder, the preferences dialog cannot be closed with the "OK" button.
2. Even with the TEMPLATE_FOLDER set to model/templates, and a template file in model/templates/org/eclipse/emf/texo/modelgenerator/templates/model.xpt, it still is using the built-in templates.

Filed Bug 365508 for the first problem.

The second is most likely something that I'm doing wrong, but I'm just not sure what it is.
Re: [Texo] My template overrides are not being used [message #760649 is a reply to message #760631] Sat, 03 December 2011 20:29 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Can you zip up your project and put it somewhere were I can download it (or email it directly to me at: mtaal@elver.org)?

gr. Martin

On 12/03/2011 06:55 PM, Ray Kelm wrote:
> It looks like it's two distinct issues.
>
> 1. If there is no ".settings" folder, the preferences dialog cannot be closed with the "OK" button.
> 2. Even with the TEMPLATE_FOLDER set to model/templates, and a template file in
> model/templates/org/eclipse/emf/texo/modelgenerator/templates/model.xpt, it still is using the built-in templates.
>
> Filed https://bugs.eclipse.org/bugs/show_bug.cgi?id=365508 for the first problem.
>
> The second is most likely something that I'm doing wrong, but I'm just not sure what it is.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Texo] My template overrides are not being used [message #815430 is a reply to message #760649] Wed, 07 March 2012 16:53 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 4
Registered: March 2012
Junior Member
Hello,

I'm trying Texo with indigo and the Templates folder property is not working.
When I debug, I found that templateFolderPath in TexoResourceManager is always null
public static final QualifiedName TEMPLATE_FOLDER_PROPERTY = new QualifiedName("org.eclipse.emf.texo.eclipse", "TEMPLATE_FOLDER");
final String templateFolderPath = project.getPersistentProperty(TEMPLATE_FOLDER_PROPERTY);

I don't know if it's an eclipse bug.

Beside that the OUPUT_FOLDER property seams to work. :/

PS : After test we have the same probleme with helios.

Jerome.
Re: [Texo] My template overrides are not being used [message #816028 is a reply to message #815430] Thu, 08 March 2012 10:35 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 4
Registered: March 2012
Junior Member
For now I will patch myself the org.eclipse.emf.texo.eclipse, but tell me if a another way is better to follow
Class : ProjectPropertyUtil.java

Quote:

/**
* Set the project properties in the .settings folder.
*/
public static void setProjectProperties(IProject project, String outputLocation, String templateLocation)
throws CoreException {
final Properties props = new Properties();
if (templateLocation != null) {
props.setProperty(TEMPLATES_LOCATION_PROPERTY, templateLocation);
project.setPersistentProperty(TexoResourceManager.TEMPLATE_FOLDER_PROPERTY, templateLocation);
}
props.setProperty(OUTPUT_LOCATION_PROPERTY, outputLocation);
project.setPersistentProperty(GEN_OUTPUT_FOLDER_PROPERTY, outputLocation);
final File file = getPropertiesFile(project);
try {
final OutputStream os = new FileOutputStream(file, false);
props.store(os, null);
os.close();
} catch (IOException e) {
throw new IllegalStateException("Error writing to file " + file.toString()); //$NON-NLS-1$
}

project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
}


Thanks,

Jerome.
Re: [Texo] My template overrides are not being used [message #816065 is a reply to message #816028] Thu, 08 March 2012 11:32 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Jerome,
Strange, strange and strange,
in the .settings folder of the project do see a file like this:
org.eclipse.emf.texo.prefs

and if so what is its content?

gr. Martin

On 03/08/2012 11:35 AM, Missing name Mising name wrote:
> For now I will patch myself the org.eclipse.emf.texo.eclipse, but tell me if a another way is better to follow Class :
> ProjectPropertyUtil.java
>
> Quote:
>> /**
>> * Set the project properties in the .settings folder.
>> */
>> public static void setProjectProperties(IProject project, String outputLocation, String templateLocation)
>> throws CoreException {
>> final Properties props = new Properties();
>> if (templateLocation != null) {
>> props.setProperty(TEMPLATES_LOCATION_PROPERTY, templateLocation);
>> project.setPersistentProperty(TexoResourceManager.TEMPLATE_FOLDER_PROPERTY, templateLocation);
>> }
>> props.setProperty(OUTPUT_LOCATION_PROPERTY, outputLocation);
>> project.setPersistentProperty(GEN_OUTPUT_FOLDER_PROPERTY, outputLocation);
>> final File file = getPropertiesFile(project);
>> try {
>> final OutputStream os = new FileOutputStream(file, false);
>> props.store(os, null);
>> os.close();
>> } catch (IOException e) {
>> throw new IllegalStateException("Error writing to file " + file.toString()); //$NON-NLS-1$
>> }
>>
>> project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
>> }
>
>
> Thanks,
>
> Jerome.


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Texo] My template overrides are not being used [message #816090 is a reply to message #816065] Thu, 08 March 2012 12:14 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 4
Registered: March 2012
Junior Member
Hi Martin,

Yes the file is correctly formatted and the "ProjectPropertyUtil.getProjectProperties(IProject project)" read the property correctly, but it's read by the "props.load(is);" method and not by the "project.getPersistentProperty" which return null.
After that the property is never set in the .metadata by the method "project.setPersistentProperty" (maybe I miss where it's must be done), and as the TexoResourceManager only read with getProjectProperties, it cannot found the property. That's why I set it in the "ProjectPropertyUtil.setProjectProperties(IProject, String, String)" but as I as said maybe it must be done in an another place or by eclipse itself.

Jerome.

[Updated on: Fri, 09 March 2012 08:09]

Report message to a moderator

Re: [Texo] My template overrides are not being used [message #817102 is a reply to message #816090] Fri, 09 March 2012 16:32 Go to previous messageGo to next message
Martin Taal is currently offline Martin Taal
Messages: 5339
Registered: July 2009
Senior Member
Hi Jerome,
I published a new build which should solve this issue, can you give it a try?

gr. Martin

On 03/08/2012 01:14 PM, Missing name Mising name wrote:
> Hi Martin,
>
> Yes the file is correctly formatted and the "ProjectPropertyUtil.getProjectProperties(IProject project)" read the
> property correctly, but it's read by the "props.load(is);" method and not by the "project.getPersistentProperty" which
> return null.
> After that the property is never set in the .metadata by the method "project.setPersistentProperty" (maybe I miss where
> it's must be done), and as the TexoResourceManager only read here, it cannot found the property. That's why I set it in
> the "ProjectPropertyUtil.setProjectProperties(IProject, String, String)" but as I as said maybe it must be done in an
> another place or by eclipse itself.
>
> Jerome.
>


--

With Regards, Martin Taal

Springsite/Elver.org
Office: Hardwareweg 4, 3821 BV Amersfoort
Postal: Nassaulaan 7, 3941 EC Doorn
The Netherlands
Cell: +31 (0)6 288 48 943
Tel: +31 (0)84 420 2397
Fax: +31 (0)84 225 9307
Mail: mtaal@springsite.com - mtaal@elver.org
Web: www.springsite.com - www.elver.org
Re: [Texo] My template overrides are not being used [message #818902 is a reply to message #817102] Mon, 12 March 2012 09:00 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 4
Registered: March 2012
Junior Member
Hello

It works perfectly, thank you very much Martin.

Jerome.
Re: [Texo] My template overrides are not being used [message #973374 is a reply to message #760580] Tue, 06 November 2012 09:25 Go to previous message
Pradeep Badiger is currently offline Pradeep Badiger
Messages: 53
Registered: November 2012
Member
Hello Ray,

Can you tell me how did you install Texo plugins in Eclipse Helios?

Can you share the update url for Texo on Helios/Indigo?

I get an error while installing texo. Can you share the Texo and Helios/Indigo configurations.

thanks,
Pradeep V.B.
Previous Topic:[EDAPT] Migration validation issue
Next Topic:Texo on Indigo Windows 32 bit
Goto Forum:
  


Current Time: Wed Oct 22 06:33:43 GMT 2014

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

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