Index: tmp/org.txm.lexicon.core/.project
===================================================================
--- tmp/org.txm.lexicon.core/.project	(revision 0)
+++ tmp/org.txm.lexicon.core/.project	(revision 299)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.lexicon.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: tmp/org.txm.lexicon.core/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/corpusengine/cqp/Lexicon.java
===================================================================
--- tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/corpusengine/cqp/Lexicon.java	(revision 0)
+++ tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/corpusengine/cqp/Lexicon.java	(revision 299)
@@ -0,0 +1,446 @@
+// 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: 2016-09-19 10:31:00 +0200 (Mon, 19 Sep 2016) $
+// $LastChangedRevision: 3298 $
+// $LastChangedBy: mdecorde $ 
+//
+package org.txm.lexicon.core.corpusengine.cqp;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.util.Arrays;
+import java.util.Map;
+
+import org.txm.functions.Function;
+import org.txm.lexicon.core.messages.LexiconCoreMessages;
+import org.txm.searchengine.cqp.CqpDataProxy;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.CorpusManager;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.Subcorpus;
+import org.txm.statsengine.core.StatException;
+import org.txm.statsengine.core.data.Vector;
+import org.txm.statsengine.r.core.data.VectorImpl;
+
+// TODO: Auto-generated Javadoc
+//  TODO should be put into stat.data package ?
+/**
+ * Represent a frequency list according to a {@link Corpus} (or a.
+ *
+ * {@link Subcorpus}) and a {@link Property}.
+ * @author sloiseau
+ */
+public class Lexicon extends Function {
+
+	
+	/** The prefix r. */
+	protected static String prefixR = "Lexicon"; //$NON-NLS-1$
+
+	/** The nolex. */
+	protected static int nolex = 1;
+	
+	/** The freqs. */
+	private final int[] freqs;
+	
+	/** The ids. */
+	private final int[] ids;
+	
+	/** The forms. */
+	private String[] forms;
+	
+	/** The property. */
+	private final Property property;
+	
+	/** The number of tokens. */
+	int numberOfTokens = -1;
+
+	/** The cache. */
+	private Map<Property, CqpDataProxy> cache;
+	
+	/** The symbol. */
+	private String symbol;
+	
+	/** The writer. */
+	private OutputStreamWriter writer;
+
+	/**
+	 * Protected on purpose: should be accessed through.
+	 *
+	 * @param corpus the corpus
+	 * @param property the property
+	 * @param freq the freq
+	 * @param ids the ids
+	 * {@link Corpus#getLexicon(Property)} or
+	 * {@link Subcorpus#getLexicon(Property)}.
+	 */
+	public Lexicon(Corpus corpus, Property property, final int[] freq, final int[] ids) {
+		super(corpus);
+		if (freq.length != ids.length)
+			throw new IllegalArgumentException(LexiconCoreMessages.Lexicon_0);
+		this.freqs = freq;
+		this.ids = ids;
+		this.forms = null;
+		this.property = property;
+	}
+
+	/**
+	 * Protected on purpose: should be accessed through.
+	 *
+	 * @param corpus the corpus
+	 * @param property the property
+	 * @param map the map
+	 * {@link Corpus#getLexicon(Property)} or
+	 * {@link Subcorpus#getLexicon(Property)}.
+	 */
+	public Lexicon(Corpus corpus, Property property, Map<String, Integer> map) {
+		super(corpus);
+		int size = map.size();
+		freqs = new int[size];
+		forms = map.keySet().toArray(new String[] {});
+		for (int i = 0; i < forms.length; i++) {
+			freqs[i] = map.get(forms[i]);
+		}
+		this.ids = null;
+		this.property = property;
+	}
+
+	/**
+	 * The dif ferent types in the lexicon, the type at the index <code>j</code>
+	 * of this array have the frequency at index <code>j</code> in the array
+	 * returned by {@link #getFreq()}.
+	 * 
+	 * @return types as an array of <code>String</code>
+	 */
+	public String[] getForms() {
+		if (forms == null) {
+			if(ids == null)
+				return new String[0];
+			try {
+				forms = CorpusManager.getCorpusManager().getCqiClient().id2Str(
+						property.getQualifiedName(), ids);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return forms;
+	}
+	
+	/**
+	 * The dif ferent types in the lexicon, the type at the index <code>j</code>
+	 * of this array have the frequency at index <code>j</code> in the array
+	 * returned by {@link #getFreq()}.
+	 *
+	 * @param number the number
+	 * @return types as an array of <code>String</code>
+	 */
+	public String[] getForms(int number) {
+		//System.out.println("Lexicon("+this.property+" get forms. number="+number+", ids len="+ids.length);
+		if (forms == null) {
+			try {
+				number = Math.min(number, ids.length);
+				if (number <= 0)
+					return new String[0];
+				int[] subpositions = new int[number];
+				System.arraycopy(ids, 0, subpositions, 0, number);
+				return CorpusManager.getCorpusManager().getCqiClient().id2Str(
+						property.getQualifiedName(), subpositions);
+			} catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+				return null;
+			}
+		}
+		else
+		{
+			number = Math.min(number, ids.length);
+			if (number <= 0)
+				return new String[0];
+			String[] subforms = new String[number];
+			System.arraycopy(ids, 0, subforms, 0, number);
+			return subforms;
+		}
+	}
+
+	/**
+	 * return the ids of the entries.
+	 *
+	 * @return types as an array of <code>String</code>
+	 */
+	public int[] getIds() {
+		return ids;
+	}
+
+	/**
+	 * The dif ferent frequencies in the lexicon. See {@link #getForms()}.
+	 * 
+	 * @return frequencies as an array of <code>int</code>
+	 */
+	public int[] getFreq() {
+		return freqs;
+	}
+
+	/**
+	 * Number of dif ferent types in the frequency list.
+	 * 
+	 * @return number of types in the corpus or subcorpus.
+	 */
+	public int nbrOfType() {
+		return freqs.length;
+	}
+
+	/**
+	 * Number of tokens (sum of all the frequencies) in the corpus.
+	 * 
+	 * @return the size of the corpus or subcorpus.
+	 */
+	public int nbrOfToken() {
+		if (numberOfTokens <= 0)
+			computeNumberOfTokens();
+		return numberOfTokens;
+	}
+
+	/**
+	 * Compute number of tokens. / this.nbr
+	 */
+	private void computeNumberOfTokens() {
+		numberOfTokens = 0;
+		for (int i = 0; i < freqs.length; i++) {
+			numberOfTokens += freqs[i];
+			// System.out.println(numberOfTokens);
+			// if (freqs[i] != 1) System.out.println(freqs[i]);
+		}
+	}
+
+
+	
+	/**
+	 * Convert the Lexicon into a Vector object.
+	 *
+	 * @return the vector
+	 * @throws StatException the stat exception
+	 */
+	public Vector asVector() throws StatException {
+		String symbol = prefixR + (nolex++);
+		VectorImpl v = new VectorImpl(freqs, symbol);
+		v.setRNames(getForms());
+		this.symbol = v.getSymbol();
+		return v;
+	}
+
+	//TODO: move this into a Lexicon chart renderer
+//	/**
+//	 * Draw a pareto graphic with this frequency list and record it into the
+//	 * provided filename into svg format.
+//	 *
+//	 * @param file where to save the pareto graphic.
+//	 * @return the pareto graphic
+//	 * @throws StatException if anything goes wrong.
+//	 */
+//	public void getParetoGraphic(File file) throws StatException {
+//		String rName = asVector().getSymbol();
+//		String expr = "pareto(" + rName + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+//		try {
+//			RWorkspace.getRWorkspaceInstance().plot(file, expr, RDevice.SVG);
+//		} catch (Exception e) {
+//			throw new StatException(e);
+//		}
+//	}
+
+	/**
+	 * The corpus or subcorpus this lexicon is build on.
+	 * 
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return (Corpus) this.parent;
+	}
+
+	/**
+	 * The property this lexicon is build on.
+	 * 
+	 * @return the property
+	 */
+	public Property getProperty() {
+		return property;
+	}
+
+
+	/**
+	 * Dump.
+	 *
+	 * @param col the col
+	 * @param txt the txt
+	 * @return the string
+	 */
+	public String dump(String col, String txt) {
+		StringBuffer buffer = new StringBuffer();
+		getForms();
+		for (int i = 0; i < forms.length; i++) {
+			buffer.append(txt+ forms[i].replace(txt, txt+txt) + txt + col + freqs[i] + "\n"); //$NON-NLS-1$ 
+		}
+		return buffer.toString();
+	}
+
+	/**
+	 * To txt.
+	 *
+	 * @param outfile the outfile
+	 * @param encoding the encoding
+	 * @param colseparator the colseparator
+	 * @param txtseparator the txtseparator
+	 * @return true, if successful
+	 */
+	@Deprecated
+	public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
+		// NK: writer declared as class attribute to perform a clean if the operation is interrupted
+		// OutputStreamWriter writer;
+		try {
+			this.writer = new OutputStreamWriter(new FileOutputStream(outfile),
+					encoding); 
+		} catch (UnsupportedEncodingException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return false;
+		} catch (FileNotFoundException e1) {
+			org.txm.utils.logger.Log.printStackTrace(e1);
+			return false;
+		}
+
+		try {
+			writer.write(this.dump(colseparator, txtseparator));
+			writer.close();
+		} catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+			return false;
+		}
+
+		return true;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.lang.Object#equals(java.lang.Object)
+	 */
+	@Override
+	public boolean equals(Object obj) {
+		if (!(obj instanceof Lexicon))
+			return false;
+		Lexicon other = (Lexicon) obj;
+
+		if (other.nbrOfType() != this.nbrOfType())
+			return false;
+		return (Arrays.equals(freqs, other.getFreq()) && Arrays.equals(
+				getForms(), other.getForms()));
+	}
+
+	/**
+	 * Sets the symbol.
+	 *
+	 * @param symbol the new symbol
+	 */
+	public void setSymbol(String symbol) {
+		this.symbol = symbol;
+	}
+	
+	/**
+	 * Gets the symbol.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol()
+	{
+		return this.symbol;
+	}
+
+	@Override
+	public void clean() {
+		try {
+			this.writer.flush();
+			this.writer.close();	
+		}
+		catch (NullPointerException e) {
+		}
+		catch (IOException e) {
+			org.txm.utils.logger.Log.printStackTrace(e);
+		}
+	}
+
+	@Override
+	public boolean delete() {
+		this.getCorpus().dropLexicon(getProperty());
+		return super.delete();
+	}
+
+	@Override
+	public String getName() {
+		try {
+			return LexiconCoreMessages.RESULT_TYPE + ": " + this.parent.getSimpleName() + ": " + this.getSimpleName();	
+		}
+		catch(Exception e) {
+		}
+		return "";
+	}
+	
+	
+	@Override
+	public String toString() {
+		return super.toString() + ": " + LexiconCoreMessages.Lexicon_3 + getName();
+	}
+
+	
+	@Override
+	public String getSimpleName() {
+		try {
+			return this.getProperty().getName();
+		}
+		catch(Exception e) {
+		}
+		return "";
+	}
+
+	@Override
+	public String getDetails() {
+		//FIXME: the hierarchy of Lexicon and Index should be redefined
+		// Index should not store a Lexicon?
+		// + Lexicon should extend Index?
+//		try {
+//			Object[] params = new Object[]{this.parent.getSimpleName(),index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax()}; 
+//			String str;
+//			if(this.parent instanceof Partition)	{
+//				str = LexiconCoreMessages.DetailsFromPartition;
+//			}
+//			else	{
+//				str = LexiconCoreMessages.DetailsFromCorpus;
+//			}
+//			return NLS.bind(str, params);
+//		}
+//		catch(Exception e) {
+//			return "";
+//		}
+		return null;
+	}
+}

Property changes on: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/corpusengine/cqp/Lexicon.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages_ru.properties
===================================================================
--- tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages_ru.properties	(revision 0)
+++ tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages_ru.properties	(revision 299)
@@ -0,0 +1,6 @@
+
+DetailsFromCorpus = Словарь:\n\	Корпус {0}\n\	Запрос {1}\n\	Свойства {2}\n\	Fmin {3}\n\	Fmax {4}
+
+DetailsFromPartition = Словарь:\n\	Распределение {0}\n\	Запрос {1}\n\	Свойства {2}\n\	Fmin {3}\n\	Fmax {4}
+
+RESULT_TYPE = Словарь

Property changes on: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages_ru.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages_fr.properties	(revision 0)
+++ tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages_fr.properties	(revision 299)
@@ -0,0 +1,9 @@
+
+DetailsFromCorpus = Lexique :\n\	Corpus {0}\n\	Requête {1}\n\	Propriétés {2}\n\	Fmin {3}\n\	Fmax {4}
+
+DetailsFromPartition = Lexique :\n\	Partition {0}\n\	Requête {1}\n\	Propriétés {2}\n\	Fmin {3}\n\	Fmax {4}
+
+Lexicon_0 = Le tableau des formes et des fréquences doivent avoir la même longueur.
+Lexicon_3 = Lexique :
+
+RESULT_TYPE = Lexique

Property changes on: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/LexiconCoreMessages.java
===================================================================
--- tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/LexiconCoreMessages.java	(revision 0)
+++ tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/LexiconCoreMessages.java	(revision 299)
@@ -0,0 +1,32 @@
+package org.txm.lexicon.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+
+/**
+ * Lexicon core messages.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class LexiconCoreMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.lexicon.core.messages.messages"; //$NON-NLS-1$
+
+	public static String RESULT_TYPE;
+	public static String Lexicon_0;
+	public static String Lexicon_3;
+	public static String DetailsFromPartition;
+	public static String DetailsFromCorpus;
+
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, LexiconCoreMessages.class);
+	}
+
+	private LexiconCoreMessages() {
+	}
+}

Property changes on: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/LexiconCoreMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages.properties
===================================================================
--- tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages.properties	(revision 0)
+++ tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages.properties	(revision 299)
@@ -0,0 +1,9 @@
+
+DetailsFromCorpus = Lexicon:\n\	Corpus {0}\n\	query {1}\n\	properties {2}\n\	Fmin {3}\n\	Fmax {4}
+
+DetailsFromPartition = Lexicon:\n\	Partition {0}\n\	query {1}\n\	properties {2}\n\	Fmin {3}\n\	Fmax {4}
+
+Lexicon_0 = Forms and frequencies tables must be of the same length.
+Lexicon_3 = Lexicon : 
+
+RESULT_TYPE = Lexicon

Property changes on: tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/messages/messages.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/build.properties
===================================================================
--- tmp/org.txm.lexicon.core/build.properties	(revision 0)
+++ tmp/org.txm.lexicon.core/build.properties	(revision 299)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .

Property changes on: tmp/org.txm.lexicon.core/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- tmp/org.txm.lexicon.core/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ tmp/org.txm.lexicon.core/.settings/org.eclipse.jdt.core.prefs	(revision 299)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Property changes on: tmp/org.txm.lexicon.core/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/.classpath
===================================================================
--- tmp/org.txm.lexicon.core/.classpath	(revision 0)
+++ tmp/org.txm.lexicon.core/.classpath	(revision 299)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: tmp/org.txm.lexicon.core/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.core/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.lexicon.core/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.lexicon.core/META-INF/MANIFEST.MF	(revision 299)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Lexicon Core
+Bundle-SymbolicName: org.txm.lexicon.core
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Textometrie.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.txm.core;bundle-version="0.7.0",
+ org.eclipse.core.runtime;bundle-version="3.10.0"
+Export-Package: org.txm.lexicon.core.corpusengine.cqp,
+ org.txm.lexicon.core.messages

Property changes on: tmp/org.txm.lexicon.core/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/plugin.xml
===================================================================
--- tmp/org.txm.lexicon.rcp/plugin.xml	(revision 0)
+++ tmp/org.txm.lexicon.rcp/plugin.xml	(revision 299)
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.menus">
+      <menuContribution
+            allPopups="false"
+            locationURI="toolbar:org.txm.rcpapplication.toolbartools">
+         <command
+               commandId="ComputeLexicon"
+               icon="icons/lexicon.png"
+               style="push"
+               tooltip="%command.tooltip">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            allPopups="false"
+            locationURI="popup:org.txm.rcpapplication.views.CorporaView">
+         <command
+               commandId="ComputeLexicon"
+               icon="icons/lexicon.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            locationURI="menu:menu.tools">
+         <command
+               commandId="ComputeLexicon"
+               icon="icons/lexicon.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <reference
+                     definitionId="OneCorpusSelected">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+               <command
+            categoryId="org.txm.rcpapplication.category.txm"
+            defaultHandler="org.txm.lexicon.rcp.handlers.ComputeLexicon"
+            id="ComputeLexicon"
+            name="%command.name">
+      </command>
+         
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors">
+               <editor
+            class="org.txm.lexicon.rcp.editors.DictionnaryEditor"
+            default="false"
+            icon="icons/lexicon.png"
+            id="LexiconEditor"
+            name="%editor.name">
+      </editor>
+         
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.adapters">
+      <factory
+            adaptableType="org.txm.lexicon.core.corpusengine.cqp.Lexicon"
+            class="org.txm.lexicon.rcp.adapters.LexiconAdapterFactory">
+         <adapter
+               type="org.eclipse.ui.model.IWorkbenchAdapter">
+         </adapter>
+      </factory>
+   </extension>
+   <extension
+         point="org.eclipse.core.expressions.definitions">
+      <definition
+            id="OneLexiconSelected">
+         <with
+               variable="selection">
+            <iterate
+                  ifEmpty="false"
+                  operator="and">
+               <instanceof
+                     value="org.txm.lexicon.core.corpusengine.cqp.Lexicon">
+               </instanceof>
+            </iterate>
+         </with>
+      </definition>
+   </extension>
+
+</plugin>

Property changes on: tmp/org.txm.lexicon.rcp/plugin.xml
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- tmp/org.txm.lexicon.rcp/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ tmp/org.txm.lexicon.rcp/.settings/org.eclipse.jdt.core.prefs	(revision 299)
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6

Property changes on: tmp/org.txm.lexicon.rcp/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/.classpath
===================================================================
--- tmp/org.txm.lexicon.rcp/.classpath	(revision 0)
+++ tmp/org.txm.lexicon.rcp/.classpath	(revision 299)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: tmp/org.txm.lexicon.rcp/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.lexicon.rcp/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.lexicon.rcp/META-INF/MANIFEST.MF	(revision 299)
@@ -0,0 +1,19 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Lexicon RCP
+Bundle-SymbolicName: org.txm.lexicon.rcp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.txm.core;bundle-version="0.7.0",
+ org.txm.lexicon.core;bundle-version="1.0.0",
+ org.txm.index.core;bundle-version="1.0.0",
+ org.txm.index.rcp;bundle-version="1.0.0",
+ org.eclipse.jface,
+ org.txm.rcp;bundle-version="0.7.8",
+ org.eclipse.ui;bundle-version="3.106.1",
+ org.eclipse.core.runtime;bundle-version="3.10.0",
+ org.eclipse.core.expressions;bundle-version="3.4.600"
+Export-Package: org.txm.lexicon.rcp.adapters,
+ org.txm.lexicon.rcp.editors,
+ org.txm.lexicon.rcp.handlers
+Bundle-Vendor: Textometrie.org

Property changes on: tmp/org.txm.lexicon.rcp/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/.project
===================================================================
--- tmp/org.txm.lexicon.rcp/.project	(revision 0)
+++ tmp/org.txm.lexicon.rcp/.project	(revision 299)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.txm.lexicon.rcp</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: tmp/org.txm.lexicon.rcp/.project
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/adapters/LexiconAdapterFactory.java
===================================================================
--- tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/adapters/LexiconAdapterFactory.java	(revision 0)
+++ tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/adapters/LexiconAdapterFactory.java	(revision 299)
@@ -0,0 +1,41 @@
+// Copyright © 2010-2013 ENS de Lyon.
+package org.txm.lexicon.rcp.adapters;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.model.IWorkbenchAdapter;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.FrameworkUtil;
+import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
+import org.txm.rcp.adapters.TXMResultAdapter;
+import org.txm.rcp.adapters.TXMResultAdapterFactory;
+
+
+/**
+ * A factory for creating Adapter objects.
+ *  
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class LexiconAdapterFactory extends TXMResultAdapterFactory {
+
+	
+	public static final ImageDescriptor ICON =
+			AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(LexiconAdapterFactory.class).getSymbolicName(),
+					"platform:/plugin/"+ FrameworkUtil.getBundle(LexiconAdapterFactory.class).getSymbolicName() + "/icons/lexicon.png"); //$NON-NLS-1$
+	
+	@Override
+	public Object getAdapter(Object adaptableObject, Class adapterType) {
+		if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Lexicon)	{
+			return new TXMResultAdapter() {
+				@Override
+				public ImageDescriptor getImageDescriptor(Object object) {
+					// TODO Auto-generated method stub
+					return ICON;
+				}
+			};
+		}
+		return null;
+	}
+
+
+}

Property changes on: tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/adapters/LexiconAdapterFactory.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/editors/DictionnaryEditor.java
===================================================================
--- tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/editors/DictionnaryEditor.java	(revision 0)
+++ tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/editors/DictionnaryEditor.java	(revision 299)
@@ -0,0 +1,84 @@
+// 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:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.lexicon.rcp.editors;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Composite;
+import org.txm.index.rcp.editors.IndexEditor;
+import org.txm.lexicon.core.messages.LexiconCoreMessages;
+// TODO: Auto-generated Javadoc
+/**
+ * extends the index editor to set : the number of property to 1 hide the
+ * query field @ author mdecorde.
+ */
+public class DictionnaryEditor extends IndexEditor {
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcpapplication.editors.index.IndexEditor#createPartControl(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	public void createPartControl(final Composite parent) {
+		super.createPartControl(parent);
+		this.propsArea.setMaxPropertyNumber(1);
+		this.queryWidget.setText("[]"); //$NON-NLS-1$
+		this.queryWidget.setEnabled(false);
+		this.queryWidget.setVisible(false);
+		this.queryWidget.setSize(0, 0);
+		this.queryWidget.dispose();
+		this.queryLabel.setVisible(false);
+		this.queryLabel.dispose();
+		saveIndex = false;
+	}
+	
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcpapplication.editors.index.IndexEditor#getTitleToolTip()
+	 */
+	@Override
+	public String getTitleToolTip() {
+		if (index != null) {
+			String str;
+
+			if (partition != null)
+				str = NLS.bind(LexiconCoreMessages.DetailsFromPartition, new Object[]{partition.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax()});
+			else
+				str = NLS.bind(LexiconCoreMessages.DetailsFromCorpus, new Object[]{corpus.getName(), index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax()});
+			return str;
+		}
+		return ""; //$NON-NLS-1$
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.txm.rcpapplication.editors.index.IndexEditor#getSource()
+	 */
+	@Override
+	public Object getSource()
+	{
+		return index.getLexicon();
+	}
+}

Property changes on: tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/editors/DictionnaryEditor.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/handlers/ComputeLexicon.java
===================================================================
--- tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/handlers/ComputeLexicon.java	(revision 0)
+++ tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/handlers/ComputeLexicon.java	(revision 299)
@@ -0,0 +1,106 @@
+// 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:$
+// $LastChangedRevision:$
+// $LastChangedBy:$ 
+//
+package org.txm.lexicon.rcp.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.ui.IWorkbenchPage;
+import org.txm.index.core.functions.Index;
+import org.txm.index.rcp.editors.IndexEditorInput;
+import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
+import org.txm.lexicon.rcp.editors.DictionnaryEditor;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.rcpapplication.TXMWindows;
+import org.txm.rcpapplication.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.Corpus;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Compute a Lexicon used it to create a Index (object) then open it in the
+ * DictionnaryEditor
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ComputeLexicon extends BaseAbstractHandler {
+
+	
+	
+	// adds a double click listener to the Corpus View
+	static	{
+		CorporaView.addDoubleClickListener(Lexicon.class, ComputeLexicon.class);
+	}
+
+	
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+		if(!this.checkCorpusEngine()) {
+			return false;
+		}
+		
+		Object selection = this.getSelection();
+		IndexEditorInput editorInput = null;
+		
+		
+		// New lexicon from corpus
+		if(selection instanceof Corpus)	{
+			editorInput = new IndexEditorInput((Corpus) selection);
+		}
+		// Reopens an existing lexicon
+		else if(selection instanceof Lexicon)	{
+			Lexicon lex = (Lexicon) selection;
+			Index index = new Index(lex.getCorpus(), lex.getProperty());
+			editorInput = new IndexEditorInput(index);
+		}
+		
+		try {
+			IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
+			DictionnaryEditor editor = (DictionnaryEditor) page.openEditor(editorInput, "LexiconEditor"); //$NON-NLS-1$
+			
+			// compute
+			if(selection instanceof Corpus)	{
+				//FIXME: to hide the created index, but the problem is when user deletes the Lexicon node, the Index is not deleted, discuss about this
+				//Actually I do not understand well the link between Lexicon and Index classes.
+				//FIXME 2: now the Index is a child of the Lexicon so we can hide it if we want and it will be deleted when the Lexicon will be deleted
+				editor.compute(false);
+				//editor.compute();
+				// editor.initializeFields();
+			}
+			
+		}
+		catch (Exception e) {
+			org.txm.rcpapplication.utils.Logger.printStackTrace(e);
+		} 
+
+		
+		return null;
+	}
+	
+
+}

Property changes on: tmp/org.txm.lexicon.rcp/src/org/txm/lexicon/rcp/handlers/ComputeLexicon.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/build.properties
===================================================================
--- tmp/org.txm.lexicon.rcp/build.properties	(revision 0)
+++ tmp/org.txm.lexicon.rcp/build.properties	(revision 299)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml

Property changes on: tmp/org.txm.lexicon.rcp/build.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle.properties	(revision 299)
@@ -0,0 +1,6 @@
+
+command.name = Lexicon
+
+command.tooltip = Process the full lexicon
+
+editor.name = Lexicon

Property changes on: tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle_ru.properties
===================================================================
--- tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 0)
+++ tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 299)
@@ -0,0 +1,6 @@
+
+command.name = Словарь
+
+command.tooltip = Вычислить полный словарный состав
+
+editor.name = Словарь

Property changes on: tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle_ru.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 0)
+++ tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 299)
@@ -0,0 +1,6 @@
+
+command.name = Lexique
+
+command.tooltip = Calculer le lexique complet
+
+editor.name = Lexique

Property changes on: tmp/org.txm.lexicon.rcp/OSGI-INF/l10n/bundle_fr.properties
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.lexicon.rcp/icons/lexicon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tmp/org.txm.lexicon.rcp/icons/lexicon.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

