Index: TXM/trunk/bundles/org.txm.utils.core/.project
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/.project	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/.project	(revision 3666)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.utils.core</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Property changes on: TXM/trunk/bundles/org.txm.utils.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/juniversalchardet-1.0.3.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.utils.core/juniversalchardet-1.0.3.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.utils.core/commons-lang-2.4.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.utils.core/commons-lang-2.4.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/TimeFormatter.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/TimeFormatter.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/TimeFormatter.java	(revision 3666)
@@ -0,0 +1,90 @@
+package org.txm.utils;
+
+public class TimeFormatter {
+	public static String formatTime(String time) {
+		try {
+			return formatTime(Float.parseFloat(time));
+		} catch (Exception e) {
+			try {
+				return formatTime(Integer.parseInt(time));
+			} catch (Exception e2) {
+				return formatTime(0.0f);
+			}
+		}
+	}
+
+	/**
+	 * 
+	 * @param secondes
+	 *            number of seconde
+	 * @return
+	 */
+	public static String formatTime(int secondes) {
+		String rez = " ";
+		float h = secondes / 3600;
+		secondes = secondes % 3600;
+		float min = (secondes % 3600) / 60;
+		int sec = secondes % 60;
+		if (min < 10)
+			rez = "" + (int) h + ":0" + (int) min;// +":"+time%60;
+		else
+			rez = "" + (int) h + ":" + (int) min;// +":"+time%60;
+
+		if (sec >= 10)
+			rez += ":" + sec;
+		else
+			rez += ":0" + sec;
+
+		return rez;
+	}
+
+	/**
+	 * 
+	 * @param time
+	 *            0.00s
+	 * @return
+	 */
+	public static String formatTime(float time) {
+		String rez = " ";
+		float h = time / 3600;
+		time = time % 3600;
+		float min = (time % 3600) / 60;
+		int sec = (int) time % 60;
+		if (min < 10)
+			rez = "" + (int) h + ":0" + (int) min;// +":"+time%60;
+		else
+			rez = "" + (int) h + ":" + (int) min;// +":"+time%60;
+
+		if (sec >= 10)
+			rez += ":" + sec;
+		else
+			rez += ":0" + sec;
+
+		return rez;
+	}
+
+	/**
+	 * 
+	 * @param time
+	 *            0.00s
+	 * @return
+	 */
+	public static String formatTime(double time) {
+		String rez = " ";
+		double h = time / 3600;
+		time = time % 3600;
+		double min = (time % 3600) / 60;
+		int sec = (int) time % 60;
+		if (min < 10)
+			rez = "" + (int) h + ":0" + (int) min;// +":"+time%60;
+		else
+			rez = "" + (int) h + ":" + (int) min;// +":"+time%60;
+
+		if (sec >= 10)
+			rez += ":" + sec;
+		else
+			rez += ":0" + sec;
+
+		return rez;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/TimeFormatter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/UtilsCoreMessages.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/UtilsCoreMessages.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/UtilsCoreMessages.java	(revision 3666)
@@ -0,0 +1,41 @@
+package org.txm.utils.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Utils core messages.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class UtilsCoreMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.utils.messages.messages"; //$NON-NLS-1$
+
+	public static String ExecTimer_0;
+	public static String ExecTimer_1;
+	public static String ExecTimer_2;
+	public static String ExecTimer_3;
+	public static String Localizer_0;
+	public static String Localizer_1;
+	public static String FileCopy_0;
+	public static String FileCopy_2;
+	public static String FileCopy_4;
+	public static String LS_0;
+	public static String LS_1;
+	public static String Log_3;
+	public static String Log_5;
+	public static String Log_8;
+	public static String MessageBox_0;
+	public static String MessageBox_1;
+	public static String MessageBox_2;
+	public static String Pair_0;
+	public static String Pair_1;
+	public static String Sh_4;
+
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, UtilsCoreMessages.class);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/UtilsCoreMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/messages.properties
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/messages.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/messages.properties	(revision 3666)
@@ -0,0 +1,22 @@
+#TXM messages generated by the PluginMessagesManager class
+#Thu Dec 06 15:00:56 CET 2018
+Localizer_0=[Missing translation] 
+Pair_1=\ should be true
+Localizer_1=messages
+FileCopy_0=** File copy\: failed to find source\: 
+FileCopy_2=** File copy\: access right restriction to source\: 
+ExecTimer_3=h, 
+FileCopy_4=** File copy\: failed to create directory\: 
+Pair_0=\ should be false
+ExecTimer_0=msec
+ExecTimer_2=min and 
+ExecTimer_1=sec
+Sh_4=Process exited abnormally with code 
+Log_5=Start loging in 
+LS_1=is not a Directory\!
+Log_3=Copying logs in 
+LS_0=Error\: 
+MessageBox_0=Error
+MessageBox_1=Warning
+Log_8=\nstack\:\n
+MessageBox_2=Information

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/Utf8NLS.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/Utf8NLS.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/Utf8NLS.java	(revision 3666)
@@ -0,0 +1,60 @@
+package org.txm.utils.messages;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Class that manages UTF-8 encoding for .properties messages files.
+ * 
+ * @author sjacquot
+ *
+ */
+public class Utf8NLS extends NLS {
+
+	private static final int MOD_EXPECTED = Modifier.PUBLIC | Modifier.STATIC;
+	private static final int MOD_MASK = MOD_EXPECTED | Modifier.FINAL;
+
+	/**
+	 * initialize UTF-8 messages using the Message class package path as base name
+	 * 
+	 * @param clazz
+	 */
+	public static void initializeMessages(Class<?> clazz) {
+		initializeMessages(clazz.getPackage().getName() + ".messages", clazz);
+	}
+
+	/**
+	 * Initializes messages using UTF-8 encoding.
+	 * 
+	 * @param baseName
+	 * @param clazz
+	 */
+	public static void initializeMessages(final String baseName, final Class<?> clazz) {
+		// initialize resource bundle
+		NLS.initializeMessages(baseName, clazz);
+
+		// re-encode the fields
+		final Field[] fieldArray = clazz.getDeclaredFields();
+		final int len = fieldArray.length;
+		for (int i = 0; i < len; i++) {
+			final Field field = (Field) fieldArray[i];
+
+			if ((field.getModifiers() & MOD_MASK) != MOD_EXPECTED) // only init public static fields
+				continue;
+
+			if (field.getType() != java.lang.String.class)
+				continue;
+
+			if (!field.isAccessible())
+				field.setAccessible(true);
+			try {
+				final String rawValue = (String) field.get(null);
+				field.set(null, new String(rawValue.getBytes("ISO-8859-1"), "UTF-8")); //$NON-NLS-1$ //$NON-NLS-2$
+			} catch (Exception e) {
+				// e.printStackTrace();
+			}
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/Utf8NLS.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/messages_fr.properties
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/messages_fr.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/messages_fr.properties	(revision 3666)
@@ -0,0 +1,22 @@
+#TXM messages generated by the PluginMessagesManager class
+#Thu Dec 06 15:00:56 CET 2018
+Localizer_0=[Traduction manquante] 
+Pair_1=\ devrait valoir vrai.
+Localizer_1=messages
+FileCopy_0=** Copie de fichiers \: Échec d'accès à la source \: 
+FileCopy_2=** Copie de fichiers \: droits d'accès insuffisants à la source \: 
+ExecTimer_3=h, 
+FileCopy_4=** Copie de fichiers \: Échec de création du dossier \: 
+Pair_0=\ devrait valoir faux.
+ExecTimer_0=\ msec
+ExecTimer_2=\ min et 
+ExecTimer_1=\ sec
+Sh_4=Le processus a terminé avec le code d'erreur \: 
+Log_5=Écriture des messages dans 
+LS_1=\ n'est pas un dossier.
+Log_3=Copie des messages dans 
+LS_0=Erreur \: 
+MessageBox_0=Erreur
+MessageBox_1=Attention
+Log_8=\nstack\:\n
+MessageBox_2=Information

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/tostring/ToString.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/tostring/ToString.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/tostring/ToString.java	(revision 3666)
@@ -0,0 +1,55 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.tostring;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+// TODO: Auto-generated Javadoc
+//http://www-128.ibm.com/developerworks/java/library/j-cwt06075/
+
+/**
+ * The Interface ToString.
+ */
+@Target({ ElementType.FIELD })
+public @interface ToString {
+
+	/**
+	 * Order.
+	 *
+	 * @return the int
+	 */
+	int order() default 0;
+
+	/**
+	 * Text.
+	 *
+	 * @return the string
+	 */
+	String text() default ""; //$NON-NLS-1$
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/tostring/ToString.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/tostring/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/tostring/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/tostring/package.html	(revision 3666)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Apache log annotation</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/tostring/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/SparseList.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/SparseList.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/SparseList.java	(revision 3666)
@@ -0,0 +1,115 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils;
+
+import java.util.AbstractList;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class SparseList.
+ *
+ * @param <E>
+ *            the element type
+ */
+public class SparseList<E> extends AbstractList<E> {
+
+	/** The map. */
+	private SortedMap<Integer, E> map;
+
+	/**
+	 * Instantiates a new sparse list.
+	 */
+	public SparseList() {
+		map = new TreeMap<Integer, E>();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.util.AbstractList#get(int)
+	 */
+	@Override
+	public E get(int n) {
+		return map.get(n);
+	}
+
+	/**
+	 * Returns all the elements between from (included) and to(excluded). Values not
+	 * in the list are returned as null
+	 *
+	 * @param from
+	 *            the from
+	 * @param to
+	 *            the to
+	 * @return A list whose size is to-form
+	 */
+	public List<E> getRange(int from, int to) {
+		List<E> res = new ArrayList<E>();
+		// if (from > to) System.out.println("ERROR: "+from+" > "+to);
+		SortedMap<Integer, E> subMap = map.subMap(from, to);
+		if (subMap.size() == (to - from))
+			res.addAll(subMap.values());
+		else
+			for (int i = from; i < to; i++)
+				res.add(map.get(i));
+		return res;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.util.AbstractCollection#size()
+	 */
+	@Override
+	public int size() {
+		return map.size();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.util.AbstractList#add(int, java.lang.Object)
+	 */
+	@Override
+	public void add(int n, E obj) {
+		map.put(n, obj);
+	}
+
+	/**
+	 * Gets the not null.
+	 *
+	 * @return the not null
+	 */
+	public List<Integer> getNotNull() {
+		return new ArrayList<Integer>(map.keySet());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/SparseList.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/BiHashMap.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/BiHashMap.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/BiHashMap.java	(revision 3666)
@@ -0,0 +1,76 @@
+package org.txm.utils;
+
+import java.util.HashMap;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Bi directionnal hashmap : keys <-> values
+ * 
+ * @author mdecorde
+ *
+ * @param <KeyType>
+ * @param <ValueType>
+ */
+public class BiHashMap<KeyType, ValueType> {
+
+	private ConcurrentHashMap<KeyType, ValueType> keyToValueMap = new ConcurrentHashMap<KeyType, ValueType>();
+	private ConcurrentHashMap<ValueType, KeyType> valueToKeyMap = new ConcurrentHashMap<ValueType, KeyType>();
+
+	public BiHashMap() {
+
+	}
+
+	public BiHashMap(Properties props) {
+		for (Object k : props.keySet()) {
+			put((KeyType) k, (ValueType) props.get(k));
+		}
+	}
+
+	synchronized public void put(KeyType key, ValueType value) {
+		keyToValueMap.put(key, value);
+		// FIXME clash because values are not unique
+		valueToKeyMap.put(value, key);
+	}
+
+	synchronized public ValueType removeByKey(KeyType key) {
+		ValueType removedValue = keyToValueMap.remove(key);
+		valueToKeyMap.remove(removedValue);
+		return removedValue;
+	}
+
+	synchronized public KeyType removeByValue(ValueType value) {
+		KeyType removedKey = valueToKeyMap.remove(value);
+		keyToValueMap.remove(removedKey);
+		return removedKey;
+	}
+
+	public boolean containsKey(KeyType key) {
+		return keyToValueMap.containsKey(key);
+	}
+
+	public boolean containsValue(ValueType value) {
+		return keyToValueMap.containsValue(value);
+	}
+
+	public KeyType getKey(ValueType value) {
+		return valueToKeyMap.get(value);
+	}
+
+	public ValueType get(KeyType key) {
+		return keyToValueMap.get(key);
+	}
+
+	public Set<KeyType> getKeys() {
+		return keyToValueMap.keySet();
+	}
+
+	public Set<ValueType> getValues() {
+		return valueToKeyMap.keySet();
+	}
+
+	public String toString() {
+		return keyToValueMap.toString();
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/BiHashMap.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/package.html	(revision 3666)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Using different languages in output messages.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/LangFormater.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/LangFormater.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/LangFormater.java	(revision 3666)
@@ -0,0 +1,177 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The TXM platform is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with the TXM platform.  If not, see <http://www.gnu.org/licenses/>.
+// 
+// 
+// 
+// $LastChangedDate: 2016-12-15 10:26:28 +0100 (Thu, 15 Dec 2016) $
+// $LastChangedRevision: 3368 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.i18n;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+
+// TODO: Auto-generated Javadoc
+/**
+ * depending on the locale, remove or add spaces between words.
+ *
+ * @author mdecorde
+ */
+public class LangFormater {
+
+	/** The FR no space before. */
+	static List<String> FRNoSpaceBefore = Arrays.asList(",", ".", ")", "]", "}", "°"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+
+	/** The FR no space after. */
+	static List<String> FRNoSpaceAfter = Arrays.asList("’", "'", "(", "[", "{"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+
+	/** The FRO no space before. */
+	static List<String> FRONoSpaceBefore = Arrays.asList(",", ".", ")", "]", "}", "°"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+
+	/** The FRO no space after. */
+	static List<String> FRONoSpaceAfter = Arrays.asList("’", "'", "(", "[", "{"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+
+	/** The EN no space before. */
+	static List<String> ENNoSpaceBefore = Arrays.asList(":", "!", "?", ";", ",", ".", ")", "]", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+			"}", "»", "°", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+			"'s", "'re", "'ve", "'d", "'m", "'em", "'ll", "n't"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
+
+	/** The EN no space after. */
+	static List<String> ENNoSpaceAfter = Arrays.asList("'", "(", "[", "{", "«"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+
+	/**
+	 * Gets the no space before.
+	 *
+	 * @param lang
+	 *            the lang
+	 * @return the no space before
+	 */
+	public static List<String> getNoSpaceBefore(String lang) {
+
+		if (lang.startsWith("fr") || lang.startsWith("FR")) //$NON-NLS-1$ //$NON-NLS-2$
+			return (FRNoSpaceBefore);
+		else if (lang.startsWith("fro") || lang.startsWith("FRO")) //$NON-NLS-1$ //$NON-NLS-2$
+			return (FRONoSpaceBefore);
+		else if (lang.startsWith("en") || lang.startsWith("EN") //$NON-NLS-1$ //$NON-NLS-2$
+				|| lang.startsWith("us") || lang.startsWith("US")) //$NON-NLS-1$ //$NON-NLS-2$
+			return (ENNoSpaceBefore);
+		else
+			return (ENNoSpaceBefore);
+	}
+
+	/**
+	 * Gets the no space after.
+	 *
+	 * @param lang
+	 *            the lang
+	 * @return the no space after
+	 */
+	public static List<String> getNoSpaceAfter(String lang) {
+
+		if (lang.startsWith("fr") || lang.startsWith("FR")) //$NON-NLS-1$ //$NON-NLS-2$
+			return (FRNoSpaceAfter);
+		else if (lang.startsWith("fro") || lang.startsWith("FRO")) //$NON-NLS-1$ //$NON-NLS-2$
+			return (FRONoSpaceAfter);
+		else if (lang.startsWith("en") || lang.startsWith("EN") //$NON-NLS-1$ //$NON-NLS-2$
+				|| lang.startsWith("us") || lang.startsWith("US")) //$NON-NLS-1$ //$NON-NLS-2$
+			return (ENNoSpaceAfter);
+		else
+			return (ENNoSpaceAfter);
+	}
+
+	/**
+	 * Format.
+	 *
+	 * @param str
+	 *            the str
+	 * @param lang
+	 *            the lang
+	 * @return the string
+	 */
+	public static String format(String str, String lang) {
+		if (lang == null) {
+			lang = Locale.getDefault().getLanguage();
+		}
+
+		for (String punc : getNoSpaceAfter(lang)) {
+			str = str.replace(punc + " ", punc); //$NON-NLS-1$
+		}
+
+		for (String punc : getNoSpaceBefore(lang)) {
+			str = str.replace(" " + punc, punc); //$NON-NLS-1$
+		}
+
+		return str;
+	}
+
+	public static boolean isSpaceAfterNotNeeded(String str, String lang) {
+		for (String t : getNoSpaceAfter(lang)) {
+			if (str.endsWith(t)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	public static boolean isSpaceBeforeNotNeeded(String str, String lang) {
+		for (String t : getNoSpaceBefore(lang)) {
+			if (str.startsWith(t)) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * Format.
+	 *
+	 * @param str
+	 *            the str
+	 * @param lang
+	 *            the lang
+	 * @return the string
+	 */
+	public static String format(String str, Object lang) {
+		if (lang == null)
+			lang = Locale.getDefault().getLanguage();
+		return format(str, lang.toString());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/LangFormater.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/Localizer.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/Localizer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/Localizer.java	(revision 3666)
@@ -0,0 +1,200 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.i18n;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.txm.utils.messages.UtilsCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Format string using a Resource bundle mechanism for managing languages.
+ * 
+ * @author sloiseau
+ */
+public class Localizer {
+
+	/** The cls. */
+	private final Class<?> cls;
+
+	/** The loc. */
+	private final Locale loc;
+
+	/** The bundle. */
+	private ResourceBundle bundle;
+
+	/** The bundle in default locale. */
+	private ResourceBundle default_bundle;
+
+	/**
+	 * Instantiates a new localizer.
+	 * 
+	 * @param cls
+	 *            the cls
+	 */
+	public Localizer(Class<?> cls) {
+		this(cls, null);
+	}
+
+	/**
+	 * Instantiates a new localizer.
+	 *
+	 * @param cls
+	 *            the cls
+	 * @param loc
+	 *            the loc
+	 */
+	public Localizer(Class<?> cls, Locale loc) {
+		this.cls = cls;
+		this.loc = loc;
+	}
+
+	/**
+	 * Message.
+	 * 
+	 * @param key
+	 *            the key
+	 * 
+	 * @return the string
+	 */
+	public String message(String key) {
+		return MessageFormat.format(getString(key), new Object[] {});
+	}
+
+	/**
+	 * Message.
+	 * 
+	 * @param key
+	 *            the key
+	 * @param arg
+	 *            the arg
+	 * 
+	 * @return the string
+	 */
+	public String message(String key, Object arg) {
+		return MessageFormat.format(getString(key), new Object[] { arg });
+	}
+
+	/**
+	 * Message.
+	 * 
+	 * @param key
+	 *            the key
+	 * @param arg1
+	 *            the arg1
+	 * @param arg2
+	 *            the arg2
+	 * 
+	 * @return the string
+	 */
+	public String message(String key, Object arg1, Object arg2) {
+		return MessageFormat.format(getString(key), new Object[] { arg1, arg2 });
+	}
+
+	/**
+	 * Message.
+	 * 
+	 * @param key
+	 *            the key
+	 * @param args
+	 *            the args
+	 * 
+	 * @return the string
+	 */
+	public String message(String key, Object[] args) {
+		return MessageFormat.format(getString(key), args);
+	}
+
+	/**
+	 * Query the bundle for the string corresponding to a key.
+	 * 
+	 * If a given key does not exist in the loaded bundle, this class look for the
+	 * key in a bundle with locale "en", "US". It the key is still not found, it
+	 * return the key itself.
+	 *
+	 * @param key
+	 *            the key
+	 * @return the string
+	 */
+	private String getString(String key) {
+		try {
+			return getBundle().getString(key);
+		} catch (MissingResourceException e1) {
+			try {
+				return UtilsCoreMessages.Localizer_0 + getDefaultBundle().getString(key);
+			} catch (MissingResourceException e2) {
+				return key;
+			}
+		}
+	}
+
+	/**
+	 * Gets the bundle.
+	 * 
+	 * @return the bundle
+	 */
+	private ResourceBundle getBundle() {
+		if (bundle == null) {
+			String s = getRessourcePrefix();
+			bundle = loc == null ? ResourceBundle.getBundle(s + UtilsCoreMessages.Localizer_1) : ResourceBundle.getBundle(s + UtilsCoreMessages.Localizer_1, loc);
+		}
+		return bundle;
+	}
+
+	/**
+	 * Gets the default bundle.
+	 * 
+	 * @return the default bundle
+	 */
+	private ResourceBundle getDefaultBundle() {
+		if (default_bundle == null) {
+			String s = getRessourcePrefix();
+			default_bundle = ResourceBundle.getBundle(s + UtilsCoreMessages.Localizer_1, new Locale("en", "US")); //$NON-NLS-1$//$NON-NLS-2$
+		}
+		return default_bundle;
+	}
+
+	/**
+	 * Gets the ressource prefix.
+	 *
+	 * @return the ressource prefix
+	 */
+	private String getRessourcePrefix() {
+		String s = cls.getName();
+		int i = s.lastIndexOf('.');
+		if (i > 0)
+			s = s.substring(0, i + 1);
+		else
+			s = ""; //$NON-NLS-1$
+		return s;
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/Localizer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/DetectBOM.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/DetectBOM.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/DetectBOM.java	(revision 3666)
@@ -0,0 +1,109 @@
+package org.txm.utils.i18n;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.nio.charset.Charset;
+
+/**
+ * Simple class to detect BOM in a file
+ * 
+ * @see http://blog.ymango.com/2010/09/16/29
+ * 
+ * @author mdecorde
+ *
+ */
+public class DetectBOM {
+
+	Charset enc = null;
+	int n, unread, size;
+
+	/**
+	 * 
+	 * @param srcFile
+	 *            the file to test
+	 */
+	public DetectBOM(File srcFile) {
+		// *** Use Default of Encoding.Default (Ansi CodePage)
+
+		try {
+			// *** Detect byte order mark if any - otherwise assume default
+			byte[] buffer = new byte[4];
+			FileInputStream file = new FileInputStream(srcFile);
+			n = file.read(buffer, 0, buffer.length);
+			file.close();
+
+			String encoding = null;
+			if ((buffer[0] == (byte) 0x00) && (buffer[1] == (byte) 0x00) && (buffer[2] == (byte) 0xFE) && (buffer[3] == (byte) 0xFF)) {
+				encoding = "UTF-32BE"; //$NON-NLS-1$
+				unread = n - 4;
+				size = 4;
+			} else if ((buffer[0] == (byte) 0xFF) && (buffer[1] == (byte) 0xFE) && (buffer[2] == (byte) 0x00) && (buffer[3] == (byte) 0x00)) {
+				encoding = "UTF-32LE"; //$NON-NLS-1$
+				unread = n - 4;
+				size = 4;
+			} else if ((buffer[0] == (byte) 0xEF) && (buffer[1] == (byte) 0xBB) && (buffer[2] == (byte) 0xBF)) {
+				encoding = "UTF-8"; //$NON-NLS-1$
+				unread = n - 3;
+				size = 3;
+			} else if ((buffer[0] == (byte) 0xFE) && (buffer[1] == (byte) 0xFF)) {
+				encoding = "UTF-16BE"; //$NON-NLS-1$
+				unread = n - 2;
+				size = 2;
+			} else if ((buffer[0] == (byte) 0xFF) && (buffer[1] == (byte) 0xFE)) {
+				encoding = "UTF-16LE"; //$NON-NLS-1$
+				unread = n - 2;
+				size = 4;
+			} else {
+				// Unicode BOM mark not found, unread all bytes
+				// encoding = "UTF-8";
+				unread = n;
+				size = 0;
+			}
+			if (encoding != null)
+				enc = Charset.forName(encoding);
+
+		} catch (FileNotFoundException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		// System.out.println("BOM size: "+size);
+		// return enc;
+	}
+
+	/**
+	 * 
+	 * @return if the file has a BOM, return the encoding, else return file system
+	 *         encoding
+	 */
+	public Charset getCharSet() {
+		if (enc != null)
+			return enc;
+		else
+			return Charset.forName(System.getProperty("file.encoding")); //$NON-NLS-1$
+	}
+
+	/**
+	 * 
+	 * @return the number of byte to skip to read the file
+	 */
+	public int getBOMSize() {
+		return size;
+	}
+
+	/**
+	 * 
+	 * @return true if the file has a BOM
+	 */
+	public boolean hasBOM() {
+		return size > 0;
+	}
+
+	public static void main(String args[]) {
+		DetectBOM db = new DetectBOM(new File(System.getProperty("user.home"), "xml/SUPPORT/CS/3-revues_eng_complet2.txt"));
+		System.out.println(db.getBOMSize());
+		System.out.println(db.getCharSet());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/i18n/DetectBOM.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/saxon/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/saxon/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/saxon/package.html	(revision 3666)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Tools for Saxon</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/saxon/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Diff.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Diff.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Diff.java	(revision 3666)
@@ -0,0 +1,993 @@
+/*
+ * $Log: Diff.java,v $
+ * Revision 1.7  2009/01/19 03:05:26  stuart
+ * Fix StackOverflow bug with heuristic on reported by Jimmy Han.
+ *
+ * Revision 1.6  2003/03/06 22:51:32  stuart
+ * Convert to CVS
+ *
+ * Revision 1.5  2002/07/19  19:14:40  stuart
+ * fix reverseScript, make change ctor public, update docs
+ *
+ * Revision 1.4  2002/04/09  17:53:39  stuart
+ * More flexible interface for diff() function.
+ *
+ * Revision 1.3  2000/03/03 21:58:03  stuart
+ * move discard_confusing_lines and shift_boundaries to class file_data
+ *
+ * Revision 1.2  2000/03/02  16:37:38  stuart
+ * Add GPL and copyright
+ *
+ */
+package org.txm.utils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+/**
+ * A class to compare vectors of objects. The result of comparison is a list of
+ * <code>change</code> objects which form an edit script. The objects compared
+ * are traditionally lines of text from two files. Comparison options such as
+ * "ignore whitespace" are implemented by modifying the <code>equals</code> and
+ * <code>hashcode</code> methods for the objects compared.
+ * <p>
+ * The basic algorithm is described in: </br>
+ * "An O(ND) Difference Algorithm and its Variations", Eugene Myers,
+ * Algorithmica Vol. 1 No. 2, 1986, p 251.
+ * <p>
+ * This class outputs different results from GNU diff 1.15 on some inputs. Our
+ * results are actually better (smaller change list, smaller total size of
+ * changes), but it would be nice to know why. Perhaps there is a memory
+ * overwrite bug in GNU diff 1.15.
+ * 
+ * @author Stuart D. Gathman, translated from GNU diff 1.15 Copyright (C) 2000
+ *         Business Management Systems, Inc.
+ *         <p>
+ *         This program is free software; you can redistribute it and/or modify
+ *         it under the terms of the GNU General Public License as published by
+ *         the Free Software Foundation; either version 1, or (at your option)
+ *         any later version.
+ *         <p>
+ *         This program is distributed in the hope that it will be useful, but
+ *         WITHOUT ANY WARRANTY; without even the implied warranty of
+ *         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *         General Public License for more details.
+ *         <p>
+ *         You should have received a copy of the <a href=COPYING.txt> GNU
+ *         General Public License</a> along with this program; if not, write to
+ *         the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
+ *         02139, USA.
+ * 
+ */
+
+public class Diff {
+
+	/**
+	 * Prepare to find differences between two arrays. Each element of the arrays is
+	 * translated to an "equivalence number" based on the result of
+	 * <code>equals</code>. The original Object arrays are no longer needed for
+	 * computing the differences. They will be needed again later to print the
+	 * results of the comparison as an edit script, if desired.
+	 */
+	public Diff(Object[] a, Object[] b) {
+		Hashtable h = new Hashtable(a.length + b.length);
+		filevec[0] = new file_data(a, h);
+		filevec[1] = new file_data(b, h);
+	}
+
+	/**
+	 * 1 more than the maximum equivalence value used for this or its sibling file.
+	 */
+	private int equiv_max = 1;
+
+	/**
+	 * When set to true, the comparison uses a heuristic to speed it up. With this
+	 * heuristic, for files with a constant small density of changes, the algorithm
+	 * is linear in the file size.
+	 */
+	public boolean heuristic = false;
+
+	/**
+	 * When set to true, the algorithm returns a guarranteed minimal set of changes.
+	 * This makes things slower, sometimes much slower.
+	 */
+	public boolean no_discards = false;
+
+	private int[] xvec, yvec; /* Vectors being compared. */
+	private int[] fdiag; /*
+							 * Vector, indexed by diagonal, containing the X coordinate of the point
+							 * furthest along the given diagonal in the forward search of the edit matrix.
+							 */
+	private int[] bdiag; /*
+							 * Vector, indexed by diagonal, containing the X coordinate of the point
+							 * furthest along the given diagonal in the backward search of the edit matrix.
+							 */
+	private int fdiagoff, bdiagoff;
+	private final file_data[] filevec = new file_data[2];
+	private int cost;
+	/** Snakes bigger than this are considered "big". */
+	private static final int SNAKE_LIMIT = 20;
+
+	/**
+	 * Find the midpoint of the shortest edit script for a specified portion of the
+	 * two files.
+	 * 
+	 * We scan from the beginnings of the files, and simultaneously from the ends,
+	 * doing a breadth-first search through the space of edit-sequence. When the two
+	 * searches meet, we have found the midpoint of the shortest edit sequence.
+	 * 
+	 * The value returned is the number of the diagonal on which the midpoint lies.
+	 * The diagonal number equals the number of inserted lines minus the number of
+	 * deleted lines (counting only lines before the midpoint). The edit cost is
+	 * stored into COST; this is the total number of lines inserted or deleted
+	 * (counting only lines before the midpoint).
+	 * 
+	 * This function assumes that the first lines of the specified portions of the
+	 * two files do not match, and likewise that the last lines do not match. The
+	 * caller must trim matching lines from the beginning and end of the portions it
+	 * is going to specify.
+	 * 
+	 * Note that if we return the "wrong" diagonal value, or if the value of bdiag
+	 * at that diagonal is "wrong", the worst this can do is cause suboptimal diff
+	 * output. It cannot cause incorrect diff output.
+	 */
+
+	private int diag(int xoff, int xlim, int yoff, int ylim) {
+		final int[] fd = fdiag; // Give the compiler a chance.
+		final int[] bd = bdiag; // Additional help for the compiler.
+		final int[] xv = xvec; // Still more help for the compiler.
+		final int[] yv = yvec; // And more and more . . .
+		final int dmin = xoff - ylim; // Minimum valid diagonal.
+		final int dmax = xlim - yoff; // Maximum valid diagonal.
+		final int fmid = xoff - yoff; // Center diagonal of top-down search.
+		final int bmid = xlim - ylim; // Center diagonal of bottom-up search.
+		int fmin = fmid, fmax = fmid; // Limits of top-down search.
+		int bmin = bmid, bmax = bmid; // Limits of bottom-up search.
+		/*
+		 * True if southeast corner is on an odd diagonal with respect to the northwest.
+		 */
+		final boolean odd = (fmid - bmid & 1) != 0;
+
+		fd[fdiagoff + fmid] = xoff;
+		bd[bdiagoff + bmid] = xlim;
+
+		for (int c = 1;; ++c) {
+			int d; /* Active diagonal. */
+			boolean big_snake = false;
+
+			/* Extend the top-down search by an edit step in each diagonal. */
+			if (fmin > dmin)
+				fd[fdiagoff + --fmin - 1] = -1;
+			else
+				++fmin;
+			if (fmax < dmax)
+				fd[fdiagoff + ++fmax + 1] = -1;
+			else
+				--fmax;
+			for (d = fmax; d >= fmin; d -= 2) {
+				int x, y, oldx, tlo = fd[fdiagoff + d - 1], thi = fd[fdiagoff + d + 1];
+
+				if (tlo >= thi)
+					x = tlo + 1;
+				else
+					x = thi;
+				oldx = x;
+				y = x - d;
+				while (x < xlim && y < ylim && xv[x] == yv[y]) {
+					++x;
+					++y;
+				}
+				if (x - oldx > SNAKE_LIMIT)
+					big_snake = true;
+				fd[fdiagoff + d] = x;
+				if (odd && bmin <= d && d <= bmax && bd[bdiagoff + d] <= fd[fdiagoff + d]) {
+					cost = 2 * c - 1;
+					return d;
+				}
+			}
+
+			/* Similar extend the bottom-up search. */
+			if (bmin > dmin)
+				bd[bdiagoff + --bmin - 1] = Integer.MAX_VALUE;
+			else
+				++bmin;
+			if (bmax < dmax)
+				bd[bdiagoff + ++bmax + 1] = Integer.MAX_VALUE;
+			else
+				--bmax;
+			for (d = bmax; d >= bmin; d -= 2) {
+				int x, y, oldx, tlo = bd[bdiagoff + d - 1], thi = bd[bdiagoff + d + 1];
+
+				if (tlo < thi)
+					x = tlo;
+				else
+					x = thi - 1;
+				oldx = x;
+				y = x - d;
+				while (x > xoff && y > yoff && xv[x - 1] == yv[y - 1]) {
+					--x;
+					--y;
+				}
+				if (oldx - x > SNAKE_LIMIT)
+					big_snake = true;
+				bd[bdiagoff + d] = x;
+				if (!odd && fmin <= d && d <= fmax && bd[bdiagoff + d] <= fd[fdiagoff + d]) {
+					cost = 2 * c;
+					return d;
+				}
+			}
+
+			/*
+			 * Heuristic: check occasionally for a diagonal that has made lots of progress
+			 * compared with the edit distance. If we have any such, find the one that has
+			 * made the most progress and return it as if it had succeeded.
+			 * 
+			 * With this heuristic, for files with a constant small density of changes, the
+			 * algorithm is linear in the file size.
+			 */
+
+			if (c > 200 && big_snake && heuristic) {
+				int best = 0;
+				int bestpos = -1;
+
+				for (d = fmax; d >= fmin; d -= 2) {
+					int dd = d - fmid;
+					int x = fd[fdiagoff + d];
+					int y = x - d;
+					int v = (x - xoff) * 2 - dd;
+					if (v > 12 * (c + (dd < 0 ? -dd : dd))) {
+						if (v > best && xoff + SNAKE_LIMIT <= x && x < xlim && yoff + SNAKE_LIMIT <= y && y < ylim) {
+							/*
+							 * We have a good enough best diagonal; now insist that it end with a
+							 * significant snake.
+							 */
+							int k;
+
+							for (k = 1; xvec[x - k] == yvec[y - k]; k++)
+								if (k == SNAKE_LIMIT) {
+									best = v;
+									bestpos = d;
+									break;
+								}
+						}
+					}
+				}
+				if (best > 0) {
+					cost = 2 * c - 1;
+					return bestpos;
+				}
+
+				best = 0;
+				for (d = bmax; d >= bmin; d -= 2) {
+					int dd = d - bmid;
+					int x = bd[bdiagoff + d];
+					int y = x - d;
+					int v = (xlim - x) * 2 + dd;
+					if (v > 12 * (c + (dd < 0 ? -dd : dd))) {
+						if (v > best && xoff < x && x <= xlim - SNAKE_LIMIT && yoff < y && y <= ylim - SNAKE_LIMIT) {
+							/*
+							 * We have a good enough best diagonal; now insist that it end with a
+							 * significant snake.
+							 */
+							int k;
+
+							for (k = 0; xvec[x + k] == yvec[y + k]; k++)
+								if (k == SNAKE_LIMIT) {
+									best = v;
+									bestpos = d;
+									break;
+								}
+						}
+					}
+				}
+				if (best > 0) {
+					cost = 2 * c - 1;
+					return bestpos;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Compare in detail contiguous subsequences of the two files which are known,
+	 * as a whole, to match each other.
+	 * 
+	 * The results are recorded in the vectors filevec[N].changed_flag, by storing a
+	 * 1 in the element for each line that is an insertion or deletion.
+	 * 
+	 * The subsequence of file 0 is [XOFF, XLIM) and likewise for file 1.
+	 * 
+	 * Note that XLIM, YLIM are exclusive bounds. All line numbers are origin-0 and
+	 * discarded lines are not counted.
+	 */
+
+	private void compareseq(int xoff, int xlim, int yoff, int ylim) {
+		/* Slide down the bottom initial diagonal. */
+		while (xoff < xlim && yoff < ylim && xvec[xoff] == yvec[yoff]) {
+			++xoff;
+			++yoff;
+		}
+		/* Slide up the top initial diagonal. */
+		while (xlim > xoff && ylim > yoff && xvec[xlim - 1] == yvec[ylim - 1]) {
+			--xlim;
+			--ylim;
+		}
+
+		/* Handle simple cases. */
+		if (xoff == xlim)
+			while (yoff < ylim)
+				filevec[1].changed_flag[1 + filevec[1].realindexes[yoff++]] = true;
+		else if (yoff == ylim)
+			while (xoff < xlim)
+				filevec[0].changed_flag[1 + filevec[0].realindexes[xoff++]] = true;
+		else {
+			/* Find a point of correspondence in the middle of the files. */
+
+			int d = diag(xoff, xlim, yoff, ylim);
+			int c = cost;
+			int f = fdiag[fdiagoff + d];
+			int b = bdiag[bdiagoff + d];
+
+			if (c == 1) {
+				/*
+				 * This should be impossible, because it implies that one of the two
+				 * subsequences is empty, and that case was handled above without calling
+				 * `diag'. Let's verify that this is true.
+				 */
+				throw new IllegalArgumentException("Empty subsequence"); //$NON-NLS-1$
+			} else {
+				/* Use that point to split this problem into two subproblems. */
+				compareseq(xoff, b, yoff, b - d);
+				/*
+				 * This used to use f instead of b, but that is incorrect! It is not necessarily
+				 * the case that diagonal d has a snake from b to f.
+				 */
+				compareseq(b, xlim, b - d, ylim);
+			}
+		}
+	}
+
+	/**
+	 * Discard lines from one file that have no matches in the other file.
+	 */
+
+	private void discard_confusing_lines() {
+		filevec[0].discard_confusing_lines(filevec[1]);
+		filevec[1].discard_confusing_lines(filevec[0]);
+	}
+
+	private boolean inhibit = false;
+
+	/**
+	 * Adjust inserts/deletes of blank lines to join changes as much as possible.
+	 */
+
+	private void shift_boundaries() {
+		if (inhibit)
+			return;
+		filevec[0].shift_boundaries(filevec[1]);
+		filevec[1].shift_boundaries(filevec[0]);
+	}
+
+	public interface ScriptBuilder {
+		/**
+		 * Scan the tables of which lines are inserted and deleted, producing an edit
+		 * script.
+		 * 
+		 * @param changed0
+		 *            true for lines in first file which do not match 2nd
+		 * @param len0
+		 *            number of lines in first file
+		 * @param changed1
+		 *            true for lines in 2nd file which do not match 1st
+		 * @param len1
+		 *            number of lines in 2nd file
+		 * @return a linked list of changes - or null
+		 */
+		public change build_script(boolean[] changed0, int len0, boolean[] changed1, int len1);
+	}
+
+	/**
+	 * Scan the tables of which lines are inserted and deleted, producing an edit
+	 * script in reverse order.
+	 */
+
+	static class ReverseScript implements ScriptBuilder {
+		public change build_script(final boolean[] changed0, int len0, final boolean[] changed1, int len1) {
+			change script = null;
+			int i0 = 0, i1 = 0;
+			while (i0 < len0 || i1 < len1) {
+				if (changed0[1 + i0] || changed1[1 + i1]) {
+					int line0 = i0, line1 = i1;
+
+					/* Find # lines changed here in each file. */
+					while (changed0[1 + i0])
+						++i0;
+					while (changed1[1 + i1])
+						++i1;
+
+					/* Record this change. */
+					script = new change(line0, line1, i0 - line0, i1 - line1, script);
+				}
+
+				/* We have reached lines in the two files that match each other. */
+				i0++;
+				i1++;
+			}
+
+			return script;
+		}
+	}
+
+	static class ForwardScript implements ScriptBuilder {
+		/**
+		 * Scan the tables of which lines are inserted and deleted, producing an edit
+		 * script in forward order.
+		 */
+		public change build_script(final boolean[] changed0, int len0, final boolean[] changed1, int len1) {
+			change script = null;
+			int i0 = len0, i1 = len1;
+
+			while (i0 >= 0 || i1 >= 0) {
+				if (changed0[i0] || changed1[i1]) {
+					int line0 = i0, line1 = i1;
+
+					/* Find # lines changed here in each file. */
+					while (changed0[i0])
+						--i0;
+					while (changed1[i1])
+						--i1;
+
+					/* Record this change. */
+					script = new change(i0, i1, line0 - i0, line1 - i1, script);
+				}
+
+				/* We have reached lines in the two files that match each other. */
+				i0--;
+				i1--;
+			}
+
+			return script;
+		}
+	}
+
+	/** Standard ScriptBuilders. */
+	public final static ScriptBuilder forwardScript = new ForwardScript(), reverseScript = new ReverseScript();
+
+	/*
+	 * Report the differences of two files. DEPTH is the current directory depth.
+	 */
+	public final change diff_2(final boolean reverse) {
+		return diff(reverse ? reverseScript : forwardScript);
+	}
+
+	/**
+	 * Get the results of comparison as an edit script. The script is described by a
+	 * list of changes. The standard ScriptBuilder implementations provide for
+	 * forward and reverse edit scripts. Alternate implementations could, for
+	 * instance, list common elements instead of differences.
+	 * 
+	 * @param bld
+	 *            an object to build the script from change flags
+	 * @return the head of a list of changes
+	 */
+	public change diff(final ScriptBuilder bld) {
+
+		/*
+		 * Some lines are obviously insertions or deletions because they don't match
+		 * anything. Detect them now, and avoid even thinking about them in the main
+		 * comparison algorithm.
+		 */
+
+		discard_confusing_lines();
+
+		/*
+		 * Now do the main comparison algorithm, considering just the undiscarded lines.
+		 */
+
+		xvec = filevec[0].undiscarded;
+		yvec = filevec[1].undiscarded;
+
+		int diags = filevec[0].nondiscarded_lines + filevec[1].nondiscarded_lines + 3;
+		fdiag = new int[diags];
+		fdiagoff = filevec[1].nondiscarded_lines + 1;
+		bdiag = new int[diags];
+		bdiagoff = filevec[1].nondiscarded_lines + 1;
+
+		compareseq(0, filevec[0].nondiscarded_lines, 0, filevec[1].nondiscarded_lines);
+		fdiag = null;
+		bdiag = null;
+
+		/*
+		 * Modify the results slightly to make them prettier in cases where that can
+		 * validly be done.
+		 */
+
+		shift_boundaries();
+
+		/*
+		 * Get the results of comparison in the form of a chain of `struct change's --
+		 * an edit script.
+		 */
+		return bld.build_script(filevec[0].changed_flag, filevec[0].buffered_lines, filevec[1].changed_flag, filevec[1].buffered_lines);
+
+	}
+
+	/**
+	 * The result of comparison is an "edit script": a chain of change objects. Each
+	 * change represents one place where some lines are deleted and some are
+	 * inserted.
+	 * 
+	 * LINE0 and LINE1 are the first affected lines in the two files (origin 0).
+	 * DELETED is the number of lines deleted here from file 0. INSERTED is the
+	 * number of lines inserted here in file 1.
+	 * 
+	 * If DELETED is 0 then LINE0 is the number of the line before which the
+	 * insertion was done; vice versa for INSERTED and LINE1.
+	 */
+
+	public static class change {
+		/** Previous or next edit command. */
+		public change link;
+		/** # lines of file 1 changed here. */
+		public final int inserted;
+		/** # lines of file 0 changed here. */
+		public final int deleted;
+		/** Line number of 1st deleted line. */
+		public final int line0;
+		/** Line number of 1st inserted line. */
+		public final int line1;
+
+		/**
+		 * Cons an additional entry onto the front of an edit script OLD. LINE0 and
+		 * LINE1 are the first affected lines in the two files (origin 0). DELETED is
+		 * the number of lines deleted here from file 0. INSERTED is the number of lines
+		 * inserted here in file 1.
+		 * 
+		 * If DELETED is 0 then LINE0 is the number of the line before which the
+		 * insertion was done; vice versa for INSERTED and LINE1.
+		 */
+		public change(int line0, int line1, int deleted, int inserted, change old) {
+			this.line0 = line0;
+			this.line1 = line1;
+			this.inserted = inserted;
+			this.deleted = deleted;
+			this.link = old;
+			// System.err.println(line0+","+line1+","+inserted+","+deleted);
+		}
+	}
+
+	/**
+	 * Data on one input file being compared.
+	 */
+
+	class file_data {
+
+		/** Allocate changed array for the results of comparison. */
+		void clear() {
+			/*
+			 * Allocate a flag for each line of each file, saying whether that line is an
+			 * insertion or deletion. Allocate an extra element, always zero, at each end of
+			 * each vector.
+			 */
+			changed_flag = new boolean[buffered_lines + 2];
+		}
+
+		/**
+		 * Return equiv_count[I] as the number of lines in this file that fall in
+		 * equivalence class I.
+		 * 
+		 * @return the array of equivalence class counts.
+		 */
+		int[] equivCount() {
+			int[] equiv_count = new int[equiv_max];
+			for (int i = 0; i < buffered_lines; ++i)
+				++equiv_count[equivs[i]];
+			return equiv_count;
+		}
+
+		/**
+		 * Discard lines that have no matches in another file.
+		 * 
+		 * A line which is discarded will not be considered by the actual comparison
+		 * algorithm; it will be as if that line were not in the file. The file's
+		 * `realindexes' table maps virtual line numbers (which don't count the
+		 * discarded lines) into real line numbers; this is how the actual comparison
+		 * algorithm produces results that are comprehensible when the discarded lines
+		 * are counted.
+		 * <p>
+		 * When we discard a line, we also mark it as a deletion or insertion so that it
+		 * will be printed in the output.
+		 * 
+		 * @param f
+		 *            the other file
+		 */
+		void discard_confusing_lines(file_data f) {
+			clear();
+			/* Set up table of which lines are going to be discarded. */
+			final byte[] discarded = discardable(f.equivCount());
+
+			/*
+			 * Don't really discard the provisional lines except when they occur in a run of
+			 * discardables, with nonprovisionals at the beginning and end.
+			 */
+			filterDiscards(discarded);
+
+			/* Actually discard the lines. */
+			discard(discarded);
+		}
+
+		/**
+		 * Mark to be discarded each line that matches no line of another file. If a
+		 * line matches many lines, mark it as provisionally discardable.
+		 * 
+		 * @see equivCount()
+		 * @param counts
+		 *            The count of each equivalence number for the other file.
+		 * @return 0=nondiscardable, 1=discardable or 2=provisionally discardable for
+		 *         each line
+		 */
+
+		private byte[] discardable(final int[] counts) {
+			final int end = buffered_lines;
+			final byte[] discards = new byte[end];
+			final int[] equivs = this.equivs;
+			int many = 5;
+			int tem = end / 64;
+
+			/*
+			 * Multiply MANY by approximate square root of number of lines. That is the
+			 * threshold for provisionally discardable lines.
+			 */
+			while ((tem = tem >> 2) > 0)
+				many *= 2;
+
+			for (int i = 0; i < end; i++) {
+				int nmatch;
+				if (equivs[i] == 0)
+					continue;
+				nmatch = counts[equivs[i]];
+				if (nmatch == 0)
+					discards[i] = 1;
+				else if (nmatch > many)
+					discards[i] = 2;
+			}
+			return discards;
+		}
+
+		/**
+		 * Don't really discard the provisional lines except when they occur in a run of
+		 * discardables, with nonprovisionals at the beginning and end.
+		 */
+
+		private void filterDiscards(final byte[] discards) {
+			final int end = buffered_lines;
+
+			for (int i = 0; i < end; i++) {
+				/* Cancel provisional discards not in middle of run of discards. */
+				if (discards[i] == 2)
+					discards[i] = 0;
+				else if (discards[i] != 0) {
+					/* We have found a nonprovisional discard. */
+					int j;
+					int length;
+					int provisional = 0;
+
+					/*
+					 * Find end of this run of discardable lines. Count how many are provisionally
+					 * discardable.
+					 */
+					for (j = i; j < end; j++) {
+						if (discards[j] == 0)
+							break;
+						if (discards[j] == 2)
+							++provisional;
+					}
+
+					/* Cancel provisional discards at end, and shrink the run. */
+					while (j > i && discards[j - 1] == 2) {
+						discards[--j] = 0;
+						--provisional;
+					}
+
+					/*
+					 * Now we have the length of a run of discardable lines whose first and last are
+					 * not provisional.
+					 */
+					length = j - i;
+
+					/*
+					 * If 1/4 of the lines in the run are provisional, cancel discarding of all
+					 * provisional lines in the run.
+					 */
+					if (provisional * 4 > length) {
+						while (j > i)
+							if (discards[--j] == 2)
+								discards[j] = 0;
+					} else {
+						int consec;
+						int minimum = 1;
+						int tem = length / 4;
+
+						/*
+						 * MINIMUM is approximate square root of LENGTH/4. A subrun of two or more
+						 * provisionals can stand when LENGTH is at least 16. A subrun of 4 or more can
+						 * stand when LENGTH >= 64.
+						 */
+						while ((tem = tem >> 2) > 0)
+							minimum *= 2;
+						minimum++;
+
+						/*
+						 * Cancel any subrun of MINIMUM or more provisionals within the larger run.
+						 */
+						for (j = 0, consec = 0; j < length; j++)
+							if (discards[i + j] != 2)
+								consec = 0;
+							else if (minimum == ++consec)
+								/* Back up to start of subrun, to cancel it all. */
+								j -= consec;
+							else if (minimum < consec)
+								discards[i + j] = 0;
+
+						/*
+						 * Scan from beginning of run until we find 3 or more nonprovisionals in a row
+						 * or until the first nonprovisional at least 8 lines in. Until that point,
+						 * cancel any provisionals.
+						 */
+						for (j = 0, consec = 0; j < length; j++) {
+							if (j >= 8 && discards[i + j] == 1)
+								break;
+							if (discards[i + j] == 2) {
+								consec = 0;
+								discards[i + j] = 0;
+							} else if (discards[i + j] == 0)
+								consec = 0;
+							else
+								consec++;
+							if (consec == 3)
+								break;
+						}
+
+						/* I advances to the last line of the run. */
+						i += length - 1;
+
+						/* Same thing, from end. */
+						for (j = 0, consec = 0; j < length; j++) {
+							if (j >= 8 && discards[i - j] == 1)
+								break;
+							if (discards[i - j] == 2) {
+								consec = 0;
+								discards[i - j] = 0;
+							} else if (discards[i - j] == 0)
+								consec = 0;
+							else
+								consec++;
+							if (consec == 3)
+								break;
+						}
+					}
+				}
+			}
+		}
+
+		/**
+		 * Actually discard the lines.
+		 * 
+		 * @param discards
+		 *            flags lines to be discarded
+		 */
+		private void discard(final byte[] discards) {
+			final int end = buffered_lines;
+			int j = 0;
+			for (int i = 0; i < end; ++i)
+				if (no_discards || discards[i] == 0) {
+					undiscarded[j] = equivs[i];
+					realindexes[j++] = i;
+				} else
+					changed_flag[1 + i] = true;
+			nondiscarded_lines = j;
+		}
+
+		file_data(Object[] data, Hashtable h) {
+			buffered_lines = data.length;
+
+			equivs = new int[buffered_lines];
+			undiscarded = new int[buffered_lines];
+			realindexes = new int[buffered_lines];
+
+			for (int i = 0; i < data.length; ++i) {
+				Integer ir = (Integer) h.get(data[i]);
+				if (ir == null)
+					h.put(data[i], new Integer(equivs[i] = equiv_max++));
+				else
+					equivs[i] = ir.intValue();
+			}
+		}
+
+		/**
+		 * Adjust inserts/deletes of blank lines to join changes as much as possible.
+		 * 
+		 * We do something when a run of changed lines include a blank line at one end
+		 * and have an excluded blank line at the other. We are free to choose which
+		 * blank line is included. `compareseq' always chooses the one at the beginning,
+		 * but usually it is cleaner to consider the following blank line to be the
+		 * "change". The only exception is if the preceding blank line would join this
+		 * change to other changes.
+		 * 
+		 * @param f
+		 *            the file being compared against
+		 */
+
+		void shift_boundaries(file_data f) {
+			final boolean[] changed = changed_flag;
+			final boolean[] other_changed = f.changed_flag;
+			int i = 0;
+			int j = 0;
+			int i_end = buffered_lines;
+			int preceding = -1;
+			int other_preceding = -1;
+
+			for (;;) {
+				int start, end, other_start;
+
+				/*
+				 * Scan forwards to find beginning of another run of changes. Also keep track of
+				 * the corresponding point in the other file.
+				 */
+
+				while (i < i_end && !changed[1 + i]) {
+					while (other_changed[1 + j++])
+						/*
+						 * Non-corresponding lines in the other file will count as the preceding batch
+						 * of changes.
+						 */
+						other_preceding = j;
+					i++;
+				}
+
+				if (i == i_end)
+					break;
+
+				start = i;
+				other_start = j;
+
+				for (;;) {
+					/* Now find the end of this run of changes. */
+
+					while (i < i_end && changed[1 + i])
+						i++;
+					end = i;
+
+					/*
+					 * If the first changed line matches the following unchanged one, and this run
+					 * does not follow right after a previous run, and there are no lines deleted
+					 * from the other file here, then classify the first changed line as unchanged
+					 * and the following line as changed in its place.
+					 */
+
+					/*
+					 * You might ask, how could this run follow right after another? Only because
+					 * the previous run was shifted here.
+					 */
+
+					if (end != i_end && equivs[start] == equivs[end] && !other_changed[1 + j] && end != i_end && !((preceding >= 0 && start == preceding) || (other_preceding >= 0 && other_start == other_preceding))) {
+						changed[1 + end++] = true;
+						changed[1 + start++] = false;
+						++i;
+						/*
+						 * Since one line-that-matches is now before this run instead of after, we must
+						 * advance in the other file to keep in synch.
+						 */
+						++j;
+					} else
+						break;
+				}
+
+				preceding = i;
+				other_preceding = j;
+			}
+		}
+
+		/** Number of elements (lines) in this file. */
+		final int buffered_lines;
+
+		/**
+		 * Vector, indexed by line number, containing an equivalence code for each line.
+		 * It is this vector that is actually compared with that of another file to
+		 * generate differences.
+		 */
+		private final int[] equivs;
+
+		/**
+		 * Vector, like the previous one except that the elements for discarded lines
+		 * have been squeezed out.
+		 */
+		final int[] undiscarded;
+
+		/**
+		 * Vector mapping virtual line numbers (not counting discarded lines) to real
+		 * ones (counting those lines). Both are origin-0.
+		 */
+		final int[] realindexes;
+
+		/** Total number of nondiscarded lines. */
+		int nondiscarded_lines;
+
+		/**
+		 * Array, indexed by real origin-1 line number, containing true for a line that
+		 * is an insertion or a deletion. The results of comparison are stored here.
+		 */
+		boolean[] changed_flag;
+
+	}
+
+	public static Object[] getLines(File file) throws IOException {
+		ArrayList<String> lines = new ArrayList<String>();
+		BufferedReader in = new BufferedReader(new FileReader(file));
+		String line = in.readLine();
+		while (line != null) {
+			lines.add(line);
+			line = in.readLine();
+		}
+		in.close();
+		return lines.toArray();
+	}
+
+	public static String diffFile(File file1, File file2) throws IOException {
+		if (file1.exists() && file2.exists()) {
+
+			Object[] test1 = getLines(file1);
+			Object[] test2 = getLines(file2);
+
+			Diff diff = new Diff(test1, test2);
+			Diff.change script = diff.diff_2(false);
+			DiffPrint.Base p = new DiffPrint.UnifiedPrint(test1, test2);
+			StringWriter wtr = new StringWriter();
+			p.setOutput(wtr);
+			p.print_script(script);
+			// System.out.println(wtr.toString());
+			return wtr.toString().trim();
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public static String diffFolder(File dir1, File dir2) throws IOException {
+		if (dir1.exists() && dir2.exists()) {
+
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	public static void main(String args[]) {
+		// String[] test1 = {
+		// "aaa","bbb","ccc","ddd","eee","fff","ggg","hhh","iii"
+		// };
+		// String[] test2 = {
+		// "aaa","bbb","ccc","ddd","eee","fff","ggg","hhh","iii"
+		// };
+		//
+		// Diff diff = new Diff(test1,test2);
+		// Diff.change script = diff.diff_2(false);
+		// DiffPrint.Base p = new DiffPrint.UnifiedPrint(test1,test2);
+		// StringWriter wtr = new StringWriter();
+		// p.setOutput(wtr);
+		// p.print_script(script);
+		// System.out.println(wtr.toString());
+
+		File file1 = new File("/home/mdecorde/paquets/shared/debian/usr/lib/TXM/install.prefs"); //$NON-NLS-1$
+		File file2 = new File("/home/mdecorde/paquets/shared/win/install.prefs"); //$NON-NLS-1$
+		try {
+			System.out.println(diffFile(file1, file2));
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Diff.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/AsciiUtils.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/AsciiUtils.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/AsciiUtils.java	(revision 3666)
@@ -0,0 +1,211 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.utils;
+
+import com.ibm.icu.text.Transliterator;
+
+/**
+ * The Class AsciiUtils.
+ * 
+ * FR:
+ * 
+ * AsciiUtils.convertNonAscii(str) supprime les accents
+ * 
+ * AsciiUtils.removePunct(str) supprime les ponctuations
+ * 
+ * AsciiUtils.buildWordId(str) créé un identifiant de mot CQP compatible
+ * 
+ * AsciiUtils.buildId(str) créé un identifiant compatible corpus CQP
+ *
+ * @see : http://www.rgagnon.com/javadetails/java-0456.html
+ */
+public class AsciiUtils {
+
+	/** The Constant PLAIN_ASCII. */
+	private static final String PLAIN_ASCII = "AaEeIiOoUu" // grave //$NON-NLS-1$
+			+ "AaEeIiOoUuYy" // acute //$NON-NLS-1$
+			+ "AaEeIiOoUuYy" // circumflex //$NON-NLS-1$
+			+ "AaOoNn" // tilde //$NON-NLS-1$
+			+ "AaEeIiOoUuYy" // umlaut //$NON-NLS-1$
+			+ "Aa" // ring //$NON-NLS-1$
+			+ "Cc" // cedilla //$NON-NLS-1$
+			+ "OoUu" // double acute //$NON-NLS-1$
+	;
+
+	/** The Constant UNICODE. */
+	private static final String UNICODE = "\u00C0\u00E0\u00C8\u00E8\u00CC\u00EC\u00D2\u00F2\u00D9\u00F9" //$NON-NLS-1$
+			+ "\u00C1\u00E1\u00C9\u00E9\u00CD\u00ED\u00D3\u00F3\u00DA\u00FA\u00DD\u00FD" //$NON-NLS-1$
+			+ "\u00C2\u00E2\u00CA\u00EA\u00CE\u00EE\u00D4\u00F4\u00DB\u00FB\u0176\u0177" //$NON-NLS-1$
+			+ "\u00C3\u00E3\u00D5\u00F5\u00D1\u00F1" //$NON-NLS-1$
+			+ "\u00C4\u00E4\u00CB\u00EB\u00CF\u00EF\u00D6\u00F6\u00DC\u00FC\u0178\u00FF" //$NON-NLS-1$
+			+ "\u00C5\u00E5" //$NON-NLS-1$
+			+ "\u00C7\u00E7" //$NON-NLS-1$
+			+ "\u0150\u0151\u0170\u0171" //$NON-NLS-1$
+	;
+
+	// private constructor, can't be instanciated!
+	/**
+	 * Instantiates a new ascii utils.
+	 */
+	private AsciiUtils() {
+	}
+
+	public static Transliterator asciiFormmater = Transliterator.getInstance("Any-Latin; NFD; [^\\p{Alnum}\\p{p}] Remove");
+
+	/**
+	 * Convert non ascii characters. Warning punctuations are not removed
+	 *
+	 * @param s
+	 *            the s
+	 * @return the string
+	 */
+	public static String convertNonAscii(String s) {
+		if (s == null)
+			return null;
+
+		String latin = asciiFormmater.transform(s);
+
+		// StringBuilder sb = new StringBuilder();
+		// int n = s.length();
+		// for (int i = 0; i < n; i++) {
+		// char c = s.charAt(i);
+		// int pos = UNICODE.indexOf(c);
+		// if (pos > -1) {
+		// sb.append(PLAIN_ASCII.charAt(pos));
+		// } else {
+		// sb.append(c);
+		// }
+		// }
+		return latin;
+	}
+
+	/**
+	 * Removes the punct and empty spaces.
+	 *
+	 * @param s
+	 *            the s
+	 * @return the string
+	 */
+	public static String removePunct(String s) {
+		return s.replaceAll("\\p{Space}", "").replaceAll("\\p{Punct}", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+	}
+
+	/**
+	 * Builds the word id.
+	 *
+	 * @param s
+	 *            the s
+	 * @return the string
+	 */
+	public static String buildWordId(String s) {
+
+		if (s.length() == 0) {
+			return s;
+		}
+
+		// ensure the "w_" prefix presence
+		if (s.startsWith("w")) {
+			if (!s.startsWith("w_")) {
+				s = "w_" + s.substring(1);
+			}
+		} else {
+			s = "w_" + s;
+		}
+		// System.out.println("first="+s);
+
+		String rez = convertNonAscii(s);// .toLowerCase();
+		// System.out.println("nonasscii="+rez);
+		rez = rez.replaceAll("\\p{Space}++", "_");
+		// System.out.println("spaces="+rez);
+		rez = rez.replaceAll("[¤€§µ£°().,;:/?!@§%\\\\\"’ʹ'*+\\-}\\]\\[{#~&]", ""); //$NON-NLS-1$ //$NON-NLS-2$ // "[^\\P{P}_]"
+		// System.out.println("ponc="+rez);
+
+		return rez;
+	}
+
+	/**
+	 * Builds attribute id.
+	 *
+	 * @param s
+	 *            the s
+	 * @return the string
+	 */
+	public static String buildAttributeId(String s) {
+		return buildId(s);
+	}
+
+	/**
+	 * Builds the id.
+	 *
+	 * @param s
+	 *            the s
+	 * @return the string
+	 */
+	public static String buildId(String s) {
+		// TODO: replace this with a lib managing the ID attribute format
+		if (s.length() == 0) {
+			return s;
+		}
+		String rez = s.trim();
+		rez = rez.replaceAll("\\p{Space}++", "_");
+		rez = rez.replaceAll("_", "-");
+		rez = convertNonAscii(rez).toLowerCase();
+
+		rez = rez.replaceAll("[¤€§µ£°().,;:/?!@§%\\\\\"’ʹ'*+\\}\\]\\[{#~&]", ""); //$NON-NLS-1$ //$NON-NLS-2$
+		// remove first chars if number
+		char c = rez.charAt(0);
+		while (c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7' || c == '8' || c == '9') {
+			rez = rez.substring(1);
+			if (rez.length() == 0) {
+				return "";
+			}
+			c = rez.charAt(0);
+		}
+
+		return rez;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args
+	 *            the arguments
+	 */
+	public static void main(String args[]) {
+		String s = "01The result : - - _ тврьдо È,É,Ê,Ë,Û,Ù,Ï,Î,À,Â,Ô,è,é,ê,ë,û,ù,ï,î,à,â,ô,ç  0 1 2 3 4 5 6 7 8 9 10"; //$NON-NLS-1$
+		System.out.println(AsciiUtils.convertNonAscii(s));
+		// System.out.println(AsciiUtils.buildId(s));
+		String s2 = "w_ТВРЬДОтврьдо_123&é\"'(-è_çà)=/*-+~#{[|`\\^@]}¤;:!§/.?µ%£°";
+		System.out.println("nonascii=" + AsciiUtils.convertNonAscii(s2));
+		System.out.println("word_id=" + AsciiUtils.buildWordId(s2));
+		System.out.println("attribute_id=" + AsciiUtils.buildAttributeId(s2));
+		// output :
+		// The result : E,E,E,E,U,U,I,I,A,A,O,e,e,e,e,u,u,i,i,a,a,o,c
+
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/AsciiUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/FixString.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/FixString.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/FixString.java	(revision 3666)
@@ -0,0 +1,73 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The TXM platform is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with the TXM platform.  If not, see <http://www.gnu.org/licenses/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils;
+
+// TODO: Auto-generated Javadoc
+/**
+ * syntaxic sugar for CQP queries.
+ *
+ * @author mdecorde
+ */
+public class FixString {
+
+	/**
+	 * Normalize.
+	 *
+	 * @param line
+	 *            the line
+	 * @return the string
+	 */
+	public static String normalize(String line) {
+		char[] array = line.toCharArray();
+		for (int i = 0; i < array.length; i++) {
+			char c = array[i];
+			if (c <= 0x1f) {
+				// System.out.println(
+				// "fix : "+c+" code "+Character.getNumericValue(c));
+				array[i] = ' ';
+			}
+		}
+		return String.valueOf(array);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/FixString.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/package.html	(revision 3666)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Contains usefull tools</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Timer.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Timer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Timer.java	(revision 3666)
@@ -0,0 +1,17 @@
+package org.txm.utils;
+
+public class Timer {
+	long start = System.currentTimeMillis();
+
+	public long ellaspeTime() {
+		return System.currentTimeMillis() - start;
+	}
+
+	public void reset() {
+		start = System.currentTimeMillis();
+	}
+
+	public long getStart() {
+		return start;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Timer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/xml/UpdateXSLParameters.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/xml/UpdateXSLParameters.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/xml/UpdateXSLParameters.java	(revision 3666)
@@ -0,0 +1,71 @@
+package org.txm.utils.xml;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.txm.utils.xml.*;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ * change parameters value of an XSL file
+ * 
+ * @author mdecorde
+ *
+ */
+public class UpdateXSLParameters {
+
+	File xslFile;
+
+	public UpdateXSLParameters(File xslFile) {
+		this.xslFile = xslFile;
+	}
+
+	/**
+	 * update the content of "param" elements which name attribute exists in the
+	 * parameters map with the parameter map value.
+	 * 
+	 * @param parameters
+	 * @return true if document if successfully saved
+	 * @throws ParserConfigurationException
+	 * @throws SAXException
+	 * @throws IOException
+	 * 
+	 */
+	public boolean process(HashMap<String, String> parameters) throws ParserConfigurationException, SAXException, IOException {
+		if (!xslFile.exists()) {
+			System.out.println("Error: $xslFile doest not exists. Aborting.");
+			return false;
+		}
+
+		Document doc = DomUtils.load(xslFile);
+		NodeList list = doc.getElementsByTagName("xsl:param");
+		for (int i = 0; i < list.getLength(); i++) {
+			Element e = (Element) list.item(i);
+			String name = e.getAttribute("name");
+
+			if (parameters.keySet().contains(name)) {
+				e.setTextContent(parameters.get(name));
+			}
+		}
+
+		return DomUtils.save(doc, xslFile);
+	}
+
+	public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException {
+		File xslFile = new File("/home/mdecorde/TEMP/testori/mss-dates/txm/mss-dates-w/xsl/4-edition/1-facsimile-pager.xsl");
+		HashMap<String, String> parameters = new HashMap<String, String>();
+		parameters.put("image-directory", "/home/mdecorde/TEMP/testori/mss-dates/img222222222222");
+		UpdateXSLParameters p = new UpdateXSLParameters(xslFile);
+		if (!p.process(parameters)) {
+			System.out.println("Fail");
+		} else {
+			System.out.println("Success");
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/xml/UpdateXSLParameters.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/xml/DomUtils.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/xml/DomUtils.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/xml/DomUtils.java	(revision 3666)
@@ -0,0 +1,173 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.utils.xml;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+import javax.xml.parsers.*;
+import javax.xml.transform.*;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class DomUtils.
+ */
+public class DomUtils {
+
+	/**
+	 * Empty document.
+	 *
+	 * @return the document
+	 * @throws ParserConfigurationException
+	 */
+	public static Document emptyDocument() throws ParserConfigurationException {
+		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+		factory.setXIncludeAware(true);
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		return builder.newDocument();
+	}
+
+	/**
+	 * Load.
+	 *
+	 * @param xmlfile
+	 *            the xmlfile
+	 * @return the document
+	 * @throws ParserConfigurationException
+	 * @throws IOException
+	 * @throws SAXException
+	 */
+	public static Document load(File xmlfile) throws ParserConfigurationException, SAXException, IOException {
+		DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+		factory.setXIncludeAware(true);
+		factory.setNamespaceAware(true); // never forget this!
+		DocumentBuilder builder = factory.newDocumentBuilder();
+		// builder.parse(xmlfile).getDocumentElement().getElementsByTagName(name)
+		return builder.parse(xmlfile);
+	}
+
+	/**
+	 * Save.
+	 *
+	 * @param element
+	 *            the doc
+	 * @param writer
+	 *            the writer
+	 * @return true if successful
+	 */
+	public static boolean save(Document doc, Writer writer) {
+		return save(doc.getDocumentElement(), writer);
+	}
+
+	public static boolean save(Element element, File outfile) throws UnsupportedEncodingException, FileNotFoundException {
+		Writer writer = new BufferedWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(outfile)), "UTF-8")); //$NON-NLS-1$
+		return save(element, writer);
+	}
+
+	/**
+	 * Save.
+	 *
+	 * @param element
+	 *            the doc
+	 * @param writer
+	 *            the writer
+	 * @return true, if successful
+	 */
+	public static boolean save(Element element, Writer writer) {
+		try {
+			// Création de la source DOM
+			Source source = new DOMSource(element);
+
+			// Création du fichier de sortie
+			Result resultat = new StreamResult(writer);
+
+			// Configuration du transformer
+			TransformerFactory fabrique = new net.sf.saxon.TransformerFactoryImpl();
+			Transformer transformer = fabrique.newTransformer();
+			transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+			transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+			transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+
+			// Transformation
+			transformer.transform(source, resultat);
+			writer.close();
+			return true;
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+	}
+
+	/**
+	 * Save.
+	 *
+	 * @param doc
+	 *            the doc
+	 * @param outfile
+	 *            the output file
+	 * @return true, if successful
+	 * @throws FileNotFoundException
+	 * @throws UnsupportedEncodingException
+	 * @return true if successful
+	 */
+	public static boolean save(Document doc, File outfile) throws UnsupportedEncodingException, FileNotFoundException {
+		Writer writer = new BufferedWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(outfile)), "UTF-8")); //$NON-NLS-1$
+		return save(doc, writer);
+	}
+
+	/**
+	 * Save.
+	 *
+	 * @param doc
+	 *            the doc
+	 * @param outfile
+	 *            the outfile
+	 * @return true, if successful
+	 * @throws FileNotFoundException
+	 * @throws UnsupportedEncodingException
+	 */
+	public static boolean print(Document doc) throws UnsupportedEncodingException, FileNotFoundException {
+		Writer writer = new PrintWriter(System.out);
+		return save(doc, writer);
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/xml/DomUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LocalXhtmlDtdEntityResolver.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LocalXhtmlDtdEntityResolver.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LocalXhtmlDtdEntityResolver.java	(revision 3666)
@@ -0,0 +1,25 @@
+package org.txm.utils;
+
+import java.io.IOException;
+
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class LocalXhtmlDtdEntityResolver implements EntityResolver {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String,
+	 * java.lang.String)
+	 */
+	@Override
+	public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+		String fileName = systemId.substring(systemId.lastIndexOf("/") + 1);
+		System.out.println("FILENAME: " + fileName);
+
+		return new InputSource(getClass().getClassLoader().getResourceAsStream(fileName));
+	}
+
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LocalXhtmlDtdEntityResolver.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/zip/GZip.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/zip/GZip.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/zip/GZip.java	(revision 3666)
@@ -0,0 +1,58 @@
+package org.txm.utils.zip;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+public class GZip {
+	public static void compress(File infile, File gzFile) throws FileNotFoundException, IOException {
+
+		FileInputStream finStream = new FileInputStream(infile);
+		BufferedInputStream bufinStream = new BufferedInputStream(finStream);
+		FileOutputStream outStream = new FileOutputStream(gzFile);
+		GZIPOutputStream goutStream = new GZIPOutputStream(outStream);
+		byte[] buf = new byte[1024];
+		int i;
+		while ((i = bufinStream.read(buf)) >= 0) {
+			goutStream.write(buf, 0, i);
+		}
+		bufinStream.close();
+		goutStream.close();
+	}
+
+	/**
+	 * unzip using gz filename to name the output file
+	 * 
+	 * @param gzFile
+	 * @param outDir
+	 * @return the extracted file
+	 * @throws IOException
+	 */
+	public static File uncompress(File gzFile, File outDir) throws IOException {
+		// To Uncompress GZip File Contents we need to open the gzip file.....
+		GZIPInputStream gzipInputStream = new GZIPInputStream(new FileInputStream(gzFile));
+
+		String outFileName = gzFile.getName();
+		outFileName = outFileName.substring(0, outFileName.length() - 3); // remove ".gz"
+		File outFile = new File(outDir, outFileName);
+		OutputStream out = new FileOutputStream(outFile);
+
+		byte[] buf = new byte[1024]; // size can be
+
+		int len;
+		while ((len = gzipInputStream.read(buf)) > 0) {
+			out.write(buf, 0, len);
+		}
+
+		gzipInputStream.close();
+		out.close();
+
+		return outFile;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/zip/GZip.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/zip/Zip.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/zip/Zip.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/zip/Zip.java	(revision 3666)
@@ -0,0 +1,744 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2016-10-27 16:30:30 +0200 (Thu, 27 Oct 2016) $
+// $LastChangedRevision: 3331 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.zip;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.zip.Deflater;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.utils.logger.Log;
+
+/**
+ * Utility methods to extract, compress, list files of ZIP files
+ */
+public class Zip {
+
+	//	/** The ZIP extension. */
+	//	@Deprecated
+	//	public static String ZIP_EXTENSION = ".odt"; // no more used, stay for old Groovy script compatibility ?
+
+	/** The DEFAUL level of compression. */
+	public static int DEFAULT_LEVEL_COMPRESSION = Deflater.BEST_COMPRESSION;
+
+	/**
+	 * Compress.
+	 *
+	 * @param file
+	 *            the file
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final File file) throws IOException {
+		compress(file, file, DEFAULT_LEVEL_COMPRESSION, null, null);
+	}
+
+	/**
+	 * Compress.
+	 *
+	 * @param file
+	 *            the file
+	 * @param target
+	 *            the target
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final File file, final File target) throws IOException {
+		compress(file, target, DEFAULT_LEVEL_COMPRESSION, null, null);
+	}
+
+	/**
+	 * Compress.
+	 *
+	 * @param file
+	 *            the file
+	 * @param targetZipFile
+	 *            the Zip file to create
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final File file, final File targetZipFile, IProgressMonitor monitor) throws IOException {
+		compress(file, targetZipFile, DEFAULT_LEVEL_COMPRESSION, monitor, null);
+	}
+
+	/**
+	 * Compress.
+	 *
+	 * @param file
+	 *            the file
+	 * @param targetZipFile
+	 *            the Zip file to create
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final File file, final File targetZipFile, IProgressMonitor monitor, HashSet<String> ignore) throws IOException {
+		compress(file, targetZipFile, DEFAULT_LEVEL_COMPRESSION, monitor, ignore);
+	}
+
+	// Compresse un fichier à l'adresse pointée par le fichier cible.
+	// Remplace le fichier cible s'il existe déjà.
+	/**
+	 * Compresse un fichier à l'adresse pointée par le fichier cible. Remplace le
+	 * fichier cible s'il existe déjà..
+	 *
+	 * @param file
+	 *            the file
+	 * @param targetZipFile
+	 *            the target
+	 * @param compressionLevel
+	 *            the compression level
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final File[] files, final File targetZipFile, final int compressionLevel, IProgressMonitor monitor, HashSet<String> ignore) throws IOException {
+
+
+		// Création du fichier zip
+		final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(targetZipFile));
+		out.setMethod(ZipOutputStream.DEFLATED);
+		out.setLevel(compressionLevel);
+
+		for (File file : files) {
+			// Ajout du(es) fichier(s) au zip
+			final File source = file.getCanonicalFile();
+			compressFile(out, "", source, monitor, ignore);
+		}
+		out.close();
+	}
+
+	// Compresse un fichier à l'adresse pointée par le fichier cible.
+	// Remplace le fichier cible s'il existe déjà.
+	/**
+	 * Compresse un fichier à l'adresse pointée par le fichier cible. Remplace le
+	 * fichier cible s'il existe déjà..
+	 *
+	 * @param file
+	 *            the file
+	 * @param targetZipFile
+	 *            the target
+	 * @param compressionLevel
+	 *            the compression level
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final File file, final File targetZipFile, final int compressionLevel, IProgressMonitor monitor, HashSet<String> ignore) throws IOException {
+		compress(new File[] {file}, targetZipFile, compressionLevel, monitor, ignore);
+	}
+	
+	/**
+	 * Compress.
+	 *
+	 * @param file
+	 *            the file
+	 * @param compressionLevel
+	 *            the compression level
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final File file, final int compressionLevel) throws IOException {
+		compress(file, file, compressionLevel, null, null);
+	}
+
+	/**
+	 * Compress.
+	 *
+	 * @param fileName
+	 *            the file name
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final String fileName) throws IOException {
+		compress(new File(fileName), new File(fileName), DEFAULT_LEVEL_COMPRESSION, null, null);
+	}
+
+	/**
+	 * Compress.
+	 *
+	 * @param fileName
+	 *            the file name
+	 * @param compressionLevel
+	 *            the compression level
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final String fileName, final int compressionLevel) throws IOException {
+		compress(new File(fileName), new File(fileName), compressionLevel, null, null);
+	}
+
+	/**
+	 * Compress.
+	 *
+	 * @param fileName
+	 *            the file name
+	 * @param targetName
+	 *            the target name
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final String fileName, final String targetName) throws IOException {
+		compress(new File(fileName), new File(targetName), DEFAULT_LEVEL_COMPRESSION, null, null);
+	}
+
+	/**
+	 * Compress.
+	 *
+	 * @param fileName
+	 *            the file name
+	 * @param targetName
+	 *            the target name
+	 * @param compressionLevel
+	 *            the compression level
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void compress(final String fileName, final String targetName, final int compressionLevel) throws IOException {
+		compress(new File(fileName), new File(targetName), compressionLevel, null, null);
+	}
+
+	/**
+	 * Compress file or directory into an archive.
+	 *
+	 * @param out
+	 *            the out
+	 * @param parentFolder
+	 *            the parent folder
+	 * @param file
+	 *            the file
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	private final static void compressFile(final ZipOutputStream out, final String parentFolder, final File file, IProgressMonitor monitor, HashSet<String> ignore) throws IOException {
+		final String zipName = new StringBuilder(parentFolder).append(file.getName()).append(file.isDirectory() ? '/' : "").toString();
+
+		// Définition des attributs du fichier
+		final ZipEntry entry = new ZipEntry(zipName);
+		entry.setSize(file.length());
+		entry.setTime(file.lastModified());
+		out.putNextEntry(entry);
+
+		// Traitement récursif s'il s'agit d'un dossier
+		// System.out.println("COMPRESS "+file+" monitor="+monitor);
+		if (file.isDirectory()) {
+			File[] files = file.listFiles();
+			if (files != null) {
+				if (monitor != null)
+					monitor.beginTask("Compressing " + file + " directory (" + files.length + " files).", files.length);
+				for (final File f : files) {
+					if (ignore != null && ignore.contains(f.getName())) {
+						// continue; // file is ignored
+					} else {
+						compressFile(out, zipName.toString(), f, null, null);
+					}
+
+					if (monitor != null) {
+						monitor.worked(1);
+					}
+				}
+				if (monitor != null)
+					monitor.done();
+			}
+		} else {
+			// Ecriture du fichier dans le zip
+			final InputStream in = new BufferedInputStream(new FileInputStream(file));
+
+			try {
+				if (monitor != null)
+					monitor.beginTask("Compressing " + file + " file (" + file.length() + " bytes).", (int) file.length());
+				final byte[] buf = new byte[8192];
+				int bytesRead;
+				while (-1 != (bytesRead = in.read(buf))) {
+					out.write(buf, 0, bytesRead);
+					if (monitor != null)
+						monitor.worked(bytesRead);
+				}
+				if (monitor != null)
+					monitor.done();
+			} finally {
+				in.close();
+			}
+		}
+	}
+
+	/**
+	 * Decompress a ZIP file in the ZIP file parent directory
+	 *
+	 * @param zipfile
+	 *            the ZIP file
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final File zipfile) throws IOException {
+		decompress(zipfile, zipfile.getCanonicalFile().getParentFile(), false, null);
+	}
+
+	/**
+	 * Decompress.
+	 *
+	 * @param zipFile
+	 *            the file
+	 * @param deleteZipAfter
+	 *            the delete zip after
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final File zipFile, final boolean deleteZipAfter) throws IOException {
+		decompress(zipFile, zipFile.getCanonicalFile().getParentFile(), deleteZipAfter, null);
+	}
+
+	// Décompresse un fichier zip à l'adresse indiquée par le dossier
+	/**
+	 * Decompress.
+	 *
+	 * @param zipFile
+	 *            the file
+	 * @param folder
+	 *            the folder
+	 * @param deleteZipAfter
+	 *            the delete zip after
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final File zipFile, final File folder, final boolean deleteZipAfter) throws IOException {
+		decompress(zipFile, folder, deleteZipAfter, null);
+	}
+
+	// Décompresse un fichier zip à l'adresse indiquée par le dossier
+	/**
+	 * Decompress.
+	 *
+	 * @param zipFile
+	 *            the file
+	 * @param folder
+	 *            the folder
+	 * @param deleteZipAfter
+	 *            the delete zip after
+	 * @param monitor
+	 *            change progress state
+	 * 
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final File zipFile, final File folder, final boolean deleteZipAfter, IProgressMonitor monitor) throws IOException {
+		ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFile.getCanonicalFile())));
+		ZipEntry ze;
+		int nEntries = 0;
+		// System.out.println("count entries...");
+		try {
+			while (null != (ze = zis.getNextEntry())) {
+				nEntries++;
+			}
+		} catch (Exception e) {
+			e.printStackTrace();
+		} finally {
+			if (zis != null)
+				zis.close();
+		}
+		// System.out.println("count entries result: "+nEntries);
+
+		zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFile.getCanonicalFile())));
+		// System.out.println("zis: "+zis);
+		if (monitor != null) {
+			monitor.beginTask("Extracting " + zipFile, nEntries);
+		}
+
+		try {
+			// Parcours tous les fichiers
+			// System.out.println("start parsing zip file: "+file);
+			while (null != (ze = zis.getNextEntry())) {
+				if (monitor != null)
+					monitor.worked(1);
+
+				final File f = new File(folder.getCanonicalPath(), ze.getName());
+				// System.out.println(f);
+				if (f.exists())
+					f.delete();
+
+				// Création des dossiers
+				if (ze.isDirectory()) {
+					f.mkdirs();
+					continue;
+				}
+				f.getParentFile().mkdirs();
+				final OutputStream fos = new BufferedOutputStream(new FileOutputStream(f));
+
+				// Ecriture des fichiers
+				try {
+					try {
+						final byte[] buf = new byte[8192];
+						int bytesRead;
+						while (-1 != (bytesRead = zis.read(buf))) {
+							fos.write(buf, 0, bytesRead);
+						}
+					} finally {
+						fos.close();
+					}
+				} catch (final IOException ioe) {
+					f.delete();
+					throw ioe;
+				}
+			}
+		} finally {
+			zis.close();
+			// if (monitor != null) monitor.done();
+		}
+
+		if (deleteZipAfter)
+			zipFile.delete();
+	}
+
+	/**
+	 * Decompress.
+	 *
+	 * @param fileName
+	 *            the file name
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final String fileName) throws IOException {
+		decompress(new File(fileName));
+	}
+
+	/**
+	 * Decompress.
+	 *
+	 * @param zipFileName
+	 *            the file name
+	 * @param deleteZipAfter
+	 *            the delete zip after
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final String zipFileName, final boolean deleteZipAfter) throws IOException {
+		decompress(new File(zipFileName), deleteZipAfter);
+	}
+
+	/**
+	 * Decompress.
+	 *
+	 * @param zipFileName
+	 *            the file name
+	 * @param folderName
+	 *            the folder name
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final String zipFileName, final String folderName) throws IOException {
+		decompress(new File(zipFileName), new File(folderName), false);
+	}
+
+	/**
+	 * Decompress.
+	 *
+	 * @param zipFileName
+	 *            the file name
+	 * @param folderName
+	 *            the folder name
+	 * @param deleteZipAfter
+	 *            the delete zip after
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final String zipFileName, final String folderName, final boolean deleteZipAfter) throws IOException {
+		decompress(new File(zipFileName), new File(folderName), deleteZipAfter, null);
+	}
+
+	/**
+	 * Decompress.
+	 *
+	 * @param zipFileName
+	 *            the file name
+	 * @param folderName
+	 *            the folder name
+	 * @param deleteZipAfter
+	 *            the delete zip after
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void decompress(final String zipFileName, final String folderName, final boolean deleteZipAfter, IProgressMonitor monitor) throws IOException {
+		decompress(new File(zipFileName), new File(folderName), deleteZipAfter, monitor);
+	}
+
+	/**
+	 * Extract one file from an archive given a relative path in the archive
+	 * 
+	 * @param zipFile
+	 *            the archive
+	 * @param path
+	 *            the relative path in the archive
+	 * @param outputFile
+	 *            the output file
+	 * @return true if success
+	 */
+	public static boolean extractOneFile(File zipFile, String path, File outputFile) {
+		return extractOneFile(zipFile, path, outputFile, false);
+	}
+
+	/**
+	 * Extract one file from an archive given a relative path in the archive
+	 * 
+	 * @param zipFile
+	 *            the archive
+	 * @param path
+	 *            the relative path in the archive of the file to extract (file or
+	 *            directory)
+	 * @param outputFile
+	 *            the output file
+	 * @param replaceOnlyIfNewer
+	 *            if true the file is replaced only if the archive file is more
+	 *            recent
+	 * @return true if success
+	 */
+	public static boolean extractOneFile(File zipFile, String path, File outputFile, boolean replaceOnlyIfNewer) {
+
+		boolean copySubEntries = false; // internal variable to copy entries of a directory
+		boolean pathFound = false; // internal variable to know if path was found
+
+		try {
+			long oldFileTime = outputFile.lastModified();
+
+			ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFile.getCanonicalFile())));
+			ZipEntry ze;
+
+			// Parcourt tous les fichiers
+			while (null != (ze = zis.getNextEntry())) {
+				// System.out.println("P="+ze.getName());
+				String currentpath = ze.getName();
+				if (currentpath.equals(path)) { // this is the file to extract !
+					if (replaceOnlyIfNewer && ze.getTime() < oldFileTime) { // don't replace the file
+						zis.close();
+						return true;
+					}
+					if (ze.isDirectory()) { // the path point a directory
+						copySubEntries = true;
+						outputFile.mkdirs();
+						pathFound = true;
+					} else { // the path point a file
+						writeFileEntry(zis, outputFile);
+						pathFound = true;
+					}
+				} else if (currentpath.startsWith(path) && copySubEntries) {
+					String subpath = currentpath.substring(path.length());
+
+					if (ze.isDirectory()) { // a sub directory of the pointed path
+						new File(outputFile, subpath).mkdirs();
+					} else { // a sub file of the pointed path (directory)
+						writeFileEntry(zis, new File(outputFile, subpath));
+					}
+				} else {
+					copySubEntries = false; // stop copying sub entries
+				}
+			}
+			if (!pathFound) {
+				System.out.println("Error: " + path + " not found.");
+			}
+
+			if (zis != null) {
+				try {
+					zis.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		} catch (Exception e) {
+			System.out.println("Fail to extract " + path + " from " + zipFile + ": " + e);
+			Log.printStackTrace(e);
+		}
+
+		return pathFound; // no suitable entry found
+	}
+
+	/**
+	 * Write the current Zis entry to a file
+	 * 
+	 * @param zis
+	 * @param outputFile
+	 * @throws IOException
+	 */
+	private static void writeFileEntry(ZipInputStream zis, File outputFile) throws IOException {
+		OutputStream fos = new BufferedOutputStream(new FileOutputStream(outputFile));
+
+		// Ecriture des fichiers
+		try {
+			try {
+				final byte[] buf = new byte[8192];
+				int bytesRead;
+				while (-1 != (bytesRead = zis.read(buf)))
+					fos.write(buf, 0, bytesRead);
+			} finally {
+				fos.close();
+			}
+		} catch (final IOException ioe) {
+			throw ioe;
+		}
+	}
+
+	/**
+	 * Try to get the root folder of the archive. If there is no root folder, the
+	 * Zip filename is used
+	 * 
+	 * @param zipFile
+	 * @return the root directory of the archive
+	 */
+	public static String getRoot(File zipFile) {
+		String root = null;
+		for (String f : listFiles(zipFile)) {
+			root = f;
+			if (f.startsWith(".") && f.indexOf(".") > 0)
+				continue;
+			break;
+		}
+		// System.out.println("BIN ROOT: "+root);
+		if (root == null) { // no sub-directory found, we use the zip filename
+			root = zipFile.getName();
+			if (root.indexOf(".") > 0) // remove the extension
+				root = root.substring(0, root.indexOf("."));
+		}
+
+		int idx = root.indexOf("/");
+		if (idx > 0)
+			root = root.substring(0, idx);
+		return root;
+	}
+
+	/**
+	 * List the ZIP file content
+	 * 
+	 * @param zipFile
+	 * @return the list of files in the archive
+	 */
+	public static ArrayList<String> listFiles(File zipFile) {
+		ArrayList<String> list = new ArrayList<>();
+		Enumeration<?> zipEntries;
+		ZipFile zip = null;
+		try {
+			zip = new ZipFile(zipFile);
+			zipEntries = zip.entries();
+			while (zipEntries.hasMoreElements()) {
+				list.add(((ZipEntry) zipEntries.nextElement()).getName());
+			}
+			Collections.sort(list);
+		} catch (Exception e) {
+			Log.warning("Fail to list files of " + zipFile + ": " + e);
+			Log.printStackTrace(e);
+			return new ArrayList<>();
+		} finally {
+			if (zip != null) {
+				try {
+					zip.close();
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}
+		return list;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args
+	 *            the arguments
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void main(String[] args) throws IOException {
+		// File zipFile = new
+		// File("/home/mdecorde/Téléchargements/bvhepistemon-bin.zip");
+		// ArrayList<String> list = Zip.listFiles(zipFile);
+		// System.out.println(list);
+		// System.out.println("outdir: "+list.get(0));
+		// System.out.println("outdir fixed: "+Zip.getRoot(zipFile));
+		File dir = new File("/home/mdecorde/workspace079/org.txm.setups/exportRCP/linux.gtk.x86_64/TXM/plugins");
+		File jarFile = new File(dir, "org.txm.statsengine.r.core_1.0.0.201805091353.jar");
+		File outDir = new File("/home/mdecorde/TEMP");
+		// System.out.println(StringUtils.join(Zip.listFiles(jarFile), "\n"));
+		System.out.println("Zip result: " + Zip.extractOneFile(jarFile, "R/", outDir));
+
+	}
+
+	public static boolean hasEntries(File zipFile, String... paths) {
+		HashSet<String> toFind = new HashSet(Arrays.asList(paths));
+		try {
+
+			ZipInputStream zis = new ZipInputStream(new BufferedInputStream(new FileInputStream(zipFile.getCanonicalFile())));
+			ZipEntry ze;
+
+			// Parcours tous les fichiers
+			while (null != (ze = zis.getNextEntry())) {
+				String currentpath = ze.getName();
+				// String filename = currentpath;
+				// if (filename.endsWith("/")) {
+				// filename = filename.substring(0, filename.length()-1);
+				// }
+				// if (filename.lastIndexOf("/") > 0) {
+				// filename = filename.substring(filename.lastIndexOf("/")+1);
+				// }
+				if (toFind.contains(currentpath)) {
+					toFind.remove(currentpath);
+					if (toFind.size() == 0) {
+						try {
+							zis.close();
+						} catch (IOException e) {
+							e.printStackTrace();
+						}
+						return true;
+					}
+				}
+			}
+
+			if (zis != null) {
+				try {
+					zis.close();
+				} catch (IOException e) {
+					e.printStackTrace();
+				}
+			}
+		} catch (Exception e) {
+			System.out.println("Fail to search for " + paths + " from " + zipFile + ": " + e);
+			Log.printStackTrace(e);
+		}
+
+		return toFind.size() == 0;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/zip/Zip.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/CharsetDetector.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/CharsetDetector.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/CharsetDetector.java	(revision 3666)
@@ -0,0 +1,86 @@
+package org.txm.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+
+import org.mozilla.universalchardet.CharsetListener;
+import org.mozilla.universalchardet.UniversalDetector;
+import org.txm.utils.io.IOUtils;
+
+public class CharsetDetector {
+	public static int MINIMALSIZE = 2000;
+	String encoding = System.getProperty("file.encoding"); //$NON-NLS-1$
+	LinkedHashMap<String, Integer> encodings = new LinkedHashMap<String, Integer>();
+
+	public CharsetDetector(File file) {
+		if (file.isDirectory())
+			processDirectory(file);
+		else
+			try {
+				processFile(file);
+			} catch (IOException e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+	}
+
+	private void processDirectory(File dir) {
+		for (File file : dir.listFiles(IOUtils.HIDDENFILE_FILTER)) {
+			if (file.isFile()) {
+				try {
+					processFile(file);
+				} catch (IOException e) {
+					// TODO Auto-generated catch block
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			}
+		}
+	}
+
+	String guessedCharset = System.getProperty("file.encoding"); //$NON-NLS-1$
+
+	private void processFile(File file) throws IOException {
+		guessedCharset = System.getProperty("file.encoding"); //$NON-NLS-1$
+		UniversalDetector detector = new UniversalDetector(new CharsetListener() {
+			@Override
+			public void report(String name) {
+				guessedCharset = name;
+			}
+		});
+
+		byte[] buf = new byte[4096];
+		java.io.FileInputStream fis = new java.io.FileInputStream(file);
+
+		int nread;
+		while ((nread = fis.read(buf)) > 0 && !detector.isDone()) {
+			detector.handleData(buf, 0, nread);
+		}
+		detector.dataEnd();
+
+		if (!encodings.containsKey(guessedCharset))
+			encodings.put(guessedCharset, 0);
+		encodings.put(guessedCharset, encodings.get(guessedCharset) + 1);
+		fis.close();
+	}
+
+	public String getEncoding() {
+		int max = 0;
+		for (String s : encodings.keySet()) {
+			if (max < encodings.get(s)) {
+				max = encodings.get(s);
+				encoding = s;
+			}
+		}
+		return encoding;
+	}
+
+	public LinkedHashMap<String, Integer> getEncodings() {
+		return encodings;
+	}
+
+	public static void main(String[] args) {
+		CharsetDetector detector = new CharsetDetector(new File("/home/mdecorde/Bureau/testencoding")); //$NON-NLS-1$
+		System.out.println(detector.getEncodings());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/CharsetDetector.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/DiffPrint.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/DiffPrint.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/DiffPrint.java	(revision 3666)
@@ -0,0 +1,638 @@
+package org.txm.utils;
+/*
+ * $Log: DiffPrint.java,v $
+ * Revision 1.10  2009/04/20 18:53:29  stuart
+ * Make print_header public.
+ *
+ * Revision 1.9  2009/01/19 03:05:26  stuart
+ * Fix StackOverflow bug with heuristic on reported by Jimmy Han.
+ *
+ * Revision 1.8  2007/12/20 05:04:21  stuart
+ * Can no longer import from default package.
+ *
+ * Revision 1.7  2007/12/20 04:29:53  stuart
+ * Fix setupOutput permission.  Thanks to Sargon Benjamin
+ *
+ * Revision 1.6  2005/04/27 02:13:40  stuart
+ * Add Str.dup()
+ *
+ * Revision 1.5  2004/01/29 02:35:35  stuart
+ * Test for out of bounds exception in UnifiedPrint.print_hunk.
+ * Add setOutput() to DiffPrint.Base.
+ *
+ * Revision 1.4  2003/04/22  01:50:47  stuart
+ * add Unified format diff
+ *
+ * Revision 1.3  2003/04/22  01:00:32  stuart
+ * added context diff format
+ *
+ * Revision 1.2  2000/03/02  16:59:54  stuart
+ * add GPL
+ *
+ */
+
+import java.io.*;
+import java.util.Vector;
+import java.util.Date;
+
+interface UnaryPredicate {
+	boolean execute(Object obj);
+}
+
+/**
+ * A simple framework for printing change lists produced by <code>Diff</code>.
+ * 
+ * @see bmsi.util.Diff
+ * @author Stuart D. Gathman Copyright (C) 2000 Business Management Systems,
+ *         Inc.
+ *         <p>
+ *         This program is free software; you can redistribute it and/or modify
+ *         it under the terms of the GNU General Public License as published by
+ *         the Free Software Foundation; either version 1, or (at your option)
+ *         any later version.
+ *         <p>
+ *         This program is distributed in the hope that it will be useful, but
+ *         WITHOUT ANY WARRANTY; without even the implied warranty of
+ *         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ *         General Public License for more details.
+ *         <p>
+ *         You should have received a copy of the GNU General Public License
+ *         along with this program; if not, write to the Free Software
+ *         Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+public class DiffPrint {
+	/**
+	 * A Base class for printing edit scripts produced by Diff. This class divides
+	 * the change list into "hunks", and calls <code>print_hunk</code> for each
+	 * hunk. Various utility methods are provided as well.
+	 */
+	public static abstract class Base {
+		protected PrintWriter outfile;
+
+		public void setOutput(Writer wtr) {
+			outfile = new PrintWriter(wtr);
+		}
+
+		protected void setupOutput() {
+			if (outfile == null)
+				outfile = new PrintWriter(new OutputStreamWriter(System.out));
+		}
+
+		protected Base(Object[] a, Object[] b) {
+			file0 = a;
+			file1 = b;
+		}
+
+		/**
+		 * Set to ignore certain kinds of lines when printing an edit script. For
+		 * example, ignoring blank lines or comments.
+		 */
+		protected UnaryPredicate ignore = null;
+
+		/**
+		 * Set to the lines of the files being compared.
+		 */
+		protected Object[] file0, file1;
+
+		/**
+		 * Divide SCRIPT into pieces by calling HUNKFUN and print each piece with
+		 * PRINTFUN. Both functions take one arg, an edit script.
+		 * 
+		 * PRINTFUN takes a subscript which belongs together (with a null link at the
+		 * end) and prints it.
+		 */
+		public void print_script(Diff.change script) {
+			setupOutput();
+			Diff.change next = script;
+
+			while (next != null) {
+				Diff.change t, end;
+
+				/* Find a set of changes that belong together. */
+				t = next;
+				end = hunkfun(next);
+
+				/*
+				 * Disconnect them from the rest of the changes, making them a hunk, and
+				 * remember the rest for next iteration.
+				 */
+				next = end.link;
+				end.link = null;
+				// if (DEBUG)
+				// debug_script(t);
+
+				/* Print this hunk. */
+				print_hunk(t);
+
+				/* Reconnect the script so it will all be freed properly. */
+				end.link = next;
+			}
+			outfile.flush();
+		}
+
+		/**
+		 * Called with the tail of the script and returns the last link that belongs
+		 * together with the start of the tail.
+		 */
+
+		protected Diff.change hunkfun(Diff.change hunk) {
+			return hunk;
+		}
+
+		protected int first0, last0, first1, last1, deletes, inserts;
+
+		/**
+		 * Look at a hunk of edit script and report the range of lines in each file that
+		 * it applies to. HUNK is the start of the hunk, which is a chain of `struct
+		 * change'. The first and last line numbers of file 0 are stored in *FIRST0 and
+		 * *LAST0, and likewise for file 1 in *FIRST1 and *LAST1. Note that these are
+		 * internal line numbers that count from 0.
+		 * 
+		 * If no lines from file 0 are deleted, then FIRST0 is LAST0+1.
+		 * 
+		 * Also set *DELETES nonzero if any lines of file 0 are deleted and set *INSERTS
+		 * nonzero if any lines of file 1 are inserted. If only ignorable lines are
+		 * inserted or deleted, both are set to 0.
+		 */
+
+		protected void analyze_hunk(Diff.change hunk) {
+			int f0, l0 = 0, f1, l1 = 0, show_from = 0, show_to = 0;
+			int i;
+			Diff.change next;
+			boolean nontrivial = (ignore == null);
+
+			show_from = show_to = 0;
+
+			f0 = hunk.line0;
+			f1 = hunk.line1;
+
+			for (next = hunk; next != null; next = next.link) {
+				l0 = next.line0 + next.deleted - 1;
+				l1 = next.line1 + next.inserted - 1;
+				show_from += next.deleted;
+				show_to += next.inserted;
+				for (i = next.line0; i <= l0 && !nontrivial; i++)
+					if (!ignore.execute(file0[i]))
+						nontrivial = true;
+				for (i = next.line1; i <= l1 && !nontrivial; i++)
+					if (!ignore.execute(file1[i]))
+						nontrivial = true;
+			}
+
+			first0 = f0;
+			last0 = l0;
+			first1 = f1;
+			last1 = l1;
+
+			/*
+			 * If all inserted or deleted lines are ignorable, tell the caller to ignore
+			 * this hunk.
+			 */
+
+			if (!nontrivial)
+				show_from = show_to = 0;
+
+			deletes = show_from;
+			inserts = show_to;
+		}
+
+		/**
+		 * Called to print the script header which identifies the files compared. The
+		 * default does nothing (except set output to system.out if not otherwise set).
+		 * Derived style classes can override to print the files compared in the format
+		 * for that style.
+		 */
+		public void print_header(String filea, String fileb) {
+			setupOutput();
+		}
+
+		protected abstract void print_hunk(Diff.change hunk);
+
+		protected void print_1_line(String pre, Object linbuf) {
+			outfile.println(pre + linbuf.toString());
+		}
+
+		/**
+		 * Print a pair of line numbers with SEPCHAR, translated for file FILE. If the
+		 * two numbers are identical, print just one number.
+		 * 
+		 * Args A and B are internal line numbers. We print the translated (real) line
+		 * numbers.
+		 */
+
+		protected void print_number_range(char sepchar, int a, int b) {
+			/*
+			 * Note: we can have B < A in the case of a range of no lines. In this case, we
+			 * should print the line number before the range, which is B.
+			 */
+			if (++b > ++a)
+				outfile.print("" + a + sepchar + b);
+			else
+				outfile.print(b);
+		}
+
+		public static char change_letter(int inserts, int deletes) {
+			if (inserts == 0)
+				return 'd';
+			else if (deletes == 0)
+				return 'a';
+			else
+				return 'c';
+		}
+	}
+
+	/**
+	 * Print a change list in the standard diff format.
+	 */
+	public static class NormalPrint extends Base {
+
+		public NormalPrint(Object[] a, Object[] b) {
+			super(a, b);
+		}
+
+		/**
+		 * Print a hunk of a normal diff. This is a contiguous portion of a complete
+		 * edit script, describing changes in consecutive lines.
+		 */
+
+		protected void print_hunk(Diff.change hunk) {
+
+			/* Determine range of line numbers involved in each file. */
+			analyze_hunk(hunk);
+			if (deletes == 0 && inserts == 0)
+				return;
+
+			/* Print out the line number header for this hunk */
+			print_number_range(',', first0, last0);
+			outfile.print(change_letter(inserts, deletes));
+			print_number_range(',', first1, last1);
+			outfile.println();
+
+			/* Print the lines that the first file has. */
+			if (deletes != 0)
+				for (int i = first0; i <= last0; i++)
+					print_1_line("< ", file0[i]);
+
+			if (inserts != 0 && deletes != 0)
+				outfile.println("---");
+
+			/* Print the lines that the second file has. */
+			if (inserts != 0)
+				for (int i = first1; i <= last1; i++)
+					print_1_line("> ", file1[i]);
+		}
+	}
+
+	/**
+	 * Prints an edit script in a format suitable for input to <code>ed</code>. The
+	 * edit script must be generated with the reverse option to be useful as actual
+	 * <code>ed</code> input.
+	 */
+	public static class EdPrint extends Base {
+
+		public EdPrint(Object[] a, Object[] b) {
+			super(a, b);
+		}
+
+		/** Print a hunk of an ed diff */
+		protected void print_hunk(Diff.change hunk) {
+
+			/* Determine range of line numbers involved in each file. */
+			analyze_hunk(hunk);
+			if (deletes == 0 && inserts == 0)
+				return;
+
+			/* Print out the line number header for this hunk */
+			print_number_range(',', first0, last0);
+			outfile.println(change_letter(inserts, deletes));
+
+			/* Print new/changed lines from second file, if needed */
+			if (inserts != 0) {
+				boolean inserting = true;
+				for (int i = first1; i <= last1; i++) {
+					/* Resume the insert, if we stopped. */
+					if (!inserting)
+						outfile.println(i - first1 + first0 + "a");
+					inserting = true;
+
+					/*
+					 * If the file's line is just a dot, it would confuse `ed'. So output it with a
+					 * double dot, and set the flag LEADING_DOT so that we will output another
+					 * ed-command later to change the double dot into a single dot.
+					 */
+
+					if (".".equals(file1[i])) {
+						outfile.println("..");
+						outfile.println(".");
+						/* Now change that double dot to the desired single dot. */
+						outfile.println(i - first1 + first0 + 1 + "s/^\\.\\././");
+						inserting = false;
+					} else
+						/* Line is not `.', so output it unmodified. */
+						print_1_line("", file1[i]);
+				}
+
+				/* End insert mode, if we are still in it. */
+				if (inserting)
+					outfile.println(".");
+			}
+		}
+	}
+
+	/**
+	 * Prints an edit script in context diff format. This and its 'unified'
+	 * variation is used for source code patches.
+	 */
+	public static class ContextPrint extends Base {
+
+		protected int context = 3;
+
+		public ContextPrint(Object[] a, Object[] b) {
+			super(a, b);
+		}
+
+		protected void print_context_label(String mark, File inf, String label) {
+			setupOutput();
+			if (label != null)
+				outfile.println(mark + ' ' + label);
+			else if (inf.lastModified() > 0)
+				// FIXME: use DateFormat to get precise format needed.
+				outfile.println(mark + ' ' + inf.getPath() + '\t' + new Date(inf.lastModified()));
+			else
+				/* Don't pretend that standard input is ancient. */
+				outfile.println(mark + ' ' + inf.getPath());
+		}
+
+		public void print_header(String filea, String fileb) {
+			print_context_label("***", new File(filea), filea);
+			print_context_label("---", new File(fileb), fileb);
+		}
+
+		/** If function_regexp defined, search for start of function. */
+		private String find_function(Object[] lines, int start) {
+			return null;
+		}
+
+		protected void print_function(Object[] file, int start) {
+			String function = find_function(file0, first0);
+			if (function != null) {
+				outfile.print(" ");
+				outfile.print((function.length() < 40) ? function : function.substring(0, 40));
+			}
+		}
+
+		protected void print_hunk(Diff.change hunk) {
+
+			/* Determine range of line numbers involved in each file. */
+
+			analyze_hunk(hunk);
+
+			if (deletes == 0 && inserts == 0)
+				return;
+
+			/* Include a context's width before and after. */
+
+			first0 = Math.max(first0 - context, 0);
+			first1 = Math.max(first1 - context, 0);
+			last0 = Math.min(last0 + context, file0.length - 1);
+			last1 = Math.min(last1 + context, file1.length - 1);
+
+			outfile.print("***************");
+
+			/*
+			 * If we looked for and found a function this is part of, include its name in
+			 * the header of the diff section.
+			 */
+			print_function(file0, first0);
+
+			outfile.println();
+			outfile.print("*** ");
+			print_number_range(',', first0, last0);
+			outfile.println(" ****");
+
+			if (deletes != 0) {
+				Diff.change next = hunk;
+
+				for (int i = first0; i <= last0; i++) {
+					/*
+					 * Skip past changes that apply (in file 0) only to lines before line I.
+					 */
+
+					while (next != null && next.line0 + next.deleted <= i)
+						next = next.link;
+
+					/* Compute the marking for line I. */
+
+					String prefix = " ";
+					if (next != null && next.line0 <= i)
+						/*
+						 * The change NEXT covers this line. If lines were inserted here in file 1, this
+						 * is "changed". Otherwise it is "deleted".
+						 */
+						prefix = (next.inserted > 0) ? "!" : "-";
+
+					print_1_line(prefix, file0[i]);
+				}
+			}
+
+			outfile.print("--- ");
+			print_number_range(',', first1, last1);
+			outfile.println(" ----");
+
+			if (inserts != 0) {
+				Diff.change next = hunk;
+
+				for (int i = first1; i <= last1; i++) {
+					/*
+					 * Skip past changes that apply (in file 1) only to lines before line I.
+					 */
+
+					while (next != null && next.line1 + next.inserted <= i)
+						next = next.link;
+
+					/* Compute the marking for line I. */
+
+					String prefix = " ";
+					if (next != null && next.line1 <= i)
+						/*
+						 * The change NEXT covers this line. If lines were deleted here in file 0, this
+						 * is "changed". Otherwise it is "inserted".
+						 */
+						prefix = (next.deleted > 0) ? "!" : "+";
+
+					print_1_line(prefix, file1[i]);
+				}
+			}
+		}
+	}
+
+	/**
+	 * Prints an edit script in context diff format. This and its 'unified'
+	 * variation is used for source code patches.
+	 */
+	public static class UnifiedPrint extends ContextPrint {
+
+		public UnifiedPrint(Object[] a, Object[] b) {
+			super(a, b);
+		}
+
+		public void print_header(String filea, String fileb) {
+			print_context_label("---", new File(filea), filea);
+			print_context_label("+++", new File(fileb), fileb);
+		}
+
+		private void print_number_range(int a, int b) {
+			// translate_range (file, a, b, &trans_a, &trans_b);
+
+			/*
+			 * Note: we can have B < A in the case of a range of no lines. In this case, we
+			 * should print the line number before the range, which is B.
+			 */
+			if (b < a)
+				outfile.print(b + ",0");
+			else
+				super.print_number_range(',', a, b);
+		}
+
+		protected void print_hunk(Diff.change hunk) {
+			/* Determine range of line numbers involved in each file. */
+			analyze_hunk(hunk);
+
+			if (deletes == 0 && inserts == 0)
+				return;
+
+			/* Include a context's width before and after. */
+
+			first0 = Math.max(first0 - context, 0);
+			first1 = Math.max(first1 - context, 0);
+			last0 = Math.min(last0 + context, file0.length - 1);
+			last1 = Math.min(last1 + context, file1.length - 1);
+
+			outfile.print("@@ -");
+			print_number_range(first0, last0);
+			outfile.print(" +");
+			print_number_range(first1, last1);
+			outfile.print(" @@");
+
+			/*
+			 * If we looked for and found a function this is part of, include its name in
+			 * the header of the diff section.
+			 */
+			print_function(file0, first0);
+
+			outfile.println();
+
+			Diff.change next = hunk;
+			int i = first0;
+			int j = first1;
+
+			while (i <= last0 || j <= last1) {
+
+				/* If the line isn't a difference, output the context from file 0. */
+
+				if (next == null || i < next.line0) {
+					if (i < file0.length) {
+						outfile.print(' ');
+						print_1_line("", file0[i++]);
+					}
+					j++;
+				} else {
+					/* For each difference, first output the deleted part. */
+
+					int k = next.deleted;
+					while (k-- > 0) {
+						outfile.print('-');
+						print_1_line("", file0[i++]);
+					}
+
+					/* Then output the inserted part. */
+
+					k = next.inserted;
+					while (k-- > 0) {
+						outfile.print('+');
+						print_1_line("", file1[j++]);
+					}
+
+					/* We're done with this hunk, so on to the next! */
+
+					next = next.link;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Read a text file into an array of String. This provides basic diff
+	 * functionality. A more advanced diff utility will use specialized objects to
+	 * represent the text lines, with options to, for example, convert sequences of
+	 * whitespace to a single space for comparison purposes.
+	 */
+	static String[] slurp(String file) throws IOException {
+		BufferedReader rdr = new BufferedReader(new FileReader(file));
+		Vector s = new Vector();
+		for (;;) {
+			String line = rdr.readLine();
+			if (line == null)
+				break;
+			s.addElement(line);
+		}
+		String[] a = new String[s.size()];
+		s.copyInto(a);
+		rdr.close();
+		return a;
+	}
+
+	public static void main(String[] argv) throws IOException {
+		String filea = argv[argv.length - 2];
+		String fileb = argv[argv.length - 1];
+		String[] a = slurp(filea);
+		String[] b = slurp(fileb);
+		Diff d = new Diff(a, b);
+		char style = 'n';
+		d.heuristic = false;
+		for (int i = 0; i < argv.length - 2; ++i) {
+			String f = argv[i];
+			if (f.startsWith("-")) {
+				for (int j = 1; j < f.length(); ++j) {
+					switch (f.charAt(j)) {
+					case 'H': // heuristic on
+						d.heuristic = true;
+						break;
+					case 'e': // Ed style
+						style = 'e';
+						break;
+					case 'c': // Context diff
+						style = 'c';
+						break;
+					case 'u':
+						style = 'u';
+						break;
+					}
+				}
+			}
+		}
+		boolean reverse = style == 'e';
+		Diff.change script = d.diff_2(reverse);
+		if (script == null)
+			System.err.println("No differences");
+		else {
+			Base p;
+			switch (style) {
+			case 'e':
+				p = new EdPrint(a, b);
+				break;
+			case 'c':
+				p = new ContextPrint(a, b);
+				break;
+			case 'u':
+				p = new UnifiedPrint(a, b);
+				break;
+			default:
+				p = new NormalPrint(a, b);
+			}
+			p.print_header(filea, fileb);
+			p.print_script(script);
+		}
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/DiffPrint.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/ExecTimer.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/ExecTimer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/ExecTimer.java	(revision 3666)
@@ -0,0 +1,44 @@
+package org.txm.utils;
+
+import java.util.Date;
+
+import org.txm.utils.messages.UtilsCoreMessages;
+
+public class ExecTimer {
+	static long startTime = 0, endTime = 0;
+	static String message = ""; //$NON-NLS-1$
+
+	public static void start() {
+		startTime = new Date().getTime();
+	}
+
+	public static String stop() {
+		endTime = new Date().getTime();
+		return setMessage(endTime - startTime);
+	}
+
+	static float t;
+
+	private static String setMessage(float time) {
+		t = time;
+		if (t < 1000) {
+			message = "" + ((int) t) + UtilsCoreMessages.ExecTimer_0; //$NON-NLS-1$
+		} else {
+			t = t / 1000;
+			if (t < 3) {
+				message = "" + t; //$NON-NLS-1$
+				message = "" + (message.substring(0, 3)) + UtilsCoreMessages.ExecTimer_1; //$NON-NLS-1$
+			} else if (t < 60)
+				message = "" + ((int) t) + UtilsCoreMessages.ExecTimer_1; //$NON-NLS-1$
+			else if (t < 3600)
+				message = "" + ((int) t / 60) + UtilsCoreMessages.ExecTimer_2 + ((int) t % 60) + UtilsCoreMessages.ExecTimer_1; //$NON-NLS-1$
+			else
+				message = "" + ((int) t / 3600) + UtilsCoreMessages.ExecTimer_3 + ((int) (t % 3600) / 60) + UtilsCoreMessages.ExecTimer_2 + ((int) (t % 3600) % 60) + UtilsCoreMessages.ExecTimer_1; //$NON-NLS-1$
+		}
+		return message + " (" + (int) time + " ms)"; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	public static String getMessage() {
+		return message;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/ExecTimer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/io/IOUtils.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/io/IOUtils.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/io/IOUtils.java	(revision 3666)
@@ -0,0 +1,318 @@
+package org.txm.utils.io;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.FileUtils;
+import org.txm.utils.i18n.DetectBOM;
+import org.txm.utils.logger.Log;
+
+public class IOUtils {
+
+	public static final String UTF8 = "UTF-8"; //$NON-NLS-1$
+
+	public static ArrayList<String> findWithGroup(File file, String pattern) throws IOException {
+		
+		return findWithGroup(file, UTF8, pattern, false);
+	}
+
+	public static ArrayList<String> findWithGroup(File file, String pattern, boolean normalizeSeparators) throws IOException {
+		
+		return findWithGroup(file, UTF8, pattern, normalizeSeparators);
+	}
+
+	public static ArrayList<String> findWithGroup(File file, String encoding, String pattern) throws IOException {
+		
+		return findWithGroup(file, encoding, pattern, false);
+	}
+
+	/**
+	 * select only files not hidden @deprecated
+	 */
+	public static final FileFilter HIDDENFILE_FILTER = FileUtils.HIDDENFILE_FILTER;
+
+
+	public static ArrayList<String> findWithGroup(File file, String encoding, String pattern, boolean normalizeSeparators) throws IOException {
+		
+		ArrayList<String> matches = new ArrayList<String>();
+		String text = IOUtils.getText(file, encoding);
+		if (normalizeSeparators) {
+			text = text.replaceAll("\\s", " "); //$NON-NLS-1$
+			text = text.replaceAll("\\t", " "); //$NON-NLS-1$
+			text = text.replaceAll("\\n", " "); //$NON-NLS-1$
+			text = text.replaceAll("[ ]+", " "); //$NON-NLS-1$
+		}
+
+		Pattern test = Pattern.compile(pattern);
+		Matcher m = test.matcher(text);
+		while (m.find()) {
+			matches.add(m.group(1));
+		}
+		return matches;
+	}
+
+	public static ArrayList<String> find(File file, String pattern) throws IOException {
+		
+		return find(file, UTF8, pattern, false);
+	}
+
+	public static ArrayList<String> find(File file, String pattern, boolean normalizeSeparators) throws IOException {
+		
+		return findWithGroup(file, UTF8, pattern, normalizeSeparators);
+	}
+
+	public static ArrayList<String> find(File file, String encoding, String pattern) throws IOException {
+		
+		return find(file, encoding, pattern, false);
+	}
+
+	public static ArrayList<String> find(File file, String encoding, String pattern, boolean normalizeSeparators) throws IOException {
+		
+		ArrayList<String> matches = new ArrayList<String>();
+		String text = IOUtils.getText(file, encoding);
+		// System.out.println(text);
+		if (normalizeSeparators) {
+			text = text.replaceAll("\\s", " "); //$NON-NLS-1$ //$NON-NLS-2$
+			text = text.replaceAll("\\t", " "); //$NON-NLS-1$ //$NON-NLS-2$
+			text = text.replaceAll("\\n", " "); //$NON-NLS-1$ //$NON-NLS-2$
+			text = text.replaceAll("[ ]+", " "); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+
+		Pattern test = Pattern.compile(pattern);
+		Matcher m = test.matcher(text);
+		while (m.find()) {
+			matches.add(m.group());
+		}
+		return matches;
+	}
+
+	public static BufferedReader getReader(File file) throws UnsupportedEncodingException, FileNotFoundException {
+		
+		return getReader(file, UTF8);
+	}
+
+	/**
+	 * 
+	 * @param file
+	 * @param encoding
+	 *            if null the "UTF-8" encoding is used
+	 * @return
+	 * @throws UnsupportedEncodingException
+	 * @throws FileNotFoundException
+	 */
+	public static BufferedReader getReader(File file, String encoding) throws UnsupportedEncodingException, FileNotFoundException {
+		
+		if (encoding == null) {
+			encoding = UTF8; // prevent null exception
+		}
+		
+		FileInputStream input = new FileInputStream(file);
+		DetectBOM db = new DetectBOM(file);
+		for (int ibom = 0; ibom < db.getBOMSize(); ibom++) {
+			try {
+				input.read();
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+		}
+		return new BufferedReader(new InputStreamReader(input, encoding));
+	}
+
+	public static BufferedReader getReader(String file) throws UnsupportedEncodingException, FileNotFoundException {
+		
+		return getReader(new File(file), UTF8);
+	}
+
+	public static BufferedReader getReader(URL url) throws IOException {
+
+		return getReader(url, UTF8);
+	}
+
+	public static BufferedReader getReader(URL url, String encoding) throws IOException {
+
+		if (encoding == null) {
+			encoding = UTF8; // prevent null exception
+		}
+		
+		URLConnection conn = url.openConnection();
+		InputStream inputStream = conn.getInputStream();
+		return new BufferedReader(new InputStreamReader(inputStream, encoding));
+	}
+
+	public static void setText(File file, String text, String encoding) throws IOException {
+		
+		PrintWriter writer = getWriter(file, encoding);
+		writer.print(text);
+		writer.close();
+	}
+
+	public static String getText(URL url, String encoding) throws IOException {
+		
+		BufferedReader reader = getReader(url, encoding);
+		StringBuilder builder = new StringBuilder();
+		try {
+			String line = reader.readLine();
+			while (line != null) {
+				builder.append(line);
+				line = reader.readLine();
+				if (line != null)
+					builder.append("\n"); //$NON-NLS-1$
+			}
+		} finally {
+			reader.close();
+		}
+		return builder.toString();
+	}
+
+	public static String getText(File file) throws IOException {
+		
+		return getText(file, UTF8);
+	}
+
+	public static String getText(File file, String encoding) throws IOException {
+		
+		BufferedReader reader = getReader(file, encoding);
+		StringBuilder builder = new StringBuilder();
+		try {
+			String line = reader.readLine();
+			while (line != null) {
+				builder.append(line);
+				line = reader.readLine();
+				if (line != null)
+					builder.append("\n"); //$NON-NLS-1$
+			}
+		} finally {
+			reader.close();
+		}
+		return builder.toString();
+	}
+
+	public static PrintWriter getWriter(File file) throws UnsupportedEncodingException, FileNotFoundException {
+		
+		return getWriter(file, UTF8);
+	}
+
+	public static PrintWriter getWriter(File file, String encoding) throws UnsupportedEncodingException, FileNotFoundException {
+		
+		return getWriter(file, encoding, false);
+	}
+
+	public static PrintWriter getWriter(File file, boolean append) throws UnsupportedEncodingException, FileNotFoundException {
+		
+		return getWriter(file, UTF8, append);
+	}
+
+	public static PrintWriter getWriter(File file, String encoding, boolean append) throws UnsupportedEncodingException, FileNotFoundException {
+		
+		if (encoding == null) {
+			encoding = UTF8; // prevent null exception
+		}
+		
+		return new PrintWriter(new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(file, append)), encoding));
+	}
+
+	public static PrintWriter getWriter(String file) throws UnsupportedEncodingException, FileNotFoundException {
+		
+		return getWriter(new File(file), UTF8);
+	}
+
+	public static boolean write(File file, String str) {
+		
+		PrintWriter writer = null;
+		try {
+			writer = getWriter(file);
+			writer.write(str);
+		} catch(Exception e) {
+			Log.warning(NLS.bind("Error while writing the {0} file: {1}", file, e));
+			return false;
+		} finally {
+			if (writer != null) {
+				writer.close();
+			}
+		}
+		return true;
+	}
+
+	public static ArrayList<String> getLines(File file, String encoding) {
+		
+		ArrayList<String> lines = new ArrayList<String>();
+		try {
+			BufferedReader reader = IOUtils.getReader(file, encoding);
+			String line = reader.readLine();
+			while (line != null) {
+				lines.add(line);
+				line = reader.readLine();
+			}
+			reader.close();
+		} catch (Exception e) {
+			System.err.println(NLS.bind("Error while getting lines: {0}.", e.getLocalizedMessage()));
+		}
+		return lines;
+	}
+
+	/**
+	 * 
+	 * @param manifest
+	 * @return an InputStream, dont forget to close it
+	 * @throws MalformedURLException
+	 * @throws IOException
+	 */
+	public static InputStream getInput(File file) throws MalformedURLException, IOException {
+		
+		return file.toURI().toURL().openStream();
+	}
+
+	public static OutputStream getOutputStream(File file) throws FileNotFoundException {
+		
+		return new BufferedOutputStream(new FileOutputStream(file, false));
+	}
+
+	public static OutputStream getOutputStream(File file, boolean append) throws FileNotFoundException {
+		
+		return new BufferedOutputStream(new FileOutputStream(file, append));
+	}
+
+	public static void replace(File file, String oldString, String newString) throws IOException {
+		
+		String text = getText(file, UTF8);
+		text = text.replace(oldString, newString);
+		IOUtils.write(file, text);
+	}
+
+	public static void replaceAll(File file, Pattern regex, String newString) throws IOException {
+		
+		String text = getText(file, UTF8);
+		text = regex.matcher(text).replaceAll(newString);
+		IOUtils.write(file, text);
+	}
+
+	public static String firstLine(File file) {
+		try {
+			BufferedReader reader = getReader(file);
+			String line = reader.readLine();
+			reader.close();
+			return line;
+		} catch (Exception e) {
+			return null;
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/io/IOUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/io/FileCopy.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/io/FileCopy.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/io/FileCopy.java	(revision 3666)
@@ -0,0 +1,261 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2016-11-17 17:01:31 +0100 (Thu, 17 Nov 2016) $
+// $LastChangedRevision: 3341 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.io;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+import org.txm.utils.messages.UtilsCoreMessages;
+
+/**
+ * File copy methods
+ */
+public class FileCopy {
+
+	private static final boolean isWindows = System.getProperty("os.name").contains("Windows");
+
+	/**
+	 * replace the file if it exists
+	 * 
+	 * @param source
+	 * @param dest
+	 * @return
+	 * @throws IOException
+	 */
+	public static boolean copy(File source, File dest) throws IOException {
+		
+		return copy(source, dest, true);
+	}
+
+	/**
+	 * copy one file with nio package to accelerate the copy
+	 * 
+	 * !!! on windows : max size = 64mo !!!.
+	 * 
+	 * resolve symbolic links
+	 *
+	 * @param source
+	 *            the source
+	 * @param dest
+	 *            the dest
+	 * @return true, if successful
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static boolean copy(File source, File dest, boolean replace) throws IOException {
+		
+		if (dest.exists() && !replace)
+			return true; // don't replace file
+
+		if (isWindows || source.length() >= Integer.MAX_VALUE) {
+			// System.out.println("COPY BIG FILE");
+			FileInputStream instream = null;
+			BufferedOutputStream outstream = null;
+			try {
+				// Open a stream of bytes to read the file bytes into the program
+				instream = new FileInputStream(source);
+				// A stream of bytes from the program to the destination
+				outstream = new BufferedOutputStream(new FileOutputStream(dest));
+				byte[] buffer = new byte[4096];
+				int bytesRead;
+				// Write the bytes from the inputstream to the outputstream
+				while ((bytesRead = instream.read(buffer)) != -1) {
+					outstream.write(buffer, 0, bytesRead);
+				}
+			} catch (Exception e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return false;
+			} finally {
+				if (instream != null)
+					instream.close();
+				if (outstream != null)
+					outstream.close();
+				instream = null;
+				outstream = null;
+			}
+		} else {
+			// System.out.println("COPY NORMAL FILE");
+			FileChannel in = null, out = null;
+			FileInputStream fis = null;
+			FileOutputStream fos = null;
+			try {
+				fis = new FileInputStream(source);
+				fos = new FileOutputStream(dest);
+				in = fis.getChannel();
+				out = fos.getChannel();
+
+				long size = in.size();
+				MappedByteBuffer buf = in.map(FileChannel.MapMode.READ_ONLY, 0, size);
+
+				out.write(buf);
+			} catch (Exception e) {
+				org.txm.utils.logger.Log.printStackTrace(e);
+
+				if (fis != null)
+					fis.close();
+				if (fos != null)
+					fos.close();
+				if (in != null)
+					in.close();
+				if (out != null)
+					out.close();
+
+				return false;
+			} finally {
+				if (fis != null)
+					fis.close();
+				if (fos != null)
+					fos.close();
+				if (in != null)
+					in.close();
+				if (out != null)
+					out.close();
+			}
+		}
+		return true;
+	}
+
+	/**
+	 * Copy files. Don't erase the destination directory and replace files if they
+	 * already exists
+	 * 
+	 * warning: Symbolic links are not resolved and the link file is recreated
+	 *
+	 * @param src
+	 *            the src directory
+	 * @param dest
+	 *            the dest directory
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void copyFiles(File src, File dest) throws IOException {
+		
+		copyFiles(src, dest, true);
+	}
+
+	/**
+	 * Copy files. Don't erase the destination directory and replace files if they
+	 * already exists
+	 *
+	 * warning: Symbolic links are not resolved and the link file is recreated
+	 *
+	 * @param src
+	 *            the src directory
+	 * @param dest
+	 *            the dest directory
+	 * @param replace
+	 *            replace files if true
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public static void copyFiles(File src, File dest, boolean replace) throws IOException {
+
+		// Check to ensure that the source is valid...
+		if (!src.exists()) {
+			throw new IOException(UtilsCoreMessages.FileCopy_0 + src.getAbsolutePath() + "."); //$NON-NLS-1$
+		} else if (!src.canRead()) { // check to ensure we have rights to the
+			// source...
+			throw new IOException(UtilsCoreMessages.FileCopy_2 + src.getAbsolutePath() + "."); //$NON-NLS-1$
+		}
+
+		if (Files.isSymbolicLink(src.toPath())) { // copy symbolic links
+			Path target = Files.readSymbolicLink(src.toPath());
+			Files.createSymbolicLink(dest.toPath(), target);
+		} else if (src.isDirectory()) { // is it a directory ?
+
+			if (!dest.exists()) { // does the destination already exist?
+				// if not create the file hierarchy
+				dest.mkdirs();
+				if (!dest.exists()) {
+					throw new IOException(UtilsCoreMessages.FileCopy_4 + dest.getAbsolutePath() + "."); //$NON-NLS-1$
+				}
+			}
+
+			// get a listing of files...
+			String list[] = src.list();
+			// copy all the files in the list.
+			for (int i = 0; i < list.length; i++) {
+				File dest1 = new File(dest, list[i]);
+				File src1 = new File(src, list[i]);
+				copyFiles(src1, dest1);
+
+			}
+		} else {
+			// This was not a directory, so lets just copy the file
+			copy(src, dest, replace);
+		}
+	}
+
+	public static void main(String[] args) throws IOException {
+		// File test1 = File.createTempFile("source", ".large"); //$NON-NLS-1$
+		// //$NON-NLS-2$
+		// File test2 = File.createTempFile("source", ".verylarge"); //$NON-NLS-1$
+		// //$NON-NLS-2$
+		//
+		// System.out.println("write "+test1); //$NON-NLS-1$
+		// writeBigFile(test1, Integer.MAX_VALUE / 2, 1);
+		// System.out.println("write "+test2); //$NON-NLS-1$
+		// writeBigFile(test2, Integer.MAX_VALUE / 2, 3);
+		//
+		// System.out.println("test1: "+test1+" : "+test1.length()); //$NON-NLS-1$
+		// //$NON-NLS-2$
+		// System.out.println("test2: "+test2+" : "+test2.length()); //$NON-NLS-1$
+		// //$NON-NLS-2$
+		//
+		// File copy1 = File.createTempFile("copy", ".large"); //$NON-NLS-1$
+		// //$NON-NLS-2$
+		// File copy2 = File.createTempFile("copy", ".verylarge"); //$NON-NLS-1$
+		// //$NON-NLS-2$
+		//
+		// System.out.println("Copy1 "+copy1); //$NON-NLS-1$
+		// FileCopy.copy(test1, copy1);
+		// System.out.println("Copy2 "+copy2); //$NON-NLS-1$
+		// FileCopy.copy(test2, copy2);
+		//
+		// System.out.println("copy1: "+copy1+" : "+copy1.length()); //$NON-NLS-1$
+		// //$NON-NLS-2$
+		// System.out.println("copy2: "+copy2+" : "+copy2.length()); //$NON-NLS-1$
+		// //$NON-NLS-2$
+		//
+		// System.out.println("delete 1 "+test1.delete()); //$NON-NLS-1$
+		// System.out.println("delete 2 "+test2.delete()); //$NON-NLS-1$
+		// System.out.println("delete c1 "+copy1.delete()); //$NON-NLS-1$
+		// System.out.println("delete c2 "+copy2.delete()); //$NON-NLS-1$
+
+		File dir1 = new File("/home/mdecorde/TEMP/copydir");
+		File dir2 = new File("/home/mdecorde/TEMP/copydir3");
+		FileCopy.copyFiles(dir1, dir2);
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/io/FileCopy.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/MessagePrinter.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/MessagePrinter.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/MessagePrinter.java	(revision 3666)
@@ -0,0 +1,7 @@
+package org.txm.utils;
+
+public interface MessagePrinter {
+	public void println(String message);
+
+	public void print(String message);
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/MessagePrinter.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Tuple.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Tuple.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Tuple.java	(revision 3666)
@@ -0,0 +1,51 @@
+package org.txm.utils;
+
+import java.util.HashSet;
+
+public class Tuple<T> {
+
+	public T a, b;
+
+	public Tuple(T a, T b) {
+		this.a = a;
+		this.b = b;
+	}
+
+	static String format = "%s %s";
+
+	public String toString() {
+		return String.format(format, a, b);
+	}
+
+	@Override
+	public int hashCode() {
+		return a.hashCode() * b.hashCode();
+	}
+
+	@Override
+	public boolean equals(Object t) {
+		if (t instanceof Tuple)
+			return equals((Tuple<?>) t);
+		else
+			return super.equals(t);
+	};
+
+	public boolean equals(Tuple<Object> t) {
+		return a.equals(t.a) & b.equals(t.b);
+	};
+
+	public static void main(String[] args) {
+		Tuple<Integer> t1 = new Tuple<Integer>(1, 1);
+		Tuple<Integer> t2 = new Tuple<Integer>(1, 2);
+		Tuple<Integer> t3 = new Tuple<Integer>(1, 3);
+		Tuple<Integer> t33 = new Tuple<Integer>(1, 3);
+
+		HashSet<Tuple<Integer>> set = new HashSet<Tuple<Integer>>();
+		set.add(t1);
+		set.add(t2);
+		set.add(t3);
+		set.add(t33);
+
+		System.out.println(set);
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Tuple.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/StreamHog.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/StreamHog.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/StreamHog.java	(revision 3666)
@@ -0,0 +1,139 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2014-09-15 10:51:15 +0200 (Mon, 15 Sep 2014) $
+// $LastChangedRevision: 2836 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+
+import org.txm.utils.logger.Log;
+
+/**
+ * The StreamHog read the given InputStream in a Thread until the InputStream is
+ * closed.
+ * 
+ * If a MessagePrinter is set, then the messages are displayed with the
+ * MessagePrinter and not in sys.out
+ */
+public class StreamHog extends Thread {
+
+	InputStream is;
+	BufferedReader br;
+	ArrayList<MessagePrinter> messagePrinters = new ArrayList<>();
+
+	public String lastline;
+	boolean log;
+
+	/**
+	 * Instantiates a new stream hog.
+	 *
+	 * @param is
+	 *            the is
+	 * @param log
+	 *            the capture
+	 */
+	public StreamHog(InputStream is, boolean log) {
+		this.setName("");
+		this.is = is;
+		this.log = log;
+		start();
+	}
+
+	public String getLastMessage() {
+		return lastline;
+	}
+
+	public InputStream getInputStream() {
+		return is;
+	}
+
+	public BufferedReader getBufferedReader() {
+		return br;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Thread#run()
+	 */
+	@Override
+	public void run() {
+		try {
+			br = new BufferedReader(new InputStreamReader(is));
+			String line = null;
+			while ((line = br.readLine()) != null) {
+				if (log) { // we are supposed to capture the output from
+					Log.info(this.getName() + ">" + line); //$NON-NLS-1$
+				}
+
+				printMessage(line);
+				lastline = line;
+			}
+		} catch (Throwable e) {
+			Log.fine("ERROR: broken process logging : " + e); //$NON-NLS-1$
+			// org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * print the message to any registered MessagePrinter
+	 * 
+	 * @param msg
+	 */
+	public void printMessage(String msg) {
+		if (messagePrinters.size() > 0) {
+			for (MessagePrinter mp : messagePrinters) {
+				mp.println(msg);
+			}
+		}
+	}
+
+	/**
+	 * Use this method to retrieve messages
+	 * 
+	 * @param mp
+	 */
+	public void registerMessagePrinter(MessagePrinter mp) {
+		this.messagePrinters.add(mp);
+	}
+
+	public ArrayList<MessagePrinter> getMessagePrinter() {
+		return this.messagePrinters;
+	}
+
+	/**
+	 * Sets the prints the.
+	 *
+	 * @param log
+	 *            activate message logs if true
+	 */
+	public void setPrint(boolean log) {
+		this.log = log;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/StreamHog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Pair.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Pair.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Pair.java	(revision 3666)
@@ -0,0 +1,184 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils;
+
+import java.util.HashMap;
+
+import org.txm.utils.messages.UtilsCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * similar to a C++ pair @ author mdecorde.
+ *
+ * @param <T>
+ *            the generic type
+ * @param <V>
+ *            the value type
+ */
+public class Pair<T, V> {
+
+	/** The o1. */
+	public T o1;
+
+	/** The o2. */
+	public V o2;
+
+	/**
+	 * Instantiates a new pair.
+	 *
+	 * @param o1
+	 *            the o1
+	 * @param o2
+	 *            the o2
+	 */
+	public Pair(T o1, V o2) {
+		this.o1 = o1;
+		this.o2 = o2;
+	}
+
+	/**
+	 * Same.
+	 *
+	 * @param o1
+	 *            the o1
+	 * @param o2
+	 *            the o2
+	 * @return true, if successful
+	 */
+	public static boolean same(Object o1, Object o2) {
+		return o1 == null ? o2 == null : o1.equals(o2);
+	}
+
+	/**
+	 * Gets the first.
+	 *
+	 * @return the first
+	 */
+	public T getFirst() {
+		return o1;
+	}
+
+	/**
+	 * Gets the second.
+	 *
+	 * @return the second
+	 */
+	public V getSecond() {
+		return o2;
+	}
+
+	/**
+	 * Sets the first.
+	 *
+	 * @param o
+	 *            the new first
+	 */
+	public void setFirst(T o) {
+		o1 = o;
+	}
+
+	/**
+	 * Sets the second.
+	 *
+	 * @param o
+	 *            the new second
+	 */
+	public void setSecond(V o) {
+		o2 = o;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (!(obj instanceof Pair))
+			return false;
+		Pair<?,?> p = (Pair<?,?>) obj;
+		return same(p.o1, this.o1) && same(p.o2, this.o2);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return "Pair{" + o1 + ", " + o2 + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#hashCode()
+	 */
+	@Override
+	public int hashCode() {
+		if (o1 == null && o2 == null)
+			return 0;
+		if (o1 != null && o2 != null)
+			return this.o1.hashCode() * this.o2.hashCode();
+		if (o1 != null)
+			return this.o1.hashCode();
+		else
+			return this.o2.hashCode();
+	}
+
+	/**
+	 * Simple example test program.
+	 *
+	 * @param args
+	 *            the arguments
+	 */
+	public static void main(String[] args) {
+
+		HashMap<Pair, String> hashpair = new HashMap<Pair, String>();
+
+		Pair<String, String> p1 = new Pair<String, String>("a", "b"); //$NON-NLS-1$ //$NON-NLS-2$
+		Pair<String, String> p2 = new Pair<String, String>("a", null); //$NON-NLS-1$
+		Pair<String, String> p3 = new Pair<String, String>("a", "b"); //$NON-NLS-1$ //$NON-NLS-2$
+		Pair<String, String> p4 = new Pair<String, String>(null, null);
+		System.out.println(p1.equals(new Pair<Integer, Integer>(new Integer(1), new Integer(2))) + UtilsCoreMessages.Pair_0);
+		System.out.println(p4.equals(p2) + UtilsCoreMessages.Pair_0);
+		System.out.println(p2.equals(p4) + UtilsCoreMessages.Pair_0);
+		System.out.println(p1.equals(p3) + UtilsCoreMessages.Pair_1);
+		System.out.println(p4.equals(p4) + UtilsCoreMessages.Pair_1);
+		hashpair.containsKey(p1);
+		hashpair.put(p1, "p1"); //$NON-NLS-1$
+		hashpair.put(p2, "p2"); //$NON-NLS-1$
+		hashpair.put(p3, "p3"); //$NON-NLS-1$
+		hashpair.put(p4, "p4"); //$NON-NLS-1$
+
+		System.out.println(hashpair);
+		System.out.println((p1 == null ? p3 == null : p1.equals(p3)));
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Pair.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/ProcessBuilderBuilder.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/ProcessBuilderBuilder.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/ProcessBuilderBuilder.java	(revision 3666)
@@ -0,0 +1,297 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.utils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ProcessBuilderBuilder.
+ *
+ * @deprecated
+ * 
+ * 			Reads a shell command line interface definition in an xml file
+ *             (CLIX) then creates the corresponding java wrapper API code.
+ * 
+ *             example xml definition file :
+ * 
+ *             <application name="progname" version="0.0.0" desc="..."> <progs>
+ *             <prog exec="prog.exe" desc="..."> <args>
+ *             <arg state="optional" type="none" name="thing" desc="the thing
+ *             arg"/>
+ *             <arg state="must" type="none" name="compulsorything" desc=""/>
+ *             <arg state="multiple" type="none" name="onethingatleast" desc=
+ *             ""/> </args> </prog> </progs> </application>
+ * @author mdecorde, sheiden
+ */
+@Deprecated
+public class ProcessBuilderBuilder {
+
+	/**
+	 * build the java file from the definition file.
+	 *
+	 * @param xmlFile
+	 *            the xml file
+	 * @param outFile
+	 *            the out file
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws SAXException
+	 *             the sAX exception
+	 * @throws ParserConfigurationException
+	 *             the parser configuration exception
+	 */
+	public static void build(File xmlFile, File outFile) throws IOException, SAXException, ParserConfigurationException {
+		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(outFile), "UTF-8"); //$NON-NLS-1$
+		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+		DocumentBuilder db = dbf.newDocumentBuilder();
+		Document doc = db.parse(xmlFile);
+		Element root = doc.getDocumentElement();
+		String appliname = root.getAttribute("name"); //$NON-NLS-1$
+		String version = root.getAttribute("version"); //$NON-NLS-1$
+		String applidesc = root.getAttribute("desc"); //$NON-NLS-1$
+		writer.write("import java.util.Date;\n"); //$NON-NLS-1$
+		writer.write("import java.util.Locale;\n"); //$NON-NLS-1$
+		writer.write("import java.text.DateFormat;\n"); //$NON-NLS-1$
+		writer.write("import java.io.BufferedReader;\n"); //$NON-NLS-1$
+		writer.write("import java.io.IOException;\n"); //$NON-NLS-1$
+		writer.write("import java.io.InputStream;\n"); //$NON-NLS-1$
+		writer.write("import java.io.InputStreamReader;\n"); //$NON-NLS-1$
+		writer.write("import java.util.ArrayList;\n"); //$NON-NLS-1$
+
+		writer.write("\n// " + applidesc + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("class " + appliname + "\n{\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("\tString binpath = \"\";\n"); //$NON-NLS-1$
+		writer.write("\tpublic " + appliname + "(String bindir){this.binpath=bindir;}\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("\tpublic " + appliname + "(File bindir){this.binpath=bindir.getAbsolutePath();}\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("\tString version = \"" + version + "\";\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("\tString desc = \"" + applidesc + "\";\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		writer.write("\tboolean debug = false;\n"); //$NON-NLS-1$
+		writer.write("\tpublic void debug(boolean b){debug=b;};\n"); //$NON-NLS-1$
+
+		NodeList nodeLst = doc.getElementsByTagName("prog"); //$NON-NLS-1$
+		ArrayList<String> dejavu = new ArrayList<String>();
+
+		for (int s = 0; s < nodeLst.getLength(); s++) {
+			HashMap<String, String> atester = new HashMap<String, String>();
+			ArrayList<String> order = new ArrayList<String>();
+			ArrayList<String> musts = new ArrayList<String>();
+			ArrayList<String> multiples = new ArrayList<String>();
+			Element elem = (Element) nodeLst.item(s);
+			NodeList children = elem.getElementsByTagName("arg"); //$NON-NLS-1$
+
+			String execfile = elem.getAttribute("exec"); //$NON-NLS-1$
+			String execfiledesc = elem.getAttribute("desc"); //$NON-NLS-1$
+			String func = "\n\t// " + execfiledesc + //$NON-NLS-1$
+					"\n\tpublic void " //$NON-NLS-1$
+					+ execfile.replace("-", "").replace(".", "") + "("; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+			String argsdesc = ""; //$NON-NLS-1$
+			for (int i = 0; i < children.getLength(); i++) {
+				Element child = (Element) children.item(i);
+				String name = child.getAttribute("name"); //$NON-NLS-1$
+				String type = child.getAttribute("type"); //$NON-NLS-1$
+				String desc = child.getAttribute("desc"); //$NON-NLS-1$
+				String state = child.getAttribute("state"); //$NON-NLS-1$
+				if (!order.contains(name))
+					order.add(name);
+				if (state.equals("optional")) //$NON-NLS-1$
+				{
+					if (!dejavu.contains(name)) {
+						dejavu.add(name);
+						writer.write("\n\t// " + desc + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+						writer.write("\tprivate Boolean is" + name.replace("-", "") + " = false;\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+						if (!type.equals("none")) //$NON-NLS-1$
+						{
+							writer.write("\tprivate " + type + " " + name.replace("-", "") + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+							writer.write("\tpublic void set" + name.replace("-", "") + "(" + type + " arg)\n\t{" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+									"\tthis.is" //$NON-NLS-1$
+									+ name.replace("-", "") + "=true;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+									"\t\tthis." //$NON-NLS-1$
+									+ name.replace("-", "") + "=arg;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+									"\t}\n" //$NON-NLS-1$
+							);
+						} else {
+							writer.write("\tpublic void set" + name.replace("-", "") + "()\n\t{" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+									"\tthis.is" //$NON-NLS-1$
+									+ name.replace("-", "") + "=true;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+									"\t}\n" //$NON-NLS-1$
+							);
+						}
+						writer.write("\tpublic void unset" + name.replace("-", "") + "()\n\t{" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+								"\tthis.is" //$NON-NLS-1$
+								+ name.replace("-", "") + "=false;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+								"\t}\n" //$NON-NLS-1$
+						);
+					}
+
+					atester.put(name, type);
+				} else if (state.equals("multiple")) //$NON-NLS-1$
+				{
+					if (!dejavu.contains(name)) {
+						dejavu.add(name);
+						writer.write("\n\t// " + desc + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+						writer.write("\tprivate Boolean is" + name.replace("-", "") + " = false;\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+						if (!type.equals("none")) //$NON-NLS-1$
+						{
+							writer.write("\tprivate List<" + type + "> " + name + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+							writer.write("\tpublic void set" + name.replace("-", "") + "(List<" + type + "> arg)\n\t{" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+									"\tthis.is" //$NON-NLS-1$
+									+ name.replace("-", "") + "=true;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+									"\t\tthis." //$NON-NLS-1$
+									+ name.replace("-", "") + "=arg;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+									"\t}\n" //$NON-NLS-1$
+							);
+						} else {
+							writer.write("\tpublic void set" + name.replace("-", "") + "()\n\t{" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+									"\tthis.is" //$NON-NLS-1$
+									+ name.replace("-", "") + "=true;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+									"\t}\n" //$NON-NLS-1$
+							);
+						}
+						writer.write("\tpublic void unset" + name.replace("-", "") + "()\n\t{" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+								"\tthis.is" //$NON-NLS-1$
+								+ name.replace("-", "") + "=false;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+								"\t}\n" //$NON-NLS-1$
+						);
+					}
+					multiples.add(name);
+					atester.put(name, type);
+				} else {
+					func = func + type + " " + name.replace("-", "") + ", "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+					argsdesc += "\t// arg : " + desc + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
+					musts.add(name);
+
+					if (!dejavu.contains(name))
+						dejavu.add(name);
+				}
+			}
+			if (musts.size() > 0)
+				func = func.substring(0, func.length() - 2) + ")"; //$NON-NLS-1$
+			else
+				func = func + ")"; //$NON-NLS-1$
+
+			writer.write("\n" + func + " throws IOException\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			writer.write(argsdesc);
+			writer.write("\t{\n"); //$NON-NLS-1$
+			writer.write("\t\tArrayList<String> args = new ArrayList<String>();\n"); //$NON-NLS-1$
+			writer.write("\t\targs.add(binpath+\"/" + execfile + "\");\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			for (String name : order) {
+				if (atester.containsKey(name)) {
+					writer.write("\t\tif (is" + name.replace("-", "") + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+					if (!atester.get(name).equals("none")) //$NON-NLS-1$
+					{
+						if (multiples.contains(name)) {
+							writer.write("\t\t\tfor(int c = 0;c < " + name.replace("-", "") + ".size();c++)\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+							writer.write("\t\t\t{args.add(\"-" + name + "\");\n"); //$NON-NLS-1$ //$NON-NLS-2$
+							writer.write("\t\t\targs.add(\"\"+" + name.replace("-", "") + ".get(c));}\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+						} else {
+							writer.write("\t\t\t{args.add(\"-" + name + "\");\n"); //$NON-NLS-1$ //$NON-NLS-2$
+							writer.write("\t\t\targs.add(\"\"+" + name.replace("-", "") + ");}\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+						}
+					} else {
+						writer.write("\t\t\targs.add(\"-" + name + "\");\n"); //$NON-NLS-1$ //$NON-NLS-2$
+					}
+				} else {
+					if (musts.contains(name))
+						writer.write("\t\targs.add(\"\"+" + name.replace("-", "") + ");\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				}
+			}
+
+			writer.write("\n\t\tProcessBuilder pb = new ProcessBuilder(args);\n" + //$NON-NLS-1$
+					"\t\tpb.redirectErrorStream(true);\n" + //$NON-NLS-1$
+					"\t\tProcess process = null;\n" + //$NON-NLS-1$
+					"\t\ttry {\n\t\t\tprocess = pb.start();\n\t\t} catch (IOException e) {\n\t\t\tSystem.err.println(e);\n\t\t}\n"); //$NON-NLS-1$
+			writer.write("\t\tInputStream is = process.getInputStream();\n"); //$NON-NLS-1$
+			writer.write("\t\tInputStreamReader isr = new InputStreamReader(is);\n"); //$NON-NLS-1$
+			writer.write("\t\tBufferedReader br = new BufferedReader(isr);\n"); //$NON-NLS-1$
+			writer.write("\t\tString line;\n"); //$NON-NLS-1$
+			writer.write("\t\twhile ((line = br.readLine()) != null)\n\t\t{\n\t\t\tSystem.out.println(line);\n\t\t}\n"); //$NON-NLS-1$
+			writer.write("\t\tint e=0;\n\ttry {e = process.waitFor();}catch(Exception err){}\n\t\tif (e != 0) {\n\t\t\t" + //$NON-NLS-1$
+					"System.err.println(\"Process exited abnormally with code \"+e+\" at \"+" //$NON-NLS-1$
+					+ "DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date()));\n\t\t\n"); //$NON-NLS-1$
+			writer.write("\t\n\n"); //$NON-NLS-1$
+			writer.write("for(int c=0;c <args.size();c++)System.out.print(\"\"+args.get(c)+\" \");\n"); //$NON-NLS-1$
+			writer.write("System.out.println();\n}\n\t}\n"); //$NON-NLS-1$
+		}
+
+		writer.write("\tpublic static void main(String[] args) \n"); //$NON-NLS-1$
+		writer.write("\t{\n"); //$NON-NLS-1$
+		writer.write("\t\t" + appliname + " tt = new " + appliname + "(\"\");\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		writer.write("\t}\n"); //$NON-NLS-1$
+
+		writer.write("}"); //$NON-NLS-1$
+		writer.close();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args
+	 *            the arguments
+	 */
+	public static void main(String[] args) {
+		if (args.length < 2) {
+			System.err.println("Need 2 args : xmlfile & outfile paths"); //$NON-NLS-1$
+			return;
+		}
+		File xmlfile = new File(args[0]);
+		File outfile = new File(args[1]);
+
+		if (xmlfile.exists())
+			System.out.println("xmlfile ok"); //$NON-NLS-1$
+		try {
+			ProcessBuilderBuilder.build(xmlfile, outfile);
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (SAXException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		} catch (ParserConfigurationException e) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+		System.out.println("done"); //$NON-NLS-1$
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/ProcessBuilderBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Watcher.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Watcher.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Watcher.java	(revision 3666)
@@ -0,0 +1,119 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.utils;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Watcher.
+ *
+ * @author mdecorde
+ * 
+ *         Watch for an external tool (such as CWB or R) to be OK and try to
+ *         restart it
+ */
+public abstract class Watcher implements Runnable {
+
+	/** The process. */
+	boolean process = true;
+
+	/** The processname. */
+	protected String processname = "noname"; //$NON-NLS-1$
+
+	/** The restartcount. */
+	int restartcount = 0;
+
+	/** The MAXRESTARTCOUNT. */
+	static int MAXRESTARTCOUNT = 10;
+
+	/** The DELAY. */
+	static int DELAY = 10000;
+
+	/** The DEBUG. */
+	static boolean DEBUG = true;
+
+	/**
+	 * Sets the debug.
+	 *
+	 * @param state
+	 *            the new debug
+	 */
+	public static void setDebug(boolean state) {
+		DEBUG = state;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Runnable#run()
+	 */
+	@Override
+	public void run() {
+
+		while (process) {
+			try {
+				Thread.sleep(DELAY);
+			} catch (InterruptedException e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return;
+			}
+			if (DEBUG) {
+				System.out.println("check " + processname); //$NON-NLS-1$
+			}
+			if (!check()) {
+				if (DEBUG) {
+					System.out.println("restart " + processname); //$NON-NLS-1$
+				}
+				if (!restart()) {
+					System.out.println("Failed to restart : " + processname); //$NON-NLS-1$
+					return;
+				}
+
+				restartcount++;
+				if (restartcount >= MAXRESTARTCOUNT) {
+					System.out.println(processname + " have been restarted " + MAXRESTARTCOUNT + " times, You should restart TXM."); //$NON-NLS-1$ //$NON-NLS-2$
+					return;
+				}
+			}
+		}
+	}
+
+	/**
+	 * Check.
+	 *
+	 * @return true, if successful
+	 */
+	abstract protected boolean check();
+
+	/**
+	 * Restart.
+	 *
+	 * @return true, if successful
+	 */
+	abstract protected boolean restart();
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Watcher.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/TXMLogger.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/TXMLogger.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/TXMLogger.java	(revision 3666)
@@ -0,0 +1,246 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The TXM platform is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with the TXM platform.  If not, see <http://www.gnu.org/licenses/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-09-05 09:27:13 +0200 (jeu., 05 sept. 2013) $
+// $LastChangedRevision: 2529 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.logger;
+
+import java.util.logging.Filter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.logging.Logger;
+
+/**
+ * no instanciation to do manage better Exceptions' log.
+ *
+ * @author mdecorde
+ */
+public class TXMLogger extends Logger {
+
+	/** The caller information. */
+	protected static String sourceMethodName;
+	protected static String sourceClassName;
+
+	/**
+	 * Instantiates a new tXM logger.
+	 *
+	 * @param name
+	 *            the name
+	 * @param resourceBundleName
+	 *            the resource bundle name
+	 */
+	protected TXMLogger(String name, String resourceBundleName) {
+		super(name, resourceBundleName);
+	}
+
+	/**
+	 * Info.
+	 *
+	 * @param e
+	 *            the e
+	 */
+	public void info(Exception e) {
+		this.info(exceptionToString(e));
+	}
+
+	/**
+	 * Severe.
+	 *
+	 * @param e
+	 *            the e
+	 */
+	public void severe(Exception e) {
+		this.severe(exceptionToString(e));
+	}
+
+	/**
+	 * Error.
+	 *
+	 * @param e
+	 *            the e
+	 */
+	public void error(Exception e) {
+		this.severe(exceptionToString(e));
+	}
+
+	/**
+	 * Warning.
+	 *
+	 * @param e
+	 *            the e
+	 */
+	public void warning(Exception e) {
+		this.warning(exceptionToString(e));
+	}
+
+	/**
+	 * Fine.
+	 *
+	 * @param e
+	 *            the e
+	 */
+	public void fine(Exception e) {
+		this.fine(exceptionToString(e));
+	}
+
+	/**
+	 * Finer.
+	 *
+	 * @param e
+	 *            the e
+	 */
+	public void finer(Exception e) {
+		this.finer(exceptionToString(e));
+	}
+
+	/**
+	 * Finest.
+	 *
+	 * @param e
+	 *            the e
+	 */
+	public void finest(Exception e) {
+		this.finest(exceptionToString(e));
+	}
+
+	/**
+	 * Exception to string.
+	 *
+	 * @param e
+	 *            the e
+	 * @return the string
+	 */
+	public static String exceptionToString(Exception e) {
+		StackTraceElement t = e.getStackTrace()[0];
+		return t.getFileName() + ": " + t.getMethodName() + ", l." //$NON-NLS-1$ //$NON-NLS-2$
+				+ t.getLineNumber() + " -> " + e.toString(); //$NON-NLS-1$
+	}
+
+	/**
+	 * Method from Logger Create a LogRecord then calls the log method
+	 * 
+	 * @param level
+	 * @param msg
+	 */
+	public void log(Level level, String msg) {
+		int levelValue = this.getLevel().intValue();
+		if (level.intValue() < levelValue || levelValue == Level.OFF.intValue()) {
+			return;
+		}
+		LogRecord lr = new LogRecord(level, msg);
+		inferCaller();
+		lr.setSourceClassName(sourceClassName);
+		lr.setSourceMethodName(sourceMethodName);
+		log(lr);
+	}
+
+	/**
+	 * Method from Logger to perform a log
+	 * 
+	 * @param record
+	 */
+	public void log(LogRecord record) {
+		Filter theFilter = this.getFilter();
+		if (theFilter != null && !theFilter.isLoggable(record)) {
+			return;
+		}
+
+		// Post the LogRecord to all our Handlers, and then to
+		// our parents' handlers, all the way up the tree.
+
+		Logger logger = this;
+		while (logger != null) {
+			for (Handler handler : logger.getHandlers()) {
+				handler.publish(record);
+			}
+
+			if (!logger.getUseParentHandlers()) {
+				break;
+			}
+
+			logger = logger.getParent();
+		}
+	}
+
+	/**
+	 * Method from LogRecord to infer the caller's class and method names
+	 */
+	protected static final void inferCaller() {
+		// JavaLangAccess access = SharedSecrets.getJavaLangAccess();
+
+		Throwable throwable = new Throwable();
+		StackTraceElement[] stack = throwable.getStackTrace();
+
+		// int depth = access.getStackTraceDepth(throwable); // JAVA 7
+		int depth = stack.length;
+
+		boolean lookingForLogger = true;
+		for (int ix = 0; ix < depth; ix++) {
+			// Calling getStackTraceElement directly prevents the VM
+			// from paying the cost of building the entire stack frame.
+
+			// StackTraceElement frame = access.getStackTraceElement(throwable, ix); //
+			// JAVA7
+			StackTraceElement frame = stack[ix];
+			String cname = frame.getClassName();
+			boolean isLoggerImpl = Log.isLoggerImplFrame(cname);
+			if (lookingForLogger) {
+				// Skip all frames until we have found the first logger frame.
+				if (isLoggerImpl) {
+					lookingForLogger = false;
+				}
+			} else {
+				if (!isLoggerImpl) {
+					// skip reflection call
+					if (!cname.startsWith("java.lang.reflect.") && !cname.startsWith("sun.reflect.")) {
+						// We've found the relevant frame.
+						sourceClassName = cname;
+						sourceMethodName = frame.getMethodName();
+						return;
+					}
+				}
+			}
+		}
+		// We haven't found a suitable frame, so just punt. This is
+		// OK as we are only committed to making a "best effort" here.
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/TXMLogger.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/MessageBox.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/MessageBox.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/MessageBox.java	(revision 3666)
@@ -0,0 +1,236 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2016-07-04 16:11:30 +0200 (Mon, 04 Jul 2016) $
+// $LastChangedRevision: 3257 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.logger;
+
+import java.util.logging.Level;
+
+import javax.swing.SwingUtilities;
+
+import org.txm.utils.messages.UtilsCoreMessages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * display alerts in a Swing popup.
+ *
+ * @author mdecorde
+ */
+public class MessageBox {
+
+	/**
+	 * Severe.
+	 *
+	 * @param title
+	 *            the title
+	 * @param message
+	 *            the message
+	 */
+	public static void severe(String title, String message) {
+		if (Log.txm.getLevel().intValue() <= Level.SEVERE.intValue())
+			show(title, message, 1000);
+	}
+
+	/**
+	 * Warning.
+	 *
+	 * @param title
+	 *            the title
+	 * @param message
+	 *            the message
+	 */
+	public static void warning(String title, String message) {
+		if (Log.txm.getLevel().intValue() < Level.WARNING.intValue())
+			show(title, message, 900);
+	}
+
+	/**
+	 * Info.
+	 *
+	 * @param title
+	 *            the title
+	 * @param message
+	 *            the message
+	 */
+	public static void info(String title, String message) {
+		if (Log.txm.getLevel().intValue() <= Level.INFO.intValue())
+			show(title, message, 800);
+	}
+
+	/**
+	 * Fine.
+	 *
+	 * @param title
+	 *            the title
+	 * @param message
+	 *            the message
+	 */
+	public static void fine(String title, String message) {
+		if (Log.txm.getLevel().intValue() <= Level.FINE.intValue())
+			show(title, message, 700);
+	}
+
+	/**
+	 * Finer.
+	 *
+	 * @param title
+	 *            the title
+	 * @param message
+	 *            the message
+	 */
+	public static void finer(String title, String message) {
+		if (Log.txm.getLevel().intValue() <= Level.FINER.intValue())
+			show(title, message, 600);
+	}
+
+	/**
+	 * Finest.
+	 *
+	 * @param title
+	 *            the title
+	 * @param message
+	 *            the message
+	 */
+	public static void finest(String title, String message) {
+		if (Log.txm.getLevel().intValue() <= Level.FINEST.intValue())
+			show(title, message, 500);
+	}
+
+	/**
+	 * Severe.
+	 *
+	 * @param message
+	 *            the message
+	 */
+	public static void severe(String message) {
+		severe(UtilsCoreMessages.MessageBox_0, message);
+	}
+
+	/**
+	 * Error.
+	 *
+	 * @param message
+	 *            the message
+	 */
+	public static void error(String message) {
+		severe(message);
+	}
+
+	/**
+	 * Error.
+	 *
+	 * @param title
+	 *            the title
+	 * @param message
+	 *            the message
+	 */
+	public static void error(String title, String message) {
+		severe(title, message);
+	}
+
+	/**
+	 * Warning.
+	 *
+	 * @param message
+	 *            the message
+	 */
+	public static void warning(String message) {
+		warning(UtilsCoreMessages.MessageBox_1, message);
+	}
+
+	/**
+	 * Info.
+	 *
+	 * @param message
+	 *            the message
+	 */
+	public static void info(String message) {
+		info(UtilsCoreMessages.MessageBox_2, message);
+	}
+
+	/**
+	 * Fine.
+	 *
+	 * @param message
+	 *            the message
+	 */
+	public static void fine(String message) {
+		fine("", message); //$NON-NLS-1$
+	}
+
+	/**
+	 * Finer.
+	 *
+	 * @param message
+	 *            the message
+	 */
+	public static void finer(String message) {
+		finer("", message); //$NON-NLS-1$
+	}
+
+	/**
+	 * Finest.
+	 *
+	 * @param message
+	 *            the message
+	 */
+	public static void finest(String message) {
+		finest("", message); //$NON-NLS-1$
+	}
+
+	/**
+	 * Displays a Swing alert pop up (in the Swing thread).
+	 *
+	 * @param title
+	 *            the title
+	 * @param message
+	 *            the message
+	 * @param level
+	 *            the level
+	 */
+	public static void show(final String title, final String message, final int level) {
+
+		SwingUtilities.invokeLater(new Runnable() {
+
+			@Override
+			public void run() {
+
+				if (level > 900) {
+					javax.swing.JOptionPane.showMessageDialog(null, message, title, javax.swing.JOptionPane.ERROR_MESSAGE);
+				} else if (level > 800) {
+					javax.swing.JOptionPane.showMessageDialog(null, message, title, javax.swing.JOptionPane.WARNING_MESSAGE);
+				} else if (level > 700) {
+					javax.swing.JOptionPane.showMessageDialog(null, message, title, javax.swing.JOptionPane.INFORMATION_MESSAGE);
+				} else// if (level > 600)
+				{
+					javax.swing.JOptionPane.showMessageDialog(null, message, title, javax.swing.JOptionPane.CLOSED_OPTION);
+				}
+			}
+		});
+
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/MessageBox.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/package.html	(revision 3666)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>Extending logging package.</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/Log.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/Log.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/Log.java	(revision 3666)
@@ -0,0 +1,519 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2017-01-24 18:11:42 +0100 (Tue, 24 Jan 2017) $
+// $LastChangedRevision: 3400 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.logger;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.logging.FileHandler;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.SimpleFormatter;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.utils.messages.UtilsCoreMessages;
+
+/**
+ * The Class Log contains methods to print messages in the console depending on
+ * a log level
+ * 
+ * see the severe(), warning(), info(), fine(), finer() and finest() methods
+ * 
+ * set the log level with Log.setLevel()
+ */
+public class Log {
+	/** The class id. */
+	public static final String id = "org.txm.utils.logger.Log";
+
+	/** The txm Logger. */
+	protected static TXMLogger txm;
+
+	/** The fh. */
+	protected static FileHandler fh;
+
+	public static int MAX_LINE_LENGTH = 1000;
+	
+	public static int MAX_NEWLINES = 10;
+
+	/**
+	 * The CONSOLE flags indicates if messages with level < INFO are printed in
+	 * console
+	 */
+	public static boolean CONSOLE = false;
+
+	/** The caller information. */
+	protected static String sourceMethodName;
+	protected static String sourceClassName;
+	/** The logger frame list. */
+	protected static List<String> frameList;
+
+	static {
+		// System.out.println("INIT TXMLOGGER");
+		txm = new TXMLogger("TXMFileLogger", null);
+		txm.setLevel(Level.SEVERE); // default is to show errors
+		txm.setUseParentHandlers(true);
+		frameList = new ArrayList<>();
+		frameList.add(id);
+	}
+
+	/**
+	 * Sets the level.
+	 * 
+	 * @param l
+	 *            the new level
+	 */
+	public static void setLevel(Level l) {
+		txm.setLevel(l);
+	}
+
+	/**
+	 * Sets the prints the in file.
+	 * 
+	 * @param b
+	 *            the new prints the in file
+	 */
+	public static String setPrintInFile(boolean b) {
+		// System.out.println("set print in file: "+b);
+		String filename = null;
+		if (b) {
+			try {
+				SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
+
+				filename = System.getProperty("java.io.tmpdir") + "/TXM-" + f.format(new Date()) + ".log"; //$NON-NLS-1$ //$NON-NLS-2$
+
+				fh = new FileHandler(filename, false);
+				System.out.println(UtilsCoreMessages.Log_3 + new File(filename).getAbsolutePath());
+				fh.setFormatter(new SimpleFormatter());
+				fh.setEncoding("UTF-8"); //$NON-NLS-1$
+				txm.addHandler(fh);
+			} catch (SecurityException e) {
+				printStackTrace(e);
+			} catch (IOException e) {
+				printStackTrace(e);
+			}
+		} else {
+			txm.removeHandler(fh);
+		}
+		return filename;
+	}
+
+	static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd"); //$NON-NLS-1$
+
+	/**
+	 * Sets the prints the in file.
+	 * 
+	 * @param b
+	 *            the new prints the in file
+	 */
+	public static void setPrintInFile(boolean b, File logfiledir) {
+		if (b) {
+			if (txm.getHandlers().length == 0 && logfiledir.exists()) {
+				try {
+
+					fh = new FileHandler(logfiledir.getAbsolutePath() + "/TXM-" + f.format(new Date()) + ".log", false); //$NON-NLS-1$ //$NON-NLS-2$
+					System.out.println(UtilsCoreMessages.Log_5 + logfiledir.getAbsolutePath() + "TXM-" + f.format(new Date()) + ".log"); //$NON-NLS-2$ //$NON-NLS-1$
+					fh.setFormatter(new SimpleFormatter());
+					fh.setEncoding("UTF-8"); //$NON-NLS-1$
+					txm.addHandler(fh);
+				} catch (Exception e) {
+					org.txm.utils.logger.Log.printStackTrace(e);
+				}
+			}
+		} else {
+			txm.removeHandler(fh);
+		}
+	}
+
+	public static void addHandler(Handler handler) {
+		txm.addHandler(handler);
+	}
+
+	public static void removeHandler(Handler handler) {
+		txm.addHandler(handler);
+	}
+
+	/**
+	 * To string.
+	 * 
+	 * @param e
+	 *            the e
+	 * @return the string
+	 */
+	public static String toString(Exception e) {
+		try {
+			StackTraceElement t = e.getStackTrace()[0];
+			if (txm.getLevel().equals(Level.SEVERE) || txm.getLevel().equals(Level.ALL)) {
+				StringBuffer message = new StringBuffer();
+
+				message.append(t.getFileName() + ": " + t.getMethodName() + ", l." //$NON-NLS-1$ //$NON-NLS-2$
+						+ t.getLineNumber() + " -> " + e.toString()); //$NON-NLS-1$
+
+				if (log_stacktrace_boolean) {
+					message.append(UtilsCoreMessages.Log_8);
+					for (StackTraceElement se : e.getStackTrace())
+						message.append("\t" + se.getFileName() + "\t" + se.getMethodName() + "\tl." + se.getLineNumber() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				}
+				return message.toString();
+			} else
+				return t.getFileName() + ": " + t.getMethodName() + ", l." //$NON-NLS-1$ //$NON-NLS-2$
+						+ t.getLineNumber() + " -> " + e.toString(); //$NON-NLS-1$
+		} catch (Exception ex) {
+			return e.getLocalizedMessage();
+		}
+	}
+
+	/**
+	 * Sets the prints the in console.
+	 * 
+	 * @param b
+	 *            the new prints the in console
+	 */
+	public static void setPrintInConsole(boolean b) {
+		CONSOLE = b;
+	}
+
+	/**
+	 * Sets the prints the in console.
+	 * 
+	 * @param b
+	 *            the new prints the in console
+	 */
+	public static boolean getPrintInConsole() {
+		return txm.getUseParentHandlers();
+	}
+
+	/**
+	 * Log a severe message using the default flag
+	 * 
+	 * @param t
+	 *            the error to print
+	 */
+	public static void severe(Throwable t) {
+		severe(t.getLocalizedMessage());
+		printStackTrace(t);
+	}
+
+	/**
+	 * Log a severe message
+	 * 
+	 * @param message
+	 */
+	public static void severe(String message) {
+
+		if (message.length()> MAX_LINE_LENGTH) { // cut if too long
+			message = message.substring(0, MAX_LINE_LENGTH) + "[...]";
+		}
+		if (StringUtils.countMatches(message, "\n") > MAX_NEWLINES) {
+			message = message.replace("\n", "⏎");
+		}
+
+		if (Level.SEVERE.intValue() >= txm.getLevel().intValue()) {
+			System.out.println(message);
+
+			StackTraceElement[] st = Thread.currentThread().getStackTrace();
+			int stL = 0;
+			int maxClassNameLength = 0;
+			int maxMethodNameLength = 0;
+
+			for (StackTraceElement t : st) {
+				String cn = t.getClassName();
+				if (cn.startsWith("org.txm.") && !cn.startsWith(Log.class.getName())) {
+					int cns = cn.length();
+					if (cns > maxClassNameLength)
+						maxClassNameLength = cns;
+					int mns = t.getMethodName().length();
+					if (mns > maxMethodNameLength)
+						maxMethodNameLength = mns;
+					stL++;
+				}
+			}
+
+			int stLs = (int) Math.log10(stL) + 1;
+			String format = String.format("[%%%dd]  %%%ds.%%%ds  %%s, %%s", stLs, maxClassNameLength, maxMethodNameLength);
+
+			System.out.println("Stacktrace: ");
+			int n = 1;
+			for (StackTraceElement t : st) {
+				if (t.getClassName().startsWith("org.txm.") && !t.getClassName().startsWith(Log.class.getName())) {
+					System.out.println(String.format(format, n++, t.getClassName(), t.getMethodName(), t.getFileName(), t.getLineNumber()));
+				}
+			}
+
+			// System.out.println("Stacktrace: ");
+			// int n = 1;
+			// for (StackTraceElement t : Thread.currentThread().getStackTrace()) {
+			// if (t.getClassName().startsWith("org.txm.") &&
+			// !t.getClassName().startsWith(Log.class.getName())) {
+			// System.out.println(String.format("[%2d]\t",n++)+t);
+			// }
+			// }
+		}
+
+		txm.severe(message);
+	}
+
+	/**
+	 * Log a warning message using the default flag
+	 * 
+	 * @param t
+	 *            the error to print
+	 */
+	public static void warning(Throwable e) {
+		warning(e.getLocalizedMessage());
+		printStackTrace(e);
+	}
+
+	/**
+	 * Log a warning message
+	 * 
+	 * @param message
+	 */
+	public static void warning(String message) {
+
+		if (message.length()> MAX_LINE_LENGTH) { // cut if too long
+			message = message.substring(0, MAX_LINE_LENGTH) + "[...]";
+		}
+		message = message.replace("\n", "⏎");
+
+
+		if (Level.WARNING.intValue() >= txm.getLevel().intValue()) {
+			System.out.println(message);
+			// System.out.print("AT: ");
+			// int n = 1;
+			// for (StackTraceElement t : Thread.currentThread().getStackTrace()) {
+			// if (t.getClassName().startsWith("org.txm.") &&
+			// !t.getClassName().startsWith(Log.class.getName())) {
+			// System.out.println(t);
+			// break;
+			// }
+			// }
+		}
+		txm.warning(message);
+	}
+
+	/**
+	 * Log an info message using the default flag
+	 * 
+	 * @param t
+	 *            the error to print
+	 */
+	public static void info(Throwable t) {
+		info(t.getLocalizedMessage());
+		printStackTrace(t);
+	}
+
+	/**
+	 * Log an info message
+	 * 
+	 * @param message
+	 * @param flag
+	 *            where to print the message
+	 */
+	public static void info(String message) {
+		info(message, true);
+	}
+
+	/**
+	 * Log an info message
+	 * 
+	 * @param message
+	 * @param flag
+	 *            where to print the message
+	 */
+	public static void info(String message, boolean newline) {
+
+		if (message.length()> MAX_LINE_LENGTH) { // cut if too long
+			message = message.substring(0, MAX_LINE_LENGTH) + "[...]";
+		}
+		message = message.replace("\n", "⏎");
+
+
+		if (Level.INFO.intValue() >= txm.getLevel().intValue()) {
+			if (newline) System.out.println(message);
+			else  System.out.print(message);
+		}
+		txm.info(message);
+	}
+
+	/**
+	 * Logs a finest level message.
+	 * 
+	 * @param message
+	 */
+	public static void finest(String message) {
+		if (CONSOLE && Level.FINEST.intValue() >= txm.getLevel().intValue()) {
+			System.out.println(message);
+		}
+		txm.finest(message);
+	}
+
+	/**
+	 * Logs a finest level message adding the class and method of callers stack
+	 * according to the specified trace depth.
+	 * 
+	 * @param message
+	 * @param stackDepth
+	 */
+	public static void finest(String message, int stackTraceDepth) {
+		finest(message);
+
+		// Log callers
+		String lead = ""; //$NON-NLS-1$
+		for (int i = 2; i < 10; i++) {
+			lead += " "; //$NON-NLS-1$
+			try {
+				Log.finest(lead + Thread.currentThread().getStackTrace()[i].getClassName() + "." + Thread.currentThread().getStackTrace()[i].getMethodName()); //$NON-NLS-1$
+			} catch (Exception e) {
+				// nothing to do
+			}
+		}
+	}
+
+	/**
+	 * Log an info message
+	 * 
+	 * @param message
+	 * @param flag
+	 *            where to print the message
+	 */
+	public static void fine(String message) {
+		fine(message, true);
+	}
+
+	/**
+	 * Log an info message
+	 * 
+	 * @param message
+	 * @param flag
+	 *            where to print the message
+	 */
+	public static void fine(String message, boolean newline) {
+		if (CONSOLE && Level.FINE.intValue() >= txm.getLevel().intValue()) {
+			if (newline) System.out.println(message);
+			else System.out.print(message);
+		}
+		txm.fine(message);
+	}
+
+
+	/**
+	 * Log an info message
+	 * 
+	 * @param message
+	 * @param flag
+	 *            where to print the message
+	 */
+	public static void finer(String message) {
+		if (CONSOLE && Level.FINER.intValue() >= txm.getLevel().intValue()) {
+			System.out.println(message);
+		}
+		txm.finer(message);
+	}
+
+	public static boolean log_stacktrace_boolean = true;
+
+	/**
+	 * Log a stacktrace if the 'Log.log_stacktrace_boolean' is set to true
+	 * 
+	 * @param e
+	 *            the Throwable
+	 */
+	public static void printStackTrace(Throwable e) {
+		if (log_stacktrace_boolean) {
+			e.printStackTrace();
+		}
+	}
+
+	public static Level getLevel() {
+		return txm.getLevel();
+	}
+
+	public static boolean isPrintingErrors() {
+		if (txm == null)
+			return false;
+		return txm.getLevel().intValue() <= Level.INFO.intValue();
+	}
+
+	/**
+	 * Checks if the FINE level is activated.
+	 * 
+	 * @return
+	 */
+	public static boolean isLoggingFineLevel() {
+		return Level.FINE.intValue() >= Log.getLevel().intValue();
+	}
+
+	/**
+	 * Method from LogRecord to determine if a frame is a logger frame
+	 * 
+	 * @param cname
+	 *            the frame
+	 * @return
+	 */
+	protected static boolean isLoggerImplFrame(String cname) {
+		for (String s : frameList) {
+			if (cname.equals(s))
+				return true;
+		}
+		return false;
+	}
+
+	public static void printStackTrace() {
+		StackTraceElement[] st = Thread.currentThread().getStackTrace();
+		int stL = 0;
+		int maxClassNameLength = 0;
+		int maxMethodNameLength = 0;
+
+		for (StackTraceElement t : st) {
+			String cn = t.getClassName();
+			if (cn.startsWith("org.txm.") && !cn.startsWith(Log.class.getName())) {
+				int cns = cn.length();
+				if (cns > maxClassNameLength)
+					maxClassNameLength = cns;
+				int mns = t.getMethodName().length();
+				if (mns > maxMethodNameLength)
+					maxMethodNameLength = mns;
+				stL++;
+			}
+		}
+
+		int stLs = (int) Math.log10(stL) + 1;
+		String format = String.format("[%%%dd]  %%%ds.%%%ds  %%s, %%s", stLs, maxClassNameLength, maxMethodNameLength);
+
+		System.out.println("Stacktrace: ");
+		int n = 1;
+		for (StackTraceElement t : st) {
+			if (t.getClassName().startsWith("org.txm.") && !t.getClassName().startsWith(Log.class.getName())) {
+				System.out.println(String.format(format, n++, t.getClassName(), t.getMethodName(), t.getFileName(), t.getLineNumber()));
+			}
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/Log.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/LocalizedLogger.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/LocalizedLogger.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/LocalizedLogger.java	(revision 3666)
@@ -0,0 +1,106 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.logger;
+
+/*
+ import org.apache.log4j.BasicConfigurator;
+ import org.apache.log4j.Level;
+ import org.apache.log4j.Logger;
+ */
+import org.txm.utils.i18n.Localizer;
+
+/**
+ * A logger whose messages are translated unsing a {@link Localizer}.
+ * 
+ * @deprecated
+ * @author sloiseau
+ */
+@Deprecated
+public class LocalizedLogger {
+	/*
+	 * private Logger logger; private Localizer localizer;
+	 * 
+	 * // TODO : manage elsewhere the log configuration! static {
+	 * BasicConfigurator.configure(); Logger.getRootLogger().setLevel(Level.INFO); }
+	 * 
+	 * public LocalizedLogger(Class<?> clazz) { logger = Logger.getLogger(clazz);
+	 * localizer = new Localizer(clazz); }
+	 * 
+	 * public void info(String key, Object[] arg) {
+	 * logger.info(localizer.message(key, arg)); }
+	 * 
+	 * public void info(String key, Object arg) { logger.info(localizer.message(key,
+	 * arg)); }
+	 * 
+	 * public void info(String key) { logger.info(localizer.message(key)); }
+	 * 
+	 * public void debug(String key) { logger.debug(localizer.message(key)); }
+	 * 
+	 * public void debug(String key, Object[] arg) {
+	 * logger.debug(localizer.message(key, arg)); }
+	 * 
+	 * public void debug(String key, Object arg) {
+	 * logger.debug(localizer.message(key, arg)); }
+	 * 
+	 * public Localizer getLocalizer() { return this.localizer; }
+	 * 
+	 * public void error(String key) { logger.error(localizer.message(key)); }
+	 * 
+	 * public void error(String key, Throwable t) {
+	 * logger.error(localizer.message(key),t); }
+	 * 
+	 * public void error(String key, Object[] arg) {
+	 * logger.error(localizer.message(key, arg)); }
+	 * 
+	 * public void error(String key, Object[] arg, Throwable t) {
+	 * logger.error(localizer.message(key, arg),t); }
+	 * 
+	 * public void error(String key, Object arg) {
+	 * logger.error(localizer.message(key, arg)); }
+	 * 
+	 * public void error(String key, Object arg, Throwable t) {
+	 * logger.error(localizer.message(key, arg), t); }
+	 * 
+	 * public void fatal(String key) { logger.fatal(localizer.message(key)); }
+	 * 
+	 * public void fatal(String key, Throwable t) {
+	 * logger.fatal(localizer.message(key),t); }
+	 * 
+	 * public void fatal(String key, Object[] arg, Throwable t) {
+	 * logger.fatal(localizer.message(key, arg),t); }
+	 * 
+	 * public void fatal(String key, Object[] arg) {
+	 * logger.fatal(localizer.message(key, arg)); }
+	 * 
+	 * public void fatal(String key, Object arg, Throwable t) {
+	 * logger.fatal(localizer.message(key, arg),t); }
+	 * 
+	 * public void fatal(String key, Object arg) {
+	 * logger.fatal(localizer.message(key, arg)); }
+	 */
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/logger/LocalizedLogger.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/FileUtils.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/FileUtils.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/FileUtils.java	(revision 3666)
@@ -0,0 +1,143 @@
+package org.txm.utils;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.apache.commons.io.FilenameUtils;
+
+public class FileUtils {
+
+	public static boolean isExtension(File f, String ext) {
+		return FilenameUtils.isExtension(f.getName().toLowerCase(), ext.toLowerCase());
+	}
+
+	public static boolean isExactlyExtension(File f, String ext) {
+		return FilenameUtils.isExtension(f.getName(), ext);
+	}
+
+	public static boolean isXMLFile(File f) {
+		return isExtension(f, "xml");
+	}
+
+	public static boolean isTXTFile(File f) {
+		return isExtension(f, "txt");
+	}
+
+	public static boolean isXSLFile(File f) {
+		return isExtension(f, "xsl");
+	}
+
+	public static boolean isJARFile(File f) {
+		return isExtension(f, "jar");
+	}
+
+	public static String getExtension(File f) {
+		return FilenameUtils.getExtension(f.getName());
+	}
+
+	public static String stripExtension(File f) {
+		return FilenameUtils.getBaseName(f.getName());
+	}
+	
+	public static String stripExtension(String filename) {
+		return FilenameUtils.getBaseName(filename);
+	}
+	
+	/**
+	 * select file and directories
+	 * ignore hidden files
+	 * 
+	 * @param file a directory or a file (its parent directory will be used)
+	 * @return list of files, null if the file does not exists
+	 */
+	public File[] listFiles(File file) {
+		return listFiles(file, null, false, true);
+	}
+	
+	/**
+	 * select only files not hidden
+	 */
+	public static final FileFilter HIDDENFILE_FILTER = new FileFilter() {
+		@Override
+		public boolean accept(File file) {
+			return !file.isHidden() && !file.getName().startsWith(".") && !file.getName().endsWith("~");
+		}
+	};
+
+	/**
+	 * 
+	 * @return a list containing the files not hidden
+	 */
+	public List<File> listFilesAsList(File dir) {
+		
+		File[] files = dir.listFiles(HIDDENFILE_FILTER);
+		if (files == null)
+			return new ArrayList<File>();
+
+		return Arrays.asList(files);
+	}
+	
+	/**
+	 * 
+	 * @param file a directory or a file (its parent directory will be used)
+	 * @param namePattern null or filename regex 
+	 * @return list of files, null if the file does not exists
+	 */
+	public File[] listFiles(File file, String namePattern, boolean fileOnly, boolean ignoreHiddenFiles) {
+		
+		if (!file.isDirectory()) {
+			file = file.getParentFile();
+		}
+		if (file == null) {
+			return null;
+		}
+		
+		File[] files = file.listFiles(new PatternFilter(namePattern, fileOnly, ignoreHiddenFiles));
+		
+		if (files != null) {
+			Arrays.sort(files); // always sort files by name
+		}
+		
+		return files;
+	}
+	
+	public static class PatternFilter implements FileFilter {
+
+		public Pattern mNamePattern = null;
+		boolean fileOnly;
+		boolean ignoreHiddenFiles;
+		
+		public PatternFilter(String pattern, boolean fileOnly, boolean ignoreHiddenFiles) {
+			if (pattern != null && pattern.length() > 0) {
+				mNamePattern = Pattern.compile(pattern);
+			}
+			this.ignoreHiddenFiles = ignoreHiddenFiles;
+			this.fileOnly = fileOnly;
+		}
+		
+		@Override
+		public boolean accept(File file) {
+			
+			if (fileOnly && !file.isFile()) return false;
+			
+			if (ignoreHiddenFiles && !HIDDENFILE_FILTER.accept(file)) return false;
+			
+			if (mNamePattern == null) return true; // no more tests
+			
+			return mNamePattern.matcher(file.getName()).matches(); // test the whole filename
+		}
+		
+	}
+
+	public static void main(String[] args) {
+		File f = new File("test.gz.Txt");
+		System.out.println("base=" + stripExtension(f));
+		System.out.println("ext=" + getExtension(f));
+		System.out.println("is txt=" + isExtension(f, "txt"));
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/FileUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/DeleteDir.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/DeleteDir.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/DeleteDir.java	(revision 3666)
@@ -0,0 +1,147 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2015-12-09 09:48:50 +0100 (Wed, 09 Dec 2015) $
+// $LastChangedRevision: 3084 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.util.ArrayList;
+import java.util.LinkedList;
+
+import org.apache.commons.lang.SystemUtils;
+
+// TODO: Auto-generated Javadoc
+/**
+ * tools to delete files from a directory.
+ *
+ * @author mdecorde
+ */
+public class DeleteDir {
+
+	/**
+	 * The main method.
+	 *
+	 * @param args
+	 *            the arguments
+	 */
+	public static void main(String args[]) {
+		deleteDirectory(new File(args[0]));
+	}
+
+	static public boolean deleteDirectory(File path) {
+		return deleteDirectory(path, false);
+	}
+	
+	/**
+	 * Delete directory.
+	 *
+	 * @param path the path to the directory to delete
+	 * @param definitive definitivelly delete the directory or move it to trash FIXME NOT IMPLEMENTED YET
+	 * @return true, if successful
+	 */
+	static public boolean deleteDirectory(File path, boolean definitive) {
+		if (path == null) {
+			return false;
+		}
+		if (!path.exists()) {
+			return false;
+		}
+		try { // try using system for faster reply and prefer OS-dependent directory removal tool
+			if (SystemUtils.IS_OS_WINDOWS) {
+				Runtime.getRuntime().exec(new String[] { "%ComSpec%", "/C", "RD /S /Q \"" + path + '"' }).waitFor(); // FIXME: SJ: "%ComSpec%" is not defined, at least on my Win7
+			} else if (SystemUtils.IS_OS_UNIX) {
+				if (definitive) {
+					Runtime.getRuntime().exec(new String[] { "/bin/rm", "-rf", path.toString() }).waitFor();
+				} else {
+					Runtime.getRuntime().exec(new String[] { "gio", "trash", path.toString() }).waitFor();
+				}
+			}
+			
+			if (!path.exists()) { // it worked
+				return true;
+			}
+		} catch (Exception e) {
+			// fallback to internal implementation on error
+			// e.printStackTrace();
+		}
+
+		if (path.exists() && path.isDirectory()) {
+			File[] files = path.listFiles();
+			if (files != null)
+				for (int i = 0; i < files.length; i++) {
+					if (files[i].isDirectory()) {
+						deleteDirectory(files[i], definitive);
+					} else {
+						files[i].delete();
+					}
+				}
+		}
+		return (path.delete());
+	}
+
+	/**
+	 * Recursively scan a directory files
+	 *
+	 * @param directory
+	 *            the directory
+	 * @param ignorecached
+	 *            the ignorecached
+	 * @return the array list of files
+	 */
+	public static ArrayList<File> scanDirectory(File directory, boolean ignorecached, boolean recursive) {
+		// System.out.println("scan directory : "+directory.getAbsolutePath());
+		ArrayList<File> dirfiles = new ArrayList<File>();
+		LinkedList<File> files = new LinkedList<File>();
+		files.add(directory);
+
+		while (!files.isEmpty()) {
+			File current = files.removeFirst();
+
+			if (current.isDirectory()) {
+				// System.out.println(current);
+				for (File sfile : current.listFiles()) {
+					// System.out.println(" "+sfile);
+					if (sfile.isDirectory()) {
+						if (!recursive) continue;
+						
+						if (ignorecached) {
+							if (!sfile.getName().startsWith(".")) //$NON-NLS-1$
+								files.add(sfile);
+						} else
+							files.add(sfile);
+					} else
+						dirfiles.add(sfile);
+				}
+			}
+		}
+		// System.out.println(dirfiles);
+		return dirfiles;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/DeleteDir.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/image/BMPUtils.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/image/BMPUtils.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/image/BMPUtils.java	(revision 3666)
@@ -0,0 +1,75 @@
+package org.txm.utils.image;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+
+import javax.imageio.IIOImage;
+import javax.imageio.ImageIO;
+import javax.imageio.ImageWriteParam;
+import javax.imageio.ImageWriter;
+import javax.imageio.stream.FileImageOutputStream;
+
+public class BMPUtils {
+
+	public static void toRLE8(File inputFile, File outputFile) throws Exception {
+		fromTo(inputFile, outputFile, "BI_RLE8");
+	}
+	
+	public static void toRLE4(File inputFile, File outputFile) throws Exception {
+		fromTo(inputFile, outputFile, "BI_RLE4");
+	}
+	
+	public static void emptySquare(File outputFile, int size, String comp) throws Exception {
+		
+		BufferedImage bi = new BufferedImage(size, size, BufferedImage.TYPE_BYTE_INDEXED);
+		
+		ImageWriter writer = ImageIO.getImageWritersByFormatName("bmp").next();
+		ImageWriteParam param = writer.getDefaultWriteParam();
+
+		param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
+		param.setCompressionType(comp);
+
+		writer.setOutput(new FileImageOutputStream(outputFile));
+		writer.write(null, new IIOImage(bi, null, null), param);
+		writer.dispose();
+	}
+	
+	public static void fromTo(File inputFile, File outputFile, String comp) throws Exception {
+		
+		BufferedImage bi = ImageIO.read(inputFile); //new BufferedImage(size, size, BufferedImage.TYPE_BYTE_INDEXED);
+		
+		ImageWriter writer = ImageIO.getImageWritersByFormatName("bmp").next();
+		ImageWriteParam param = writer.getDefaultWriteParam();
+
+		param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
+		param.setCompressionType(comp);
+
+		writer.setOutput(new FileImageOutputStream(outputFile));
+		writer.write(null, new IIOImage(bi, null, null), param);
+		writer.dispose();
+	}
+
+	public static void main(String[] args) throws Exception {
+		
+//		toRLE4(new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 16x16 8-bit.bmp"), 
+//				new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 16x16 8-bit RLE8.bmp"));
+//		
+//		toRLE4(new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 48x48 8-bit.bmp"), 
+//				new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 48x48 8-bit RLE8.bmp"));
+//		
+//		toRLE4(new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 256x256 32-bit.bmp"), 
+//				new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 256x256 32-bit RLE8.bmp"));
+		
+		emptySquare( 
+				new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 32x32 8-bit RLE8.bmp"),
+				32, "BI_RLE8");
+		
+//		emptySquare(
+//				new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 48x48 8-bit RLE8.bmp"),
+//				48, "BI_RLE8");
+//		
+//		emptySquare(
+//				new File("/home/mdecorde/eclipse-tycho2022-09/bundles/org.txm.rcp/icons/logo/TXM logo 256x256 32-bit RLE8.bmp"),
+//				256, "BI_RLE8");
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/image/BMPUtils.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/___StreamConsumer.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/___StreamConsumer.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/___StreamConsumer.java	(revision 3666)
@@ -0,0 +1,43 @@
+package org.txm.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+import org.txm.utils.logger.Log;
+
+/**
+ * Consumer for dumping stdout and stderr from a native process.
+ * 
+ * @author sjacquot
+ *
+ */
+public class ___StreamConsumer extends Thread {
+
+	InputStream is;
+	int type;
+
+	public ___StreamConsumer(InputStream is, int type) {
+		this.is = is;
+		this.type = type;
+	}
+
+	@Override
+	public void run() {
+		try {
+			InputStreamReader isr = new InputStreamReader(this.is);
+			BufferedReader br = new BufferedReader(isr);
+			String line = null;
+			while ((line = br.readLine()) != null) {
+				if (this.type == 0) {
+					Log.finest(line);
+				} else {
+					Log.severe(line);
+				}
+			}
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/___StreamConsumer.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/package.html	(revision 3666)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>classes for the next Wrapper - not yet finished</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Param.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Param.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Param.java	(revision 3666)
@@ -0,0 +1,229 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.processbuilder;
+
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+
+import org.w3c.dom.Element;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Param.
+ */
+public class Param {
+
+	/** The root. */
+	Element root;
+
+	/** The exec. */
+	Executable exec;
+
+	/** The name. */
+	String name;
+
+	/** The type. */
+	String type;
+
+	/** The state. */
+	String state;
+
+	/** The desc. */
+	String desc;
+
+	/** The prefix. */
+	String prefix;
+
+	/**
+	 * Instantiates a new param.
+	 *
+	 * @param exec
+	 *            the exec
+	 * @param root
+	 *            the root
+	 */
+	public Param(Executable exec, Element root) {
+
+		this.root = root;
+		this.exec = exec;
+
+		name = root.getAttribute("name"); //$NON-NLS-1$
+		type = root.getAttribute("type"); //$NON-NLS-1$
+		state = root.getAttribute("state");//$NON-NLS-1$
+		desc = root.getAttribute("desc"); //$NON-NLS-1$
+		prefix = root.getAttribute("prefix");//$NON-NLS-1$
+	}
+
+	/**
+	 * Builds the.
+	 *
+	 * @param writer
+	 *            the writer
+	 */
+	public void build(Writer writer) {
+		/*
+		 * for(int i=0;i < children.getLength();i++) { Element child =
+		 * (Element)children.item(i); String name = child.getAttribute("name");
+		 * //$NON-NLS-1$ String type = child.getAttribute("type"); //$NON-NLS-1$ String
+		 * desc = child.getAttribute("desc"); //$NON-NLS-1$ String state =
+		 * child.getAttribute("state"); //$NON-NLS-1$ if (!order.contains(name))
+		 * order.add(name);
+		 * 
+		 * }
+		 */
+	}
+
+	/**
+	 * Write test.
+	 *
+	 * @return the string
+	 */
+	public String writeTest() {
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Write definition.
+	 *
+	 * @return the string
+	 */
+	public String writeDefinition() {
+		return ""; //$NON-NLS-1$
+
+	}
+
+	/**
+	 * Write xml report.
+	 *
+	 * @return the string
+	 */
+	public String writeXmlReport() {
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Describe.
+	 *
+	 * @return the string
+	 */
+	public String describe() {
+		/*
+		 * StringBuffer buff = new StringBuffer();
+		 * buff.append("App: "+name+", version: "+version+", desc: "+desc+"\n");
+		 * for(Executable exec : executables.values()) buff.append(exec.describe());
+		 * return buff.toString();
+		 */
+		return "  Param: " + prefix + name + ", type: " + type + ", state: " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				+ state + ",desc: " + desc + "\n"; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Equals.
+	 *
+	 * @param param
+	 *            the param
+	 * @return true, if successful
+	 */
+	public boolean equals(Param param) {
+		return this.name.equals(param.name) && this.type.equals(param.type);
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#toString()
+	 */
+	@Override
+	public String toString() {
+		return this.prefix + this.name + ":" + this.type; //$NON-NLS-1$
+	}
+
+	/**
+	 * Declare.
+	 *
+	 * @param writer
+	 *            the writer
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public void declare(OutputStreamWriter writer) throws IOException {
+		if (state.equals("optional")) //$NON-NLS-1$
+		{
+			writer.write("\t// " + desc + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			writer.write("\tprivate Boolean is" + name.replace("-", "") + " = false;\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+			if (!type.equals("none")) //$NON-NLS-1$
+			{
+				writer.write("\tprivate " + type + " " + name.replace("-", "") + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+				writer.write("\tpublic void set" + name.replace("-", "") + "(" + type + " arg)\n\t{" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"\tthis.is" //$NON-NLS-1$
+						+ name.replace("-", "") + "=true;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						"\t\tthis." //$NON-NLS-1$
+						+ name.replace("-", "") + "=arg;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						"\t}\n" //$NON-NLS-1$
+				);
+			} else {
+				writer.write("\tpublic void set" + name.replace("-", "") + "(){" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+						"\tthis.is" //$NON-NLS-1$
+						+ name.replace("-", "") + "=true;\t}\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				);
+			}
+
+			writer.write("\tpublic void unset" + name.replace("-", "") + "(){" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+					"\tthis.is" + name.replace("-", "") + "=false;\t}\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			);
+		} else if (state.equals("multiple")) //$NON-NLS-1$
+		{
+			writer.write("\n\t// " + desc + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			writer.write("\tprivate Boolean is" + name.replace("-", "") + " = false;\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+			if (!type.equals("none")) //$NON-NLS-1$
+			{
+				writer.write("\tprivate List<" + type + "> " + name + ";\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				writer.write("\tpublic void set" + name.replace("-", "") + "(List<" + type + "> arg)\n\t{" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
+						"\tthis.is" //$NON-NLS-1$
+						+ name.replace("-", "") + "=true;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						"\t\tthis." //$NON-NLS-1$
+						+ name.replace("-", "") + "=arg;\n" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+						"\t}\n" //$NON-NLS-1$
+				);
+			} else {
+				writer.write("\tpublic void set" + name.replace("-", "") + "(){" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+						"\tthis.is" //$NON-NLS-1$
+						+ name.replace("-", "") + "=true;\t}\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				);
+			}
+
+			writer.write("\tpublic void unset" + name.replace("-", "") + "(){" + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+					"\tthis.is" + name.replace("-", "") + "=false;\t}\n" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			);
+		}
+		writer.write("\n"); //$NON-NLS-1$
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Param.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Executable.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Executable.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Executable.java	(revision 3666)
@@ -0,0 +1,215 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.processbuilder;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Executable.
+ */
+public class Executable {
+
+	/** The root. */
+	Element root;
+
+	/** The app. */
+	Application app;
+
+	/** The name. */
+	String name;
+
+	/** The version. */
+	String version;
+
+	/** The desc. */
+	String desc;
+
+	/** The params. */
+	ArrayList<Param> params = new ArrayList<Param>();
+
+	/** The optionals. */
+	HashSet<Param> optionals = new HashSet<Param>();
+
+	/** The musts. */
+	HashSet<Param> musts = new HashSet<Param>();
+
+	/** The multiples. */
+	HashSet<Param> multiples = new HashSet<Param>();
+
+	/**
+	 * Instantiates a new executable.
+	 *
+	 * @param app
+	 *            the app
+	 * @param root
+	 *            the root
+	 */
+	public Executable(Application app, Element root) {
+		this.root = root;
+		this.app = app;
+
+		name = root.getAttribute("exec"); //$NON-NLS-1$
+		version = root.getAttribute("version"); //$NON-NLS-1$
+		desc = root.getAttribute("desc"); //$NON-NLS-1$
+
+		NodeList argss = root.getElementsByTagName("args"); //$NON-NLS-1$
+		Node args = argss.item(0);
+		NodeList childs = args.getChildNodes();
+
+		for (int s = 0; s < childs.getLength(); s++) {
+			Node child = childs.item(s);
+			if (child.getNodeType() == 1) {
+				Element param = (Element) child;
+				Param p = new Param(this, param);
+				addParam(p);
+			}
+		}
+	}
+
+	/**
+	 * Adds the param.
+	 *
+	 * @param param
+	 *            the param
+	 */
+	public void addParam(Param param) {
+		params.add(param);
+		if (param.state.equals("must")) //$NON-NLS-1$
+		{
+			musts.add(param);
+		} else if (param.state.equals("optional")) //$NON-NLS-1$
+		{
+			optionals.add(param);
+		} else if (param.state.equals("multiple")) //$NON-NLS-1$
+		{
+			multiples.add(param);
+		}
+	}
+
+	/**
+	 * Builds the.
+	 *
+	 * @param writer
+	 *            the writer
+	 * @return the string
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public String build(Writer writer) throws IOException {
+		// NodeList nodeLst = doc.getElementsByTagName("prog"); //$NON-NLS-1$
+		ArrayList<String> dejavu = new ArrayList<String>();
+
+		HashMap<String, String> atester = new HashMap<String, String>();
+
+		// Function header
+		String func = "\t// " + desc; //$NON-NLS-1$
+		for (Param p : musts)
+			func += "\n\t// arg " + p.name + ": " + p.desc + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		func += "\n\tpublic void " + name.replace("-", "").replace(".", "") + "("; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+		for (Param p : musts)
+			func = func + p.type + " " + p.name.replace("-", "") + ", "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		if (musts.size() > 0)
+			func = func.substring(0, func.length() - 2) + ")"; //$NON-NLS-1$
+		else
+			func = func + ")"; //$NON-NLS-1$
+
+		// musts
+		for (Param p : musts) {
+			writer.write("\t\targs.add(\"\"+" + p.name.replace("-", "") + ");\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		}
+
+		writer.write("\n" + func + " throws IOException\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("\t{\n"); //$NON-NLS-1$
+		writer.write("\t\tArrayList<String> args = new ArrayList<String>();\n"); //$NON-NLS-1$
+		writer.write("\t\targs.add(binpath+\"" + name + "\");\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		// test set parameters
+		// optionals&multiple
+		for (Param p : params) {
+			System.out.println("test param " + p.state); //$NON-NLS-1$
+			if (p.state.equals("optional")) { //$NON-NLS-1$
+				writer.write("\t\tif (is" + p.name.replace("-", "") + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				if (!p.type.equals("none")) { //$NON-NLS-1$
+					writer.write("\t\t\t{args.add(\"-" + p.name + "\");\n"); //$NON-NLS-1$ //$NON-NLS-2$
+					writer.write("\t\t\targs.add(\"\"+" + p.name.replace("-", "") + ");}\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				} else {
+					writer.write("\t\t\targs.add(\"-" + p.name + "\");\n"); //$NON-NLS-1$ //$NON-NLS-2$
+				}
+			} else if (p.state.equals("multiple")) { //$NON-NLS-1$
+				writer.write("\t\tif (is" + p.name.replace("-", "") + ")\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				writer.write("\t\t\tfor(int c = 0;c < " + p.name.replace("-", "") + ".size();c++)\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+				writer.write("\t\t\t{args.add(\"-" + p.name + "\");\n"); //$NON-NLS-1$ //$NON-NLS-2$
+				writer.write("\t\t\targs.add(\"\"+" + p.name.replace("-", "") + ".get(c));}\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			}
+		}
+
+		writer.write("\n\t\tProcessBuilder pb = new ProcessBuilder(args);\n" + //$NON-NLS-1$
+				"\t\tpb.redirectErrorStream(true);\n" + //$NON-NLS-1$
+				"\t\tProcess process = null;\n" + //$NON-NLS-1$
+				"\t\ttry {\n\t\t\tprocess = pb.start();\n\t\t} catch (IOException e) {\n\t\t\tSystem.err.println(e);\n\t\t}\n"); //$NON-NLS-1$
+		writer.write("\t\tInputStream is = process.getInputStream();\n"); //$NON-NLS-1$
+		writer.write("\t\tInputStreamReader isr = new InputStreamReader(is);\n"); //$NON-NLS-1$
+		writer.write("\t\tBufferedReader br = new BufferedReader(isr);\n"); //$NON-NLS-1$
+		writer.write("\t\tString line;\n"); //$NON-NLS-1$
+		writer.write("\t\twhile ((line = br.readLine()) != null)\n\t\t{\n\t\t\tif (debug)\n\t\t\t\tSystem.out.println(line);\n\t\t}\n"); //$NON-NLS-1$
+		writer.write("\t\tint e=0;\n\t\ttry {e = process.waitFor();}catch(Exception err){}\n\t\tif (e != 0) {\n\t\t\t" + //$NON-NLS-1$
+				"System.err.println(\"Process exited abnormally with code \"+e+\" at \"+" //$NON-NLS-1$
+				+ "DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date()));"); //$NON-NLS-1$
+		writer.write("\n\t\t\t"); //$NON-NLS-1$
+		writer.write("for(int c=0;c <args.size();c++)System.out.print(\"\"+args.get(c)+\" \");\n"); //$NON-NLS-1$
+		writer.write("\t\t\tSystem.out.println();\n\t\t}\n\t}\n"); //$NON-NLS-1$
+
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Describe.
+	 *
+	 * @return the string
+	 */
+	public String describe() {
+		StringBuffer buff = new StringBuffer();
+		buff.append(" Exec: " + name + ", version: " + version + ", desc: " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				+ desc + "\n"); //$NON-NLS-1$
+		buff.append("  Optionals: " + optionals + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		buff.append("  Musts: " + musts + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		buff.append("  Multiples: " + multiples + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		for (Param param : params)
+			buff.append(param.describe());
+		return buff.toString();
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Executable.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Application.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Application.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Application.java	(revision 3666)
@@ -0,0 +1,186 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.utils.processbuilder;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.util.HashMap;
+import java.util.HashSet;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class Application.
+ */
+public class Application {
+
+	/** The definition file. */
+	File definitionFile;
+
+	/** The name. */
+	String name;
+
+	/** The version. */
+	String version;
+
+	/** The desc. */
+	String desc;
+
+	/** The params. */
+	HashSet<Param> params = new HashSet<Param>();
+
+	/** The executables. */
+	HashMap<String, Executable> executables = new HashMap<String, Executable>();
+
+	/**
+	 * Instantiates a new application.
+	 *
+	 * @param definitionFile
+	 *            the definition file
+	 * @throws ParserConfigurationException
+	 *             the parser configuration exception
+	 * @throws SAXException
+	 *             the sAX exception
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public Application(File definitionFile) throws ParserConfigurationException, SAXException, IOException {
+		this.definitionFile = definitionFile;
+
+		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+		DocumentBuilder db = dbf.newDocumentBuilder();
+		Document doc = db.parse(definitionFile);
+		Element root = doc.getDocumentElement();
+
+		name = root.getAttribute("name"); //$NON-NLS-1$
+		version = root.getAttribute("version"); //$NON-NLS-1$
+		desc = root.getAttribute("desc"); //$NON-NLS-1$
+
+		// pr chq exec
+		// lit param
+		NodeList nodeLst = doc.getElementsByTagName("prog"); //$NON-NLS-1$
+		for (int s = 0; s < nodeLst.getLength(); s++) {
+			Element prog = (Element) nodeLst.item(s);
+			Executable exec = new Executable(this, prog);
+			executables.put(exec.name, exec);
+			params.addAll(exec.params);
+		}
+	}
+
+	/**
+	 * Builds the.
+	 *
+	 * @param outFile
+	 *            the out file
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 * @throws SAXException
+	 *             the sAX exception
+	 * @throws ParserConfigurationException
+	 *             the parser configuration exception
+	 */
+	public void build(File outFile) throws IOException, SAXException, ParserConfigurationException {
+		OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(outFile), "UTF-8"); //$NON-NLS-1$
+
+		writer.write("import java.util.Date;\n"); //$NON-NLS-1$
+		writer.write("import java.util.Locale;\n"); //$NON-NLS-1$
+		writer.write("import java.text.DateFormat;\n"); //$NON-NLS-1$
+		writer.write("import java.io.BufferedReader;\n"); //$NON-NLS-1$
+		writer.write("import java.io.IOException;\n"); //$NON-NLS-1$
+		writer.write("import java.io.InputStream;\n"); //$NON-NLS-1$
+		writer.write("import java.io.InputStreamReader;\n"); //$NON-NLS-1$
+		writer.write("import java.util.ArrayList;\n"); //$NON-NLS-1$
+
+		writer.write("\n// " + desc + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("class " + name + "\n{\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("\tpublic String binpath = \"\";\n"); //$NON-NLS-1$
+		writer.write("\tboolean debug = false;\n"); //$NON-NLS-1$
+		writer.write("\tpublic  String version = \"" + version + "\";\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("\tpublic String desc = \"" + desc + "\";\n"); //$NON-NLS-1$ //$NON-NLS-2$
+
+		writer.write("\n\tpublic " + name + "(String binpath){this.binpath=binpath;}\n\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		writer.write("\tpublic void debug(boolean b){debug=b;};\n\n"); //$NON-NLS-1$
+
+		writer.write("//PARAMETERS DECLARATION\n"); //$NON-NLS-1$
+		for (Param p : params) {
+			p.declare(writer);
+		}
+		writer.write("//EXECUTABLES DECLARATION\n"); //$NON-NLS-1$
+		for (Executable exec : executables.values()) {
+			exec.build(writer);
+		}
+
+		writer.write("\tpublic static void main(String[] args) \n"); //$NON-NLS-1$
+		writer.write("\t{\n"); //$NON-NLS-1$
+		writer.write("\t\t" + name + " tt = new " + name + "(\"thepathtobinariesfolder\");\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+		writer.write("\t}\n"); //$NON-NLS-1$
+
+		writer.write("}"); //$NON-NLS-1$
+		writer.close();
+	}
+
+	/**
+	 * Describe.
+	 *
+	 * @return the string
+	 */
+	public String describe() {
+		StringBuffer buff = new StringBuffer();
+		buff.append("App: " + name + ", version: " + version + ", desc: " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+				+ desc + "\n"); //$NON-NLS-1$
+		buff.append(" All Params: " + params + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+		for (Executable exec : executables.values())
+			buff.append(exec.describe());
+		return buff.toString();
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args
+	 *            the arguments
+	 */
+	public static void main(String args[]) {
+		try {
+			Application app = new Application(new File("~/workspace/org.txm.core/src/groovy/org/textometrie/scripts/ls-wrapper-definition.xml")); //$NON-NLS-1$
+			app.build(new File("~/Bureau/testClix.java")); //$NON-NLS-1$
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/Application.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/ProcessBuilder.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/ProcessBuilder.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/ProcessBuilder.java	(revision 3666)
@@ -0,0 +1,70 @@
+// Copyright © 2010-2013 ENS de Lyon.
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.processbuilder;
+
+import java.io.File;
+
+import org.txm.utils.ProcessBuilderBuilder;
+
+import groovy.lang.GroovyClassLoader;
+
+/**
+ * creates a wrapper of a program.
+ *
+ * @param definitionFile the definition file
+ * @param classFile the class file
+ * @param binariesDirectory the binaries directory
+ * @return the object
+ * @author H
+ */
+public class ProcessBuilder {
+	public static Object wrapProgram(File definitionFile, File classFile, File binariesDirectory) {
+		try {
+			ProcessBuilderBuilder.build(definitionFile, classFile);
+			// Application app = new Application(definitionFile);
+			// app.build(classFile);
+		} catch (Exception e) {
+			System.err.println(e);
+			return null;
+		}
+
+		GroovyClassLoader gcl = new GroovyClassLoader();
+		Object aProgram;
+
+		try {
+			gcl.addClasspath("."); //$NON-NLS-1$
+			Class clazz = gcl.parseClass(classFile);
+			aProgram = clazz.getConstructor(String.class).newInstance(binariesDirectory.getAbsolutePath()); // path to the directory containing binaries //$NON-NLS-1$
+
+		} catch (Exception e) {
+			System.err.println(e);
+			return null;
+		}
+		return aProgram;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder/ProcessBuilder.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain


Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/processbuilder
___________________________________________________________________
Added: svn:ignore
   + target


Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Download.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Download.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Download.java	(revision 3666)
@@ -0,0 +1,16 @@
+package org.txm.utils;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.nio.channels.Channels;
+import java.nio.channels.ReadableByteChannel;
+
+public class Download {
+	public static long download(URL source, File output) throws IOException {
+		ReadableByteChannel rbc = Channels.newChannel(source.openStream());
+		FileOutputStream fos = new FileOutputStream(output);
+		return fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Download.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/network/SystemProxyDetector.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/network/SystemProxyDetector.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/network/SystemProxyDetector.java	(revision 3666)
@@ -0,0 +1,156 @@
+package org.txm.utils.network;
+
+import java.net.InetSocketAddress;
+import java.net.Proxy;
+import java.net.ProxySelector;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.List;
+
+import org.eclipse.core.net.proxy.IProxyService;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.util.tracker.ServiceTracker;
+import org.txm.utils.logger.Log;
+
+/**
+ * This class implements various manner to retrieve the system proxy
+ * configuration. It tries to get the configuration from the RCP store and from
+ * the Java system properties.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class SystemProxyDetector {
+
+	public String proxy_user = "";
+	public String proxy_password = "";
+	public String proxy_host = "";
+	public int proxy_port = 0;
+
+	/**
+	 * Creates a system proxy detector and tries to retrieve the system proxy
+	 * configuration from the RCP store and from the Java system properties.
+	 */
+	@SuppressWarnings({ "rawtypes", "unchecked" })
+	public SystemProxyDetector() {
+		ServiceTracker proxyTracker = null;
+		try {
+			Bundle c = FrameworkUtil.getBundle(this.getClass());
+			if (c == null)
+				return; // abord;
+			BundleContext bc = c.getBundleContext();
+			if (bc == null)
+				return; // abord;
+			proxyTracker = new ServiceTracker(bc, IProxyService.class.getName(), null);
+			proxyTracker.open();
+
+			IProxyService proxyService = (IProxyService) proxyTracker.getService();
+			if (proxyService.hasSystemProxies()) { // Always response false for Mac OS X, because there is no Eclipse plugin that
+													// manages the system proxies
+				try {
+					List<Proxy> proxies = ProxySelector.getDefault().select(new URI("http://textometrie.ens-lyon.fr"));
+					if (proxies != null) {
+						for (Proxy proxy : proxies) {
+							if (proxy.type().equals(Proxy.Type.HTTP)) {
+								InetSocketAddress addr = (InetSocketAddress) proxy.address();
+								if (addr != null) {
+									proxy_host = addr.getHostName();
+									proxy_port = addr.getPort();
+									break; // ok done
+								}
+							}
+						}
+					}
+				} catch (URISyntaxException e) {
+					Log.printStackTrace(e);
+				}
+			}
+
+			// last resort to find out proxy configuration
+			if (proxy_host == null || proxy_host.length() == 0) {
+				proxy_host = System.getProperty("http.proxyHost");
+				String s = System.getProperty("http.proxyPort");
+				if (s != null)
+					proxy_port = Integer.parseInt(s);
+				proxy_password = System.getProperty("http.proxyPassword");
+				proxy_user = System.getProperty("http.proxyUser");
+			}
+
+			// Log
+			if (proxy_host != null && !proxy_host.isEmpty()) {
+				Log.info("System proxy network configuration detected.");
+			}
+
+			// TODO: useless ?
+			// if (proxyTracker == null) {
+			// IProxyData[] data = proxyService.getProxyData();
+			// for (IProxyData d : data) {
+			// proxy_host = d.getHost();
+			// if (IProxyData.HTTP_PROXY_TYPE.equals(d.getType()) && proxy_host != null &&
+			// proxy_host.length() > 0) {
+			// proxy_port = d.getPort();
+			// proxy_password = d.getPassword();
+			// proxy_user = d.getUserId();
+			// //System.out.println("proxy_server="+proxy_server+" proxy_port="+proxy_port);
+			//
+			// break; // ok done
+			// } else {
+			// proxy_host = null;
+			// }
+			// }
+			// }
+		} catch (Exception e) {
+			Log.printStackTrace(e);
+		} finally {
+			if (proxyTracker != null)
+				proxyTracker.close();
+		}
+	}
+
+	/**
+	 * Checks if a system proxy has been detected.
+	 * 
+	 * @return
+	 */
+	public boolean isSystemProxyDetected() {
+		return proxy_host != null && !proxy_host.isEmpty();
+	}
+
+	/**
+	 * Returns the HTTP system proxy configuration as URL if exists otherwise false.
+	 * 
+	 * @return
+	 */
+	public String getHttpProxyUrl() {
+
+		String proxyUrl = null;
+		String userData = "";
+
+		if (this.isSystemProxyDetected()) {
+			proxyUrl = proxy_host + ":" + proxy_port;
+
+			if (proxy_user != null && !proxy_user.isEmpty()) {
+				userData = proxy_user;
+				proxyUrl = "@" + proxyUrl; //$NON-NLS-1$
+			}
+			if (proxy_password != null && !proxy_password.isEmpty()) {
+				userData += ":" + proxy_password; //$NON-NLS-1$
+			}
+		} else {
+			Log.warning("HTTP system proxy configuration is not set.");
+		}
+
+		if (proxyUrl != null) {
+			proxyUrl = "http://" + userData + proxyUrl; //$NON-NLS-1$
+		}
+
+		return proxyUrl;
+	}
+
+	public String toString() {
+		return getHttpProxyUrl();
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/network/SystemProxyDetector.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/TreeTagger.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/TreeTagger.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/TreeTagger.java	(revision 3666)
@@ -0,0 +1,884 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2016-09-19 10:31:00 +0200 (Mon, 19 Sep 2016) $
+// $LastChangedRevision: 3298 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.treetagger;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Locale;
+
+import org.apache.commons.lang.StringUtils;
+import org.txm.utils.logger.Log;
+
+// Tag files
+/**
+ * The Class TreeTagger.
+ */
+public class TreeTagger {
+
+	/** The binpath. */
+	String binpath = ""; //$NON-NLS-1$
+	String[] options;
+
+	/**
+	 * Instantiates a new tree tagger.
+	 *
+	 * @param binpath
+	 *            the binpath
+	 */
+	public TreeTagger(String binpath, String[] options) {
+		this.binpath = binpath;
+		this.options = options;
+	}
+
+	/** The version. */
+	String version = "0.0.0"; //$NON-NLS-1$
+
+	/** The desc. */
+	String desc = "Tag files"; //$NON-NLS-1$
+
+	/** The debug. */
+	boolean debug = false;
+
+	/**
+	 * Debug.
+	 *
+	 * @param b
+	 *            the b
+	 */
+	public void debug(boolean b) {
+		debug = b;
+	};
+
+	// Print the token
+	/** The istoken. */
+	private Boolean istoken = false;
+
+	/**
+	 * Settoken.
+	 */
+	public void settoken() {
+		this.istoken = true;
+	}
+
+	/**
+	 * Unsettoken.
+	 */
+	public void unsettoken() {
+		this.istoken = false;
+	}
+
+	// Print the lemma
+	/** The islemma. */
+	private Boolean islemma = false;
+
+	/**
+	 * Setlemma.
+	 */
+	public void setlemma() {
+		this.islemma = true;
+	}
+
+	/**
+	 * Unsetlemma.
+	 */
+	public void unsetlemma() {
+		this.islemma = false;
+	}
+
+	// Don't tag SGML annotations
+	/** The issgml. */
+	private Boolean issgml = false;
+
+	/**
+	 * Setsgml.
+	 */
+	public void setsgml() {
+		this.issgml = true;
+	}
+
+	/**
+	 * Unsetsgml.
+	 */
+	public void unsetsgml() {
+		this.issgml = false;
+	}
+
+	// Print all tags of a word with a probability higher than p times the
+	// largest probability
+	/** The isthreshold. */
+	private Boolean isthreshold = false;
+
+	/** The threshold. */
+	private float threshold;
+
+	/**
+	 * Sets the threshold.
+	 *
+	 * @param arg
+	 *            the new threshold
+	 */
+	public void setthreshold(float arg) {
+		this.isthreshold = true;
+		this.threshold = arg;
+	}
+
+	/**
+	 * Unsetthreshold.
+	 */
+	public void unsetthreshold() {
+		this.isthreshold = false;
+	}
+
+	// Print tag probabilities
+	/** The isprob. */
+	private Boolean isprob = false;
+
+	/**
+	 * Setprob.
+	 */
+	public void setprob() {
+		this.isprob = true;
+	}
+
+	/**
+	 * Unsetprob.
+	 */
+	public void unsetprob() {
+		this.isprob = false;
+	}
+
+	// Ignore prefix when guessing pos for unknown words
+	/** The isignoreprefix. */
+	private Boolean isignoreprefix = false;
+
+	/**
+	 * Setignoreprefix.
+	 */
+	public void setignoreprefix() {
+		this.isignoreprefix = true;
+	}
+
+	/**
+	 * Unsetignoreprefix.
+	 */
+	public void unsetignoreprefix() {
+		this.isignoreprefix = false;
+	}
+
+	// Print the token rather than [unknown] for unknown lemma
+	/** The isnounknown. */
+	private Boolean isnounknown = false;
+
+	/**
+	 * Setnounknown.
+	 */
+	public void setnounknown() {
+		this.isnounknown = true;
+	}
+
+	/**
+	 * Unsetnounknown.
+	 */
+	public void unsetnounknown() {
+		this.isnounknown = false;
+	}
+
+	// Look up unknown capitalized words in the list of lower-case words
+	/** The iscapheuristics. */
+	private Boolean iscapheuristics = false;
+
+	/**
+	 * Setcapheuristics.
+	 */
+	public void setcapheuristics() {
+		this.iscapheuristics = true;
+	}
+
+	/**
+	 * Unsetcapheuristics.
+	 */
+	public void unsetcapheuristics() {
+		this.iscapheuristics = false;
+	}
+
+	// Turn on the heuristics fur guessing the parts of speech of unknown
+	// hyphenated words
+	/** The ishyphenheuristics. */
+	private Boolean ishyphenheuristics = false;
+
+	/**
+	 * Sethyphenheuristics.
+	 */
+	public void sethyphenheuristics() {
+		this.ishyphenheuristics = true;
+	}
+
+	/**
+	 * Unsethyphenheuristics.
+	 */
+	public void unsethyphenheuristics() {
+		this.ishyphenheuristics = false;
+	}
+
+	// quiet mode
+	/** The isquiet. */
+	private Boolean isquiet = false;
+
+	/**
+	 * Setquiet.
+	 */
+	public void setquiet() {
+		this.isquiet = true;
+	}
+
+	/**
+	 * Unsetquiet.
+	 */
+	public void unsetquiet() {
+		this.isquiet = false;
+	}
+
+	// pretagging with probabilities
+	/** The isptwithprob. */
+	private Boolean isptwithprob = false;
+
+	/**
+	 * Setptwithprob.
+	 */
+	public void setptwithprob() {
+		this.isptwithprob = true;
+	}
+
+	/**
+	 * Unsetptwithprob.
+	 */
+	public void unsetptwithprob() {
+		this.isptwithprob = false;
+	}
+
+	// pretagging with lemmata
+	/** The isptwithlemma. */
+	private Boolean isptwithlemma = false;
+
+	/**
+	 * Setptwithlemma.
+	 */
+	public void setptwithlemma() {
+		this.isptwithlemma = true;
+	}
+
+	/**
+	 * Unsetptwithlemma.
+	 */
+	public void unsetptwithlemma() {
+		this.isptwithlemma = false;
+	}
+
+	// Print lexical information for each word
+	/** The isproto. */
+	private Boolean isproto = false;
+
+	/**
+	 * Setproto.
+	 */
+	public void setproto() {
+		this.isproto = true;
+	}
+
+	/**
+	 * Unsetproto.
+	 */
+	public void unsetproto() {
+		this.isproto = false;
+	}
+
+	// Use only lexical probabilities for tagging
+	/** The isbase. */
+	private Boolean isbase = false;
+
+	/**
+	 * Setbase.
+	 */
+	public void setbase() {
+		this.isbase = true;
+	}
+
+	/**
+	 * Unsetbase.
+	 */
+	public void unsetbase() {
+		this.isbase = false;
+	}
+
+	// Set minimal tag frequency to [epsilon]
+	/** The iseps. */
+	private Boolean iseps = false;
+
+	/** The eps. */
+	private float eps;
+
+	/**
+	 * Sets the eps.
+	 *
+	 * @param arg
+	 *            the new eps
+	 */
+	public void seteps(float arg) {
+		this.iseps = true;
+		this.eps = arg;
+	}
+
+	/**
+	 * Unseteps.
+	 */
+	public void unseteps() {
+		this.iseps = false;
+	}
+
+	// Read auxiliary lexicon entries from file
+	/** The islex. */
+	private Boolean islex = false;
+
+	/** The lex. */
+	private String lex;
+
+	/**
+	 * Sets the lex.
+	 *
+	 * @param arg
+	 *            the new lex
+	 */
+	public void setlex(String arg) {
+		this.islex = true;
+		this.lex = arg;
+	}
+
+	/**
+	 * Unsetlex.
+	 */
+	public void unsetlex() {
+		this.islex = false;
+	}
+
+	// Read a word-class automaton from file
+	/** The iswc. */
+	private Boolean iswc = false;
+
+	/** The wc. */
+	private String wc;
+
+	/**
+	 * Sets the wc.
+	 *
+	 * @param arg
+	 *            the new wc
+	 */
+	public void setwc(String arg) {
+		this.iswc = true;
+		this.wc = arg;
+	}
+
+	/**
+	 * Unsetwc.
+	 */
+	public void unsetwc() {
+		this.iswc = false;
+	}
+
+	// The SGML tag [tag] signals the end of a sentence. this function implies
+	// the -sgml option
+	/** The iseostag. */
+	private Boolean iseostag = false;
+
+	/** The eostag. */
+	private String eostag;
+
+	/**
+	 * Sets the eostag.
+	 *
+	 * @param arg
+	 *            the new eostag
+	 */
+	public void seteostag(String arg) {
+		this.iseostag = true;
+		this.eostag = arg;
+	}
+
+	/**
+	 * Unseteostag.
+	 */
+	public void unseteostag() {
+		this.iseostag = false;
+	}
+
+	// Tag
+	/**
+	 * Treetagger.
+	 *
+	 * @param modelfile
+	 *            the modelfile
+	 * @param infile
+	 *            the infile
+	 * @param outfile
+	 *            the outfile
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public void treetagger(String modelfile, String infile, String outfile) throws IOException
+	// arg : The model file
+	// arg : The In file
+	// arg : The Out file
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "tree-tagger"); //$NON-NLS-1$
+		if (istoken)
+			args.add("-token"); //$NON-NLS-1$
+		if (islemma)
+			args.add("-lemma"); //$NON-NLS-1$
+		if (issgml)
+			args.add("-sgml"); //$NON-NLS-1$
+		if (isthreshold) {
+			args.add("-threshold"); //$NON-NLS-1$
+			args.add("" + threshold); //$NON-NLS-1$
+		}
+		if (isprob)
+			args.add("-prob"); //$NON-NLS-1$
+		if (isignoreprefix)
+			args.add("-ignore-prefix"); //$NON-NLS-1$
+		if (isnounknown)
+			args.add("-no-unknown"); //$NON-NLS-1$
+		if (iscapheuristics)
+			args.add("-cap-heuristics"); //$NON-NLS-1$
+		if (ishyphenheuristics)
+			args.add("-hyphen-heuristics"); //$NON-NLS-1$
+		if (isquiet)
+			args.add("-quiet"); //$NON-NLS-1$
+		if (isptwithprob)
+			args.add("-pt-with-prob"); //$NON-NLS-1$
+		if (isptwithlemma)
+			args.add("-pt-with-lemma"); //$NON-NLS-1$
+		if (isproto)
+			args.add("-proto"); //$NON-NLS-1$
+		if (isbase)
+			args.add("-base"); //$NON-NLS-1$
+		if (iseps) {
+			args.add("-eps"); //$NON-NLS-1$
+			args.add("" + eps); //$NON-NLS-1$
+		}
+		if (islex) {
+			args.add("-lex"); //$NON-NLS-1$
+			args.add("" + lex); //$NON-NLS-1$
+		}
+		if (iswc) {
+			args.add("-wc"); //$NON-NLS-1$
+			args.add("" + wc); //$NON-NLS-1$
+		}
+		if (iseostag) {
+			args.add("-eos-tag"); //$NON-NLS-1$
+			args.add("" + eostag); //$NON-NLS-1$
+		}
+
+		for (String option : options) {
+			// System.out.println("add manual option: "+option);
+			if (option.trim().length() > 0)
+				args.add(option);
+		}
+
+		args.add("" + modelfile); //$NON-NLS-1$
+		args.add("" + infile); //$NON-NLS-1$
+		args.add("" + outfile); //$NON-NLS-1$
+
+		if (debug)
+			System.out.println(StringUtils.join(args.toArray(), " "));
+
+		Log.fine(StringUtils.join(args.toArray(), " "));
+		
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code " + e + " at " + DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
+
+			System.out.println("Args: ");
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+			System.out.println();
+		}
+
+		File rootFile = new File(infile).getParentFile().getParentFile();
+		File report = new File(rootFile, "NLPToolsParameters.xml"); //$NON-NLS-1$
+		// System.out.println("create txm report file "+report.getAbsolutePath());
+		Writer writer = new OutputStreamWriter(new FileOutputStream(report), "UTF-8"); //$NON-NLS-1$
+		writer.write("<txm:commandLine>" + //$NON-NLS-1$
+				"  <txm:os name=\"" //$NON-NLS-1$
+				+ System.getProperty("os.name") + "\" arch=\"x86\"/>" + //$NON-NLS-1$ //$NON-NLS-2$
+				"  <txm:osSeparator file=\"&#92;\" path=\"&#59;\" line=\"&#x0D;\"/>" //$NON-NLS-1$
+				+ "  <txm:program name=\"tree-tagger\" path=\"~/TXM/treetagger/bin\" desc=\"TreeTagger is the name of the project TreeTagger\" version=\"3.2\"/>" //$NON-NLS-1$
+				+ "  <txm:args>" //$NON-NLS-1$
+				+ "    <txm:arg name=\"token\" type=\"none\"/>" //$NON-NLS-1$
+				+ "    <txm:arg name=\"lemma\" type=\"none\"/>" //$NON-NLS-1$
+				+ "    <txm:arg name=\"sgml\" type=\"none\"/>" //$NON-NLS-1$
+				+ "    <txm:arg name=\"no-unknown\" type=\"none\"/>" //$NON-NLS-1$
+				+ "    <txm:arg name=\"eos-tag\" type=\"String\">&lt;s></txm:arg>" //$NON-NLS-1$
+				+ "    <txm:arg name=\"model\" type=\"String\">" //$NON-NLS-1$
+				+ modelfile + "</txm:arg>" + //$NON-NLS-1$
+				"    <txm:arg name=\"input\" type=\"String\">" + infile //$NON-NLS-1$
+				+ "</txm:arg>" + //$NON-NLS-1$
+				"    <txm:arg name=\"output\" type=\"String\">" //$NON-NLS-1$
+				+ outfile + "</txm:arg>" + //$NON-NLS-1$
+				"  </txm:args>" + //$NON-NLS-1$
+				"</txm:commandLine>"); //$NON-NLS-1$
+		writer.flush();
+		writer.close();
+	}
+
+	// number of preceding words
+	/** The iscl. */
+	private Boolean iscl = false;
+
+	/** The cl. */
+	private int cl;
+
+	/**
+	 * Sets the cl.
+	 *
+	 * @param arg
+	 *            the new cl
+	 */
+	public void setcl(int arg) {
+		this.iscl = true;
+		this.cl = arg;
+	}
+
+	/**
+	 * Unsetcl.
+	 */
+	public void unsetcl() {
+		this.iscl = false;
+	}
+
+	// min. decision tree gain
+	/** The isdtg. */
+	private Boolean isdtg = false;
+
+	/** The dtg. */
+	private float dtg;
+
+	/**
+	 * Sets the dtg.
+	 *
+	 * @param arg
+	 *            the new dtg
+	 */
+	public void setdtg(float arg) {
+		this.isdtg = true;
+		this.dtg = arg;
+	}
+
+	/**
+	 * Unsetdtg.
+	 */
+	public void unsetdtg() {
+		this.isdtg = false;
+	}
+
+	// A smoothing weight parameter
+	/** The issw. */
+	private Boolean issw = false;
+
+	/** The sw. */
+	private float sw;
+
+	/**
+	 * Sets the sw.
+	 *
+	 * @param arg
+	 *            the new sw
+	 */
+	public void setsw(float arg) {
+		this.issw = true;
+		this.sw = arg;
+	}
+
+	/**
+	 * Unsetsw.
+	 */
+	public void unsetsw() {
+		this.issw = false;
+	}
+
+	// affix tree gain
+	/** The isatg. */
+	private Boolean isatg = false;
+
+	/** The atg. */
+	private float atg;
+
+	/**
+	 * Sets the atg.
+	 *
+	 * @param arg
+	 *            the new atg
+	 */
+	public void setatg(float arg) {
+		this.isatg = true;
+		this.atg = arg;
+	}
+
+	/**
+	 * Unsetatg.
+	 */
+	public void unsetatg() {
+		this.isatg = false;
+	}
+
+	// the end-of-sentence part-of-speech tag
+	/** The isst. */
+	private Boolean isst = false;
+
+	/** The st. */
+	private String st;
+
+	/**
+	 * Sets the st.
+	 *
+	 * @param arg
+	 *            the new st
+	 */
+	public void setst(String arg) {
+		this.isst = true;
+		this.st = arg;
+	}
+
+	/**
+	 * Unsetst.
+	 */
+	public void unsetst() {
+		this.isst = false;
+	}
+
+	// weight of the equivalence class based probability estimates
+	/** The isecw. */
+	private Boolean isecw = false;
+
+	/** The ecw. */
+	private float ecw;
+
+	/**
+	 * Sets the ecw.
+	 *
+	 * @param arg
+	 *            the new ecw
+	 */
+	public void setecw(float arg) {
+		this.isecw = true;
+		this.ecw = arg;
+	}
+
+	/**
+	 * Unsetecw.
+	 */
+	public void unsetecw() {
+		this.isecw = false;
+	}
+
+	// probability for lexical entries. default 0.001
+	/** The islt. */
+	private Boolean islt = false;
+
+	/** The lt. */
+	private float lt;
+
+	/**
+	 * Sets the lt.
+	 *
+	 * @param arg
+	 *            the new lt
+	 */
+	public void setlt(float arg) {
+		this.islt = true;
+		this.lt = arg;
+	}
+
+	/**
+	 * Unsetlt.
+	 */
+	public void unsetlt() {
+		this.islt = false;
+	}
+
+	// assume that the data is encoded with UTF8
+	/** The isutf8. */
+	private Boolean isutf8 = false;
+
+	/**
+	 * Setutf8.
+	 */
+	public void setutf8() {
+		this.isutf8 = true;
+	}
+
+	/**
+	 * Unsetutf8.
+	 */
+	public void unsetutf8() {
+		this.isutf8 = false;
+	}
+
+	// Train
+	/**
+	 * Traintreetagger.
+	 *
+	 * @param lexiconfile
+	 *            the lexiconfile
+	 * @param openclassfile
+	 *            the openclassfile
+	 * @param infile
+	 *            the infile
+	 * @param outfile
+	 *            the outfile
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public void traintreetagger(String lexiconfile, String openclassfile, String infile, String outfile) throws IOException
+	// arg : The lexicon file
+	// arg : The open class file
+	// arg : The In file
+	// arg : The Out file
+	{
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "train-tree-tagger"); //$NON-NLS-1$
+		if (isquiet)
+			args.add("-quiet"); //$NON-NLS-1$
+
+		if (iscl) {
+			args.add("-cl"); //$NON-NLS-1$
+			args.add("" + cl); //$NON-NLS-1$
+		}
+		if (isdtg) {
+			args.add("-dtg"); //$NON-NLS-1$
+			args.add("" + dtg); //$NON-NLS-1$
+		}
+		if (issw) {
+			args.add("-sw"); //$NON-NLS-1$
+			args.add("" + sw); //$NON-NLS-1$
+		}
+		if (isatg) {
+			args.add("-atg"); //$NON-NLS-1$
+			args.add("" + atg); //$NON-NLS-1$
+		}
+		if (isst) {
+			args.add("-st"); //$NON-NLS-1$
+			args.add("" + st); //$NON-NLS-1$
+		}
+		if (isecw) {
+			args.add("-ecw"); //$NON-NLS-1$
+			args.add("" + ecw); //$NON-NLS-1$
+		}
+		if (islt) {
+			args.add("-lt"); //$NON-NLS-1$
+			args.add("" + lt); //$NON-NLS-1$
+		}
+		if (isutf8)
+			args.add("-utf8"); //$NON-NLS-1$
+		args.add("" + lexiconfile); //$NON-NLS-1$
+		args.add("" + openclassfile); //$NON-NLS-1$
+		args.add("" + infile); //$NON-NLS-1$
+		args.add("" + outfile); //$NON-NLS-1$
+
+		ProcessBuilder pb = new ProcessBuilder(args);
+		if (debug)
+			System.out.println(StringUtils.join(args.toArray(), " "));
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (Exception err) {
+		}
+		if (e != 0) {
+			System.err.println("Process exited abnormally with code " + e + " at " + DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date())); //$NON-NLS-1$ //$NON-NLS-2$
+			System.out.println("Args: ");
+			for (int c = 0; c < args.size(); c++)
+				System.out.print("" + args.get(c) + " "); //$NON-NLS-1$ //$NON-NLS-2$
+			System.out.println();
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args
+	 *            the arguments
+	 */
+	public static void main(String[] args) {
+
+	}
+
+	public void kill() {
+		// TODO uses TreeTagger4j and manage the process
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/TreeTagger.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/ModelCatalog.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/ModelCatalog.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/ModelCatalog.java	(revision 3666)
@@ -0,0 +1,232 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The TXM platform is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with the TXM platform.  If not, see <http://www.gnu.org/licenses/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-08-29 14:23:55 +0200 (jeu., 29 août 2013) $
+// $LastChangedRevision: 2519 $
+// $LastChangedBy: nilskredens $ 
+//
+package org.txm.utils.treetagger;
+
+import java.io.File;
+import java.util.HashMap;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * build links between a lang and encoding and model file @ author mdecorde.
+ */
+public class ModelCatalog extends HashMap<String, Model> {
+
+	/** The default lang. */
+	String defaultLang = "fr"; //$NON-NLS-1$
+
+	/** The default encoding. */
+	String defaultEncoding = "UTF-8"; //$NON-NLS-1$
+
+	/** The default version. */
+	String defaultVersion = "3.2"; //$NON-NLS-1$
+
+	/** The modelsdescriptor. */
+	File modelsdescriptor;
+
+	/**
+	 * Instantiates a new model catalog.
+	 *
+	 * @param modelsdescriptor
+	 *            the modelsdescriptor
+	 */
+	public ModelCatalog(File modelsdescriptor) {
+		this.modelsdescriptor = modelsdescriptor;
+		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+		DocumentBuilder db;
+		try {
+			db = dbf.newDocumentBuilder();
+			Document doc = db.parse(modelsdescriptor);
+			Element root = doc.getDocumentElement();
+
+			NodeList models = root.getElementsByTagName("model"); //$NON-NLS-1$
+			for (int i = 0; i < models.getLength(); i++) {
+				Element model = (Element) models.item(i);
+				this.put(model.getAttribute("lang"), new Model(model)); //$NON-NLS-1$
+			}
+		} catch (Exception e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	/**
+	 * Describe.
+	 */
+	public void describe() {
+		System.out.println("Model Catalog : " + modelsdescriptor); //$NON-NLS-1$
+		for (Model m : this.values()) {
+			m.describe();
+		}
+	}
+
+	/**
+	 * Gets the model.
+	 *
+	 * @param lang
+	 *            the lang
+	 * @param encoding
+	 *            the encoding
+	 * @param version
+	 *            the version
+	 * @return the model
+	 */
+	public String getModel(String lang, String encoding, String version) {
+		Model m = this.get(lang);
+		return m.get(encoding + version);
+	}
+
+	/**
+	 * Gets the model by encoding.
+	 *
+	 * @param lang
+	 *            the lang
+	 * @param encoding
+	 *            the encoding
+	 * @return the model by encoding
+	 */
+	public String getModelByEncoding(String lang, String encoding) {
+		Model m = this.get(lang);
+		return m.byencoding.get(encoding);
+	}
+
+	/**
+	 * Gets the model by version.
+	 *
+	 * @param lang
+	 *            the lang
+	 * @param version
+	 *            the version
+	 * @return the model by version
+	 */
+	public String getModelByVersion(String lang, String version) {
+		Model m = this.get(lang);
+		return m.byversion.get(version);
+	}
+
+	/**
+	 * Gets the model.
+	 *
+	 * @param lang
+	 *            the lang
+	 * @return the model
+	 */
+	public String getModel(String lang) {
+		return getModel(lang, defaultEncoding, defaultVersion);
+	}
+
+	/**
+	 * Gets the default lang.
+	 *
+	 * @return the default lang
+	 */
+	public String getDefaultLang() {
+		return defaultLang;
+	}
+
+	/**
+	 * Gets the default encoding.
+	 *
+	 * @return the default encoding
+	 */
+	public String getDefaultEncoding() {
+		return defaultEncoding;
+	}
+
+	/**
+	 * Gets the default version.
+	 *
+	 * @return the default version
+	 */
+	public String getDefaultVersion() {
+		return defaultVersion;
+	}
+
+	/**
+	 * Sets the default lang.
+	 *
+	 * @param defaultLang
+	 *            the new default lang
+	 */
+	public void setDefaultLang(String defaultLang) {
+		this.defaultLang = defaultLang;
+	}
+
+	/**
+	 * Sets the default encoding.
+	 *
+	 * @param defaultEncoding
+	 *            the new default encoding
+	 */
+	public void setDefaultEncoding(String defaultEncoding) {
+		this.defaultEncoding = defaultEncoding;
+	}
+
+	/**
+	 * Sets the default version.
+	 *
+	 * @param defaultVersion
+	 *            the new default version
+	 */
+	public void setDefaultVersion(String defaultVersion) {
+		this.defaultVersion = defaultVersion;
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args
+	 *            the arguments
+	 */
+	public static void main(String args[]) {
+		File modelsdescriptor = new File("C:\\Documents and Settings\\H\\Bureau\\eclipseRCP\\eclipse\\models.xml"); //$NON-NLS-1$
+		ModelCatalog catalog = new ModelCatalog(modelsdescriptor);
+		catalog.describe();
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/ModelCatalog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/package.html
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/package.html	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/package.html	(revision 3666)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>TreeTagger wrapper : learning and tagging</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/Model.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/Model.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/Model.java	(revision 3666)
@@ -0,0 +1,120 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+
+//
+// This file is part of the TXM platform.
+//
+// The TXM platform is free software: you can redistribute it and/or modif y
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// The TXM platform is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with the TXM platform.  If not, see <http://www.gnu.org/licenses/>.
+// 
+// 
+// 
+// $LastChangedDate: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
+// $LastChangedRevision: 2386 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils.treetagger;
+
+import java.util.HashMap;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A TreeTagger model varies on language and encoding @ author mdecorde.
+ */
+public class Model extends HashMap<String, String> {
+
+	/** The Constant serialVersionUID. */
+	private static final long serialVersionUID = 4490061845502678357L;
+
+	/** The lang. */
+	String lang;
+
+	/** The country. */
+	String country;
+
+	/** The byversion. */
+	HashMap<String, String> byversion = new HashMap<String, String>();
+
+	/** The byencoding. */
+	HashMap<String, String> byencoding = new HashMap<String, String>();
+
+	/**
+	 * Instantiates a new model.
+	 *
+	 * @param model
+	 *            the model
+	 */
+	public Model(Element model) {
+		lang = model.getAttribute("lang"); //$NON-NLS-1$
+		country = model.getAttribute("country"); //$NON-NLS-1$
+
+		NodeList files = model.getElementsByTagName("file"); //$NON-NLS-1$
+		for (int i = 0; i < files.getLength(); i++) {
+			Element file = (Element) files.item(i);
+			this.put(file.getAttribute("encoding") //$NON-NLS-1$
+					+ file.getAttribute("version"), file.getAttribute("name")); //$NON-NLS-1$ //$NON-NLS-2$
+			this.byversion.put(file.getAttribute("version"), file //$NON-NLS-1$
+					.getAttribute("name")); //$NON-NLS-1$
+			this.byencoding.put(file.getAttribute("encoding"), file //$NON-NLS-1$
+					.getAttribute("name")); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Gets the lang.
+	 *
+	 * @return the lang
+	 */
+	public String getLang() {
+		return lang;
+	}
+
+	/**
+	 * Gets the country.
+	 *
+	 * @return the country
+	 */
+	public String getCountry() {
+		return country;
+	}
+
+	/**
+	 * Describe.
+	 */
+	public void describe() {
+		System.out.println(" Model: lang=" + lang + ", country=" + country); //$NON-NLS-1$ //$NON-NLS-2$
+		for (String encoding : this.byencoding.keySet())
+			System.out.println("  File: encoding=" + encoding + ", name=" //$NON-NLS-1$ //$NON-NLS-2$
+					+ this.byencoding.get(encoding));
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/treetagger/Model.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Sh.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Sh.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Sh.java	(revision 3666)
@@ -0,0 +1,194 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate: 2011-05-09 14:58:28 +0200 (lun., 09 mai 2011) $
+// $LastChangedRevision: 1839 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.utils;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Locale;
+
+import org.txm.utils.logger.Log;
+import org.txm.utils.messages.UtilsCoreMessages;
+
+// TODO: Auto-generated Javadoc
+// Shell
+/**
+ * The Class Sh.
+ */
+public class Sh {
+
+	/** The binpath. */
+	String binpath = ""; //$NON-NLS-1$
+
+	/** The version. */
+	String version = "0.0.0"; //$NON-NLS-1$
+
+	/** The desc. */
+	String desc = "Shell"; //$NON-NLS-1$
+
+	/**
+	 * Instantiates a new sh.
+	 *
+	 * @param binpath
+	 *            the binpath
+	 */
+	public Sh(String binpath) {
+		// System.out.println("set binpath "+binpath);
+		this.binpath = binpath;
+	}
+
+	// execute command line in argument
+	/** The isc. */
+	private Boolean isc = false;
+
+	/** The c. */
+	private String c;
+
+	/**
+	 * Sets the isc.
+	 *
+	 * @param arg
+	 *            the new isc
+	 */
+	public void setIsc(String arg) {
+		this.isc = true;
+		this.c = arg;
+	}
+
+	/**
+	 * Unset isc.
+	 */
+	public void unsetIsc() {
+		this.isc = false;
+	}
+
+	// Sh
+	/**
+	 * Shexe.
+	 *
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public void shexe() throws IOException {
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "sh.exe"); //$NON-NLS-1$
+		if (isc)
+			args.add("-c " + c); //$NON-NLS-1$
+		System.out.println(args);
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			System.err.println(e);
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			System.out.println(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (InterruptedException e1) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e1);
+		}
+		if (e != 0) {
+			Log.fine(UtilsCoreMessages.Sh_4 + e + " at " //$NON-NLS-1$
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date()));
+		}
+	}
+
+	// Sh
+	/**
+	 * Sh.
+	 *
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public void sh() throws IOException {
+		ArrayList<String> args = new ArrayList<String>();
+		args.add(binpath + "sh"); //$NON-NLS-1$
+		if (isc) {
+			args.add("-c"); //$NON-NLS-1$
+			args.add(c);
+		}
+		// System.out.println(args);
+		ProcessBuilder pb = new ProcessBuilder(args);
+		pb.redirectErrorStream(true);
+		Process process = null;
+		try {
+			process = pb.start();
+		} catch (IOException e) {
+			Log.severe(Log.toString(e));
+		}
+		InputStream is = process.getInputStream();
+		InputStreamReader isr = new InputStreamReader(is);
+		BufferedReader br = new BufferedReader(isr);
+		String line;
+		while ((line = br.readLine()) != null) {
+			Log.info(line);
+		}
+		int e = 0;
+		try {
+			e = process.waitFor();
+		} catch (InterruptedException e1) {
+			// TODO Auto-generated catch block
+			org.txm.utils.logger.Log.printStackTrace(e1);
+		}
+		if (e != 0) {
+			Log.fine(UtilsCoreMessages.Sh_4 + e + " at " //$NON-NLS-1$
+					+ DateFormat.getDateInstance(DateFormat.FULL, Locale.UK).format(new Date()));
+		}
+	}
+
+	/**
+	 * The main method.
+	 *
+	 * @param args
+	 *            the arguments
+	 */
+	public static void main(String[] args) {
+		// Sh tt = new Sh("");
+		// tt.setIsc("kill `ps aux | grep cqpserver | awk '/-P 4877/ {print \\$2}'`");//
+		// try {
+		// tt.sh();
+		// } catch (IOException e) {
+		// // TODO Auto-generated catch block
+		// org.txm.utils.logger.Log.printStackTrace(e);
+		// }
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/Sh.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/TableReader.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/TableReader.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/TableReader.java	(revision 3666)
@@ -0,0 +1,215 @@
+package org.txm.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import org.txm.libs.msoffice.ReadExcel;
+import org.txm.libs.office.ReadODS;
+
+/**
+ * Read a table from a TSV, XLSX or ODS files.
+ * 
+ * 1- TableReader reader = new TableReader(file) 2- reader.readHeaders() 3- def
+ * headers = reader.getHeaders() 4- while (reader.readRecord) {
+ * reader.getRecord()} 5- reader.close()
+ * 
+ * @author mdecorde
+ *
+ */
+public class TableReader {
+
+	File tableFile;
+	String mode = "tsv";
+
+	HashMap<String, String> record;
+	CsvReader tsvReader = null;
+	ReadExcel excelReader = null;
+	ReadODS odsReader;
+
+	/**
+	 * Read all the file and creates a list of lines
+	 * (ArraysList<ArraysList<String>>)
+	 * 
+	 * @param tableFile
+	 * @return ArrayList<ArrayList<String>>
+	 * @throws Exception
+	 */
+	public static ArrayList<ArrayList<String>> readAsList(File tableFile) throws Exception {
+		ArrayList<ArrayList<String>> result = new ArrayList<>();
+
+		TableReader reader = new TableReader(tableFile, null);
+		reader.readHeaders();
+		while (reader.readRecord()) {
+			ArrayList<String> line = new ArrayList<>();
+			for (String h : reader.getHeaders()) {
+				line.add(reader.getRecord().get(h));
+			}
+			result.add(line);
+		}
+
+		reader.close();
+		return result;
+	}
+
+	/**
+	 * Read all the file and creates a table of lines (String[][])
+	 * 
+	 * @param tableFile
+	 * @return String[lines][columns]
+	 * @throws Exception
+	 */
+	public static String[][] readAsTable(File tableFile) throws Exception {
+
+		ArrayList<ArrayList<String>> list = readAsList(tableFile);
+
+		if (list.size() == 0)
+			return new String[0][0];
+
+		String[][] result = new String[list.size()][list.get(0).size()];
+
+		int n = 0;
+		for (ArrayList<String> line : list) {
+			int c = 0;
+			for (String s : line) {
+				result[n][c] = s;
+				c++;
+			}
+			n++;
+		}
+		return result;
+	}
+
+	public TableReader(File tableFile) throws Exception {
+		this(tableFile, null);
+	}
+	
+	public TableReader(File tableFile, String sheet) throws Exception {
+		this.tableFile = tableFile;
+
+		if (tableFile.getName().toLowerCase().endsWith(".xlsx")) {
+			mode = "excel";
+			excelReader = new ReadExcel(tableFile, sheet);
+		} else if (tableFile.getName().toLowerCase().endsWith(".ods")) {
+			mode = "ods";
+			odsReader = new ReadODS(tableFile, sheet);
+		} else if (tableFile.getName().toLowerCase().endsWith(".tsv")) {
+			tsvReader = new CsvReader(tableFile.getAbsolutePath(), "\t".charAt(0), Charset.forName("UTF-8"));
+			mode = "tsv";
+		}  else if (tableFile.getName().toLowerCase().endsWith(".csv")) {
+			tsvReader = new CsvReader(tableFile.getAbsolutePath(), ",".charAt(0), Charset.forName("UTF-8"));
+			mode = "tsv";
+		}
+	}
+
+	public String getMode() {
+		return mode;
+	}
+
+	public boolean readHeaders() throws IOException {
+		if (tsvReader != null) {
+			return tsvReader.readHeaders();
+		} else if (excelReader != null) {
+			return excelReader.readHeaders();
+		} else if (odsReader != null) {
+			return odsReader.readHeaders();
+		}
+
+		return false;
+	}
+
+	/**
+	 * read the next record
+	 * 
+	 * @return true if there is another record
+	 * @throws IOException
+	 */
+	public boolean readRecord() throws IOException {
+		if (tsvReader != null) {
+			if (tsvReader.readRecord()) {
+				record = tsvReader.getRecord();
+				return true;
+			} else {
+				return false;
+			}
+		} else if (excelReader != null) {
+			if (excelReader.readRecord()) {
+				record = excelReader.getRecord();
+				return true;
+			} else {
+				return false;
+			}
+		} else if (odsReader != null) {
+			if (odsReader.readRecord()) {
+				record = odsReader.getRecord();
+				return true;
+			} else {
+				return false;
+			}
+		}
+
+		return false;
+	}
+
+	public HashMap<String, String> getRecord() {
+		return record;
+	}
+
+	public String[] getHeaders() throws IOException {
+		if (tsvReader != null) {
+			return tsvReader.getHeaders();
+		} else if (excelReader != null) {
+			return excelReader.getHeaders();
+		} else if (odsReader != null) {
+			return odsReader.getHeaders();
+		}
+
+		return null;
+	}
+
+	String EMPTY = "";
+
+	public String get(String h) throws IOException {
+		String s = getRecord().get(h);
+		if (s == null)
+			return EMPTY;
+
+		return s;
+	}
+
+	public void close() throws IOException {
+		if (tsvReader != null) {
+			tsvReader.close();
+		} else if (excelReader != null) {
+			excelReader.close();
+		} else if (odsReader != null) {
+			odsReader.close();
+		}
+	}
+
+	public static void main(String[] args) {
+		try {
+			System.out.println("Loading...");
+			TableReader reader = new TableReader(new File("/home/mdecorde/TEMP/ANTRACT/AF/ANTRACT_AF_Notices_3oct19.xlsx"));
+			System.out.println("Table loaded");
+
+			System.out.println("Reading headers...");
+			reader.readHeaders();
+			System.out.println(Arrays.toString(reader.getHeaders()));
+
+			System.out.println("Reading record...");
+			reader.readRecord();
+			System.out.println(reader.getRecord());
+
+			System.out.println("Reading record...");
+			reader.readRecord();
+			System.out.println(reader.getRecord());
+		} catch (Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/TableReader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/OSDetector.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/OSDetector.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/OSDetector.java	(revision 3666)
@@ -0,0 +1,68 @@
+package org.txm.utils;
+
+import org.apache.tools.ant.taskdefs.condition.Os;
+
+/**
+ * Utility class dedicated to operating system detection of the runtime target.
+ * 
+ * @author sjacquot
+ *
+ */
+public class OSDetector {
+
+	/**
+	 * Checks if the operating system of the runtime target is of Windows family
+	 * type.
+	 * 
+	 * @return true if the operating system of the runtime target is of Windows
+	 *         family type
+	 */
+	public static boolean isFamilyWindows() {
+		return Os.isFamily(Os.FAMILY_WINDOWS);
+	}
+
+	/**
+	 * Checks if the operating system of the runtime target is of Unix family type.
+	 * 
+	 * @return true if the operating system of the runtime target is of Unix family
+	 *         type
+	 */
+	public static boolean isFamilyUnix() {
+		return Os.isFamily(Os.FAMILY_UNIX);
+	}
+
+	/**
+	 * Checks if the operating system of the runtime target is of Mac family type.
+	 * 
+	 * @return true if the operating system of the runtime target is of Mac family
+	 *         type
+	 */
+	public static boolean isFamilyMac() {
+		return Os.isFamily(Os.FAMILY_MAC);
+	}
+
+	/**
+	 * Checks if the operating system of the runtime target is 64bit architecture.
+	 * 
+	 * @return
+	 */
+	public static boolean isArch64() {
+		return System.getProperty("java.vm.name").toLowerCase().indexOf("64") >= 0; //$NON-NLS-1$ //$NON-NLS-2$
+	}
+
+	/**
+	 * Test method.
+	 * 
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		System.out.println("Runtime OS name: " + System.getProperty("os.name")); //$NON-NLS-1$
+		System.out.println("Runtime OS arch: " + System.getProperty("os.arch")); //$NON-NLS-1$
+		System.out.println("Runtime OS version: " + System.getProperty("os.version")); //$NON-NLS-1$
+		System.out.println("Is arch 64bit ?: " + isArch64()); //$NON-NLS-1$
+		System.out.println("Windows OS family: " + isFamilyWindows()); //$NON-NLS-1$
+		System.out.println("Unix OS family: " + isFamilyUnix()); //$NON-NLS-1$
+		System.out.println("Mac OS family: " + isFamilyMac()); //$NON-NLS-1$
+	}
+
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/OSDetector.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LangDetector.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LangDetector.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LangDetector.java	(revision 3666)
@@ -0,0 +1,112 @@
+package org.txm.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.knallgrau.utils.textcat.TextCategorizer;
+import org.txm.utils.io.IOUtils;
+import org.txm.utils.xml.DomUtils;
+import org.w3c.dom.DOMException;
+import org.xml.sax.SAXException;
+
+public class LangDetector {
+	public static int MINIMALSIZE = 5000;
+
+	String lang = System.getProperty("user.language");
+	String encoding = System.getProperty("file.encoding");
+
+	LinkedHashMap<String, Integer> langs = new LinkedHashMap<String, Integer>();
+	static HashMap<String, String> translations = new HashMap<String, String>();
+	static {
+		translations.put("french", "fr");
+		translations.put("english", "en");
+		translations.put("spanish", "sp");
+		translations.put("italian", "it");
+		translations.put("danish", "da");
+		translations.put("swedish", "sv");
+		translations.put("hungarian", "hu");
+		translations.put("slovakian", "sk");
+		translations.put("german", "de");
+		translations.put("dutch", "nl");
+		translations.put("albanian", "al");
+		translations.put("norwegian", "no");
+		translations.put("finnish", "fi");
+		translations.put("slovenian", "sl");
+		translations.put("polish", "pl");
+	}
+
+	TextCategorizer guesser = new TextCategorizer();
+
+	public LangDetector(File file) throws DOMException, IOException, ParserConfigurationException, SAXException {
+		this(file, "UTF-8");
+	}
+
+	public LangDetector(File file, String encoding) throws DOMException, IOException, ParserConfigurationException, SAXException {
+		if (file.isDirectory())
+			processDirectory(file);
+		else
+			processFile(file);
+	}
+
+	private void processDirectory(File dir) throws IOException, DOMException, ParserConfigurationException, SAXException {
+		// println "process $dir"
+		if (dir.isDirectory()) {
+			for (File file : dir.listFiles(IOUtils.HIDDENFILE_FILTER))
+				if (file.isFile())
+					processFile(file);
+		} else {
+			processFile(dir);
+		}
+
+	}
+
+	private void processFile(File file) throws IOException, DOMException, ParserConfigurationException, SAXException {
+		// println "process $file"
+		String text = null;
+		if (file.getName().endsWith(".xml") || file.getName().endsWith(".XML")) {
+			text = DomUtils.load(file).getDocumentElement().getTextContent();
+		} else {
+			text = IOUtils.getText(file, encoding);
+		}
+		// println "text: "+text.length()
+		String langcode = guesser.categorize(text);
+		String guessedLang = translations.get(langcode);
+		if (guessedLang == null) {
+			guessedLang = langcode;
+		}
+
+		// println "$file guessed $guessedLang"
+		if (!langs.containsKey(guessedLang))
+			langs.put(guessedLang, 0);
+		langs.put(guessedLang, langs.get(guessedLang) + 1);
+	}
+
+	public String getLang() {
+		int max = 0;
+		// println "LANGS: "+langs
+		for (String s : langs.keySet()) {
+			if (max < langs.get(s)) {
+				max = langs.get(s);
+				lang = s;
+			}
+		}
+		return lang;
+	}
+
+	public static void configFromModels(File dir) {
+		File[] files = dir.listFiles(IOUtils.HIDDENFILE_FILTER);
+		Arrays.sort(files);
+		for (File f : files)
+			if (f.getName().contains(".lm") && !f.getName().contains("-"))
+				System.out.println(f.getAbsolutePath() + "\t" + f.getName().substring(0, f.getName().length() - 3));
+	}
+
+	public HashMap<String, Integer> getLangs() {
+		return langs;
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LangDetector.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LS.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LS.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LS.java	(revision 3666)
@@ -0,0 +1,54 @@
+package org.txm.utils;
+
+import java.io.File;
+import java.util.ArrayList;
+
+import org.txm.utils.messages.UtilsCoreMessages;
+
+class LS {
+
+	/**
+	 * Prints the Content of the Directory
+	 *
+	 * @param dir
+	 *            Directory
+	 * @param recur
+	 *            Recursion
+	 * @param size
+	 *            SizeRecursion
+	 * @param hidden
+	 *            Show hidden Files
+	 */
+	public static ArrayList<File> list(File dir, boolean recur, boolean hidden) {
+		ArrayList<File> result = new ArrayList<File>();
+		if ((dir != null) && dir.exists() && dir.isDirectory()) {
+			File[] filelist = dir.listFiles();
+
+			for (File file : filelist) {
+				if (hidden || !file.isHidden()) {
+					result.add(file);
+					if (file.isDirectory() && recur) {
+						result.addAll(list(file, recur, hidden));
+					}
+				}
+			}
+		} else {
+			System.err.println(UtilsCoreMessages.LS_0 + dir + UtilsCoreMessages.LS_1);
+		}
+		return result;
+	}
+
+	public static void main(String args[]) {
+		ArrayList<File> files1 = LS.list(new File("/home/mdecorde"), false, false); //$NON-NLS-1$
+		System.out.println(files1.size());
+
+		ArrayList<File> files2 = LS.list(new File("/home/mdecorde"), true, false); //$NON-NLS-1$
+		System.out.println(files2.size());
+
+		ArrayList<File> files3 = LS.list(new File("/home/mdecorde"), false, true); //$NON-NLS-1$
+		System.out.println(files3.size());
+
+		ArrayList<File> files4 = LS.list(new File("/home/mdecorde"), true, true); //$NON-NLS-1$
+		System.out.println(files4.size());
+	}
+}

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/LS.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/CsvReader.java
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/CsvReader.java	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/CsvReader.java	(revision 3666)
@@ -0,0 +1,1927 @@
+// Copyright © 2010-2020 ENS de Lyon., University of Franche-Comté
+// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
+// Lyon 2, University of Franche-Comté, University of Nice
+// Sophia Antipolis, University of Paris 3.
+// 
+// The TXM platform is free software: you can redistribute it
+// and/or modify it under the terms of the GNU General Public
+// License as published by the Free Software Foundation,
+// either version 2 of the License, or (at your option) any
+// later version.
+// 
+// The TXM platform is distributed in the hope that it will be
+// useful, but WITHOUT ANY WARRANTY; without even the implied
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+// PURPOSE. See the GNU General Public License for more
+// details.
+// 
+// You should have received a copy of the GNU General
+// Public License along with the TXM platform. If not, see
+// http://www.gnu.org/licenses.
+// 
+// 
+// 
+// $LastChangedDate:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.utils;
+/*
+ * Java CSV is a stream based library for reading and writing
+ * CSV and other delimited data.
+ *   
+ * Copyright (C) Bruce Dunwiddie bruce@csvreader.com
+ *
+ * This library is free software; you can redistribute it and/or
+ * modif y it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fif th Floor, Boston, MA  02110-1301, USA
+ */
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.nio.charset.Charset;
+import java.text.NumberFormat;
+import java.util.HashMap;
+
+// TODO: Auto-generated Javadoc
+/**
+ * A stream based parser for parsing delimited text data from a file or a
+ * stream.
+ */
+public class CsvReader {
+
+	/** The input stream. */
+	private Reader inputStream = null;
+
+	/** The file name. */
+	private String fileName = null;
+
+	// this holds all the values for switches that the user is allowed to set
+	/** The user settings. */
+	private UserSettings userSettings = new UserSettings();
+
+	/** The charset. */
+	private Charset charset = null;
+
+	/** The use custom record delimiter. */
+	private boolean useCustomRecordDelimiter = false;
+
+	// this will be our working buffer to hold data chunks
+	// read in from the data file
+
+	/** The data buffer. */
+	private DataBuffer dataBuffer = new DataBuffer();
+
+	/** The column buffer. */
+	private ColumnBuffer columnBuffer = new ColumnBuffer();
+
+	/** The raw buffer. */
+	private RawRecordBuffer rawBuffer = new RawRecordBuffer();
+
+	/** The is qualified. */
+	private boolean[] isQualified = null;
+
+	/** The raw record. */
+	private String rawRecord = ""; //$NON-NLS-1$
+
+	/** The headers holder. */
+	private HeadersHolder headersHolder = new HeadersHolder();
+
+	// these are all more or less global loop variables
+	// to keep from needing to pass them all into various
+	// methods during parsing
+
+	/** The started column. */
+	private boolean startedColumn = false;
+
+	/** The started with qualifier. */
+	private boolean startedWithQualifier = false;
+
+	/** The has more data. */
+	private boolean hasMoreData = true;
+
+	/** The last letter. */
+	private char lastLetter = '\0';
+
+	/** The has read next line. */
+	private boolean hasReadNextLine = false;
+
+	/** The columns count. */
+	private int columnsCount = 0;
+
+	/** The current record. */
+	private long currentRecord = 0;
+
+	/** The values. */
+	private String[] values = new String[StaticSettings.INITIAL_COLUMN_COUNT];
+
+	/** The initialized. */
+	private boolean initialized = false;
+
+	/** The closed. */
+	private boolean closed = false;
+
+	/**
+	 * Double up the text qualif ier to represent an occurance of the text qualif
+	 * ier.
+	 */
+	public static final int ESCAPE_MODE_DOUBLED = 1;
+
+	/**
+	 * Use a backslash character before the text qualif ier to represent an
+	 * occurance of the text qualif ier.
+	 */
+	public static final int ESCAPE_MODE_BACKSLASH = 2;
+
+	/**
+	 * Creates a {@link com.csvreader.CsvReader CsvReader} object using a file as
+	 * the data source.
+	 *
+	 * @param fileName
+	 *            The path to the file to use as the data source.
+	 * @param delimiter
+	 *            The character to use as the column delimiter.
+	 * @param charset
+	 *            The {@link java.nio.charset.Charset Charset} to use while parsing
+	 *            the data.
+	 * @throws FileNotFoundException
+	 *             the file not found exception
+	 */
+	public CsvReader(String fileName, char delimiter, Charset charset) throws FileNotFoundException {
+		if (fileName == null) {
+			throw new IllegalArgumentException("Parameter fileName can not be null."); //$NON-NLS-1$
+		}
+
+		if (charset == null) {
+			throw new IllegalArgumentException("Parameter charset can not be null."); //$NON-NLS-1$
+		}
+
+		if (!new File(fileName).exists()) {
+			throw new FileNotFoundException("File " + fileName //$NON-NLS-1$
+					+ " does not exist."); //$NON-NLS-1$
+		}
+
+		this.fileName = fileName;
+		this.userSettings.Delimiter = delimiter;
+		this.charset = charset;
+
+		isQualified = new boolean[values.length];
+	}
+
+	/**
+	 * Creates a {@link com.csvreader.CsvReader CsvReader} object using a file as
+	 * the data source.&nbsp;Uses ISO-8859-1 as the
+	 *
+	 * @param fileName
+	 *            The path to the file to use as the data source.
+	 * @param delimiter
+	 *            The character to use as the column delimiter.
+	 * @throws FileNotFoundException
+	 *             the file not found exception {@link java.nio.charset.Charset
+	 *             Charset}.
+	 */
+	public CsvReader(String fileName, char delimiter) throws FileNotFoundException {
+		this(fileName, delimiter, Charset.forName("ISO-8859-1")); //$NON-NLS-1$
+	}
+
+	/**
+	 * Creates a {@link com.csvreader.CsvReader CsvReader} object using a file as
+	 * the data source.&nbsp;Uses a comma as the column delimiter and ISO-8859-1 as
+	 * the {@link java.nio.charset.Charset Charset}.
+	 *
+	 * @param fileName
+	 *            The path to the file to use as the data source.
+	 * @throws FileNotFoundException
+	 *             the file not found exception
+	 */
+	public CsvReader(String fileName) throws FileNotFoundException {
+		this(fileName, Letters.COMMA);
+	}
+
+	/**
+	 * Constructs a {@link com.csvreader.CsvReader CsvReader} object using a
+	 *
+	 * @param inputStream
+	 *            The stream to use as the data source.
+	 * @param delimiter
+	 *            The character to use as the column delimiter.
+	 *            {@link java.io.Reader Reader} object as the data source.
+	 */
+	public CsvReader(Reader inputStream, char delimiter) {
+		if (inputStream == null) {
+			throw new IllegalArgumentException("Parameter inputStream can not be null."); //$NON-NLS-1$
+		}
+
+		this.inputStream = inputStream;
+		this.userSettings.Delimiter = delimiter;
+		initialized = true;
+
+		isQualified = new boolean[values.length];
+	}
+
+	/**
+	 * Constructs a {@link com.csvreader.CsvReader CsvReader} object using a
+	 *
+	 * @param inputStream
+	 *            The stream to use as the data source. {@link java.io.Reader
+	 *            Reader} object as the data source.&nbsp;Uses a comma as the column
+	 *            delimiter.
+	 */
+	public CsvReader(Reader inputStream) {
+		this(inputStream, Letters.COMMA);
+	}
+
+	/**
+	 * Constructs a {@link com.csvreader.CsvReader CsvReader} object using an
+	 *
+	 * @param inputStream
+	 *            The stream to use as the data source.
+	 * @param delimiter
+	 *            The character to use as the column delimiter.
+	 * @param charset
+	 *            The {@link java.nio.charset.Charset Charset} to use while parsing
+	 *            the data. {@link java.io.InputStream InputStream} object as the
+	 *            data source.
+	 */
+	public CsvReader(InputStream inputStream, char delimiter, Charset charset) {
+		this(new InputStreamReader(inputStream, charset), delimiter);
+	}
+
+	/**
+	 * Constructs a {@link com.csvreader.CsvReader CsvReader} object using an
+	 *
+	 * @param inputStream
+	 *            The stream to use as the data source.
+	 * @param charset
+	 *            The {@link java.nio.charset.Charset Charset} to use while parsing
+	 *            the data. {@link java.io.InputStream InputStream} object as the
+	 *            data source.&nbsp;Uses a comma as the column delimiter.
+	 */
+	public CsvReader(InputStream inputStream, Charset charset) {
+		this(new InputStreamReader(inputStream, charset));
+	}
+
+	/**
+	 * Gets the capture raw record.
+	 *
+	 * @return the capture raw record
+	 */
+	public boolean getCaptureRawRecord() {
+		return userSettings.CaptureRawRecord;
+	}
+
+	/**
+	 * Sets the capture raw record.
+	 *
+	 * @param captureRawRecord
+	 *            the new capture raw record
+	 */
+	public void setCaptureRawRecord(boolean captureRawRecord) {
+		userSettings.CaptureRawRecord = captureRawRecord;
+	}
+
+	/**
+	 * Gets the raw record.
+	 *
+	 * @return the raw record
+	 */
+	public String getRawRecord() {
+		return rawRecord;
+	}
+
+	/**
+	 * Gets whether leading and trailing whitespace characters are being trimmed
+	 * from non-textqualified column data. Default is true.
+	 * 
+	 * @return Whether leading and trailing whitespace characters are being trimmed
+	 *         from non-textqualified column data.
+	 */
+	public boolean getTrimWhitespace() {
+		return userSettings.TrimWhitespace;
+	}
+
+	/**
+	 * Sets whether leading and trailing whitespace characters should be trimmed
+	 * from non-textqualified column data or not. Default is true.
+	 * 
+	 * @param trimWhitespace
+	 *            Whether leading and trailing whitespace characters should be
+	 *            trimmed from non-textqualified column data or not.
+	 */
+	public void setTrimWhitespace(boolean trimWhitespace) {
+		userSettings.TrimWhitespace = trimWhitespace;
+	}
+
+	/**
+	 * Gets the character being used as the column delimiter. Default is comma, ','.
+	 * 
+	 * @return The character being used as the column delimiter.
+	 */
+	public char getDelimiter() {
+		return userSettings.Delimiter;
+	}
+
+	/**
+	 * Sets the character to use as the column delimiter. Default is comma, ','.
+	 * 
+	 * @param delimiter
+	 *            The character to use as the column delimiter.
+	 */
+	public void setDelimiter(char delimiter) {
+		userSettings.Delimiter = delimiter;
+	}
+
+	/**
+	 * Gets the record delimiter.
+	 *
+	 * @return the record delimiter
+	 */
+	public char getRecordDelimiter() {
+		return userSettings.RecordDelimiter;
+	}
+
+	/**
+	 * Sets the character to use as the record delimiter.
+	 * 
+	 * @param recordDelimiter
+	 *            The character to use as the record delimiter. Default is
+	 *            combination of standard end of line characters for Windows, Unix,
+	 *            or Mac.
+	 */
+	public void setRecordDelimiter(char recordDelimiter) {
+		useCustomRecordDelimiter = true;
+		userSettings.RecordDelimiter = recordDelimiter;
+	}
+
+	/**
+	 * Gets the character to use as a text qualif ier in the data.
+	 * 
+	 * @return The character to use as a text qualif ier in the data.
+	 */
+	public char getTextQualifier() {
+		return userSettings.TextQualifier;
+	}
+
+	/**
+	 * Sets the character to use as a text qualif ier in the data.
+	 * 
+	 * @param textQualifier
+	 *            The character to use as a text qualif ier in the data.
+	 */
+	public void setTextQualifier(char textQualifier) {
+		userSettings.TextQualifier = textQualifier;
+	}
+
+	/**
+	 * Whether text qualif iers will be used while parsing or not.
+	 * 
+	 * @return Whether text qualif iers will be used while parsing or not.
+	 */
+	public boolean getUseTextQualifier() {
+		return userSettings.UseTextQualifier;
+	}
+
+	/**
+	 * Sets whether text qualif iers will be used while parsing or not.
+	 * 
+	 * @param useTextQualifier
+	 *            Whether to use a text qualif ier while parsing or not.
+	 */
+	public void setUseTextQualifier(boolean useTextQualifier) {
+		userSettings.UseTextQualifier = useTextQualifier;
+	}
+
+	/**
+	 * Gets the character being used as a comment signal.
+	 * 
+	 * @return The character being used as a comment signal.
+	 */
+	public char getComment() {
+		return userSettings.Comment;
+	}
+
+	/**
+	 * Sets the character to use as a comment signal.
+	 * 
+	 * @param comment
+	 *            The character to use as a comment signal.
+	 */
+	public void setComment(char comment) {
+		userSettings.Comment = comment;
+	}
+
+	/**
+	 * Gets whether comments are being looked for while parsing or not.
+	 * 
+	 * @return Whether comments are being looked for while parsing or not.
+	 */
+	public boolean getUseComments() {
+		return userSettings.UseComments;
+	}
+
+	/**
+	 * Sets whether comments are being looked for while parsing or not.
+	 * 
+	 * @param useComments
+	 *            Whether comments are being looked for while parsing or not.
+	 */
+	public void setUseComments(boolean useComments) {
+		userSettings.UseComments = useComments;
+	}
+
+	/**
+	 * Gets the current way to escape an occurance of the text qualif ier inside
+	 * qualified data.
+	 * 
+	 * @return The current way to escape an occurance of the text qualif ier inside
+	 *         qualified data.
+	 */
+	public int getEscapeMode() {
+		return userSettings.EscapeMode;
+	}
+
+	/**
+	 * Sets the current way to escape an occurance of the text qualif ier inside
+	 * qualified data.
+	 *
+	 * @param escapeMode
+	 *            The way to escape an occurance of the text qualif ier inside
+	 *            qualified data.
+	 * @throws IllegalArgumentException
+	 *             When an illegal value is specif ied for escapeMode.
+	 */
+	public void setEscapeMode(int escapeMode) throws IllegalArgumentException {
+		if (escapeMode != ESCAPE_MODE_DOUBLED && escapeMode != ESCAPE_MODE_BACKSLASH) {
+			throw new IllegalArgumentException("Parameter escapeMode must be a valid value."); //$NON-NLS-1$
+		}
+
+		userSettings.EscapeMode = escapeMode;
+	}
+
+	/**
+	 * Gets the skip empty records.
+	 *
+	 * @return the skip empty records
+	 */
+	public boolean getSkipEmptyRecords() {
+		return userSettings.SkipEmptyRecords;
+	}
+
+	/**
+	 * Sets the skip empty records.
+	 *
+	 * @param skipEmptyRecords
+	 *            the new skip empty records
+	 */
+	public void setSkipEmptyRecords(boolean skipEmptyRecords) {
+		userSettings.SkipEmptyRecords = skipEmptyRecords;
+	}
+
+	/**
+	 * Safety caution to prevent the parser from using large amounts of memory in
+	 * the case where parsing settings like file encodings don't end up matching the
+	 * actual format of a file. This switch can be turned off if the file format is
+	 * known and tested. With the switch off, the max column lengths and max column
+	 * count per record supported by the parser will greatly increase. Default is
+	 * true.
+	 * 
+	 * @return The current setting of the safety switch.
+	 */
+	public boolean getSafetySwitch() {
+		return userSettings.SafetySwitch;
+	}
+
+	/**
+	 * Safety caution to prevent the parser from using large amounts of memory in
+	 * the case where parsing settings like file encodings don't end up matching the
+	 * actual format of a file. This switch can be turned off if the file format is
+	 * known and tested. With the switch off, the max column lengths and max column
+	 * count per record supported by the parser will greatly increase. Default is
+	 * true.
+	 *
+	 * @param safetySwitch
+	 *            the new safety switch
+	 */
+	public void setSafetySwitch(boolean safetySwitch) {
+		userSettings.SafetySwitch = safetySwitch;
+	}
+
+	/**
+	 * Gets the count of columns found in this record.
+	 * 
+	 * @return The count of columns found in this record.
+	 */
+	public int getColumnCount() {
+		return columnsCount;
+	}
+
+	/**
+	 * Gets the index of the current record.
+	 * 
+	 * @return The index of the current record.
+	 */
+	public long getCurrentRecord() {
+		return currentRecord - 1;
+	}
+
+	/**
+	 * Gets the count of headers read in by a previous call to.
+	 *
+	 * @return The count of headers read in by a previous call to
+	 *         {@link com.csvreader.CsvReader#readHeaders readHeaders()}.
+	 *         {@link com.csvreader.CsvReader#readHeaders readHeaders()}.
+	 */
+	public int getHeaderCount() {
+		return headersHolder.Length;
+	}
+
+	/**
+	 * Returns the header values as a string array.
+	 *
+	 * @return The header values as a String array.
+	 * @throws IOException
+	 *             Thrown if this object has already been closed.
+	 */
+	public String[] getHeaders() throws IOException {
+		checkClosed();
+
+		if (headersHolder.Headers == null) {
+			return null;
+		} else {
+			// use clone here to prevent the outside code from
+			// setting values on the array directly, which would
+			// throw off the index lookup based on header name
+			String[] clone = new String[headersHolder.Length];
+			System.arraycopy(headersHolder.Headers, 0, clone, 0, headersHolder.Length);
+			return clone;
+		}
+	}
+
+	/**
+	 * Sets the headers.
+	 *
+	 * @param headers
+	 *            the new headers
+	 */
+	public void setHeaders(String[] headers) {
+		headersHolder.Headers = headers;
+
+		headersHolder.IndexByName.clear();
+
+		if (headers != null) {
+			headersHolder.Length = headers.length;
+		} else {
+			headersHolder.Length = 0;
+		}
+
+		// use headersHolder.Length here in case headers is null
+		for (int i = 0; i < headersHolder.Length; i++) {
+			headersHolder.IndexByName.put(headers[i], new Integer(i));
+		}
+	}
+
+	/**
+	 * Gets the values.
+	 *
+	 * @return the values
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public String[] getValues() throws IOException {
+		checkClosed();
+
+		// need to return a clone, and can't use clone because values.Length
+		// might be greater than columnsCount
+		String[] clone = new String[columnsCount];
+		System.arraycopy(values, 0, clone, 0, columnsCount);
+		return clone;
+	}
+
+	/**
+	 * Returns the current column value for a given column index.
+	 *
+	 * @param columnIndex
+	 *            The index of the column.
+	 * @return The current column value.
+	 * @throws IOException
+	 *             Thrown if this object has already been closed.
+	 */
+	public String get(int columnIndex) throws IOException {
+		checkClosed();
+
+		if (columnIndex > -1 && columnIndex < columnsCount) {
+			return values[columnIndex];
+		} else {
+			return ""; //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Returns the current column value for a given column header name.
+	 *
+	 * @param headerName
+	 *            The header name of the column.
+	 * @return The current column value.
+	 * @throws IOException
+	 *             Thrown if this object has already been closed.
+	 */
+	public String get(String headerName) throws IOException {
+		checkClosed();
+
+		return get(getIndex(headerName));
+	}
+
+	/**
+	 * Creates a {@link com.csvreader.CsvReader CsvReader} object using a string of
+	 * data as the source.&nbsp;Uses ISO-8859-1 as the
+	 *
+	 * @param data
+	 *            The String of data to use as the source.
+	 * @return A {@link com.csvreader.CsvReader CsvReader} object using the String
+	 *         of data as the source. {@link java.nio.charset.Charset Charset}.
+	 */
+	public static CsvReader parse(String data) {
+		if (data == null) {
+			throw new IllegalArgumentException("Parameter data can not be null."); //$NON-NLS-1$
+		}
+
+		return new CsvReader(new StringReader(data));
+	}
+
+	/**
+	 * Reads another record.
+	 *
+	 * @return Whether another record was successfully read or not.
+	 * @throws IOException
+	 *             Thrown if an error occurs while reading data from the source
+	 *             stream.
+	 */
+	public boolean readRecord() throws IOException {
+		checkClosed();
+
+		columnsCount = 0;
+		rawBuffer.Position = 0;
+
+		dataBuffer.LineStart = dataBuffer.Position;
+
+		hasReadNextLine = false;
+
+		// check to see if we've already found the end of data
+
+		if (hasMoreData) {
+			// loop over the data stream until the end of data is found
+			// or the end of the record is found
+
+			do {
+				if (dataBuffer.Position == dataBuffer.Count) {
+					checkDataLength();
+				} else {
+					startedWithQualifier = false;
+
+					// grab the current letter as a char
+
+					char currentLetter = dataBuffer.Buffer[dataBuffer.Position];
+
+					if (userSettings.UseTextQualifier && currentLetter == userSettings.TextQualifier) {
+						// this will be a text qualified column, so
+						// we need to set startedWithQualifier to make it
+						// enter the seperate branch to handle text
+						// qualified columns
+
+						lastLetter = currentLetter;
+
+						// read qualified
+						startedColumn = true;
+						dataBuffer.ColumnStart = dataBuffer.Position + 1;
+						startedWithQualifier = true;
+						boolean lastLetterWasQualifier = false;
+
+						char escapeChar = userSettings.TextQualifier;
+
+						if (userSettings.EscapeMode == ESCAPE_MODE_BACKSLASH) {
+							escapeChar = Letters.BACKSLASH;
+						}
+
+						boolean eatingTrailingJunk = false;
+						boolean lastLetterWasEscape = false;
+						boolean readingComplexEscape = false;
+						int escape = ComplexEscape.UNICODE;
+						int escapeLength = 0;
+						char escapeValue = (char) 0;
+
+						dataBuffer.Position++;
+
+						do {
+							if (dataBuffer.Position == dataBuffer.Count) {
+								checkDataLength();
+							} else {
+								// grab the current letter as a char
+
+								currentLetter = dataBuffer.Buffer[dataBuffer.Position];
+
+								if (eatingTrailingJunk) {
+									dataBuffer.ColumnStart = dataBuffer.Position + 1;
+
+									if (currentLetter == userSettings.Delimiter) {
+										endColumn();
+									} else if ((!useCustomRecordDelimiter && (currentLetter == Letters.CR || currentLetter == Letters.LF)) || (useCustomRecordDelimiter && currentLetter == userSettings.RecordDelimiter)) {
+										endColumn();
+
+										endRecord();
+									}
+								} else if (readingComplexEscape) {
+									escapeLength++;
+
+									switch (escape) {
+									case ComplexEscape.UNICODE:
+										escapeValue *= (char) 16;
+										escapeValue += hexToDec(currentLetter);
+
+										if (escapeLength == 4) {
+											readingComplexEscape = false;
+										}
+
+										break;
+									case ComplexEscape.OCTAL:
+										escapeValue *= (char) 8;
+										escapeValue += (char) (currentLetter - '0');
+
+										if (escapeLength == 3) {
+											readingComplexEscape = false;
+										}
+
+										break;
+									case ComplexEscape.DECIMAL:
+										escapeValue *= (char) 10;
+										escapeValue += (char) (currentLetter - '0');
+
+										if (escapeLength == 3) {
+											readingComplexEscape = false;
+										}
+
+										break;
+									case ComplexEscape.HEX:
+										escapeValue *= (char) 16;
+										escapeValue += hexToDec(currentLetter);
+
+										if (escapeLength == 2) {
+											readingComplexEscape = false;
+										}
+
+										break;
+									}
+
+									if (!readingComplexEscape) {
+										appendLetter(escapeValue);
+									} else {
+										dataBuffer.ColumnStart = dataBuffer.Position + 1;
+									}
+								} else if (currentLetter == userSettings.TextQualifier) {
+									if (lastLetterWasEscape) {
+										lastLetterWasEscape = false;
+										lastLetterWasQualifier = false;
+									} else {
+										updateCurrentValue();
+
+										if (userSettings.EscapeMode == ESCAPE_MODE_DOUBLED) {
+											lastLetterWasEscape = true;
+										}
+
+										lastLetterWasQualifier = true;
+									}
+								} else if (userSettings.EscapeMode == ESCAPE_MODE_BACKSLASH && lastLetterWasEscape) {
+									switch (currentLetter) {
+									case 'n':
+										appendLetter(Letters.LF);
+										break;
+									case 'r':
+										appendLetter(Letters.CR);
+										break;
+									case 't':
+										appendLetter(Letters.TAB);
+										break;
+									case 'b':
+										appendLetter(Letters.BACKSPACE);
+										break;
+									case 'f':
+										appendLetter(Letters.FORM_FEED);
+										break;
+									case 'e':
+										appendLetter(Letters.ESCAPE);
+										break;
+									case 'v':
+										appendLetter(Letters.VERTICAL_TAB);
+										break;
+									case 'a':
+										appendLetter(Letters.ALERT);
+										break;
+									case '0':
+									case '1':
+									case '2':
+									case '3':
+									case '4':
+									case '5':
+									case '6':
+									case '7':
+										escape = ComplexEscape.OCTAL;
+										readingComplexEscape = true;
+										escapeLength = 1;
+										escapeValue = (char) (currentLetter - '0');
+										dataBuffer.ColumnStart = dataBuffer.Position + 1;
+										break;
+									case 'u':
+									case 'x':
+									case 'o':
+									case 'd':
+									case 'U':
+									case 'X':
+									case 'O':
+									case 'D':
+										switch (currentLetter) {
+										case 'u':
+										case 'U':
+											escape = ComplexEscape.UNICODE;
+											break;
+										case 'x':
+										case 'X':
+											escape = ComplexEscape.HEX;
+											break;
+										case 'o':
+										case 'O':
+											escape = ComplexEscape.OCTAL;
+											break;
+										case 'd':
+										case 'D':
+											escape = ComplexEscape.DECIMAL;
+											break;
+										}
+
+										readingComplexEscape = true;
+										escapeLength = 0;
+										escapeValue = (char) 0;
+										dataBuffer.ColumnStart = dataBuffer.Position + 1;
+
+										break;
+									default:
+										break;
+									}
+
+									lastLetterWasEscape = false;
+
+									// can only happen for ESCAPE_MODE_BACKSLASH
+								} else if (currentLetter == escapeChar) {
+									updateCurrentValue();
+									lastLetterWasEscape = true;
+								} else {
+									if (lastLetterWasQualifier) {
+										if (currentLetter == userSettings.Delimiter) {
+											endColumn();
+										} else if ((!useCustomRecordDelimiter && (currentLetter == Letters.CR || currentLetter == Letters.LF)) || (useCustomRecordDelimiter && currentLetter == userSettings.RecordDelimiter)) {
+											endColumn();
+
+											endRecord();
+										} else {
+											dataBuffer.ColumnStart = dataBuffer.Position + 1;
+
+											eatingTrailingJunk = true;
+										}
+
+										// make sure to clear the flag for next
+										// run of the loop
+
+										lastLetterWasQualifier = false;
+									}
+								}
+
+								// keep track of the last letter because we need
+								// it for several key decisions
+
+								lastLetter = currentLetter;
+
+								if (startedColumn) {
+									dataBuffer.Position++;
+
+									if (userSettings.SafetySwitch && dataBuffer.Position - dataBuffer.ColumnStart + columnBuffer.Position > 100000) {
+										close();
+
+										throw new IOException("Maximum column length of 100,000 exceeded in column " //$NON-NLS-1$
+												+ NumberFormat.getIntegerInstance().format(columnsCount) + " in record " //$NON-NLS-1$
+												+ NumberFormat.getIntegerInstance().format(currentRecord) + ". Set the SafetySwitch property to false" //$NON-NLS-1$
+												+ " if you're expecting column lengths greater than 100,000 characters to" //$NON-NLS-1$
+												+ " avoid this error."); //$NON-NLS-1$
+									}
+								}
+							} // end else
+
+						} while (hasMoreData && startedColumn);
+					} else if (currentLetter == userSettings.Delimiter) {
+						// we encountered a column with no data, so
+						// just send the end column
+
+						lastLetter = currentLetter;
+
+						endColumn();
+					} else if (useCustomRecordDelimiter && currentLetter == userSettings.RecordDelimiter) {
+						// this will skip blank lines
+						if (startedColumn || columnsCount > 0 || !userSettings.SkipEmptyRecords) {
+							endColumn();
+
+							endRecord();
+						} else {
+							dataBuffer.LineStart = dataBuffer.Position + 1;
+						}
+
+						lastLetter = currentLetter;
+					} else if (!useCustomRecordDelimiter && (currentLetter == Letters.CR || currentLetter == Letters.LF)) {
+						// this will skip blank lines
+						if (startedColumn || columnsCount > 0 || (!userSettings.SkipEmptyRecords && (currentLetter == Letters.CR || lastLetter != Letters.CR))) {
+							endColumn();
+
+							endRecord();
+						} else {
+							dataBuffer.LineStart = dataBuffer.Position + 1;
+						}
+
+						lastLetter = currentLetter;
+					} else if (userSettings.UseComments && columnsCount == 0 && currentLetter == userSettings.Comment) {
+						// encountered a comment character at the beginning of
+						// the line so just ignore the rest of the line
+
+						lastLetter = currentLetter;
+
+						skipLine();
+					} else if (userSettings.TrimWhitespace && (currentLetter == Letters.SPACE || currentLetter == Letters.TAB)) {
+						// do nothing, this will trim leading whitespace
+						// for both text qualified columns and non
+
+						startedColumn = true;
+						dataBuffer.ColumnStart = dataBuffer.Position + 1;
+					} else {
+						// since the letter wasn't a special letter, this
+						// will be the first letter of our current column
+
+						startedColumn = true;
+						dataBuffer.ColumnStart = dataBuffer.Position;
+						boolean lastLetterWasBackslash = false;
+						boolean readingComplexEscape = false;
+						int escape = ComplexEscape.UNICODE;
+						int escapeLength = 0;
+						char escapeValue = (char) 0;
+
+						boolean firstLoop = true;
+
+						do {
+							if (!firstLoop && dataBuffer.Position == dataBuffer.Count) {
+								checkDataLength();
+							} else {
+								if (!firstLoop) {
+									// grab the current letter as a char
+									currentLetter = dataBuffer.Buffer[dataBuffer.Position];
+								}
+
+								if (!userSettings.UseTextQualifier && userSettings.EscapeMode == ESCAPE_MODE_BACKSLASH && currentLetter == Letters.BACKSLASH) {
+									if (lastLetterWasBackslash) {
+										lastLetterWasBackslash = false;
+									} else {
+										updateCurrentValue();
+										lastLetterWasBackslash = true;
+									}
+								} else if (readingComplexEscape) {
+									escapeLength++;
+
+									switch (escape) {
+									case ComplexEscape.UNICODE:
+										escapeValue *= (char) 16;
+										escapeValue += hexToDec(currentLetter);
+
+										if (escapeLength == 4) {
+											readingComplexEscape = false;
+										}
+
+										break;
+									case ComplexEscape.OCTAL:
+										escapeValue *= (char) 8;
+										escapeValue += (char) (currentLetter - '0');
+
+										if (escapeLength == 3) {
+											readingComplexEscape = false;
+										}
+
+										break;
+									case ComplexEscape.DECIMAL:
+										escapeValue *= (char) 10;
+										escapeValue += (char) (currentLetter - '0');
+
+										if (escapeLength == 3) {
+											readingComplexEscape = false;
+										}
+
+										break;
+									case ComplexEscape.HEX:
+										escapeValue *= (char) 16;
+										escapeValue += hexToDec(currentLetter);
+
+										if (escapeLength == 2) {
+											readingComplexEscape = false;
+										}
+
+										break;
+									}
+
+									if (!readingComplexEscape) {
+										appendLetter(escapeValue);
+									} else {
+										dataBuffer.ColumnStart = dataBuffer.Position + 1;
+									}
+								} else if (userSettings.EscapeMode == ESCAPE_MODE_BACKSLASH && lastLetterWasBackslash) {
+									switch (currentLetter) {
+									case 'n':
+										appendLetter(Letters.LF);
+										break;
+									case 'r':
+										appendLetter(Letters.CR);
+										break;
+									case 't':
+										appendLetter(Letters.TAB);
+										break;
+									case 'b':
+										appendLetter(Letters.BACKSPACE);
+										break;
+									case 'f':
+										appendLetter(Letters.FORM_FEED);
+										break;
+									case 'e':
+										appendLetter(Letters.ESCAPE);
+										break;
+									case 'v':
+										appendLetter(Letters.VERTICAL_TAB);
+										break;
+									case 'a':
+										appendLetter(Letters.ALERT);
+										break;
+									case '0':
+									case '1':
+									case '2':
+									case '3':
+									case '4':
+									case '5':
+									case '6':
+									case '7':
+										escape = ComplexEscape.OCTAL;
+										readingComplexEscape = true;
+										escapeLength = 1;
+										escapeValue = (char) (currentLetter - '0');
+										dataBuffer.ColumnStart = dataBuffer.Position + 1;
+										break;
+									case 'u':
+									case 'x':
+									case 'o':
+									case 'd':
+									case 'U':
+									case 'X':
+									case 'O':
+									case 'D':
+										switch (currentLetter) {
+										case 'u':
+										case 'U':
+											escape = ComplexEscape.UNICODE;
+											break;
+										case 'x':
+										case 'X':
+											escape = ComplexEscape.HEX;
+											break;
+										case 'o':
+										case 'O':
+											escape = ComplexEscape.OCTAL;
+											break;
+										case 'd':
+										case 'D':
+											escape = ComplexEscape.DECIMAL;
+											break;
+										}
+
+										readingComplexEscape = true;
+										escapeLength = 0;
+										escapeValue = (char) 0;
+										dataBuffer.ColumnStart = dataBuffer.Position + 1;
+
+										break;
+									default:
+										break;
+									}
+
+									lastLetterWasBackslash = false;
+								} else {
+									if (currentLetter == userSettings.Delimiter) {
+										endColumn();
+									} else if ((!useCustomRecordDelimiter && (currentLetter == Letters.CR || currentLetter == Letters.LF)) || (useCustomRecordDelimiter && currentLetter == userSettings.RecordDelimiter)) {
+										endColumn();
+
+										endRecord();
+									}
+								}
+
+								// keep track of the last letter because we need
+								// it for several key decisions
+
+								lastLetter = currentLetter;
+								firstLoop = false;
+
+								if (startedColumn) {
+									dataBuffer.Position++;
+
+									if (userSettings.SafetySwitch && dataBuffer.Position - dataBuffer.ColumnStart + columnBuffer.Position > 100000) {
+										close();
+
+										throw new IOException("Maximum column length of 100,000 exceeded in column " //$NON-NLS-1$
+												+ NumberFormat.getIntegerInstance().format(columnsCount) + " in record " //$NON-NLS-1$
+												+ NumberFormat.getIntegerInstance().format(currentRecord) + ". Set the SafetySwitch property to false" //$NON-NLS-1$
+												+ " if you're expecting column lengths greater than 100,000 characters to" //$NON-NLS-1$
+												+ " avoid this error."); //$NON-NLS-1$
+									}
+								}
+							} // end else
+						} while (hasMoreData && startedColumn);
+					}
+
+					if (hasMoreData) {
+						dataBuffer.Position++;
+					}
+				} // end else
+			} while (hasMoreData && !hasReadNextLine);
+
+			// check to see if we hit the end of the file
+			// without processing the current record
+
+			if (startedColumn || lastLetter == userSettings.Delimiter) {
+				endColumn();
+
+				endRecord();
+			}
+		}
+
+		if (userSettings.CaptureRawRecord) {
+			if (hasMoreData) {
+				if (rawBuffer.Position == 0) {
+					rawRecord = new String(dataBuffer.Buffer, dataBuffer.LineStart, dataBuffer.Position - dataBuffer.LineStart - 1);
+				} else {
+					rawRecord = new String(rawBuffer.Buffer, 0, rawBuffer.Position) + new String(dataBuffer.Buffer, dataBuffer.LineStart, dataBuffer.Position - dataBuffer.LineStart - 1);
+				}
+			} else {
+				// for hasMoreData to ever be false, all data would have had to
+				// have been
+				// copied to the raw buffer
+				rawRecord = new String(rawBuffer.Buffer, 0, rawBuffer.Position);
+			}
+		} else {
+			rawRecord = ""; //$NON-NLS-1$
+		}
+
+		return hasReadNextLine;
+	}
+
+	/**
+	 * Check data length.
+	 *
+	 * @throws IOException
+	 *             Thrown if an error occurs while reading data from the source
+	 *             stream.
+	 */
+	private void checkDataLength() throws IOException {
+		if (!initialized) {
+			if (fileName != null) {
+				inputStream = new BufferedReader(new InputStreamReader(new FileInputStream(fileName), charset), StaticSettings.MAX_FILE_BUFFER_SIZE);
+			}
+
+			charset = null;
+			initialized = true;
+		}
+
+		updateCurrentValue();
+
+		if (userSettings.CaptureRawRecord && dataBuffer.Count > 0) {
+			if (rawBuffer.Buffer.length - rawBuffer.Position < dataBuffer.Count - dataBuffer.LineStart) {
+				int newLength = rawBuffer.Buffer.length + Math.max(dataBuffer.Count - dataBuffer.LineStart, rawBuffer.Buffer.length);
+
+				char[] holder = new char[newLength];
+
+				System.arraycopy(rawBuffer.Buffer, 0, holder, 0, rawBuffer.Position);
+
+				rawBuffer.Buffer = holder;
+			}
+
+			System.arraycopy(dataBuffer.Buffer, dataBuffer.LineStart, rawBuffer.Buffer, rawBuffer.Position, dataBuffer.Count - dataBuffer.LineStart);
+
+			rawBuffer.Position += dataBuffer.Count - dataBuffer.LineStart;
+		}
+
+		try {
+			dataBuffer.Count = inputStream.read(dataBuffer.Buffer, 0, dataBuffer.Buffer.length);
+		} catch (IOException ex) {
+			close();
+
+			throw ex;
+		}
+
+		// if no more data could be found, set flag stating that
+		// the end of the data was found
+
+		if (dataBuffer.Count == -1) {
+			hasMoreData = false;
+		}
+
+		dataBuffer.Position = 0;
+		dataBuffer.LineStart = 0;
+		dataBuffer.ColumnStart = 0;
+	}
+
+	/**
+	 * Read the first record of data as column headers.
+	 *
+	 * @return Whether the header record was successfully read or not.
+	 * @throws IOException
+	 *             Thrown if an error occurs while reading data from the source
+	 *             stream.
+	 */
+	public boolean readHeaders() throws IOException {
+		boolean result = readRecord();
+
+		// copy the header data from the column array
+		// to the header string array
+
+		headersHolder.Length = columnsCount;
+
+		headersHolder.Headers = new String[columnsCount];
+
+		for (int i = 0; i < headersHolder.Length; i++) {
+			String columnValue = get(i);
+
+			headersHolder.Headers[i] = columnValue;
+
+			// if there are duplicate header names, we will save the last one
+			headersHolder.IndexByName.put(columnValue, new Integer(i));
+		}
+
+		if (result) {
+			currentRecord--;
+		}
+
+		columnsCount = 0;
+
+		return result;
+	}
+
+	/**
+	 * Returns the column header value for a given column index.
+	 *
+	 * @param columnIndex
+	 *            The index of the header column being requested.
+	 * @return The value of the column header at the given column index.
+	 * @throws IOException
+	 *             Thrown if this object has already been closed.
+	 */
+	public String getHeader(int columnIndex) throws IOException {
+		checkClosed();
+
+		// check to see if we have read the header record yet
+
+		// check to see if the column index is within the bounds
+		// of our header array
+
+		if (columnIndex > -1 && columnIndex < headersHolder.Length) {
+			// return the processed header data for this column
+
+			return headersHolder.Headers[columnIndex];
+		} else {
+			return ""; //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Checks if is qualified.
+	 *
+	 * @param columnIndex
+	 *            the column index
+	 * @return true, if is qualified
+	 * @throws IOException
+	 *             Signals that an I/O exception has occurred.
+	 */
+	public boolean isQualified(int columnIndex) throws IOException {
+		checkClosed();
+
+		if (columnIndex < columnsCount && columnIndex > -1) {
+			return isQualified[columnIndex];
+		} else {
+			return false;
+		}
+	}
+
+	/**
+	 * End column.
+	 *
+	 * @throws IOException
+	 *             Thrown if a very rare extreme exception occurs during parsing,
+	 *             normally resulting from improper data format.
+	 */
+	private void endColumn() throws IOException {
+		String currentValue = ""; //$NON-NLS-1$
+
+		// must be called before setting startedColumn = false
+		if (startedColumn) {
+			if (columnBuffer.Position == 0) {
+				if (dataBuffer.ColumnStart < dataBuffer.Position) {
+					int lastLetter = dataBuffer.Position - 1;
+
+					if (userSettings.TrimWhitespace && !startedWithQualifier) {
+						while (lastLetter >= dataBuffer.ColumnStart && (dataBuffer.Buffer[lastLetter] == Letters.SPACE || dataBuffer.Buffer[lastLetter] == Letters.TAB)) {
+							lastLetter--;
+						}
+					}
+
+					currentValue = new String(dataBuffer.Buffer, dataBuffer.ColumnStart, lastLetter - dataBuffer.ColumnStart + 1);
+				}
+			} else {
+				updateCurrentValue();
+
+				int lastLetter = columnBuffer.Position - 1;
+
+				if (userSettings.TrimWhitespace && !startedWithQualifier) {
+					while (lastLetter >= 0 && (columnBuffer.Buffer[lastLetter] == Letters.SPACE || columnBuffer.Buffer[lastLetter] == Letters.SPACE)) {
+						lastLetter--;
+					}
+				}
+
+				currentValue = new String(columnBuffer.Buffer, 0, lastLetter + 1);
+			}
+		}
+
+		columnBuffer.Position = 0;
+
+		startedColumn = false;
+
+		if (columnsCount >= 100000 && userSettings.SafetySwitch) {
+			close();
+
+			throw new IOException("Maximum column count of 100,000 exceeded in record " //$NON-NLS-1$
+					+ NumberFormat.getIntegerInstance().format(currentRecord) + ". Set the SafetySwitch property to false" //$NON-NLS-1$
+					+ " if you're expecting more than 100,000 columns per record to" //$NON-NLS-1$
+					+ " avoid this error."); //$NON-NLS-1$
+		}
+
+		// check to see if our current holder array for
+		// column chunks is still big enough to handle another
+		// column chunk
+
+		if (columnsCount == values.length) {
+			// holder array needs to grow to be able to hold another column
+			int newLength = values.length * 2;
+
+			String[] holder = new String[newLength];
+
+			System.arraycopy(values, 0, holder, 0, values.length);
+
+			values = holder;
+
+			boolean[] qualifiedHolder = new boolean[newLength];
+
+			System.arraycopy(isQualified, 0, qualifiedHolder, 0, isQualified.length);
+
+			isQualified = qualifiedHolder;
+		}
+
+		values[columnsCount] = currentValue;
+
+		isQualified[columnsCount] = startedWithQualifier;
+
+		currentValue = ""; //$NON-NLS-1$
+
+		columnsCount++;
+	}
+
+	/**
+	 * Append letter.
+	 *
+	 * @param letter
+	 *            the letter
+	 */
+	private void appendLetter(char letter) {
+		if (columnBuffer.Position == columnBuffer.Buffer.length) {
+			int newLength = columnBuffer.Buffer.length * 2;
+
+			char[] holder = new char[newLength];
+
+			System.arraycopy(columnBuffer.Buffer, 0, holder, 0, columnBuffer.Position);
+
+			columnBuffer.Buffer = holder;
+		}
+		columnBuffer.Buffer[columnBuffer.Position++] = letter;
+		dataBuffer.ColumnStart = dataBuffer.Position + 1;
+	}
+
+	/**
+	 * Update current value.
+	 */
+	private void updateCurrentValue() {
+		if (startedColumn && dataBuffer.ColumnStart < dataBuffer.Position) {
+			if (columnBuffer.Buffer.length - columnBuffer.Position < dataBuffer.Position - dataBuffer.ColumnStart) {
+				int newLength = columnBuffer.Buffer.length + Math.max(dataBuffer.Position - dataBuffer.ColumnStart, columnBuffer.Buffer.length);
+
+				char[] holder = new char[newLength];
+
+				System.arraycopy(columnBuffer.Buffer, 0, holder, 0, columnBuffer.Position);
+
+				columnBuffer.Buffer = holder;
+			}
+
+			System.arraycopy(dataBuffer.Buffer, dataBuffer.ColumnStart, columnBuffer.Buffer, columnBuffer.Position, dataBuffer.Position - dataBuffer.ColumnStart);
+
+			columnBuffer.Position += dataBuffer.Position - dataBuffer.ColumnStart;
+		}
+
+		dataBuffer.ColumnStart = dataBuffer.Position + 1;
+	}
+
+	/**
+	 * End record.
+	 *
+	 * @throws IOException
+	 *             Thrown if an error occurs while reading data from the source
+	 *             stream.
+	 */
+	private void endRecord() throws IOException {
+		// this flag is used as a loop exit condition
+		// during parsing
+
+		hasReadNextLine = true;
+
+		currentRecord++;
+	}
+
+	/**
+	 * Gets the corresponding column index for a given column header name.
+	 *
+	 * @param headerName
+	 *            The header name of the column.
+	 * @return The column index for the given column header name.&nbsp;Returns -1 if
+	 *         not found.
+	 * @throws IOException
+	 *             Thrown if this object has already been closed.
+	 */
+	public int getIndex(String headerName) throws IOException {
+		checkClosed();
+
+		Object indexValue = headersHolder.IndexByName.get(headerName);
+
+		if (indexValue != null) {
+			return ((Integer) indexValue).intValue();
+		} else {
+			return -1;
+		}
+	}
+
+	/**
+	 * Skips the next record of data by parsing each column.&nbsp;Does not increment
+	 *
+	 * @return Whether another record was successfully skipped or not.
+	 * @throws IOException
+	 *             Thrown if an error occurs while reading data from the source
+	 *             stream. {@link com.csvreader.CsvReader#getCurrentRecord
+	 *             getCurrentRecord()}.
+	 */
+	public boolean skipRecord() throws IOException {
+		checkClosed();
+
+		boolean recordRead = false;
+
+		if (hasMoreData) {
+			recordRead = readRecord();
+
+			if (recordRead) {
+				currentRecord--;
+			}
+		}
+
+		return recordRead;
+	}
+
+	/**
+	 * Skips the next line of data using the standard end of line characters and
+	 * does not do any column delimited parsing.
+	 *
+	 * @return Whether a line was successfully skipped or not.
+	 * @throws IOException
+	 *             Thrown if an error occurs while reading data from the source
+	 *             stream.
+	 */
+	public boolean skipLine() throws IOException {
+		checkClosed();
+
+		// clear public column values for current line
+
+		columnsCount = 0;
+
+		boolean skippedLine = false;
+
+		if (hasMoreData) {
+			boolean foundEol = false;
+
+			do {
+				if (dataBuffer.Position == dataBuffer.Count) {
+					checkDataLength();
+				} else {
+					skippedLine = true;
+
+					// grab the current letter as a char
+
+					char currentLetter = dataBuffer.Buffer[dataBuffer.Position];
+
+					if (currentLetter == Letters.CR || currentLetter == Letters.LF) {
+						foundEol = true;
+					}
+
+					// keep track of the last letter because we need
+					// it for several key decisions
+
+					lastLetter = currentLetter;
+
+					if (!foundEol) {
+						dataBuffer.Position++;
+					}
+
+				} // end else
+			} while (hasMoreData && !foundEol);
+
+			columnBuffer.Position = 0;
+
+			dataBuffer.LineStart = dataBuffer.Position + 1;
+		}
+
+		rawBuffer.Position = 0;
+		rawRecord = ""; //$NON-NLS-1$
+
+		return skippedLine;
+	}
+
+	/**
+	 * Closes and releases all related resources.
+	 */
+	public void close() {
+		if (!closed) {
+			close(true);
+
+			closed = true;
+		}
+	}
+
+	/**
+	 * Close.
+	 *
+	 * @param closing
+	 *            the closing
+	 */
+	private void close(boolean closing) {
+		if (!closed) {
+			if (closing) {
+				charset = null;
+				headersHolder.Headers = null;
+				headersHolder.IndexByName = null;
+				dataBuffer.Buffer = null;
+				columnBuffer.Buffer = null;
+				rawBuffer.Buffer = null;
+			}
+
+			try {
+				if (initialized) {
+					inputStream.close();
+				}
+			} catch (Exception e) {
+				// just eat the exception
+			}
+
+			inputStream = null;
+
+			closed = true;
+		}
+	}
+
+	/**
+	 * Check closed.
+	 *
+	 * @throws IOException
+	 *             Thrown if this object has already been closed.
+	 */
+	private void checkClosed() throws IOException {
+		if (closed) {
+			throw new IOException("This instance of the CsvReader class has already been closed."); //$NON-NLS-1$
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see java.lang.Object#finalize()
+	 */
+	@Override
+	protected void finalize() {
+		close(false);
+	}
+
+	/**
+	 * The Class ComplexEscape.
+	 */
+	private class ComplexEscape {
+
+		/** The Constant UNICODE. */
+		private static final int UNICODE = 1;
+
+		/** The Constant OCTAL. */
+		private static final int OCTAL = 2;
+
+		/** The Constant DECIMAL. */
+		private static final int DECIMAL = 3;
+
+		/** The Constant HEX. */
+		private static final int HEX = 4;
+	}
+
+	/**
+	 * Hex to dec.
+	 *
+	 * @param hex
+	 *            the hex
+	 * @return the char
+	 */
+	private static char hexToDec(char hex) {
+		char result;
+
+		if (hex >= 'a') {
+			result = (char) (hex - 'a' + 10);
+		} else if (hex >= 'A') {
+			result = (char) (hex - 'A' + 10);
+		} else {
+			result = (char) (hex - '0');
+		}
+
+		return result;
+	}
+
+	/**
+	 * The Class DataBuffer.
+	 */
+	private class DataBuffer {
+
+		/** The Buffer. */
+		public char[] Buffer;
+
+		/** The Position. */
+		public int Position;
+
+		// / <summary>
+		// / How much usable data has been read into the stream,
+		// / which will not always be as long as Buffer.Length.
+		// / </summary>
+		/** The Count. */
+		public int Count;
+
+		// / <summary>
+		// / The position of the cursor in the buffer when the
+		// / current column was started or the last time data
+		// / was moved out to the column buffer.
+		// / </summary>
+		/** The Column start. */
+		public int ColumnStart;
+
+		/** The Line start. */
+		public int LineStart;
+
+		/**
+		 * Instantiates a new data buffer.
+		 */
+		public DataBuffer() {
+			Buffer = new char[StaticSettings.MAX_BUFFER_SIZE];
+			Position = 0;
+			Count = 0;
+			ColumnStart = 0;
+			LineStart = 0;
+		}
+	}
+
+	/**
+	 * The Class ColumnBuffer.
+	 */
+	private class ColumnBuffer {
+
+		/** The Buffer. */
+		public char[] Buffer;
+
+		/** The Position. */
+		public int Position;
+
+		/**
+		 * Instantiates a new column buffer.
+		 */
+		public ColumnBuffer() {
+			Buffer = new char[StaticSettings.INITIAL_COLUMN_BUFFER_SIZE];
+			Position = 0;
+		}
+	}
+
+	/**
+	 * The Class RawRecordBuffer.
+	 */
+	private class RawRecordBuffer {
+
+		/** The Buffer. */
+		public char[] Buffer;
+
+		/** The Position. */
+		public int Position;
+
+		/**
+		 * Instantiates a new raw record buffer.
+		 */
+		public RawRecordBuffer() {
+			Buffer = new char[StaticSettings.INITIAL_COLUMN_BUFFER_SIZE * StaticSettings.INITIAL_COLUMN_COUNT];
+			Position = 0;
+		}
+	}
+
+	/**
+	 * The Class Letters.
+	 */
+	private class Letters {
+
+		/** The Constant LF. */
+		public static final char LF = '\n';
+
+		/** The Constant CR. */
+		public static final char CR = '\r';
+
+		/** The Constant QUOTE. */
+		public static final char QUOTE = '"';
+
+		/** The Constant COMMA. */
+		public static final char COMMA = ',';
+
+		/** The Constant SPACE. */
+		public static final char SPACE = ' ';
+
+		/** The Constant TAB. */
+		public static final char TAB = '\t';
+
+		/** The Constant POUND. */
+		public static final char POUND = '#';
+
+		/** The Constant BACKSLASH. */
+		public static final char BACKSLASH = '\\';
+
+		/** The Constant NULL. */
+		public static final char NULL = '\0';
+
+		/** The Constant BACKSPACE. */
+		public static final char BACKSPACE = '\b';
+
+		/** The Constant FORM_FEED. */
+		public static final char FORM_FEED = '\f';
+
+		/** The Constant ESCAPE. */
+		public static final char ESCAPE = '\u001B'; // ASCII/ANSI escape
+
+		/** The Constant VERTICAL_TAB. */
+		public static final char VERTICAL_TAB = '\u000B';
+
+		/** The Constant ALERT. */
+		public static final char ALERT = '\u0007';
+	}
+
+	/**
+	 * The Class UserSettings.
+	 */
+	private class UserSettings {
+		// having these as publicly accessible members will prevent
+		// the overhead of the method call that exists on properties
+		/** The Case sensitive. */
+		public boolean CaseSensitive;
+
+		/** The Text qualifier. */
+		public char TextQualifier;
+
+		/** The Trim whitespace. */
+		public boolean TrimWhitespace;
+
+		/** The Use text qualifier. */
+		public boolean UseTextQualifier;
+
+		/** The Delimiter. */
+		public char Delimiter;
+
+		/** The Record delimiter. */
+		public char RecordDelimiter;
+
+		/** The Comment. */
+		public char Comment;
+
+		/** The Use comments. */
+		public boolean UseComments;
+
+		/** The Escape mode. */
+		public int EscapeMode;
+
+		/** The Safety switch. */
+		public boolean SafetySwitch;
+
+		/** The Skip empty records. */
+		public boolean SkipEmptyRecords;
+
+		/** The Capture raw record. */
+		public boolean CaptureRawRecord;
+
+		/**
+		 * Instantiates a new user settings.
+		 */
+		public UserSettings() {
+			CaseSensitive = true;
+			TextQualifier = Letters.QUOTE;
+			TrimWhitespace = true;
+			UseTextQualifier = true;
+			Delimiter = Letters.COMMA;
+			RecordDelimiter = Letters.NULL;
+			Comment = Letters.POUND;
+			UseComments = false;
+			EscapeMode = CsvReader.ESCAPE_MODE_DOUBLED;
+			SafetySwitch = true;
+			SkipEmptyRecords = true;
+			CaptureRawRecord = true;
+		}
+	}
+
+	/**
+	 * The Class HeadersHolder.
+	 */
+	private class HeadersHolder {
+
+		/** The Headers. */
+		public String[] Headers;
+
+		/** The Length. */
+		public int Length;
+
+		/** The Index by name. */
+		public HashMap<String, Integer> IndexByName;
+
+		/**
+		 * Instantiates a new headers holder.
+		 */
+		public HeadersHolder() {
+			Headers = null;
+			Length = 0;
+			IndexByName = new HashMap<>();
+		}
+	}
+
+	/**
+	 * The Class StaticSettings.
+	 */
+	private class StaticSettings {
+		// these are static instead of final so they can be changed in unit test
+		// isn't visible outside this class and is only accessed once during
+		// CsvReader construction
+		/** The Constant MAX_BUFFER_SIZE. */
+		public static final int MAX_BUFFER_SIZE = 1024;
+
+		/** The Constant MAX_FILE_BUFFER_SIZE. */
+		public static final int MAX_FILE_BUFFER_SIZE = 4 * 1024;
+
+		/** The Constant INITIAL_COLUMN_COUNT. */
+		public static final int INITIAL_COLUMN_COUNT = 10;
+
+		/** The Constant INITIAL_COLUMN_BUFFER_SIZE. */
+		public static final int INITIAL_COLUMN_BUFFER_SIZE = 50;
+	}
+
+	protected HashMap<String, String> getRecord() throws IOException {
+		HashMap<String, String> record = new HashMap<>();
+		for (String h : getHeaders()) {
+			record.put(h, get(h));
+		}
+
+		return record;
+	}
+}
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/src/org/txm/utils/CsvReader.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/commons-cli-1.2.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.utils.core/commons-cli-1.2.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.utils.core/build.properties
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/build.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/build.properties	(revision 3666)
@@ -0,0 +1,12 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               commons-cli-1.2.jar,\
+               commons-io-1.4.jar,\
+               commons-lang-2.4.jar,\
+               juniversalchardet-1.0.3.jar,\
+               ant-1.7.1.jar,\
+               textcat-1.0.1.jar,\
+               OSGI-INF/
+#qualifier=svn

Property changes on: TXM/trunk/bundles/org.txm.utils.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/OSGI-INF/l10n/bundle.properties
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/OSGI-INF/l10n/bundle.properties	(revision 3666)
@@ -0,0 +1,3 @@
+#Properties file for org.txm.utils
+Bundle-Vendor = Textometrie.org
+Bundle-Name = org.txm.utils
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/commons-io-1.4.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.utils.core/commons-io-1.4.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.utils.core/test.bmp
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.utils.core/test.bmp
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.jdt.core.prefs	(revision 3666)
@@ -0,0 +1,285 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=400
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

Property changes on: TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.jdt.ui.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.jdt.ui.prefs	(revision 3666)
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+formatter_profile=_Mine
+formatter_settings_version=12

Property changes on: TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.jdt.ui.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.core.resources.prefs
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.core.resources.prefs	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.core.resources.prefs	(revision 3666)
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding//src/org/txm/utils/messages/messages_fr.properties=UTF-8

Property changes on: TXM/trunk/bundles/org.txm.utils.core/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/ant-1.7.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.utils.core/ant-1.7.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: TXM/trunk/bundles/org.txm.utils.core/.classpath
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/.classpath	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/.classpath	(revision 3666)
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con"
+		path="org.eclipse.jdt.launching.JRE_CONTAINER" />
+	<classpathentry kind="con"
+		path="org.eclipse.pde.core.requiredPlugins" />
+	<classpathentry kind="src" path="src" />
+	<classpathentry exported="true" kind="lib"
+		path="commons-cli-1.2.jar" />
+	<classpathentry exported="true" kind="lib"
+		path="commons-io-1.4.jar" />
+	<classpathentry exported="true" kind="lib"
+		path="commons-lang-2.4.jar" />
+	<classpathentry exported="true" kind="lib"
+		path="juniversalchardet-1.0.3.jar" />
+	<classpathentry exported="true" kind="lib"
+		path="ant-1.7.1.jar" />
+	<classpathentry exported="true" kind="lib"
+		path="textcat-1.0.1.jar" />
+	<classpathentry kind="output" path="bin" />
+</classpath>
\ No newline at end of file

Property changes on: TXM/trunk/bundles/org.txm.utils.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/META-INF/MANIFEST.MF
===================================================================
--- TXM/trunk/bundles/org.txm.utils.core/META-INF/MANIFEST.MF	(revision 0)
+++ TXM/trunk/bundles/org.txm.utils.core/META-INF/MANIFEST.MF	(revision 3666)
@@ -0,0 +1,100 @@
+Manifest-Version: 1.0
+Bundle-SymbolicName: org.txm.utils.core
+Export-Package: org.apache.commons.cli,org.apache.commons.io;uses:="or
+ g.apache.commons.io.filefilter",org.apache.commons.io.comparator;uses
+ :="org.apache.commons.io",org.apache.commons.io.filefilter;uses:="org
+ .apache.commons.io",org.apache.commons.io.input,org.apache.commons.io
+ .output,org.apache.commons.lang;uses:="org.apache.commons.lang.except
+ ion",org.apache.commons.lang.builder,org.apache.commons.lang.enum,org
+ .apache.commons.lang.enums,org.apache.commons.lang.exception,org.apac
+ he.commons.lang.math,org.apache.commons.lang.mutable,org.apache.commo
+ ns.lang.text,org.apache.commons.lang.time,org.apache.tools.ant; uses:
+ ="org.apache.tools.ant.input,  org.apache.tools.ant.launch,  org.apac
+ he.tools.ant.types,  new org.apache.tools.ant,  org.apache.tools.ant.
+ types.selectors,  org.xml.sax",org.apache.tools.ant.dispatch;uses:="o
+ rg.apache.tools.ant",org.apache.tools.ant.filters;uses:="org.apache.t
+ ools.ant.util,org.apache.tools.ant.types,org.apache.tools.ant",org.ap
+ ache.tools.ant.filters.util;uses:="org.apache.tools.ant",org.apache.t
+ ools.ant.helper; uses:="org.apache.tools.ant.util,  org.apache.tools.
+ ant,  org.xml.sax.helpers,  org.xml.sax",org.apache.tools.ant.input,o
+ rg.apache.tools.ant.listener;uses:="org.apache.tools.ant",org.apache.
+ tools.ant.loader;uses:="org.apache.tools.ant",org.apache.tools.ant.ta
+ skdefs; uses:="org.apache.tools.ant.util.facade,  org.apache.tools.an
+ t.input,  org.apache.tools.tar,  org.apache.tools.ant.types.selectors
+ .modifiedselector,  org.apache.tools.zip,  org.apache.tools.ant.types
+ .spi,  org.apache.tools.ant,  org.apache.tools.ant.types.selectors,  
+ org.w3c.dom,  org.xml.sax,  org.apache.tools.ant.types.resources.sele
+ ctors,  org.apache.tools.ant.types.resources,  org.apache.tools.ant.u
+ til,  org.apache.tools.ant.filters,  org.apache.tools.ant.taskdefs.co
+ ndition,  org.apache.tools.ant.taskdefs.email,  org.apache.tools.ant.
+ types",org.apache.tools.ant.taskdefs.compilers;uses:="org.apache.tool
+ s.ant.types,org.apache.tools.ant.taskdefs,org.apache.tools.ant",org.a
+ pache.tools.ant.taskdefs.condition; uses:="org.apache.tools.ant.types
+ ,  org.apache.tools.ant.taskdefs,  org.apache.tools.ant.types.selecto
+ rs,  org.apache.tools.ant",org.apache.tools.ant.taskdefs.cvslib;uses:
+ ="org.apache.tools.ant.util,org.apache.tools.ant.taskdefs,org.apache.
+ tools.ant.types",org.apache.tools.ant.taskdefs.email;uses:="org.apach
+ e.tools.ant.types,org.apache.tools.ant",org.apache.tools.ant.taskdefs
+ .rmic; uses:="org.apache.tools.ant.util,  org.apache.tools.ant.types,
+   org.apache.tools.ant.taskdefs,  org.apache.tools.ant",org.apache.to
+ ols.ant.types; uses:="org.apache.tools.ant.types.selectors.modifiedse
+ lector,  org.apache.tools.ant.taskdefs,  org.apache.tools.ant,  org.a
+ pache.tools.ant.types.selectors,  org.xml.sax,  org.apache.tools.ant.
+ util,  javax.xml.transform,  org.apache.tools.ant.filters,  org.apach
+ e.tools.ant.util.regexp",org.apache.tools.ant.types.mappers;uses:="or
+ g.apache.tools.ant.util,org.apache.tools.ant.types",org.apache.tools.
+ ant.types.resources; uses:="org.apache.tools.tar,  org.apache.tools.a
+ nt.types.resources.selectors,  org.apache.tools.ant.util,  org.apache
+ .tools.zip,  org.apache.tools.ant.types.resources.comparators,  org.a
+ pache.tools.ant.types,  org.apache.tools.ant.types.selectors,  org.ap
+ ache.tools.ant",org.apache.tools.ant.types.resources.comparators;uses
+ :="org.apache.tools.ant.types,org.apache.tools.ant",org.apache.tools.
+ ant.types.resources.selectors;uses:="org.apache.tools.ant.types.resou
+ rces.comparators,org.apache.tools.ant.types,org.apache.tools.ant",org
+ .apache.tools.ant.types.selectors; uses:="org.apache.tools.ant.types.
+ resources.selectors,  org.apache.tools.ant.util,  org.apache.tools.an
+ t.types.selectors.modifiedselector,  org.apache.tools.ant.types,  org
+ .apache.tools.ant",org.apache.tools.ant.types.selectors.modifiedselec
+ tor; uses:="org.apache.tools.ant.types.resources.selectors,  org.apac
+ he.tools.ant.types,  org.apache.tools.ant.types.selectors,  org.apach
+ e.tools.ant",org.apache.tools.ant.types.spi;uses:="org.apache.tools.a
+ nt",org.apache.tools.ant.util; uses:="javax.xml.parsers,  org.apache.
+ tools.ant,  org.w3c.dom,  org.xml.sax,  org.apache.tools.ant.types.re
+ sources,  org.apache.tools.ant.types.resources.selectors,  org.apache
+ .tools.ant.types,  org.apache.tools.ant.util.regexp",org.apache.tools
+ .ant.util.facade;uses:="org.apache.tools.ant.types",org.apache.tools.
+ ant.util.regexp;uses:="org.apache.tools.ant",org.apache.tools.bzip2,o
+ rg.apache.tools.mail,org.apache.tools.tar,org.apache.tools.zip,org.kn
+ allgrau.utils.textcat,org.mozilla.universalchardet,org.mozilla.univer
+ salchardet.prober;uses:="org.mozilla.universalchardet.prober.sequence
+ ",org.mozilla.universalchardet.prober.contextanalysis,org.mozilla.uni
+ versalchardet.prober.distributionanalysis,org.mozilla.universalcharde
+ t.prober.sequence,org.mozilla.universalchardet.prober.statemachine,or
+ g.txm.utils; uses:="org.eclipse.core.runtime,  org.osgi.framework,  o
+ rg.knallgrau.utils.textcat,  org.xml.sax",org.txm.utils.i18n,org.txm.
+ utils.io,org.txm.utils.logger,org.txm.utils.messages;uses:="org.eclip
+ se.osgi.util",org.txm.utils.network,org.txm.utils.processbuilder;uses
+ :="org.w3c.dom",org.txm.utils.saxon;uses:="net.sf.saxon.value,net.sf.
+ saxon.om,net.sf.saxon.lib",org.txm.utils.tostring,org.txm.utils.treet
+ agger;uses:="org.w3c.dom",org.txm.utils.xml;uses:="org.w3c.dom",org.t
+ xm.utils.zip;uses:="org.txm.functions"
+Bundle-Name: org.txm.utils.core
+Bundle-Version: 1.0.0.qualifier
+Bundle-ClassPath: .,commons-cli-1.2.jar,commons-io-1.4.jar,commons-lan
+ g-2.4.jar,juniversalchardet-1.0.3.jar,ant-1.7.1.jar,textcat-1.0.1.jar
+Require-Bundle: com.ibm.icu;visibility:=reexport,
+ org.eclipse.osgi.util;bundle-version="3.3.0";visibility:=reexport,
+ org.eclipse.core.runtime;visibility:=reexport,
+ org.eclipse.core.net;bundle-version="1.2.200";visibility:=reexport,
+ org.txm.libs.saxon;bundle-version="9.0.0";visibility:=reexport,
+ org.txm.libs.colt;bundle-version="1.2.0";visibility:=reexport,
+ org.txm.libs.itext;bundle-version="2.1.5";visibility:=reexport,
+ org.txm.libs.msoffice;bundle-version="1.0.0";visibility:=reexport,
+ org.txm.libs.office;bundle-version="0.8.2";visibility:=reexport,
+ org.txm.libs.gson;bundle-version="2.8.6";visibility:=reexport,
+ org.txm.libs.groovy-all;bundle-version="2.3.7";visibility:=reexport
+Bundle-ManifestVersion: 2
+Bundle-RequiredExecutionEnvironment: JavaSE-16
+Bundle-Vendor: Textometrie.org
+Automatic-Module-Name: org.txm.utils.core
+

Property changes on: TXM/trunk/bundles/org.txm.utils.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: TXM/trunk/bundles/org.txm.utils.core/textcat-1.0.1.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: TXM/trunk/bundles/org.txm.utils.core/textcat-1.0.1.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream


Property changes on: TXM/trunk/bundles/org.txm.utils.core
___________________________________________________________________
Added: svn:ignore
   + bin

target


