Index: tmp/org.txm.progression.rcp/build.properties
===================================================================
--- tmp/org.txm.progression.rcp/build.properties	(revision 0)
+++ tmp/org.txm.progression.rcp/build.properties	(revision 35)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               plugin.xml,\
+               OSGI-INF/l10n/bundle.properties

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

Index: tmp/org.txm.progression.rcp/OSGI-INF/l10n/bundle.properties
===================================================================
--- tmp/org.txm.progression.rcp/OSGI-INF/l10n/bundle.properties	(revision 0)
+++ tmp/org.txm.progression.rcp/OSGI-INF/l10n/bundle.properties	(revision 35)
@@ -0,0 +1,6 @@
+#Properties file for org.txm.rcp.progression
+Bundle-Name = Progression
+page.name = Progression2
+command.name = Progression2
+command.label = Progression2
+command.tooltip=Process the progression graphic of a query

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

Index: tmp/org.txm.progression.rcp/OSGI-INF/l10n/bundle_fr.properties
===================================================================
--- tmp/org.txm.progression.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 0)
+++ tmp/org.txm.progression.rcp/OSGI-INF/l10n/bundle_fr.properties	(revision 35)
@@ -0,0 +1,6 @@
+#Properties file for org.txm.rcp.progression
+Bundle-Name = Progression
+page.name = Progression2
+command.name = Progression2
+command.label = Progression2
+command.tooltip=Affiche le graphique de progression d'une requ�te
\ No newline at end of file

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

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

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

Index: tmp/org.txm.progression.rcp/plugin.xml
===================================================================
--- tmp/org.txm.progression.rcp/plugin.xml	(revision 0)
+++ tmp/org.txm.progression.rcp/plugin.xml	(revision 35)
@@ -0,0 +1,110 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            category="org.txm.rcpapplication.preferences.UserPreferencePage"
+            class="org.txm.progression.rcp.preferences.ProgressionPreferencePage"
+            id="org.txm.rcp.progression.preferences.ProgressionPreferencePage"
+            name="%page.name">
+      </page>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            categoryId="org.txm.rcpapplication.category.txm"
+            defaultHandler="org.txm.progression.rcp.handlers.ComputeProgression"
+            id="ComputeProgression"
+            name="%command.name">
+      </command>
+   </extension>
+   <extension
+         point="org.eclipse.ui.menus">
+      <menuContribution
+            allPopups="false"
+            locationURI="toolbar:org.txm.rcpapplication.toolbartools">
+         <command
+               commandId="ComputeProgression"
+               icon="icons/functions/progression.png"
+               label="%command.label"
+               style="push"
+               tooltip="%command.tooltip">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            allPopups="false"
+            locationURI="popup:org.txm.rcpapplication.views.CorporaView">
+         <command
+               commandId="ComputeProgression"
+               icon="icons/functions/progression.png"
+               label="%command.label"
+               style="push"
+               tooltip="%command.tooltip">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            locationURI="menu:menu.tools">
+         <command
+               commandId="ComputeProgression"
+               icon="icons/functions/progression.png"
+               label="%command.label"
+               style="push"
+               tooltip="%command.tooltip">
+            <visibleWhen
+                  checkEnabled="false">
+               <or>
+                  <reference
+                        definitionId="OneCorpusSelected">
+                  </reference>
+               </or>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+   </extension>
+   <extension
+         point="org.txm.chartsengine.eventcallback">
+      <EventCallBack
+            chartsEngineName="jfreechart_charts_engine"
+            class="org.txm.progression.rcp.chartsengine.jfreechart.events.ProgressionEventCallBack"
+            resultDataClass="org.txm.progression.tbx.functions.Progression2">
+      </EventCallBack>
+   </extension>
+   <extension
+         point="org.eclipse.core.runtime.adapters">
+      <factory
+            adaptableType="org.txm.progression.core.functions.Progression2"
+            class="org.txm.progression.rcp.adapters.ProgressionAdapterFactory">
+         <adapter
+               type="org.eclipse.ui.model.IWorkbenchAdapter">
+         </adapter>
+      </factory>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            class="org.txm.chartsengine.rcp.editors.ChartEditorPart"
+            default="false"
+            icon="icons/functions/progression.png"
+            id="org.txm.progression.core.functions.Progression2"
+            name="Progression">
+      </editor>
+   </extension>
+
+</plugin>

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

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

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

Index: tmp/org.txm.progression.rcp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.progression.rcp/META-INF/MANIFEST.MF	(revision 0)
+++ tmp/org.txm.progression.rcp/META-INF/MANIFEST.MF	(revision 35)
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.txm.progression.rcp;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.txm.chartsengine.jfreechart.core;bundle-version="1.0.0",
+ org.eclipse.swt,
+ org.txm.rcpapplication,
+ org.txm.chartsengine.core,
+ org.txm.chartsengine.r.core;bundle-version="1.0.0",
+ org.eclipse.core.runtime;bundle-version="3.10.0",
+ org.txm.chartsengine.svgbatik.rcp;bundle-version="1.0.0",
+ org.txm.progression.core;bundle-version="1.0.0",
+ org.txm.chartsengine.rcp;bundle-version="1.0.0"
+Export-Package: org.txm.progression.rcp.adapters

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

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

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java	(revision 35)
@@ -0,0 +1,296 @@
+// 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.progression.rcp.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.txm.Toolbox;
+import org.txm.chartsengine.core.ChartsEngine;
+import org.txm.chartsengine.r.core.RChartsEngine;
+import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
+import org.txm.chartsengine.rcp.editors.ChartEditorPart;
+import org.txm.chartsengine.rcp.events.BaseSelectionListener;
+import org.txm.chartsengine.rcp.events.EventCallBack;
+import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages;
+import org.txm.chartsengine.svgbatik.rcp.SVGSWTChartsComponentsProvider;
+import org.txm.progression.core.functions.Progression2;
+import org.txm.progression.core.messages.TBXProgressionMessages;
+import org.txm.progression.core.preferences.ProgressionPreferences;
+import org.txm.progression.rcp.chartsengine.jfreechart.events.ProgressionSelectionListener;
+import org.txm.progression.rcp.dialogs.ProgressionDialog;
+import org.txm.progression.rcp.forms.ProgressionParametersComposite;
+import org.txm.progression.rcp.preferences.ProgressionPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+import org.txm.rcpapplication.Application;
+import org.txm.rcpapplication.IImageKeys;
+import org.txm.rcpapplication.JobsTimer;
+import org.txm.rcpapplication.Messages;
+import org.txm.rcpapplication.StatusLine;
+import org.txm.rcpapplication.utils.JobHandler;
+import org.txm.rcpapplication.views.CorporaView;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.utils.logger.Log;
+
+/**
+ * Open the ProgressionDialog, computes and opens the result editor part.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ComputeProgression extends AbstractHandler {
+	
+	
+	// FIXME: should be put in an Activator? or better in an extension point loaded by the corpora view? or in a method called here as initTreeDoubleClickListener(Class resultDataType, String commandId)?
+	// adds a double click listener to the Corpus View
+	static	{
+		CorporaView.addDoubleClickListener(Progression2.class, "ComputeProgression"); //$NON-NLS-1$
+	}
+	
+	
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+		if (!Toolbox.isSearchEngineInitialized()) return false;
+		
+		if (!Toolbox.isStatEngineInitialized()) {
+			Log.severe(TBXProgressionMessages.ComputeProgression_5);
+			return null;
+		}
+		
+		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
+
+		
+		 
+		// Computes a new progression
+		if(selection.getFirstElement() instanceof Corpus)	{
+			Corpus corpus = (Corpus) selection.getFirstElement();
+
+			if (!Progression2.canRunProgression(corpus)) {
+				Log.severe(TBXProgressionMessages.ComputeProgression_0);
+				// La fonctionnalité Progression n'est pas encore disponible pour les sous-corpus discontinus.
+				return null;
+			}
+
+			
+			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
+			ProgressionDialog d = new ProgressionDialog(shell, corpus);
+			
+			int code = d.open();
+			if (code == Window.OK) {
+				computeProgression(d);
+			}
+
+		}
+		// Reopens a progression result with default preferences
+		else if(selection.getFirstElement() instanceof Progression2)	{
+			
+			Progression2 progression = (Progression2) selection.getFirstElement();
+			TXMPreferenceStore store = ProgressionPreferencePage.getNewPreferenceStore();
+			
+			openEditor(progression,
+					store.getBoolean(ProgressionPreferences.MONOCHROMATIC),
+					store.getBoolean(ProgressionPreferences.MONO_STYLE),
+					store.getBoolean(ProgressionPreferences.CUMULATIVE));
+		}
+		
+		return null;
+	}
+
+	
+	
+	
+	/**
+	 * 
+	 * @param progression
+	 * @param monochrome
+	 * @param monoStyle
+	 * @param cumulative
+	 * @return
+	 */
+	public static ChartEditorPart openEditor(Progression2 progression, boolean monochrome, boolean monoStyle, boolean cumulative) {
+		
+		ChartEditorPart editor = null;
+		
+		// FIXME: temporary force R/SVG version because the Progression density chart is not yet implemented in JFC mode
+		if(!cumulative)	{
+			SVGSWTChartsComponentsProvider tmpSWTComponentsProvider = (SVGSWTChartsComponentsProvider) SWTChartsComponentsProvider.getComponentsProvider(SVGSWTChartsComponentsProvider.class);
+			RChartsEngine tmpChartsEngine = (RChartsEngine) ChartsEngine.getChartsEngine(RChartsEngine.class);									
+			tmpSWTComponentsProvider.setChartsEngine(tmpChartsEngine);
+			
+			// Create and open the chart editor
+			editor = tmpSWTComponentsProvider.openEditor(progression.getCorpus().getName() + ": " + progression.getName(), progression, ProgressionPreferences.PREFERENCES_NODE);
+		}
+		else	{
+			// Create and open the chart editor
+			editor = SWTChartsComponentsProvider.getCurrent().openEditor(progression.getCorpus().getName() + ": " + progression.getName(), progression, ProgressionPreferences.PREFERENCES_NODE);
+
+			
+
+			// FIXME: tests parameters composite extension
+			if(!editor.wasAlreadyOpened())	{
+				new ProgressionParametersComposite(editor.getParametersComposite(), SWT.NONE);
+			}
+			
+			
+	
+			// FIXME: to discuss
+//			// initialize extended menus for item selection
+//			Menu menu = editor.getComposite().getContextMenu(EventCallBack.AREA_ITEM);
+//			
+//			// send to index
+//			MenuItem sendToIndex = new MenuItem(menu.getItem(0).getMenu(), SWT.CASCADE);
+//		    sendToIndex.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHARED_SEND_SELECTION_TO_INDEX);
+//		    sendToIndex.setImage(IImageKeys.getImage(IImageKeys.ACTION_INDEX));
+//		    sendToIndex.addSelectionListener(new ProgressionSelectionListener(editor, BaseSelectionListener.SEND_TO_INDEX));
+//
+//		    // send to concordance
+//			MenuItem sendToConcordance = new MenuItem(menu.getItem(0).getMenu(), SWT.CASCADE);
+//		    sendToConcordance.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHARED_SEND_SELECTION_TO_CONCORDANCE);
+//		    sendToConcordance.setImage(IImageKeys.getImage(IImageKeys.ACTION_CONCORDANCES));
+//		    sendToConcordance.addSelectionListener(new ProgressionSelectionListener(editor, BaseSelectionListener.SEND_TO_CONCORDANCE));
+//		    
+//		    // send to cooccurrence
+//			MenuItem sendToCoorccurrence = new MenuItem(menu.getItem(0).getMenu(), SWT.CASCADE);
+//		    sendToCoorccurrence.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHARED_SEND_SELECTION_TO_COOCCURRENCE);
+//		    sendToCoorccurrence.setImage(IImageKeys.getImage(IImageKeys.ACTION_COOCCURRENCE));
+//		    sendToCoorccurrence.addSelectionListener(new ProgressionSelectionListener(editor, BaseSelectionListener.SEND_TO_COOCCURRENCE));
+//		    //*****************************************************
+
+		}
+		
+		return editor;
+	}
+	
+	
+	
+	
+	/**
+	 * Computes progression and open the result editor.
+	 *
+	 * @param dialog the dialog box
+	 */
+	public static Object computeProgression(final ProgressionDialog dialog) {
+		if (!Toolbox.isSearchEngineInitialized()) return false;
+		
+		JobHandler jobhandler = new JobHandler(NLS.bind(TBXProgressionMessages.ComputeProgression_2, dialog.getQueries(), dialog.getCorpus().getName())) {
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				this.runInit(monitor);
+				JobsTimer.start();
+				try {
+					final Corpus corpus = dialog.getCorpus();
+					if (dialog.getQueries().size() == 0) {
+						Log.severe(TBXProgressionMessages.ComputeProgression_6);
+						return Status.CANCEL_STATUS;
+					}
+
+					final Progression2 progression = new Progression2(dialog.getCorpus(), dialog.getQueries(), dialog.getStructuralUnit(), dialog.getStructuralProperty(), dialog.getPropertyregex(),
+							dialog.isCumulativeType(), dialog.getLineWidth(), dialog.isRepeatvalues(), dialog.getBandeMultiplier());
+					
+					Log.info(NLS.bind(TBXProgressionMessages.ComputeProgression_4, 
+							new Object[]{dialog.getCorpus(), dialog.getQueries(), dialog.getStructuralUnit(), dialog.getStructuralProperty(), dialog.isCumulativeType()}));
+					
+					
+					
+					monitor.worked(50);
+					if (monitor.isCanceled())
+						return Status.CANCEL_STATUS;
+					boolean success = true;//progression.process();
+
+					if (!progression.stepQueries()) {
+						System.out.println(TBXProgressionMessages.ComputeProgression_3);
+						return Status.CANCEL_STATUS;
+					}
+					if (monitor.isCanceled()) return Status.CANCEL_STATUS;
+					monitor.worked(10);
+
+					if (!progression.stepStructuralUnits() || monitor.isCanceled())
+						return Status.CANCEL_STATUS;
+					monitor.worked(20);
+
+					if (!progression.stepFinalize() || monitor.isCanceled())
+						return Status.CANCEL_STATUS;
+					monitor.worked(20);
+
+					// System.out.println("success : "+success);
+					if (success) {
+						syncExec(new Runnable() {
+							@Override
+							public void run() {
+								
+								openEditor(progression, dialog.isMonochrome(), dialog.isMonoStyle(), dialog.isCumulativeType());
+									
+								StatusLine.setMessage(TBXProgressionMessages.ComputeProgression_10);
+								
+							}
+						});
+					}
+					monitor.worked(45);
+
+					monitor.subTask(Messages.CreatePartition_9);
+					CorporaView.storeResult(corpus, progression);
+					
+					monitor.worked(5);
+					System.out.println(NLS.bind(TBXProgressionMessages.ComputeProgression_12, progression.getPositionsCounts()));
+				} catch (ThreadDeath td) { 
+					return Status.CANCEL_STATUS;
+				} catch (Exception e) {
+					System.out.println(NLS.bind(TBXProgressionMessages.ComputeProgression_13, e));
+					Log.severe(TBXProgressionMessages.ComputeProgression_13 + Log.toString(e));
+					try {
+						System.out.println(Messages.LastCQPError + Toolbox.getCqiClient().getLastCQPError());
+					} catch (Exception e1) {
+						System.out.println(TBXProgressionMessages.ComputeProgression_1 + e1);
+						Log.printStackTrace(e1);
+					}
+				} finally {
+					monitor.done();
+					JobsTimer.stopAndPrint();
+				}
+				return Status.OK_STATUS;
+			}
+		};
+		jobhandler.startJob();
+		return null;
+	}
+}

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

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java	(revision 35)
@@ -0,0 +1,141 @@
+// 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.progression.rcp.preferences;
+
+import org.apache.batik.gvt.event.SelectionAdapter;
+import org.apache.batik.gvt.event.SelectionEvent;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+import org.eclipse.ui.IWorkbench;
+import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
+import org.txm.progression.core.preferences.ProgressionPreferences;
+import org.txm.progression.rcp.messages.RCPProgressionMessages;
+import org.txm.rcp.preferences.TXMPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+import org.txm.rcpapplication.TxmPreferences;
+import org.txm.rcpapplication.jface.DoubleFieldEditor;
+// TODO: Auto-generated Javadoc
+/**
+ * This class represents a preference page that is contributed to the
+ * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>, we
+ * can use the field support built into JFace that allows us to create a page
+ * that is small and knows how to save, restore and apply itself.
+ * <p>
+ * This page is used to modif y preferences only. They are stored in the
+ * preference store that belongs to the main plug-in class. That way,
+ * preferences can be accessed directly via the preference store.
+ */
+
+public class ProgressionPreferencePage extends TXMPreferencePage {
+
+	/** The Constant ID. */
+	public static final String ID = "org.txm.rcp.progression.preferences.ProgressionPreferencePage"; //$NON-NLS-1$
+
+	/** The bande multiplier field. */
+	private DoubleFieldEditor bandemultiplierfield;
+
+
+	/**
+	 * Instantiates a new progression preference page.
+	 */
+	public ProgressionPreferencePage() {
+		super();
+	}
+
+	
+	/**
+	 * 
+	 * @return
+	 */
+	public static TXMPreferenceStore getNewPreferenceStore()	{
+		return new TXMPreferenceStore(ProgressionPreferences.PREFERENCES_NODE);
+	}
+
+	
+	/**
+	 * Creates the field editors. Field editors are abstractions of the common
+	 * GUI blocks needed to manipulate various types of preferences. Each field
+	 * editor knows how to save and restore itself.
+	 */
+	@Override
+	public void createFieldEditors() {
+
+		
+		// FIXME: tabbed preferences page test
+//		TabFolder tabFolder = new TabFolder(this.getFieldEditorParent(), SWT.TOP);
+//		tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+////		for(int i = 1; i < 4; i++) {
+//			 TabItem tabItem = new TabItem(tabFolder, SWT.NULL);
+//			 tabItem.setText("Graphiques");
+//	         Composite composite = new Composite(tabFolder, SWT.NULL);
+//	         tabItem.setControl(composite);
+//	         this.addField(new BooleanFieldEditor(ProgressionPreferences.CUMULATIVE, RCPProgressionMessages.ProgressionPreferencePage_3, composite));   
+////	      }
+		
+		
+		// Charts rendering
+		Group chartsGroup = SWTChartsComponentsProvider.createChartsRenderingPreferencesGroup(this.getFieldEditorParent());
+		
+		this.addField(new BooleanFieldEditor(ProgressionPreferences.CUMULATIVE, RCPProgressionMessages.ProgressionPreferencePage_3, chartsGroup));
+		this.addField(new BooleanFieldEditor(ProgressionPreferences.MONOCHROMATIC, RCPProgressionMessages.ProgressionPreferencePage_4, chartsGroup));
+		this.addField(new BooleanFieldEditor(ProgressionPreferences.MONO_STYLE, RCPProgressionMessages.ProgressionPreferencePage_5, chartsGroup));
+		this.addField(new BooleanFieldEditor(ProgressionPreferences.REPEAT_VALUES, RCPProgressionMessages.ProgressionPreferencePage_6, chartsGroup));
+		
+		
+		float test = TxmPreferences.getFloat(ProgressionPreferences.BANDE_MULTIPLIER, 999f);
+		if (test == 999f)	{
+			TxmPreferences.set(ProgressionPreferences.BANDE_MULTIPLIER, 1.0f);
+		}
+		
+		DoubleFieldEditor bandemultiplierfield = new DoubleFieldEditor(ProgressionPreferences.BANDE_MULTIPLIER, RCPProgressionMessages.ProgressionPreferencePage_7, chartsGroup);
+		this.addField(bandemultiplierfield);
+		// FIXME: valid range
+		//if (bandemultiplierfield.getIntValue() == 0)
+		//	bandemultiplierfield.setStringValue("1");
+		//bandemultiplierfield.setValidRange(1, 10);
+		
+		
+		
+
+	}
+
+	@Override
+	public void init(IWorkbench workbench) {
+		this.setPreferenceStore(getNewPreferenceStore());
+		//setDescription("Progression");
+		this.setTitle(RCPProgressionMessages.ProgressionPreferencePage_2);
+		
+	}
+
+}

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

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/dialogs/ProgressionDialog.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/dialogs/ProgressionDialog.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/dialogs/ProgressionDialog.java	(revision 35)
@@ -0,0 +1,620 @@
+// 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.progression.rcp.dialogs;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+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.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.txm.progression.core.functions.Progression2;
+import org.txm.progression.core.preferences.ProgressionPreferences;
+import org.txm.progression.rcp.preferences.ProgressionPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+import org.txm.rcpapplication.Messages;
+import org.txm.rcpapplication.StatusLine;
+import org.txm.rcpapplication.TxmPreferences;
+import org.txm.rcpapplication.swt.widget.AssistedQueryWidget;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
+import org.txm.searchengine.cqp.corpus.query.Query;
+import org.txm.utils.logger.Log;
+
+/**
+ * Allow the user to choose : the type of the graphic the structural units,
+ * property and values to be shown the queries of each curves.
+ *
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ProgressionDialog extends Dialog {
+
+	/** The query widgets. */
+	protected List<AssistedQueryWidget> queryWidgets = new ArrayList<AssistedQueryWidget>();
+	
+	/** The queries. */
+	List<Query> queries;
+	
+	/** The corpus. */
+	private Corpus corpus;
+	
+	/** The selected structural unit. */
+	private StructuralUnit selectedStructuralUnit;
+	
+	/** The selected structural unit property. */
+	private StructuralUnitProperty selectedStructuralUnitProperty;
+	
+	/** The regexproperty value. */
+	private String regexpropertyValue;
+	
+	/** The graphtype. */
+	private boolean cumulative = true;
+	
+	/** The monochrome. */
+	private boolean monochrome = true;
+	
+	/** The monostyle. */
+	private boolean monostyle = true;
+	
+	/** The repeatvalues. */
+	private boolean repeatvalues = false;
+	
+	/** The linewidth. */
+	private int linewidth = 2;
+	
+	/** The bandemultiplier. */
+	private float bandemultiplier = 2;
+
+	/** The structural units combo. */
+	Combo structuralUnitsCombo;
+	
+	/** The structural units. */
+	List<StructuralUnit> structuralUnits;
+	
+	/** The structural units properties. */
+	List<StructuralUnitProperty> structuralUnitsProperties;
+	
+	/** The property combo. */
+	private Combo propertyCombo;
+	
+	/** The regex value. */
+	private Text regexValue;
+
+	/** The focus composite. */
+	Composite focusComposite;
+	
+	/** The main panel. */
+	Composite mainPanel;
+	
+	/** The bande field. */
+	Text bandeField;
+	
+	/** The cumu button. */
+	Button cumuButton;
+	
+	/** The repeat button. */
+	Button repeatButton;
+	
+	/** The color button. */
+	Button colorButton;
+	
+	/** The style button. */
+	Button styleButton;
+	
+	/** The colors. */
+	String[] colors = Progression2.colors;
+	
+	/** The self. */
+	ProgressionDialog self;
+	
+	/** The parent. */
+	private Composite parent;
+
+	private ScrolledComposite sc1;
+
+
+
+	/**
+	 * Instantiates a new progression dialog.
+	 *
+	 * @param parentShell the parent shell
+	 * @param corpus the corpus
+	 */
+	public ProgressionDialog(Shell parentShell, Corpus corpus) {
+		super(parentShell);
+		this.corpus = corpus;
+		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
+	}
+
+	/**
+	 * Instantiates a new progression dialog.
+	 *
+	 * @param parentShell the parent shell
+	 * @param corpus the corpus
+	 * @param queries the queries
+	 */
+	public ProgressionDialog(Shell parentShell, Corpus corpus,
+			List<Query> queries) {
+		super(parentShell);
+		this.corpus = corpus;
+		this.queries = queries;
+		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.ProgressionDialog_0);
+		newShell.setMinimumSize(300, 460);
+
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+	 */
+	@Override
+	protected Control createDialogArea(Composite p) {
+		try {
+			this.self = this;
+			this.parent = p;
+
+			// get preferences values
+			TXMPreferenceStore store = ProgressionPreferencePage.getNewPreferenceStore();
+			this.monochrome = store.getBoolean(ProgressionPreferences.MONOCHROMATIC);
+			this.monostyle = store.getBoolean(ProgressionPreferences.MONO_STYLE);
+			this.cumulative = store.getBoolean(ProgressionPreferences.CUMULATIVE);
+			this.repeatvalues = store.getBoolean(ProgressionPreferences.REPEAT_VALUES);
+			this.bandemultiplier = store.getFloat(ProgressionPreferences.BANDE_MULTIPLIER);
+
+			// System.out.println(parent.getLayout());
+			FormLayout mainlayout = new FormLayout();
+			mainPanel = new Composite(parent, SWT.NONE);
+			mainPanel.setLayout(mainlayout);
+			GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
+			mainPanel.setLayoutData(gridData);
+
+			Composite paramPanel = new Composite(mainPanel, SWT.NONE);
+			// set the QueryWidget's tab
+			
+			sc1 = new ScrolledComposite(mainPanel, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+			sc1.setLayout(new GridLayout(1, true));
+			sc1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+			sc1.setExpandHorizontal( true );
+			sc1.setExpandVertical( true );
+			sc1.setMinSize( 0, 250 );
+			
+			focusComposite = new Composite(sc1, SWT.NONE);
+			focusComposite.setLayout(new GridLayout(1, true));
+			sc1.setContent(focusComposite);
+
+			FormData paramPanelData = new FormData();
+			paramPanelData.top = new FormAttachment(0);
+			paramPanelData.left = new FormAttachment(0);
+			paramPanelData.right = new FormAttachment(100);
+			paramPanel.setLayoutData(paramPanelData);
+
+			FormData queriesPanelData = new FormData();
+			queriesPanelData.top = new FormAttachment(paramPanel);
+			queriesPanelData.left = new FormAttachment(0);
+			queriesPanelData.right = new FormAttachment(100);
+			queriesPanelData.bottom = new FormAttachment(100);
+			sc1.setLayoutData(queriesPanelData);
+
+			paramPanel.setLayout(new GridLayout(3, true));
+
+			// controls
+			// graph param
+			Label typeLabel = new Label(paramPanel, SWT.NONE);
+			typeLabel.setText(Messages.ProgressionDialog_1);
+			typeLabel.setAlignment(SWT.CENTER);
+
+			cumuButton = new Button(paramPanel, SWT.RADIO);
+			cumuButton.setText(Messages.ProgressionDialog_2);
+			cumuButton.setSelection(cumulative);
+
+			Button densityButton = new Button(paramPanel, SWT.RADIO);
+			densityButton.setText(Messages.ProgressionDialog_3);
+			densityButton.setSelection(!cumulative);
+
+			//Bande size
+			typeLabel = new Label(paramPanel, SWT.NONE);
+			typeLabel.setText(Messages.ProgressionDialog_11);
+			typeLabel.setAlignment(SWT.CENTER);
+
+			bandeField = new Text(paramPanel, SWT.BORDER);
+			bandeField.setText(""+bandemultiplier); //$NON-NLS-1$
+			bandeField.setLayoutData(new GridData(GridData.FILL,
+					GridData.FILL, true, true, 2, 1));
+			// Structural units param
+			Group displayParam = new Group(paramPanel, SWT.BORDER);
+			displayParam.setText(Messages.ProgressionDialog_13);
+			displayParam.setLayout(new GridLayout(3, true));
+			displayParam.setLayoutData(new GridData(GridData.FILL,
+					GridData.FILL, true, true, 3, 1));
+
+			Label structLabel = new Label(displayParam, SWT.NONE);
+			structLabel.setText(Messages.ProgressionDialog_4);
+			structLabel.setAlignment(SWT.CENTER);
+
+			structuralUnitsCombo = new Combo(displayParam, SWT.READ_ONLY);
+			structuralUnitsCombo.setLayoutData(new GridData(GridData.FILL,
+					GridData.FILL, true, true, 2, 1));
+
+			structuralUnitsCombo.addSelectionListener(new SelectionListener() {
+				@Override
+				public void widgetDefaultSelected(SelectionEvent e) {
+				}
+
+				@Override
+				public void widgetSelected(SelectionEvent event) {
+					reloadProperties();
+				}
+			});
+
+			try {// get
+				structuralUnitsCombo.add("    "); //$NON-NLS-1$
+				structuralUnits = corpus.getOrderedStructuralUnits();
+				for (StructuralUnit unit : structuralUnits) {
+					structuralUnitsCombo.add(unit.getName());
+				}
+			} catch (Exception e) {
+				Log.severe(Messages.ObjectExplorer_9
+						+ Log.toString(e));
+				return null;
+			}
+			structuralUnitsCombo.select(0);
+			
+//			if (structuralUnitsCombo.getItemCount() == 0) {
+//				this.getButton(IDialogConstants.OK_ID).setEnabled(false);
+//			} else {
+//				selectedStructuralUnit = structuralUnits.get(0);
+//			}
+
+			// properties combo
+			Label propLabel = new Label(displayParam, SWT.NONE);
+			propLabel.setText(Messages.LexicalTable_1);
+			propLabel.setAlignment(SWT.CENTER);
+
+			propertyCombo = new Combo(displayParam, SWT.READ_ONLY);
+			propertyCombo.setLayoutData(new GridData(GridData.FILL,
+					GridData.FILL, true, true, 2, 1));
+			reloadProperties();
+
+			// property value field
+			Label regexLabel = new Label(displayParam, SWT.NONE);
+			regexLabel.setText(Messages.ProgressionDialog_7);
+			regexLabel.setAlignment(SWT.CENTER);
+
+			regexValue = new Text(displayParam, SWT.SINGLE | SWT.BORDER);
+			regexValue.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+					true, true, 2, 1));
+
+			//spacer
+			styleButton = new Button(displayParam, SWT.CHECK);
+			styleButton.setText(Messages.ProgressionDialog_14);
+			styleButton.setSelection(monostyle);
+
+			//Repeat options
+			repeatButton = new Button(displayParam, SWT.CHECK);
+			repeatButton.setText(Messages.ProgressionDialog_15);
+			repeatButton.setSelection(repeatvalues);
+
+			//Color options
+			colorButton = new Button(displayParam, SWT.CHECK);
+			colorButton.setText(Messages.ProgressionPreferencePage_4);
+			colorButton.setSelection(monochrome);
+
+			// queries param
+			Label focusLabel = new Label(paramPanel, SWT.NONE);
+			focusLabel.setText(Messages.ProgressionDialog_8);
+			focusLabel.setAlignment(SWT.CENTER);
+
+			Button plusButton = new Button(paramPanel, SWT.NONE);
+			plusButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+					true, true));
+			plusButton.setText(Messages.ProgressionDialog_9);
+			plusButton.addListener(SWT.Selection, new Listener() {
+				@Override
+				public void handleEvent(Event event) {
+					if (colors.length > queryWidgets.size()) {
+						Log.info("add query field");
+						createTypeFocusField();
+						sc1.layout(true);
+						focusComposite.layout(true);
+						sc1.setMinSize(focusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+					}
+				}
+			});
+
+			Button minusButton = new Button(paramPanel, SWT.NONE);
+			minusButton.setLayoutData(new GridData(GridData.FILL,
+					GridData.FILL, true, true));
+			minusButton.setText(Messages.ProgressionDialog_5);
+			minusButton.addListener(SWT.Selection, new Listener() {
+				@Override
+				public void handleEvent(Event event) {
+					if (queryWidgets.size() > 0) {
+						// System.out.println("remove field");
+						AssistedQueryWidget lastwidget = queryWidgets
+						.get(queryWidgets.size() - 1);
+						lastwidget.setSize(200, 30);
+						queryWidgets.remove(queryWidgets.size() - 1);
+						lastwidget.dispose();
+						sc1.layout(true);
+						focusComposite.layout(true);
+						sc1.setMinSize(focusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+					}
+				}
+			});
+
+			if (queries == null) {
+				createTypeFocusField();
+			} else {
+				for (Query q : queries) {
+					createTypeFocusField().setText(q.getQueryString());
+				}
+			}
+			return mainPanel;
+		} catch (Exception e) {
+			Log.printStackTrace(e);
+		}
+		return null;
+	}
+
+	/**
+	 * Creates the type focus field.
+	 *
+	 * @return the assisted query widget
+	 */
+	private AssistedQueryWidget createTypeFocusField() {
+		AssistedQueryWidget focusTextBox = new AssistedQueryWidget(
+				focusComposite, SWT.BORDER, this.corpus);
+		GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
+				false);
+		focusTextBox.setLayoutData(gridData);
+
+		queryWidgets.add(focusTextBox);
+		return focusTextBox;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+	 */
+	@Override
+	protected void okPressed() {
+
+		queries = new ArrayList<Query>();
+		for (AssistedQueryWidget wid : queryWidgets) {
+			if (!wid.getQueryString().equals("\"\"")) //$NON-NLS-1$
+			{
+				queries.add(new Query(wid.getQueryString()));
+				wid.memorize();
+			}
+		}
+
+		if (propertyCombo.getSelectionIndex() > 0)
+			selectedStructuralUnitProperty = structuralUnitsProperties
+			.get(propertyCombo.getSelectionIndex() - 1);
+		else
+			selectedStructuralUnitProperty = null;
+
+		if (structuralUnitsCombo.getSelectionIndex() > 0)
+			selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo
+					.getSelectionIndex() - 1);
+		else {
+			selectedStructuralUnit = null;
+			selectedStructuralUnitProperty = null;// need a structuralunit
+		}
+
+		try {
+			Pattern.compile(regexValue.getText());
+			regexpropertyValue = regexValue.getText();
+
+			if (regexpropertyValue.length() == 0)
+				regexpropertyValue = null;
+		} catch (PatternSyntaxException e) {
+			System.out.println(Messages.ProgressionDialog_10 + e);
+		}
+
+		cumulative = cumuButton.getSelection();
+		monochrome = colorButton.getSelection();
+		monostyle = styleButton.getSelection();
+		repeatvalues = repeatButton.getSelection();
+		String smultibande = bandeField.getText();
+		if (smultibande != null && smultibande.length() > 0)
+		{
+			try
+			{	bandemultiplier = Float.parseFloat(smultibande);
+
+			}catch(Exception e){
+				bandemultiplier = 1.0f;
+				System.out.println(Messages.ProgressionDialog_17+e);
+				StatusLine.error(Messages.ProgressionDialog_17+e);
+			}
+		}
+		else
+			bandemultiplier = 1.0f;
+
+		super.okPressed();
+	}
+
+	/**
+	 * Reload properties.
+	 */
+	private void reloadProperties() {
+		propertyCombo.removeAll();
+		propertyCombo.add("    "); //$NON-NLS-1$
+
+		if (structuralUnitsCombo.getSelectionIndex() > 0) {
+			selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo
+					.getSelectionIndex() - 1);
+			structuralUnitsProperties = selectedStructuralUnit.getOrderedProperties();
+			for (StructuralUnitProperty property : structuralUnitsProperties) {
+				propertyCombo.add(property.getName());
+			}
+		}
+		if (propertyCombo.getItemCount() > 0) {
+			propertyCombo.select(0);
+		}
+	}
+
+	/**
+	 * Gets the corpus.
+	 *
+	 * @return the corpus
+	 */
+	public Corpus getCorpus() {
+		return corpus;
+	}
+
+	/**
+	 * Gets the queries.
+	 *
+	 * @return the queries
+	 */
+	public List<Query> getQueries() {
+		return queries;
+	}
+
+	/**
+	 * Gets the colors.
+	 *
+	 * @return the colors
+	 */
+	public List<String> getColors() {
+		return null;
+	}
+
+	/**
+	 * Gets the structural unit.
+	 *
+	 * @return the structural unit
+	 */
+	public StructuralUnit getStructuralUnit() {
+		return selectedStructuralUnit;
+	}
+
+	/**
+	 * Gets the graph type.
+	 *
+	 * @return the graph type
+	 */
+	public boolean isCumulativeType() {
+		return cumulative;
+	}
+
+	/**
+	 * Gets the bande multiplier.
+	 *
+	 * @return the bande multiplier
+	 */
+	public float getBandeMultiplier()
+	{
+		return bandemultiplier;
+	}
+
+	/**
+	 * Checks if is monochrome.
+	 *
+	 * @return true, if is monochrome
+	 */
+	public boolean isMonochrome() {
+		return monochrome;
+	}
+
+	/**
+	 * Checks if is repeatvalues.
+	 *
+	 * @return true, if is repeatvalues
+	 */
+	public boolean isRepeatvalues() {
+		return repeatvalues;
+	}
+
+	/**
+	 * Gets the structural property.
+	 *
+	 * @return the structural property
+	 */
+	public StructuralUnitProperty getStructuralProperty() {
+		return selectedStructuralUnitProperty;
+	}
+
+	/**
+	 * Gets the propertyregex.
+	 *
+	 * @return the propertyregex
+	 */
+	public String getPropertyregex() {
+		return regexpropertyValue;
+	}
+
+	/**
+	 * Checks if is mono style.
+	 *
+	 * @return true, if is mono style
+	 */
+	public boolean isMonoStyle() {
+
+		return monostyle;
+	}
+
+	/**
+	 * Gets the line width.
+	 *
+	 * @return the line width
+	 */
+	public int getLineWidth()
+	{
+		return linewidth;
+	}
+}

Property changes on: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/dialogs/ProgressionDialog.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/adapters/ProgressionAdapterFactory.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/adapters/ProgressionAdapterFactory.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/adapters/ProgressionAdapterFactory.java	(revision 35)
@@ -0,0 +1,61 @@
+// Copyright © 2010-2013 ENS de Lyon.
+package org.txm.progression.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.progression.core.functions.Progression2;
+import org.txm.rcp.adapters.BaseAdapterFactory;
+
+
+/**
+ * A factory for creating Adapter objects.
+ *  
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ProgressionAdapterFactory extends BaseAdapterFactory {
+
+	
+	/**
+	 * Gets the adapter.
+	 *
+	 * @param adaptableObject the adaptable object
+	 * @param adapterType the adapter type
+	 * @return the adapter
+	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
+	 */
+	@Override
+	public Object getAdapter(Object adaptableObject, Class adapterType) {
+		
+		if(adapterType == IWorkbenchAdapter.class)	{
+			if(adaptableObject instanceof Progression2)	{
+				return new IWorkbenchAdapter() {
+					@Override
+					public Object[] getChildren(Object resultData) {
+						return new Object[0];
+					}
+	
+					@Override
+					public ImageDescriptor getImageDescriptor(Object object) {
+						return AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(ProgressionAdapterFactory.class).getSymbolicName(), "platform:/plugin/org.txm.progression.rcp/icons/functions/progression.png"); //$NON-NLS-1$
+					}
+	
+					@Override
+					public String getLabel(Object resultData) {
+						return ((Progression2) resultData).getDetails(); 
+					}
+	
+					@Override
+					public Object getParent(Object resultData) {
+						return ((Progression2) resultData).getCorpus();
+					}
+				};
+			}
+		}
+		return null;
+	}
+
+
+}

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

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/forms/ProgressionParametersComposite.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/forms/ProgressionParametersComposite.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/forms/ProgressionParametersComposite.java	(revision 35)
@@ -0,0 +1,254 @@
+package org.txm.progression.rcp.forms;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ScrolledComposite;
+import org.eclipse.swt.layout.FillLayout;
+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.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.txm.rcpapplication.Messages;
+
+
+public class ProgressionParametersComposite extends Composite {
+	SashForm sashForm;
+	
+	private Table table;
+	private Text scaleTextEdit;
+	private Text regTextEdit;
+	
+	Button btnSupprimer;
+	Button cumulBtn;
+	Button densiBtn;
+	
+	Combo structCombo;
+	Combo propCombo;
+	private Button styleRadio;
+	private Button repeatRadio;
+	private Button NBRadio;
+	private Button btnNewButton;
+
+	
+	/**
+	 * Creates the composite.
+	 * @param parent
+	 * @param style
+	 */
+	public ProgressionParametersComposite(Composite parent, int style) {
+		super(parent, style);
+		
+		
+		//parent.setLayout(new GridLayout(1, true));
+		
+//		ExpandBar bar = new ExpandBar(parent, SWT.NONE);
+		
+//		sashForm = new SashForm(parent, SWT.VERTICAL);
+//		sashForm.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
+		
+		
+		
+		ScrolledComposite scrolledComposite_1 = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+		scrolledComposite_1.setExpandHorizontal(true);
+		scrolledComposite_1.setExpandVertical(true);
+
+//		Composite scrolledComposite_1 = new Composite(this, SWT.BORDER);
+		
+		Composite composite_1 = new Composite(scrolledComposite_1, SWT.NONE);
+		composite_1.setLayout(new FillLayout(SWT.VERTICAL));
+		
+		Composite composite = new Composite(composite_1, SWT.NONE);
+		composite.setLayout(new GridLayout(5, false));
+		
+		Label label = new Label(composite, SWT.NONE);
+		GridData gd_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
+		gd_label.widthHint = 29;
+		label.setLayoutData(gd_label);
+		label.setText(Messages.ProgressionForm_0);
+		
+		cumulBtn = new Button(composite, SWT.RADIO);
+		cumulBtn.setText(Messages.ProgressionForm_1);
+		cumulBtn.setSelection(true);
+		
+		densiBtn = new Button(composite, SWT.RADIO);
+		densiBtn.setText(Messages.ProgressionForm_2);
+		
+		Label lblEchelle = new Label(composite, SWT.NONE);
+		lblEchelle.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+		lblEchelle.setText(Messages.ProgressionForm_3);
+		
+		scaleTextEdit = new Text(composite, SWT.BORDER);
+		scaleTextEdit.setText("1.0"); //$NON-NLS-1$
+		
+		Label lblOptionsDaffichage = new Label(composite, SWT.NONE);
+		lblOptionsDaffichage.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
+		lblOptionsDaffichage.setText(Messages.ProgressionForm_5);
+		new Label(composite, SWT.NONE);
+		
+		Label label_6 = new Label(composite, SWT.NONE);
+		label_6.setText(Messages.ProgressionForm_6);
+		
+		structCombo = new Combo(composite, SWT.NONE);
+		
+		Label label_5 = new Label(composite, SWT.NONE);
+		label_5.setText(Messages.ProgressionForm_7);
+		
+		propCombo = new Combo(composite, SWT.NONE);
+		propCombo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+		new Label(composite, SWT.NONE);
+		new Label(composite, SWT.NONE);
+		
+		Label label_7 = new Label(composite, SWT.NONE);
+		label_7.setText(Messages.ProgressionForm_8);
+		
+		regTextEdit = new Text(composite, SWT.BORDER);
+		regTextEdit.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
+		new Label(composite, SWT.NONE);
+		
+		styleRadio = new Button(composite, SWT.CHECK);
+		styleRadio.setText(Messages.ProgressionForm_9);
+		styleRadio.setSelection(true);
+		
+		repeatRadio = new Button(composite, SWT.CHECK);
+		repeatRadio.setText(Messages.ProgressionForm_10);
+		
+		NBRadio = new Button(composite, SWT.CHECK);
+		NBRadio.setText(Messages.ProgressionForm_11);
+		new Label(composite, SWT.NONE);
+	
+		Composite composite_2 = new Composite(composite_1, SWT.NONE);
+		composite_2.setLayout(new GridLayout(1, false));
+		
+		Composite composite_3 = new Composite(composite_2, SWT.NONE);
+		composite_3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
+		composite_3.setLayout(new FillLayout(SWT.HORIZONTAL));
+		
+		Label lblRequetes = new Label(composite_3, SWT.NONE);
+		lblRequetes.setText(Messages.ProgressionForm_12);
+		
+		btnNewButton = new Button(composite_3, SWT.NONE);
+		btnNewButton.setText(Messages.ProgressionForm_13);
+		
+		btnSupprimer = new Button(composite_3, SWT.NONE);
+		btnSupprimer.setText(Messages.ProgressionForm_14);
+		
+		scrolledComposite_1.setContent(composite_1);
+		scrolledComposite_1.setMinSize(composite_1.computeSize(SWT.DEFAULT, SWT.DEFAULT));
+		
+		
+//		table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
+//		table.setHeaderVisible(true);
+//		table.setLinesVisible(true);
+//		sashForm.setWeights(new int[] {215, 334});
+		//return sashForm;
+		
+		
+		scrolledComposite_1.setBounds(20, 20, 800, 800);
+
+	}
+	
+	
+	
+	public void setTable(Table table) {
+		this.table = table;
+		//table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
+		table.setHeaderVisible(true);
+		table.setLinesVisible(true);
+		sashForm.setWeights(new int[] {215, 334});
+	}
+	
+
+
+	public SashForm getSash() {
+		return sashForm;
+	}
+	
+	/**
+	 * @return the table
+	 */
+	public Table getTable() {
+		return table;
+	}
+
+	/**
+	 * @return the scaleTextEdit
+	 */
+	public Text getScaleTextEdit() {
+		return scaleTextEdit;
+	}
+
+	/**
+	 * @return the regTextEdit
+	 */
+	public Text getRegTextEdit() {
+		return regTextEdit;
+	}
+
+	/**
+	 * @return the btnSupprimer
+	 */
+	public Button getBtnSupprimer() {
+		return btnSupprimer;
+	}
+
+	/**
+	 * @return the cumulBtn
+	 */
+	public Button getCumulBtn() {
+		return cumulBtn;
+	}
+
+	/**
+	 * @return the densiBtn
+	 */
+	public Button getDensiBtn() {
+		return densiBtn;
+	}
+
+	/**
+	 * @return the structCombo
+	 */
+	public Combo getStructCombo() {
+		return structCombo;
+	}
+
+	/**
+	 * @return the propCombo
+	 */
+	public Combo getPropCombo() {
+		return propCombo;
+	}
+
+	/**
+	 * @return the styleRadio
+	 */
+	public Button getStyleRadio() {
+		return styleRadio;
+	}
+
+	/**
+	 * @return the repeatRadio
+	 */
+	public Button getRepeatRadio() {
+		return repeatRadio;
+	}
+
+	/**
+	 * @return the nBRadio
+	 */
+	public Button getNBRadio() {
+		return NBRadio;
+	}
+
+	/**
+	 * @return the btnNewButton
+	 */
+	public Button getBtnNewButton() {
+		return btnNewButton;
+	}
+
+
+}

Property changes on: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/forms/ProgressionParametersComposite.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/RCPProgressionMessages.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/RCPProgressionMessages.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/RCPProgressionMessages.java	(revision 35)
@@ -0,0 +1,23 @@
+package org.txm.progression.rcp.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class RCPProgressionMessages extends NLS {
+	private static final String BUNDLE_NAME = "org.txm.progression.rcp.messages.messages"; //$NON-NLS-1$
+
+	public static String ProgressionPreferencePage_2;
+	public static String ProgressionPreferencePage_3;
+	public static String ProgressionPreferencePage_4;
+	public static String ProgressionPreferencePage_5;
+	public static String ProgressionPreferencePage_6;
+	public static String ProgressionPreferencePage_7;
+	
+	
+	static {
+		// initialize resource bundle
+		NLS.initializeMessages(BUNDLE_NAME, RCPProgressionMessages.class);
+	}
+
+	private RCPProgressionMessages() {
+	}
+}

Property changes on: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/RCPProgressionMessages.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages_fr.properties
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages_fr.properties	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages_fr.properties	(revision 35)
@@ -0,0 +1,6 @@
+ProgressionPreferencePage_2=Progression
+ProgressionPreferencePage_3=Graphe de progression cumulatif
+ProgressionPreferencePage_4=Niveaux de gris
+ProgressionPreferencePage_5=Style de ligne unique
+ProgressionPreferencePage_6=R�p�ter les valeurs de propri�t�s de structures
+ProgressionPreferencePage_7=\u00C9chelle des limites de structures
\ No newline at end of file

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

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages.properties
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages.properties	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages.properties	(revision 35)
@@ -0,0 +1,6 @@
+ProgressionPreferencePage_2=Progression
+ProgressionPreferencePage_3=Default graph type is cumulative
+ProgressionPreferencePage_4=Grayscale
+ProgressionPreferencePage_5=Single line style
+ProgressionPreferencePage_6=Repeat the values of the structure properties
+ProgressionPreferencePage_7=Bande size multiplier
\ No newline at end of file

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

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionSelectionListener.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionSelectionListener.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionSelectionListener.java	(revision 35)
@@ -0,0 +1,103 @@
+package org.txm.progression.rcp.chartsengine.jfreechart.events;
+
+import org.eclipse.swt.events.SelectionEvent;
+import org.txm.chartsengine.rcp.editors.ChartEditorPart;
+import org.txm.chartsengine.rcp.events.BaseSelectionListener;
+
+/**
+ * Progression selection listener.
+ * @author sjacquot
+ *
+ */
+public class ProgressionSelectionListener extends BaseSelectionListener {
+
+
+	/**
+	 * 
+	 * @param chartEditor
+	 * @param commandId
+	 */
+	public ProgressionSelectionListener(ChartEditorPart chartEditor, int commandId) {
+		super(chartEditor, commandId);
+	}
+
+
+
+	@Override
+	public void widgetSelected(SelectionEvent e) {
+		
+		
+		// FIXME: to discuss
+		// Send to other command
+//		if(this.commandId == ProgressionSelectionListener.SEND_TO_INDEX || this.commandId == ProgressionSelectionListener.SEND_TO_CONCORDANCE
+//				|| this.commandId == ProgressionSelectionListener.SEND_TO_COOCCURRENCE)	{
+//
+//
+//			Progression progression = (Progression) this.chartEditor.getResultData();
+//			// gets the progression queries from the current selected chart series
+//			String query = progression.getQueriesString(chartEditor.getEditorInput().getSWTChartComponentsProvider().getChartsEngine().getProgressionChartSelectedSeries(chartEditor.getChart()));
+//			
+//			// Send to index
+//			if(this.commandId == ProgressionSelectionListener.SEND_TO_INDEX)	{
+//	
+//				IndexEditorInput editorInput = new IndexEditorInput(progression.getCorpus());
+//	
+//				try {
+//					IWorkbenchPage page = this.chartEditor.getEditorSite().getWorkbenchWindow().getActivePage();
+//					IndexEditor editor = (IndexEditor) page.openEditor(editorInput, IndexEditor.ID);
+//					editor.setFocus(query);
+//					editor.compute();
+//				}
+//				catch(PartInitException e1) {
+//					e1.printStackTrace();
+//				}
+//			}
+//			// Send to concordance
+//			else if(this.commandId == ProgressionSelectionListener.SEND_TO_CONCORDANCE)	{
+//	
+//				ConcordancesEditorInput editorInput = new ConcordancesEditorInput(progression.getCorpus(), null);
+//	
+//				try {
+//					IWorkbenchPage page = this.chartEditor.getEditorSite().getWorkbenchWindow().getActivePage();
+//					ConcordancesEditor editor = (ConcordancesEditor) page.openEditor(editorInput, "org.txm.rcpapplication.editors.ConcordancesEditor"); //$NON-NLS-1$
+//					editor.setQuery(query);
+//					editor.compute();
+//					
+//					// move in the concordance to the line of the selected progression point
+//					final ArrayList<Integer> selectedPointPositions = chartEditor.getEditorInput().getSWTChartComponentsProvider().getChartsEngine().getProgressionChartSelectedPointPositions(chartEditor.getChart());
+//					ArrayList<EditorPart> linkedEditors = new ArrayList<EditorPart>(); 
+//					linkedEditors.add(editor);
+//					new ProgressionEventCallBack(this.chartEditor).updateLinkedConcordanceEditor(linkedEditors, selectedPointPositions);
+//
+//					
+//				}
+//				catch(PartInitException e1) {
+//					e1.printStackTrace();
+//				}
+//			}
+//			// Send to cooccurrence
+//			else if(this.commandId == ProgressionSelectionListener.SEND_TO_COOCCURRENCE)	{
+//	
+//				CooccurrenceEditorInput editorInput = new CooccurrenceEditorInput(progression.getCorpus());
+//	
+//				try {
+//					IWorkbenchPage page = this.chartEditor.getEditorSite().getWorkbenchWindow().getActivePage();
+//					CooccurrencesEditor editor = (CooccurrencesEditor) page.openEditor(editorInput, CooccurrencesEditor.ID);
+//					editor.setFocus(query);
+//					editor.compute();
+//				}
+//				catch(PartInitException e1) {
+//					e1.printStackTrace();
+//				}
+//			}
+//		}
+		
+	}
+
+	@Override
+	public void widgetDefaultSelected(SelectionEvent e) {
+		// TODO Auto-generated method stub
+
+	}
+
+}

Property changes on: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionSelectionListener.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionEventCallBack.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionEventCallBack.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionEventCallBack.java	(revision 35)
@@ -0,0 +1,423 @@
+package org.txm.progression.rcp.chartsengine.jfreechart.events;
+
+import java.awt.AWTEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.e4.ui.workbench.modeling.EModelService;
+import org.eclipse.jface.viewers.StructuredSelection;
+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.PlatformUI;
+import org.eclipse.ui.part.EditorPart;
+import org.jfree.chart.ChartMouseEvent;
+import org.jfree.chart.entity.ChartEntity;
+import org.txm.chartsengine.rcp.events.EventCallBack;
+import org.txm.chartsengine.rcp.events.ZoomAndPanCallBack;
+import org.txm.functions.concordances.comparators.LineComparator;
+import org.txm.objects.Edition;
+import org.txm.objects.Page;
+import org.txm.objects.Text;
+import org.txm.progression.core.functions.Progression2;
+import org.txm.rcpapplication.Messages;
+import org.txm.rcpapplication.commands.OpenBrowser;
+import org.txm.rcpapplication.editors.TXMBrowser;
+import org.txm.rcpapplication.editors.concordances.ConcordancesEditor;
+import org.txm.rcpapplication.editors.input.ConcordancesEditorInput;
+import org.txm.rcpapplication.utils.SWTEditorsUtils;
+import org.txm.searchengine.cqp.corpus.Corpus;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.searchengine.cqp.corpus.StructuralUnit;
+import org.txm.searchengine.cqp.corpus.query.Match;
+import org.txm.utils.logger.Log;
+
+/**
+ * Progression chart mixed mouse and key user entries call back.
+ * 
+ * @author sjacquot
+ *
+ */
+public class ProgressionEventCallBack extends EventCallBack {
+
+	/**
+	 * To keep track of the concordance lines and recomputing only if the selected item is out of this range.
+	 */
+	protected int lastConcordanceTopLine = -1;
+	protected int lastConcordanceBottomLine = -1;
+	
+	/**
+	 * To keep track of the concordance lines sort and recomputing only if the sorting order has changed.
+	 */
+	protected LineComparator lastSortingComparator = null;
+	
+	
+	/**
+	 * 
+	 * @param chartEditor
+	 */
+	public ProgressionEventCallBack() {
+		super();
+	}
+
+	@Override
+	public void processEvent(final AWTEvent event, final int eventArea, final Object o) {
+		
+		// Need to run this in the SWT UI thread because it's called from the AWT UI thread in TBX charts engine layer
+		chartEditor.getComposite().getDisplay().asyncExec(new Runnable() {
+			public void run() {
+
+				// Mouse event
+				if(event instanceof MouseEvent)	{
+				
+					MouseEvent mouseEvent = (MouseEvent)event;
+					
+					//return if it's not the left mouse button
+					if(mouseEvent.getButton() != MouseEvent.BUTTON1)	{
+						return;
+					}
+					
+					
+					ChartMouseEvent chartEvent = (ChartMouseEvent) o;
+					ChartEntity entity = chartEvent.getEntity();
+					final ArrayList<Integer> selectedPointPositions = chartEditor.getEditorInput().getSWTChartsComponentsProvider().getChartsEngine().getProgressionChartSelectedPointPositions(chartEditor.getChart());
+	
+					if(event.getID() == MouseEvent.MOUSE_CLICKED && mouseEvent.getClickCount() == 2 && eventArea == EventCallBack.AREA_ITEM && !selectedPointPositions.isEmpty()) {
+	
+						// Linked edition (CTRL/CMD + double click)
+						if((mouseEvent.getModifiers() & ZoomAndPanCallBack.keyboardZoomModifierKeyMask) != 0) {
+							// Updates the linked editor
+							updateLinkedEditionEditor((TXMBrowser) chartEditor.getLinkedEditor(TXMBrowser.class), selectedPointPositions);
+						}
+						// Linked concordance
+						else	{
+							// Updates the linked editor
+							updateLinkedConcordanceEditor(chartEditor.getLinkedEditors(ConcordancesEditor.class), selectedPointPositions);
+						}
+					}
+					else if(event.getID() == MouseEvent.MOUSE_CLICKED && mouseEvent.getClickCount() == 1 && eventArea == EventCallBack.AREA_ITEM) {
+
+						// Get the linked concordance editors and update the one linked to the progression curve if it exists
+						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordancesEditor.class);
+						if(!linkedConcordancesEditors.isEmpty())	{
+							updateLinkedConcordanceEditor(linkedConcordancesEditors, selectedPointPositions);
+						}
+						
+						
+						// Get the linked edition editor and update it if exists
+						TXMBrowser linkedEditionEditor = (TXMBrowser)chartEditor.getLinkedEditor(TXMBrowser.class);
+						if(linkedEditionEditor != null)	{
+							updateLinkedEditionEditor(linkedEditionEditor, selectedPointPositions);
+						}
+						
+					}
+					else if(event.getID() == MouseEvent.MOUSE_CLICKED && mouseEvent.getClickCount() == 2 && eventArea == EventCallBack.AREA_EMPTY) {
+						// FIXME: debug
+						//System.err.println("ProgressionMouseClickedCallBack.processEvent(...).new Runnable() {...}.run(): double click in empty area");
+					}
+					else if(event.getID() == MouseEvent.MOUSE_CLICKED && mouseEvent.getClickCount() == 1 && eventArea == EventCallBack.AREA_EMPTY) {
+						// FIXME: debug
+						//System.err.println("ProgressionMouseClickedCallBack.processEvent(...).new Runnable() {...}.run(): single click in empty area");
+					}
+				}
+				// Key event
+				else if(event instanceof KeyEvent)	{
+					KeyEvent keyEvent = (KeyEvent)event;
+					
+					// return if zoom and pan modifier
+					if((keyEvent.getModifiers() & ZoomAndPanCallBack.keyboardZoomModifierKeyMask) != 0) {
+						return;
+					}
+					
+					// Arrow keys
+					if(keyEvent.getKeyCode() == KeyEvent.VK_LEFT || keyEvent.getKeyCode() == KeyEvent.VK_RIGHT)	{
+					
+						final ArrayList<Integer> selectedPointPositions = chartEditor.getEditorInput().getSWTChartsComponentsProvider().getChartsEngine().getProgressionChartSelectedPointPositions(chartEditor.getChart());
+	
+						// Get the linked concordance editors and update the one linked to the progression curve if it exists
+						ArrayList<EditorPart> linkedConcordancesEditors = chartEditor.getLinkedEditors(ConcordancesEditor.class);
+						if(!linkedConcordancesEditors.isEmpty())	{
+							updateLinkedConcordanceEditor(linkedConcordancesEditors, selectedPointPositions);
+						}
+						
+						// Get the linked edition editor and update it if exists
+						TXMBrowser linkedEditionEditor = (TXMBrowser)chartEditor.getLinkedEditor(TXMBrowser.class);
+						if(linkedEditionEditor != null)	{
+							updateLinkedEditionEditor(linkedEditionEditor, selectedPointPositions);
+						}
+					}
+				}
+			}
+		});
+
+	}
+
+	
+	/**
+	 * Updates the linked concordance editor.
+	 * If the editor doesn't exist it will be created.
+	 * @param editor
+	 */
+	public void updateLinkedConcordanceEditor(ArrayList<EditorPart> linkedEditors, ArrayList<Integer> selectedPointPositions)	{
+
+		// FIXME: Debug
+		//System.err.println("ProgressionEventCallBack.updateLinkedConcordanceEditor(): linked editors count: " + linkedEditors.size());
+		
+		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+		IWorkbenchPage page = window.getActivePage();
+
+		// Get and format the progression query from the selected chart series
+		// FIXME: case 1, the query is the query of the selected chart series
+//		ArrayList<Integer> selectedSeries = chartEditor.getEditorInput().getSWTChartComponentsProvider().getChartsEngine().getProgressionChartSelectedSeries(chartEditor.getChart());
+//		String query = ((Progression) chartEditor.getResultData()).getQueries().get(selectedSeries.get(selectedSeries.size() - 1).intValue()).getQueryString();
+		
+		int lastSelectedSeries = chartEditor.getEditorInput().getSWTChartsComponentsProvider().getChartsEngine().getProgressionChartLastSelectedSeries(chartEditor.getChart());
+		String query = ((Progression2) chartEditor.getResultData()).getQueries().get(lastSelectedSeries).getQueryString();
+
+		// Remove "[" and "]" only if it's a simple query as "[faire]" 
+		if(query.startsWith("[") && !query.contains("="))	{
+			int length = query.length();
+			if(query.endsWith("]"))	{
+				length--;
+			}
+			query = query.substring(1, length);
+		}
+
+		// FIXME: case 2, the query is the combination of all the queries of the progression
+//		String query = ((Progression) chartEditor.getResultData()).getQueriesString();
+		
+		
+		// gets the linked editor according to the query if it exists
+		ConcordancesEditor linkedEditor = null;
+		for(int i = 0; i < linkedEditors.size(); i++) {
+			if(query.equals(((ConcordancesEditor) linkedEditors.get(i)).getConcordance().getQuery().getQueryString()))	{
+				linkedEditor = ((ConcordancesEditor) linkedEditors.get(i));
+				break;
+			}
+		}
+		
+		
+		
+		ConcordancesEditorInput editorInput;
+		boolean newEditor = false;
+		// Create the linked editor input if needed
+		if(linkedEditor == null) {
+			editorInput = new ConcordancesEditorInput(((Progression2) chartEditor.getResultData()).getCorpus(), null);
+			newEditor = true;
+		}
+		else	{
+			editorInput = (ConcordancesEditorInput) linkedEditor.getEditorInput();
+		}
+
+		try {
+			boolean wasOpenEditor = SWTEditorsUtils.isOpenEditor(editorInput);
+			
+			linkedEditor = (ConcordancesEditor) page.openEditor(editorInput, "org.txm.rcpapplication.editors.ConcordancesEditor", false); //$NON-NLS-1$
+			if(newEditor)	{
+				chartEditor.addLinkedEditor(linkedEditor);
+			}
+			
+			// Split the area and insert the new editor
+			if(!wasOpenEditor)	{
+				
+				int position = EModelService.BELOW;
+				EditorPart parentEditor = chartEditor;
+				
+				// Split vertically if there is already a concordance editor otherwise split horizontally
+				if(linkedEditors != null && !linkedEditors.isEmpty())	 {
+					position = EModelService.RIGHT_OF;
+					parentEditor = linkedEditors.get(linkedEditors.size() - 1);
+					
+					System.err.println("ProgressionEventCallBack.updateLinkedConcordanceEditor(): parent editor for splitting: " + parentEditor);
+				}
+				// Split vertically if there is already an edition editor otherwise split horizontally
+				else	{
+					TXMBrowser linkedEditionEditor = (TXMBrowser)chartEditor.getLinkedEditor(TXMBrowser.class);
+					if(linkedEditionEditor != null)	{
+						position = EModelService.RIGHT_OF;
+						parentEditor = linkedEditionEditor;
+					}
+				}
+				
+				
+				// Split and add linked editor
+				SWTEditorsUtils.addEditor(parentEditor, linkedEditor, position);
+			}
+			
+		}
+		catch (PartInitException e) {
+			System.err.println(NLS.bind(Messages.GetConcordances_4, e));
+		}
+
+		linkedEditor.setQuery(query);
+		// Compute the concordance if the query has changed or if the concordance has never been computed
+		if(linkedEditor.getConcordance() == null || newEditor)	{
+			linkedEditor.compute(false);
+			// initialize range change tracking variables
+			this.lastConcordanceTopLine = 0;
+			this.lastConcordanceBottomLine = linkedEditor.getLinePerPage();
+			this.lastSortingComparator = linkedEditor.getCurrentComparator();
+		}
+
+
+	
+		
+		final TableViewer tableViewer = linkedEditor.getLineTableViewer();
+		if(selectedPointPositions.size() > 0)	{
+
+			// Get the index of the last selected point in concordance according to the global token position and concordance sorting order
+			int lineIndex = linkedEditor.getConcordance().indexOf(selectedPointPositions.get(selectedPointPositions.size() - 1));
+			
+			int top = lineIndex - (lineIndex % linkedEditor.getLinePerPage());
+			int bottom = top + linkedEditor.getLinePerPage() - 1;
+			
+			
+			// Manage the lazy loading of new lines range in the concordance
+			boolean loadLines = false;
+			// not open editor (or new editor)
+			if(!SWTEditorsUtils.isOpenEditor(editorInput))	{
+				loadLines = true;
+			}
+			// page change
+			else if(this.lastConcordanceTopLine != top || this.lastConcordanceBottomLine != bottom)	{
+				loadLines = true;
+			}
+			// sort change
+			else if(this.lastSortingComparator != linkedEditor.getCurrentComparator())	{
+				loadLines = true;
+			}
+			
+			
+			// Loads new lines, fill the display area and select the table row
+			if(loadLines)	{
+				linkedEditor.fillDisplayArea(top, bottom);
+			}
+
+			// update range change tracking variables
+			this.lastConcordanceTopLine = top;
+			this.lastConcordanceBottomLine = bottom;
+			this.lastSortingComparator = linkedEditor.getCurrentComparator();
+
+			
+			
+			final int selectedPointInTableRange = lineIndex - top;						
+	
+			tableViewer.getControl().getDisplay().asyncExec(new Runnable() {
+				@Override
+				public void run() {
+					tableViewer.getTable().deselectAll();
+					
+					Object line = tableViewer.getElementAt(selectedPointInTableRange);
+					if(line != null)	{
+						tableViewer.setSelection(new StructuredSelection(line), true);
+						// FIXME: commented because the set top index makes the read of the table difficult
+						//tableViewer.getTable().setTopIndex(selectedPointInTableRange);
+					}
+					else	{
+						Log.info("Selected progression point doesn't exist in the linked Concordance.");
+					}
+				}
+			});
+		}
+		else	{
+			tableViewer.getTable().deselectAll();
+		}
+		
+		// give back the focus to chart editor
+		chartEditor.setFocus();
+	}
+
+	    
+	/**
+	 * Updates the linked edition editor.
+	 * If the editor doesn't exist it will be created.
+	 * @param editor
+	 */
+	public void updateLinkedEditionEditor(TXMBrowser linkedEditor, ArrayList<Integer> selectedPointPositions)	{
+		
+		try {
+			
+			// Unhighlight all tokens if no selected points
+			if(selectedPointPositions.size() < 1)	{
+				linkedEditor.setWordsIds(new ArrayList<String>(), new ArrayList<String>());
+				linkedEditor.showPage(linkedEditor.getCurrentPage());
+				return;
+			}
+			
+			Corpus corpus = ((Progression2) chartEditor.getResultData()).getCorpus();
+			StructuralUnit textS = corpus.getStructuralUnit("text"); //$NON-NLS-1$
+			Property textP = textS.getProperty("id"); //$NON-NLS-1$
+			Match selectedWordMatch = new Match(selectedPointPositions.get(selectedPointPositions.size() - 1), selectedPointPositions.get(selectedPointPositions.size() - 1));
+			String textId = selectedWordMatch.getValueForProperty(textP);
+
+			Text text = corpus.getText(textId);
+			if(text == null) {
+				Log.severe("Text " + textId + " is missing.");
+				return;
+			}
+
+			Edition edition = text.getEdition(corpus.getMainCorpus().getDefaultEdition());
+			if(edition == null) {
+				Log.severe("Default edition is missing.");
+				return;
+			}
+
+			// Get the current selected word to highlight more
+			List<String> selectedWordIds = selectedWordMatch.getValuesForProperty(corpus.getProperty("id")); //$NON-NLS-1$;
+
+			// Get all words to highlight from the progression chart data set
+			ArrayList<Integer> allPointPositions = chartEditor.getEditorInput().getSWTChartsComponentsProvider().getChartsEngine().getProgressionChartAllPointPositions(chartEditor.getChart());
+			ArrayList<String> wordIds = new ArrayList<String>(allPointPositions.size());
+			for(int i = 0; i < allPointPositions.size(); i++) {
+				Match match = new Match(allPointPositions.get(i), allPointPositions.get(i));
+				if(match.getValueForProperty(textP).equals(textId)) {
+					wordIds.add(match.getValueForProperty(corpus.getProperty("id"))); //$NON-NLS-1$;
+				}
+			}
+
+			Page openPage = edition.getPageForWordId(selectedWordIds.get(0));
+
+			if(openPage != null) {
+
+				// Create the linked editor if needed
+				if(linkedEditor == null || linkedEditor.isDisposed()) {
+					linkedEditor = OpenBrowser.openEdition(openPage.getFile().getAbsolutePath(), openPage.getFile().getName());
+					linkedEditor.setEdition(edition);
+					chartEditor.addLinkedEditor(linkedEditor);
+					
+					
+					int position = EModelService.BELOW;;
+					EditorPart parentEditor = chartEditor;
+					// Split vertically if there is already a concordance editor otherwise split horizontally
+					ConcordancesEditor linkedConcordanceEditor = (ConcordancesEditor)chartEditor.getLinkedEditor(ConcordancesEditor.class);
+					if(linkedConcordanceEditor != null)	{
+						position = EModelService.RIGHT_OF;
+						parentEditor = linkedConcordanceEditor;
+					}
+					
+					// Split and add linked editor
+					SWTEditorsUtils.addEditor(parentEditor, linkedEditor, position);
+				}
+
+				linkedEditor.showPage(openPage);
+				// Highlight tokens
+				linkedEditor.setWordsIds(wordIds, selectedWordIds);
+
+				IWorkbenchPage attachedPage = linkedEditor.getEditorSite().getPage();
+				attachedPage.activate(linkedEditor);
+			}
+		}
+		catch(Exception e) {
+			Log.printStackTrace(e);
+		}
+	}
+
+
+
+	
+	    
+}

Property changes on: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/jfreechart/events/ProgressionEventCallBack.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

