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

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

Index: tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle.properties	(revision 363)
@@ -0,0 +1,10 @@
+
+command.name = Concordances
+
+command.name.37 = Delete line
+
+command.tooltip = Concordances
+
+editor.name = Concordances
+
+page.name = Concordances

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

Index: tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle_ru.properties
===================================================================
--- tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 0)
+++ tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle_ru.properties	(revision 363)
@@ -0,0 +1,10 @@
+
+command.name = Конкордансы
+
+command.name.37 = Удалить строку
+
+command.tooltip = Конкордансы
+
+editor.name = Конкордансы
+
+page.name = Конкордансы

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

Index: tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 0)
+++ tmp/org.txm.concordance.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 363)
@@ -0,0 +1,10 @@
+
+command.name = Concordances
+
+command.name.37 = Supprimer la ligne
+
+command.tooltip = Concordances
+
+editor.name = Concordances
+
+page.name = Concordances

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

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

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

Index: tmp/org.txm.concordance.rcp/plugin.xml
===================================================================
--- tmp/org.txm.concordance.rcp/plugin.xml	(revision 0)
+++ tmp/org.txm.concordance.rcp/plugin.xml	(revision 363)
@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.core.runtime.adapters">
+      <factory
+            adaptableType="org.txm.concordance.core.functions.Concordance"
+            class="org.txm.concordance.rcp.adapters.ConcordanceAdapterFactory">
+         <adapter
+               type="org.eclipse.ui.model.IWorkbenchAdapter">
+         </adapter>
+      </factory>
+   </extension>
+   <extension
+         point="org.eclipse.core.expressions.definitions">
+      <definition
+            id="OneConcordanceSelected">
+         <with
+               variable="selection">
+            <iterate
+                  ifEmpty="false"
+                  operator="and">
+               <instanceof
+                     value="org.txm.concordance.core.functions.Concordance">
+               </instanceof>
+            </iterate>
+         </with>
+      </definition>
+   </extension>
+   <extension
+         point="org.eclipse.ui.menus">
+      <menuContribution
+            allPopups="false"
+            locationURI="popup:org.txm.rcp.views.CorporaView">
+         <command
+               commandId="ComputeConcordance"
+               icon="icons/concordance.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            locationURI="menu:menu.tools">
+         <command
+               commandId="ComputeConcordance"
+               icon="icons/concordance.png"
+               style="push">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            allPopups="false"
+            locationURI="toolbar:org.txm.rcp.toolbartools">
+         <command
+               commandId="ComputeConcordance"
+               icon="icons/concordance.png"
+               style="push"
+               tooltip="%command.tooltip">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            locationURI="popup:org.txm.rcp.editors.ConcordancesEditor">
+         <command
+               commandId="DeleteConcordanceLines"
+               style="push">
+         </command>
+      </menuContribution>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            categoryId="org.txm.rcp.category.txm"
+            defaultHandler="org.txm.concordance.rcp.handlers.ComputeConcordance"
+            id="ComputeConcordance"
+            name="%command.name">
+      </command>
+      <command
+            defaultHandler="org.txm.concordance.rcp.handlers.DeleteLines"
+            id="DeleteConcordanceLines"
+            name="%command.name.37">
+      </command>
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            category="org.txm.rcp.preferences.UserPreferencePage"
+            class="org.txm.concordance.rcp.preferences.ConcordancePreferencePage"
+            id="ConcordancePreferencePage"
+            name="%page.name">
+      </page>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            class="org.txm.concordance.rcp.editors.ConcordanceEditor"
+            default="false"
+            icon="icons/concordance.png"
+            id="ConcordanceEditor"
+            name="%editor.name">
+      </editor>
+   </extension>
+
+</plugin>

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

Index: tmp/org.txm.concordance.rcp/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- tmp/org.txm.concordance.rcp/.settings/org.eclipse.jdt.core.prefs	(revision 0)
+++ tmp/org.txm.concordance.rcp/.settings/org.eclipse.jdt.core.prefs	(revision 363)
@@ -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.concordance.rcp/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/.classpath
===================================================================
--- tmp/org.txm.concordance.rcp/.classpath	(revision 0)
+++ tmp/org.txm.concordance.rcp/.classpath	(revision 363)
@@ -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.concordance.rcp/.classpath
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.concordance.rcp/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.concordance.rcp/META-INF/MANIFEST.MF	(revision 363)
@@ -0,0 +1,18 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Concordances RCP
+Bundle-SymbolicName: org.txm.concordance.rcp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Textometrie.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.txm.concordance.core,
+ org.txm.rcp,
+ 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",
+ org.txm.core
+Export-Package: org.txm.concordance.rcp.adapters,
+ org.txm.concordance.rcp.editors,
+ org.txm.concordance.rcp.handlers,
+ org.txm.concordance.rcp.preferences,
+ org.txm.concordance.rcp.widgets

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

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/widgets/ComplexSortSelector.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/widgets/ComplexSortSelector.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/widgets/ComplexSortSelector.java	(revision 363)
@@ -0,0 +1,233 @@
+// 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.concordance.rcp.widgets;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.txm.concordance.core.functions.comparators.CompositeComparator;
+import org.txm.concordance.core.functions.comparators.LineComparator;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.Messages;
+// TODO: Auto-generated Javadoc
+/**
+ * allow to build a Composite sorter of 1 to 4 keys @ author mdecorde.
+ */
+public class ComplexSortSelector extends Composite {
+
+	/** The standard comparators. */
+	HashMap<String, LineComparator> standardComparators = new HashMap<String, LineComparator>();
+	
+	/** The comparators names. */
+	List<String> comparatorsNames;
+
+	/** The editor. */
+	ConcordanceEditor editor;
+	
+	/** The default comparator. */
+	CompositeComparator defaultComparator;
+
+	/** The first key. */
+	Combo firstKey;
+	
+	/** The second key. */
+	Combo secondKey;
+	
+	/** The third key. */
+	Combo thirdKey;
+	
+	/** The fourth key. */
+	Combo fourthKey;
+
+	/**
+	 * Instantiates a new complex sort selector.
+	 *
+	 * @param parent the parent
+	 * @param style the style
+	 */
+	public ComplexSortSelector(Composite parent, int style) {
+		super(parent, style);
+		GridLayout gl = new GridLayout(10, false);
+		gl.marginWidth = 0;
+		gl.marginLeft = 0;
+		gl.marginRight = 0;
+		this.setLayout(gl);
+
+		SelectionListener listener = new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				updateDefaultComparator();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		};
+		new Label(this, SWT.NONE).setText(Messages.ComplexSortSelector_0);
+		new Label(this, SWT.NONE).setText("#1"); //$NON-NLS-1$
+		firstKey = new Combo(this, SWT.NONE | SWT.READ_ONLY);
+		//firstKey.addSelectionListener(listener);
+		GridData griddata = new GridData(GridData.FILL, GridData.FILL, false,
+				true);
+		griddata.widthHint = 100;
+		firstKey.setLayoutData(griddata);
+
+		new Label(this, SWT.NONE).setText("#2"); //$NON-NLS-1$
+		secondKey = new Combo(this, SWT.NONE | SWT.READ_ONLY);
+		//secondKey.addSelectionListener(listener);
+		secondKey.setLayoutData(griddata);
+
+		new Label(this, SWT.NONE).setText("#3"); //$NON-NLS-1$
+		thirdKey = new Combo(this, SWT.NONE | SWT.READ_ONLY);
+		//thirdKey.addSelectionListener(listener);
+		thirdKey.setLayoutData(griddata);
+
+		new Label(this, SWT.NONE).setText("#4"); //$NON-NLS-1$
+		fourthKey = new Combo(this, SWT.NONE | SWT.READ_ONLY);
+		//fourthKey.addSelectionListener(listener);
+		fourthKey.setLayoutData(griddata);
+		
+		Button sortButton = new Button(this, SWT.PUSH);
+		sortButton.setText(Messages.ComplexSortSelector_2);
+		sortButton.addSelectionListener(listener);
+		
+	}
+
+	/**
+	 * Update default comparator.
+	 */
+	public void updateDefaultComparator() {
+		try {
+			ArrayList<LineComparator> comp = new ArrayList<LineComparator>();
+			comp.add(standardComparators.get(firstKey.getText()));
+			comp.add(standardComparators.get(secondKey.getText()));
+			comp.add(standardComparators.get(thirdKey.getText()));
+			comp.add(standardComparators.get(fourthKey.getText()));
+			defaultComparator.setComparators(comp);
+			System.out.println(Messages.ComplexSortSelector_1+comp);
+			editor.resetSortedColumn(firstKey.getSelectionIndex());
+			editor.setCurrentComparator(defaultComparator);
+			editor.sort();
+		} catch (Exception e) {
+			System.err.println(NLS.bind(Messages.ComplexSortSelector_5, e));
+			org.txm.rcp.utils.Logger.printStackTrace(e);
+		}
+	}
+	
+	/**
+	 * Sets the key.
+	 *
+	 * @param no the new key
+	 */
+	public void setKey(int no)
+	{
+		firstKey.select(no);
+		secondKey.select(0);
+		thirdKey.select(0);
+		fourthKey.select(0);
+		
+	}
+
+	/**
+	 * Sets the comparators.
+	 *
+	 * @param editor the new comparators
+	 */
+	public void setComparators(ConcordanceEditor editor) {
+		this.editor = editor;
+
+		List<LineComparator> standardComparatorslist = editor
+				.getStandardComparators();
+		comparatorsNames = new ArrayList<String>(standardComparatorslist.size());
+		String[] tcomparatorsNames = new String[standardComparatorslist.size()];
+		for (int i = 0; i < standardComparatorslist.size(); i++) {
+			LineComparator comparator = standardComparatorslist.get(i);
+			comparatorsNames.add(comparator.getName());
+			tcomparatorsNames[i] = comparator.getName();
+			this.standardComparators.put(comparator.getName(), comparator);
+		}
+
+		firstKey.setItems(tcomparatorsNames);
+		secondKey.setItems(tcomparatorsNames);
+		thirdKey.setItems(tcomparatorsNames);
+		fourthKey.setItems(tcomparatorsNames);
+
+		List<LineComparator> userDefinedComparators = editor
+				.getUserDefinedComparators();
+		for (LineComparator c : userDefinedComparators) {
+			if (c.getName().equals(Messages.ComplexSortSelector_6)) {
+				defaultComparator = (CompositeComparator) c;
+				List<LineComparator> comp = defaultComparator.getComparators();
+				if (comp.size() >= 4) {
+					firstKey.select(comparatorsNames.indexOf(comp.get(0)));
+					secondKey.select(comparatorsNames.indexOf(comp.get(1)));
+					thirdKey.select(comparatorsNames.indexOf(comp.get(2)));
+					fourthKey.select(comparatorsNames.indexOf(comp.get(3)));
+				} else if (comp.size() >= 3) {
+					firstKey.select(comparatorsNames.indexOf(comp.get(0)));
+					secondKey.select(comparatorsNames.indexOf(comp.get(1)));
+					thirdKey.select(comparatorsNames.indexOf(comp.get(2)));
+					fourthKey.select(comparatorsNames.indexOf(comp.get(2)));
+				} else if (comp.size() == 2) {
+					firstKey.select(comparatorsNames.indexOf(comp.get(0)));
+					secondKey.select(comparatorsNames.indexOf(comp.get(1)));
+					thirdKey.select(comparatorsNames.indexOf(comp.get(1)));
+					fourthKey.select(comparatorsNames.indexOf(comp.get(1)));
+				} else if (comp.size() == 1) {
+					firstKey.select(comparatorsNames.indexOf(comp.get(0)));
+					secondKey.select(comparatorsNames.indexOf(comp.get(0)));
+					thirdKey.select(comparatorsNames.indexOf(comp.get(0)));
+					fourthKey.select(comparatorsNames.indexOf(comp.get(0)));
+				}
+				return;
+			}
+		}
+
+		// no default comparator found -> create one
+		defaultComparator = new CompositeComparator(
+				Messages.ComplexSortSelector_6, standardComparatorslist);
+		firstKey.select(0);
+		secondKey.select(0);
+		thirdKey.select(0);
+		fourthKey.select(0);
+		editor.getUserDefinedComparators().add(defaultComparator);
+		editor.setCurrentComparator(defaultComparator);
+		editor.sort();
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/widgets/ComplexSortSelector.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/package.html
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/package.html	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/package.html	(revision 363)
@@ -0,0 +1,5 @@
+<html>
+<body>
+	<p>concordances editors</p>
+</body>
+</html>
\ No newline at end of file

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/package.html
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/OpenFileDialog.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/OpenFileDialog.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/OpenFileDialog.java	(revision 363)
@@ -0,0 +1,101 @@
+package org.txm.concordance.rcp.editors;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+public class OpenFileDialog {
+
+  Display d;
+
+  Shell s;
+
+  OpenFileDialog() {
+    d = new Display();
+    s = new Shell(d);
+    s.setSize(400, 400);
+    
+    s.setText("A MessageBox Example");
+    //         create the menu system
+    Menu m = new Menu(s, SWT.BAR);
+    // create a file menu and add an exit item
+    final MenuItem file = new MenuItem(m, SWT.CASCADE);
+    file.setText("&File");
+    final Menu filemenu = new Menu(s, SWT.DROP_DOWN);
+    file.setMenu(filemenu);
+    final MenuItem openItem = new MenuItem(filemenu, SWT.PUSH);
+    openItem.setText("&Open\tCTRL+O");
+    openItem.setAccelerator(SWT.CTRL + 'O');
+    final MenuItem saveItem = new MenuItem(filemenu, SWT.PUSH);
+    saveItem.setText("&Save\tCTRL+S");
+    saveItem.setAccelerator(SWT.CTRL + 'S');
+    final MenuItem separator = new MenuItem(filemenu, SWT.SEPARATOR);
+    final MenuItem exitItem = new MenuItem(filemenu, SWT.PUSH);
+    exitItem.setText("E&xit");
+
+    class Open implements SelectionListener {
+      public void widgetSelected(SelectionEvent event) {
+        FileDialog fd = new FileDialog(s, SWT.OPEN);
+        fd.setText("Open");
+        fd.setFilterPath("C:/");
+        String[] filterExt = { "*.txt", "*.doc", ".rtf", "*.*" };
+        fd.setFilterExtensions(filterExt);
+        String selected = fd.open();
+        System.out.println(selected);
+      }
+
+      public void widgetDefaultSelected(SelectionEvent event) {
+      }
+    }
+
+    class Save implements SelectionListener {
+      public void widgetSelected(SelectionEvent event) {
+        FileDialog fd = new FileDialog(s, SWT.SAVE);
+        fd.setText("Save");
+        fd.setFilterPath("C:/");
+        String[] filterExt = { "*.txt", "*.doc", ".rtf", "*.*" };
+        fd.setFilterExtensions(filterExt);
+        String selected = fd.open();
+        System.out.println(selected);
+      }
+
+      public void widgetDefaultSelected(SelectionEvent event) {
+      }
+    }
+    openItem.addSelectionListener(new Open());
+    saveItem.addSelectionListener(new Save());
+
+    exitItem.addSelectionListener(new SelectionAdapter() {
+      public void widgetSelected(SelectionEvent e) {
+        MessageBox messageBox = new MessageBox(s, SWT.ICON_QUESTION
+            | SWT.YES | SWT.NO);
+        messageBox.setMessage("Do you really want to exit?");
+        messageBox.setText("Exiting Application");
+        int response = messageBox.open();
+        if (response == SWT.YES)
+          System.exit(0);
+      }
+    });
+    s.setMenuBar(m);
+    s.open();
+
+    while (!s.isDisposed()) {
+      if (!d.readAndDispatch())
+        d.sleep();
+    }
+    d.dispose();
+  }
+
+  public static void main(String[] argv) {
+    new OpenFileDialog();
+  }
+
+}
\ No newline at end of file

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/LineLabelProvider.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/LineLabelProvider.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/LineLabelProvider.java	(revision 363)
@@ -0,0 +1,137 @@
+// 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.concordance.rcp.editors;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.txm.annotation.Annotation;
+import org.txm.concordance.core.functions.Line;
+import org.txm.rcp.Messages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * provides the labels of the columns of the concordance table 
+ * 
+ * @author mdecorde.
+ */
+public class LineLabelProvider implements ITableLabelProvider {
+
+	private ConcordanceEditor editor;
+
+	public LineLabelProvider(ConcordanceEditor editor) {
+		this.editor = editor;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+	 */
+	@Override
+	public Image getColumnImage(Object element, int columnIndex) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+	 */
+	@Override
+	public String getColumnText(Object element, int columnIndex) {
+		Line line = (Line) element;
+
+		switch (columnIndex) {
+		case 0:
+		case 6:
+			return ""; //this is the fake column used to work around the fact that MS windows refuses to right align the 1st column  //$NON-NLS-1$
+		case 1:
+			return line.getViewRef().toString();
+		case 2:
+			return line.leftContextToString();
+		case 3:
+			return line.keywordToString();
+		case 4:
+			if (line.getAnnotation()!=null) {
+				String value = line.getAnnotationValue().getStandardName();
+				Annotation a = line.getAnnotation();
+				if (value == null) value = a.getValue();
+								
+				if (a.getStart() < line.matchGetStart() - line.getLeftContextSize()) {
+					value = "… "+value;
+				}
+				
+				if (a.getEnd() > line.matchGetEnd() + line.getRightContextSize()) {
+					value = value+" …";
+				} 
+				return value;
+			} else {
+				return "";
+			}
+		case 5:
+			return line.rightContextToString();
+		default:
+			throw new RuntimeException(Messages.LineLabelProvider_1);
+		}
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+	 */
+	@Override
+	public void addListener(ILabelProviderListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
+	 */
+	@Override
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+	 */
+	@Override
+	public boolean isLabelProperty(Object element, String property) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+	 */
+	@Override
+	public void removeListener(ILabelProviderListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/SortPropertySelectionDialog.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/SortPropertySelectionDialog.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/SortPropertySelectionDialog.java	(revision 363)
@@ -0,0 +1,313 @@
+// 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.concordance.rcp.editors;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.txm.rcp.Messages;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+
+// TODO: Auto-generated Javadoc
+/**
+ * the dialog box called to select the view properties @ author mdecorde.
+ */
+public class SortPropertySelectionDialog extends Dialog {
+
+	/** The available properties. */
+	final private List<Property> availableProperties;
+	
+	/** The selected properties. */
+	final private List<Property> selectedProperties;
+	
+	/** The maxprops. */
+	int maxprops = -1;
+
+	/** The available properties view. */
+	org.eclipse.swt.widgets.List availablePropertiesSort;
+	
+	/** The selected properties view. */
+	org.eclipse.swt.widgets.List selectedPropertiesSort;
+
+	/**
+	 * Instantiates a new view property selection dialog.
+	 *
+	 * @param parentShell the parent shell
+	 * @param availableProperties the available properties
+	 * @param selectedProperties the selected properties
+	 */
+	public SortPropertySelectionDialog(IShellProvider parentShell,
+			List<Property> availableProperties,
+			List<Property> selectedProperties) {
+		super(parentShell);
+
+		this.availableProperties = availableProperties;
+		this.selectedProperties = selectedProperties;
+		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
+	}
+
+	/**
+	 * Instantiates a new view property selection dialog.
+	 *
+	 * @param shell the shell
+	 * @param availableProperties the available properties
+	 * @param selectedProperties the selected properties
+	 */
+	public SortPropertySelectionDialog(Shell shell,
+			List<Property> availableProperties,
+			List<Property> selectedProperties) {
+		super(shell);
+
+		this.availableProperties = availableProperties;
+		this.selectedProperties = selectedProperties;
+		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
+	}
+
+	/**
+	 * Instantiates a new view property selection dialog.
+	 *
+	 * @param shell the shell
+	 * @param availableProperties the available properties
+	 * @param selectedProperties the selected properties
+	 * @param maxprops the maxprops
+	 */
+	public SortPropertySelectionDialog(Shell shell,
+			List<Property> availableProperties,
+			List<Property> selectedProperties, int maxprops) {
+		super(shell);
+
+		this.availableProperties = availableProperties;
+		this.selectedProperties = selectedProperties;
+		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
+		this.maxprops = maxprops;
+	}
+
+	/**
+	 * Gets the selected properties.
+	 *
+	 * @return the selected properties
+	 */
+	public List<Property> getSelectedProperties() {
+		return selectedProperties;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+	 */
+	@Override
+	protected void configureShell(Shell newShell) {
+		super.configureShell(newShell);
+		newShell.setText(Messages.SortPropertySelection_0);
+		newShell.setMinimumSize(300, 200);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		// parent.setLayout(new FormLayout());
+		Composite mainArea = new Composite(parent, SWT.NONE);
+		mainArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+		// 4 columns
+		GridLayout layout = new GridLayout(4, false);
+		mainArea.setLayout(layout);
+
+		availablePropertiesSort = new org.eclipse.swt.widgets.List(mainArea,
+				SWT.BORDER | SWT.V_SCROLL);
+		GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+		availablePropertiesSort.setLayoutData(gridData);
+
+		Composite selectionButtons = new Composite(mainArea, SWT.NONE);
+		selectionButtons.setLayout(new GridLayout(1, false));
+		Button select = new Button(selectionButtons, SWT.ARROW | SWT.RIGHT);
+		Button unselect = new Button(selectionButtons, SWT.ARROW | SWT.LEFT);
+
+		selectedPropertiesSort = new org.eclipse.swt.widgets.List(mainArea,
+				SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+		gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+		selectedPropertiesSort.setLayoutData(gridData);
+
+		Composite orderButtons = new Composite(mainArea, SWT.NONE);
+		orderButtons.setLayout(new GridLayout(1, false));
+		Button up = new Button(orderButtons, SWT.ARROW | SWT.UP);
+		Button down = new Button(orderButtons, SWT.ARROW | SWT.DOWN);
+
+		select.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int index = availablePropertiesSort.getSelectionIndex();
+				if (maxprops == 1) {
+					selectedProperties.add(availableProperties.get(index));
+					availableProperties.remove(index);
+
+					availableProperties.add(selectedProperties.get(0));
+					selectedProperties.remove(0);
+				} else {
+					if (maxprops > 0) {
+						if (selectedProperties.size() >= maxprops)
+							return;
+					}
+
+					selectedProperties.add(availableProperties.get(index));
+					availableProperties.remove(index);
+				}
+				reload();
+				availablePropertiesSort.setSelection(index);
+			}
+		});
+
+		unselect.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (maxprops == 1 || selectedProperties.size() > 1) {
+					int index = selectedPropertiesSort.getSelectionIndex();
+
+					availableProperties.add(selectedProperties.get(index));
+					selectedProperties.remove(index);
+
+					reload();
+					selectedPropertiesSort.setSelection(index);
+				}
+			}
+		});
+
+		up.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int index = selectedPropertiesSort.getSelectionIndex();
+				if (index > 0) {
+					Property selectedP = selectedProperties.get(index);
+					Property upperP = selectedProperties.get(index - 1);
+
+					selectedProperties.set(index, upperP);
+					selectedProperties.set(index - 1, selectedP);
+
+					reload();
+					selectedPropertiesSort.setSelection(index - 1);
+				}
+			}
+		});
+
+		down.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int index = selectedPropertiesSort.getSelectionIndex();
+				if (index < selectedProperties.size() - 1) {
+					Property selectedP = selectedProperties.get(index);
+					Property bellowP = selectedProperties.get(index + 1);
+
+					selectedProperties.set(index, bellowP);
+					selectedProperties.set(index + 1, selectedP);
+
+					reload();
+					selectedPropertiesSort.setSelection(index + 1);
+				}
+			}
+		});
+
+		availablePropertiesSort.addMouseListener(new MouseAdapter() {
+			@Override
+			public void mouseDoubleClick(MouseEvent e) {
+				int index = availablePropertiesSort.getSelectionIndex();
+
+				selectedProperties.add(availableProperties.get(index));
+				availableProperties.remove(index);
+
+				reload();
+				availablePropertiesSort.setSelection(index);
+			}
+		});
+
+		selectedPropertiesSort.addMouseListener(new MouseAdapter() {
+			@Override
+			public void mouseDoubleClick(MouseEvent e) {
+				if (selectedProperties.size() > 1) {
+					int index = selectedPropertiesSort.getSelectionIndex();
+
+					availableProperties.add(selectedProperties.get(index));
+					selectedProperties.remove(index);
+
+					reload();
+					selectedPropertiesSort.setSelection(index);
+				}
+			}
+		});
+
+		reload();
+		return mainArea;
+	}
+
+	/**
+	 * Reload.
+	 */
+	public void reload() {
+		availablePropertiesSort.removeAll();
+		for (Property property : availableProperties) {
+			//if (!property.getName().equals("id")) //$NON-NLS-1$
+			if (property instanceof StructuralUnitProperty)
+				availablePropertiesSort.add(((StructuralUnitProperty)property).getFullName());
+			else
+				availablePropertiesSort.add(property.getName());
+		}
+		selectedPropertiesSort.removeAll();
+		for (Property property : selectedProperties) {
+			//if (!property.getName().equals("id")) //$NON-NLS-1$
+			if (property instanceof StructuralUnitProperty)
+				selectedPropertiesSort.add(((StructuralUnitProperty)property).getFullName());
+			else
+				selectedPropertiesSort.add(property.getName());
+		}
+
+		availablePropertiesSort.getParent().layout();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		if (selectedProperties.size() != 0)
+			super.okPressed();
+	}
+
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordancesEditorContributor.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordancesEditorContributor.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordancesEditorContributor.java	(revision 363)
@@ -0,0 +1,64 @@
+// 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.concordance.rcp.editors;
+
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.part.EditorActionBarContributor;
+import org.txm.rcp.Messages;
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ConcordancesEditorContributor.
+ */
+public class ConcordancesEditorContributor extends EditorActionBarContributor {
+
+	/**
+	 * Instantiates a new concordances editor contributor.
+	 */
+	public ConcordancesEditorContributor() {
+		// TODO Auto-generated constructor stub
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
+	 */
+	@Override
+	public void contributeToMenu(IMenuManager menuManager) {
+		super.contributeToMenu(menuManager);
+		// IMenuManager fileMenu = (IMenuManager)
+		// menubar.find(IWorkbenchActionConstants.M_FILE);
+		MenuManager viewMenu = new MenuManager(
+				Messages.ConcordancesEditorContributor_0);
+
+		viewMenu.add(new Separator());
+
+		menuManager.add(viewMenu);
+
+	}
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ErrorAnnotationDialog.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ErrorAnnotationDialog.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ErrorAnnotationDialog.java	(revision 363)
@@ -0,0 +1,54 @@
+package org.txm.concordance.rcp.editors;
+
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPartSite;
+
+public class ErrorAnnotationDialog extends Dialog {
+
+	
+  public ErrorAnnotationDialog(IWorkbenchPartSite iWorkbenchPartSite, List<int[]> matchesNotAnnotated) {
+    super(iWorkbenchPartSite);
+  }
+
+  @Override
+  protected Control createDialogArea(Composite parent) {
+    Composite container = (Composite) super.createDialogArea(parent);
+    Button button = new Button(container, SWT.PUSH);
+    button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false,
+        false));
+    button.setText("Press me");
+    button.addSelectionListener(new SelectionAdapter() {
+      @Override
+      public void widgetSelected(SelectionEvent e) {
+        System.out.println("Pressed");
+      }
+    });
+
+    return container;
+  }
+
+  // overriding this methods allows you to set the
+  // title of the custom dialog
+  @Override
+  protected void configureShell(Shell newShell) {
+    super.configureShell(newShell);
+    newShell.setText("Selection dialog");
+  }
+
+  @Override
+  protected Point getInitialSize() {
+    return new Point(450, 300);
+  }
+
+} 

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 363)
@@ -0,0 +1,2949 @@
+// 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.concordance.rcp.editors;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import java.util.logging.Level;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.browser.ProgressListener;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.ListDialog;
+import org.eclipse.ui.part.EditorPart;
+import org.txm.Toolbox;
+import org.txm.annotation.Annotation;
+import org.txm.annotation.AnnotationManager;
+import org.txm.annotation.repository.AnnotationType;
+import org.txm.annotation.repository.KnowledgeRepository;
+import org.txm.annotation.repository.KnowledgeRepositoryManager;
+import org.txm.annotation.repository.LocalKnowledgeRepository;
+import org.txm.annotation.repository.SQLKnowledgeRepository;
+import org.txm.annotation.repository.TypedValue;
+import org.txm.concordance.core.functions.Concordance;
+import org.txm.concordance.core.functions.Line;
+import org.txm.concordance.core.functions.comparators.CompositeComparator;
+import org.txm.concordance.core.functions.comparators.LexicographicKeywordComparator;
+import org.txm.concordance.core.functions.comparators.LexicographicLeftContextComparator;
+import org.txm.concordance.core.functions.comparators.LexicographicRightContextComparator;
+import org.txm.concordance.core.functions.comparators.LineComparator;
+import org.txm.concordance.core.functions.comparators.NullComparator;
+import org.txm.concordance.core.functions.comparators.PropertiesReferenceComparator;
+import org.txm.concordance.core.functions.comparators.ReverseComparator;
+import org.txm.concordance.core.preferences.ConcordancePreferences;
+import org.txm.concordance.rcp.actions.DefineSortReferencePattern;
+import org.txm.concordance.rcp.actions.DefineViewReferencePattern;
+import org.txm.concordance.rcp.actions.SetContextSize;
+import org.txm.concordance.rcp.actions.SetLineNumber;
+import org.txm.concordance.rcp.actions.SortPropertySelection;
+import org.txm.concordance.rcp.actions.ViewPropertySelection;
+import org.txm.concordance.rcp.handlers.BackToTextCommand;
+import org.txm.concordance.rcp.handlers.DeleteLines;
+import org.txm.concordance.rcp.widgets.ComplexSortSelector;
+import org.txm.cooccurrence.rcp.messages.CooccurrenceUIMessages;
+import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.functions.ReferencePattern;
+import org.txm.objects.Page;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.Messages;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.TXMWindows;
+import org.txm.rcp.commands.OpenBrowser;
+import org.txm.rcp.commands.annotation.InitializeKnowledgeRepository;
+import org.txm.rcp.commands.annotation.SaveAnnotations;
+import org.txm.rcp.commands.editor.CustomizableEditor;
+import org.txm.rcp.commands.krview.OpenKRView;
+import org.txm.rcp.editors.TXMBrowser;
+import org.txm.rcp.editors.TableKeyListener;
+import org.txm.rcp.editors.input.InternalViewEditorInput;
+import org.txm.rcp.editors.internal.InternalViewEditor;
+import org.txm.rcp.preferences.RCPPreferences;
+import org.txm.rcp.swt.dialog.ConfirmDialog;
+import org.txm.rcp.swt.dialog.ViewPropertySelectionDialog;
+import org.txm.rcp.swt.provider.SimpleLabelProvider;
+import org.txm.rcp.swt.widget.AssistedQueryWidget;
+import org.txm.rcp.swt.widget.NavigationWidget;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.utils.SWTEditorsUtils;
+import org.txm.rcp.views.QueriesView;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.rcp.views.knowledgerepositories.KRView;
+import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.utils.AsciiUtils;
+import org.txm.utils.logger.Log;
+// TODO: Auto-generated Javadoc
+/**
+ * display the concordances parameters and results in the same editor
+ * 
+ * @author mdecorde.
+ */
+public class ConcordanceEditor extends EditorPart implements CustomizableEditor {
+
+	/**
+	 * the limit number of annotation when a confirm dialog box is shown
+	 */
+	private static final int NALERTAFFECTANNOTATIONS = 100;
+
+	String locale = TXMPreferences.getString(RCPPreferences.PREFERENCES_NODE, RCPPreferences.UI_LOCALE, "en");
+	
+	/** The lineids. */
+	List<String> lineids;
+
+	/** The standard comparators. */
+	private List<LineComparator> standardComparators;
+
+	/** The user defined comparators. */
+	private List<LineComparator> userDefinedComparators;
+
+	/** The complexsorter. */
+	ComplexSortSelector complexsorter;
+	org.eclipse.swt.widgets.Text cqlSeparator;
+
+	/** The available view keyword properties. */
+	private List<Property> availableKeywordViewProperties;
+	/** The available view left properties. */
+	private List<Property> availableLeftViewProperties;
+	/** The available view right properties. */
+	private List<Property> availableRightViewProperties;
+
+	/** The selected left view properties. */
+	private List<Property> selectedLeftViewProperties;
+	/** The selected right view properties. */
+	private List<Property> selectedRightViewProperties;
+	/** The selected keyword view properties. */
+	private List<Property> selectedKeywordViewProperties;
+
+	/** The available sort properties. */
+	private List<Property> availableKeywordSortProperties;
+
+	/** The selected keyword sort property. */
+	private List<Property> selectedKeywordSortProperties;
+	/** The selected left sort property. */
+	private List<Property> selectedLeftSortProperties;
+	/** The selected right sort property. */
+	private List<Property> selectedRightSortProperties;
+
+	/** The reference pattern. */
+	private ReferencePattern refViewPattern;
+	private ReferencePattern refSortPattern;
+
+	/** The concordance. */
+	private Concordance concordance;
+
+	/** The annotation service */
+	private AnnotationManager  annotManager;
+	
+	//boolean annotation_expert_mode = TxmPreferences.getBoolean(AnnotationPreferencePage.MODE, false);
+
+	/** The standard comparator class name. */
+	private LineComparator[] standardComparatorClassName = {
+			new NullComparator(), new LexicographicKeywordComparator(),
+			new LexicographicLeftContextComparator(),
+			new LexicographicRightContextComparator(),
+			new PropertiesReferenceComparator() };
+
+	/** The corpus. */
+	private Corpus corpus;
+
+	/** The n line per page. */
+	private int nLinePerPage;
+
+	/** The top line. */
+	private int topLine;
+
+	/** The bottom line. */
+	private int bottomLine;
+
+	/** The current comparator. */
+	protected LineComparator currentComparator;
+
+	/** The left context size. */
+	private int leftContextSize;
+
+	/** The right context size. */
+	private int rightContextSize;
+
+	/** The mouseposition. */
+	private Point mouseposition;
+
+	/** The query widget. */
+	private AssistedQueryWidget queryWidget;
+
+	/** The line table viewer. */
+	private TableViewer viewer;
+
+	/** The reference column. */
+	private TableColumn referenceColumn;
+
+	/** The first column. */
+	private TableColumn firstColumn; // due to a restriction on some platforms
+	// (actually, MS Windows), the first
+	// column is always left aligned. The
+	// work around is to have a 0 width
+	// first column
+	/** The left context column. */
+	private TableColumn leftContextColumn;
+	/** The keyword column. */
+	private TableColumn keywordColumn;
+	/** The right context column. */
+	private TableColumn rightContextColumn;
+
+	/** The view properties label. */
+	private Label viewPropertiesLabel;
+
+	/** The set sort property action. */
+	private Action setSortPropertyAction;
+
+	/** The set context size action. */
+	private Action setContextSizeAction;
+
+	/** The set line number action. */
+	private Action setLineNumberAction;
+
+	/** The define view reference pattern action. */
+	protected Action defineViewReferencePatternAction;
+
+	/** The define sort reference pattern action. */
+	protected Action defineSortReferencePatternAction;	
+
+	/** The set view property action. */
+	protected Action setViewPropertyAction;
+
+	/** The attached browser editor. */
+	protected TXMBrowser attachedBrowserEditor;
+
+	/** The progresslistener. */
+	protected ProgressListener progresslistener;
+
+	/** The textid. */
+	protected String textid;
+
+	/** The opened page. */
+	Page openedPage;
+
+	/** The query area. */
+	private Composite queryArea;
+
+	/** The annotation area. */
+	private Composite annotationArea;
+
+	/** The navigation area. */
+	private NavigationWidget navigationArea;
+
+	/** The is setup shown. */
+	private boolean isSetupShown = true;
+	
+
+	/** The hide btn. */
+	private Button hideBtn;
+	private Button deleteLineButton;
+
+	/** The query size. */
+	protected Point querySize;
+	
+	protected Point annotationSize;
+	
+	/** The annot btn. */
+	private Button annotationButton;
+
+	//	/** The selected typed value for new annotations **/
+	//	private TypedValue annotSelectedTypedValue;
+	//	private AnnotationType annotSelectedType;
+
+	private Text annotationValuesText;
+	private ComboViewer annotationTypesCombo;
+
+	/** The parent. */
+	private Composite parent;
+
+	private ArrayList<Property> availableLeftSortProperties;
+
+	private ArrayList<Property> availableRightSortProperties;
+
+	private List<TypedValue> typeValuesList;
+
+	protected Point annotSize;
+
+	private TableColumn annotationColumn;
+
+	//	private Button addAnnotationButton;
+	//	private Button deleteAnnotationButton;
+	private Combo addRemoveCombo;
+	private Combo affectCombo;
+	private Button affectAnnotationButton;
+	//	private Button affectAnnotationToSelectionButton;
+	//	private Button affectAnnotationToConcordanceButton;
+	//	private Button affectAnnotationToPageButton;
+
+	private Label aLabel;
+
+	private Button infosAnnotTypeSelectedLink;
+
+	//	private TableColumnLayout tableLayout;
+
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+	 */
+	@Override
+	public void doSave(IProgressMonitor monitor) {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+	 */
+	@Override
+	public void doSaveAs() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#isDirty()
+	 */
+	@Override
+	public boolean isDirty() {
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+	 */
+	@Override
+	public boolean isSaveAsAllowed() {
+		return false;
+	}
+
+	/**
+	 * Sets the standard comparators.
+	 */
+	private void setStandardComparators() {
+		for (int i = 0; i < standardComparatorClassName.length; i++)
+			standardComparators.add(standardComparatorClassName[i]);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
+	 */
+	@Override
+	public void init(IEditorSite site, IEditorInput input)
+			throws PartInitException {
+		setSite(site);
+		setInput(input);
+
+		initializeEditor();
+	}
+
+	private void initializeEditor() {
+		this.corpus = ((ConcordanceEditorInput) getEditorInput()).getCorpus();
+		this.annotManager = corpus.getAnnotationManager();
+
+		this.standardComparators = new ArrayList<LineComparator>();
+		this.userDefinedComparators = new ArrayList<LineComparator>();
+		new ArrayList<LineComparator>();
+		setStandardComparators();
+		this.nLinePerPage = TXMPreferences.getInt(ConcordancePreferences.PREFERENCES_NODE, ConcordancePreferences.N_LINE_PER_PAGE);
+		try {
+			this.availableKeywordViewProperties = new ArrayList<Property>(
+					corpus.getOrderedProperties());
+			this.availableLeftViewProperties = new ArrayList<Property>(corpus
+					.getOrderedProperties());
+			this.availableRightViewProperties = new ArrayList<Property>(corpus
+					.getOrderedProperties());
+			this.availableLeftSortProperties = new ArrayList<Property>(corpus
+					.getOrderedProperties());
+			this.availableKeywordSortProperties = new ArrayList<Property>(corpus
+					.getOrderedProperties());
+			this.availableRightSortProperties = new ArrayList<Property>(corpus
+					.getOrderedProperties());
+		} catch (CqiClientException e) {
+			//System.err.println(Messages.CorporaView_3+" : "+Log.toString(e)); //$NON-NLS-1$
+			try {
+				System.out.println(Messages.ConcordancesEditor_0+Toolbox.getCqiClient().getLastCQPError());
+				Log.severe(Messages.ConcordancesEditor_0+Toolbox.getCqiClient().getLastCQPError());
+			} catch (Exception e1) {
+				org.txm.rcp.utils.Logger.printStackTrace(e1);
+				Log.severe("Error while computing concordance: "+e.getLocalizedMessage());
+			} 
+			
+			return;
+		}
+
+		this.concordance = ((ConcordanceEditorInput) getEditorInput()).getConcordance();
+
+		if (this.concordance == null) {
+			leftContextSize = TXMPreferences.getInt(ConcordancePreferences.PREFERENCES_NODE, ConcordancePreferences.LEFT_CONTEXT_SIZE);
+			rightContextSize = TXMPreferences.getInt(ConcordancePreferences.PREFERENCES_NODE, ConcordancePreferences.RIGHT_CONTEXT_SIZE);
+
+			selectedLeftViewProperties = new ArrayList<Property>();
+			selectedRightViewProperties = new ArrayList<Property>();
+			selectedKeywordViewProperties = new ArrayList<Property>();
+
+			//set default view property
+			Property defaultViewProperty = availableKeywordViewProperties.get(0);
+			if(!defaultViewProperty.getName().equals("word")) //$NON-NLS-1$
+				for(int i = 0 ; i < availableKeywordViewProperties.size() ; i++ )
+					if (availableKeywordViewProperties.get(i).getName().equals("word")) //$NON-NLS-1$
+					{
+						defaultViewProperty = availableKeywordViewProperties.get(i);
+						break;
+					}
+
+			availableKeywordViewProperties.remove(defaultViewProperty);
+			availableLeftViewProperties.remove(defaultViewProperty);
+			availableRightViewProperties.remove(defaultViewProperty);
+			selectedLeftViewProperties.add(defaultViewProperty);
+			selectedRightViewProperties.add(defaultViewProperty);
+			selectedKeywordViewProperties.add(defaultViewProperty);
+
+			//set default sort property
+			selectedLeftSortProperties = new ArrayList<Property>();
+			selectedRightSortProperties = new ArrayList<Property>();
+			selectedKeywordSortProperties = new ArrayList<Property>();
+
+			Property defaultSortProperty = availableKeywordSortProperties.get(0);
+			if(!defaultSortProperty.getName().equals("word")) //$NON-NLS-1$
+				for(int i = 0 ; i < availableKeywordSortProperties.size() ; i++ )
+					if (availableKeywordSortProperties.get(i).getName().equals("word")) //$NON-NLS-1$
+					{
+						defaultSortProperty = availableKeywordSortProperties.get(i);
+						break;
+					}
+
+			availableKeywordSortProperties.remove(defaultSortProperty);
+			availableLeftSortProperties.remove(defaultSortProperty);
+			availableRightSortProperties.remove(defaultSortProperty);
+			selectedLeftSortProperties.add(defaultSortProperty);
+			selectedRightSortProperties.add(defaultSortProperty);
+			selectedKeywordSortProperties.add(defaultSortProperty);
+
+			this.refViewPattern = new ReferencePattern();
+			this.refSortPattern = new ReferencePattern();
+			try { // set the default reference is there is one
+				if (corpus.getProperty("ref") != null) //$NON-NLS-1$
+				{
+					refViewPattern.addProperty(corpus.getProperty("ref")); //$NON-NLS-1$
+					refSortPattern.addProperty(corpus.getProperty("ref")); //$NON-NLS-1$
+				} else {
+					if (corpus.getStructuralUnit("text") != null) //$NON-NLS-1$
+						if (corpus.getStructuralUnit("text").getProperty("id") != null) //$NON-NLS-1$ //$NON-NLS-2$
+						{
+							refViewPattern.addProperty(corpus.getStructuralUnit("text").getProperty("id")); //$NON-NLS-1$ //$NON-NLS-2$
+							refSortPattern.addProperty(corpus.getStructuralUnit("text").getProperty("id")); //$NON-NLS-1$ //$NON-NLS-2$
+						}
+				}
+			} catch (CqiClientException e) {
+				System.out.println(NLS.bind(Messages.ConcordancesEditor_43, corpus.getName(), e));
+			}
+		} else {
+			leftContextSize = concordance.getLeftContextSize();
+			rightContextSize = concordance.getRightContextSize();
+
+			selectedLeftViewProperties = concordance.getLeftViewProperties();
+			selectedRightViewProperties = concordance.getRightViewProperties();
+			selectedKeywordViewProperties = concordance.getKeywordViewProperties();
+			availableKeywordViewProperties.remove(selectedKeywordViewProperties);
+			availableLeftViewProperties.remove(selectedLeftViewProperties);
+			availableRightViewProperties.remove(selectedRightViewProperties);
+
+			selectedLeftSortProperties = concordance.getLeftAnalysisProperties();
+			selectedRightSortProperties = concordance.getRightAnalysisProperties();
+			selectedKeywordSortProperties = concordance.getKeywordAnalysisProperties();
+			availableKeywordSortProperties.remove(selectedKeywordSortProperties);
+			availableLeftSortProperties.remove(selectedLeftSortProperties);
+			availableRightSortProperties.remove(selectedRightSortProperties);
+
+			this.refViewPattern = concordance.getRefViewPattern();
+			this.refSortPattern = concordance.getRefAnalysePattern();
+		}
+
+
+
+		if (concordance != null)
+			setPartName(concordance.getName());
+		else
+			setPartName(corpus.getName());
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	public void createPartControl(Composite parent) {
+		this.parent = parent;
+		//		GridLayout layout = new GridLayout(1, false);
+		//		layout.horizontalSpacing = 0;
+		//		layout.verticalSpacing = 0;
+		//		parent.setLayout(layout);
+
+		parent.setLayout(new FormLayout());
+
+		Composite controlArea = new Composite(parent, SWT.NONE); // the form
+		FormData formdata1 = new FormData();
+		formdata1.top = new FormAttachment(0);
+		//formdata1.bottom = new FormAttachment(100);
+		formdata1.left = new FormAttachment(0);
+		formdata1.right = new FormAttachment(100);
+		controlArea.setLayoutData(formdata1);
+
+
+		Composite displayArea = new Composite(parent, SWT.NONE); // the lines
+		FormData formdata2 = new FormData();
+		formdata2.top = new FormAttachment(controlArea);
+		formdata2.bottom = new FormAttachment(100);
+		formdata2.left = new FormAttachment(0);
+		formdata2.right = new FormAttachment(100);
+		displayArea.setLayoutData(formdata2);
+
+		composeControlArea(controlArea);
+		composeDisplayArea(displayArea);
+
+		//if (concordance != null)
+		//	fillDisplayArea(0, nLinePerPage);
+	}
+
+	/**
+	 * Compose display area.
+	 *
+	 * @param displayArea the display area
+	 */
+	private void composeDisplayArea(final Composite displayArea) {
+		//		tableLayout = new TableColumnLayout();
+		displayArea.setLayout(new GridLayout(1, true));
+
+		viewer = new TableViewer(displayArea, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
+		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
+		viewer.setLabelProvider(new LineLabelProvider(this));
+		viewer.setContentProvider(new ConcordancesProvider());
+		viewer.getTable().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+		if (corpus != null && corpus.getFont() != null && corpus.getFont().length() > 0) {
+			Font old = viewer.getTable().getFont();
+			FontData fD = old.getFontData()[0];
+			Font font = new Font(Display.getCurrent(), corpus.getFont(), fD.getHeight(), fD.getStyle()); 
+			viewer.getTable().setFont(font);
+		}
+
+		viewer.getTable().addListener(SWT.Resize, new Listener() {
+			@Override
+			public void handleEvent(Event event) {
+				ScrollBar bar = viewer.getTable().getHorizontalBar();
+				float l=leftContextColumn.getWidth();
+				float k=keywordColumn.getWidth();
+				float r=rightContextColumn.getWidth();
+				float t=viewer.getTable().getClientArea().width;//the width of the visible part of the table; l+k+r>=t
+				float x=l+k/2-t/2; //the abcisse the visible rectangle must have for the keyword column to be centered
+				float M=bar.getMaximum();
+				float T=bar.getThumb();
+				bar.setSelection(Math.round(x*(M-T)/(l+k+r-t)));//this is how x translate in terms of bar selection
+			}
+		});
+
+		//TODO: to enable line deletion, Concordance code must updated 
+		viewer.getTable().addKeyListener(new KeyListener() {
+
+			@Override
+			public void keyReleased(KeyEvent e) {	}
+
+			@Override
+			public void keyPressed(KeyEvent e) {
+				if (e.keyCode != SWT.DEL ) { // CTRL + C
+					return;
+				}
+
+				DeleteLines.deleteConcordanceLines(ConcordanceEditor.this);
+			}
+		});
+
+
+		firstColumn = new TableColumn(viewer.getTable(), SWT.LEFT);
+		firstColumn.setWidth(0);
+
+		referenceColumn = new TableColumn(viewer.getTable(), SWT.V_SCROLL | SWT.H_SCROLL);
+		refreshReferenceColumnTitle();
+		referenceColumn.setToolTipText(Messages.ConcordancesEditor_1);
+		referenceColumn.setAlignment(SWT.LEFT);
+		referenceColumn.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(Messages.ConcordancesEditor_37);
+				LineComparator comparator = new PropertiesReferenceComparator();
+				if (viewer.getTable().getSortColumn() != referenceColumn) {
+					viewer.getTable().setSortColumn(null);
+					viewer.getTable().setSortColumn(referenceColumn);
+					viewer.getTable().setSortDirection(SWT.UP);
+				} else if (viewer.getTable().getSortDirection() == SWT.UP) {
+					viewer.getTable().setSortDirection(SWT.DOWN);
+					comparator = new ReverseComparator(comparator);
+				} else {
+					viewer.getTable().setSortDirection(SWT.UP);
+				}
+				comparator.initialize(corpus);
+				currentComparator = comparator;
+				complexsorter.setKey(4);//set ref key
+				sort();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		leftContextColumn = new TableColumn(viewer.getTable(), SWT.RIGHT);
+		leftContextColumn.setText(Messages.ConcordancesEditor_2);
+		leftContextColumn.setToolTipText(Messages.ConcordancesEditor_2);
+		leftContextColumn.setAlignment(SWT.RIGHT);
+		leftContextColumn.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(Messages.ConcordancesEditor_41);
+				LineComparator comparator = new LexicographicLeftContextComparator();
+				if (viewer.getTable().getSortColumn() != leftContextColumn) {
+					viewer.getTable().setSortColumn(leftContextColumn);
+					viewer.getTable().setSortDirection(SWT.UP);
+				} else if (viewer.getTable().getSortDirection() == SWT.UP) {
+					viewer.getTable().setSortDirection(SWT.DOWN);
+					comparator = new ReverseComparator(comparator);
+				} else
+					viewer.getTable().setSortDirection(SWT.UP);
+				comparator.initialize(corpus);
+				currentComparator = comparator;
+				complexsorter.setKey(2);//set ref key
+				sort();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		keywordColumn = new TableColumn(viewer.getTable(), SWT.CENTER);
+		keywordColumn.setText(Messages.ConcordancesEditor_3);
+		keywordColumn.setToolTipText(Messages.ConcordancesEditor_3);
+		keywordColumn.setAlignment(SWT.CENTER);
+		keywordColumn.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(Messages.ConcordancesEditor_45);
+				LineComparator comparator = new LexicographicKeywordComparator();
+				if (viewer.getTable().getSortColumn() != keywordColumn) {
+					viewer.getTable().setSortColumn(keywordColumn);
+					viewer.getTable().setSortDirection(SWT.UP);
+				} else if (viewer.getTable().getSortDirection() == SWT.UP) {
+					viewer.getTable().setSortDirection(SWT.DOWN);
+					comparator = new ReverseComparator(comparator);
+				} else
+					viewer.getTable().setSortDirection(SWT.UP);
+				comparator.initialize(corpus);
+				currentComparator = comparator;
+				complexsorter.setKey(1);//set ref key
+				sort();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		annotationColumn = new TableColumn(viewer.getTable(), SWT.CENTER);
+		annotationColumn.setText(Messages.ConcordancesEditor_15);
+		annotationColumn.setToolTipText(Messages.ConcordancesEditor_17);
+		annotationColumn.setAlignment(SWT.CENTER);
+
+		rightContextColumn = new TableColumn(viewer.getTable(), SWT.LEFT);
+		rightContextColumn.setText(Messages.ConcordancesEditor_4);
+		rightContextColumn.setToolTipText(Messages.ConcordancesEditor_4);
+		rightContextColumn.setAlignment(SWT.LEFT);
+		rightContextColumn.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(Messages.ConcordancesEditor_48);
+				LineComparator comparator = new LexicographicRightContextComparator();
+
+				if (viewer.getTable().getSortColumn() != rightContextColumn) {
+					viewer.getTable().setSortColumn(rightContextColumn);
+				} else if (viewer.getTable().getSortDirection() == SWT.UP) {
+					viewer.getTable().setSortDirection(SWT.DOWN);
+					comparator = new ReverseComparator(comparator);
+				} else {
+					viewer.getTable().setSortDirection(SWT.UP);
+				}
+				comparator.initialize(corpus);
+				currentComparator = comparator;
+				complexsorter.setKey(3); //set ref key
+				sort();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		resetColumnWidths(); // set column widths
+
+		viewer.getTable().setLinesVisible(true);
+		viewer.getTable().setHeaderVisible(true);
+
+		createContextMenu();
+
+		// And now, a sweet piece of code :)
+		// When the window is resized, the scrollbar is adjusted so that the
+		// keywords remain centered
+		viewer.getTable().addListener(SWT.Resize, new Listener() {
+			@Override
+			public void handleEvent(Event event) {
+				ScrollBar bar = viewer.getTable().getHorizontalBar();
+				//float l = leftContextColumn.getWidth();
+				//float k = keywordColumn.getWidth();
+				rightContextColumn.getWidth();
+				//float t = lineTableViewer.getTable().getClientArea().width;
+				bar.getMaximum();
+				bar.getThumb();
+			}
+		});
+
+		// back to text mouse listener
+		viewer.getTable().addMouseListener(new MouseListener() {
+			@Override
+			public void mouseDoubleClick(MouseEvent e) {
+				StatusLine.setMessage(Messages.ConcordancesEditor_50);
+				backToText();
+				StatusLine.setMessage(""); //$NON-NLS-1$
+			}
+
+			@Override
+			public void mouseDown(MouseEvent e) { }
+			@Override
+			public void mouseUp(MouseEvent e) {	}
+		});
+
+		// On Windows, the selection is gray if the table does not have focus.
+		// To make both tables appear in focus, draw the selection background
+		// here.
+		// This part only works on version 3.2 or later.
+		Listener eraseListener = new Listener() {
+			@Override
+			public void handleEvent(Event event) {
+				event.detail &= ~SWT.HOT;
+				if ((event.detail & SWT.SELECTED) != 0) {
+					GC gc = event.gc;
+					Rectangle rect = event.getBounds();
+					gc.setForeground(displayArea.getDisplay().getSystemColor(
+							SWT.COLOR_LIST_SELECTION_TEXT));
+					gc.setBackground(displayArea.getDisplay().getSystemColor(
+							SWT.COLOR_LIST_SELECTION));
+					gc.fillRectangle(rect);
+					event.detail &= ~SWT.SELECTED;
+				}
+			}
+		};
+
+		// Listeners to avoid 0 width clumns
+		referenceColumn.addControlListener(new ControlListener() {
+			@Override
+			public void controlMoved(ControlEvent e) { }
+			@Override
+			public void controlResized(ControlEvent e) {
+				if (referenceColumn.getWidth() < 5) referenceColumn.setWidth(5);
+
+			}
+		});
+		leftContextColumn.addControlListener(new ControlListener() {
+			@Override
+			public void controlMoved(ControlEvent e) { }
+			@Override
+			public void controlResized(ControlEvent e) {
+				if (leftContextColumn.getWidth() < 5) leftContextColumn.setWidth(5);
+
+			}
+		});
+		keywordColumn.addControlListener(new ControlListener() {
+			@Override
+			public void controlMoved(ControlEvent e) { }
+			@Override
+			public void controlResized(ControlEvent e) {
+				if (keywordColumn.getWidth() < 5) keywordColumn.setWidth(5);
+
+			}
+		});
+		annotationColumn.addControlListener(new ControlListener() {
+			@Override
+			public void controlMoved(ControlEvent e) { }
+			@Override
+			public void controlResized(ControlEvent e) {
+				if (annotationArea != null && annotationColumn.getWidth() < 5) annotationColumn.setWidth(5);
+
+			}
+		});
+		rightContextColumn.addControlListener(new ControlListener() {
+			@Override
+			public void controlMoved(ControlEvent e) { }
+			@Override
+			public void controlResized(ControlEvent e) {
+				if (rightContextColumn.getWidth() < 5) rightContextColumn.setWidth(5);
+
+			}
+		});
+
+		viewer.getTable().addListener(SWT.EraseItem, eraseListener);
+
+		//		tableLayout.setColumnData(firstColumn, new ColumnWeightData(0, false));
+		//		tableLayout.setColumnData(referenceColumn, new ColumnWeightData(1, true)); 
+		//		tableLayout.setColumnData(keywordColumn, new ColumnWeightData(1, true));
+		//		tableLayout.setColumnData(leftContextColumn, new ColumnWeightData(1, true));
+		//		tableLayout.setColumnData(annotationColumn, new ColumnWeightData(0, true));
+		//		tableLayout.setColumnData(rightContextColumn, new ColumnWeightData(1, true));
+	}
+
+	/**
+	 * Sort.
+	 */
+	public void sort() {
+		if (concordance != null && currentComparator != null) {
+
+			//System.out.println("concordance sort props: "+concordance.getLeftCAnalysisProperty()+", "+concordance.getKeywordAnalysisProperty()+", "+concordance.getRightCAnalysisProperty());
+			concordance.setLeftAnalysisProperties(selectedLeftSortProperties);
+			concordance.setKeywordAnalysisProperties(selectedKeywordSortProperties);
+			concordance.setRightAnalysisProperties(selectedRightSortProperties);
+			
+			try {
+				Log.info(NLS.bind(CooccurrenceUIMessages.CooccurrencesEditor_0, currentComparator.getName()));
+				if (currentComparator instanceof CompositeComparator)
+					Log.info(((CompositeComparator) currentComparator).getComparators().toString());
+				JobHandler jobhandler = new JobHandler("Sorting...") { //$NON-NLS-1$
+					@Override
+					protected IStatus run(IProgressMonitor monitor) {
+						this.runInit(monitor);
+						JobsTimer.start();
+						try {
+							monitor.beginTask(Messages.ConcordancesEditor_6, concordance.getNLines());
+							concordance.setCurrentMonitor(this);
+							concordance.sort(currentComparator);
+							concordance.setCurrentMonitor(null);
+							syncExec(new Runnable() {
+								@Override
+								public void run() {
+									StatusLine.setMessage(Messages.SORT_DONE);
+									fillDisplayArea(topLine, topLine + nLinePerPage - 1);
+								}
+							});
+
+						} catch (ThreadDeath td) {
+							return Status.CANCEL_STATUS;
+						} catch (Exception e) {
+							System.err.println(NLS.bind(Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE, e));
+							org.txm.rcp.utils.Logger.printStackTrace(e);
+						} finally {
+							monitor.done();
+							JobsTimer.stopAndPrint();
+						}
+						return Status.OK_STATUS;
+					}
+				};
+
+				jobhandler.startJob();
+			} catch (Exception e) {
+				System.err.println(NLS.bind(Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE, e));
+				org.txm.rcp.utils.Logger.printStackTrace(e);
+			}
+		}
+	}
+
+	/**
+	 * Lazy loads the concordance lines range and fills the display area.
+	 *
+	 * @param from the from
+	 * @param to the to
+	 */
+	public void fillDisplayArea(int from, int to) {
+		if (viewer == null)
+			return;
+		
+		viewer.getControl().setRedraw(false);
+		
+		from = Math.max(from, 0);
+		to = Math.min(to, concordance.getNLines() - 1);
+		List<Line> lines = null;
+		if (concordance.getNLines() > 0) {
+			try {
+				lines = concordance.getLines(from, to);
+			} catch (Exception e) {
+				System.err.println(Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE+ e);
+				org.txm.rcp.utils.Logger.printStackTrace(e);
+			}
+		} else
+			lines = new ArrayList<Line>();
+
+		viewer.setInput(lines);
+		referenceColumn.pack();
+		leftContextColumn.pack();
+		keywordColumn.pack();
+		rightContextColumn.pack();
+		viewer.getTable().pack(true);
+		viewer.getTable().getParent().layout();
+
+		topLine = from;
+		bottomLine = to;
+
+		navigationArea.setInfoLineText(""+(from + 1), //$NON-NLS-1$
+				" - "+(to + 1) + " / " + concordance.getNLines()); //$NON-NLS-1$ //$NON-NLS-2$
+
+		navigationArea.setPreviousEnabled(topLine > 0);
+		navigationArea.setFirstEnabled(topLine > 0);
+		navigationArea.setNextEnabled(bottomLine < concordance.getNLines() - 1);
+		navigationArea.setLastEnabled(bottomLine < concordance.getNLines() - 1);
+		navigationArea.layout();
+		navigationArea.getParent().layout();
+
+		refreshReferenceColumnTitle();
+		
+		viewer.getControl().setRedraw(true);
+	}
+
+	HashMap<AnnotationType, ArrayList<TypedValue>> history = new HashMap<AnnotationType, ArrayList<TypedValue>>();
+
+	private Button addAnnotationTypeLink;
+
+	private KnowledgeRepository currentKnowledgeRepository = null;
+	Vector<AnnotationType> typesList = new Vector<AnnotationType>(); 
+
+	private Button addTypedValueLink;
+
+	private Label withLabel;
+
+	private AnnotationType tagAnnotationType; // the tag annotation type if annotation mode is simple
+
+	private Label equalLabel;
+	Boolean advanced_annotation_mode = false;
+	
+	private void composeAnnotationArea(final Composite parent){ 
+		advanced_annotation_mode = "advanced".equals(TXMPreferences.getString(RCPPreferences.PREFERENCES_NODE, RCPPreferences.ANNOTATION_MODE, "simple"));
+		
+		List<KnowledgeRepository> krs = InitializeKnowledgeRepository.get(corpus.getMainCorpus());
+		typesList.clear();
+		Log.warning("Corpus KRs: "+krs); //$NON-NLS-1$
+
+		for (KnowledgeRepository kr : krs) {
+			currentKnowledgeRepository = kr;
+			Log.warning(" KR: "+kr); //$NON-NLS-1$
+			List<AnnotationType> krtypes = kr.getAllAnnotationTypes();
+			Log.warning("Advanced annotation mode ? "+advanced_annotation_mode);
+			if (!advanced_annotation_mode) { // creates the "span" annotation type
+				boolean createTagAnnotationType = true;
+				for (AnnotationType type : krtypes) {
+					if (type.getName().equals("span")) { //$NON-NLS-1$
+						createTagAnnotationType = false;
+					}
+				}
+				if (createTagAnnotationType) {
+					tagAnnotationType = kr.addType("span", "span");//corresponds to an "undef" type //$NON-NLS-1$ //$NON-NLS-2$
+					typesList.add(tagAnnotationType);
+				} else {
+					tagAnnotationType = kr.getType("span"); //$NON-NLS-1$
+				}
+			} else {
+				typesList.addAll(krtypes);
+			}
+			Log.warning("Available annotation types: "+typesList);
+			break;
+		}
+
+		annotationArea = new Composite(parent, SWT.NONE);
+		annotationArea.setLayoutData(new GridData(SWT.FILL, SWT.LEFT, false, false));
+
+		GridLayout annotLayout = new GridLayout(12, false);
+		annotLayout.verticalSpacing = 0;
+		annotLayout.marginWidth = 0;
+		annotLayout.marginHeight = 0;
+		annotationArea.setLayout(annotLayout);
+
+		//init values history
+		for (AnnotationType type : typesList) {
+			history.put(type, new ArrayList<TypedValue>());
+		}
+
+		addRemoveCombo = new Combo(annotationArea, SWT.READ_ONLY);
+		String affectLabel = currentKnowledgeRepository.getString(locale, "ConcordancesEditor_22");
+		if (affectLabel == null) affectLabel= Messages.ConcordancesEditor_22;
+		String removeLabel = currentKnowledgeRepository.getString(locale, "ConcordancesEditor_24");
+		if (removeLabel == null) removeLabel= Messages.ConcordancesEditor_24;
+		String items[] = {affectLabel, removeLabel};
+		addRemoveCombo.setItems(items);
+		addRemoveCombo.select(0);
+		addRemoveCombo.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (addRemoveCombo.getSelectionIndex() == 0) { // add
+					annotationValuesText.setEnabled(true);
+					String withLabelText = currentKnowledgeRepository.getString(locale, "ConcordancesEditor_83");
+					if (withLabelText == null) withLabelText= Messages.ConcordancesEditor_83;
+					withLabel.setText(withLabelText);
+					if (equalLabel != null) equalLabel.setText("=");
+				} else { // remove
+					annotationValuesText.setEnabled(false);
+					withLabel.setText(""); //$NON-NLS-1$
+					if (equalLabel != null) equalLabel.setText("");
+				}
+				withLabel.redraw();
+				annotationArea.layout();
+				updateAnnotationWidgetStates();
+			}
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		GridData gdata = new GridData(SWT.CENTER, SWT.CENTER, false, true);
+		gdata.widthHint = 90;
+		addRemoveCombo.setLayoutData(gdata);
+	
+		withLabel = new Label(annotationArea, SWT.NONE);
+		String withLabelText = currentKnowledgeRepository.getString(locale, "ConcordancesEditor_83");
+		if (withLabelText == null) withLabelText= Messages.ConcordancesEditor_83;
+		withLabel.setText(withLabelText);
+		withLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+
+		if (advanced_annotation_mode) {
+			equalLabel = new Label(annotationArea, SWT.NONE);
+			equalLabel.setText("="); //$NON-NLS-1$
+			equalLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+		}
+
+		//Display combo with list of Annotation Type 
+		if (advanced_annotation_mode) {
+			annotationTypesCombo = new ComboViewer(annotationArea, SWT.READ_ONLY);
+			annotationTypesCombo.setContentProvider(new ArrayContentProvider());
+			annotationTypesCombo.setLabelProvider(new SimpleLabelProvider() {
+				@Override
+				public String getColumnText(Object element, int columnIndex) {
+					return ((AnnotationType)element).getName(); //$NON-NLS-1$
+				}
+				@Override
+				public String getText(Object element) {
+					return ((AnnotationType)element).getName(); //$NON-NLS-1$
+				}
+			});
+			gdata = new GridData(SWT.CENTER, SWT.CENTER, false, true);
+			gdata.widthHint = 200;
+
+			annotationTypesCombo.getCombo().setLayoutData(gdata);
+			annotationTypesCombo.setInput(typesList);
+			if (advanced_annotation_mode.equals(Messages.AnnotationPreferences_2)) {
+				annotationTypesCombo.getCombo().select(0);
+			}
+
+			annotationTypesCombo.addSelectionChangedListener(new ISelectionChangedListener() {
+				@Override
+				public void selectionChanged(SelectionChangedEvent event) {
+					AnnotationType type = getSelectedAnnotationType();
+					if (type == null) return;
+					if (type.getSize() != AnnotationType.ValuesSize.LARGE) {
+						try {
+							KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
+							typeValuesList = kr.getValues(type);
+						} catch (Exception e) {
+							// TODO Auto-generated catch block
+							e.printStackTrace();
+						}
+					} else { // set history values
+						typeValuesList = history.get(type);
+					}
+
+					annotationColumn.setText(type.getName());
+					if (concordance != null) {
+						concordance.setViewAnnotation(type);
+						concordance.setAnnotationOverlap(true);
+						fillDisplayArea(topLine, bottomLine);
+					}
+
+					updateAnnotationWidgetStates();
+				}
+			});
+		}
+
+		if (advanced_annotation_mode) {
+			if (currentKnowledgeRepository instanceof SQLKnowledgeRepository) {
+				infosAnnotTypeSelectedLink = new Button(annotationArea, SWT.PUSH);
+				infosAnnotTypeSelectedLink.setImage(IImageKeys.getImage(IImageKeys.ACTION_INFO));
+				infosAnnotTypeSelectedLink.setEnabled(true);
+				infosAnnotTypeSelectedLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, true));
+				infosAnnotTypeSelectedLink.addSelectionListener(new SelectionListener() {
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						AnnotationType type = getSelectedAnnotationType();
+						if (type == null) return;
+
+						String typedValueURL = type.getURL(); // may be null/empty
+						if (typedValueURL != null && typedValueURL.length() > 0) {
+							KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
+							kr.getTypeURL(type);
+						}
+						if (typedValueURL != null && typedValueURL.length() > 0) {
+							OpenBrowser.openfile(typedValueURL, new File(typedValueURL).getName());
+						} else {
+							IWorkbenchWindow window = getSite().getWorkbenchWindow();
+							try {
+								OpenKRView.openView(window, type);
+							} catch (PartInitException e1) {
+								e1.printStackTrace();
+							}
+						}
+					}
+
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) { }
+				});
+			}
+
+			if (currentKnowledgeRepository instanceof LocalKnowledgeRepository) {
+				addAnnotationTypeLink = new Button(annotationArea, SWT.PUSH);
+				addAnnotationTypeLink.setToolTipText(Messages.ConcordancesEditor_115);
+				addAnnotationTypeLink.setImage(IImageKeys.getImage(IImageKeys.ACTION_ADD));
+				addAnnotationTypeLink.setEnabled(true);
+				addAnnotationTypeLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, true));
+				addAnnotationTypeLink.addSelectionListener(new SelectionListener() {
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						if (currentKnowledgeRepository == null) return;
+						if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
+
+						LocalKnowledgeRepository kr = (LocalKnowledgeRepository)currentKnowledgeRepository;
+
+						InputDialog dialog = new InputDialog(e.widget.getDisplay().getActiveShell(), Messages.ConcordancesEditor_82, Messages.ConcordancesEditor_81, "", null); //$NON-NLS-3$
+						if (dialog.open() == InputDialog.OK) {
+							String name = dialog.getValue();
+							if (name.trim().length() == 0) return;
+							String baseid = AsciiUtils.buildId(name);
+							String id = AsciiUtils.buildId(name);
+							int c = 1;
+							while (kr.getType(id) != null) {
+								id = baseid+"_"+(c++); //$NON-NLS-1$
+							}
+							AnnotationType type = kr.addType(name, id, ""); //$NON-NLS-1$
+							typesList.add(type);
+							history.put(type, new ArrayList<TypedValue>());
+
+							if (annotationTypesCombo != null) annotationTypesCombo.refresh();
+							if (typesList.size() == 1) {
+								if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(0);
+								if (concordance != null) {
+									concordance.setViewAnnotation(type);
+									concordance.setAnnotationOverlap(true);
+									fillDisplayArea(topLine, bottomLine);
+								}
+								annotationArea.layout(true);
+							}else {
+								if (typesList.size() > 1){
+									if (annotationTypesCombo != null) annotationTypesCombo.getCombo().select(typesList.size()-1);
+								
+								}
+								
+							}
+							KRView.refresh();
+							updateAnnotationWidgetStates();
+						} else {
+							System.out.println("Creation aborted."); //$NON-NLS-1$
+						}
+					}
+
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) { }
+				});
+			}
+		}
+		if (advanced_annotation_mode) {
+			Label valueLabel = new Label(annotationArea, SWT.NONE);
+			String valueLabelText = currentKnowledgeRepository.getString(locale, "ConcordancesEditor_80");
+			if (valueLabelText == null) valueLabelText= Messages.ConcordancesEditor_80;
+			valueLabel.setText(valueLabelText);
+			valueLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
+		}
+
+		annotationValuesText = new Text(annotationArea, SWT.BORDER);
+		annotationValuesText.setToolTipText(Messages.ConcordancesEditor_32);
+		GridData gdata2 = new GridData(SWT.FILL, SWT.CENTER, false, true);
+		gdata2.widthHint = 200;
+		annotationValuesText.setLayoutData(gdata2);
+		annotationValuesText.addKeyListener(new KeyListener() {
+			@Override
+			public void keyReleased(KeyEvent e) {
+				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
+					affectAnnotationToSelection(viewer.getSelection());
+				}
+			}
+
+			@Override
+			public void keyPressed(KeyEvent e) { }
+		});
+
+		if (currentKnowledgeRepository instanceof LocalKnowledgeRepository) {
+			addTypedValueLink = new Button(annotationArea, SWT.PUSH);
+			addTypedValueLink.setText("..."); //$NON-NLS-1$
+			if (advanced_annotation_mode.equals(Messages.AnnotationPreferences_2)) {
+				addTypedValueLink.setToolTipText(Messages.ConcordancesEditor_79);
+			}else {
+				addTypedValueLink.setToolTipText(Messages.ConcordancesEditor_77);
+			}
+			addTypedValueLink.setEnabled(true);
+			addTypedValueLink.setLayoutData(new GridData(SWT.FILL,	SWT.CENTER, false, true));
+			addTypedValueLink.addSelectionListener(new SelectionListener() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					if (currentKnowledgeRepository == null) return;
+					if (!(currentKnowledgeRepository instanceof LocalKnowledgeRepository)) return;
+
+					AnnotationType type = getSelectedAnnotationType();
+					if (type == null) return;
+
+					LocalKnowledgeRepository kr = (LocalKnowledgeRepository)currentKnowledgeRepository;
+
+					ListDialog dialog = new ListDialog(e.widget.getDisplay().getActiveShell());
+					if (advanced_annotation_mode.equals(Messages.AnnotationPreferences_2)) {
+						String title = currentKnowledgeRepository.getString(locale, "ConcordancesEditor_100");
+						if (title == null) title = Messages.ConcordancesEditor_100;
+						dialog.setTitle(Messages.bind(title, type.getName()));//+"valeurs de "+type.getName());
+					}else {
+						dialog.setTitle(Messages.ConcordancesEditor_99);//+"valeurs de "+type.getName());
+					}
+					dialog.setContentProvider(new ArrayContentProvider());
+					dialog.setLabelProvider(new SimpleLabelProvider() {
+						public String getColumnText(Object element, int columnIndex) {
+							if (element instanceof TypedValue)
+								return ((TypedValue)element).getId();
+							return element.toString();
+						}
+					});
+					List<TypedValue> values;
+					try {
+						values = kr.getValues(type);
+					} catch (Exception e1) {
+						e1.printStackTrace();
+						return;
+					}
+					dialog.setInput(values);
+					if (dialog.open() == InputDialog.OK) {
+						TypedValue value = (TypedValue) dialog.getResult()[0];
+						String name = value.getId();
+						if (name.trim().length() == 0) return;
+
+						annotationValuesText.setText(name);
+					} else {
+
+					}
+				}
+
+				@Override
+				public void widgetDefaultSelected(SelectionEvent e) { }
+			});
+		}
+
+		affectCombo = new Combo(annotationArea, SWT.READ_ONLY);
+		affectCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true));
+		String items2[] = {Messages.ConcordancesEditor_35, Messages.ConcordancesEditor_42, Messages.ConcordancesEditor_49};
+		affectCombo.setItems(items2);
+		affectCombo.select(0);
+		gdata = new GridData(SWT.CENTER, SWT.CENTER, false, true);
+		gdata.widthHint = 140;
+		affectCombo.setLayoutData(gdata);
+
+		affectAnnotationButton = new Button(annotationArea, SWT.PUSH);
+		affectAnnotationButton.setText(Messages.ConcordancesEditor_85);
+		affectAnnotationButton.setToolTipText(Messages.ConcordancesEditor_116);
+		affectAnnotationButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, true));
+		affectAnnotationButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int isel = affectCombo.getSelectionIndex();
+				if (isel == 0) { // selected line
+					affectAnnotationToSelection(viewer.getSelection());
+				} else if (isel == 1) { // page
+					try {
+						List<Match> matches = concordance.getMatches().subList(topLine, bottomLine+1);
+						affectMatchesToSelection(matches);
+					} catch (CqiClientException e1) {
+						Log.severe(Messages.ConcordancesEditor_53+e1);
+						Log.printStackTrace(e1);
+						return;
+					}
+				} else { // all
+					try {
+						List<Match> matches = concordance.getMatches();
+						affectMatchesToSelection(matches);
+					} catch (CqiClientException e1) {
+						Log.severe(Messages.ConcordancesEditor_53+e1);
+						Log.printStackTrace(e1);
+						return;
+					}
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		Button cancelAnnotateButton = new Button(annotationArea, SWT.PUSH);
+		cancelAnnotateButton.setText(Messages.ConcordancesEditor_101);
+		cancelAnnotateButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				//@TODO Closing the annotation tool bar 
+					//System.out.println("must hide");
+					annotationSize = annotationArea.getSize();
+					annotationArea.dispose();
+					annotationArea = null;
+					parent.layout(true);
+					parent.layout();
+					annotationButton.setToolTipText(Messages.ConcordancesEditor_75);
+					annotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL));
+					annotationColumn.setWidth(0);
+					annotationColumn.setResizable(false);
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+		
+		
+		updateAnnotationWidgetStates();
+
+		parent.layout();
+	}
+
+	protected void affectAnnotationToSelection(ISelection selection) {
+
+		final IStructuredSelection lineSelection = (IStructuredSelection) selection;
+		List<Line> lines = lineSelection.toList();
+		ArrayList<Match> matches = new ArrayList<Match>();
+		for (Line l : lines) matches.add(l.getMatch());
+
+		affectMatchesToSelection(matches);
+	}
+
+	protected AnnotationType getSelectedAnnotationType() {
+		if (annotationTypesCombo != null) {
+			IStructuredSelection isel = (IStructuredSelection)annotationTypesCombo.getSelection();
+			if (isel.isEmpty()) return null;
+			return (AnnotationType) isel.getFirstElement();
+		} else { // simple mode
+			return tagAnnotationType;
+		}
+	}
+
+	protected void affectMatchesToSelection(final List<Match> matches) {
+		final AnnotationType type = getSelectedAnnotationType();
+		final String svalue = annotationValuesText.getText();
+		final boolean doAffect = addRemoveCombo.getSelectionIndex() == 0; // add is default
+
+		JobHandler job = new JobHandler(Messages.ConcordancesEditor_36, true) {
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				this.runInit(monitor);
+				try {
+					if (doAffect) {
+						affectAnnotationValues(matches, type, svalue, this);
+					} else {
+						deleteAnnotationValues(matches, type, this);
+					}
+				} catch(Exception e) {
+					Log.severe(Messages.ConcordancesEditor_40+e);
+					Log.printStackTrace(e);
+					return Status.CANCEL_STATUS;
+				} catch(ThreadDeath td) {
+					System.out.println("Annotation canceled by user.");
+					return Status.CANCEL_STATUS;
+				}
+				
+				return Status.OK_STATUS;
+			}
+		};
+		job.startJob(true);
+	}
+
+	public void updateAnnotationWidgetStates() {
+		if (annotationArea == null) return; // :)
+
+		if (addRemoveCombo.getSelectionIndex() == 0) { // add is default
+
+			if (getSelectedAnnotationType() != null) {
+				annotationValuesText.setEnabled(true);
+
+				affectAnnotationButton.setEnabled(true);
+				affectCombo.setEnabled(true);
+			} else {
+				annotationValuesText.setEnabled(false);
+
+				affectAnnotationButton.setEnabled(false);
+				affectCombo.setEnabled(false);
+			}
+		} else {
+			annotationValuesText.setEnabled(false);
+
+			if (getSelectedAnnotationType() != null) {
+				affectAnnotationButton.setEnabled(true);
+				affectCombo.setEnabled(true);
+			} else {
+				affectAnnotationButton.setEnabled(false);
+				affectCombo.setEnabled(false);
+			}
+		}
+
+		if (advanced_annotation_mode.equals(Messages.AnnotationPreferences_2)) {
+			if (infosAnnotTypeSelectedLink != null) infosAnnotTypeSelectedLink.setEnabled(getSelectedAnnotationType() != null);
+		}
+		if (addTypedValueLink != null) addTypedValueLink.setEnabled(getSelectedAnnotationType() != null);
+
+		if (concordance == null) {
+			affectAnnotationButton.setEnabled(false);
+			affectCombo.setEnabled(false);
+		}
+	}
+
+	protected void deleteAnnotationValues(List<Match> matches, AnnotationType type, JobHandler job) {
+		if (concordance == null) return;
+		if (matches.size() == 0) {
+			System.out.println("No lines selected. Aborting."); //$NON-NLS-1$
+			return;
+		}
+		if (type == null) return;
+
+		if (concordance != null) {
+			try {
+				if (annotManager != null && annotManager.deleteAnnotations(type, matches, job)) {
+					if (Log.getLevel().intValue() < Level.WARNING.intValue()) annotManager.checkData();
+					concordance.reloadLines(topLine, bottomLine);
+				} else {
+					return;
+				}
+			} catch (Exception e1) {
+				System.out.println(Messages.ConcordancesEditor_54+e1);
+				Log.printStackTrace(e1);
+				return;
+			}
+
+			job.syncExec(new Runnable() {
+				@Override
+				public void run() {
+					fillDisplayArea(topLine, bottomLine+1);
+					CorporaView.refreshObject(corpus);
+				}
+			});
+		}
+	}
+
+	TypedValue value_to_add;
+	protected void affectAnnotationValues(final List<Match> matches,  final AnnotationType type, final String svalue, JobHandler job) {
+		value_to_add = null; // reset
+		if (concordance == null) {
+			System.out.println("No concordance done. Aborting."); //$NON-NLS-1$
+			return;
+		}
+		if (matches.size() == 0) {
+			System.out.println("No line selected. Aborting."); //$NON-NLS-1$
+			return;
+		}
+		if (type == null) return; // no type, no annotation
+
+		job.syncExec(new Runnable() {
+			@Override
+			public void run() {
+				if (matches.size() > NALERTAFFECTANNOTATIONS) {
+					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), 
+							"confirm_annotate",  //$NON-NLS-1$
+							Messages.ConcordancesEditor_86, 
+							Messages.ConcordancesEditor_87+matches.size()+Messages.ConcordancesEditor_108);
+
+					if (dialog.open() == ConfirmDialog.CANCEL) {
+						System.out.println("Annotation aborted by user."); //$NON-NLS-1$
+						matches.clear();
+					}
+				}
+			}
+		});
+
+		// get value from combo text value
+		Log.warning(Messages.ConcordancesEditor_57+svalue);
+		final KnowledgeRepository kr = KnowledgeRepositoryManager.getKnowledgeRepository(type.getKnowledgeRepository());
+		value_to_add = kr.getValue(type, svalue);
+
+
+		if (value_to_add == null && kr instanceof LocalKnowledgeRepository) { // create or not the annotation is simple mode
+			job.syncExec(new Runnable() {
+				@Override
+				public void run() {
+					String title = kr.getString(locale, "ConcordancesEditor_110");
+					String content = kr.getString(locale, "ConcordancesEditor_112");
+					if (title == null ) title = Messages.ConcordancesEditor_110;
+					if (content == null ) content = Messages.ConcordancesEditor_112;
+					ConfirmDialog dialog = new ConfirmDialog(Display.getCurrent().getActiveShell(), 
+							"create_value", //$NON-NLS-1$
+							Messages.bind(title, svalue, type.getName()),  
+							Messages.bind(content, svalue, type.getName()));
+					if (dialog.open() == ConfirmDialog.CANCEL) {
+						System.out.println("Annotation aborted by user."); //$NON-NLS-1$
+						return;
+					} else {
+						value_to_add = kr.addValue(svalue, svalue, type.getId());
+						KRView.refresh();
+					}
+				}
+			});
+		}
+
+		if (value_to_add == null && kr instanceof LocalKnowledgeRepository) return; // canceled
+
+		if (value_to_add == null) {	
+			job.syncExec(new Runnable() {
+				@Override
+				public void run() {
+					String mess = Messages.bind(Messages.ConcordancesEditor_58, svalue);
+					System.out.println(mess);
+					MessageDialog.openError(Display.getCurrent().getActiveShell(), "Annotation canceled", mess); //$NON-NLS-1$
+				}
+			});
+			return;
+		}
+
+		Log.info(Messages.ConcordancesEditor_59+value_to_add+Messages.ConcordancesEditor_60+matches);
+
+		// finally we can 'try' to create the annotations \o/
+		try {
+			HashMap<Match, List<Annotation>> existingAnnots = annotManager.createAnnotations(type, value_to_add, matches, job);
+			
+			// did we had problems ?
+			if (existingAnnots!=null && existingAnnots.size() > 0) {
+				String message = Messages.ConcordancesEditor_61+value_to_add.getStandardName()+
+						Messages.ConcordancesEditor_62;
+				for (Match m : existingAnnots.keySet()) {
+					message += Messages.ConcordancesEditor_63+m+Messages.ConcordancesEditor_64;
+
+					for (Annotation existingAnnot : existingAnnots.get(m)) {
+						if (existingAnnot.getStart() < m.getStart()){
+							message += Messages.ConcordancesEditor_65+existingAnnot.getType()+Messages.ConcordancesEditor_66+existingAnnot.getStart()+Messages.ConcordancesEditor_67+existingAnnot.getEnd()+Messages.ConcordancesEditor_68;
+						} else {
+							message += Messages.ConcordancesEditor_69+existingAnnot.getType()+Messages.ConcordancesEditor_70+existingAnnot.getStart()+Messages.ConcordancesEditor_71+existingAnnot.getEnd()+Messages.ConcordancesEditor_72;
+						}
+					}
+				}
+				final String final_message = message;
+				job.syncExec(new Runnable() {
+					@Override
+					public void run() {
+						MessageDialog.openInformation(getSite().getShell(), Messages.ConcordancesEditor_73, final_message);
+					}
+				});
+			}
+			//				if (history != null && !history.get(type).contains(value_to_add))
+			//					history.get(type).add(value_to_add);
+
+			if (Log.getLevel().intValue() < Level.WARNING.intValue() && annotManager != null) annotManager.checkData();
+			concordance.reloadLines(topLine, bottomLine+1);
+		} catch (Exception e1) {
+			System.out.println(Messages.ConcordancesEditor_74+e1);
+			Log.printStackTrace(e1);
+			return;
+		}
+
+		job.syncExec(new Runnable() {
+			@Override
+			public void run() {
+				fillDisplayArea(topLine, bottomLine+1);
+				CorporaView.refreshObject(corpus);
+			}
+		});
+
+	}
+
+	/**
+	 * Compose control area.
+	 *
+	 * @param controlArea the control area
+	 */
+	private void composeControlArea(final Composite controlArea) {
+		GridLayout controlLayout = new GridLayout(1, false);
+		controlLayout.verticalSpacing = 0;
+		controlLayout.marginWidth = 0;
+		controlLayout.marginHeight = 0;
+		controlArea.setLayout(controlLayout);
+
+		// Query Area: query itself + view properties
+		queryArea = new Composite(controlArea, SWT.NONE);
+		queryArea.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+		queryArea.setLayout(new GridLayout(4, false));
+
+		////////////////////////////////
+		//composeAnnotationArea(controlArea);
+		//////////////////////////////////
+
+		Composite navigationPanel = new Composite(controlArea, SWT.NONE);
+		navigationPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true));
+		GridLayout navigationLayout = new GridLayout(7, false); 
+		navigationLayout.verticalSpacing = 0;
+		navigationLayout.marginWidth = 0;
+		navigationLayout.marginHeight = 0;
+		navigationPanel.setLayout(navigationLayout);
+		///////////////////////////
+		// | Query: [ (v)] [Search] |
+
+		// Query:
+		Label queryLabel = new Label(queryArea, SWT.NONE);
+		queryLabel.setText(Messages.CreateSubcorpusDialog_10);
+		queryLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false,
+				false));
+
+		// [ (v)]
+		// queryWidget = new QueryWidget(queryArea, SWT.DROP_DOWN);
+		queryWidget = new AssistedQueryWidget(queryArea, SWT.DROP_DOWN, corpus);
+		queryWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
+		queryWidget.addKeyListener(new KeyListener() {
+			@Override
+			public void keyPressed(KeyEvent e) {
+				// System.out.println("key pressed : "+e.keyCode);
+				if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) {
+					compute();
+				}
+			}
+
+			@Override
+			public void keyReleased(KeyEvent e) {
+			}
+		});
+
+		// | Properties: word/pos [Edit] |
+		Composite propertiesArea = new Composite(queryArea, SWT.NONE);
+		propertiesArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false,
+				false, 1, 1));
+		propertiesArea.setLayout(new GridLayout(3, false));
+		// Properties:
+		Label propLabel = new Label(propertiesArea, SWT.NONE);
+		propLabel.setText(Messages.ConcordancesEditor_16);
+		propLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true));
+
+		// word/pos
+		viewPropertiesLabel = new Label(propertiesArea, SWT.NONE);
+		viewPropertiesLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER,
+				false, true));
+		this.updateViewPropertiesLabel();
+
+		// [Edit]
+		Button editViewProperties = new Button(propertiesArea, SWT.PUSH);
+		editViewProperties.setText(Messages.ConcordancesEditor_18);
+		editViewProperties.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true));
+		editViewProperties.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				StatusLine.setMessage(Messages.ConcordancesEditor_55);
+				new ViewPropertySelectionDialog(getSite(),
+						availableKeywordViewProperties,
+						selectedKeywordViewProperties).open();
+				if (concordance != null)
+					try {
+						refreshViewProperties();
+					} catch (Exception e1) {
+						System.err.println(NLS.bind(
+								Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE,
+								e1));
+					}
+				updateViewPropertiesLabel();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		// [Search]
+		Button go = new Button(queryArea, SWT.PUSH);
+		go.setText(Messages.SEARCH);
+
+		Font f = go.getFont();
+		FontData defaultFont = f.getFontData()[0];
+		defaultFont.setStyle(SWT.BOLD);
+		Font newf = new Font(go.getDisplay(), defaultFont);
+		go.setFont(newf);
+
+		go.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
+		go.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				compute();
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+			}
+		});
+
+		// Complex sort chooser (full line)
+		complexsorter = new ComplexSortSelector(queryArea, SWT.NONE);
+		complexsorter.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true,
+				true, 4, 1));
+
+		// Delete line button
+		deleteLineButton = new Button(navigationPanel, SWT.PUSH);
+		deleteLineButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false,
+				false));
+		deleteLineButton.setToolTipText(Messages.ConcordancesEditor_88);
+		deleteLineButton.setImage(IImageKeys.getImage(IImageKeys.CONCORDANCE_DELETE));
+		deleteLineButton.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				DeleteLines.deleteConcordanceLines(ConcordanceEditor.this);
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) { }
+		});
+
+
+		if (corpus.getKnowledgeRepositoryNames().size() > 0) { // shown only if corpus has a registered KR
+
+			annotationButton = new Button(navigationPanel, SWT.PUSH);
+			annotationButton.setToolTipText(Messages.ConcordancesEditor_75);
+			annotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL));
+			annotationButton.addSelectionListener(new SelectionListener() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					if (annotationArea != null) {
+						AnnotationManager am = corpus.getMainCorpus().getAnnotationManager();
+						if (am != null && am.hasChanges()) {
+							// && MessageDialog.openConfirm(e.display.getActiveShell(), "Confirm annotation save", "Saving annotation will close this editor. Are you sure you want to save annotations right now ?")
+							JobHandler saveJob = SaveAnnotations.save(corpus.getMainCorpus());
+							if (saveJob.getResult() == Status.CANCEL_STATUS) {
+								// update editor corpus
+								System.out.println("Fail to save annotations of the corpus."); //$NON-NLS-1$
+							}
+						}
+
+					} else {
+						if (annotationArea == null) composeAnnotationArea(controlArea);
+						if (annotationArea == null) return;
+
+						annotationColumn.pack();
+						annotationButton.setToolTipText(Messages.ConcordancesEditor_76);
+						annotationButton.setImage(IImageKeys.getImage(IImageKeys.PENCIL_SAVE));
+
+						annotSize = annotationArea.getSize();
+						Point size = controlArea.getSize();
+						controlArea.setSize(size.x, size.y + annotSize.y);
+						GridData data = (GridData) annotationArea.getLayoutData();
+						data.heightHint = annotSize.y;
+						data.minimumHeight = annotSize.y;
+						annotationArea.setSize(annotSize);
+						controlArea.layout(true);
+						parent.layout();
+
+						if (concordance != null) {
+							AnnotationType type = getSelectedAnnotationType();
+							if (type != null) {
+								concordance.setViewAnnotation(type);
+								concordance.setAnnotationOverlap(true);
+								fillDisplayArea(topLine, bottomLine+1);
+							}
+						}
+
+						CorporaView.refreshObject(corpus);
+					}
+				}
+
+				@Override
+				public void widgetDefaultSelected(SelectionEvent e) {	}
+			});
+		}
+		// Navigation Area: infoLine and buttons
+				navigationArea = new NavigationWidget(navigationPanel, SWT.NONE);
+				navigationArea.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, false, 4, 1));
+
+				// | [|<] [<] infos [>] [>|] |
+				// [|<]
+				navigationArea.addFirstListener(new SelectionListener() {
+					@Override
+					public void widgetDefaultSelected(SelectionEvent arg0) {
+					}
+
+					@Override
+					public void widgetSelected(SelectionEvent arg0) {
+						fillDisplayArea(0, nLinePerPage - 1);
+					}
+				});
+
+				// [<]
+				navigationArea.addPreviousListener(new SelectionListener() {
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {
+					}
+
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						int top = topLine - nLinePerPage;
+						if (top < 0)
+							top = 0;
+						int bottom = top + nLinePerPage -1 ;
+						fillDisplayArea(top, bottom);
+					}
+				});
+
+				// [>]
+				navigationArea.addNextListener(new SelectionListener() {
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {
+					}
+
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						fillDisplayArea(bottomLine + 1, bottomLine + nLinePerPage);
+					}
+				});
+
+				// [>|]
+				navigationArea.addLastListener(new SelectionListener() {
+					@Override
+					public void widgetDefaultSelected(SelectionEvent e) {
+					}
+
+					@Override
+					public void widgetSelected(SelectionEvent e) {
+						int top = (concordance.getNLines()/nLinePerPage)*nLinePerPage;
+						int bottom = top + nLinePerPage -1 ;
+						fillDisplayArea(top, bottom);
+						//fillDisplayArea(concordance.getNLines() - 1 - nLinePerPage,concordance.getNLines() - 1);
+					}
+				});
+		hideBtn = new Button(navigationPanel, SWT.PUSH);
+		hideBtn.setText(Messages.ConcordancesEditor_38);
+		hideBtn.addSelectionListener(new SelectionListener() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				if (isSetupShown) { // must hide
+					//System.out.println("hide");
+					hideBtn.setText(Messages.ConcordancesEditor_39);
+					querySize = queryArea.getSize();
+					//queryArea.setVisible(false);
+					Point size = controlArea.getSize();
+					controlArea.setSize(size.x, size.y - querySize.y);
+					queryArea.setSize(0,0);
+					GridData data = (GridData) queryArea.getLayoutData();
+					data.heightHint = 0;
+					data.minimumHeight = 0;
+					controlArea.layout(true);
+					isSetupShown = false;
+					parent.layout();
+				} else {
+					//System.out.println("show");
+					hideBtn.setText(Messages.ConcordancesEditor_38);
+					//queryArea.setVisible(true);
+					Point size = controlArea.getSize();
+					controlArea.setSize(size.x, size.y + querySize.y);
+					GridData data = (GridData) queryArea.getLayoutData();
+					data.heightHint = querySize.y;
+					data.minimumHeight = querySize.y;
+					queryArea.setSize(querySize);
+					controlArea.layout(true);
+					isSetupShown = true;
+					parent.layout();
+				}
+			}
+
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {	}
+		});
+
+		//		List<String> krnames = corpus.getKnowledgeRepositoryNames();
+		//		if (krnames==null){
+		//			System.out.println("Corpus "+corpus.getName()+" has no KR ");
+		//		}else {
+		//			
+		//			for(String krname : krnames){
+		//				System.out.println("Corpus "+corpus.getName()+" has KR "+krname);
+		//			}
+		//		}
+
+		queryArea.layout();
+		if (complexsorter != null)
+			complexsorter.setComparators(this);
+	}
+
+	/**
+	 * Computes the concordance and fills the display area with the specified lines range.
+	 * @param top
+	 * @param bottom
+	 */
+	public void compute(int top, int bottom, boolean fillDisplay) {
+		StatusLine.setMessage(Messages.ConcordancesEditor_56);
+		Query query = new Query(queryWidget.getQueryString());
+
+		String cql_limit = null;
+		if (cqlSeparator != null) cql_limit = cqlSeparator.getText();
+		if (cql_limit != null && cql_limit.trim().length() == 0) cql_limit = null;
+		if (cql_limit == null) cql_limit = corpus.getCQLLimitQuery();
+
+		//if (true)// concordance==null || concordance.getQuery()!=query)
+		try {
+			JobsTimer.start();
+			Concordance oldConcordance = concordance;
+			System.out.println(NLS.bind(Messages.ConcordancesEditor_5, query.getQueryString(), corpus.getName()));
+			concordance = new Concordance(corpus, query,
+					selectedLeftSortProperties, 
+					selectedRightSortProperties,
+					selectedKeywordSortProperties,
+					selectedLeftViewProperties,
+					selectedRightViewProperties,
+					selectedKeywordViewProperties,
+					getViewReferencePattern(),
+					getSortReferencePattern(),
+					leftContextSize, rightContextSize);
+
+			concordance.setCQLSeparator(cql_limit);
+
+			if (annotationArea != null) {
+				AnnotationType type = getSelectedAnnotationType();
+				if (type != null) {
+					concordance.setViewAnnotation(type);
+					concordance.setAnnotationOverlap(true);
+				}
+			}
+			StatusLine.setMessage(NLS.bind(Messages.ConcordancesEditor_19, concordance.getNLines()));
+			if (concordance.getNLines() == 1)
+				System.out.println(Messages.ConcordancesEditor_52);
+			else if (concordance.getNLines() > 0)
+				System.out.println(NLS.bind(Messages.ConcordancesEditor_19, concordance.getNLines()));
+			else
+				System.out.println(TXMCoreMessages.COMPUTE_DONE_NO_RESULT);
+
+			if (oldConcordance != null) {
+				corpus.removeResult(oldConcordance);
+				oldConcordance.clean(); // drop the CQP corpus
+			}
+			//corpus.addResult(concordance);
+
+			CorporaView.refresh();
+			CorporaView.expand(corpus);
+			QueriesView.refresh();
+			//FIXME: the call below doesn't work
+			//RVariablesView.refresh();
+
+			if (fillDisplay) {
+				fillDisplayArea(top, bottom);
+			}
+
+			setPartName(concordance.getName());
+			queryWidget.memorize();
+
+			resetColumnWidths();
+
+			updateAnnotationWidgetStates();
+			JobsTimer.stopAndPrint();
+
+
+			((ConcordanceEditorInput)this.getEditorInput()).setResult(concordance);
+
+			JobsTimer.stopAndPrint();
+
+		} catch (Exception e1) {
+			System.err.println(Messages.CorporaView_3+" "+Log.toString(e1)); //$NON-NLS-1$
+			//System.err.println(Messages.CorporaView_3);
+			org.txm.rcp.utils.Logger.printStackTrace(e1);
+			try {
+				System.out.println(Messages.LastCQPError+Toolbox.getCqiClient().getLastCQPError());
+				Log.severe(Messages.LastCQPError+Toolbox.getCqiClient().getLastCQPError());
+			} catch (Exception e2) {
+				System.out.println(Messages.ConcordancesEditor_7+e2);
+				org.txm.rcp.utils.Logger.printStackTrace(e1);
+				Log.severe(Log.toString(e1));
+			}
+			
+		}
+	}
+
+
+	/**
+	 * Computes the concordance and fills the display area with lines range corresponding to the first page.
+	 */
+	public void compute() {
+		this.compute(true);
+	}
+
+	/**
+	 * Computes the concordance and fills the display area with lines range corresponding to the first page.
+	 * @param fillDisplay
+	 */
+	public void compute(boolean fillDisplay) {
+		this.compute(0, nLinePerPage - 1, fillDisplay);
+	}
+
+	/**
+	 * Sets the line per page.
+	 *
+	 * @param nb the new line per page
+	 */
+	public void setLinePerPage(int nb) {
+		this.nLinePerPage = nb;
+	}
+
+	/**
+	 * Gets the line per page.
+	 *
+	 * @return the line per page
+	 */
+	public int getLinePerPage() {
+		return nLinePerPage;
+	}
+
+	/**
+	 * Update view properties label.
+	 */
+	void updateViewPropertiesLabel() {
+		StringBuffer buffer = new StringBuffer();
+		Iterator<Property> it = selectedKeywordViewProperties.iterator();
+		if (it.hasNext())
+			buffer.append(it.next().getName());
+		while (it.hasNext())
+			buffer.append("_" + it.next().getName()); //$NON-NLS-1$
+		viewPropertiesLabel.setText(buffer.toString());
+		viewPropertiesLabel.getParent().layout();
+		viewPropertiesLabel.update();
+		queryArea.layout();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.EditorPart#getTitleToolTip()
+	 */
+	@Override
+	public String getTitleToolTip() {
+		if (concordance != null) {
+			StringBuffer buf = new StringBuffer();
+			buf.append("Concordance:\n"); //$NON-NLS-1$
+			buf.append("\tCorpus: " + corpus.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			buf
+			.append("\tQuery: " + concordance.getQuery().getQueryString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			buf
+			.append("\tView properties: " + viewPropertiesLabel.getText() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			buf
+			.append("\tLeft Context Sort property: " + selectedLeftSortProperties + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			buf
+			.append("\tKeyword Sort property: " + selectedKeywordSortProperties + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			buf
+			.append("\right Context Sort property: " + selectedRightSortProperties + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			buf.append("\tReference View Pattern: " + refViewPattern + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			buf.append("\tReference Sort Pattern: " + refSortPattern + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
+			return buf.toString();
+		}
+		return ""; //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets the reference pattern.
+	 *
+	 * @return the reference pattern
+	 */
+	ReferencePattern getViewReferencePattern() {
+		return refViewPattern;
+	}
+
+	/**
+	 * Gets the reference pattern.
+	 *
+	 * @return the reference pattern
+	 */
+	ReferencePattern getSortReferencePattern() {
+		return refSortPattern;
+	}
+
+	/**
+	 * Sets the left sort properties.
+	 *
+	 * @param list the new left sort properties
+	 */
+	public void setLeftSortProperties(List<Property> list) {
+		this.selectedLeftSortProperties = list;
+	}
+
+	/**
+	 * Sets the keyword sort properties.
+	 *
+	 * @param list the new keyword sort property
+	 */
+	public void setKeywordSortProperties(List<Property> list) {
+		this.selectedKeywordSortProperties = list;
+		if (concordance != null) {
+			try {
+				concordance.setAnalysisProperty(list);
+			} catch (Exception e) {
+				System.err.println(NLS.bind(
+						Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE, e));
+			}
+			sort();
+		}
+	}
+
+	/**
+	 * Sets the right sort properties.
+	 *
+	 * @param list the new right sort properties
+	 */
+	public void setRightSortProperties(List<Property> list) {
+		this.selectedRightSortProperties = list;
+		if (concordance != null) {
+			try {
+				concordance.setAnalysisProperty(list);
+			} catch (Exception e) {
+				System.err.println(NLS.bind(
+						Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE, e));
+			}
+			sort();
+		}
+	}
+
+	/**
+	 * Sets the view reference pattern.
+	 *
+	 * @param referencePattern the new reference pattern
+	 */
+	public void setRefViewPattern(ReferencePattern referencePattern) {
+		this.refViewPattern = referencePattern;
+
+		if (concordance != null) {
+			concordance.setRefViewPattern(referencePattern);
+			//			int top = topLine;
+			//			int bottom = bottomLine;
+			//
+			sort();
+			//fillDisplayArea(top, bottom); // we return to the previously
+
+			// displayed page
+		}
+	}
+
+	/**
+	 * Sets the sort reference pattern.
+	 *
+	 * @param referencePattern the new reference pattern
+	 */
+	public void setRefSortPattern(ReferencePattern referencePattern) {
+		this.refSortPattern = referencePattern;
+
+		if (concordance != null) {
+			concordance.setRefAnalysePattern(referencePattern);
+			//			int top = topLine;
+			//			int bottom = bottomLine;
+			sort();
+			//fillDisplayArea(top, bottom); // we return to the previously
+			// displayed page
+		}
+	}
+
+	/**
+	 * Sets the context size.
+	 *
+	 * @param leftContextSize the left context size
+	 * @param rightContextSize the right context size
+	 */
+	public void setContextSize(int leftContextSize, int rightContextSize) {
+		this.leftContextSize = leftContextSize;
+		this.rightContextSize = rightContextSize;
+		if (concordance != null) {
+			concordance.setLeftContextSize(leftContextSize);
+			concordance.setRightContextSize(rightContextSize);
+			int top = topLine;
+			int bottom = bottomLine;
+			//sort();
+			fillDisplayArea(top, bottom); // we return to the previously
+			// displayed page
+		}
+	}
+
+	/**
+	 * Creates the context menu.
+	 */
+	private void createContextMenu() {
+		createActions();
+
+		// store the mouse position
+		viewer.getTable().addMouseListener(new MouseAdapter() {
+			@Override
+			public void mouseDown(MouseEvent arg0) {
+
+				if (arg0.button == 3)
+					mouseposition = new Point(arg0.x, arg0.y);
+				//				System.out.println("arg.x="+arg0.x);
+				//				System.out.println("arg.y="+arg0.y);
+				//				System.out.println("hbar: "+lineTableViewer.getTable().getHorizontalBar().getSelection());
+				//				System.out.println("vbar: "+lineTableViewer.getTable().getVerticalBar().getSelection());
+				//				System.out.println("Col: "+getPointedColumn());
+			}
+		});
+		MenuManager menuManager = new MenuManager(); //$NON-NLS-1$
+		Menu menu = menuManager.createContextMenu(viewer.getTable());
+		menuManager.setRemoveAllWhenShown(true);
+		menuManager.addMenuListener(new IMenuListener() {
+			@Override
+			public void menuAboutToShow(IMenuManager manager) {
+				IWorkbenchPartSite site = ConcordanceEditor.this.getSite();
+				site.getPage().activate(ConcordanceEditor.this);
+				// manager.add(computeCoocAction);
+
+				//manager.add(computeIndexAction);
+				manager.add(defineViewReferencePatternAction);
+				manager.add(defineSortReferencePatternAction);
+				manager.add(setViewPropertyAction);
+				manager.add(setSortPropertyAction);
+				manager.add(new Separator());
+				//manager.add(complexSortAction);
+				manager.add(setContextSizeAction);
+				//manager.add(resetColumnWidths); // don't work properly
+				manager.add(setLineNumberAction);
+				manager.add(new Separator());
+				//manager.add(backToTextAction);
+			}
+		});
+
+		//viewer.getTable().setMenu(menuManager.createContextMenu(viewer.getTable()));
+		viewer.getTable().setMenu(menu);
+		getSite().registerContextMenu(menuManager, viewer);
+		getSite().setSelectionProvider(viewer);
+	}
+
+	/**
+	 * Gets the mouse position.
+	 *
+	 * @return the mouse position
+	 */
+	private Point getMousePosition() {
+		return this.mouseposition;
+	}
+
+	/**
+	 * return the column under the mouse pointer.
+	 *
+	 * @return the pointed column
+	 */
+	public int getPointedColumn() {
+		int x = getMousePosition().x; // + lineTableViewer.getTable().get;
+		int sumWidthColumn = this.referenceColumn.getWidth();
+		if (x < sumWidthColumn)
+			return 0;
+
+		sumWidthColumn += this.leftContextColumn.getWidth();
+		if (x < sumWidthColumn)
+			return 1;
+
+		sumWidthColumn += this.keywordColumn.getWidth();
+		if (x < sumWidthColumn)
+			return 2;
+
+		sumWidthColumn += this.rightContextColumn.getWidth();
+		if (x < sumWidthColumn)
+			return 3;
+
+		return 0;
+	}
+
+	/**
+	 * Creates the actions.
+	 */
+	private void createActions() {
+		setSortPropertyAction = new SortPropertySelection(getSite()
+				.getWorkbenchWindow(), this, this.viewer);
+		setContextSizeAction = new SetContextSize(getSite()
+				.getWorkbenchWindow(), this);
+		//resetColumnWidths = new ResetColumnWidths(getSite().getWorkbenchWindow(), this);
+		setLineNumberAction = new SetLineNumber(getSite().getWorkbenchWindow(),
+				this);
+		defineViewReferencePatternAction = new DefineViewReferencePattern(getSite()
+				.getWorkbenchWindow(), this);
+		defineSortReferencePatternAction = new DefineSortReferencePattern(getSite()
+				.getWorkbenchWindow(), this);
+		setViewPropertyAction = new ViewPropertySelection(getSite()
+				.getWorkbenchWindow(), this, this.viewer);
+	}
+
+	/**
+	 * Gets the concordance.
+	 *
+	 * @return the concordance
+	 */
+	public Concordance getConcordance() {
+		return concordance;
+	}
+
+	/**
+	 * Gets the available sort properties.
+	 *
+	 * @return the available sort properties
+	 */
+	public List<Property> getAvailableSortProperties() {
+		return availableKeywordSortProperties;
+	}
+
+	/**
+	 * Gets the user defined comparators.
+	 *
+	 * @return the user defined comparators
+	 */
+	public List<LineComparator> getUserDefinedComparators() {
+		return userDefinedComparators;
+	}
+
+	/**
+	 * Sets the user defined comparators.
+	 *
+	 * @param userDefinedComparators the new user defined comparators
+	 */
+	public void setUserDefinedComparators(
+			List<LineComparator> userDefinedComparators) {
+		this.userDefinedComparators = userDefinedComparators;
+	}
+
+	/**
+	 * Sets the current comparator.
+	 *
+	 * @param comparator the new current comparator
+	 */
+	public void setCurrentComparator(LineComparator comparator) {
+		this.currentComparator = comparator;
+	}
+
+	/**
+	 * Gets the standard comparators.
+	 *
+	 * @return the standard comparators
+	 */
+	public List<LineComparator> getStandardComparators() {
+		return standardComparators;
+	}
+
+	/**
+	 * Gets the top line.
+	 *
+	 * @return the top line
+	 */
+	public int getTopLine() {
+		return topLine;
+	}
+
+	/**
+	 * Gets the bottom line.
+	 *
+	 * @return the bottom line
+	 */
+	public int getBottomLine() {
+		return bottomLine;
+	}
+
+	/**
+	 * Gets the left context size.
+	 *
+	 * @return the left context size
+	 */
+	public int getLeftContextSize() {
+		return leftContextSize;
+	}
+
+	/**
+	 * Gets the right context size.
+	 *
+	 * @return the right context size
+	 */
+	public int getRightContextSize() {
+		return rightContextSize;
+	}
+
+	/**
+	 * Gets the corpus.
+	 *
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return corpus;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
+	 */
+	@Override
+	public void setFocus() {
+		if (this.queryWidget == null) return;
+		this.queryWidget.setFocus();
+	}
+
+	/**
+	 * refresh column display accordingly to the views properties.
+	 */
+	private void refreshViewProperties() {
+		if (concordance != null) {
+			concordance.setViewProperties(
+					selectedLeftViewProperties,
+					selectedRightViewProperties,
+					selectedKeywordViewProperties);
+			sort();
+			//fillDisplayArea(topLine, bottomLine);
+		}
+	}
+
+	/**
+	 * Refresh sort properties.
+	 */
+	private void refreshSortProperties() {
+		if (concordance != null) {
+			try {
+				concordance.setLeftAnalysisProperties(selectedLeftSortProperties);
+				concordance.setRightAnalysisProperties(selectedRightSortProperties);
+				concordance.setKeywordAnalysisProperties(selectedKeywordSortProperties);
+			} catch (Exception e) {
+				System.err.println(NLS.bind(
+						Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE, e));
+			}
+			sort();
+		}
+	}
+
+	/**
+	 * Sets the left c view properties.
+	 *
+	 * @param selectedViewProperties the new left c view properties
+	 */
+	public void setLeftViewProperties(List<Property> selectedViewProperties) {
+		this.selectedLeftViewProperties = selectedViewProperties;
+		refreshViewProperties();
+	}
+
+	/**
+	 * Sets the right c view properties.
+	 *
+	 * @param selectedViewProperties the new right c view properties
+	 */
+	public void setRightViewProperties(List<Property> selectedViewProperties) {
+		this.selectedRightViewProperties = selectedViewProperties;
+		refreshViewProperties();
+	}
+
+	/**
+	 * Sets the keyword view properties.
+	 *
+	 * @param selectedViewProperties the new keyword view properties
+	 */
+	public void setKeywordViewProperties(List<Property> selectedViewProperties) {
+		this.selectedKeywordViewProperties = selectedViewProperties;
+		refreshViewProperties();
+		updateViewPropertiesLabel();
+	}
+
+	/**
+	 * Refresh reference column title.
+	 */
+	public void refreshReferenceColumnTitle()
+	{
+		if (refViewPattern == null) {
+			referenceColumn.setText(Messages.ConcordancesEditor_1);
+		} else if (refViewPattern.getProperties().size() == 0) {
+			referenceColumn.setText(Messages.ConcordancesEditor_1);
+		} else {
+			referenceColumn.setText(refViewPattern.getTitle());
+		}
+	}
+
+	/**
+	 * Gets the selected left c view properties.
+	 *
+	 * @return the selected left c view properties
+	 */
+	public List<Property> getSelectedLeftViewProperties() {
+		return this.selectedLeftViewProperties;
+	}
+
+	/**
+	 * Gets the selected keyword view properties.
+	 *
+	 * @return the selected keyword view properties
+	 */
+	public List<Property> getSelectedKeywordViewProperties() {
+		return this.selectedKeywordViewProperties;
+	}
+
+	/**
+	 * Gets the selected right c view properties.
+	 *
+	 * @return the selected right c view properties
+	 */
+	public List<Property> getSelectedRightViewProperties() {
+		return this.selectedRightViewProperties;
+	}
+
+	/**
+	 * Gets the selected left c sort properties.
+	 *
+	 * @return the selected left c sort properties
+	 */
+	public List<Property> getSelectedLeftSortProperties() {
+		return this.selectedLeftSortProperties;
+	}
+
+	/**
+	 * Gets the selected keyword sort properties.
+	 *
+	 * @return the selected keyword sort properties
+	 */
+	public List<Property> getSelectedKeywordSortProperties() {
+		return this.selectedKeywordSortProperties;
+	}
+
+	/**
+	 * Gets the selected right c sort properties.
+	 *
+	 * @return the selected right c sort properties
+	 */
+	public List<Property> getSelectedRightSortProperties() {
+		return this.selectedRightSortProperties;
+	}
+
+	/**
+	 * Gets the available left c view properties.
+	 *
+	 * @return the available left c view properties
+	 */
+	public List<Property> getAvailableLeftViewProperties() {
+		return availableLeftViewProperties;
+	}
+
+	/**
+	 * Gets the available keyword view properties.
+	 *
+	 * @return the available keyword view properties
+	 */
+	public List<Property> getAvailableKeywordViewProperties() {
+		return availableKeywordViewProperties;
+	}
+
+	/**
+	 * Gets the available right c view properties.
+	 *
+	 * @return the available right c view properties
+	 */
+	public List<Property> getAvailableRightViewProperties() {
+		return availableRightViewProperties;
+	}
+
+	/**
+	 * Gets the available left sort properties.
+	 *
+	 * @return the available left sort properties
+	 */
+	public List<Property> getAvailableLeftSortProperties() {
+		return availableLeftSortProperties;
+	}
+
+	/**
+	 * Gets the available keyword sort properties.
+	 *
+	 * @return the available keyword sort properties
+	 */
+	public List<Property> getAvailableKeywordSortProperties() {
+		return availableKeywordSortProperties;
+	}
+
+	/**
+	 * Gets the available right sort properties.
+	 *
+	 * @return the available right sort properties
+	 */
+	public List<Property> getAvailableRightSortProperties() {
+		return availableRightSortProperties;
+	}
+
+	/**
+	 * Gets the selected references.
+	 *
+	 * @return the selected references
+	 */
+	public List<Property> getSelectedViewReferences() {
+		return refViewPattern.getProperties();
+	}
+
+	/**
+	 * Gets the selected references.
+	 *
+	 * @return the selected references
+	 */
+	public List<Property> getSelectedSortReferences() {
+		return refSortPattern.getProperties();
+	}
+
+	/**
+	 * Gets the line table viewer.
+	 *
+	 * @return the line table viewer
+	 */
+	public TableViewer getLineTableViewer() {
+		return viewer;
+	}
+
+	/**
+	 * Reset sorted column.
+	 *
+	 * @param col the col
+	 */
+	public void resetSortedColumn(int col) {
+		switch(col) {
+		case 1://keyword
+			viewer.getTable().setSortColumn(this.keywordColumn);
+			viewer.getTable().setSortDirection(SWT.DOWN);
+			break;
+		case 2://left
+			viewer.getTable().setSortColumn(this.leftContextColumn);
+			viewer.getTable().setSortDirection(SWT.DOWN);
+			break;
+		case 3://right
+			viewer.getTable().setSortColumn(this.rightContextColumn);
+			viewer.getTable().setSortDirection(SWT.DOWN);
+			break;
+		case 4://references
+			viewer.getTable().setSortColumn(this.referenceColumn);
+			viewer.getTable().setSortDirection(SWT.DOWN);
+			break;
+		default:
+			viewer.getTable().setSortColumn(null);
+			viewer.getTable().setSortDirection(SWT.NONE);
+		}
+
+	}
+
+	/*
+	/**
+	 * Back to text.
+
+	@SuppressWarnings("restriction") //$NON-NLS-1$
+	public void backToText() {
+		try {
+			StructuredSelection select = (StructuredSelection) viewer.getSelection();
+			if (select == null) return;
+			Line line = (Line) select.getFirstElement();
+			if (line == null) return;
+
+			StructuralUnit textS = null;
+			textid = ""; //$NON-NLS-1$
+			String baseid = ""; //$NON-NLS-1$
+
+			String projectid = ""; //$NON-NLS-1$
+			try {
+				textS = corpus.getStructuralUnit("text"); //$NON-NLS-1$
+				Property textP = textS.getProperty("id"); //$NON-NLS-1$
+				textid = line.getMatch().getValueForProperty(textP);// get text via text struc property id
+				// Log.info("Corpus' base ("+baseid+") : "+corpus.getParent());
+			} catch (Exception e2) {
+				System.out.println(Messages.ConcordancesEditor_8);
+				org.txm.rcp.utils.Logger.printStackTrace(e2);
+				return;
+			}
+
+			Log.info(Messages.ConcordancesEditor_20);
+
+			final List<String> wordids = concordance.getKeywordsId(
+					textid, getTopLine(), getBottomLine() + 1);
+
+			lineids = null;
+			try {
+				lineids = line.getMatch().getValuesForProperty(
+						corpus.getProperty("id")); //$NON-NLS-1$
+			} catch (Exception e1) {
+				org.txm.rcp.utils.Logger.printStackTrace(e1);
+				return;
+			}
+			Log.info(NLS.bind(Messages.ConcordancesEditor_26, 
+					new Object[]{projectid, baseid, textid}));
+
+			Text text = corpus.getMainCorpus().getText(textid);
+			if (text == null) {
+				System.out.println(NLS.bind(Messages.ConcordancesEditor_27, textid));
+				StatusLine.setMessage(NLS.bind(Messages.ConcordancesEditor_27, textid));
+				Log.severe(NLS.bind(Messages.ConcordancesEditor_27, textid));
+				return;
+			}
+
+			Edition edition = text.getEdition(corpus.getMainCorpus().getDefaultEdition()); 
+			if (edition == null) {
+				System.out.println(Messages.ConcordancesEditor_30);
+				StatusLine.setMessage(Messages.ConcordancesEditor_30);
+				Log.severe(Messages.ConcordancesEditor_30);
+				return;
+			}
+
+			String line_wordid = lineids.get(0);
+			if (line_wordid == null) {
+				System.out.println(Messages.ConcordancesEditor_9+edition+Messages.ConcordancesEditor_10);
+				return;				
+			}
+			openedPage = edition.getPageForWordId(line_wordid);
+			if (openedPage != null) {
+				// System.out.println(page.getFile());
+				if (attachedBrowserEditor == null || attachedBrowserEditor.isDisposed()) {
+					attachedBrowserEditor = OpenBrowser.openEdition(openedPage.getFile().getAbsolutePath(), openedPage.getFile().getName());
+					if (attachedBrowserEditor != null) {
+						attachedBrowserEditor.setEdition(edition);
+					} else {
+						System.out.println("Fail to create Edition editor.");
+						return;
+					}
+				}
+
+				if (attachedBrowserEditor != null) {
+					attachedBrowserEditor.showPage(openedPage);
+					attachedBrowserEditor.setWordsIds(wordids, lineids);
+
+					IWorkbenchPage attachedPage = attachedBrowserEditor.getEditorSite().getPage();
+					attachedPage.activate(attachedBrowserEditor);
+				}
+			} else
+				System.out.println(NLS.bind(Messages.ConcordancesEditor_29, wordids.get(0)));
+		} catch (Exception err) {
+			Log.severe(NLS.bind(Messages.ConcordancesEditor_46, err));
+			Log.printStackTrace(err);
+		}
+	}
+	 */
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setName(java.lang.String)
+	 */
+	@Override
+	public void setName(String name) {
+		this.setPartName(name);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setIcon(org.eclipse.swt.graphics.Image)
+	 */
+	@Override
+	public void setIcon(Image image) {
+		this.setTitleImage(image);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.commands.editor.CustomizableEditor#setSource(java.lang.Object)
+	 */
+	@Override
+	public void setSource(Object source)
+	{
+		//this.source = source;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.txm.rcp.commands.editor.CustomizableEditor#getSource()
+	 */
+	@Override
+	public Object getSource() {
+		return concordance;
+	}
+
+	/**
+	 * Gets the current comparator used for sorting lines.
+	 * @return the currentComparator
+	 */
+	public LineComparator getCurrentComparator() {
+		return currentComparator;
+	}
+
+	/**
+	 * Gets the number of pages.
+	 * @return
+	 */
+	public int getPagesCount()	{
+		return (int) Math.ceil(((double)this.concordance.getNLines() / this.nLinePerPage));
+	}
+
+
+	@Override
+	public Object toConcordance() { return null;}
+	@Override
+	public Object toIndex() { return null;}
+	@Override
+	public Object toProgression() { return null;}
+
+	public void setQuery(String query) {
+		queryWidget.setText(query);
+	}
+
+
+	private static final String BACKTOTEXT_COMMAND_ID = "org.txm.rcp.extensionpoint.backtotext"; //$NON-NLS-1$
+	/**
+	 * Open the edition for the selected line.
+	 * The command used to show the edition is an EditionBackToText Extension
+	 */
+	public boolean backToText() {
+
+		StructuredSelection select = (StructuredSelection) viewer.getSelection();
+		if (select == null) return false;
+		Line line = (Line) select.getFirstElement();
+		if (line == null) return false;
+
+		try {
+			IConfigurationElement[] config = Platform.getExtensionRegistry()
+					.getConfigurationElementsFor(BACKTOTEXT_COMMAND_ID);
+			for (IConfigurationElement e : config) {
+				Object o = e.createExecutableExtension(Messages.ConcordancesEditor_78);
+				if (o instanceof BackToTextCommand) {
+					return ((BackToTextCommand) o).backToText(this, line);
+				}
+			}
+		} catch (CoreException e1) {
+			e1.printStackTrace();
+		}
+
+		// Last resort edition
+		InternalViewEditorInput editorInput = new InternalViewEditorInput(corpus, null);
+
+		IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
+		try {
+			StatusLine.setMessage(Messages.ComputeReferencer_0);
+			InternalViewEditor editor = (InternalViewEditor)page.openEditor(editorInput,"org.txm.rcp.editors.internal.InternalViewEditor"); //$NON-NLS-1$
+			editor.backToText(line);
+			SWTEditorsUtils.addEditor(this, editor, EModelService.ABOVE);
+		} catch (PartInitException e) {
+			System.err.println(Messages.CorporaView_6+ e);
+		}
+
+		return false;
+
+		//		try {
+		//			StructuredSelection select = (StructuredSelection) viewer.getSelection();
+		//			if (select == null) return;
+		//			Line line = (Line) select.getFirstElement();
+		//			if (line == null) return;
+		//			org.txm.rcp.synoptic.commands.BackToText.backToText(line);
+		//		} catch(Exception err) {
+		//			System.out.println("Error while calling backtotext: "+err);
+		//			Log.printStackTrace(err);
+		//		}
+	}
+
+	public boolean isAnnotationEnable() {
+		return annotationArea != null;
+	}
+
+	public void resetColumnWidths() {
+
+		//		tableLayout.setColumnData(referenceColumn, new ColumnWeightData(10, true)); 
+		//		tableLayout.setColumnData(leftContextColumn, new ColumnWeightData(50, true));  
+		//		tableLayout.setColumnData(keywordColumn, new ColumnWeightData(10, true)); 
+		//		tableLayout.setColumnData(rightContextColumn, new ColumnWeightData(50, true));  
+		if (annotationArea != null) {
+			annotationColumn.pack();
+
+			annotationColumn.setResizable(true);
+			//			tableLayout.setColumnData(annotationColumn, new ColumnWeightData(10, true));
+		} else { 
+			annotationColumn.setWidth(0);
+			//			tableLayout.setColumnData(annotationColumn, new ColumnWeightData(0, false));
+		}
+
+		referenceColumn.pack();
+		leftContextColumn.pack();
+		keywordColumn.pack();
+		rightContextColumn.pack();
+
+		//viewer.getTable().layout(true, true);
+	}
+
+	@Override
+	public boolean usingCorpus(Corpus corpus) {
+		return this.corpus.getName().equals(corpus.getName());
+	}
+
+	@Override
+	public boolean updateCorpus(Corpus corpus) {
+		ConcordanceEditorInput input = (ConcordanceEditorInput) this.getEditorInput();
+		input.setCorpus(corpus);
+		input.setResult(null);
+		initializeEditor();
+		return true;
+	}
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditorInput.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditorInput.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditorInput.java	(revision 363)
@@ -0,0 +1,107 @@
+// 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.concordance.rcp.editors;
+
+import org.txm.concordance.core.functions.Concordance;
+import org.txm.rcp.editors.TXMResultEditorInput;
+import org.txm.searchengine.cqp.corpus.Corpus;
+
+/**
+ * Concordance result editor input.
+ * @author sjacquot
+ *
+ */
+public class ConcordanceEditorInput extends TXMResultEditorInput {
+
+	/** The corpus. */
+	private Corpus corpus;
+	
+	/**
+	 * Instantiates a new concordances editor input.
+	 *
+	 * @param corpus the corpus
+	 * @param concordance the concordance
+	 */
+	public ConcordanceEditorInput(Corpus corpus, Concordance concordance) {
+		super(concordance);
+		if (concordance != null)	{
+			this.corpus = concordance.getCorpus();
+		}
+		else	{
+			this.corpus = corpus;
+		}
+	}
+
+	/**
+	 * 
+	 * @param corpus
+	 */
+	public ConcordanceEditorInput(Corpus corpus) {
+		this(corpus, null);
+	}
+	
+	/**
+	 * Gets the corpus.
+	 *
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return corpus;
+	}
+
+	/**
+	 * Gets the concordance.
+	 *
+	 * @return the concordance
+	 */
+	public Concordance getConcordance() {
+		return (Concordance) this.result;
+	}
+
+	/**
+	 * 
+	 * @param newCorpus
+	 */
+	public void setCorpus(Corpus newCorpus) {
+		this.corpus = newCorpus;
+	}
+
+	@Deprecated
+	public void setConcordance(Concordance conc) {
+		this.result = conc;
+	}
+	
+	@Override
+	public boolean equals(Object obj)	{
+		if(obj instanceof ConcordanceEditorInput)	{
+			return this.result == ((ConcordanceEditorInput) obj).getConcordance()
+					&& (this.result != null && ((ConcordanceEditorInput) obj).getConcordance() != null && this.getConcordance().getQuery() == ((ConcordanceEditorInput) obj).getConcordance().getQuery());
+		}
+		return false;
+	}
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/CompositeSorterCreationDialog.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/CompositeSorterCreationDialog.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/CompositeSorterCreationDialog.java	(revision 363)
@@ -0,0 +1,225 @@
+// 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.concordance.rcp.editors;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.txm.concordance.core.functions.comparators.LineComparator;
+import org.txm.rcp.Messages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * dialog box used to define the complex sort @ author mdecorde.
+ */
+public class CompositeSorterCreationDialog extends Dialog {
+
+	/** The available comparators. */
+	final private List<LineComparator> availableComparators;
+	
+	/** The selected comparators. */
+	final private List<LineComparator> selectedComparators;
+	
+	/** The name text. */
+	private Text nameText;
+	
+	/** The name. */
+	private String name;
+
+	/**
+	 * Instantiates a new composite sorter creation dialog.
+	 *
+	 * @param parentShell the parent shell
+	 * @param availableComparators the available comparators
+	 */
+	protected CompositeSorterCreationDialog(IShellProvider parentShell,
+			List<LineComparator> availableComparators) {
+		super(parentShell);
+		this.availableComparators = new ArrayList<LineComparator>(
+				availableComparators);
+		this.selectedComparators = new ArrayList<LineComparator>();
+	}
+
+	/**
+	 * Gets the name.
+	 *
+	 * @return the name
+	 */
+	public String getName() {
+		return name;
+	}
+
+	/**
+	 * Gets the comparators.
+	 *
+	 * @return the comparators
+	 */
+	public List<LineComparator> getComparators() {
+		return selectedComparators;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+	 */
+	@Override
+	protected void configureShell(Shell newShell) {
+		super.configureShell(newShell);
+		newShell.setText(Messages.ComplexSort_5);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		Composite mainArea = new Composite(parent, SWT.NONE);
+		GridLayout layout = new GridLayout(4, false);
+		mainArea.setLayout(layout);
+
+		Label nameLabel = new Label(mainArea, SWT.NONE);
+		nameLabel.setText(Messages.ComplexSort_6);
+
+		nameText = new Text(mainArea, SWT.NONE);
+		GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+		gridData.horizontalSpan = 3;
+		nameText.setLayoutData(gridData);
+
+		final org.eclipse.swt.widgets.List availbleItems = new org.eclipse.swt.widgets.List(
+				mainArea, SWT.BORDER | SWT.V_SCROLL);
+		for (LineComparator comparator : availableComparators) {
+			availbleItems.add(comparator.getName());
+		}
+		gridData = new GridData(GridData.FILL, GridData.FILL, true, false);
+		Point size = availbleItems.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+		gridData.widthHint = size.x;
+		availbleItems.setLayoutData(gridData);
+
+		Composite selectionButtons = new Composite(mainArea, SWT.NONE);
+		selectionButtons.setLayout(new GridLayout(1, false));
+		Button select = new Button(selectionButtons, SWT.ARROW | SWT.RIGHT);
+		Button unselect = new Button(selectionButtons, SWT.ARROW | SWT.LEFT);
+
+		final org.eclipse.swt.widgets.List selectedItems = new org.eclipse.swt.widgets.List(
+				mainArea, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+		selectedItems.setLayoutData(gridData);
+
+		Composite orderButtons = new Composite(mainArea, SWT.NONE);
+		orderButtons.setLayout(new GridLayout(1, false));
+		Button up = new Button(orderButtons, SWT.ARROW | SWT.UP);
+		Button down = new Button(orderButtons, SWT.ARROW | SWT.DOWN);
+
+		select.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int ind = availbleItems.getSelectionIndex();
+				selectedItems.add(availbleItems.getItem(ind));
+				availbleItems.remove(ind);
+				selectedComparators.add(availableComparators.get(ind));
+				availableComparators.remove(ind);
+				availbleItems.setSelection(ind);
+			}
+		});
+
+		unselect.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int ind = selectedItems.getSelectionIndex();
+				availbleItems.add(selectedItems.getItem(ind));
+				selectedItems.remove(ind);
+				availableComparators.add(selectedComparators.get(ind));
+				selectedComparators.remove(ind);
+				selectedItems.setSelection(ind);
+			}
+		});
+
+		up.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int ind = selectedItems.getSelectionIndex();
+				if (ind > 0) {
+					selectedItems.add(selectedItems.getItem(ind), ind - 1);
+					selectedItems.remove(ind + 1);
+					selectedComparators.add(selectedComparators.get(ind - 1));
+					selectedComparators.remove(ind + 1);
+					selectedItems.setSelection(ind - 1);
+				}
+			}
+		});
+
+		down.addSelectionListener(new SelectionAdapter() {
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				int ind = selectedItems.getSelectionIndex();
+				if (ind < selectedItems.getItemCount() - 1) {
+					selectedItems.add(selectedItems.getItem(ind), ind + 2);
+					selectedItems.remove(ind);
+					selectedComparators.add(selectedComparators.get(ind + 2));
+					selectedComparators.remove(ind);
+					selectedItems.setSelection(ind + 2);
+				}
+			}
+		});
+		return mainArea;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		if (nameText.getText().equals("")) { //$NON-NLS-1$
+			MessageDialog.openError(getShell(),
+					Messages.CreateSubcorpusDialog_11,
+					Messages.ComplexSort_9);
+			return;
+		}
+		name = nameText.getText();
+		if (selectedComparators.size() < 2) {
+			MessageDialog.openError(getShell(),
+					Messages.ComplexSort_10,
+					Messages.ComplexSort_11);
+			return;
+		}
+		super.okPressed();
+	}
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ReferenceLabelProvider.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ReferenceLabelProvider.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ReferenceLabelProvider.java	(revision 363)
@@ -0,0 +1,102 @@
+// 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.concordance.rcp.editors;
+
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Image;
+import org.txm.concordance.core.functions.Line;
+import org.txm.rcp.Messages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ReferenceLabelProvider.
+ *
+ * @deprecated @ author mdecorde
+ */
+@Deprecated
+public class ReferenceLabelProvider extends LabelProvider implements
+		ITableLabelProvider {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
+	 */
+	@Override
+	public Image getColumnImage(Object element, int columnIndex) {
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
+	 */
+	@Override
+	public String getColumnText(Object element, int columnIndex) {
+		if (columnIndex != 0)
+			throw new RuntimeException(Messages.LineLabelProvider_1);
+		Line line = (Line) element;
+		return line.getViewRef().toString();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.BaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
+	 */
+	@Override
+	public void addListener(ILabelProviderListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.BaseLabelProvider#dispose()
+	 */
+	@Override
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.BaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
+	 */
+	@Override
+	public boolean isLabelProperty(Object element, String property) {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.viewers.BaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
+	 */
+	@Override
+	public void removeListener(ILabelProviderListener listener) {
+		// TODO Auto-generated method stub
+
+	}
+
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ViewAnnotationSelectionDialog.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ViewAnnotationSelectionDialog.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ViewAnnotationSelectionDialog.java	(revision 363)
@@ -0,0 +1,109 @@
+// 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.concordance.rcp.editors;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+// TODO: Auto-generated Javadoc
+/**
+ * the dialog box called to select the view properties @ author mdecorde.
+ */
+public class ViewAnnotationSelectionDialog extends Dialog {
+
+	
+	/**
+	 * Instantiates a new view property selection dialog.
+	 *
+	 * @param parentShell the parent shell
+	 * @param availableProperties the available properties
+	 * @param selectedProperties the selected properties
+	 */
+	public ViewAnnotationSelectionDialog(IShellProvider parentShell) {
+		super(parentShell);
+
+		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
+	}
+
+	/**
+	 * Instantiates a new view property selection dialog.
+	 *
+	 * @param shell the shell
+	 * @param availableProperties the available properties
+	 * @param selectedProperties the selected properties
+	 */
+	public ViewAnnotationSelectionDialog(Shell shell) {
+		super(shell);
+
+		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
+	}
+
+	
+
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+	 */
+	@Override
+	protected void configureShell(Shell newShell) {
+		super.configureShell(newShell);
+		//newShell.setText(Messages.ViewPropertySelectionDialog_0);
+		newShell.setText("A VOIR");
+		newShell.setMinimumSize(200, 100);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createDialogArea(Composite parent) {
+		// parent.setLayout(new FormLayout());
+		Composite mainArea = new Composite(parent, SWT.NONE);
+		mainArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+		return mainArea;
+	}
+
+
+	
+	
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+		
+	}
+
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordancesProvider.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordancesProvider.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordancesProvider.java	(revision 363)
@@ -0,0 +1,82 @@
+// 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.concordance.rcp.editors;
+
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.txm.concordance.core.functions.Line;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The IStructuredContentProvider used by the reference and line tables.
+ *
+ * @author jmague
+ */
+public class ConcordancesProvider implements IStructuredContentProvider {
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java
+	 * .lang.Object)
+	 */
+	@Override
+	public Object[] getElements(Object inputElement) {
+		@SuppressWarnings("unchecked") //$NON-NLS-1$
+		List<Line> lines = (List<Line>) inputElement;
+		return lines.toArray();
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+	 */
+	@Override
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see
+	 * org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface
+	 * .viewers.Viewer, java.lang.Object, java.lang.Object)
+	 */
+	@Override
+	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+		// TODO Auto-generated method stub
+
+	}
+
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineViewReferencePattern.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineViewReferencePattern.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineViewReferencePattern.java	(revision 363)
@@ -0,0 +1,383 @@
+// 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.concordance.rcp.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.functions.ReferencePattern;
+import org.txm.rcp.Messages;
+import org.txm.rcp.editors.parabrowser.ParaBrowserEditor;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+// TODO: Auto-generated Javadoc
+/**
+ * Action to build the reference pattern.
+ *
+ * @ author mdecorde
+ */
+public class DefineViewReferencePattern extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.definereferencepattern"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+	
+	/** The para browser editor. */
+	private ParaBrowserEditor paraBrowserEditor;
+
+	/**
+	 * Instantiates a new define reference pattern.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public DefineViewReferencePattern(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.DefineReferencePattern_1);
+		setToolTipText(Messages.DefineReferencePattern_2);
+	}
+
+	/**
+	 * Instantiates a new define reference pattern.
+	 *
+	 * @param window the window
+	 * @param paraBrowserEditor the para browser editor
+	 */
+	public DefineViewReferencePattern(IWorkbenchWindow window,
+			ParaBrowserEditor paraBrowserEditor) {
+		this.window = window;
+		this.paraBrowserEditor = paraBrowserEditor;
+		setId(ID);
+		setText(Messages.DefineReferencePattern_1);
+		setToolTipText(Messages.DefineReferencePattern_2);
+	}
+
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		List<StructuralUnit> structuralUnits = null;
+		List<Property> availableReferenceItems = new ArrayList<Property>();
+		try {
+			if (paraBrowserEditor != null) {
+				structuralUnits = paraBrowserEditor.getCorpus()
+						.getOrderedStructuralUnits();
+				availableReferenceItems.addAll(paraBrowserEditor.getCorpus()
+						.getOrderedProperties());
+
+			} else if (concordanceEditor != null) {
+				structuralUnits = concordanceEditor.getCorpus()
+						.getOrderedStructuralUnits();
+				availableReferenceItems.addAll(concordanceEditor.getCorpus()
+						.getOrderedProperties());
+
+			}
+
+		} catch (Exception e) {
+			org.txm.rcp.utils.Logger.printStackTrace(e);
+		}
+
+		for (StructuralUnit unit : structuralUnits) {
+			availableReferenceItems.addAll(unit.getProperties());
+		}
+
+		// System.out.println("selected "+concordanceEditor.getSelectedReferences());
+		// System.out.println("before avail"+availableReferenceItems);
+		if (paraBrowserEditor != null) {
+			availableReferenceItems.remove(paraBrowserEditor
+					.getSelectedReferences());
+		} else {
+			availableReferenceItems.remove(concordanceEditor
+					.getSelectedViewReferences());
+		}
+
+		// System.out.println("after avail"+availableReferenceItems);
+		DefineReferencePatternDialog d = null;
+		if (paraBrowserEditor != null) {
+			d = new DefineReferencePatternDialog(window.getShell(),
+					availableReferenceItems, paraBrowserEditor
+							.getSelectedReferences());
+		} else if (concordanceEditor != null) {
+			d = new DefineReferencePatternDialog(window.getShell(),
+					availableReferenceItems, concordanceEditor
+							.getSelectedViewReferences());
+		}
+
+		if (d.open() == Window.OK) {
+			if (paraBrowserEditor != null) {
+				paraBrowserEditor.setReferencePattern(new ReferencePattern(d
+						.getSelectesdReferenceItems()));
+			} else if (concordanceEditor != null) {
+				concordanceEditor.setRefViewPattern(new ReferencePattern(d
+						.getSelectesdReferenceItems()));
+			}
+			//System.out.println(concordanceEditor.getViewReferencePattern());
+		}
+	}
+
+	/**
+	 * The Class DefineReferencePatternDialog.
+	 */
+	private class DefineReferencePatternDialog extends Dialog {
+
+		/** The available reference items. */
+		private List<Property> availableReferenceItems;
+		
+		/** The selected reference items. */
+		private List<Property> selectedReferenceItems;
+
+		/**
+		 * Instantiates a new define reference pattern dialog.
+		 *
+		 * @param parentShell the parent shell
+		 * @param availableReferenceItems the available reference items
+		 * @param selectedReferences the selected references
+		 */
+		protected DefineReferencePatternDialog(Shell parentShell,
+				List<Property> availableReferenceItems,
+				List<Property> selectedReferences) {
+			super(parentShell);
+			
+			this.availableReferenceItems = availableReferenceItems;
+			this.selectedReferenceItems = selectedReferences;
+			this.availableReferenceItems.removeAll(selectedReferences);
+			this.setShellStyle(this.getShellStyle() | SWT.RESIZE);	
+		}
+
+		/**
+		 * Gets the selectesd reference items.
+		 *
+		 * @return the selectesd reference items
+		 */
+		public List<Property> getSelectesdReferenceItems() {
+			return selectedReferenceItems;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+		 */
+		@Override
+		protected void configureShell(Shell shell) {
+		      super.configureShell(shell);
+		      shell.setText(Messages.DefineReferencePattern_0);
+		      
+		      shell.setSize(400, 500);
+		      shell.setLocation(shell.getParent().getLocation());
+		   }
+		
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+		 */
+		@Override
+		protected Control createDialogArea(Composite parent) {
+
+			Composite mainArea = new Composite(parent, SWT.NONE);
+			mainArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+					true, true));
+			mainArea.setLayout(new GridLayout(4, false));
+
+			final org.eclipse.swt.widgets.List availbleItems = new org.eclipse.swt.widgets.List(
+					mainArea, SWT.BORDER | SWT.V_SCROLL);
+			for (Property property : availableReferenceItems) {
+				if (property instanceof StructuralUnitProperty) {
+					StructuralUnitProperty sProperty = (StructuralUnitProperty) property;
+					availbleItems.add(sProperty.getStructuralUnit().getName()
+							+ ": " + property.getName()); //$NON-NLS-1$
+				} else {
+					availbleItems.add(property.getName());
+				}
+			}
+						
+			GridData gridData = new GridData(GridData.FILL, GridData.FILL,
+					true, true);
+			//Point size = availbleItems.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+			//gridData.widthHint = size.x;
+			availbleItems.setLayoutData(gridData);
+
+			Composite selectionButtons = new Composite(mainArea, SWT.NONE);
+			selectionButtons.setLayout(new GridLayout(1, false));
+			Button select = new Button(selectionButtons, SWT.ARROW | SWT.RIGHT);
+			Button unselect = new Button(selectionButtons, SWT.ARROW | SWT.LEFT);
+
+			final org.eclipse.swt.widgets.List selectedItems = new org.eclipse.swt.widgets.List(
+					mainArea, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+			selectedItems.setLayoutData(gridData);
+			for (Property property : selectedReferenceItems) {
+				if (property instanceof StructuralUnitProperty) {
+					StructuralUnitProperty sProperty = (StructuralUnitProperty) property;
+					selectedItems.add(sProperty.getStructuralUnit().getName()
+							+ ": " + property.getName()); //$NON-NLS-1$
+				} else {
+					selectedItems.add(property.getName());
+				}
+			}
+			
+			//DBL CLICK Listeners
+			selectedItems.addMouseListener(new MouseListener() {
+				@Override
+				public void mouseUp(MouseEvent e) { }
+				
+				@Override
+				public void mouseDown(MouseEvent e) { }
+				
+				@Override
+				public void mouseDoubleClick(MouseEvent e) {
+					int ind = selectedItems.getSelectionIndex();
+					availbleItems.add(selectedItems.getItem(ind));
+					selectedItems.remove(ind);
+					availableReferenceItems
+							.add(selectedReferenceItems.get(ind));
+					selectedReferenceItems.remove(ind);
+					selectedItems.setSelection(ind);	
+				}
+			});
+			availbleItems.addMouseListener(new MouseListener() {
+				@Override
+				public void mouseUp(MouseEvent e) { }
+				
+				@Override
+				public void mouseDown(MouseEvent e) { }
+				
+				@Override
+				public void mouseDoubleClick(MouseEvent e) {
+					int ind = availbleItems.getSelectionIndex();
+					selectedItems.add(availbleItems.getItem(ind));
+					availbleItems.remove(ind);
+					selectedReferenceItems
+							.add(availableReferenceItems.get(ind));
+					availableReferenceItems.remove(ind);
+					availbleItems.setSelection(ind);
+				}
+			});
+
+			Composite orderButtons = new Composite(mainArea, SWT.NONE);
+			orderButtons.setLayout(new GridLayout(1, false));
+			Button up = new Button(orderButtons, SWT.ARROW | SWT.UP);
+			Button down = new Button(orderButtons, SWT.ARROW | SWT.DOWN);
+
+			select.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int ind = availbleItems.getSelectionIndex();
+					selectedItems.add(availbleItems.getItem(ind));
+					availbleItems.remove(ind);
+					selectedReferenceItems
+							.add(availableReferenceItems.get(ind));
+					availableReferenceItems.remove(ind);
+					availbleItems.setSelection(ind);
+				}
+			});
+
+			unselect.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int ind = selectedItems.getSelectionIndex();
+					availbleItems.add(selectedItems.getItem(ind));
+					selectedItems.remove(ind);
+					availableReferenceItems
+							.add(selectedReferenceItems.get(ind));
+					selectedReferenceItems.remove(ind);
+					selectedItems.setSelection(ind);					
+				}
+			});
+
+			up.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int ind = selectedItems.getSelectionIndex();
+					if (ind > 0) {
+						String value = selectedItems.getItem(ind);
+						selectedItems.remove(ind);
+						selectedItems.add(value, ind -1);
+						
+						Property prop = selectedReferenceItems.get(ind);
+						selectedReferenceItems.remove(ind);
+						selectedReferenceItems.add(ind-1,prop);
+						
+						selectedItems.setSelection(ind -1);
+					}
+				}
+			});
+
+			down.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int ind = selectedItems.getSelectionIndex();
+					if (ind < selectedItems.getItemCount() - 1) {
+						String value = selectedItems.getItem(ind);
+						selectedItems.remove(ind);
+						selectedItems.add(value, ind + 1);
+						
+						Property prop = selectedReferenceItems.get(ind);
+						selectedReferenceItems.remove(ind);
+						selectedReferenceItems.add(ind+1, prop);
+						
+						selectedItems.setSelection(ind + 1);
+					}
+				}
+			});
+
+			return mainArea;
+		}
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineViewReferencePattern.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SortPropertySelection.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SortPropertySelection.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SortPropertySelection.java	(revision 363)
@@ -0,0 +1,131 @@
+// 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.concordance.rcp.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.concordance.rcp.editors.SortPropertySelectionDialog;
+import org.txm.rcp.Messages;
+// TODO: Auto-generated Javadoc
+/**
+ * Action to define the view properties of each column @ author mdecorde.
+ */
+public class SortPropertySelection extends Action implements IWorkbenchAction {
+	
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.SortPropertySelection"; //$NON-NLS-1$
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/** The available view properties. */
+	List<Property> availableSortProperties;
+	
+	/** The selected view properties. */
+	List<Property> selectedSortProperties;
+
+	/**
+	 * Instantiates a new view property selection.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 * @param tableViewer the table viewer
+	 */
+	public SortPropertySelection(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor, TableViewer tableViewer) {
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.SortPropertySelection_0);
+		setToolTipText(Messages.SortPropertySelection_0);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		int columnid = concordanceEditor.getPointedColumn(); // get the column id
+		IWorkbenchPartSite site = concordanceEditor.getSite();
+
+		List<Property> selectedSortProperties = new ArrayList<Property>();
+		switch (columnid) // the selected properties depends on the columns
+		{
+		case 1:
+			availableSortProperties = concordanceEditor.getAvailableLeftSortProperties();
+			selectedSortProperties = concordanceEditor.getSelectedLeftSortProperties();
+			break;
+		case 2:
+			availableSortProperties = concordanceEditor.getAvailableKeywordSortProperties();
+			selectedSortProperties = concordanceEditor.getSelectedKeywordSortProperties();
+			break;
+		case 3:
+			availableSortProperties = concordanceEditor.getAvailableRightSortProperties();
+			selectedSortProperties = concordanceEditor.getSelectedRightSortProperties();
+			break;
+		}
+
+//		System.out.println("Column: "+columnid);
+//		System.out.println("available: "+availableSortProperties);
+//		System.out.println("selected: "+selectedSortProperties);
+		
+		int ret = new SortPropertySelectionDialog(site, availableSortProperties,
+				selectedSortProperties).open();
+		if (ret == SWT.CANCEL)
+			return;
+
+		switch (columnid) {
+		case 1:
+			concordanceEditor.setLeftSortProperties(selectedSortProperties);
+			break;
+		case 2:
+			concordanceEditor.setKeywordSortProperties(selectedSortProperties);
+			break;
+		case 3:
+			concordanceEditor.setRightSortProperties(selectedSortProperties);
+			break;
+		}
+
+		// concordanceEditor.updateSortPropertiesLabel();
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SortPropertySelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComputeIndexFromLines.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComputeIndexFromLines.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComputeIndexFromLines.java	(revision 363)
@@ -0,0 +1,85 @@
+// 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.concordance.rcp.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.Messages;
+import org.txm.rcp.commands.link.ConcordanceToIndex;
+
+// TODO: Auto-generated Javadoc
+/**
+ * use the line selection to compute an index.
+ */
+public class ComputeIndexFromLines extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.computecoocfromconclines"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/**
+	 * Instantiates a new compute index from lines.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public ComputeIndexFromLines(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.ComputeIndexFromLines_0);
+		setToolTipText(Messages.ComputeIndexFromLines_0);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		TableViewer table = concordanceEditor.getLineTableViewer();
+		ConcordanceToIndex.link(concordanceEditor,
+				(IStructuredSelection) table.getSelection());
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComputeIndexFromLines.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ResetColumnWidths.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ResetColumnWidths.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ResetColumnWidths.java	(revision 363)
@@ -0,0 +1,26 @@
+package org.txm.concordance.rcp.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+
+public class ResetColumnWidths extends Action {
+	
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.ResetColumnWidths"; //$NON-NLS-1$
+	
+	
+	private ConcordanceEditor concordanceEditor;
+
+	public ResetColumnWidths(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText("Reset column widths");
+	}
+	
+	@Override
+	public void run() {
+		concordanceEditor.resetColumnWidths();
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ResetColumnWidths.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ViewPropertySelection.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ViewPropertySelection.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ViewPropertySelection.java	(revision 363)
@@ -0,0 +1,139 @@
+// 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.concordance.rcp.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.Messages;
+import org.txm.rcp.swt.dialog.ViewPropertySelectionDialog;
+// TODO: Auto-generated Javadoc
+/**
+ * Action to define the view properties of each column @ author mdecorde.
+ */
+public class ViewPropertySelection extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.ViewPropertySelection"; //$NON-NLS-1$
+
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/** The available view properties. */
+	List<Property> availableViewProperties;
+
+	/** The selected view properties. */
+	List<Property> selectedViewProperties;
+
+	/**
+	 * Instantiates a new view property selection.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 * @param tableViewer the table viewer
+	 */
+	public ViewPropertySelection(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor, TableViewer tableViewer) {
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.ViewPropertySelection_0);
+		setToolTipText(Messages.ViewPropertySelection_0);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		int columnid = concordanceEditor.getPointedColumn(); 
+		IWorkbenchPartSite site = concordanceEditor.getSite();
+
+		List<Property> selectedViewProperties = new ArrayList<Property>();
+		switch (columnid) // the selected properties depends on the columns
+		{
+		case 1:
+			availableViewProperties = concordanceEditor
+			.getAvailableLeftViewProperties();
+			selectedViewProperties = concordanceEditor
+					.getSelectedLeftViewProperties();
+			break;
+		case 2:
+			availableViewProperties = concordanceEditor
+			.getAvailableKeywordViewProperties();
+			selectedViewProperties = concordanceEditor
+					.getSelectedKeywordViewProperties();
+			break;
+		case 3:
+			availableViewProperties = concordanceEditor
+			.getAvailableRightViewProperties();
+			selectedViewProperties = concordanceEditor
+					.getSelectedRightViewProperties();
+			break;
+		default:
+			availableViewProperties = concordanceEditor
+			.getAvailableKeywordViewProperties();
+			selectedViewProperties = concordanceEditor
+					.getSelectedKeywordViewProperties();
+			break;
+		}
+
+		if (new ViewPropertySelectionDialog(site, availableViewProperties,
+				selectedViewProperties).open() == SWT.CANCEL)
+			return;
+
+		switch (columnid) {
+		case 1:
+			concordanceEditor.setLeftViewProperties(selectedViewProperties);
+			break;
+		case 2:
+			concordanceEditor.setKeywordViewProperties(selectedViewProperties);
+			break;
+		case 3:
+			concordanceEditor.setRightViewProperties(selectedViewProperties);
+			break;
+		default:
+			concordanceEditor.setKeywordViewProperties(selectedViewProperties);
+			break;
+		}
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ViewPropertySelection.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/BackToText.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/BackToText.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/BackToText.java	(revision 363)
@@ -0,0 +1,80 @@
+// 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.concordance.rcp.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.Messages;
+// TODO: Auto-generated Javadoc
+/**
+ * action called to set the complex sort of the concordance @ author mdecorde.
+ */
+public class BackToText extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.backtotext"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/**
+	 * Instantiates a new back to text.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public BackToText(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.BackToText_0);
+		setToolTipText(Messages.BackToText_0);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		concordanceEditor.backToText();
+
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/BackToText.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetSortProperty.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetSortProperty.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetSortProperty.java	(revision 363)
@@ -0,0 +1,210 @@
+// 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.concordance.rcp.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.Messages;
+import org.txm.searchengine.cqp.corpus.Property;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Action to define the sort property to use @ author mdecorde.
+ */
+public class SetSortProperty extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.setsortproperty"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/**
+	 * Instantiates a new sets the sort property.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public SetSortProperty(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.SetSortProperty_1);
+		setToolTipText(Messages.SetSortProperty_2);
+	}
+
+	/**
+	 * Instantiates a new sets the sort property.
+	 */
+	public SetSortProperty() {
+		// TODO Auto-generated constructor stub
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		List<Property> selectedProperty;
+		int columnid = concordanceEditor.getPointedColumn();
+		switch (columnid) // the selected properties depends on the columns
+		{
+		case 1:
+			selectedProperty = concordanceEditor
+					.getSelectedLeftSortProperties();
+			break;
+		case 2:
+			selectedProperty = concordanceEditor
+					.getSelectedKeywordSortProperties();
+			break;
+		default:
+			selectedProperty = concordanceEditor
+					.getSelectedRightSortProperties();
+			break;
+		}
+
+		SetSortPropertyDialog d = new SetSortPropertyDialog(window.getShell(),
+				concordanceEditor.getAvailableSortProperties(),
+				selectedProperty);
+
+		if (d.open() == Window.OK) {
+
+			switch (columnid) // the selected properties depends on the columns
+			{
+			case 1:
+				concordanceEditor.setLeftSortProperties(d.getSelectedProperty());
+				break;
+			case 2:
+				concordanceEditor.setKeywordSortProperties(d.getSelectedProperty());
+				break;
+			case 3:
+				concordanceEditor.setRightSortProperties(d.getSelectedProperty());
+				break;
+			}
+		}
+	}
+
+	/**
+	 * The Class SetSortPropertyDialog.
+	 */
+	private class SetSortPropertyDialog extends Dialog {
+
+		/** The properties. */
+		private final List<Property> properties;
+		
+		/** The buttons. */
+		private List<Button> buttons;
+		
+		/** The selected property. */
+		private List<Property> selectedProperty;
+
+		/**
+		 * Instantiates a new sets the sort property dialog.
+		 *
+		 * @param shell the shell
+		 * @param properties the properties
+		 * @param selectedProperty2 the selected property
+		 */
+		public SetSortPropertyDialog(Shell shell, List<Property> properties,
+				List<Property> selectedProperty2) {
+			super(shell);
+			this.properties = properties;
+			this.selectedProperty = selectedProperty2;
+			buttons = new ArrayList<Button>();
+
+			this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+		 */
+		@Override
+		protected Control createDialogArea(Composite parent) {
+			Composite mainArea = new Composite(parent, SWT.NONE);
+			mainArea.setLayout(new RowLayout(SWT.VERTICAL));
+			mainArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+					true, true));
+			Group group = new Group(mainArea, SWT.SHADOW_IN);
+			group.setText(Messages.SetSortProperty_3);
+			group.setLayout(new RowLayout(SWT.VERTICAL));
+			for (Property property : properties) {
+				Button button = new Button(group, SWT.RADIO);
+				button.setText(property.getName());
+				buttons.add(button);
+			}
+			return mainArea;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+		 */
+		@Override
+		protected void okPressed() {
+			selectedProperty.clear();
+			for (int i = 0; i < buttons.size(); i++)
+				if (buttons.get(i).getSelection())
+					selectedProperty.add(properties.get(i));
+			super.okPressed();
+		}
+
+		/**
+		 * Gets the selected property.
+		 *
+		 * @return the selected property
+		 */
+		public List<Property> getSelectedProperty() {
+			return selectedProperty;
+		}
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetSortProperty.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetContextSize.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetContextSize.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetContextSize.java	(revision 363)
@@ -0,0 +1,174 @@
+// 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.concordance.rcp.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.Messages;
+// TODO: Auto-generated Javadoc
+/**
+ * Action to set the contexts size @ author mdecorde.
+ */
+public class SetContextSize extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.setcontextsize"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/**
+	 * Instantiates a new sets the context size.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public SetContextSize(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.SetContextSize_1);
+		setToolTipText(Messages.SetContextSize_2);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		SetContextSizeDialog d = new SetContextSizeDialog(window.getShell());
+		if (d.open() == Window.OK) {
+			concordanceEditor.setContextSize(d.getLeftContextSize(), d
+					.getRightContextSize());
+			// concordanceEditor.getConcordance().setLeftContextSize(d.getLeftContextSize());
+			// concordanceEditor.getConcordance().setRightContextSize(d.getRightContextSize());
+			// concordanceEditor.sort();
+			// concordanceEditor.fillDisplayArea(concordanceEditor.getTopLine(),
+			// concordanceEditor.getBottomLine());
+		}
+	}
+
+	/**
+	 * The Class SetContextSizeDialog.
+	 */
+	private class SetContextSizeDialog extends Dialog {
+
+		/** The right context size. */
+		private int rightContextSize;
+		
+		/** The left context size. */
+		private int leftContextSize;
+		
+		/** The left spinner. */
+		private Spinner leftSpinner;
+		
+		/** The right spinner. */
+		private Spinner rightSpinner;
+
+		/**
+		 * Instantiates a new sets the context size dialog.
+		 *
+		 * @param parentShell the parent shell
+		 */
+		protected SetContextSizeDialog(Shell parentShell) {
+			super(parentShell);
+			//parentShell.setText(Messages.SetContextSize_1);
+		}
+
+		/**
+		 * Gets the right context size.
+		 *
+		 * @return the right context size
+		 */
+		public int getRightContextSize() {
+			return rightContextSize;
+		}
+
+		/**
+		 * Gets the left context size.
+		 *
+		 * @return the left context size
+		 */
+		public int getLeftContextSize() {
+			return leftContextSize;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+		 */
+		@Override
+		protected Control createDialogArea(Composite parent) {
+			Composite mainArea = new Composite(parent, SWT.NONE);
+			mainArea.setLayout(new GridLayout(2, false));
+			new Label(mainArea, SWT.None).setText(Messages.SetContextSize_3);
+			leftSpinner = new Spinner(mainArea, SWT.NONE);
+			leftSpinner.setMinimum(0);
+			leftSpinner.setMaximum(100);
+			leftSpinner.setSelection(concordanceEditor.getLeftContextSize());
+			new Label(mainArea, SWT.None).setText(Messages.SetContextSize_4);
+			rightSpinner = new Spinner(mainArea, SWT.NONE);
+			rightSpinner.setMinimum(0);
+			rightSpinner.setMaximum(100);
+			rightSpinner.setSelection(concordanceEditor.getRightContextSize());
+			return mainArea;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+		 */
+		@Override
+		protected void okPressed() {
+			leftContextSize = leftSpinner.getSelection();
+			rightContextSize = rightSpinner.getSelection();
+			super.okPressed();
+		}
+
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetContextSize.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetLineNumber.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetLineNumber.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetLineNumber.java	(revision 363)
@@ -0,0 +1,154 @@
+// 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.concordance.rcp.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.Messages;
+
+// TODO: Auto-generated Javadoc
+/**
+ * Action to set the number of line shown per concordance page @ author mdecorde.
+ */
+public class SetLineNumber extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.setcontextsize"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/**
+	 * Instantiates a new sets the line number.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public SetLineNumber(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.SetLineNumber_0);
+		setToolTipText(Messages.SetLineNumber_0);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		SetLineNumberDialog d = new SetLineNumberDialog(window.getShell());
+		if (d.open() == Window.OK) {
+			concordanceEditor.setLinePerPage(d.getValue());
+			// concordanceEditor.getConcordance().setLeftContextSize(d.getLeftContextSize());
+			// concordanceEditor.getConcordance().setRightContextSize(d.getRightContextSize());
+			// concordanceEditor.sort();
+			// concordanceEditor.fillDisplayArea(concordanceEditor.getTopLine(),
+			// concordanceEditor.getBottomLine());
+		}
+	}
+
+	/**
+	 * The Class SetLineNumberDialog.
+	 */
+	private class SetLineNumberDialog extends Dialog {
+
+		/** The right context size. */
+		private int rightContextSize;
+		
+		/** The right spinner. */
+		private Spinner rightSpinner;
+
+		/**
+		 * Instantiates a new sets the line number dialog.
+		 *
+		 * @param parentShell the parent shell
+		 */
+		protected SetLineNumberDialog(Shell parentShell) {
+			super(parentShell);
+			//parentShell.setText(Messages.SetLineNumber_0);
+		}
+
+		/**
+		 * Gets the value.
+		 *
+		 * @return the value
+		 */
+		public int getValue() {
+			return rightContextSize;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+		 */
+		@Override
+		protected Control createDialogArea(Composite parent) {
+			Composite mainArea = new Composite(parent, SWT.NONE);
+			mainArea.setLayout(new GridLayout(2, false));
+
+			new Label(mainArea, SWT.None).setText(Messages.SetLineNumber_1);
+			rightSpinner = new Spinner(mainArea, SWT.NONE);
+			rightSpinner.setSelection(concordanceEditor.getLinePerPage());
+			rightSpinner.setMinimum(0);
+			rightSpinner.setMaximum(100000);
+			return mainArea;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+		 */
+		@Override
+		protected void okPressed() {
+			rightContextSize = rightSpinner.getSelection();
+			super.okPressed();
+		}
+
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/SetLineNumber.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComplexSort.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComplexSort.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComplexSort.java	(revision 363)
@@ -0,0 +1,403 @@
+// 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.concordance.rcp.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.core.functions.comparators.CompositeComparator;
+import org.txm.concordance.core.functions.comparators.LineComparator;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.rcp.Messages;
+import org.txm.rcp.StatusLine;
+
+// TODO: Auto-generated Javadoc
+/**
+ * action called to set the complex sort of the concordance @ author mdecorde.
+ */
+public class ComplexSort extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.complexsort"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/**
+	 * Instantiates a new complex sort.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public ComplexSort(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.ComplexSort_1);
+		setToolTipText(Messages.ComplexSort_2);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		SelectComplexSortDialog d = new SelectComplexSortDialog(window
+				.getShell());
+		if (d.open() == Window.OK) {
+			concordanceEditor.setUserDefinedComparators(d
+					.getUserDefinedComparators());
+			concordanceEditor.setCurrentComparator(d.getSelectedComparator());
+			concordanceEditor.sort();
+		}
+
+	}
+
+	/**
+	 * The Class SelectComplexSortDialog.
+	 */
+	private class SelectComplexSortDialog extends Dialog {
+
+		/** The selected comparator. */
+		private LineComparator selectedComparator;
+		
+		/** The user defined comparators. */
+		private List<LineComparator> userDefinedComparators;
+		
+		/** The list. */
+		private org.eclipse.swt.widgets.List list;
+
+		/**
+		 * Instantiates a new select complex sort dialog.
+		 *
+		 * @param shell the shell
+		 */
+		public SelectComplexSortDialog(Shell shell) {
+			super(shell);
+			this.userDefinedComparators = new ArrayList<LineComparator>(
+					concordanceEditor.getUserDefinedComparators());
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+		 */
+		@Override
+		protected void configureShell(Shell newShell) {
+			super.configureShell(newShell);
+			newShell.setText(Messages.ComplexSort_3);
+		}
+
+		/**
+		 * Gets the user defined comparators.
+		 *
+		 * @return the user defined comparators
+		 */
+		public List<LineComparator> getUserDefinedComparators() {
+			return userDefinedComparators;
+		}
+
+		/**
+		 * Gets the selected comparator.
+		 *
+		 * @return the selected comparator
+		 */
+		public LineComparator getSelectedComparator() {
+			return selectedComparator;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+		 */
+		@Override
+		protected Control createDialogArea(Composite parent) {
+			Composite mainArea = new Composite(parent, SWT.NONE);
+			mainArea.setLayout(new GridLayout(2, false));
+			list = new org.eclipse.swt.widgets.List(mainArea, SWT.V_SCROLL
+					| SWT.BORDER);
+			GridData layoutData = new GridData(GridData.FILL, GridData.FILL,
+					true, true);
+			layoutData.verticalSpan = 2;
+			layoutData.minimumWidth = 100;
+			layoutData.minimumHeight = 75;
+			list.setLayoutData(layoutData);
+			for (LineComparator comparator : concordanceEditor
+					.getUserDefinedComparators()) {
+				list.add(comparator.getName());
+			}
+			list.select(0);
+			Button newButton = new Button(mainArea, SWT.PUSH);
+			newButton.setText(Messages.ComplexSort_4);
+			newButton.addSelectionListener(new SelectionListener() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					StatusLine.setMessage(Messages.ComplexSort_0);
+					CompositeSorterCreationDialog sorterCreationDialog = new CompositeSorterCreationDialog(
+							getShell());
+					int code = sorterCreationDialog.open();
+					if (code == Window.OK) {
+						CompositeComparator comp = new CompositeComparator(
+								sorterCreationDialog.getName(),
+								sorterCreationDialog.getComparators());
+						list.add(comp.getName());
+						userDefinedComparators.add(comp);
+						list.select(list.getItemCount() - 1);
+					}
+					StatusLine.setMessage(""); //$NON-NLS-1$
+				}
+
+				@Override
+				public void widgetDefaultSelected(SelectionEvent e) {
+				}
+			});
+			return mainArea;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+		 */
+		@Override
+		protected void okPressed() {
+			selectedComparator = userDefinedComparators.get(list
+					.getSelectionIndex());
+			super.okPressed();
+		}
+
+	}
+
+	/**
+	 * The Class CompositeSorterCreationDialog.
+	 */
+	private class CompositeSorterCreationDialog extends Dialog {
+
+		/** The available comparators. */
+		final private List<LineComparator> availableComparators;
+		
+		/** The selected comparators. */
+		final private List<LineComparator> selectedComparators;
+		
+		/** The name text. */
+		private Text nameText;
+		
+		/** The name. */
+		private String name;
+
+		/**
+		 * Instantiates a new composite sorter creation dialog.
+		 *
+		 * @param shell the shell
+		 */
+		protected CompositeSorterCreationDialog(Shell shell) {
+			super(shell);
+			this.availableComparators = new ArrayList<LineComparator>(
+					concordanceEditor.getStandardComparators());
+			this.selectedComparators = new ArrayList<LineComparator>();
+		}
+
+		/**
+		 * Gets the name.
+		 *
+		 * @return the name
+		 */
+		public String getName() {
+			return name;
+		}
+
+		/**
+		 * Gets the comparators.
+		 *
+		 * @return the comparators
+		 */
+		public List<LineComparator> getComparators() {
+			return selectedComparators;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+		 */
+		@Override
+		protected void configureShell(Shell newShell) {
+			super.configureShell(newShell);
+			newShell.setText(Messages.ComplexSort_5);
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+		 */
+		@Override
+		protected Control createDialogArea(Composite parent) {
+			Composite mainArea = new Composite(parent, SWT.NONE);
+			GridLayout layout = new GridLayout(4, false);
+			mainArea.setLayout(layout);
+
+			Label nameLabel = new Label(mainArea, SWT.NONE);
+			nameLabel.setText(Messages.ComplexSort_6);
+
+			nameText = new Text(mainArea, SWT.NONE);
+			GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
+			gridData.horizontalSpan = 3;
+			nameText.setLayoutData(gridData);
+
+			final org.eclipse.swt.widgets.List availbleItems = new org.eclipse.swt.widgets.List(
+					mainArea, SWT.BORDER | SWT.V_SCROLL);
+			for (LineComparator comparator : availableComparators) {
+				availbleItems.add(comparator.getName());
+			}
+			gridData = new GridData(GridData.FILL, GridData.FILL, true, false);
+			Point size = availbleItems.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+			gridData.widthHint = size.x;
+			availbleItems.setLayoutData(gridData);
+
+			Composite selectionButtons = new Composite(mainArea, SWT.NONE);
+			selectionButtons.setLayout(new GridLayout(1, false));
+			Button select = new Button(selectionButtons, SWT.ARROW | SWT.RIGHT);
+			Button unselect = new Button(selectionButtons, SWT.ARROW | SWT.LEFT);
+
+			final org.eclipse.swt.widgets.List selectedItems = new org.eclipse.swt.widgets.List(
+					mainArea, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+			selectedItems.setLayoutData(gridData);
+
+			Composite orderButtons = new Composite(mainArea, SWT.NONE);
+			orderButtons.setLayout(new GridLayout(1, false));
+			Button up = new Button(orderButtons, SWT.ARROW | SWT.UP);
+			Button down = new Button(orderButtons, SWT.ARROW | SWT.DOWN);
+
+			select.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					StatusLine.setMessage(Messages.ComplexSort_12);
+					int ind = availbleItems.getSelectionIndex();
+					selectedItems.add(availbleItems.getItem(ind));
+					availbleItems.remove(ind);
+					selectedComparators.add(availableComparators.get(ind));
+					availableComparators.remove(ind);
+					availbleItems.setSelection(ind);
+					StatusLine.setMessage(""); //$NON-NLS-1$
+				}
+			});
+
+			unselect.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					StatusLine.setMessage(Messages.ComplexSort_14);
+					int ind = selectedItems.getSelectionIndex();
+					availbleItems.add(selectedItems.getItem(ind));
+					selectedItems.remove(ind);
+					availableComparators.add(selectedComparators.get(ind));
+					selectedComparators.remove(ind);
+					selectedItems.setSelection(ind);
+					StatusLine.setMessage(""); //$NON-NLS-1$
+				}
+			});
+
+			up.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					StatusLine.setMessage(Messages.ComplexSort_16);
+					int ind = selectedItems.getSelectionIndex();
+					if (ind > 0) {
+						selectedItems.add(selectedItems.getItem(ind), ind - 1);
+						selectedItems.remove(ind + 1);
+						selectedComparators.add(selectedComparators
+								.get(ind - 1));
+						selectedComparators.remove(ind + 1);
+						selectedItems.setSelection(ind - 1);
+					}
+					StatusLine.setMessage(""); //$NON-NLS-1$
+				}
+			});
+
+			down.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					StatusLine.setMessage(Messages.ComplexSort_18);
+					int ind = selectedItems.getSelectionIndex();
+					if (ind < selectedItems.getItemCount() - 1) {
+						selectedItems.add(selectedItems.getItem(ind), ind + 2);
+						selectedItems.remove(ind);
+						selectedComparators.add(selectedComparators
+								.get(ind + 2));
+						selectedComparators.remove(ind);
+						selectedItems.setSelection(ind + 2);
+					}
+					StatusLine.setMessage(""); //$NON-NLS-1$
+				}
+			});
+			return mainArea;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+		 */
+		@Override
+		protected void okPressed() {
+			if (nameText.getText().equals("")) { //$NON-NLS-1$
+				MessageDialog.openError(getShell(), Messages.CreateSubcorpusDialog_11,
+						Messages.ComplexSort_9);
+				return;
+			}
+			name = nameText.getText();
+			if (selectedComparators.size() < 2) {
+				MessageDialog.openError(getShell(), Messages.ComplexSort_10,
+						Messages.ComplexSort_11);
+				return;
+			}
+			super.okPressed();
+		}
+	}
+
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComplexSort.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComputeCoocFromLines.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComputeCoocFromLines.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComputeCoocFromLines.java	(revision 363)
@@ -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.concordance.rcp.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.cooccurrence.core.functions.Cooccurrence;
+import org.txm.cooccurrence.rcp.editors.CooccurrenceEditorInput;
+import org.txm.cooccurrence.rcp.editors.CooccurrencesEditor;
+import org.txm.cooccurrence.rcp.handlers.ComputeCooccurrences;
+import org.txm.rcp.Messages;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.editors.TXMResultEditorInput;
+
+// TODO: Auto-generated Javadoc
+/**
+ * The Class ComputeCoocFromLines.
+ *
+ * @deprecated use the line selection to compute a cooc
+ */
+@Deprecated
+public class ComputeCoocFromLines extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.computecoocfromconclines"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+
+	/**
+	 * Instantiates a new compute cooc from lines.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public ComputeCoocFromLines(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.ComputeCoocFromLines_0);
+		setToolTipText(Messages.ComputeCoocFromLines_0);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		TableViewer table = concordanceEditor.getLineTableViewer();
+		Cooccurrence cooc = ComputeCooccurrences
+				.computeCooc((IStructuredSelection) table.getSelection());
+		if (cooc != null) {
+			IWorkbenchPage page = window.getActivePage();
+			try {
+				StatusLine.setMessage(Messages.ComputeCoocFromLines_1);
+				page.openEditor(new TXMResultEditorInput(cooc), "CooccurrencesEditor"); 
+			} catch (PartInitException e) {
+				System.err
+						.println(NLS.bind(Messages.GetConcordances_4, e));
+			}
+		}
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/ComputeCoocFromLines.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineSortReferencePattern.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineSortReferencePattern.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineSortReferencePattern.java	(revision 363)
@@ -0,0 +1,383 @@
+// 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.concordance.rcp.actions;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+import org.txm.functions.ReferencePattern;
+import org.txm.rcp.Messages;
+import org.txm.rcp.editors.parabrowser.ParaBrowserEditor;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+// TODO: Auto-generated Javadoc
+/**
+ * Action to build the reference pattern.
+ *
+ * @ author mdecorde
+ */
+public class DefineSortReferencePattern extends Action implements IWorkbenchAction {
+
+	/** The Constant ID. */
+	private static final String ID = "org.txm.rcp.editors.concordances.definereferencepattern"; //$NON-NLS-1$
+	
+	/** The window. */
+	private IWorkbenchWindow window;
+	
+	/** The concordance editor. */
+	private ConcordanceEditor concordanceEditor;
+	
+	/** The para browser editor. */
+	private ParaBrowserEditor paraBrowserEditor;
+
+	/**
+	 * Instantiates a new define reference pattern.
+	 *
+	 * @param window the window
+	 * @param concordanceEditor the concordance editor
+	 */
+	public DefineSortReferencePattern(IWorkbenchWindow window,
+			ConcordanceEditor concordanceEditor) {
+		this.window = window;
+		this.concordanceEditor = concordanceEditor;
+		setId(ID);
+		setText(Messages.DefineReferencePattern_3);
+		setToolTipText(Messages.DefineReferencePattern_4);
+	}
+
+	/**
+	 * Instantiates a new define reference pattern.
+	 *
+	 * @param window the window
+	 * @param paraBrowserEditor the para browser editor
+	 */
+	public DefineSortReferencePattern(IWorkbenchWindow window,
+			ParaBrowserEditor paraBrowserEditor) {
+		this.window = window;
+		this.paraBrowserEditor = paraBrowserEditor;
+		setId(ID);
+		setText(Messages.DefineReferencePattern_3);
+		setToolTipText(Messages.DefineReferencePattern_4);
+	}
+
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.ui.actions.ActionFactory.IWorkbenchAction#dispose()
+	 */
+	@Override
+	public void dispose() {
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.action.Action#run()
+	 */
+	@Override
+	public void run() {
+		List<StructuralUnit> structuralUnits = null;
+		List<Property> availableReferenceItems = new ArrayList<Property>();
+		try {
+			if (paraBrowserEditor != null) {
+				structuralUnits = paraBrowserEditor.getCorpus()
+						.getOrderedStructuralUnits();
+				availableReferenceItems.addAll(paraBrowserEditor.getCorpus()
+						.getOrderedProperties());
+
+			} else if (concordanceEditor != null) {
+				structuralUnits = concordanceEditor.getCorpus()
+						.getOrderedStructuralUnits();
+				availableReferenceItems.addAll(concordanceEditor.getCorpus()
+						.getOrderedProperties());
+
+			}
+
+		} catch (Exception e) {
+			org.txm.rcp.utils.Logger.printStackTrace(e);
+		}
+
+		for (StructuralUnit unit : structuralUnits) {
+			availableReferenceItems.addAll(unit.getProperties());
+		}
+
+		// System.out.println("selected "+concordanceEditor.getSelectedReferences());
+		// System.out.println("before avail"+availableReferenceItems);
+		if (paraBrowserEditor != null) {
+			availableReferenceItems.remove(paraBrowserEditor
+					.getSelectedReferences());
+		} else {
+			availableReferenceItems.remove(concordanceEditor
+					.getSelectedSortReferences());
+		}
+
+		// System.out.println("after avail"+availableReferenceItems);
+		DefineReferencePatternDialog d = null;
+		if (paraBrowserEditor != null) {
+			d = new DefineReferencePatternDialog(window.getShell(),
+					availableReferenceItems, paraBrowserEditor
+							.getSelectedReferences());
+		} else if (concordanceEditor != null) {
+			d = new DefineReferencePatternDialog(window.getShell(),
+					availableReferenceItems, concordanceEditor
+							.getSelectedSortReferences());
+		}
+
+		if (d.open() == Window.OK) {
+			if (paraBrowserEditor != null) {
+				paraBrowserEditor.setReferencePattern(new ReferencePattern(d
+						.getSelectesdReferenceItems()));
+			} else if (concordanceEditor != null) {
+				concordanceEditor.setRefSortPattern(new ReferencePattern(d
+						.getSelectesdReferenceItems()));
+			}
+			//System.out.println(concordanceEditor.getSortReferencePattern());
+		}
+	}
+
+	/**
+	 * The Class DefineReferencePatternDialog.
+	 */
+	private class DefineReferencePatternDialog extends Dialog {
+
+		/** The available reference items. */
+		private List<Property> availableReferenceItems;
+		
+		/** The selected reference items. */
+		private List<Property> selectedReferenceItems;
+
+		/**
+		 * Instantiates a new define reference pattern dialog.
+		 *
+		 * @param parentShell the parent shell
+		 * @param availableReferenceItems the available reference items
+		 * @param selectedReferences the selected references
+		 */
+		protected DefineReferencePatternDialog(Shell parentShell,
+				List<Property> availableReferenceItems,
+				List<Property> selectedReferences) {
+			super(parentShell);
+			
+			this.availableReferenceItems = availableReferenceItems;
+			this.selectedReferenceItems = selectedReferences;
+			this.availableReferenceItems.removeAll(selectedReferences);
+			this.setShellStyle(this.getShellStyle() | SWT.RESIZE);	
+		}
+
+		/**
+		 * Gets the selectesd reference items.
+		 *
+		 * @return the selectesd reference items
+		 */
+		public List<Property> getSelectesdReferenceItems() {
+			return selectedReferenceItems;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+		 */
+		@Override
+		protected void configureShell(Shell shell) {
+		      super.configureShell(shell);
+		      shell.setText(Messages.DefineReferencePattern_5);
+		      
+		      shell.setSize(400, 500);
+		      shell.setLocation(shell.getParent().getLocation());
+		   }
+		
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+		 */
+		@Override
+		protected Control createDialogArea(Composite parent) {
+
+			Composite mainArea = new Composite(parent, SWT.NONE);
+			mainArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+					true, true));
+			mainArea.setLayout(new GridLayout(4, false));
+
+			final org.eclipse.swt.widgets.List availbleItems = new org.eclipse.swt.widgets.List(
+					mainArea, SWT.BORDER | SWT.V_SCROLL);
+			for (Property property : availableReferenceItems) {
+				if (property instanceof StructuralUnitProperty) {
+					StructuralUnitProperty sProperty = (StructuralUnitProperty) property;
+					availbleItems.add(sProperty.getStructuralUnit().getName()
+							+ ": " + property.getName()); //$NON-NLS-1$
+				} else {
+					availbleItems.add(property.getName());
+				}
+			}
+						
+			GridData gridData = new GridData(GridData.FILL, GridData.FILL,
+					true, true);
+			//Point size = availbleItems.computeSize(SWT.DEFAULT, SWT.DEFAULT);
+			//gridData.widthHint = size.x;
+			availbleItems.setLayoutData(gridData);
+
+			Composite selectionButtons = new Composite(mainArea, SWT.NONE);
+			selectionButtons.setLayout(new GridLayout(1, false));
+			Button select = new Button(selectionButtons, SWT.ARROW | SWT.RIGHT);
+			Button unselect = new Button(selectionButtons, SWT.ARROW | SWT.LEFT);
+
+			final org.eclipse.swt.widgets.List selectedItems = new org.eclipse.swt.widgets.List(
+					mainArea, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
+			selectedItems.setLayoutData(gridData);
+			for (Property property : selectedReferenceItems) {
+				if (property instanceof StructuralUnitProperty) {
+					StructuralUnitProperty sProperty = (StructuralUnitProperty) property;
+					selectedItems.add(sProperty.getStructuralUnit().getName()
+							+ ": " + property.getName()); //$NON-NLS-1$
+				} else {
+					selectedItems.add(property.getName());
+				}
+			}
+			
+			//DBL CLICK Listeners
+			selectedItems.addMouseListener(new MouseListener() {
+				@Override
+				public void mouseUp(MouseEvent e) { }
+				
+				@Override
+				public void mouseDown(MouseEvent e) { }
+				
+				@Override
+				public void mouseDoubleClick(MouseEvent e) {
+					int ind = selectedItems.getSelectionIndex();
+					availbleItems.add(selectedItems.getItem(ind));
+					selectedItems.remove(ind);
+					availableReferenceItems
+							.add(selectedReferenceItems.get(ind));
+					selectedReferenceItems.remove(ind);
+					selectedItems.setSelection(ind);	
+				}
+			});
+			availbleItems.addMouseListener(new MouseListener() {
+				@Override
+				public void mouseUp(MouseEvent e) { }
+				
+				@Override
+				public void mouseDown(MouseEvent e) { }
+				
+				@Override
+				public void mouseDoubleClick(MouseEvent e) {
+					int ind = availbleItems.getSelectionIndex();
+					selectedItems.add(availbleItems.getItem(ind));
+					availbleItems.remove(ind);
+					selectedReferenceItems
+							.add(availableReferenceItems.get(ind));
+					availableReferenceItems.remove(ind);
+					availbleItems.setSelection(ind);
+				}
+			});
+
+			Composite orderButtons = new Composite(mainArea, SWT.NONE);
+			orderButtons.setLayout(new GridLayout(1, false));
+			Button up = new Button(orderButtons, SWT.ARROW | SWT.UP);
+			Button down = new Button(orderButtons, SWT.ARROW | SWT.DOWN);
+
+			select.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int ind = availbleItems.getSelectionIndex();
+					selectedItems.add(availbleItems.getItem(ind));
+					availbleItems.remove(ind);
+					selectedReferenceItems
+							.add(availableReferenceItems.get(ind));
+					availableReferenceItems.remove(ind);
+					availbleItems.setSelection(ind);
+				}
+			});
+
+			unselect.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int ind = selectedItems.getSelectionIndex();
+					availbleItems.add(selectedItems.getItem(ind));
+					selectedItems.remove(ind);
+					availableReferenceItems
+							.add(selectedReferenceItems.get(ind));
+					selectedReferenceItems.remove(ind);
+					selectedItems.setSelection(ind);					
+				}
+			});
+
+			up.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int ind = selectedItems.getSelectionIndex();
+					if (ind > 0) {
+						String value = selectedItems.getItem(ind);
+						selectedItems.remove(ind);
+						selectedItems.add(value, ind -1);
+						
+						Property prop = selectedReferenceItems.get(ind);
+						selectedReferenceItems.remove(ind);
+						selectedReferenceItems.add(ind-1,prop);
+						
+						selectedItems.setSelection(ind -1);
+					}
+				}
+			});
+
+			down.addSelectionListener(new SelectionAdapter() {
+				@Override
+				public void widgetSelected(SelectionEvent e) {
+					int ind = selectedItems.getSelectionIndex();
+					if (ind < selectedItems.getItemCount() - 1) {
+						String value = selectedItems.getItem(ind);
+						selectedItems.remove(ind);
+						selectedItems.add(value, ind + 1);
+						
+						Property prop = selectedReferenceItems.get(ind);
+						selectedReferenceItems.remove(ind);
+						selectedReferenceItems.add(ind+1, prop);
+						
+						selectedItems.setSelection(ind + 1);
+					}
+				}
+			});
+
+			return mainArea;
+		}
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/actions/DefineSortReferencePattern.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/BackToTextCommand.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/BackToTextCommand.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/BackToTextCommand.java	(revision 363)
@@ -0,0 +1,18 @@
+package org.txm.concordance.rcp.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.txm.concordance.core.functions.Line;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+
+public abstract class BackToTextCommand extends AbstractHandler {
+
+	protected String name = "BackToText"; //$NON-NLS-1$
+	@Override
+	public abstract Object execute(ExecutionEvent event) throws ExecutionException;
+	
+	public boolean backToText(ConcordanceEditor editor, Line line) {
+		return false;
+	}
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/ComputeConcordance.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/ComputeConcordance.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/ComputeConcordance.java	(revision 363)
@@ -0,0 +1,226 @@
+// 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.concordance.rcp.handlers;
+
+import javax.inject.Inject;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.e4.ui.model.application.ui.advanced.MPerspective;
+import org.eclipse.e4.ui.model.application.ui.advanced.impl.PerspectiveStackImpl;
+import org.eclipse.e4.ui.model.application.ui.advanced.impl.PlaceholderImpl;
+import org.eclipse.e4.ui.model.application.ui.basic.MPartSashContainerElement;
+import org.eclipse.e4.ui.model.application.ui.basic.MStackElement;
+import org.eclipse.e4.ui.model.application.ui.basic.impl.PartSashContainerImpl;
+import org.eclipse.e4.ui.model.application.ui.basic.impl.PartStackImpl;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PartInitException;
+import org.txm.Toolbox;
+import org.txm.concordance.core.functions.Concordance;
+import org.txm.concordance.rcp.editors.ConcordanceEditorInput;
+import org.txm.cooccurrence.rcp.editors.CooccurrenceEditorInput;
+import org.txm.rcp.Messages;
+import org.txm.rcp.StatusLine;
+import org.txm.rcp.TXMWindows;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.Corpus;
+
+/**
+ * Opens the concordance editor.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ComputeConcordance extends BaseAbstractHandler {
+
+	
+	
+	// adds a double click listener to the Corpus View
+	static	{
+		CorporaView.addDoubleClickListener(Concordance.class, ComputeConcordance.class);
+	}
+
+	
+
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		
+		Object selection = this.getSelection();
+		if (!(selection instanceof Corpus))
+			return null;
+		Corpus corpus = (Corpus) selection;
+		if (openEditor(corpus)) {
+
+		} else {
+			System.out.println(Messages.ComputeConcordance_1);
+		}
+
+		return null;
+	}
+
+	@Inject
+	public static boolean openEditor(Corpus corpus) {
+		if (!Toolbox.isSearchEngineInitialized()) return false;
+		
+		ConcordanceEditorInput editorInput = new ConcordanceEditorInput(corpus, null);
+
+		// FIXME: MD: test of manipulating the editor's position in the UI
+		/*
+		Workbench wb = (Workbench) PlatformUI.getWorkbench();
+
+		System.out.println("Workbench: " + wb);
+		for (IWorkbenchWindow iwindow : wb.getWorkbenchWindows()) {
+			WorkbenchWindow window = (WorkbenchWindow) iwindow;
+
+			System.out.println(" Window: "+window);
+			for (IWorkbenchPage ipage :window.getPages()) {
+				WorkbenchPage page = (WorkbenchPage)ipage;
+				System.out.println("  Page: "+page);
+				
+				for (IEditorReference ieditor : page.getInternalEditorReferences()) {
+					EditorReference editor = (EditorReference)ieditor;
+					System.out.println("   Editor: "+editor+" "+editor.getId());
+					System.out.println("    part: "+ieditor.getPart(false));
+				}
+				for (IEditorPart dirtyEditor : page.getDirtyEditors()) {
+					System.out.println("   IEditorPart: "+dirtyEditor);
+				}
+
+				for (ISaveablePart dirtyPart : page.getDirtyParts()) {
+					System.out.println("   ISaveablePart: "+dirtyPart);
+				}
+
+				for (EditorReference editorref : page.getInternalEditorReferences()) {
+					System.out.println("   EditorReference: "+editorref+" "+editorref.getId());
+				}
+				//				for (IViewReference viewref : page.getViewReferences()) {
+				//					System.out.println("   IViewReference: "+viewref+" "+viewref.getId());
+				//				}
+				for (IWorkingSet iworkingset : page.getWorkingSets()) {
+					WorkingSet workingset = (WorkingSet)iworkingset;
+					System.out.println("   WorkingSet: "+workingset+" "+workingset.getId());
+					for (IAdaptable a : workingset.getElements()) {
+						System.out.println("    IAdaptable: "+a);
+					}
+				}
+
+				MWindow modelwindow = window.getModel();
+				
+				System.out.println("MWindow: "+modelwindow);
+				for (MWindowElement elem : modelwindow.getChildren()) {
+					if (elem instanceof PartSashContainerImpl) {
+						printChildren(elem, " ");
+//						PartSashContainerImpl psc = (PartSashContainerImpl)elem;
+//						System.out.println(" PartSashContainerImpl: "+psc);
+//						for (MPartSashContainerElement elem2 : psc.getChildren()) {
+//
+//							if (elem2 instanceof PerspectiveStackImpl) {
+//								PerspectiveStackImpl psi = (PerspectiveStackImpl)elem2;
+//								System.out.println("  PerspectiveStackImpl: "+psi);
+//								for (MPerspective p : psi.getChildren()) {
+//									System.out.println("   MPerspective: "+p);
+//									for (MPartSashContainerElement elem3 : p.getChildren()) {
+//										if (elem3 instanceof PartSashContainerImpl) {
+//											PartSashContainerImpl psci = (PartSashContainerImpl)elem3;
+//											printChildren(psci, "    ");
+//										} else {
+//											System.out.println("    MPartSashContainerElement: "+elem3);
+//										}
+//									}
+//								}
+//							} else if (elem2 instanceof PartStackImpl) {
+//								PartStackImpl psi = (PartStackImpl)elem2;
+//								System.out.println("  PartStackImpl: "+psi);
+//								for (MStackElement e : psi.getChildren()) {
+//									System.out.println("   MStackElement: "+e);
+//								}
+//							} else {
+//								System.out.println("  MPartSashContainerElement: "+elem2+" id="+elem2.getElementId());
+//							}
+//						}
+					} else {
+						System.out.println(" MWindowElement: "+elem);
+					}
+				}
+			}
+		}
+	*/
+		try {
+			StatusLine.setMessage(Messages.ComputeConcordance_0);
+			IEditorPart editor = TXMWindows.getActiveWindow().getActivePage().openEditor(editorInput, "ConcordanceEditor"); //$NON-NLS-1$
+			
+//			WorkbenchWindow window = (WorkbenchWindow)TXMWindows.getActiveWindow();
+//			MWindow model = window.getModel();
+//			EModelService modelService = model.getContext().get(EModelService.class);
+//			EPartService partService = model.getContext().get(EPartService.class);
+//			modelService.find("org.eclipse.ui.editorss", model); // find org.eclipse.ui.editorss?					
+//			MPart part = partService.createPart("org.txm.rcp.editors.ConcordancesEditor");
+//// NEXT STEPS : find partStack, add the part, show the part http://stackoverflow.com/questions/26912078/open-an-editing-partas-an-editor-in-previous-eclipse-versions-in-eclipse-rcp-4
+// ? direct access to PlaceholderImpl : elementId=org.eclipse.ui.editorss	
+			if (editor == null) return false;
+			
+		} catch (PartInitException e) {
+			System.err.println(NLS.bind(Messages.GetConcordances_4, e));
+			e.printStackTrace();
+		}
+		return true;
+	}
+
+
+	private static void printChildren(Object o, String space) {
+
+		System.out.println(space+o.getClass().getSimpleName()+": "+o);
+		
+		if (o instanceof PlaceholderImpl) {
+			PlaceholderImpl phi = (PlaceholderImpl)o;
+			System.out.println("phi: "+phi);
+		} else if (o instanceof PartSashContainerImpl) {
+			PartSashContainerImpl psci = (PartSashContainerImpl)o;
+			for (MPartSashContainerElement e :psci.getChildren()) {
+				printChildren(e, space+" ");
+			}
+		} else if (o instanceof PerspectiveStackImpl) {
+			PerspectiveStackImpl psi = (PerspectiveStackImpl)o;
+			for (MPerspective p : psi.getChildren()) {
+				printChildren(p,space+" ");
+			}
+		} else if (o instanceof MPerspective) {
+			MPerspective p = (MPerspective)o;
+			for (MPartSashContainerElement e : p.getChildren()) {
+				printChildren(e, space+" ");
+			}
+		} else if (o instanceof PartStackImpl) {
+			PartStackImpl psi = (PartStackImpl)o;
+			for (MStackElement e : psi.getChildren()) {
+				printChildren(e, space+" ");
+			}
+		}
+	}
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/DeleteLines.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/DeleteLines.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/handlers/DeleteLines.java	(revision 363)
@@ -0,0 +1,92 @@
+// 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.concordance.rcp.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.concordance.core.functions.Concordance;
+import org.txm.concordance.core.functions.Line;
+import org.txm.concordance.rcp.editors.ConcordanceEditor;
+
+/**
+ * Allow the user to delete lines in a Concordance table.
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class DeleteLines extends AbstractHandler {
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event)
+				.getShell();
+		// ISelection selection =
+		// HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getSelection();
+
+		IWorkbenchPart editor = HandlerUtil.getActiveWorkbenchWindow(event)
+				.getActivePage().getActivePart();
+		if (editor instanceof ConcordanceEditor) {
+			ConcordanceEditor ceditor = (ConcordanceEditor) editor;
+			deleteConcordanceLines(ceditor);
+		}
+
+		return null;
+	}
+
+
+	public static void deleteConcordanceLines(ConcordanceEditor editor) {
+		TableViewer viewer = editor.getLineTableViewer();
+		Concordance concordance = editor.getConcordance();
+		if (concordance == null) return;
+		IStructuredSelection sel = (IStructuredSelection) viewer.getSelection();
+		@SuppressWarnings("unchecked")
+		List<Line> lines = sel.toList();
+
+		if (lines.size() == 0) return;
+
+		try {
+		//	System.out.println("Delete line "+lines);
+			if (concordance.removeLines(lines)) {
+				editor.fillDisplayArea(editor.getTopLine(), editor.getBottomLine()-lines.size());
+			}
+		} catch (Exception e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+	}
+}

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

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/preferences/ConcordancePreferencePage.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/preferences/ConcordancePreferencePage.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/preferences/ConcordancePreferencePage.java	(revision 363)
@@ -0,0 +1,63 @@
+// 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.concordance.rcp.preferences;
+
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.ui.IWorkbench;
+import org.txm.concordance.core.preferences.ConcordancePreferences;
+import org.txm.concordance.rcp.adapters.ConcordanceAdapterFactory;
+import org.txm.rcp.Messages;
+import org.txm.rcp.preferences.TXMPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+
+/**
+ * Concordance preferences page.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class ConcordancePreferencePage extends TXMPreferencePage {
+	
+
+	@Override
+	protected void createFieldEditors() {
+		this.addField(new IntegerFieldEditor(ConcordancePreferences.N_LINE_PER_PAGE, Messages.ConcordancerPreferencePage_4, this.getFieldEditorParent()));
+		this.addField(new IntegerFieldEditor(ConcordancePreferences.LEFT_CONTEXT_SIZE, Messages.ConcordancerPreferencePage_5, this.getFieldEditorParent()));
+		this.addField(new IntegerFieldEditor(ConcordancePreferences.RIGHT_CONTEXT_SIZE, Messages.ConcordancerPreferencePage_6, this.getFieldEditorParent()));
+	}
+	
+	
+
+	@Override
+	public void init(IWorkbench workbench) {
+		this.setPreferenceStore(new TXMPreferenceStore(ConcordancePreferences.PREFERENCES_NODE));
+		this.setTitle(Messages.ConcordancerPreferencePage_3);
+		this.setImageDescriptor(ConcordanceAdapterFactory.ICON);
+	}
+}

Property changes on: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/preferences/ConcordancePreferencePage.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/adapters/ConcordanceAdapterFactory.java
===================================================================
--- tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/adapters/ConcordanceAdapterFactory.java	(revision 0)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/adapters/ConcordanceAdapterFactory.java	(revision 363)
@@ -0,0 +1,41 @@
+// Copyright © 2010-2013 ENS de Lyon.
+package org.txm.concordance.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.concordance.core.functions.Concordance;
+import org.txm.rcp.adapters.TXMResultAdapter;
+import org.txm.rcp.adapters.TXMResultAdapterFactory;
+
+
+/**
+ * A factory for creating Adapter objects.
+ *  
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ConcordanceAdapterFactory extends TXMResultAdapterFactory {
+
+	
+	public static final ImageDescriptor ICON =
+			AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(ConcordanceAdapterFactory.class).getSymbolicName(),
+					"platform:/plugin/"+ FrameworkUtil.getBundle(ConcordanceAdapterFactory.class).getSymbolicName() + "/icons/concordance.png"); //$NON-NLS-1$
+	
+
+	@Override
+	public Object getAdapter(Object adaptableObject, Class adapterType) {
+		if(adapterType == IWorkbenchAdapter.class && adaptableObject instanceof Concordance)	{
+			return new TXMResultAdapter() {
+				@Override
+				public ImageDescriptor getImageDescriptor(Object object) {
+					return ICON;
+				}
+			};
+		}
+		return null;
+	}
+
+
+}

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

