ekkes-corner: eclipse | osgi | mdsd | erp

July 28, 2009

HowTo Change FileEncoding of Eclipse Projects (OSX)

Filed under: Eclipse, EclipseCon, Galileo, OSX, openArchitectureWare — ekkescorner @ 8:37 am

If you followed my blogs you know that I just finished migration from oaw4 (http://openarchitectureware.org) to oaw5 (Eclipse Modeling: EMFT – MWE, M2T – Xpand, TMF – Xtext).

In oaw4 projects I used File Encoding ISO-8859-1 as global workspace setting:

workspace encoding oaw4

All Projects inherit File Encoding from container (Workspace) – so they also are using ISO-8859-1.

oaw – workflows (.oaw in oaw4 and .mwe in oaw5) are manually set to UTF-8:

workflow encoding oaw4

uml models, emf models, xml files are automatically detected by Eclipse as UTF-8:

encoding from content

Some workflows explicitely set File Encoding, per ex. using Xpand2 Generator Component, outlets etc:

encoding xpand2generator or outlet

Some years ago this was the only solution working for me using OSX and Windows and openArchitectureWare.

Converting from ISO-8859-1 to UTF-8

As result of some discussions at oaw-workinggroup mailing list it seems that using UTF-8 for all kind of oaw – templates should work on all platforms, so I decided to switch from ISO-8859-1 to UTF-8. Then its easy to handle: all files are using UTF-8, no manual settings, no workflow-specific settings and UTF-8 can be used from all OS and more languages then ISO-8859-1.

I did my tests on OSX and Windows and all works well, I can enter oaw’s special characters inside editors like

« ... »

At first let’s change the Workspace Preferences:

workspace encoding oaw5

But it’s nott only changing a preferences – value – it means all existing templates and other files have to be converted to use the new FileEncoding.

Here’s how I solved that:

1. Detect what kind of files have to be converted

Xtend templates (*.ext)
Xpand templates (*.xpt)
Check templates (*.chk)
properties files (*.properties)
java sourcecode files (*.java)
textfiles (*.txt)
  • Xtend templates (*.ext)
  • Xpand templates (*.xpt)
  • Check templates (*.chk)
  • properties files (*.properties)
  • java sourcecode files (*.java)
  • textfiles (*.txt)

2. HowTo convert file encoding of a bunch of files recursive

I’m working on OSX and there’s a built-in utility: iconv. That’s great because for this one-time work I don’t wanted to write code.

If you type iconv -l in terminal you’ll get the list of supported encodings.

Using the following command you can change the encoding of one file:

iconv -f ISO-8859-1 -t UTF-8 myFile.xyz > myFile.utf8abc

But there are many files to convert recursive in a whole workspace. It’s not my daily work to use bash shell in terminal, so I googled but got no good solution how to solve the issue.

Then I remembered the great keynote of http://stackoverflow.com from last EclipseCon and asked my question there. Soon later I got some tips and were able to create the command :-)

find /myPath2Workspace/myWorkspace -name \*.xpt -type f | \
	    (while read file; do
	        iconv -f ISO-8859-1 -t UTF-8 "$file" > "${file%.xpt}.utf8xpt";
	    done);

copy the command to Terminal:

iconv terminal

hit OK and the conversion was done. repeat this step for all kinds of files you want to convert.

3. Test the Conversion and Rename

Now you can take a look at the converted files and test visually if all was well converted.

Last step is deleting the old files (in the example above *.xpt) and renaming (in this case *.utf8xpt to *.xpt)

You can do all of this using commands in terminal, but I did it the OSX – UI – way:

To delete the old files I’m using OSX Spotlight: search for .xpt in the workspace directory, select all from result, move to trash.

Then search for .utf8xpt using Spotlight, move selection to NameChanger, rename from .utf8xpt to .xpt and you’re done.

Hint: I blogged about NameChanger here.

Now all my existing and new oaw5 projects are using UTF-8 :-)

June 30, 2009

[galileo] EPP for Cocoa 64-bit

Filed under: Eclipse, Galileo, OSX, P2 — ekkescorner @ 2:13 pm

You know from my Galileo – review – Blogs that I’m now working under OSX Cocoa-64bit.

If you try to download one of the easy-to-start EPP Packages for Galileo, there’s no Cocoa 64-bit – download available.

See a detailed discussion under Bugzilla 281501. Thanks to comment#39 from Markus Knauer there’s a Software Site wich helps you to get it:

http://download.eclipse.org/technology/epp/packages/galileo/

I also updated my collection of Software Sites here.

Now its easy:

  1. Download SDK Cocoa 64-bit
  2. Install New Software from EPP Packages
  3. Select your Package

and you’re done :-)

Eclipse EPP RCP Cocoa 64-bit

Use the EPP (P2) Software Site, choose your Package:

EPP RCP added

here are the Details:

EPP RCP added details

Finish -> Restart:

EPP RCP you got it

Now its easy to test all EPP Packages under Cocoa 64-bit :-)

December 10, 2008

Comparing Files And Folders After Codegeneration

Filed under: Eclipse, OSX, openArchitectureWare — ekkescorner @ 10:31 am
Eclipse has great possibilities to compare files and folders with each other or history.
But I’m also using external tools: 
Some time ago I blogged how to use NameChanger (Freeware) under OSX to rename files where the bundle names aren’t named like eclipse bundles (plug-ins) using “name_version“.
Also for creating of target platform – locations I’m using a tool to get unique sets of bundles. My blog „Avoid Duplicate Bundles“ desribes the use of FileMerge (under OSX part of XCode Tools).
Now I was looking for an intelligent tool to see if generated code is identical to an older version. This generated code is not checked into a sourcecode repository, because its always regenerated. Before starting the generation those directories werde cleared, so there’s also no local history in Eclipse.
While testing 4.3.1RC2 of openArchitectureWare I was interestd to see if the generated code is identical to version 4.3.0.
Its not so easy because there are some allowed differences like:
* generation started at: 9. Dezember 2008 08:04:13 CET
Those generation timestamps should be “identical” to lines with another timestamp. FileMerge from OSX was no help, because these files are reported as different.
Next try: Compare Folders compares the size of files and also reports added or missing files. If the generation timestamp hase same length, then the files are identical otherwise not: 
… I also dont know if the other content is identical – I need the compare more detailed. I found DeltaWalker where I can do waht I want. But the best of all is:
DeltaWalker is an Eclipse RCP Application :-)
…and available for OSX, Windows, Linux. Now it was easy to see if the generated code is the same as before:
Create a File – Filter, where lines of different generation timestamps are identical:
Create a Folder- Filter ignoring OSX-specific .DS_Store Files:
Then hitting Compare::
All the same :-)
congratulations openArchitectureWare 
- in all my projects no differences found between 4.3.0 and 4.3.1RC2 after re – generation.
Without the File – Filter DeltaWalker lists the differences:
…think that DeltaWalker will be a good helper and a great example for RCP Apps.

Next Page »

Blog at WordPress.com.