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 |
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 #816028 is a reply to message #815430] |
Thu, 08 March 2012 10:35 |
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 |
Martin Taal Messages: 5468 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 |
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 |
Martin Taal Messages: 5468 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
|
|
| | |
Goto Forum:
Current Time: Wed Sep 25 02:44:23 GMT 2024
Powered by FUDForum. Page generated in 0.04744 seconds
|