Index: tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/SVGSWTChartsComponentsProvider.java
===================================================================
--- tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/SVGSWTChartsComponentsProvider.java	(revision 527)
+++ tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/SVGSWTChartsComponentsProvider.java	(revision 528)
@@ -17,9 +17,7 @@
 import org.apache.batik.transcoder.svg2svg.SVGTranscoder;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
-import org.txm.chartsengine.core.ChartCreator;
 import org.txm.chartsengine.core.ChartsEngine;
-import org.txm.core.results.TXMResult;
 import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
 import org.txm.chartsengine.rcp.editors.ChartEditorInput;
 import org.txm.chartsengine.rcp.editors.ChartEditorPart;
@@ -50,17 +48,23 @@
 	
 	
 	@Override
-	public boolean createChart(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput, TXMResult result, String chartType)	{
-		ChartCreator chartCreator = chartsEngine.getChartCreator(result.getClass(), chartType);
-		if(chartCreator != null)	{
-			chartEditorInput.setChartContainer(chartCreator.createChartFile(result));
+	public boolean createChartContainer(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput)	{
+
+		Object chart = chartEditorInput.getChart();
+		
+		//if(chart != null)	{
+			chartEditorInput.setChartContainer(chart);
 			
 			// sets and updates the local preferences node qualifier from the result data
 			chartEditorInput.syncLocalPreferencesNode();
+
+
 			
 			return true;
-		}
-		return false;
+		//}
+		
+		
+		//return false;
 	}
 
 
@@ -77,21 +81,7 @@
 	  * @return
 	  */
 	 public static SVGComposite createCompositeStatic(ChartEditorPart chartEditor, Composite parent)	{
-
-		 SVGComposite composite = new SVGComposite(chartEditor, parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
-
-		 // Link the composite to the chart editor (need to be done before initializing the AWT delegation events)
-		 chartEditor.setComposite(composite);
-
-		 // Initialize Swing/AWT events
-		 SWTChartsComponentsProvider.initializeAWTDelegationListeners(chartEditor, composite.getPanel().getSVGCanvas());
-
-		 // Load the chart in composite
-		 if(chartEditor.getEditorInput().getChartContainer() != null)	{
-			 composite.loadChart(chartEditor.getEditorInput().getChartContainer());
-		 }
-		 
-		 return composite;
+		 return new SVGComposite(chartEditor, parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
 	 }
 
 
Index: tmp/org.txm.progression.rcp/plugin.xml
===================================================================
--- tmp/org.txm.progression.rcp/plugin.xml	(revision 527)
+++ tmp/org.txm.progression.rcp/plugin.xml	(revision 528)
@@ -15,7 +15,7 @@
       <command
             categoryId="org.txm.rcp.category.txm"
             defaultHandler="org.txm.progression.rcp.handlers.ComputeProgression"
-            id="ComputeProgression"
+            id="org.txm.progression.rcp.handlers.ComputeProgression"
             name="%command.name">
       </command>
    </extension>
@@ -25,7 +25,7 @@
             allPopups="false"
             locationURI="toolbar:org.txm.rcp.toolbartools">
          <command
-               commandId="ComputeProgression"
+               commandId="org.txm.progression.rcp.handlers.ComputeProgression"
                icon="icons/functions/progression.png"
                style="push"
                tooltip="%command.tooltip">
@@ -43,7 +43,7 @@
             allPopups="false"
             locationURI="popup:org.txm.rcp.views.corpora.CorporaView">
          <command
-               commandId="ComputeProgression"
+               commandId="org.txm.progression.rcp.handlers.ComputeProgression"
                icon="icons/functions/progression.png"
                style="push">
             <visibleWhen
@@ -59,7 +59,7 @@
       <menuContribution
             locationURI="menu:menu.tools">
          <command
-               commandId="ComputeProgression"
+               commandId="org.txm.progression.rcp.handlers.ComputeProgression"
                icon="icons/functions/progression.png"
                style="push">
             <visibleWhen
@@ -94,7 +94,7 @@
    <extension
          point="org.eclipse.ui.editors">
       <editor
-            class="org.txm.chartsengine.rcp.editors.ChartEditorPart"
+            class="org.txm.progression.rcp.editors.ProgressionEditor"
             default="false"
             icon="icons/functions/progression.png"
             id="org.txm.progression.core.functions.Progression"
Index: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java
===================================================================
--- tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java	(revision 0)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java	(revision 528)
@@ -0,0 +1,68 @@
+/**
+ * 
+ */
+package org.txm.progression.rcp.editors;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.txm.chartsengine.rcp.editors.ChartEditorPart;
+import org.txm.progression.rcp.forms.ProgressionParametersComposite;
+
+/**
+ * Progression command chart editor.
+ * @author sjacquot
+ *
+ */
+public class ProgressionEditor extends ChartEditorPart {
+
+
+	
+	@Override
+	public void createPartControl(Composite parent) {
+		super.createPartControl(parent);
+		
+		
+		// FIXME: tests parameters composite extension
+		new ProgressionParametersComposite(this.getCommandParametersGroup(), SWT.NONE);
+		this.getCommandParametersGroup().pack();
+
+		// FIXME: tests to use Fields editor and ScopedPreferenceStore for command parameters
+//		BooleanFieldEditor field = new BooleanFieldEditor(ChartsEnginePreferences.SHOW_TITLE, "test2 show title store", editor.getParametersComposite());
+//		field.setPreferenceStore(new TXMPreferenceStore(TXMPreferences.getId(progression)));
+//		field.load();
+//		field.store();
+//		try {
+//			((ScopedPreferenceStore) field.getPreferenceStore()).save();
+//		}
+//		catch(IOException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+		
+		
+		// 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));
+//	    //*****************************************************
+		
+	}
+	
+}

Property changes on: tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java
___________________________________________________________________
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 527)
+++ tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java	(revision 528)
@@ -32,9 +32,9 @@
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.window.Window;
 import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.handlers.HandlerUtil;
 import org.txm.chartsengine.core.ChartsEngine;
@@ -48,7 +48,6 @@
 import org.txm.progression.core.messages.ProgressionCoreMessages;
 import org.txm.progression.core.preferences.ProgressionPreferences;
 import org.txm.progression.rcp.dialogs.ProgressionDialog;
-import org.txm.progression.rcp.forms.ProgressionParametersComposite;
 import org.txm.rcp.JobsTimer;
 import org.txm.rcp.RCPMessages;
 import org.txm.rcp.StatusLine;
@@ -87,7 +86,9 @@
 		}
 
 		Object selection = this.getSelection();
-
+		Progression progression = null;
+		
+		
 		// Compute a new progression
 		if(selection instanceof Corpus)	{
 			Corpus corpus = (Corpus) selection;
@@ -104,15 +105,21 @@
 			
 			int code = d.open();
 			if (code == Window.OK) {
-				computeProgression(d);
+				//computeProgression(d);
+				
+				progression = new Progression(d.getCorpus(), d.getQueries(), d.getStructuralUnit(), d.getStructuralProperty(), d.getPropertyregex(),
+						d.isCumulativeType(), d.getLineWidth(), d.isRepeatvalues(), d.getBandeMultiplier());
 			}
 
 		}
 		// Reopens a progression result with default preferences
 		else if(selection instanceof Progression)	{
-			openEditor((Progression) selection);
+			progression = (Progression) selection;
 		}
 		
+		
+		openEditor(progression);
+		
 		return null;
 	}
 
@@ -146,52 +153,6 @@
 			// Create and open the chart editor
 			editor = SWTChartsComponentsProvider.getCurrent().openEditor(progression);
 
-			
-
-			// FIXME: tests parameters composite extension
-			// Contribute to the tool bar without extending ChartEditorPart
-			// FIXME: finally, would be better to create a ProgressionEditor
-			if(!editor.wasAlreadyOpened())	{
-				new ProgressionParametersComposite(editor.getCommandParametersGroup(), SWT.NONE);
-				editor.getCommandParametersGroup().pack();
-			}
-			// FIXME: tests to use Fields editor and ScopedPreferenceStore for command parameters
-//			BooleanFieldEditor field = new BooleanFieldEditor(ChartsEnginePreferences.SHOW_TITLE, "test2 show title store", editor.getParametersComposite());
-//			field.setPreferenceStore(new TXMPreferenceStore(TXMPreferences.getId(progression)));
-//			field.load();
-//			field.store();
-//			try {
-//				((ScopedPreferenceStore) field.getPreferenceStore()).save();
-//			}
-//			catch(IOException e) {
-//				// TODO Auto-generated catch block
-//				e.printStackTrace();
-//			}
-			
-			
-			// 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;
@@ -205,12 +166,24 @@
 	 *
 	 * @param dialog the dialog box
 	 */
-	public static Object computeProgression(final ProgressionDialog dialog) {
-		if (!CQPEngine.isInitialized()) return false;
+	@Deprecated
+	public Object computeProgression(final ProgressionDialog dialog) {
+		if (!this.checkCorpusEngine())	{
+			return false;
+		}
+
 		
-		JobHandler jobhandler = new JobHandler(NLS.bind(ProgressionCoreMessages.ComputeProgression_2, dialog.getQueries(), dialog.getCorpus().getName())) {
+
+		
+		JobHandler job = new JobHandler(NLS.bind(ProgressionCoreMessages.ComputeProgression_2, dialog.getQueries(), dialog.getCorpus().getName())) {
 			@Override
 			protected IStatus run(IProgressMonitor monitor) {
+				
+				final Progression progression = new Progression(dialog.getCorpus(), dialog.getQueries(), dialog.getStructuralUnit(), dialog.getStructuralProperty(), dialog.getPropertyregex(),
+						dialog.isCumulativeType(), dialog.getLineWidth(), dialog.isRepeatvalues(), dialog.getBandeMultiplier());
+				
+				monitor = progression;
+				
 				this.runInit(monitor);
 				JobsTimer.start();
 				try {
@@ -221,44 +194,33 @@
 					}
 
 					
-					final Progression progression = new Progression(dialog.getCorpus(), dialog.getQueries(), dialog.getStructuralUnit(), dialog.getStructuralProperty(), dialog.getPropertyregex(),
-							dialog.isCumulativeType(), dialog.getLineWidth(), dialog.isRepeatvalues(), dialog.getBandeMultiplier());
 
 					
 					// persistence
 					if(dialog.isBlackAndWhite())	{
-						TXMPreferences.putLocalInt(progression, ChartsEnginePreferences.RENDERING_COLORS_MODE, ChartsEngine.RENDERING_BLACK_AND_WHITE_MODE);	
+						TXMPreferences.putLocal(progression, ChartsEnginePreferences.RENDERING_COLORS_MODE, ChartsEngine.RENDERING_BLACK_AND_WHITE_MODE);	
 					}
-					TXMPreferences.putLocalBoolean(progression, ProgressionPreferences.CHART_MONO_STYLE, dialog.isMonoStyle());
-					TXMPreferences.putLocalBoolean(progression, ProgressionPreferences.CHART_CUMULATIVE, dialog.isCumulativeType());
+					TXMPreferences.putLocal(progression, ProgressionPreferences.CHART_MONO_STYLE, dialog.isMonoStyle());
+					TXMPreferences.putLocal(progression, ProgressionPreferences.CHART_CUMULATIVE, dialog.isCumulativeType());
 					
 					
 					
 					Log.info(NLS.bind(ProgressionCoreMessages.ComputeProgression_4, 
 							new Object[]{dialog.getCorpus(), dialog.getQueries(), dialog.getStructuralUnit(), dialog.getStructuralProperty(), dialog.isCumulativeType()}));
 					
+					monitor.worked(50);
 					
 					
-					monitor.worked(50);
-					if (monitor.isCanceled())
+					if (monitor.isCanceled())	{
 						return Status.CANCEL_STATUS;
-					boolean success = true;//progression.process();
-
-					if (!progression.stepQueries()) {
-						System.out.println(ProgressionCoreMessages.ComputeProgression_3);
-						return Status.CANCEL_STATUS;
 					}
-					if (monitor.isCanceled()) return Status.CANCEL_STATUS;
-					monitor.worked(10);
+					
+					boolean success = progression.compute(false, monitor);
 
-					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() {
@@ -275,7 +237,7 @@
 					monitor.worked(45);
 
 					monitor.subTask(RCPMessages.RefreshingCorporaView);
-					CorporaView.storeResult(corpus, progression);
+					//CorporaView.storeResult(corpus, progression);
 					
 					monitor.worked(5);
 					System.out.println(NLS.bind(ProgressionCoreMessages.ComputeProgression_12, progression.getPositionsCounts()));
@@ -298,7 +260,11 @@
 				return Status.OK_STATUS;
 			}
 		};
-		jobhandler.startJob();
+		//jobhandler.setCurrentMonitor(progression);
+		//jobhandler.startJob();
+		job.setPriority(Job.DECORATE);
+		job.setUser(true);
+		job.schedule();
 		return null;
 	}
 }
Index: tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java
===================================================================
--- tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java	(revision 527)
+++ tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java	(revision 528)
@@ -620,8 +620,8 @@
 					//monitor.worked(5);
 
 					cooc.setParameters(parameters);
-					if (cooc.validateParameters() && cooc.isDirty()) {
-						cooc.compute(this);
+					if (cooc.canCompute() && cooc.isDirty()) {
+						cooc.compute(false, this);
 					}
 
 					//FIXME: DEbug
Index: tmp/org.txm.index.core/groovy/org/txm/test/TestIndex.java
===================================================================
--- tmp/org.txm.index.core/groovy/org/txm/test/TestIndex.java	(revision 527)
+++ tmp/org.txm.index.core/groovy/org/txm/test/TestIndex.java	(revision 528)
@@ -62,7 +62,7 @@
 
 			Index index = new Index(corpus);
 			index.setParameters(query, properties, null, null, null, null);
-			index.compute();
+			index.compute(false);
 			index.getAllLines();
 			
 			if (sortBy != null) {
@@ -90,7 +90,7 @@
 
 			Index index = new Index(partition);
 			index.setParameters(query, properties, null, null, null, null);
-			index.compute();
+			index.compute(false);
 			index.getAllLines();
 			
 			if (sortBy != null) {
Index: tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java
===================================================================
--- tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 527)
+++ tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java	(revision 528)
@@ -40,7 +40,6 @@
 import java.util.List;
 
 import org.apache.commons.lang.StringUtils;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.osgi.util.NLS;
 import org.rosuda.REngine.REXPMismatchException;
 import org.txm.core.results.TXMParameters;
@@ -186,7 +185,7 @@
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		lines.clear();
 		counts.clear();
 		partnames.clear();
@@ -1015,7 +1014,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		if (getCorpus() == null && getPartition() == null) {
 			System.out.println("Corpus or partition not set");
 			return false;
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 527)
+++ tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java	(revision 528)
@@ -1277,7 +1277,7 @@
 					leftContextSize, rightContextSize);
 			concordance.setCQLSeparator(cql_limit);
 
-			concordance.compute(null);
+			concordance.compute(false, null);
 
 			StatusLine.setMessage(NLS.bind(Messages.ConcordancesEditor_19, concordance.getNLines()));
 			if (concordance.getNLines() == 1)
Index: tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/events/DefaultChartMouseListener.java
===================================================================
--- tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/events/DefaultChartMouseListener.java	(revision 527)
+++ tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/events/DefaultChartMouseListener.java	(revision 528)
@@ -288,9 +288,10 @@
 
 
 		}
+		if(renderer.getItemsSelector() != null)	{
+			renderer.getItemsSelector().setMouseOverItem(series, item);
+		}
 
-		renderer.getItemsSelector().setMouseOverItem(series, item);
-
 	}
 
 }
Index: tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/JFCSWTChartsComponentsProvider.java
===================================================================
--- tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/JFCSWTChartsComponentsProvider.java	(revision 527)
+++ tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/JFCSWTChartsComponentsProvider.java	(revision 528)
@@ -11,6 +11,7 @@
 import org.jfree.chart.plot.XYPlot;
 import org.txm.chartsengine.core.ChartCreator;
 import org.txm.chartsengine.core.ChartsEngine;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.core.results.TXMResult;
 import org.txm.chartsengine.jfreechart.core.JFCChartsEngine;
 import org.txm.chartsengine.jfreechart.core.renderers.MouseOverItemSelector;
@@ -39,7 +40,9 @@
 
 	
 	
-	
+	/**
+	 * 
+	 */
 	public JFCSWTChartsComponentsProvider() {
 		super();
 	}
@@ -56,12 +59,17 @@
 
 	
 	@Override
-	public boolean createChart(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput, TXMResult result, String chartType)	{
-		ChartCreator chartCreator = chartsEngine.getChartCreator(result.getClass(), chartType);
-		if(chartCreator != null)	{
-			JFreeChart chart = (JFreeChart) chartCreator.createChart(result); 
+	public boolean createChartContainer(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput)	{
+
+		JFreeChart chart = (JFreeChart) chartEditorInput.getChart();
+			
+//		if(chart != null)	{
+
 			ChartPanel chartPanel = ((JFCChartsEngine) chartsEngine).getJFCTheme().createChartPanel(this, chart);
+			
+			
 			chartEditorInput.setChartContainer(chartPanel);
+			
 
 			// Store the chart panel in the renderer (eg. can be needed to get the Graphics2D object to use in getItemShape() to compute the label text bounds and draw a background rectangle.)
 			if(chart.getPlot() instanceof XYPlot && chart.getXYPlot().getRenderer() instanceof IRendererWithItemSelection)	{
@@ -72,19 +80,20 @@
 			}
 			
 			// update for shared preferences, show title, show legend, colors rendering mode, etc.
-			chartCreator.updateChart(chart, result);
+			chartsEngine.updateChart(chart, chartEditorInput.getResult());
 
 			// sets and updates the local preferences node qualifier from the result data
 			chartEditorInput.syncLocalPreferencesNode();
+			
 			return true;
-		}
-		return false;
+	//	}
+		
+		//return false;
 	}
 	
 	
 	
 	
-//
 	@Override
 	public JFCChartsEngine getChartsEngine()	{
 		return (JFCChartsEngine) this.chartsEngine;
@@ -103,36 +112,10 @@
 	 * @return
 	 */
 	public static JFCComposite createCompositeStatic(ChartEditorPart chartEditor, Composite parent)	{
-
-
-		ChartPanel chartPanel = null;
-		// Get the chart panel from the editor input if exists
-		if(chartEditor.getEditorInput() instanceof ChartEditorInput && chartEditor.getEditorInput().getChartContainer() != null)	{	
-			chartPanel = (ChartPanel) chartEditor.getEditorInput().getChartContainer();
-		}
-		// Create a default empty chart panel
-		else	{
-
-			chartPanel = ((JFCSWTChartsComponentsProvider)SWTChartsComponentsProvider.getComponentsProvider(JFCSWTChartsComponentsProvider.class)).swingComponentsProvider.createDefaultEmptyChartPanel();
-			chartEditor.getEditorInput().setChartContainer(chartPanel);
-		}
-		
-		JFCComposite composite = new JFCComposite(chartEditor, parent, chartPanel);
-		((IChartComponent) chartPanel).setChartEditor(chartEditor);
-
-		// Link the composite to the chart editor (need to be done before initializing the AWT delegation events)
-		chartEditor.setComposite(composite);
-
-		// Initialize Swing/AWT events
-		SWTChartsComponentsProvider.initializeAWTDelegationListeners(chartEditor, chartPanel);
-
-		
-		return composite;
+		return new JFCComposite(chartEditor, parent);
 	}
 
 
-
-
 	@Override
 	public ArrayList<String> getEditorSupportedExportFileFormats()	{
 		return this.chartsEngine.getSupportedOutputFileFormats();
Index: tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java
===================================================================
--- tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java	(revision 527)
+++ tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java	(revision 528)
@@ -1,6 +1,7 @@
 package org.txm.chartsengine.jfreechart.rcp.swt;
 
 import java.awt.BorderLayout;
+import java.awt.Component;
 import java.awt.EventQueue;
 import java.awt.Frame;
 import java.awt.Insets;
@@ -46,17 +47,21 @@
 
 
 
+	protected Frame frame;
+	
+	protected Panel rootPanel;
+	
 
 	/**
 	 * Creates a JFreeChart composite.
 	 * @param parent
 	 * @param panel
 	 */
-	public JFCComposite(ChartEditorPart chartEditor, Composite parent, ChartPanel panel) {
+	public JFCComposite(ChartEditorPart chartEditor, Composite parent) {
 		super(chartEditor, parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
 		//super(parent, SWT.EMBEDDED | SWT.NO_MERGE_PAINTS | SWT.NO_BACKGROUND); // do not fix the transparency problem
 
-		this.chartComponent = (IChartComponent) panel;
+		//this.chartComponent = (IChartComponent) panel;
 
 		// FIXME : transparency doesn't work with tool tips
 		// The problem here is that we normally need a JFrame but it seems to be impossible to embed a JFrame
@@ -64,7 +69,7 @@
 //		panel.setOpaque(false); // do not fix
 //		ToolTipManager.sharedInstance().setLightWeightPopupEnabled(true); // do not fix
 
-		final Frame frame = SWT_AWT.new_Frame(this);
+		this.frame = SWT_AWT.new_Frame(this);
 
 
 
@@ -79,10 +84,10 @@
 
 
 
-			// Need to add an AWT Panel to fix mouse events and mouse cursors changes on Swing JPanel
-			Panel rootPanel = new Panel(new BorderLayout());
-			rootPanel.add(this.getChartPanel()); // commenter cette ligne pour le test de scrolling ci-dessous
-			frame.add(rootPanel);
+//			// Need to add an AWT Panel to fix mouse events and mouse cursors changes on Swing JPanel
+//			this.rootPanel = new Panel(new BorderLayout());
+//			//rootPanel.add(this.getChartPanel()); // commenter cette ligne pour le test de scrolling ci-dessous
+//			this.frame.add(this.rootPanel);
 
 
 			// FIXME: test, smarter way to embed the frame ? Actually it doesn't fix neither the tooltip transparency nor the cursor change on pan under Mac OS X
@@ -209,7 +214,7 @@
 	//		});
 
 
-			frame.setVisible(true);
+			//this.frame.setVisible(true);
 			//parent.pack();
 
 //		   }
@@ -242,6 +247,7 @@
 	public ChartPanel getChartPanel() {
 		return (ChartPanel) this.chartComponent;
 	}
+	
 
 	@Override
 	public void loadChart(Object data) {
@@ -262,9 +268,21 @@
 	@Override
 	public void loadChart()	{
 		
-		// get a new chart from the editor input
-		this.loadChart(((ChartPanel)this.chartEditor.getComposite().getChartComponent()).getChart());
+		// creates components if they not exist
+		if(this.chartComponent == null)	{
+			this.chartComponent = (IChartComponent) this.chartEditor.getEditorInput().getChartContainer();
+			
+			// Need to add an AWT Panel to fix mouse events and mouse cursors changes on Swing JPanel
+			this.rootPanel = new Panel(new BorderLayout());
+			
+			this.rootPanel.add((Component) this.chartComponent);
+			this.frame.add(this.rootPanel);
+			this.frame.setVisible(true);
+		}
 		
+		// loads the chart from the result
+		this.loadChart(this.chartEditor.getChart());
+		
 		this.forceFocus();
 	}
 
Index: tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java
===================================================================
--- tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java	(revision 527)
+++ tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java	(revision 528)
@@ -34,14 +34,12 @@
 import java.util.ArrayList;
 import java.util.List;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.ca.core.messages.CACoreMessages;
 import org.txm.ca.core.preferences.CAPreferences;
 import org.txm.ca.core.statsengine.r.functions.FactoMineRCA;
 import org.txm.ca.core.statsengine.r.functions.ICA;
-import org.txm.chartsengine.core.results.IChartResult;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.core.results.TXMParameters;
-import org.txm.core.results.TXMResult;
 import org.txm.lexicaltable.core.functions.LexicalTable;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Property;
@@ -55,7 +53,7 @@
  * @author sloiseau
  *  
  */
-public class CA extends TXMResult implements IChartResult {
+public class CA extends ChartResult {
 
 	/** The ca. */
 	private ICA ca;
@@ -168,7 +166,7 @@
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		return stepCompute();
 	}
 
@@ -903,7 +901,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return this.table != null && table.getNColumns() > 3;
 	}
 
Index: tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/RCAChartCreator.java
===================================================================
--- tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/RCAChartCreator.java	(revision 527)
+++ tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/RCAChartCreator.java	(revision 528)
@@ -10,10 +10,9 @@
 import org.txm.ca.core.messages.CACoreMessages;
 import org.txm.ca.core.preferences.CAPreferences;
 import org.txm.ca.core.statsengine.r.functions.FactoMineRCA;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
 import org.txm.chartsengine.r.core.RChartCreator;
 import org.txm.chartsengine.r.core.RChartsEngine;
+import org.txm.core.results.TXMResult;
 import org.txm.utils.logger.Log;
 
 /**
@@ -24,11 +23,6 @@
  */
 public class RCAChartCreator extends RChartCreator implements CAChartCreator {
 
-	public RCAChartCreator() {
-		// TODO Auto-generated constructor stub
-	}
-
-	
 	/**
 	 * Creates a factorial map chart from the specified CA result from "FactoMineR" R package and writes it in the specified file.
 	 * @param ca
Index: tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/RSingularValuesChartCreator.java
===================================================================
--- tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/RSingularValuesChartCreator.java	(revision 527)
+++ tmp/org.txm.ca.core/src/org/txm/ca/core/chartsengine/r/RSingularValuesChartCreator.java	(revision 528)
@@ -16,25 +16,7 @@
  */
 public class RSingularValuesChartCreator extends RChartCreator {
 
-	public RSingularValuesChartCreator() {
-		// TODO Auto-generated constructor stub
-	}
-
-
 	@Override
-	public Class getResultDataClass() {
-		return CA.class;
-	}
-
-
-	@Override
-	public Object createChart(TXMResult result) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-
-	@Override
 	public File createChartFile(TXMResult result, File file) {
 
 		CA ca = (CA) result;
@@ -94,5 +76,13 @@
 	}
 
 
+	
+	@Override
+	public Class getResultDataClass() {
+		return CA.class;
+	}
 
+
+
+
 }
Index: tmp/org.txm.cah.rcp/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.cah.rcp/META-INF/MANIFEST.MF	(revision 527)
+++ tmp/org.txm.cah.rcp/META-INF/MANIFEST.MF	(revision 528)
@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
-Bundle-Name: CAH RCP
+Bundle-Name: AHC RCP
 Bundle-SymbolicName: org.txm.cah.rcp;singleton:=true
 Bundle-Version: 1.0.0.qualifier
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Index: tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeCAH.java
===================================================================
--- tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeCAH.java	(revision 527)
+++ tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeCAH.java	(revision 528)
@@ -1,356 +0,0 @@
-// 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.cah.rcp.handlers;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-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.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Spinner;
-import org.txm.ca.core.functions.CA;
-import org.txm.ca.core.preferences.CAPreferences;
-import org.txm.cah.core.functions.CAH;
-import org.txm.cah.core.messages.CAHCoreMessages;
-import org.txm.cah.core.preferences.CAHPreferences;
-import org.txm.cah.rcp.messages.CAHUIMessages;
-import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
-import org.txm.chartsengine.rcp.editors.ChartEditorInput;
-import org.txm.chartsengine.rcp.editors.ChartEditorPart;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMParameters;
-import org.txm.lexicaltable.core.functions.LexicalTable;
-import org.txm.lexicaltable.core.functions.LexicalTableFactory;
-import org.txm.lexicaltable.rcp.editors.LexicalTableDialog;
-import org.txm.rcp.handlers.BaseAbstractHandler;
-import org.txm.rcp.views.corpora.CorporaView;
-import org.txm.searchengine.cqp.corpus.Partition;
-import org.txm.searchengine.cqp.corpus.Property;
-import org.txm.statsengine.core.StatException;
-import org.txm.utils.logger.Log;
-
-/**
- * If the selection is a CA or a Lexical Table result computes the CAH.
- *
- * @author mdecorde
- * @author sjacquot
- */
-public class ComputeCAH extends BaseAbstractHandler {
-
-
-	// adds a double click listener to the Corpus View
-	static	{
-		CorporaView.addDoubleClickListener(CAH.class, ComputeCAH.class);
-	}
-	
-
-	/* (non-Javadoc)
-	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-	 */
-	@Override
-	public Object execute(ExecutionEvent event) throws ExecutionException {
-
-
-		if(!this.checkStatsEngine()) {
-			return null;
-		}
-
-		Object selection = this.getSelection();
-		ChartEditorInput editorInput = null;
-		
-		
-		
-		CA ca = null;
-
-		
-		// reopening an existing result
-		if (selection instanceof CAH) {
-			editorInput = new ChartEditorInput((CAH) selection);
-		}
-		// creates from CA
-		else if (selection instanceof CA) {
-			ca = (CA) selection;
-		}
-		// creates from LexicalTable
-		else if (selection instanceof LexicalTable) {
-			//System.out.println("Compute CAH with LT : "+((LexicalTable)selection.getFirstElement()).getName());
-			LexicalTable lexicaltable = (LexicalTable) selection;
-			
-			try {
-				ca = new CA(lexicaltable);
-			} catch (StatException e) {
-				System.out.println("Failed to build the CA with lexical table " + lexicaltable + ": " + e);
-				Log.printStackTrace(e);
-			}
-			lexicaltable.addResult(ca);
-			
-//			if (lexicaltable.getPartition() != null)
-//				lexicaltable.getPartition().storeResult(ca);
-//			else if (lexicaltable.getCorpus() != null)
-//				lexicaltable.getCorpus().storeResult(ca);
-		}
-		// creates from Partition
-		else if (selection instanceof Partition) {
-			//System.out.println("Compute CAH with Partition : "+((Partition)selection.getFirstElement()).getName());
-			Partition partition = (Partition)selection;
-			try {
-				String title = CAHUIMessages.bind(CAHUIMessages.ComputeCAH_0, partition.getName());
-				int vmax = TXMPreferences.getInt(CAPreferences.V_MAX, CAPreferences.PREFERENCES_NODE);
-				int fmin = TXMPreferences.getInt(CAPreferences.F_MIN, CAPreferences.PREFERENCES_NODE);
-				Shell shell = Display.getCurrent().getActiveShell();
-				LexicalTableDialog d = new LexicalTableDialog(shell, partition.getCorpus(), title);
-				d.setFminAndVMax(fmin, vmax);
-				
-				if (d.open() == Window.OK) {
-					Property property = d.getProperty();
-					fmin = d.getFmin();
-					vmax = d.getMaxLines();
-					
-					LexicalTable lexicaltable = LexicalTableFactory.getLexicalTable(partition, property, fmin); // use the CAPreferencePage Fmin
-					lexicaltable.getData().cut(vmax);
-					partition.addResult(lexicaltable);
-					
-					ca = new CA(lexicaltable);
-					lexicaltable.addResult(ca);
-				} else {
-					// canceled
-					return null;
-				}
-			} catch (Exception e) {
-				System.out.println("Failed to build the lexical table of " + partition + ": " + e);
-				Log.printStackTrace(e);
-				return null;
-			} 
-		}
-
-		if (ca != null)	{
-			CAH cah = new CAH(ca);
-			
-			TXMParameters parameters = new TXMParameters();
-			parameters.put(CAHPreferences.COLUMNS_COMPUTING, TXMPreferences.getBoolean(CAHPreferences.COLUMNS_COMPUTING, CAHPreferences.PREFERENCES_NODE));
-			parameters.put(CAHPreferences.METHOD, TXMPreferences.getString(CAHPreferences.METHOD, CAHPreferences.PREFERENCES_NODE));
-			parameters.put(CAHPreferences.METRIC, TXMPreferences.getString(CAHPreferences.METRIC, CAHPreferences.PREFERENCES_NODE));
-			parameters.put(CAHPreferences.N_CLUSTERS, TXMPreferences.getInt(CAHPreferences.N_CLUSTERS, CAHPreferences.PREFERENCES_NODE));
-			cah.setParameters(parameters);
-			
-			editorInput = new ChartEditorInput(cah);
-		}
-		
-		ChartEditorPart editor = SWTChartsComponentsProvider.getCurrent().openEditor(editorInput);
-
-		// computes if not reopening a result
-		if(!(selection instanceof CAH))	{
-			editor.computeResult();
-		}
-		
-
-		return null;
-	}
-
-
-
-
-	/**
-	 * The Class CAHParamDialog.
-	 */
-	// FIXME: not used?
-	public class CAHParamDialog extends Dialog {
-
-		//protected Combo methodsCombo;
-		//protected Combo metricsCombo;
-		/** The ncluster spinner. */
-		protected Spinner nclusterSpinner;
-
-		/** The docolumns button. */
-		protected Button docolumnsButton;
-
-		/** The title. */
-		protected String title;
-
-		/**
-		 * Instantiates a new cAH param dialog.
-		 *
-		 * @param parentShell the parent shell
-		 */
-		public CAHParamDialog(Shell parentShell) {
-			super(parentShell);
-			this.title = CAHCoreMessages.RESULT_TYPE;
-		}
-
-		/* (non-Javadoc)
-		 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
-		 */
-		@Override
-		protected void configureShell(Shell newShell) {
-			super.configureShell(newShell);
-
-			if (title != null)
-				newShell.setText(title);
-			else
-				newShell.setText(CAHCoreMessages.RESULT_TYPE);
-		}
-
-		/** The composite. */
-		protected Composite composite;
-
-		/** The method. */
-		private String method;
-
-		/** The metric. */
-		private String metric;
-
-		/** The Ncluster. */
-		private int Ncluster;
-
-		/** The doculumns. */
-		private boolean doculumns;
-
-		/* (non-Javadoc)
-		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
-		 */
-		@Override
-		protected Control createDialogArea(Composite parent) {
-			composite = new Composite(parent, SWT.NONE);
-			GridLayout layout = new GridLayout(2, false);
-			composite.setLayout(layout);
-
-			// N CLUSTERS
-			Label label = new Label(composite, SWT.NONE);
-			label.setText(CAHUIMessages.CAHPreferencePage_2);
-
-			nclusterSpinner = new Spinner(composite, SWT.BORDER);
-			nclusterSpinner.setMinimum(2);
-			nclusterSpinner.setIncrement(1);
-			nclusterSpinner.setSelection(TXMPreferences.getInt(CAHPreferences.N_CLUSTERS, CAHPreferences.PREFERENCES_NODE));
-			nclusterSpinner.setMaximum(50);
-
-			// ROWS OR COLS
-			docolumnsButton = new Button(composite, SWT.RADIO);
-			docolumnsButton.setText(CAHUIMessages.COMPUTE_COLUMNS);
-			docolumnsButton.setSelection(true);
-
-			Button dorowsButton = new Button(composite, SWT.RADIO);
-			dorowsButton.setText(CAHUIMessages.COMPUTE_ROWS);
-
-			/*
-			// METHODS
-			Label methodLabel = new Label(composite, SWT.NONE);
-			methodLabel.setText("Methods");
-
-			methodLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER,
-					false, false));
-
-			methodsCombo = new Combo(composite, SWT.READ_ONLY);
-			methodsCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
-					true, false));
-			methodsCombo.select(methodsCombo.indexOf(CAH.getDefaultMethod()));
-			for(String method : CAH.getMethods())
-				methodsCombo.add(method);
-
-			// METRICS
-			Label metricsLabel = new Label(composite, SWT.NONE);
-			metricsLabel.setText("Methods");
-
-			metricsLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER,
-					false, false));
-
-			metricsCombo = new Combo(composite, SWT.READ_ONLY);
-			metricsCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
-					true, false));
-			metricsCombo.select(metricsCombo.indexOf(CAH.getDefaultMetric()));
-			for(String method : CAH.getMetrics())
-				metricsCombo.add(method);
-				*/
-
-			return composite;
-		}
-
-		/* (non-Javadoc)
-		 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
-		 */
-		@Override
-		protected void okPressed() {
-			/*int idx = methodsCombo.getSelectionIndex();
-			method = methodsCombo.getItem(idx);
-
-			idx = metricsCombo.getSelectionIndex();
-			metric = metricsCombo.getItem(idx);
-*/
-			Ncluster = this.nclusterSpinner.getSelection();
-
-			doculumns = this.docolumnsButton.getSelection();
-
-			super.okPressed();
-		}
-
-		/**
-		 * Gets the method.
-		 *
-		 * @return the method
-		 */
-		public String getMethod() {
-			return method;
-		}
-
-		/**
-		 * Gets the metric.
-		 *
-		 * @return the metric
-		 */
-		public String getMetric() {
-			return metric;
-		}
-
-		/**
-		 * Gets the ncluster.
-		 *
-		 * @return the ncluster
-		 */
-		public int getNcluster() {
-			return Ncluster;
-		}
-
-		/**
-		 * Checks if is doculumns.
-		 *
-		 * @return true, if is doculumns
-		 */
-		public boolean isDoculumns() {
-			return doculumns;
-		}
-	}
-
-
-}
Index: tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeAHC.java
===================================================================
--- tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeAHC.java	(revision 0)
+++ tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeAHC.java	(revision 528)
@@ -0,0 +1,356 @@
+// 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.cah.rcp.handlers;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+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.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Spinner;
+import org.txm.ca.core.functions.CA;
+import org.txm.ca.core.preferences.CAPreferences;
+import org.txm.cah.core.functions.AHC;
+import org.txm.cah.core.messages.AHCCoreMessages;
+import org.txm.cah.core.preferences.AHCPreferences;
+import org.txm.cah.rcp.messages.AHCUIMessages;
+import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
+import org.txm.chartsengine.rcp.editors.ChartEditorInput;
+import org.txm.chartsengine.rcp.editors.ChartEditorPart;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMParameters;
+import org.txm.lexicaltable.core.functions.LexicalTable;
+import org.txm.lexicaltable.core.functions.LexicalTableFactory;
+import org.txm.lexicaltable.rcp.editors.LexicalTableDialog;
+import org.txm.rcp.handlers.BaseAbstractHandler;
+import org.txm.rcp.views.corpora.CorporaView;
+import org.txm.searchengine.cqp.corpus.Partition;
+import org.txm.searchengine.cqp.corpus.Property;
+import org.txm.statsengine.core.StatException;
+import org.txm.utils.logger.Log;
+
+/**
+ * If the selection is a CA or a Lexical Table result computes the CAH.
+ *
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class ComputeAHC extends BaseAbstractHandler {
+
+
+	// adds a double click listener to the Corpus View
+	static	{
+		CorporaView.addDoubleClickListener(AHC.class, ComputeAHC.class);
+	}
+	
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+	 */
+	@Override
+	public Object execute(ExecutionEvent event) throws ExecutionException {
+
+
+		if(!this.checkStatsEngine()) {
+			return null;
+		}
+
+		Object selection = this.getSelection();
+		ChartEditorInput editorInput = null;
+		
+		
+		
+		CA ca = null;
+
+		
+		// reopening an existing result
+		if (selection instanceof AHC) {
+			editorInput = new ChartEditorInput((AHC) selection);
+		}
+		// creates from CA
+		else if (selection instanceof CA) {
+			ca = (CA) selection;
+		}
+		// creates from LexicalTable
+		else if (selection instanceof LexicalTable) {
+			//System.out.println("Compute CAH with LT : "+((LexicalTable)selection.getFirstElement()).getName());
+			LexicalTable lexicaltable = (LexicalTable) selection;
+			
+			try {
+				ca = new CA(lexicaltable);
+			} catch (StatException e) {
+				System.out.println("Failed to build the CA with lexical table " + lexicaltable + ": " + e);
+				Log.printStackTrace(e);
+			}
+			lexicaltable.addResult(ca);
+			
+//			if (lexicaltable.getPartition() != null)
+//				lexicaltable.getPartition().storeResult(ca);
+//			else if (lexicaltable.getCorpus() != null)
+//				lexicaltable.getCorpus().storeResult(ca);
+		}
+		// creates from Partition
+		else if (selection instanceof Partition) {
+			//System.out.println("Compute CAH with Partition : "+((Partition)selection.getFirstElement()).getName());
+			Partition partition = (Partition)selection;
+			try {
+				String title = AHCUIMessages.bind(AHCUIMessages.ComputeCAH_0, partition.getName());
+				int vmax = TXMPreferences.getInt(CAPreferences.V_MAX, CAPreferences.PREFERENCES_NODE);
+				int fmin = TXMPreferences.getInt(CAPreferences.F_MIN, CAPreferences.PREFERENCES_NODE);
+				Shell shell = Display.getCurrent().getActiveShell();
+				LexicalTableDialog d = new LexicalTableDialog(shell, partition.getCorpus(), title);
+				d.setFminAndVMax(fmin, vmax);
+				
+				if (d.open() == Window.OK) {
+					Property property = d.getProperty();
+					fmin = d.getFmin();
+					vmax = d.getMaxLines();
+					
+					LexicalTable lexicaltable = LexicalTableFactory.getLexicalTable(partition, property, fmin); // use the CAPreferencePage Fmin
+					lexicaltable.getData().cut(vmax);
+					partition.addResult(lexicaltable);
+					
+					ca = new CA(lexicaltable);
+					lexicaltable.addResult(ca);
+				} else {
+					// canceled
+					return null;
+				}
+			} catch (Exception e) {
+				System.out.println("Failed to build the lexical table of " + partition + ": " + e);
+				Log.printStackTrace(e);
+				return null;
+			} 
+		}
+
+		if (ca != null)	{
+			AHC cah = new AHC(ca);
+			
+			TXMParameters parameters = new TXMParameters();
+			parameters.put(AHCPreferences.COLUMNS_COMPUTING, TXMPreferences.getBoolean(AHCPreferences.COLUMNS_COMPUTING, AHCPreferences.PREFERENCES_NODE));
+			parameters.put(AHCPreferences.METHOD, TXMPreferences.getString(AHCPreferences.METHOD, AHCPreferences.PREFERENCES_NODE));
+			parameters.put(AHCPreferences.METRIC, TXMPreferences.getString(AHCPreferences.METRIC, AHCPreferences.PREFERENCES_NODE));
+			parameters.put(AHCPreferences.N_CLUSTERS, TXMPreferences.getInt(AHCPreferences.N_CLUSTERS, AHCPreferences.PREFERENCES_NODE));
+			cah.setParameters(parameters);
+			
+			editorInput = new ChartEditorInput(cah);
+		}
+		
+		ChartEditorPart editor = SWTChartsComponentsProvider.getCurrent().openEditor(editorInput);
+
+		// computes if not reopening a result
+		if(!(selection instanceof AHC))	{
+			editor.computeResult();
+		}
+		
+
+		return null;
+	}
+
+
+
+
+	/**
+	 * The Class CAHParamDialog.
+	 */
+	// FIXME: not used?
+	public class CAHParamDialog extends Dialog {
+
+		//protected Combo methodsCombo;
+		//protected Combo metricsCombo;
+		/** The ncluster spinner. */
+		protected Spinner nclusterSpinner;
+
+		/** The docolumns button. */
+		protected Button docolumnsButton;
+
+		/** The title. */
+		protected String title;
+
+		/**
+		 * Instantiates a new cAH param dialog.
+		 *
+		 * @param parentShell the parent shell
+		 */
+		public CAHParamDialog(Shell parentShell) {
+			super(parentShell);
+			this.title = AHCCoreMessages.RESULT_TYPE;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
+		 */
+		@Override
+		protected void configureShell(Shell newShell) {
+			super.configureShell(newShell);
+
+			if (title != null)
+				newShell.setText(title);
+			else
+				newShell.setText(AHCCoreMessages.RESULT_TYPE);
+		}
+
+		/** The composite. */
+		protected Composite composite;
+
+		/** The method. */
+		private String method;
+
+		/** The metric. */
+		private String metric;
+
+		/** The Ncluster. */
+		private int Ncluster;
+
+		/** The doculumns. */
+		private boolean doculumns;
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
+		 */
+		@Override
+		protected Control createDialogArea(Composite parent) {
+			composite = new Composite(parent, SWT.NONE);
+			GridLayout layout = new GridLayout(2, false);
+			composite.setLayout(layout);
+
+			// N CLUSTERS
+			Label label = new Label(composite, SWT.NONE);
+			label.setText(AHCUIMessages.CAHPreferencePage_2);
+
+			nclusterSpinner = new Spinner(composite, SWT.BORDER);
+			nclusterSpinner.setMinimum(2);
+			nclusterSpinner.setIncrement(1);
+			nclusterSpinner.setSelection(TXMPreferences.getInt(AHCPreferences.N_CLUSTERS, AHCPreferences.PREFERENCES_NODE));
+			nclusterSpinner.setMaximum(50);
+
+			// ROWS OR COLS
+			docolumnsButton = new Button(composite, SWT.RADIO);
+			docolumnsButton.setText(AHCUIMessages.COMPUTE_COLUMNS);
+			docolumnsButton.setSelection(true);
+
+			Button dorowsButton = new Button(composite, SWT.RADIO);
+			dorowsButton.setText(AHCUIMessages.COMPUTE_ROWS);
+
+			/*
+			// METHODS
+			Label methodLabel = new Label(composite, SWT.NONE);
+			methodLabel.setText("Methods");
+
+			methodLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER,
+					false, false));
+
+			methodsCombo = new Combo(composite, SWT.READ_ONLY);
+			methodsCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+					true, false));
+			methodsCombo.select(methodsCombo.indexOf(CAH.getDefaultMethod()));
+			for(String method : CAH.getMethods())
+				methodsCombo.add(method);
+
+			// METRICS
+			Label metricsLabel = new Label(composite, SWT.NONE);
+			metricsLabel.setText("Methods");
+
+			metricsLabel.setLayoutData(new GridData(GridData.END, GridData.CENTER,
+					false, false));
+
+			metricsCombo = new Combo(composite, SWT.READ_ONLY);
+			metricsCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
+					true, false));
+			metricsCombo.select(metricsCombo.indexOf(CAH.getDefaultMetric()));
+			for(String method : CAH.getMetrics())
+				metricsCombo.add(method);
+				*/
+
+			return composite;
+		}
+
+		/* (non-Javadoc)
+		 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
+		 */
+		@Override
+		protected void okPressed() {
+			/*int idx = methodsCombo.getSelectionIndex();
+			method = methodsCombo.getItem(idx);
+
+			idx = metricsCombo.getSelectionIndex();
+			metric = metricsCombo.getItem(idx);
+*/
+			Ncluster = this.nclusterSpinner.getSelection();
+
+			doculumns = this.docolumnsButton.getSelection();
+
+			super.okPressed();
+		}
+
+		/**
+		 * Gets the method.
+		 *
+		 * @return the method
+		 */
+		public String getMethod() {
+			return method;
+		}
+
+		/**
+		 * Gets the metric.
+		 *
+		 * @return the metric
+		 */
+		public String getMetric() {
+			return metric;
+		}
+
+		/**
+		 * Gets the ncluster.
+		 *
+		 * @return the ncluster
+		 */
+		public int getNcluster() {
+			return Ncluster;
+		}
+
+		/**
+		 * Checks if is doculumns.
+		 *
+		 * @return true, if is doculumns
+		 */
+		public boolean isDoculumns() {
+			return doculumns;
+		}
+	}
+
+
+}

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

Index: tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/preferences/CAHPreferencePage.java
===================================================================
--- tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/preferences/CAHPreferencePage.java	(revision 527)
+++ tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/preferences/CAHPreferencePage.java	(revision 528)
@@ -1,97 +0,0 @@
-// 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.cah.rcp.preferences;
-
-import org.eclipse.jface.preference.ComboFieldEditor;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbench;
-import org.txm.cah.core.functions.CAH;
-import org.txm.cah.core.messages.CAHCoreMessages;
-import org.txm.cah.core.preferences.CAHPreferences;
-import org.txm.cah.rcp.adapters.CAHAdapterFactory;
-import org.txm.cah.rcp.messages.CAHUIMessages;
-import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
-import org.txm.rcp.preferences.TXMPreferencePage;
-import org.txm.rcp.preferences.TXMPreferenceStore;
-
-/**
- * CAH preferences page.
- * 
- * @author mdecorde
- * @author sjacquot
- */
-public class CAHPreferencePage extends TXMPreferencePage {
-
-
-
-	@Override
-	public void createFieldEditors() {
-
-		IntegerFieldEditor nClusters = new IntegerFieldEditor(CAHPreferences.N_CLUSTERS, CAHUIMessages.CAHPreferencePage_2, getFieldEditorParent());
-		addField(nClusters);
-
-		String list[] = CAH.getMethods(); 
-		String methods[][] = new String[list.length][2];
-		for(int i = 0 ; i < list.length ; i++)
-			methods[i][0] = methods[i][1] = list[i];
-				
-		ComboFieldEditor method = new ComboFieldEditor(CAHPreferences.METHOD, CAHUIMessages.CAHPreferencePage_3, methods, getFieldEditorParent());
-		addField(method);
-
-		list = CAH.getMetrics(); 
-		String metrics[][] = new String[list.length][2];
-		for(int i = 0 ; i < list.length ; i++)
-			metrics[i][0] = metrics[i][1] = list[i];
-		
-		ComboFieldEditor metric = new ComboFieldEditor(CAHPreferences.METRIC, CAHUIMessages.CAHPreferencePage_4, metrics, getFieldEditorParent());
-		addField(metric);
-		
-		
-		// Charts
-		Composite chartsTab = SWTChartsComponentsProvider.createChartsRenderingPreferencesTabFolderComposite(getFieldEditorParent());
-
-		String[][] labelAndValues = {{"2D", "true"}, {"3D", "false"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-		RadioGroupFieldEditor default2D3Ddisplay = new RadioGroupFieldEditor(CAHPreferences.DISPLAY_2D, CAHUIMessages.CAHPreferencePage_0, 2, labelAndValues, chartsTab);
-		addField(default2D3Ddisplay);
-		
-		
-		// other shared preferences
-		SWTChartsComponentsProvider.createChartsRenderingPreferencesFields(this, chartsTab);
-	}
-
-	@Override
-	public void init(IWorkbench workbench) {
-		this.setPreferenceStore(new TXMPreferenceStore(CAHPreferences.PREFERENCES_NODE));
-		//setDescription("CAH");
-		this.setTitle(CAHCoreMessages.RESULT_TYPE);
-		this.setImageDescriptor(CAHAdapterFactory.ICON);
-	}
-
-}
Index: tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/preferences/AHCPreferencePage.java
===================================================================
--- tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/preferences/AHCPreferencePage.java	(revision 0)
+++ tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/preferences/AHCPreferencePage.java	(revision 528)
@@ -0,0 +1,97 @@
+// 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.cah.rcp.preferences;
+
+import org.eclipse.jface.preference.ComboFieldEditor;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.txm.cah.core.functions.AHC;
+import org.txm.cah.core.messages.AHCCoreMessages;
+import org.txm.cah.core.preferences.AHCPreferences;
+import org.txm.cah.rcp.adapters.AHCAdapterFactory;
+import org.txm.cah.rcp.messages.AHCUIMessages;
+import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
+import org.txm.rcp.preferences.TXMPreferencePage;
+import org.txm.rcp.preferences.TXMPreferenceStore;
+
+/**
+ * CAH preferences page.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ */
+public class AHCPreferencePage extends TXMPreferencePage {
+
+
+
+	@Override
+	public void createFieldEditors() {
+
+		IntegerFieldEditor nClusters = new IntegerFieldEditor(AHCPreferences.N_CLUSTERS, AHCUIMessages.CAHPreferencePage_2, getFieldEditorParent());
+		addField(nClusters);
+
+		String list[] = AHC.getMethods(); 
+		String methods[][] = new String[list.length][2];
+		for(int i = 0 ; i < list.length ; i++)
+			methods[i][0] = methods[i][1] = list[i];
+				
+		ComboFieldEditor method = new ComboFieldEditor(AHCPreferences.METHOD, AHCUIMessages.CAHPreferencePage_3, methods, getFieldEditorParent());
+		addField(method);
+
+		list = AHC.getMetrics(); 
+		String metrics[][] = new String[list.length][2];
+		for(int i = 0 ; i < list.length ; i++)
+			metrics[i][0] = metrics[i][1] = list[i];
+		
+		ComboFieldEditor metric = new ComboFieldEditor(AHCPreferences.METRIC, AHCUIMessages.CAHPreferencePage_4, metrics, getFieldEditorParent());
+		addField(metric);
+		
+		
+		// Charts
+		Composite chartsTab = SWTChartsComponentsProvider.createChartsRenderingPreferencesTabFolderComposite(getFieldEditorParent());
+
+		String[][] labelAndValues = {{"2D", "true"}, {"3D", "false"}}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+		RadioGroupFieldEditor default2D3Ddisplay = new RadioGroupFieldEditor(AHCPreferences.DISPLAY_2D, AHCUIMessages.CAHPreferencePage_0, 2, labelAndValues, chartsTab);
+		addField(default2D3Ddisplay);
+		
+		
+		// other shared preferences
+		SWTChartsComponentsProvider.createChartsRenderingPreferencesFields(this, chartsTab);
+	}
+
+	@Override
+	public void init(IWorkbench workbench) {
+		this.setPreferenceStore(new TXMPreferenceStore(AHCPreferences.PREFERENCES_NODE));
+		//setDescription("AHC");
+		this.setTitle(AHCCoreMessages.RESULT_TYPE);
+		this.setImageDescriptor(AHCAdapterFactory.ICON);
+	}
+
+}

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

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

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

Index: tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/messages/CAHUIMessages.java
===================================================================
--- tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/messages/CAHUIMessages.java	(revision 527)
+++ tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/messages/CAHUIMessages.java	(revision 528)
@@ -1,39 +0,0 @@
-package org.txm.cah.rcp.messages;
-
-import org.eclipse.osgi.util.NLS;
-import org.txm.utils.messages.Utf8NLS;
-
-public class CAHUIMessages extends NLS {
-
-	private static final String BUNDLE_NAME = "org.txm.cah.rcp.messages.messages"; //$NON-NLS-1$
-	
-	
-	public static String CAHPreferencePage_0;
-	public static String CAHPreferencePage_2;
-	public static String CAHPreferencePage_3;
-	public static String CAHPreferencePage_4;
-	
-	public static String ComputeCAH_0;
-	
-	//FIXME: these keys/values are not used, remove or use them?
-	public static String ComputeCAH_1;
-	public static String ComputeCAH_2;
-	public static String ComputeCAH_3;
-	public static String ComputeCAH_5;
-	public static String ComputeCAH_6;
-	// end of fixme
-	
-	public static String COMPUTE_COLUMNS;
-	public static String COMPUTE_ROWS;
-	
-	public static String CHART_TOOLBAR_BUTTON_NUMBER_OF_CLUSTERS;
-	
-	static {
-		// initializes resource bundle
-		Utf8NLS.initializeMessages(BUNDLE_NAME, CAHUIMessages.class);
-	}
-	
-	private CAHUIMessages() {
-		//no instantiation
-	}
-}
Index: tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/messages/AHCUIMessages.java
===================================================================
--- tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/messages/AHCUIMessages.java	(revision 0)
+++ tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/messages/AHCUIMessages.java	(revision 528)
@@ -0,0 +1,39 @@
+package org.txm.cah.rcp.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+public class AHCUIMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.cah.rcp.messages.messages"; //$NON-NLS-1$
+	
+	
+	public static String CAHPreferencePage_0;
+	public static String CAHPreferencePage_2;
+	public static String CAHPreferencePage_3;
+	public static String CAHPreferencePage_4;
+	
+	public static String ComputeCAH_0;
+	
+	//FIXME: these keys/values are not used, remove or use them?
+	public static String ComputeCAH_1;
+	public static String ComputeCAH_2;
+	public static String ComputeCAH_3;
+	public static String ComputeCAH_5;
+	public static String ComputeCAH_6;
+	// end of fixme
+	
+	public static String COMPUTE_COLUMNS;
+	public static String COMPUTE_ROWS;
+	
+	public static String CHART_TOOLBAR_BUTTON_NUMBER_OF_CLUSTERS;
+	
+	static {
+		// initializes resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, AHCUIMessages.class);
+	}
+	
+	private AHCUIMessages() {
+		//no instantiation
+	}
+}

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

Index: tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/CAHChartEditor.java
===================================================================
--- tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/CAHChartEditor.java	(revision 527)
+++ tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/CAHChartEditor.java	(revision 528)
@@ -1,242 +0,0 @@
-package org.txm.cah.rcp.editors;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Spinner;
-import org.eclipse.swt.widgets.ToolItem;
-import org.txm.cah.core.functions.CAH;
-import org.txm.cah.core.messages.CAHCoreMessages;
-import org.txm.cah.core.preferences.CAHPreferences;
-import org.txm.cah.rcp.messages.CAHUIMessages;
-import org.txm.chartsengine.rcp.editors.ChartEditorPart;
-import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
-import org.txm.rcp.IImageKeys;
-import org.txm.rcp.JobsTimer;
-import org.txm.rcp.utils.JobHandler;
-import org.txm.rcp.views.QueriesView;
-import org.txm.statsengine.r.rcp.views.RVariablesView;
-import org.txm.utils.logger.Log;
-
-/**
- * CAH chart editor.
- * 
- * @author mdecorde
- * @author sjacquot
- *
- */
-public class CAHChartEditor extends ChartEditorPart {
-
-	/**
-	 * Numbers of clusters.
-	 */
-	protected Spinner numbersOfClusters;
-
-
-
-	@Override
-	public void createPartControl(Composite parent) {
-
-		super.createPartControl(parent);
-
-		// Extend the chart editor tool bar
-		ToolItem separator = new ToolItem(this.topToolBar, SWT.SEPARATOR);
-
-		// Number of clusters
-		ToolItem itemSeparator = new ToolItem(this.topToolBar, SWT.SEPARATOR);
-	    CLabel clustersLabel = new CLabel(this.topToolBar, SWT.CENTER);
-		clustersLabel.setText(CAHUIMessages.CHART_TOOLBAR_BUTTON_NUMBER_OF_CLUSTERS);
-		clustersLabel.pack();
-		itemSeparator.setWidth(clustersLabel.getBounds().width);
-	    itemSeparator.setControl(clustersLabel);
-
-	    itemSeparator = new ToolItem(this.topToolBar, SWT.SEPARATOR);
-	    this.numbersOfClusters = new Spinner(this.topToolBar, SWT.BORDER);
-	    this.numbersOfClusters.setMinimum(2);
-	    this.numbersOfClusters.setIncrement(1);
-
-		itemSeparator.setControl(this.numbersOfClusters);
-		this.numbersOfClusters.pack();
-		itemSeparator.setWidth(this.numbersOfClusters.getBounds().width);
-
-
-		// Columns
-		final ToolItem computeColumns = new ToolItem(this.topToolBar, SWT.RADIO);
-		computeColumns.setToolTipText(CAHUIMessages.COMPUTE_COLUMNS);
-		computeColumns.setImage(IImageKeys.getImage(CAHChartEditor.class, "icons/compute_columns.png")); //$NON-NLS-1$
-		// FIXME: keep this for offering an option "large icons" with text in buttons ?
-		//computeColumns.setText(CAUIPMessages.ComputeClassification_5);
-		computeColumns.setSelection(this.getBooleanParameterValue(CAHPreferences.COLUMNS_COMPUTING));
-
-		// Rows
-		final ToolItem computeRows = new ToolItem(this.topToolBar, SWT.RADIO);
-		computeRows.setToolTipText(CAHUIMessages.COMPUTE_ROWS);
-		computeRows.setImage(IImageKeys.getImage(CAHChartEditor.class, "icons/compute_rows.png")); //$NON-NLS-1$
-		// FIXME: keep this for offering an option "large icons" with text in buttons ?
-		//computeRows.setText(CAUIPMessages.ComputeClassification_6);
-		computeRows.setSelection(!this.getBooleanParameterValue(CAHPreferences.COLUMNS_COMPUTING));
-
-		
-		// 2D/3D
-		final Combo displayCombo = new Combo(this.topToolBar, SWT.READ_ONLY);
-		String items[] = { "2D", "3D" }; //$NON-NLS-1$ //$NON-NLS-2$
-		displayCombo.setItems(items);
-		if(this.getBooleanParameterValue(CAHPreferences.DISPLAY_2D))	{
-			displayCombo.select(0);
-		}
-		else	{
-			displayCombo.select(1);
-		}
-		
-		ToolItem comboItem = new ToolItem(this.topToolBar, SWT.SEPARATOR);
-		comboItem.setControl(displayCombo);
-		displayCombo.pack();
-		comboItem.setWidth(displayCombo.getBounds().width);
-		
-		// Listeners
-		SelectionListener listener = new SelectionListener() {
-			
-			@Override
-			public void widgetSelected(SelectionEvent e) {
-				CAH cah = getResultData();
-
-				// Numbers of clusters
-				if(e.getSource() == numbersOfClusters)	{
-					
-					cah.setNCluster(((Spinner)e.getSource()).getSelection());
-				}
-				// Compute columns or rows
-				else if(e.getSource() == computeColumns || e.getSource() == computeRows)	{
-					
-					// cancel the event if nothing has changed
-//					if(e.getSource() == computeColumns && computeColumns.getSelection()
-//							|| e.getSource() == computeRows && computeRows.getSelection())	{
-//						return;
-//					}
-					
-					cah.setColumnsComputing(computeColumns.getSelection());
-					
-					// reset the number of clusters
-					cah.setNCluster(TXMPreferences.getInt(CAHPreferences.N_CLUSTERS, CAHPreferences.PREFERENCES_NODE));
-
-					updateNumbersOfClustersCurrentValue();
-					// Update the maximum value of the number of clusters spinner according to the new CAH configuration 
-					updateNumbersOfClustersMaxValue();
-				}
-				else if(e.getSource() == displayCombo)	{
-					TXMPreferences.putLocalBoolean(cah, CAHPreferences.DISPLAY_2D, (displayCombo.getSelectionIndex() == 0));
-				}
-				
-				
-				// Recompute the CAH and the chart
-				computeResult(true);
-			}
-			
-			@Override
-			public void widgetDefaultSelected(SelectionEvent e) {
-				// TODO Auto-generated method stub
-				
-			}
-		};
-		
-		this.numbersOfClusters.addSelectionListener(listener);
-		computeColumns.addSelectionListener(listener);
-		displayCombo.addSelectionListener(listener);
-		
-		this.computeResult(false);
-		
-		
-
-	}
-
-
-	/**
-	 * Computes the result and the chart.
-	 * @param update
-	 */
-	public void computeResult(final boolean update)	{
-		
-		JobHandler jobhandler = new JobHandler(CAHCoreMessages.LOG_COMPUTE_CAH) {
-			@Override
-			protected IStatus run(IProgressMonitor monitor) {
-				this.runInit(monitor);
-				try {
-
-					this.acquireSemaphore();
-					getResultData().compute(this);
-					this.releaseSemaphore();
-
-					if(!update)	{
-
-						getResultData().getCA().addResult(getResultData());
-						
-						// Refresh views
-						this.syncExec(new Runnable() {
-							@Override
-							public void run() {
-								
-							    updateNumbersOfClustersMaxValue();
-							    updateNumbersOfClustersCurrentValue();
-
-								QueriesView.refresh();
-								RVariablesView.refresh();
-							}
-						});
-					
-						
-					}
-					
-					computeChart(update);
-					
-				}
-				// for user direct canceling
-				catch (ThreadDeath td) {
-					return Status.CANCEL_STATUS;
-				}
-				catch (Exception e) {
-					System.out.println(e.getLocalizedMessage());
-					org.txm.rcp.utils.Logger.printStackTrace(e);
-					Log.severe("Error while computing CAH: " + e.getLocalizedMessage());
-				}
-				finally {
-					monitor.done();
-					JobsTimer.stopAndPrint();
-				}
-				return Status.OK_STATUS;
-			}
-		};
-		jobhandler.startJob();
-	}
-	
-	
-	
-	
-	/**
-	 * Updates the maximum value of the number of clusters spinner according to the CAH configuration.
-	 */
-	public void updateNumbersOfClustersMaxValue()	{
-		int max = this.getResultData().getMaxClustersCount();
-		this.numbersOfClusters.setMaximum(max);
-	}
-
-	/**
-	 * Updates the current value of the number of clusters spinner.
-	 */
-	public void updateNumbersOfClustersCurrentValue()	{
-		this.numbersOfClusters.setSelection(TXMPreferences.getInt(CAHPreferences.PREFERENCES_NODE, this.getResultData(), CAHPreferences.N_CLUSTERS));
-	}
-
-	@Override
-	public CAH getResultData() {
-		return (CAH) super.getResultData();
-	}
-}
Index: tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/AHCChartEditor.java
===================================================================
--- tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/AHCChartEditor.java	(revision 0)
+++ tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/AHCChartEditor.java	(revision 528)
@@ -0,0 +1,242 @@
+package org.txm.cah.rcp.editors;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Spinner;
+import org.eclipse.swt.widgets.ToolItem;
+import org.txm.cah.core.functions.AHC;
+import org.txm.cah.core.messages.AHCCoreMessages;
+import org.txm.cah.core.preferences.AHCPreferences;
+import org.txm.cah.rcp.messages.AHCUIMessages;
+import org.txm.chartsengine.rcp.editors.ChartEditorPart;
+import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.rcp.IImageKeys;
+import org.txm.rcp.JobsTimer;
+import org.txm.rcp.utils.JobHandler;
+import org.txm.rcp.views.QueriesView;
+import org.txm.statsengine.r.rcp.views.RVariablesView;
+import org.txm.utils.logger.Log;
+
+/**
+ * CAH chart editor.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class AHCChartEditor extends ChartEditorPart {
+
+	/**
+	 * Numbers of clusters.
+	 */
+	protected Spinner numbersOfClusters;
+
+
+
+	@Override
+	public void createPartControl(Composite parent) {
+
+		super.createPartControl(parent);
+
+		// Extend the chart editor tool bar
+		ToolItem separator = new ToolItem(this.topToolBar, SWT.SEPARATOR);
+
+		// Number of clusters
+		ToolItem itemSeparator = new ToolItem(this.topToolBar, SWT.SEPARATOR);
+	    CLabel clustersLabel = new CLabel(this.topToolBar, SWT.CENTER);
+		clustersLabel.setText(AHCUIMessages.CHART_TOOLBAR_BUTTON_NUMBER_OF_CLUSTERS);
+		clustersLabel.pack();
+		itemSeparator.setWidth(clustersLabel.getBounds().width);
+	    itemSeparator.setControl(clustersLabel);
+
+	    itemSeparator = new ToolItem(this.topToolBar, SWT.SEPARATOR);
+	    this.numbersOfClusters = new Spinner(this.topToolBar, SWT.BORDER);
+	    this.numbersOfClusters.setMinimum(2);
+	    this.numbersOfClusters.setIncrement(1);
+
+		itemSeparator.setControl(this.numbersOfClusters);
+		this.numbersOfClusters.pack();
+		itemSeparator.setWidth(this.numbersOfClusters.getBounds().width);
+
+
+		// Columns
+		final ToolItem computeColumns = new ToolItem(this.topToolBar, SWT.RADIO);
+		computeColumns.setToolTipText(AHCUIMessages.COMPUTE_COLUMNS);
+		computeColumns.setImage(IImageKeys.getImage(AHCChartEditor.class, "icons/compute_columns.png")); //$NON-NLS-1$
+		// FIXME: keep this for offering an option "large icons" with text in buttons ?
+		//computeColumns.setText(CAUIPMessages.ComputeClassification_5);
+		computeColumns.setSelection(this.getBooleanParameterValue(AHCPreferences.COLUMNS_COMPUTING));
+
+		// Rows
+		final ToolItem computeRows = new ToolItem(this.topToolBar, SWT.RADIO);
+		computeRows.setToolTipText(AHCUIMessages.COMPUTE_ROWS);
+		computeRows.setImage(IImageKeys.getImage(AHCChartEditor.class, "icons/compute_rows.png")); //$NON-NLS-1$
+		// FIXME: keep this for offering an option "large icons" with text in buttons ?
+		//computeRows.setText(CAUIPMessages.ComputeClassification_6);
+		computeRows.setSelection(!this.getBooleanParameterValue(AHCPreferences.COLUMNS_COMPUTING));
+
+		
+		// 2D/3D
+		final Combo displayCombo = new Combo(this.topToolBar, SWT.READ_ONLY);
+		String items[] = { "2D", "3D" }; //$NON-NLS-1$ //$NON-NLS-2$
+		displayCombo.setItems(items);
+		if(this.getBooleanParameterValue(AHCPreferences.DISPLAY_2D))	{
+			displayCombo.select(0);
+		}
+		else	{
+			displayCombo.select(1);
+		}
+		
+		ToolItem comboItem = new ToolItem(this.topToolBar, SWT.SEPARATOR);
+		comboItem.setControl(displayCombo);
+		displayCombo.pack();
+		comboItem.setWidth(displayCombo.getBounds().width);
+		
+		// Listeners
+		SelectionListener listener = new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				AHC cah = getResultData();
+
+				// Numbers of clusters
+				if(e.getSource() == numbersOfClusters)	{
+					
+					cah.setNCluster(((Spinner)e.getSource()).getSelection());
+				}
+				// Compute columns or rows
+				else if(e.getSource() == computeColumns || e.getSource() == computeRows)	{
+					
+					// cancel the event if nothing has changed
+//					if(e.getSource() == computeColumns && computeColumns.getSelection()
+//							|| e.getSource() == computeRows && computeRows.getSelection())	{
+//						return;
+//					}
+					
+					cah.setColumnsComputing(computeColumns.getSelection());
+					
+					// reset the number of clusters
+					cah.setNCluster(TXMPreferences.getInt(AHCPreferences.N_CLUSTERS, AHCPreferences.PREFERENCES_NODE));
+
+					updateNumbersOfClustersCurrentValue();
+					// Update the maximum value of the number of clusters spinner according to the new CAH configuration 
+					updateNumbersOfClustersMaxValue();
+				}
+				else if(e.getSource() == displayCombo)	{
+					TXMPreferences.putLocalBoolean(cah, AHCPreferences.DISPLAY_2D, (displayCombo.getSelectionIndex() == 0));
+				}
+				
+				
+				// Recompute the CAH and the chart
+				computeResult(true);
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+				// TODO Auto-generated method stub
+				
+			}
+		};
+		
+		this.numbersOfClusters.addSelectionListener(listener);
+		computeColumns.addSelectionListener(listener);
+		displayCombo.addSelectionListener(listener);
+		
+		this.computeResult(false);
+		
+		
+
+	}
+
+
+	/**
+	 * Computes the result and the chart.
+	 * @param update
+	 */
+	public void computeResult(final boolean update)	{
+		
+		JobHandler jobhandler = new JobHandler(AHCCoreMessages.LOG_COMPUTE_CAH) {
+			@Override
+			protected IStatus run(IProgressMonitor monitor) {
+				this.runInit(monitor);
+				try {
+
+					this.acquireSemaphore();
+					getResultData().compute(false, this);
+					this.releaseSemaphore();
+
+					if(!update)	{
+
+						getResultData().getCA().addResult(getResultData());
+						
+						// Refresh views
+						this.syncExec(new Runnable() {
+							@Override
+							public void run() {
+								
+							    updateNumbersOfClustersMaxValue();
+							    updateNumbersOfClustersCurrentValue();
+
+								QueriesView.refresh();
+								RVariablesView.refresh();
+							}
+						});
+					
+						
+					}
+					
+					computeChart(update);
+					
+				}
+				// for user direct canceling
+				catch (ThreadDeath td) {
+					return Status.CANCEL_STATUS;
+				}
+				catch (Exception e) {
+					System.out.println(e.getLocalizedMessage());
+					org.txm.rcp.utils.Logger.printStackTrace(e);
+					Log.severe("Error while computing CAH: " + e.getLocalizedMessage());
+				}
+				finally {
+					monitor.done();
+					JobsTimer.stopAndPrint();
+				}
+				return Status.OK_STATUS;
+			}
+		};
+		jobhandler.startJob();
+	}
+	
+	
+	
+	
+	/**
+	 * Updates the maximum value of the number of clusters spinner according to the CAH configuration.
+	 */
+	public void updateNumbersOfClustersMaxValue()	{
+		int max = this.getResultData().getMaxClustersCount();
+		this.numbersOfClusters.setMaximum(max);
+	}
+
+	/**
+	 * Updates the current value of the number of clusters spinner.
+	 */
+	public void updateNumbersOfClustersCurrentValue()	{
+		this.numbersOfClusters.setSelection(TXMPreferences.getInt(AHCPreferences.PREFERENCES_NODE, this.getResultData(), AHCPreferences.N_CLUSTERS));
+	}
+
+	@Override
+	public AHC getResultData() {
+		return (AHC) super.getResultData();
+	}
+}

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

Index: tmp/org.txm.cah.rcp/plugin.xml
===================================================================
--- tmp/org.txm.cah.rcp/plugin.xml	(revision 527)
+++ tmp/org.txm.cah.rcp/plugin.xml	(revision 528)
@@ -5,7 +5,7 @@
          point="org.eclipse.ui.commands">
       <command
             categoryId="org.txm.rcp.category.txm"
-            defaultHandler="org.txm.cah.rcp.handlers.ComputeCAH"
+            defaultHandler="org.txm.cah.rcp.handlers.ComputeAHC"
             id="org.txm.cah.rcp.handlers.ComputeCAH"
             name="%command.name">
       </command>
@@ -85,7 +85,7 @@
    <extension
          point="org.eclipse.ui.editors">
       <editor
-            class="org.txm.cah.rcp.editors.CAHChartEditor"
+            class="org.txm.cah.rcp.editors.AHCChartEditor"
             default="false"
             icon="icons/cah.png"
             id="org.txm.cah.core.functions.CAH"
@@ -96,7 +96,7 @@
          point="org.eclipse.core.runtime.adapters">
       <factory
             adaptableType="org.txm.cah.core.functions.CAH"
-            class="org.txm.cah.rcp.adapters.CAHAdapterFactory">
+            class="org.txm.cah.rcp.adapters.AHCAdapterFactory">
          <adapter
                type="org.eclipse.ui.model.IWorkbenchAdapter">
          </adapter>
@@ -106,7 +106,7 @@
          point="org.eclipse.ui.preferencePages">
       <page
             category="org.txm.rcp.preferences.UserPreferencePage"
-            class="org.txm.cah.rcp.preferences.CAHPreferencePage"
+            class="org.txm.cah.rcp.preferences.AHCPreferencePage"
             id="org.txm.cah.rcp.preferences.CAHPreferencePage"
             name="%page.name">
       </page>
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java	(revision 527)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java	(revision 528)
@@ -64,6 +64,12 @@
 
 	private Composite topToolBarContainer;
 	
+	/**
+	 * State value to create or not the computing parameters area and tool bar button.
+	 */
+	protected boolean createComputingParametersArea = true;
+	
+	
 	@Override
 	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
 		this.setSite(site);
@@ -75,42 +81,60 @@
 	}
 	
 	/**
-	 * Creates the default toolbar (empty) and default result area (empty)
+	 * Creates the default toolbar (empty) and default result area (empty).
 	 * 
 	 */
 	@Override
 	public void createPartControl(Composite parent) {
 		
-		this.parent = parent;
-		
-		// to hide and display the command parameters composite
-		this.initParentLayout(parent, 1);
+		try {
+			this.parent = parent;
+			
+			// to hide and display the command parameters composite
+			this.initParentLayout(parent, 1);
 
-		// create the top tool bar
-		topToolBarContainer = new Composite(parent, SWT.NONE);
-		topToolBarContainer.setLayoutData(new GridData(GridData.FILL,GridData.FILL,true, false));
-		
-		RowLayout rl = new RowLayout(SWT.HORIZONTAL);
-		rl.marginTop = rl.marginHeight = rl.marginWidth = rl.marginBottom = 0;
-		topToolBarContainer.setLayout(rl);
-		
-		this.topToolBar = new TXMEditorToolBar(topToolBarContainer, SWT.FLAT | SWT.RIGHT, "top", this);
-		
-		parametersGroupsComposite = new Composite(parent, SWT.NONE);
-		GridLayout gl = new GridLayout(1, true);
-		gl.marginBottom = gl.marginHeight = gl.marginWidth = gl.marginTop = 0;
-		parametersGroupsComposite.setLayout(gl);
-		if (parent.getLayout() instanceof GridLayout)
-		parametersGroupsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
-		
-		computingParametersGroup = topToolBar.installGroup("Computing parameters", "Show/Hide command parameters", "icons/show_computing_parameters.png");
-		topToolBar.setVisible(computingParametersGroup, true);
-		
-		displayArea = new Composite(parent, SWT.NONE);
-		displayArea.setLayoutData(new GridData(GridData.FILL_BOTH));
-		
-		// bottom tool bar
-		this.bottomToolBar = new TXMEditorToolBar(parent, SWT.FLAT, "bottom", this);
+			// create the top tool bar
+			this.topToolBarContainer = new Composite(parent, SWT.NONE);
+			this.topToolBarContainer.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+			
+			RowLayout rl = new RowLayout(SWT.HORIZONTAL);
+			rl.marginTop = rl.marginHeight = rl.marginWidth = rl.marginBottom = 0;
+			this.topToolBarContainer.setLayout(rl);
+			
+			this.topToolBar = new TXMEditorToolBar(this.topToolBarContainer, SWT.FLAT | SWT.RIGHT, "top", this);
+			
+			
+			this.parametersGroupsComposite = new Composite(parent, SWT.NONE);
+			GridLayout gl = new GridLayout(1, true);
+			gl.marginBottom = gl.marginHeight = gl.marginWidth = gl.marginTop = 0;
+			this.parametersGroupsComposite.setLayout(gl);
+			if (parent.getLayout() instanceof GridLayout)	{
+				this.parametersGroupsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
+			}
+
+			// computing parameters components
+			if(this.createComputingParametersArea)	{
+				// only show the area if the result can not compute and is dirty
+				boolean showComputingParameters = false; 
+				if(this.getResultData().isDirty() && !this.getResultData().canCompute())	{
+					showComputingParameters = true;
+				}
+				this.computingParametersGroup = topToolBar.installGroup("Computing parameters", "Show/Hide command parameters", "icons/show_computing_parameters.png", showComputingParameters);
+			}
+			
+
+			// display main area
+			this.displayArea = new Composite(parent, SWT.NONE);
+			this.displayArea.setLayoutData(new GridData(GridData.FILL_BOTH));
+			
+			
+			// bottom tool bar
+			this.bottomToolBar = new TXMEditorToolBar(parent, SWT.FLAT, "bottom", this);
+		}
+		catch(Exception e) {
+			System.err.println("TXMEditorPart.createPartControl(): can not create the editor.");
+			e.printStackTrace();
+		}
 	}
 	
 	public Composite getTopToolBarContainer() {
@@ -280,7 +304,7 @@
 
 						result.setParameters(parameters);
 
-						if (result.validateParameters() && result.isDirty()) {
+						if (result.canCompute() && result.isDirty()) {
 
 							String title = "";//result.getComputingMessage();
 							System.out.println(title);
@@ -357,7 +381,7 @@
 				this.setPartName(this.getResultData().getName());
 			}
 		} catch(Exception e) {
-			System.out.println("Error while refreshing editor content: "+e.getLocalizedMessage());
+			System.out.println("Error while refreshing editor content: " + e.getLocalizedMessage());
 		}
 	}
 	
@@ -369,7 +393,7 @@
 		try {
 			return this.getEditorInput().deleteResult();
 		} catch(Exception e) {
-			System.out.println("Error: could not delete result: "+e.getLocalizedMessage());
+			System.out.println("Error: could not delete result: " + e.getLocalizedMessage());
 			return false;
 		}
 	}
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java	(revision 527)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorToolBar.java	(revision 528)
@@ -40,10 +40,10 @@
 	 * 
 	 * @param parent
 	 * @param style
-	 * @param toolbar_local_id
+	 * @param toolbarLocalId
 	 * @param resultEditorPart
 	 */
-	public TXMEditorToolBar(Composite parent, int style, String toolbar_local_id, TXMEditorPart resultEditorPart) {
+	public TXMEditorToolBar(Composite parent, int style, String toolbarLocalId, TXMEditorPart resultEditorPart) {
 		super(parent, style);
 
 		this.editorPart = resultEditorPart;
@@ -51,7 +51,7 @@
 		// permit to contribute via plugin.xml menu extension
 		ToolBarManager manager = new ToolBarManager(this);
 		IMenuService menuService = (IMenuService) this.editorPart.getSite().getService(IMenuService.class);
-		menuService.populateContributionManager(manager, "toolbar:" + toolbar_local_id); //$NON-NLS-1$
+		menuService.populateContributionManager(manager, "toolbar:" + toolbarLocalId); //$NON-NLS-1$
 	}
 
 	@Override
@@ -91,7 +91,7 @@
 	 * @param iconFilePath
 	 * @return
 	 */
-	public Group installGroup(String groupTitle, String buttonToolTip, String iconFilePath)	{
+	public Group installGroup(String groupTitle, String buttonToolTip, String iconFilePath, boolean showGroup)	{
 
 		if (groups.containsKey(groupTitle)) {
 			return groups.get(groupTitle);
@@ -117,15 +117,20 @@
 		// add finally a button to the toolbar to show/hide the Group
 		final ToolItem showParameters = new ToolItem(this, SWT.CHECK | SWT.LEFT);
 		
-		if (iconFilePath != null)
+		if (iconFilePath != null)	{
 			showParameters.setImage(IImageKeys.getImage(iconFilePath));
-		else // if no icon specified, show the group title in the toolitem
+		}
+		// if no icon specified, show the group title in the toolitem
+		else	{
 			showParameters.setText(groupTitle);
+		}
 		
-		if (buttonToolTip != null)
+		if (buttonToolTip != null)	{
 			showParameters.setToolTipText(buttonToolTip);
+		}
 		
-		showParameters.setSelection(false);
+		showParameters.setSelection(showGroup);
+		this.setVisible(group, showGroup);
 		
 		showParameters.addSelectionListener(new SelectionListener() {
 			
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java	(revision 527)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java	(revision 528)
@@ -234,11 +234,11 @@
 				
 				StatusLine.setMessage(mess);
 				// FIXME: Debug:
-				//					System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): ********************************************************************************");
-				//					System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): selected object = " + selectedItem);
-				//					System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): selection full path name = " + ((TXMResult)selectedItem).getFullPathSimpleName() + " - " + ((TXMResult)selectedItem).getName());
-				//					System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): direct children count = " + ((TXMResult)selectedItem).getResults().size());
-				//					System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): direct visible children count = " + ((TXMResult)selectedItem).getResults(true).size());
+				System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): ********************************************************************************");
+				System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): selected object = " + selectedItem);
+				System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): selection full path name = " + ((TXMResult)selectedItem).getFullPathSimpleName() + " - " + ((TXMResult)selectedItem).getName());
+				System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): direct children count = " + ((TXMResult)selectedItem).getResults().size());
+				System.err.println("CorporaView.createPartControl(...).new SelectionListener() {...}.widgetSelected(): direct visible children count = " + ((TXMResult)selectedItem).getResults(true).size());
 			}
 
 			@Override
@@ -450,7 +450,7 @@
 	}
 
 	/**
-	 * Refresh.
+	 * Refreshes the view and the tree.
 	 *
 	 * @param corporaView the corpora view
 	 */
@@ -470,9 +470,9 @@
 			public void run() {
 
 				//FIXME: Debug
-				//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): refreshing node " + result);
-				//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): direct parent " + result.getParent());
-				//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): path " + result.getFullPathSimpleName());
+//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): refreshing node " + result);
+//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): direct parent " + result.getParent());
+//				System.err.println("CorporaView.refreshObject(...).new Runnable() {...}.run(): path " + result.getFullPathSimpleName());
 
 				CorporaView corporaView = getInstance();
 				corporaView.treeViewer.refresh(); // FIXME: without that the refresh sometimes doesn't work, need to investigate
@@ -521,7 +521,7 @@
 			Log.warning("The "+managedDoubleClickClasses+" class is already managed by the Corpora view.");
 			return;
 		}
-		//TODO: this won't works if the ComputeXXX commands is not called -> we can't do lazy load
+		//FIXME: this won't works if the ComputeXXX commands is not called -> we can't do lazy load
 		managedDoubleClickClasses.put(resultDataClass, commandClass);
 	}
 }
Index: tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RestartTXM.java
===================================================================
--- tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RestartTXM.java	(revision 527)
+++ tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/RestartTXM.java	(revision 528)
@@ -37,7 +37,6 @@
 import org.txm.Toolbox;
 import org.txm.rcp.JobsTimer;
 import org.txm.rcp.RCPMessages;
-import org.txm.rcp.TxmPreferences;
 import org.txm.rcp.utils.JobHandler;
 import org.txm.rcp.views.SummaryView;
 import org.txm.rcp.views.fileexplorer.MacroExplorer;
Index: tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/editors/WordCloudEditor.java
===================================================================
--- tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/editors/WordCloudEditor.java	(revision 527)
+++ tmp/org.txm.wordcloud.rcp/src/org/txm/wordcloud/rcp/editors/WordCloudEditor.java	(revision 528)
@@ -119,7 +119,7 @@
 	@Override
 	public void computeResult() {
 		try {
-			((TXMResult) this.getResultData()).compute();
+			((TXMResult) this.getResultData()).compute(false);
 		} catch (Exception e) {
 			System.out.println("Error: "+e.getLocalizedMessage());
 			Log.printStackTrace(e);
Index: tmp/org.txm.core/src/java/org/txm/functions/CommandsAPI.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/functions/CommandsAPI.java	(revision 527)
+++ tmp/org.txm.core/src/java/org/txm/functions/CommandsAPI.java	(revision 528)
@@ -96,8 +96,8 @@
 				System.out.println("Computing "+command.cmd+"...");
 				result = command.clazz.newInstance();
 				result.setParameters(parameters);
-				if (result.validateParameters())
-					result.compute();
+				if (result.canCompute())
+					result.compute(false);
 				//FIXME: debug
 				System.out.println(result);
 			} else {
Index: tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 527)
+++ tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java	(revision 528)
@@ -893,7 +893,7 @@
 		try {
 			System.err.println("TXMPreferences.flush(): Local preferences for object " + result.getUUID() + " saved to file.");
 			// FIXME: useless?
-			//scope.getNode(getId(result)).sync();
+			//scope.getNode(result.getUUID()).sync();
 			scope.getNode(result.getUUID()).flush();
 		}
 		catch(BackingStoreException e) {
@@ -1046,7 +1046,7 @@
 	}
 
 	/**
-	 * Stores the specified parameters pairs of key / value in a local node dedicated to the specified result. The node qualifier is generated by the <code>Object.toString()</code> method.
+	 * Stores the specified parameters pairs of key/value in a local node dedicated to the specified result. The node qualifier is generated by the <code>TXMResult.getUUID</code> method.
 	 * @param result
 	 * @param key
 	 * @param value
@@ -1071,12 +1071,13 @@
 		else if (Boolean.class.isInstance(value))	{
 			putLocalBoolean(result, key, (Boolean) value);
 		}
+		// FIXME: to do
 		//		else if (Serializable.class.isInstance(value))	{
 		//			putLocalSerializable(result, key, (Serializable) value);
-		//		} else {
-		//			//FIXME: Debug
-		//			System.err.println("TXMPreferences.putLocal(): error, can't find a put method that matches the value type: " + value.getClass() + "="+value+".");
-		//		}
+		else {
+					//FIXME: Debug
+					System.err.println("TXMPreferences.putLocal(): error, can't find a put method that matches the value type: " + value.getClass() + "=" + value + ".");
+				}
 	}
 
 	private static void putLocalSerializable(TXMResult result, String key, Serializable value) {
@@ -1084,6 +1085,27 @@
 		scope.getNode(result.getUUID()).putByteArray(key, b);
 	}
 
+	/**
+	 * Clones nodes. Creates a local node for the destination result and copy it all the source result parameters.
+	 * @param srcResult
+	 * @param dstResult
+	 */
+	public static void cloneNode(TXMResult srcResult, TXMResult dstResult)	{
+		IEclipsePreferences preferences = scope.getNode(srcResult.getUUID());
+		if(preferences != null)	{
+			try {
+				String[] keys = preferences.keys();
+				for(int i = 0; i < keys.length; i++) {
+					putLocal(dstResult, keys[i], preferences.get(keys[i], ""));
+				}
+			}
+			catch(BackingStoreException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+	
 	//FIXME: this code is dedicated to dynamically retrieve the static field PREFERENCES_NODE of the runtime subclass and use it super class to avoid to pass it to all methods.
 	// eg. to use ProgressionPreferences.getBoolean("test") instead of TXMPreferences.getBoolean(ProgressionPreferences.PREFERENCES_NODE, "test")
 	// but it doesn"t work, need to continue the tests...
Index: tmp/org.txm.core/src/java/org/txm/core/preferences/___CorpusScope.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/preferences/___CorpusScope.java	(revision 0)
+++ tmp/org.txm.core/src/java/org/txm/core/preferences/___CorpusScope.java	(revision 528)
@@ -0,0 +1,113 @@
+/**
+ * 
+ */
+package org.txm.core.preferences;
+
+import java.io.File;
+import java.util.HashMap;
+
+import org.eclipse.core.internal.preferences.AbstractScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.osgi.service.prefs.BackingStoreException;
+import org.osgi.service.prefs.Preferences;
+
+/**
+ * Tests to save the results and corpus parameters in the binary corpus path.
+ * Temporary, in future we'll need to use ProjectScope + IProject + Eclipse Workspace. 
+ * @author sjacquot
+ *
+ */
+//FIXME: Temporary, in future we'll need to use ProjectScope + IProject + Eclipse Workspace.
+public class ___CorpusScope extends AbstractScope {
+
+	/**
+	 * Project scopes.
+	 */
+	public static HashMap<String, ___CorpusScope> projectScopes = new HashMap<String, ___CorpusScope>(); 
+		
+	/**
+	 * Scope name.
+	 */
+	protected String name;
+	
+	/**
+	 * Location.
+	 */
+	protected IPath location;
+			
+	/**
+	 * 
+	 * @param name
+	 * @param location
+	 */
+	public ___CorpusScope(String name, File location) {
+		super();
+		this.name = name;
+		this.location = new Path(location.getAbsolutePath() + "/");
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.internal.preferences.AbstractScope#getName()
+	 */
+	@Override
+	public String getName() {
+		return this.name;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.core.internal.preferences.AbstractScope#getLocation()
+	 */
+	@Override
+	public IPath getLocation() {
+		return this.location;
+	}
+
+	
+	/**
+	 * 
+	 * @param scope
+	 */
+	@SuppressWarnings("restriction")
+	public static void addScope(___CorpusScope scope)	{
+		
+		projectScopes.put(scope.getName(), scope);
+		
+		Preferences prefs = scope.getNode("import"); 
+		prefs.put("test", "value");
+		System.err.println("CorpusScope.addScope(): " + prefs.absolutePath());
+		System.err.println("CorpusScope.addScope(): test = " + prefs.get("test", "default value"));
+		try {
+			//prefs.sync();
+			prefs.flush();
+		}
+		catch(BackingStoreException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+		System.err.println("CorpusScope.addScope(): default scope location: " + ConfigurationScope.INSTANCE.getLocation());
+		System.err.println("CorpusScope.addScope(): workspace location: " + ResourcesPlugin.getWorkspace().getRoot().getLocation().toString());
+		System.out.println("CorpusScope.addScope(): add scope " + scope.getName() + " - " + scope.getLocation());
+	}
+	
+	/**
+	 * 
+	 * @param scope
+	 */
+	public static void removeScope(String name)	{
+		projectScopes.remove(name);
+	}
+	
+	/**
+	 * 
+	 * @param name
+	 * @return
+	 */
+	public static ___CorpusScope getScope(String name)	{
+		return projectScopes.get(name);
+	}
+	
+}

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

Index: tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 527)
+++ tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java	(revision 528)
@@ -20,7 +20,7 @@
 
 /**
  * Root class of all TXM results.
- * This class contains methods to get some different version of the name of the result and some additional computing information.
+ * This class contains methods to get some different versions of the name of the result and some additional computing information.
  * It also contains methods to manage a tree hierarchy of result nodes.
  * 
  * @author mdecorde
@@ -47,16 +47,7 @@
 	 */
 	protected boolean dirty = true;
 
-	public boolean isDirty() { return dirty;}
-	
 	/**
-	 * Mark the result has dirty so editors or others will know to recompute the TXMResult
-	 */
-	public void setDirty() {
-		dirty = true;
-	}
-
-	/**
 	 * The result Parent. should not be null except for roots TXMResult
 	 */
 	protected TXMResult parent;
@@ -78,7 +69,23 @@
 	 */
 	protected String preferencesNodeQualifier;
 
+	
 	/**
+	 * If set, allows the command to notify its progress.
+	 */
+	protected IProgressMonitor monitor;
+	/**
+	 * 
+	 */
+	private Semaphore progressSemaphore = new Semaphore(1);
+	
+	/**
+	 * This variable ensure the TXMResult class constructor has been called
+	 */
+	private boolean constructorCalled;
+	
+	
+	/**
 	 * Creates a new TXMResult, child of the specified parent.
 	 * @param parent
 	 */
@@ -86,31 +93,17 @@
 		this(parent, null);
 	}
 	
-	public boolean hasResults() {
-		return children.size() > 0;
-	}
 	
 	/**
-	 * 
+	 * Creates a new TXMResult, child of the specified parent.
 	 * @param parent
-	 * @return true this object is connected to the parent
-	 */
-	public boolean isUsingParent(TXMResult parent) {
-		if (this == parent) return true;
-		else if (this.parent == null) return false;
-		else return this.parent.isUsingParent(parent);
-	}
-
-	/**
-	 * 
-	 * @param parent
 	 * @param parameters
 	 */
 	public TXMResult(TXMResult parent, TXMParameters parameters) {
 
 		// FIXME: discuss about this method and validate it. Also discuss about a getInternalName() method that should also return an unique ID.
 		this.parent = parent;
-		this.uniqueID = this.getClass().getName() + '@' + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID();
+		this.createUUID();
 
 		this.weight = 0;
 		this.visible = true;
@@ -126,12 +119,54 @@
 		//System.out.println("TXMResult.TXMResult(): default preferences node qualifier = " + this.preferencesNodeQualifier + ", class = " + getClass());
 	}
 
+
 	/**
+	 * Creates and stores an UUID dedicated to persistence for this result.
+	 */
+	protected void createUUID()	{
+		this.uniqueID = this.getClass().getName() + '@' + ID_TIME_FORMAT.format(new Date(System.currentTimeMillis())) + "_" + UUID.randomUUID();
+	}
+	
+	
+	public boolean hasResults() {
+		return children.size() > 0;
+	}
+	
+	/**
+	 * Gets the dirty states.
+	 * @return
+	 */
+	public boolean isDirty() {
+		return dirty;
+	}
+	
+	/**
+	 * Marks the result as dirty so editors or others will know the TXMResult needs to be recomputed.
+	 */
+	public void setDirty() {
+		dirty = true;
+	}
+
+
+	
+	
+	/**
+	 * 
+	 * @param parent
+	 * @return true this object is connected to the parent
+	 */
+	public boolean isUsingParent(TXMResult parent) {
+		if (this == parent) return true;
+		else if (this.parent == null) return false;
+		else return this.parent.isUsingParent(parent);
+	}
+
+	/**
 	 * Gets the preferences node qualifier of the result command.
 	 * @return
 	 */
 	public String getPreferencesNodeQualifier() {
-		return preferencesNodeQualifier;
+		return this.preferencesNodeQualifier;
 	}
 	
 	public String[] getParametersKeys() throws BackingStoreException {
@@ -571,7 +606,9 @@
 		TXMResult clone = null;
 		try {
 			clone = (TXMResult) super.clone();
+			clone.createUUID();
 			this.parent.addResult(clone);
+			TXMPreferences.cloneNode(this, clone);
 		}
 		catch(Exception e) {
 		}
@@ -608,7 +645,7 @@
 	 * 
 	 * @return true if parameters are all OK
 	 */
-	public abstract boolean validateParameters() throws Exception;
+	public abstract boolean canCompute() throws Exception;
 
 	public String getSimpleDetails() {
 		String mess = this.getDetails();
@@ -617,17 +654,6 @@
 		return this.toString();
 	}
 	
-	/**
-	 * if set, allows the command to notify its progress
-	 */
-	protected IProgressMonitor monitor;
-	
-	Semaphore progressSemaphore = new Semaphore(1);
-	/**
-	 * This variable ensure the TXMResult class constructor has been called
-	 */
-	private boolean constructorCalled;
-	
 	public void acquireSemaphore() {
 		try {
 			this.progressSemaphore.acquire();
@@ -638,18 +664,20 @@
 	
 	/**
 	 * Computes the result according to specified command parameters.
+	 * @param update TODO
+	 * @param parameters
 	 * 
-	 * @param parameters
 	 * @return
 	 */
-	public boolean compute() throws Exception {
-		return this.compute(null);
+	public boolean compute(boolean update) throws Exception {
+		return this.compute(false, null);
 	}
 	
 	/**
-	 * Computes the result according to stored command parameters.
+	 * Computes the result.
+	 * @param update TODO
+	 * @param watcher
 	 * 
-	 * @param watcher
 	 * @return
 	 * @throws Exception 
 	 * @throws InvalidCqpIdException 
@@ -657,16 +685,49 @@
 	 * @throws CqiClientException 
 	 * @throws IOException 
 	 */
-	public boolean compute(IProgressMonitor monitor) throws Exception {
-		return hasBeenConstructorCalled() && setCurrentMonitor(monitor) && validateParameters() &&  _compute() && saveParameters();
+	public boolean compute(boolean update, IProgressMonitor monitor) throws Exception {
+		
+		this.monitor = monitor;
+		
+		// FIXME: Debug
+		System.err.println("TXMResult.compute(): computing result of type " + this.getClass() + "...");
+
+		
+		if(!hasBeenConstructorCalled())	{
+			return false;
+		}
+
+		if(!canCompute())	{
+			return false;
+		}
+
+		if(!_compute(update))	{
+			return false;
+		}
+
+		if(!saveParameters())	{
+			return false;
+		}
+
+		this.dirty = false;
+
+		
+		// FIXME: Debug
+		System.err.println("TXMResult.compute(): computing done.");
+
+		
+		return true; 
 	}
 	
-	private boolean hasBeenConstructorCalled() {
-		// TODO Auto-generated method stub
-		return constructorCalled;
-	}
+	
 
-	public abstract boolean _compute() throws Exception;
+	/**
+	 * 
+	 * @param update TODO
+	 * @return
+	 * @throws Exception
+	 */
+	protected abstract boolean _compute(boolean update) throws Exception;
 	
 // //removed for now, waiting to see if used
 //	/**
@@ -675,13 +736,28 @@
 //	 * @param parameters
 //	 * @return
 //	 */
-//	public boolean compute(IProgressMonitor watcher, TXMParameters parameters) throws Exception {
+//	public boolean compute(IProgressMonitor monitor, TXMParameters parameters) throws Exception {
 //		this.parameters = parameters;
-//		return this.compute(watcher);
+//		return this.compute(monitor);
 //	}
 	
 	/**
 	 * 
+	 * @return
+	 */
+	private boolean hasBeenConstructorCalled() {
+		// TODO Auto-generated method stub
+		return constructorCalled;
+	}
+
+//	/**
+//	 * Copy the parameters from the local preference node if exists. Also fills the non existent parameters with the command default preferences.
+//	 * @return
+//	 */
+//	public abstract boolean loadParameters();
+	
+	/**
+	 * 
 	 * @return the array of extensions to show in the FileDialog SWT widget
 	 */
 	@Deprecated
@@ -701,14 +777,6 @@
 		return false;
 	}
 	
-	/**
-	 * 
-	 * @return the parent Object that contains this result
-	 */
-	@Deprecated
-	// FIXME: to remove when TXMResult2 will be fully implemented
-	//public abstract HasResults getHasResultsParent();
-	
 	public boolean tryAcquireSemaphore() {
 		return this.progressSemaphore.tryAcquire();
 	}
Index: tmp/org.txm.core/src/java/org/txm/objects/Workspace.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 527)
+++ tmp/org.txm.core/src/java/org/txm/objects/Workspace.java	(revision 528)
@@ -362,13 +362,13 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		// TODO Auto-generated method stub
 		return false;
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		// TODO Auto-generated method stub
 		return false;
 	}
Index: tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java
===================================================================
--- tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java	(revision 527)
+++ tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java	(revision 528)
@@ -266,13 +266,13 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		// TODO Auto-generated method stub
 		return false;
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		// TODO Auto-generated method stub
 		return false;
 	}
Index: tmp/org.txm.core/build.properties
===================================================================
--- tmp/org.txm.core/build.properties	(revision 527)
+++ tmp/org.txm.core/build.properties	(revision 528)
@@ -33,26 +33,8 @@
                lib/sqlite-jdbc-3.8.11.2.jar,\
                lib/postgresql-9.4.1207.jre6.jar,\
                lib/jodconverter-core-3.1-beta.jar,\
-               log4j.properties,\
-               bin/org/txm/functions/mesures/
+               log4j.properties
 output.. = bin/
 source.. = src/java/,\
            res/
-bin.excludes = META-INF/TSTMANIFEST.MF,\
-               bin/org/knallgrau/,\
-               bin/org/kohsuke/,\
-               bin/org/txm/functions/,\
-               bin/org/txm/images/,\
-               bin/org/txm/searchengine/,\
-               bin/org/txm/xml/,\
-               bin/org/txm/css/,\
-               bin/org/txm/annotation/,\
-               bin/org/txm/js/,\
-               bin/org/txm/metadatas/,\
-               bin/org/txm/objects/,\
-               bin/org/txm/package.html,\
-               bin/org/txm/sql/,\
-               bin/org/txm/stat/,\
-               bin/org/txm/tests/,\
-               bin/org/txm/ts/,\
-               bin/org/txm/utils/
+bin.excludes = META-INF/TSTMANIFEST.MF
Index: tmp/org.txm.core/.classpath
===================================================================
--- tmp/org.txm.core/.classpath	(revision 527)
+++ tmp/org.txm.core/.classpath	(revision 528)
@@ -22,8 +22,6 @@
 	<classpathentry exported="true" kind="lib" path="lib/juniversalchardet-1.0.3.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/textcat-1.0.1.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/json-20090211.jar"/>
-	<classpathentry exported="true" kind="lib" path="lib/juh-3.2.1.jar" sourcepath="src/java"/>
-	<classpathentry exported="true" kind="lib" path="lib/jurt-3.2.1.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/ridl-3.2.1.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/unoil-3.2.1.jar"/>
 	<classpathentry exported="true" kind="lib" path="lib/jtidy-r938.jar"/>
Index: tmp/org.txm.core/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.core/META-INF/MANIFEST.MF	(revision 527)
+++ tmp/org.txm.core/META-INF/MANIFEST.MF	(revision 528)
@@ -9,7 +9,8 @@
  org.eclipse.core.runtime;bundle-version="3.10.0";visibility:=reexport,
  org.eclipse.osgi.util;bundle-version="3.2.0";visibility:=reexport,
  org.eclipse.core.net;visibility:=reexport,
- org.eclipse.osgi;visibility:=reexport
+ org.eclipse.osgi;visibility:=reexport,
+ org.eclipse.core.resources
 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
 Export-Package: EDU.oswego.cs.dl.util.concurrent,
  EDU.oswego.cs.dl.util.concurrent.misc,
Index: tmp/org.txm.chartsengine.raster.rcp/src/org/txm/chartsengine/raster/rcp/RasterImageChartsComponentProvider.java
===================================================================
--- tmp/org.txm.chartsengine.raster.rcp/src/org/txm/chartsengine/raster/rcp/RasterImageChartsComponentProvider.java	(revision 527)
+++ tmp/org.txm.chartsengine.raster.rcp/src/org/txm/chartsengine/raster/rcp/RasterImageChartsComponentProvider.java	(revision 528)
@@ -12,12 +12,12 @@
 import org.eclipse.ui.PlatformUI;
 import org.txm.chartsengine.core.ChartCreator;
 import org.txm.chartsengine.core.ChartsEngine;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.chartsengine.raster.rcp.swt.RasterComposite;
 import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
 import org.txm.chartsengine.rcp.editors.ChartEditorInput;
 import org.txm.chartsengine.rcp.editors.ChartEditorPart;
 import org.txm.chartsengine.rcp.swt.ChartComposite;
-import org.txm.core.results.TXMResult;
 import org.txm.rcp.commands.OpenBrowser;
 import org.txm.rcp.editors.TXMWebBrowserEditor;
 import org.txm.rcp.utils.OpenURI;
@@ -43,8 +43,8 @@
 	
 
 	@Override
-	public ChartEditorPart createChartEditor(TXMResult result, String chartType) {
-		ChartCreator chartCreator = this.getChartsEngine().getChartCreator(result.getClass(), chartType);
+	public ChartEditorInput createChartEditorInput(ChartResult result) {
+		ChartCreator chartCreator = this.getChartsEngine().getChartCreator(result.getClass(), result.getChartType());
 		File file = chartCreator.createChartFile(result);
 		// FIXME : to temporary restore the PS and PDF formats : need to be recoded if we decide to keep the PDF and PS view else to remove if we decide to keep only the feature as export
 		if(this.chartsEngine.getOutputFormat() == ChartsEngine.OUTPUT_FORMAT_PS || this.chartsEngine.getOutputFormat() == ChartsEngine.OUTPUT_FORMAT_PDF)	{
@@ -54,30 +54,44 @@
 		
 		//return (ChartEditorPart) this.openFile(editorInputName, null, file);
 		
-		ChartEditorInput chartEditorInput = new ChartEditorInput(this, result, chartType, null);
-		this.createChart(chartEditorInput, result, chartType);
-		ChartEditorPart editor = new ChartEditorPart(this, chartEditorInput);
+		ChartEditorInput chartEditorInput = new ChartEditorInput(this, result);
+		this.createChartContainer(chartEditorInput);
+		//ChartEditorPart editor = new ChartEditorPart(this, chartEditorInput);
 		
 		//ChartEditorPart editor = new ChartEditorPart(this, editorInputName, resultData, preferencesNode, chartType, this.getChartsEngine().getChartCreator(resultData.getClass(), chartType).createChartFile(resultData, preferencesNode));
 		
 		// sets and updates the local preferences node qualifier from the result data
-		editor.getEditorInput().syncLocalPreferencesNode();
+		//editor.getEditorInput().syncLocalPreferencesNode();
 		
-		return editor;
+		return chartEditorInput;
 
 	}
 
 	@Override
-	public boolean createChart(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput, TXMResult result, String chartType) {
-		ChartCreator chartCreator = chartsEngine.getChartCreator(result.getClass(), chartType);
-		if(chartCreator != null)	{
-			chartEditorInput.setChartContainer(chartCreator.createChartFile(result));
+	public boolean createChartContainer(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput) {
+		
+		Object chart = chartEditorInput.getChart();
+		
+		if(chart != null)	{
+			chartEditorInput.setChartContainer(chart);
 			
 			// sets and updates the local preferences node qualifier from the result data
 			chartEditorInput.syncLocalPreferencesNode();
+
+			// FIXME: temporary solution
+			try {
+				chartEditorInput.getResult().compute(false);
+			}
+			catch(Exception e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+
 			
 			return true;
 		}
+		
+		
 		return false;
 	}
 
@@ -103,7 +117,8 @@
 		RasterComposite composite = new RasterComposite(chartEditor, parent,  SWT.EMBEDDED);
 		
 		 // Link the composite to the chart editor (need to be done before initializing the AWT delegation events)
-		 chartEditor.setComposite(composite);
+		//FIXME:
+		 //chartEditor.setChartComposite(composite);
 
 		 // FIXME: Initialize Swing/AWT events
 //		 SWTChartsComponentsProvider.initializeAWTDelegationListeners(chartEditor, composite.getPanel().getSVGCanvas());
@@ -116,7 +131,7 @@
 		}
 		else	{
 			 // Load the chart in composite
-			composite.loadChart(chartEditor.getEditorInput().getChartContainer());
+			//composite.loadChart(chartEditor.getEditorInput().getChartContainer());
 		}
 	 
 		return composite;
Index: tmp/org.txm.partition.rcp/plugin.xml
===================================================================
--- tmp/org.txm.partition.rcp/plugin.xml	(revision 527)
+++ tmp/org.txm.partition.rcp/plugin.xml	(revision 528)
@@ -7,7 +7,7 @@
       <command
             categoryId="org.txm.rcp.category.txm"
             defaultHandler="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart"
-            id="ComputePartitionDimensionsBarChart"
+            id="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart"
             name="%command.name">
       </command>
    </extension>
@@ -17,7 +17,7 @@
             allPopups="false"
             locationURI="toolbar:org.txm.rcp.toolbartools">
          <command
-               commandId="ComputePartitionDimensionsBarChart"
+               commandId="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart"
                icon="icons/silk_dimensions.png"
                style="push"
                tooltip="%command.tooltip">
@@ -35,7 +35,7 @@
             allPopups="false"
             locationURI="popup:org.txm.rcp.views.corpora.CorporaView">
          <command
-               commandId="ComputePartitionDimensionsBarChart"
+               commandId="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart"
                icon="icons/silk_dimensions.png"
                style="push">
             <visibleWhen
@@ -63,7 +63,7 @@
       <menuContribution
             locationURI="menu:menu.tools">
          <command
-               commandId="ComputePartitionDimensionsBarChart"
+               commandId="org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart"
                icon="icons/silk_dimensions.png"
                style="push">
             <visibleWhen
@@ -89,7 +89,7 @@
    <extension
          point="org.eclipse.ui.editors">
       <editor
-            class="org.txm.chartsengine.rcp.editors.ChartEditorPart"
+            class="org.txm.partition.rcp.editors.PartitionDimensionsEditor"
             default="false"
             icon="icons/silk_dimensions.png"
             id="org.txm.partition.core.functions.PartitionDimensions"
Index: tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/editors/PartitionDimensionsEditor.java
===================================================================
--- tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/editors/PartitionDimensionsEditor.java	(revision 0)
+++ tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/editors/PartitionDimensionsEditor.java	(revision 528)
@@ -0,0 +1,56 @@
+/**
+ * 
+ */
+package org.txm.partition.rcp.editors;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ToolItem;
+import org.txm.chartsengine.rcp.editors.ChartEditorPart;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.partition.core.preferences.PartitionDimensionsPreferences;
+import org.txm.partition.rcp.handlers.ComputePartitionDimensionsBarChart;
+import org.txm.partition.rcp.messages.PartitionUIMessages;
+import org.txm.rcp.IImageKeys;
+
+/**
+ * @author sjacquot
+ *
+ */
+public class PartitionDimensionsEditor extends ChartEditorPart {
+
+
+	
+	@Override
+	public void createPartControl(Composite parent) {
+
+		this.createComputingParametersArea = false;
+		
+		super.createPartControl(parent);
+
+		// extend the tool bar
+		new ToolItem(this.getToolBar(), SWT.SEPARATOR);
+		final ToolItem sortByPartSize = new ToolItem(this.getToolBar(), SWT.CHECK);
+		sortByPartSize.setImage(IImageKeys.getImage(ComputePartitionDimensionsBarChart.class, "icons/silk_sort_by_size.png"));
+		sortByPartSize.setToolTipText(PartitionUIMessages.PreferencesPage_DIMENSIONS_SORT_BY_PARTS_SIZE);
+		sortByPartSize.setSelection(this.getBooleanParameterValue(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORTED_BY_SIZE));
+		
+		sortByPartSize.addSelectionListener(new SelectionListener() {
+			
+			@Override
+			public void widgetSelected(SelectionEvent e) {
+				TXMPreferences.putLocal(getResultData(), PartitionDimensionsPreferences.CHART_DIMENSIONS_SORTED_BY_SIZE, sortByPartSize.getSelection());
+				computeChart(true, false, true);
+			}
+			
+			@Override
+			public void widgetDefaultSelected(SelectionEvent e) {
+				// TODO Auto-generated method stub
+				
+			}
+		});
+		
+	}
+}

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

Index: tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/handlers/ComputePartitionDimensionsBarChart.java
===================================================================
--- tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/handlers/ComputePartitionDimensionsBarChart.java	(revision 527)
+++ tmp/org.txm.partition.rcp/src/org/txm/partition/rcp/handlers/ComputePartitionDimensionsBarChart.java	(revision 528)
@@ -29,17 +29,8 @@
 
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.ToolItem;
-import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
 import org.txm.chartsengine.rcp.editors.ChartEditorPart;
-import org.txm.core.preferences.TXMPreferences;
 import org.txm.partition.core.functions.PartitionDimensions;
-import org.txm.partition.core.preferences.PartitionDimensionsPreferences;
-import org.txm.partition.rcp.messages.PartitionUIMessages;
-import org.txm.rcp.IImageKeys;
 import org.txm.rcp.handlers.BaseAbstractHandler;
 import org.txm.rcp.views.corpora.CorporaView;
 import org.txm.searchengine.cqp.corpus.Partition;
@@ -96,42 +87,15 @@
 			partitionDimensions = (PartitionDimensions) selection;
 		}
 
-		final ChartEditorPart editor = SWTChartsComponentsProvider.getCurrent().openEditor(partitionDimensions, "Partition Dimensions Bar Chart"); //$NON-NLS-1$
+//		final ChartEditorPart editor = SWTChartsComponentsProvider.getCurrent().openEditor(partitionDimensions, "Partition Dimensions Bar Chart"); //$NON-NLS-1$
 		
+		final ChartEditorPart editor = ChartEditorPart.openEditor(partitionDimensions); //$NON-NLS-1$
+		
 		// FIXME: Pie chart tests
-//		final ChartEditorPart editor = SWTChartsComponentsProvider.getCurrent().openEditor(partitionDimensions, "Partition Dimensions Pie Chart");
+		//final ChartEditorPart editor2 = SWTChartsComponentsProvider.getCurrent().openEditor(partitionDimensions, "Partition Dimensions Pie Chart");
 
 		
-		// Contribute to the tool bar without extending ChartEditorPart
-		// FIXME: finally, would be better to create a PartitionDimensionEditor
-		if(!editor.wasAlreadyOpened())	{
-
 			
-			editor.refresh();
-			
-			new ToolItem(editor.getToolBar(), SWT.SEPARATOR);
-			
-			final ToolItem sortByPartSize = new ToolItem(editor.getToolBar(), SWT.CHECK);
-			sortByPartSize.setImage(IImageKeys.getImage(ComputePartitionDimensionsBarChart.class, "icons/silk_sort_by_size.png"));
-			sortByPartSize.setToolTipText(PartitionUIMessages.PreferencesPage_DIMENSIONS_SORT_BY_PARTS_SIZE);
-			sortByPartSize.setSelection(editor.getBooleanParameterValue(PartitionDimensionsPreferences.CHART_DIMENSIONS_SORTED_BY_SIZE));
-			
-			sortByPartSize.addSelectionListener(new SelectionListener() {
-				
-				@Override
-				public void widgetSelected(SelectionEvent e) {
-					TXMPreferences.putLocalBoolean(editor.getResultData(), PartitionDimensionsPreferences.CHART_DIMENSIONS_SORTED_BY_SIZE, sortByPartSize.getSelection());
-					editor.computeChart(true, false, true);
-				}
-				
-				@Override
-				public void widgetDefaultSelected(SelectionEvent e) {
-					// TODO Auto-generated method stub
-					
-				}
-			});
-		}
-			
 		return null;
 	}
 	
Index: tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java
===================================================================
--- tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java	(revision 527)
+++ tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/SWTChartsComponentsProvider.java	(revision 528)
@@ -40,6 +40,7 @@
 import org.txm.chartsengine.core.ChartCreator;
 import org.txm.chartsengine.core.ChartsEngine;
 import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.chartsengine.rcp.editors.ChartEditorInput;
 import org.txm.chartsengine.rcp.editors.ChartEditorPart;
 import org.txm.chartsengine.rcp.events.EventCallBack;
@@ -51,7 +52,6 @@
 import org.txm.chartsengine.rcp.swt.ChartEditorToolBar;
 import org.txm.core.results.TXMResult;
 import org.txm.rcp.editors.SplitedGenericMultiPageEditor;
-import org.txm.rcp.editors.TXMEditorPart;
 import org.txm.rcp.preferences.TXMPreferencePage;
 import org.txm.utils.logger.Log;
 
@@ -68,9 +68,9 @@
 	
 	// FIXME: should be done in an activator?
 	static	{	
-	// Initializes the SWT Charts Components provider according to the current charts engine and its output format
-	SWTChartsComponentsProvider.createSWTChartsComponentsProviders();
-	SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
+		// Initializes the SWT Charts Components provider according to the current charts engine and its output format
+		SWTChartsComponentsProvider.createSWTChartsComponentsProviders();
+		SWTChartsComponentsProvider.setCurrrentComponentsProvider(ChartsEngine.getCurrent());
 	}
 	
 	
@@ -105,7 +105,6 @@
 	 */
 	protected Properties keyboardBindingProperties;
 
-
 	
 	/**
 	 * Installed SWT charts components providers.
@@ -149,75 +148,35 @@
 //		}
 	}
 
-	
+	/**
+	 * 
+	 * @param chartsEngine
+	 */
 	public SWTChartsComponentsProvider(ChartsEngine chartsEngine) {
 		this(chartsEngine, new ___MouseBindingProperties(), new ___KeyboardBindingProperties());
 	}
 
 	
+	/**
+	 * 
+	 */
 	public SWTChartsComponentsProvider() {
 		this(null);
 	}
 
 	
-	
 	/**
-	 * Creates and return a SWT EditorPart filled with a new chart for the specified result and chart type.
-	 * @param editorInputName
+	 * Creates a <code>ChartEditorInput</code> for the specified chart result.
 	 * @param result
-	 * @param preferencesNode
-	 * @param chartType
-	 * @return
+	 * @return a <code>ChartEditorInput</code>
 	 */
-	public ChartEditorPart createChartEditor(TXMResult result, String chartType) {
-		ChartEditorInput chartEditorInput = new ChartEditorInput(this, result, chartType, null);
-
-		//FIXME: need to try to do the chart creation in openEditor() with computeChart() (tested without success... need to check again)
-		// create the chart from the charts engine chart creator extension
-		this.createChart(chartEditorInput, result, chartType);
-		
-		ChartEditorPart editor = new ChartEditorPart(this, chartEditorInput);
-		return editor;
+	public ChartEditorInput createChartEditorInput(ChartResult result) {
+		return new ChartEditorInput(this, result);
 	}
-
 	
 	/**
-	 * Creates and return a SWT EditorPart filled with a new chart for the specified result.
-	 * @param editorInputName
-	 * @param result
-	 * @param preferencesNode
-	 * @return
-	 */
-	public ChartEditorPart createChartEditor(TXMResult result) {
-		return this.createChartEditor(result, null);
-	}
-	
-//	/**
-//	 * Creates and return a SWT EditorPart filled with a new chart for the specified result.
-//	 * @param result
-//	 * @param preferencesNode
-//	 * @param chartType
-//	 * @return
-//	 */
-//	public ChartEditorPart createChartEditor(TXMResult result, String preferencesNode, String chartType) {
-//		return this.createChartEditor(this.getChartsEngine().getChartCreator(result.getClass(), chartType).getFileNamePrefix(), result, preferencesNode, chartType);
-//	}
-	
-	/**
-	 * Creates a new chart for the specified result data and saves it in the specified editor input.
-	 * A chart editor created with the editor input will be filled with chart.
+	 * Creates a new chart container for the specified <code>ChartResult</code> save it in the specified <code>ChartEditorInput</code>.
 	 * 
-	 * @param chartEditorInput
-	 * @param result
-	 * @param preferencesNode
-	 */
-	public void createChart(ChartEditorInput chartEditorInput, TXMResult result)	{
-		this.createChart(chartEditorInput, result, chartEditorInput.getChartType()); 
-	}
-	
-	/**
-	 * Creates a new chart for the specified result data and chart type and save it in the specified editor input.
-	 * 
 	 * @param chartsEngine
 	 * @param chartEditorInput
 	 * @param result
@@ -225,10 +184,10 @@
 	 * @param chartType
 	 * @return
 	 */
-	protected abstract boolean createChart(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput, TXMResult result, String chartType);
+	protected abstract boolean createChartContainer(ChartsEngine chartsEngine, ChartEditorInput chartEditorInput);
 	
 	/**
-	 * Creates a new chart for the specified result data and chart type and save it in the specified editor input.
+	 * Creates a new chart container for the specified <code>ChartResult</code> save it in the specified <code>ChartEditorInput</code>.
 	 * 
 	 * @param chartEditorInput
 	 * @param result
@@ -236,8 +195,8 @@
 	 * @param chartType
 	 * @return
 	 */
-	protected boolean createChart(ChartEditorInput chartEditorInput, TXMResult result, String chartType)	{
-		return this.createChart(this.getChartsEngine(), chartEditorInput, result, chartType);
+	public boolean createChartContainer(ChartEditorInput chartEditorInput)	{
+		return this.createChartContainer(this.getChartsEngine(), chartEditorInput);
 	}
 	
 	
@@ -249,27 +208,16 @@
 	 * @param chartType
 	 * @return <code>True</code>, if a chart creator has been found and the chart has been updated, otherwise <code>false</code>
 	 */
-	public boolean updateChart(ChartEditorPart editor, String chartType)	{
-		ChartCreator chartCreator = this.chartsEngine.getChartCreator(editor.getResultData().getClass(), chartType);
-		if(chartCreator != null)	{
-			chartCreator.updateChart(editor.getChart(), editor.getResultData());
-			return true;
+	public boolean updateChart(ChartEditorPart editor)	{
+		try {
+			return editor.getResultData().compute(true);
 		}
+		catch(Exception e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
 		return false;
 	}
-	
-	
-	/**
-	 * Updates the specified chart stored in the editor and according to the stored TXM result.
-	 * @param editor
-	 * @param command
-	 * @param params
-	 * @return <code>True</code>, if a chart creator has been found and the chart has been updated, otherwise <code>false</code>
-	 */
-	public boolean updateChart(ChartEditorPart editor)	{
-		return this.updateChart(editor, editor.getChartType());
-	}
-	
 
 	
 	/**
@@ -631,18 +579,7 @@
 		return this.openEditor(chartEditorInput, chartEditorInput.getResult().getClass().getName());
 	}
 
-	/**
-	 * Opens the specified <code>ChartEditorPart</code> in the active page and registers the event listeners and context menus according to the type of the chart editor part.
-	 * The chart type is the editor input result data class name.
-	 * @param chartEditorInput
-	 * @param editorPartId
-	 * @return
-	 */
-	public ChartEditorPart openEditor(ChartEditorInput chartEditorInput, String editorPartId)	{
-		return this.openEditor(chartEditorInput, editorPartId, null);	
-	}
 	
-	
 	/**
 	 * Opens the <code>ChartEditorPart</code> specified by its id and ChartEditorInput in the active page and registers the event listeners and context menus according to the <code>EventCallBack</code> installed extensions. 
 	 * @param chartEditorInput
@@ -651,7 +588,7 @@
 	 * @return
 	 */
 	// FIXME: this method have some trouble when calling through a progress dialog
-	public ChartEditorPart openEditor(ChartEditorInput chartEditorInput, String editorPartId, String chartType)	{
+	public ChartEditorPart openEditor(ChartEditorInput chartEditorInput, String editorPartId)	{
 
 		ChartEditorPart openedChartEditorPart = null;
 
@@ -666,7 +603,7 @@
 		Log.info("SWTChartsComponentsProvider.openEditor(): opening editor with id " + editorPartId);
 		
 		// if the editor is already open or the charts engine can create the specified chart type
-		if(isAlreadyOpened || this.chartsEngine.canCreateChart(chartEditorInput.getResult().getClass(), chartType))	{
+		if(isAlreadyOpened || this.chartsEngine.canCreateChart(chartEditorInput.getResult().getClass(), chartEditorInput.getChartType()))	{
 			
 			//Log.info(this.name + " - Opening editor for result data type " + chartEditorInput.getResultData().getClass() + " and editor id " + editorPartId);
 
@@ -714,7 +651,7 @@
 			for(int i = 0; i < ChartsEngine.getChartsEngines().size() && !canCreate; i++) {
 				if(ChartsEngine.getChartsEngines().get(i) != this.chartsEngine)	{
 					ChartsEngine chartsEngine = ChartsEngine.getChartsEngines().get(i);
-					canCreate = chartsEngine.canCreateChart(chartEditorInput.getResult().getClass(), chartType);
+					canCreate = chartsEngine.canCreateChart(chartEditorInput.getResult().getClass(), chartEditorInput.getChartType());
 					// get a provider that can manage the charts engine
 					if(canCreate)	{
 						SWTChartsComponentsProvider provider = SWTChartsComponentsProvider.getComponentsProvider(chartsEngine);
@@ -722,7 +659,7 @@
 							provider.setChartsEngine(chartsEngine);
 							chartEditorInput.setSWTChartsComponentsProvider(provider);
 							Log.warning(provider.toString());
-							return provider.openEditor(chartEditorInput, editorPartId, chartType);
+							return provider.openEditor(chartEditorInput, editorPartId);
 						}
 					}
 				}
@@ -742,56 +679,12 @@
 	 * @param params
 	 * @return
 	 */
-	public ChartEditorPart openEditor(TXMResult result, String chartType)	{
-		return this.openEditor(this.createChartEditor(result, chartType), chartType);
+	public ChartEditorPart openEditor(ChartResult result)	{
+		return this.openEditor(this.createChartEditorInput(result), result.getClass().getName());
 	}
 	
-	/**
-	 * 
-	 * @param editorInputName
-	 * @param result
-	 * @param params
-	 * @return
-	 */
-	public ChartEditorPart openEditor(TXMResult result)	{
-		return this.openEditor(result, null);
-	}
 	
-	
 	/**
-	 * Opens the specified <code>ChartEditorPart</code> in the active page and registers the event listeners and context menus according to the type of the chart editor part.
-	 * The ID of the editor is the editor input result data class name.
-	 * @param editorPart
-	 * @return
-	 */
-	public ChartEditorPart openEditor(ChartEditorPart editorPart)	{
-		return this.openEditor(editorPart, null);
-	}
-	
-	/**
-	 * Opens the specified <code>ChartEditorPart</code> in the active page and registers the event listeners and context menus according to the type of the chart editor part.
-	 * The ID of the editor is the editor input result data class name.
-	 * @param chartEditorInput
-	 * @return
-	 */
-	public ChartEditorPart openEditor(ChartEditorPart editorPart, String chartType)	{
-		return this.openEditor(editorPart, editorPart.getEditorInput().getResult().getClass().getName(), chartType);
-	}
-	
-	
-	/**
-	 * Opens the specified <code>ChartEditorPart</code> in the active page and registers the event listeners and context menus according to the type of the chart editor part.
-	 * @param editorPart
-	 * @param editorId
-	 * @return
-	 */
-	public ChartEditorPart openEditor(ChartEditorPart editorPart, String editorId, String chartType)	{
-		return this.openEditor(editorPart.getEditorInput(), editorId, chartType);
-	}
-	
-	
-	
-	/**
 	 * Initializes the default context menus.
 	 * @param composite
 	 */
Index: tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java
===================================================================
--- tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java	(revision 527)
+++ tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java	(revision 528)
@@ -4,6 +4,8 @@
 import java.io.File;
 import java.util.ArrayList;
 
+import javax.swing.JComponent;
+
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IProgressMonitor;
@@ -15,20 +17,22 @@
 import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Group;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.IPartListener;
 import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.contexts.IContextService;
 import org.eclipse.ui.part.EditorPart;
 import org.eclipse.ui.part.MultiPageEditorPart;
 import org.txm.chartsengine.core.ChartsEngine;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
 import org.txm.chartsengine.rcp.events.EventCallBack;
 import org.txm.chartsengine.rcp.events.EventCallBackHandler;
 import org.txm.chartsengine.rcp.swt.AdvancedChartEditorToolBar;
 import org.txm.chartsengine.rcp.swt.ChartComposite;
 import org.txm.chartsengine.rcp.swt.ChartEditorToolBar;
-import org.txm.core.results.TXMResult;
 import org.txm.rcp.editors.TXMEditorPart;
 import org.txm.rcp.editors.TXMEditorToolBar;
 import org.txm.rcp.utils.JobHandler;
@@ -95,37 +99,34 @@
 	}
 
 	
-	
+
 	/**
 	 * 
 	 * @param swtComponentsProvider
-	 * @param titleImage
-	 * @param result
-	 * @param chartContainer
-	 */
-	public ChartEditorPart(SWTChartsComponentsProvider swtComponentsProvider, TXMResult result, String chartType, Object chartContainer) {
-		this(swtComponentsProvider, new ChartEditorInput(swtComponentsProvider, result, chartType, chartContainer));
-	}
-	
-	
-	/**
-	 * 
-	 * @param swtComponentsProvider
 	 * @param chartEditorInput
 	 */
-	public ChartEditorPart(SWTChartsComponentsProvider swtComponentsProvider, ChartEditorInput chartEditorInput) {
+	protected ChartEditorPart(SWTChartsComponentsProvider swtComponentsProvider, ChartEditorInput chartEditorInput) {
 		this.setInput(chartEditorInput);
 		this.setPartName(chartEditorInput.getName());
 		
 		this.wasAlreadyOpened = false;
 	}
 
-	
+	/**
+	 * 
+	 * @param chartEditorInput
+	 */
 	public ChartEditorPart(ChartEditorInput chartEditorInput) {
 		this(SWTChartsComponentsProvider.getCurrent(), chartEditorInput);
 	}
 	
 
+	@Override
+	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+		
+		
+		super.init(site, input);
+	}
 	
 	@Override
 	public void createPartControl(Composite parent) {
@@ -145,6 +146,7 @@
 		
 		// Toolbar
 		this.chartToolBar = new ChartEditorToolBar(this.getTopToolBarContainer(), SWT.FLAT | SWT.RIGHT, this);
+		//this.chartToolBar = new ChartEditorToolBar(this.topToolBar, SWT.FLAT | SWT.RIGHT, this);
 		//this.chartToolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED));
 
 		
@@ -223,19 +225,27 @@
 		
 		// Advanced tool bar
 		//this.advancedToolBarComposite = new Composite(parent, SWT.NONE);
-		Group group = this.topToolBar.installGroup("Rendering parameters", "Show/Hide rendering parameters", "platform:/plugin/org.txm.chartsengine.rcp/icons/show_rendering_parameters.png");
+		Group group = this.topToolBar.installGroup("Rendering parameters", "Show/Hide rendering parameters", "platform:/plugin/org.txm.chartsengine.rcp/icons/show_rendering_parameters.png", false);
 		this.advancedChartToolBar = new AdvancedChartEditorToolBar(group, SWT.FLAT, this);
 //		this.advancedToolBar.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
 //		this.advancedToolBarComposite.pack(true);
+
+		// Remove parent composites
+		this.displayArea.dispose();
+		this.bottomToolBar.dispose();
 		
 		// Chart composite
-		ChartComposite chartComposite = this.getSWTChartsComponentsProvider().createComposite(this, parent);
+		this.chartComposite = this.getSWTChartsComponentsProvider().createComposite(this, parent);
 		GridData gd = new GridData(GridData.FILL_BOTH);
 //		gd.grabExcessVerticalSpace = true;
 //		gd.grabExcessHorizontalSpace = true;
-//		gd.horizontalSpan = 2; // 2 for match the command parameters toolbar AND the chart toolbar
-		chartComposite.setLayoutData(gd);
+		//gd.horizontalSpan = 2; // 2 for match the command parameters toolbar AND the chart toolbar
+		this.chartComposite.setLayoutData(gd);
 		
+		
+		// Re-add the bottom toolbar
+		this.bottomToolBar = new TXMEditorToolBar(parent, SWT.FLAT, "bottom", this);
+		
 		// FIXME: open dialog box message if the composite doesn't contain any chart (typically when the charts engine doesn't contain chart creator for the specified result data type)
 //		if(composite.getChart() == null)	{
 //			MessageDialog.openWarning(parent.getShell(), "Warning", "Current charts engine can not create chart for " + this.getResultData().getClass().getSimpleName() + " result type. You can set another charts engine in the preferences.");
@@ -246,25 +256,10 @@
 		//parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
 
 		
+		this.computeChart(false);
 		
-		// initialize the default shared context menus as Export, etc.
-		SWTChartsComponentsProvider.initDefaultContextMenus(chartComposite);
-
 		
-		// registers user entries event call back extensions
-		this.registerEventCallBackExtensions();
 		
-		//FIXME: test to contribute to menu only in some context
-		// create chart editor part context
-//		IContextService contextService = (IContextService)getSite().getService(IContextService.class);
-//		contextService.activateContext(ChartEditorPart.class.getName());
-//		// create chart composite context
-//		contextService.activateContext(this.chartComposite.getClass().getName());
-		
-		//FIXME: description test
-		//this.setContentDescription("details");
-		//this.setContentDescription(this.getResultData().getDetails());
-		
 	}
 
 
@@ -422,6 +417,7 @@
 	 */
 	public void computeChart(String jobName, final boolean update, boolean setUser, final boolean resetView, final boolean clearChartItemsSelection) {
 		
+		
 		JobHandler job = new JobHandler(jobName) {
 
 		    @Override
@@ -430,16 +426,32 @@
 		    	this.runInit(monitor);
 		    	
 		    	try {
-					// creating/updating
-					monitor.beginTask("Computing", IProgressMonitor.UNKNOWN);
+
+		    		// computing result
+					monitor.beginTask("Computing", 100);
+
+		    		// FIXME: temporary solution, should call super.computeResult() ?
+					if(getResultData().isDirty())	{
+						getResultData().compute(update, monitor);
+					}
+		    		
 					
-					if(update)	{
-						updateChart();
+					// creating/updating chart
+					monitor.subTask("computing chart");
+
+					getResultData().computeChart(update);
+
+					if(!update)	{
+						createChartContainer();
 					}
-					else	{
-						createChart();
-					}
 
+					// FIXME: long process test
+//					for(long i = 0; i < 9000000000L; i++)	{
+//						;
+//					}
+
+					monitor.worked(25);
+					
 					// cancel
 					if(monitor.isCanceled())	{
 						close(true);
@@ -447,9 +459,38 @@
 					}
 					
 					// loading
-					monitor.setTaskName("Loading");
+					monitor.subTask("loading chart");
 					loadChart(resetView, clearChartItemsSelection);
 
+					if(!update)	{
+						// Initialize Swing/AWT events delegation.
+						this.syncExec(new Runnable() {
+							@Override
+							public void run() {
+								// initialize the default shared context menus as Export, etc.
+								SWTChartsComponentsProvider.initDefaultContextMenus(chartComposite);
+
+								
+								// registers user entries event call back extensions
+								registerEventCallBackExtensions();
+								
+								//FIXME: test to contribute to menu only in some context
+								// create chart editor part context
+//								IContextService contextService = (IContextService)getSite().getService(IContextService.class);
+//								contextService.activateContext(ChartEditorPart.class.getName());
+//								// create chart composite context
+//								contextService.activateContext(this.chartComposite.getClass().getName());
+								
+								//FIXME: description test
+								//this.setContentDescription("details");
+								//this.setContentDescription(this.getResultData().getDetails());
+
+								initializeAWTDelegationListeners();
+							}
+						});
+					}
+
+					
 					// FIXME: refresh the tree node
 //				getSite().getShell().getDisplay().syncExec(new Runnable() {
 //					@Override
@@ -464,6 +505,7 @@
 				}
 		    	// for user direct canceling
 		    	catch(ThreadDeath td) {
+		    		// FIXME should clean() and/or set the result as dirty?
 		    		close(true);
 		    		return Status.CANCEL_STATUS;
 		    	}
@@ -482,6 +524,14 @@
 
 
 
+	/**
+	 * Initialize Swing/AWT events delegation.
+	 * @param swingComponent
+	 */
+	protected void initializeAWTDelegationListeners()	{
+		this.getChartComposite().getChartComponent().setChartEditor(this);
+		SWTChartsComponentsProvider.initializeAWTDelegationListeners(this, (JComponent) this.getEditorInput().getChartContainer());
+	}
 
 	/**
 	 * Convenience method the get the casted linked editor input.
@@ -570,31 +620,11 @@
 	
 	
 	
-	/**
-	 * Updates the specified chart stored in the editor and according to the stored TXM result.
-	 * @return <code>True</code>, if a chart creator has been found and the chart has been updated, otherwise <code>false</code>
-	 */
-	public boolean updateChart()	{
-		return this.getSWTChartsComponentsProvider().updateChart(this);
+	public void createChartContainer()	{
+		this.getSWTChartsComponentsProvider().createChartContainer(this.getEditorInput());
 	}
 	
 	/**
-	 * Creates a new chart for the specified result data and save it in the current editor input.
-	 * @param result
-	 * @param preferencesNode
-	 */
-	public void createChart(TXMResult result)	{
-		this.getSWTChartsComponentsProvider().createChart(this.getEditorInput(), result);
-	}
-	
-	/**
-	 * Creates a new chart for current stored result and save it in the current editor input.
-	 */
-	public void createChart()	{
-		this.createChart(this.getResultData());
-	}
-	
-	/**
 	 * Disposes the editor.
 	 * Implementations using a Composite to embed AWT/Swing components should manually call this.composite.dispose() in the redefined method.
 	 */
@@ -627,7 +657,7 @@
 	 * @return
 	 */
 	public String getChartType()	{
-		return this.getEditorInput().getChartType();
+		return this.getResultData().getChartType();
 	}
 	
 	/**
@@ -635,9 +665,15 @@
 	 * @return
 	 */
 	public Object getChart()	{
-		return this.chartComposite.getChart();
+		return this.getResultData().getChart();
 	}
 
+	@Override
+	public ChartResult getResultData()	{
+		return (ChartResult) this.getEditorInput().getResult();
+	}
+
+	
 	/**
 	 * Returns the chart components provider associated with the editor (through its <code>ChartEditorInput</code>).
 	 * @return
@@ -835,9 +871,9 @@
 	/**
 	 * @param composite the composite to set
 	 */
-	public void setComposite(ChartComposite composite) {
-		this.chartComposite = composite;
-	}
+//	public void setComposite(ChartComposite composite) {
+//		this.chartComposite = composite;
+//	}
 
 
 
@@ -860,6 +896,15 @@
 	}
 
 
+	/**
+	 * Opens an editor for the specified result.
+	 * @param result
+	 * @return
+	 */
+	public static ChartEditorPart openEditor(ChartResult result)	{
+		return SWTChartsComponentsProvider.getCurrent().openEditor(result);
+	}
+	
 
 	/**
 	 * Checks whatever the chart composite has the focus or not.
@@ -880,4 +925,13 @@
 	protected void initializeFields() {
 		// TODO Auto-generated method stub
 	}
+
+
+
+	/**
+	 * @return the chartComposite
+	 */
+	public ChartComposite getChartComposite() {
+		return chartComposite;
+	}
 }
Index: tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorInput.java
===================================================================
--- tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorInput.java	(revision 527)
+++ tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorInput.java	(revision 528)
@@ -4,6 +4,7 @@
 import org.eclipse.ui.IPersistableElement;
 import org.txm.chartsengine.core.ChartsEngine;
 import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
 import org.txm.core.preferences.TXMPreferences;
 import org.txm.core.results.TXMResult;
@@ -20,10 +21,6 @@
 	@Deprecated
 	protected String name;
 	
-	/**
-	 * Chart type.
-	 */
-	protected String chartType;
 	
 	/**
 	 * SWT chart components provider used to create the chart editor.
@@ -38,6 +35,8 @@
 	protected Object chartContainer;
 
 	
+	//protected Object chart;
+	
 	/**
 	 * Creates a chart editor input linked to the current SWT charts components provider.
 	 * @param result
@@ -60,27 +59,15 @@
 	/**
 	 * Creates a chart editor input linked to the specified SWT charts components provider.
 	 * @param swtComponentsProvider
-	 * @param result
-	 * @param preferencesNodeQualifier
-	 * @param chartType
-	 */
-	public ChartEditorInput(SWTChartsComponentsProvider swtComponentsProvider, TXMResult result, String chartType) {
-		this(swtComponentsProvider, result, chartType, null);
-	}
-
-	/**
-	 * Creates a chart editor input linked to the specified SWT charts components provider.
-	 * @param swtComponentsProvider
 	 * @param name
 	 * @param result
 	 * @param preferencesNodeQualifier
 	 * @param chartType
 	 * @param chartContainer
 	 */
-	public ChartEditorInput(SWTChartsComponentsProvider swtComponentsProvider, TXMResult result, String chartType, Object chartContainer) {
+	public ChartEditorInput(SWTChartsComponentsProvider swtComponentsProvider, TXMResult result, Object chartContainer) {
 		super(result);
 		this.swtChartsComponentsProvider = swtComponentsProvider;
-		this.chartType = chartType;
 		this.chartContainer = chartContainer;
 	}
 
@@ -177,7 +164,12 @@
 		this.chartContainer = chartContainer;
 	}
 
+//	public void setChart(Object chart) {
+//		this.chart = chart;
+//	}
 
+	
+
 	/**
 	 * Set the <code>SWTChartsComponentsProvider</code> to link to this editor input and to use for reading the chart object.
 	 * @param swtChartsComponentsProvider the swtChartsComponentsProvider to set
@@ -193,11 +185,14 @@
 	 * @return the chartType or <code>null</code> if there only one chart type needed for the linked <code>TXMResult</code>. 
 	 */
 	public String getChartType() {
-		return chartType;
+		return this.getResult().getChartType();
 	}
 
+	@Override
+	public ChartResult getResult() {
+		return (ChartResult) this.result;
+	}
 
-
 	/**
 	 * Sets and updates the local preferences node qualifier from the result data.
 	 * Synchronizes the local preferences node with the result data type, chart type, etc.
@@ -207,11 +202,11 @@
 		//FIXME: to call when implemented in parent class
 		//super.syncLocalPreferencesNode();
 		// FIXME: persistence test
-		if(this.chartType != null)	{
-			TXMPreferences.putLocalString(this.result, ChartsEnginePreferences.CHART_TYPE, this.chartType);
+		if(this.getResult().getChartType() != null)	{
+			TXMPreferences.putLocal(this.result, ChartsEnginePreferences.CHART_TYPE, this.getResult().getChartType());
 		}
 		
-		TXMPreferences.putLocalString(this.result, ChartsEnginePreferences.RESULT_DATA_TYPE, this.result.getClass().getName());
+		TXMPreferences.putLocal(this.result, ChartsEnginePreferences.RESULT_DATA_TYPE, this.result.getClass().getName());
 	}
 	
 
@@ -225,5 +220,18 @@
 		}
 		return false;
 	}
+
+	/**
+	 * Gets the chart object. According to the used charts engine, it can be a file, an UI component, etc.
+	 * @return
+	 */
+	public Object getChart() {
+		try {
+			return ((ChartResult) this.result).getChart();
+		}
+		catch(Exception e) {
+		}
+		return null;
+	}
 	
 }
Index: tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java
===================================================================
--- tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java	(revision 527)
+++ tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/AdvancedChartEditorToolBar.java	(revision 528)
@@ -2,7 +2,11 @@
 
 import java.awt.Font;
 import java.awt.GraphicsEnvironment;
+import java.util.ArrayList;
 
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.preference.ComboFieldEditor;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
@@ -10,6 +14,7 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.ToolBar;
 import org.eclipse.swt.widgets.ToolItem;
+import org.txm.chartsengine.core.ChartCreator;
 import org.txm.chartsengine.core.ChartsEngine;
 import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
 import org.txm.chartsengine.rcp.editors.ChartEditorPart;
@@ -166,32 +171,76 @@
 		fontSizeCombo.select(currentFontSizeIndex);
 
 		
+		// Chart types from installed chart creators
 		
+//		if(contributions.length > 1)	{
+			final Combo chartTypeCombo = new Combo(this, SWT.READ_ONLY);
+			ArrayList<ChartCreator> chartCreators = this.chartEditorPart.getSWTChartsComponentsProvider().getChartsEngine().getChartCreators(this.chartEditorPart.getResultData());
+			String chartTypes[] = new String[chartCreators.size()];
+			int currentChartTypeIndex = 0;
+			for(int i = 0; i < chartCreators.size(); i++) {
+				chartTypes[i] = chartCreators.get(i).getChartType();
+				if(chartTypes[i] == null)	{
+					chartTypes[i] = this.chartEditorPart.getResultData().getClass().getName();
+				}
+				if(this.getEditorPart().getChartType() != null && this.getEditorPart().getChartType().equals(chartTypes[i])) {
+					currentChartTypeIndex = i;
+				}
+				
+			}
+			chartTypeCombo.setItems(chartTypes);
+			
+			ToolItem chartTypeComboItem = new ToolItem(this, SWT.SEPARATOR);
+			chartTypeComboItem.setControl(chartTypeCombo);
+			chartTypeCombo.pack();
+			chartTypeComboItem.setWidth(chartTypeCombo.getBounds().width);
+			
+			chartTypeCombo.select(currentChartTypeIndex);
+			
+			
+			if(chartCreators.size() < 2)	{
+				chartTypeCombo.setVisible(false);
+			}
+//		}
+//		else	{
+//			final Combo chartTypeCombo = null;
+//		}
+		
+		
+		
+		
 		// Listeners
 		SelectionListener listener = new SelectionListener() {
 			
 			@Override
 			public void widgetSelected(final SelectionEvent e) {
 				
+				boolean update = true;
+				
 				// Accessing the source must be done outside the Job
 				if(e.getSource() == showTitle)	{
-					TXMPreferences.putLocalBoolean(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_TITLE, showTitle.getSelection());
+					TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_TITLE, showTitle.getSelection());
 				}
 				else if(e.getSource() == showLegend)	{
-					TXMPreferences.putLocalBoolean(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_LEGEND, showLegend.getSelection());
+					TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_LEGEND, showLegend.getSelection());
 				}
 				else if(e.getSource() == showGrid)	{
-					TXMPreferences.putLocalBoolean(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_GRID, showGrid.getSelection());
+					TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.SHOW_GRID, showGrid.getSelection());
 				}
 				else if(e.getSource() == renderingModeCombo)	{
-					TXMPreferences.putLocalInt(chartEditorPart.getResultData(), ChartsEnginePreferences.RENDERING_COLORS_MODE, renderingModeCombo.getSelectionIndex());
+					TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.RENDERING_COLORS_MODE, renderingModeCombo.getSelectionIndex());
 				}
 				else if(e.getSource() == fontCombo || e.getSource() == fontSizeCombo)	{
-					TXMPreferences.putLocalString(chartEditorPart.getResultData(), ChartsEnginePreferences.FONT, "1|" + fontCombo.getItem(fontCombo.getSelectionIndex()) + "|" + fontSizeCombo.getItem(fontSizeCombo.getSelectionIndex()) + "|0");
+					TXMPreferences.putLocal(chartEditorPart.getResultData(), ChartsEnginePreferences.FONT, "1|" + fontCombo.getItem(fontCombo.getSelectionIndex()) + "|" + fontSizeCombo.getItem(fontSizeCombo.getSelectionIndex()) + "|0");
 				}
+				else if(e.getSource() == chartTypeCombo)	{
+					chartEditorPart.getResultData().setChartType(chartTypeCombo.getItem(chartTypeCombo.getSelectionIndex()));
+					update = false;
+				}
+
 				
 				// updates existing chart
-				chartEditorPart.computeChart("Update chart", true);
+				chartEditorPart.computeChart("Update chart", update);
 			}
 			
 			@Override
@@ -206,6 +255,7 @@
 		renderingModeCombo.addSelectionListener(listener);
 		fontCombo.addSelectionListener(listener);
 		fontSizeCombo.addSelectionListener(listener);
+		chartTypeCombo.addSelectionListener(listener);
 	}
 
 
Index: tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartEditorToolBar.java
===================================================================
--- tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartEditorToolBar.java	(revision 527)
+++ tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/swt/ChartEditorToolBar.java	(revision 528)
@@ -11,6 +11,7 @@
  * @author sjacquot
  *
  */
+// FIXME: became useless, can directly use TXMEditorToolBar
 public class ChartEditorToolBar extends TXMEditorToolBar {
 
 	
Index: tmp/org.txm.internalview.core/src/org/txm/functions/internal/InternalView.java
===================================================================
--- tmp/org.txm.internalview.core/src/org/txm/functions/internal/InternalView.java	(revision 527)
+++ tmp/org.txm.internalview.core/src/org/txm/functions/internal/InternalView.java	(revision 528)
@@ -7,7 +7,6 @@
 import java.util.LinkedHashMap;
 import java.util.List;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
 import org.txm.internalview.core.Messages;
@@ -214,12 +213,12 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return corpus != null && pStructure != null && pProperties != null && pProperties.size() > 0 && pStructProperties != null && pStructProperties.size() > 0;
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		//find struct start-end
 		Query query = new Query("<"+pStructure.getName()+"> [] expand to "+pStructure); //$NON-NLS-1$ //$NON-NLS-2$
 		//System.out.println(query);
Index: tmp/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/editors/BalanceEditor.java
===================================================================
--- tmp/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/editors/BalanceEditor.java	(revision 527)
+++ tmp/org.txm.textsbalance.rcp/src/org/txm/textsbalance/rcp/editors/BalanceEditor.java	(revision 528)
@@ -217,7 +217,7 @@
 				final TextsBalance textsBalance = (TextsBalance)getResultData();
 				try {
 					textsBalance.setParameters(method, su, propertyName, groupByTexts);
-					textsBalance.compute(monitor);
+					textsBalance.compute(false, monitor);
 				}
 				catch(Exception e) {
 					System.out.println("Error: "+e.getLocalizedMessage());
Index: tmp/org.txm.partition.core/plugin.xml
===================================================================
--- tmp/org.txm.partition.core/plugin.xml	(revision 527)
+++ tmp/org.txm.partition.core/plugin.xml	(revision 528)
@@ -10,7 +10,6 @@
    <extension
          point="org.txm.chartsengine.chartcreator">
       <ChartCreator
-            chartType="Partition Dimensions Bar Chart"
             chartsEngineName="jfreechart_charts_engine"
             class="org.txm.partition.core.chartsengine.jfreechart.JFCPartitionDimensionsBarChartCreator"
             fileNamePrefix="info">
@@ -22,7 +21,6 @@
             fileNamePrefix="partition_dimensions">
       </ChartCreator>
       <ChartCreator
-            chartType="Partition Dimensions Bar Chart"
             chartsEngineName="r_charts_engine"
             class="org.txm.partition.core.chartsengine.r.RPartitionDimensionsBarChartCreator"
             fileNamePrefix="info">
Index: tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java
===================================================================
--- tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java	(revision 527)
+++ tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java	(revision 528)
@@ -34,11 +34,41 @@
 	}
 
 
+
+	@Override
+	protected boolean _compute(boolean update) throws Exception {
+		// does nothing
+		return true;
+	}
+
+	@Override
+	public void clean() {
+		// does nothing
+	}
+
+	@Override
+	public boolean canCompute() {
+		return this.getPartition() != null;
+	}
+
+
+	@Override
+	public boolean setParameters(TXMParameters parameters) {
+		return false;
+	}
+
+
 	/**
 	 * Convenience method.
 	 */
 	public Partition getPartition()	{
-		return (Partition) this.parent;
+		try {
+			return (Partition) this.parent;
+		}
+		catch(Exception e) {
+			e.printStackTrace();
+			return null;
+		}
 	}
 	
 	/**
@@ -121,34 +151,13 @@
 	
 
 
-	@Override
-	public void clean() {
-		// TODO Auto-generated method stub
-		
-	}
 
-	@Override
-	public boolean validateParameters() {
-		return getPartition() != null;
-	}
 
-
 	@Override
-	public boolean setParameters(TXMParameters parameters) {
+	public boolean toTxt(File arg0, String arg1, String arg2, String arg3) throws Exception {
+		// TODO Auto-generated method stub
 		return false;
 	}
 
 
-	@Override
-	public boolean _compute() throws Exception {
-		// TODO move here the code from SWTChartsComponentsProvider that creates the chart to display 
-		return false;
-	}
-
-
-	@Override
-	public boolean toTxt(File arg0, String arg1, String arg2, String arg3) throws Exception {
-		// TODO Auto-generated method stub
-		return false;
-	}
 }
Index: tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsBarChartCreator.java
===================================================================
--- tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsBarChartCreator.java	(revision 527)
+++ tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/jfreechart/JFCPartitionDimensionsBarChartCreator.java	(revision 528)
@@ -11,12 +11,11 @@
 import org.jfree.data.xy.XYSeries;
 import org.jfree.data.xy.XYSeriesCollection;
 import org.txm.chartsengine.core.ChartsEngine;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
 import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
 import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection;
 import org.txm.chartsengine.jfreechart.core.themes.base.ExtendedNumberAxis;
 import org.txm.chartsengine.jfreechart.core.themes.base.SymbolAxisBetweenTicks;
+import org.txm.core.results.TXMResult;
 import org.txm.partition.core.chartsengine.base.Utils;
 import org.txm.partition.core.functions.PartitionDimensions;
 import org.txm.partition.core.messages.PartitionCoreMessages;
Index: tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java
===================================================================
--- tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java	(revision 527)
+++ tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsBarChartCreator.java	(revision 528)
@@ -4,10 +4,9 @@
 import java.util.List;
 
 import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
 import org.txm.chartsengine.r.core.RChartCreator;
 import org.txm.chartsengine.r.core.RChartsEngine;
+import org.txm.core.results.TXMResult;
 import org.txm.partition.core.chartsengine.base.Utils;
 import org.txm.partition.core.functions.PartitionDimensions;
 import org.txm.partition.core.messages.PartitionCoreMessages;
@@ -22,14 +21,6 @@
  */
 public class RPartitionDimensionsBarChartCreator extends RChartCreator {
 
-	public RPartitionDimensionsBarChartCreator() {
-	}
-
-	@Override
-	public Object createChart(TXMResult result) {
-		return null;
-	}
-
 	
 	@Override
 	public File createChartFile(TXMResult result, File file) {
Index: tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsPieChartCreator.java
===================================================================
--- tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsPieChartCreator.java	(revision 527)
+++ tmp/org.txm.partition.core/src/org/txm/partition/core/chartsengine/r/RPartitionDimensionsPieChartCreator.java	(revision 528)
@@ -22,14 +22,6 @@
  */
 public class RPartitionDimensionsPieChartCreator extends RChartCreator {
 
-	public RPartitionDimensionsPieChartCreator() {
-	}
-
-	@Override
-	public Object createChart(TXMResult result) {
-		return null;
-	}
-
 	
 	@Override
 	public File createChartFile(TXMResult result, File file) {
Index: tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartCreator.java
===================================================================
--- tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartCreator.java	(revision 527)
+++ tmp/org.txm.chartsengine.r.core/src/org/txm/chartsengine/r/core/RChartCreator.java	(revision 528)
@@ -27,8 +27,7 @@
 
 	@Override
 	public Object createChart(TXMResult result) {
-		// TODO Auto-generated method stub
-		return null;
+		return this.createChartFile(result);
 	}
 
 	
Index: tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java
===================================================================
--- tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java	(revision 527)
+++ tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java	(revision 528)
@@ -41,7 +41,6 @@
 import java.util.Map;
 import java.util.Set;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.rosuda.REngine.REXPMismatchException;
 import org.txm.concordance.core.functions.Concordance;
 import org.txm.concordance.core.functions.Line;
@@ -50,7 +49,6 @@
 import org.txm.cooccurrence.core.preferences.CooccurrencePreferences;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
-
 import org.txm.index.core.functions.Index;
 import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
@@ -445,7 +443,7 @@
 	 * @param buildLexicalTableWithCooccurrents
 	 * @return
 	 */
-	public boolean _compute() {
+	protected boolean _compute(boolean update) {
 		this.monitor = monitor;
 		//FIXME: debug
 		//System.out.println("cooc: "+corpus+" "+query+" "+properties+" "+limit+" "+maxLeft+" "+minLeft+" "+minRight+" "+maxRight+" "+minFreq+" "+minCof+" "+minScore+" "+includeXpivot);
@@ -1058,7 +1056,7 @@
 			try {
 				voc = new Index(corpus);
 				voc.setParameters(new Query(pCooccurentQueryFilter), pProperties, null, null, null, null);
-				voc.compute(monitor);
+				voc.compute(false, monitor);
 			} catch (Exception e){
 				Log.severe("Error while computing Index for the cooccurrence: "+e.getLocalizedMessage());
 				return false;
@@ -1546,7 +1544,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 
 		boolean ret = pQuery != null && pProperties != null && getCorpus() != null && pQuery.getQueryString().length() > 0 && pProperties.size() > 0;
 
Index: tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java	(revision 527)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java	(revision 528)
@@ -37,10 +37,9 @@
 import java.util.List;
 import java.util.Map;
 
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.chartsengine.r.core.themes.DefaultTheme;
 import org.txm.core.results.TXMParameters;
-import org.txm.core.results.TXMResult;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.progression.core.messages.ProgressionCoreMessages;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
 import org.txm.searchengine.cqp.corpus.Corpus;
@@ -60,10 +59,12 @@
  * @author mdecorde
  * @author sjacquot
  */
-public class Progression extends TXMResult	{
+public class Progression extends ChartResult	{
 
-	/** The corpus. */
-	Corpus corpus;
+	/**
+	 * The corpus.
+	 */
+	protected Corpus corpus;
 
 	/** The queries. */
 	List<Query> queries;
@@ -112,6 +113,17 @@
 	/** The bandemultiplier. */
 	private float bandemultiplier;
 
+	
+	/** The norep. */
+	public static int norep = 1;
+
+	/** The prefix r. */
+	public static String prefixR = "Progression"; //$NON-NLS-1$
+
+
+
+	
+	
 	/**
 	 * Instantiates a new progression.
 	 *
@@ -150,16 +162,42 @@
 		}
 	}
 
+	
 	/**
-	 * Compute.
+	 * Computes.
 	 *
 	 * @return true, if successful
 	 * @throws CqiClientException the cqi client exception
 	 * @throws CqiServerError 
 	 * @throws IOException 
 	 */
-	public boolean _compute() throws Exception {
-		return stepQueries() && stepStructuralUnits() && stepFinalize();
+	protected boolean _compute(boolean update) throws Exception {
+		
+		this.subTask("processing queries");
+		if (!stepQueries()) {
+			System.out.println(ProgressionCoreMessages.ComputeProgression_3);
+			return false;
+		}
+		
+		if (this.isCanceled())	{
+			return false;
+		}
+		this.worked(10);
+
+		
+		this.subTask("processing structural units");
+		if (!stepStructuralUnits() || this.isCanceled())	{
+			return false;
+		}
+		this.worked(20);
+
+		this.subTask("finalizing");
+		if (!stepFinalize() || this.isCanceled())	{
+			return false;
+		}
+		this.worked(20);
+
+		return true;
 	}
 
 	/**
@@ -194,8 +232,7 @@
 	 *
 	 * @throws CqiClientException the cqi client exception
 	 */
-	public boolean stepQueries() throws CqiClientException
-	{
+	public boolean stepQueries() throws CqiClientException	{
 		maxX = corpus.getSize();
 		int npositions = 0;
 		for (Query query : queries) {
@@ -222,8 +259,16 @@
 			for (Match m : matches) {
 				positions[i++] = m.getStart();
 				npositions++;
+				this.worked(1);
+				
+				// FIXME: long process test for Thread user canceling
+				System.err.println("Progression.stepQueries(): fixme: simulating a long process for canceling tests purpose.");
+				for(long j = 0; j < 100000000L; j++)	{
+					;
+				}
+
+				
 			}
-			result.drop();
 		}
 		return npositions > 0;
 	}
@@ -235,8 +280,7 @@
 	 * @throws CqiServerError 
 	 * @throws IOException 
 	 */
-	public boolean stepStructuralUnits() throws CqiClientException, IOException, CqiServerError
-	{
+	public boolean stepStructuralUnits() throws CqiClientException, IOException, CqiServerError	{
 		// structure query
 		if (structure != null) {
 			Query query = new Query("<" + structure.getName() + ">[]"); //$NON-NLS-1$ //$NON-NLS-2$
@@ -313,8 +357,7 @@
 	 *
 	 * @throws CqiClientException the cqi client exception
 	 */
-	public boolean stepFinalize() throws CqiClientException
-	{
+	public boolean stepFinalize() throws CqiClientException	{
 		if (corpus instanceof Subcorpus) {
 			List<Match> matches = ((Subcorpus) corpus).getMatches();
 			if (matches.size() == 0) {
@@ -338,13 +381,6 @@
 		return true;
 	}
 
-	/** The norep. */
-	public static int norep = 1;
-
-	/** The prefix r. */
-	public static String prefixR = "Progression"; //$NON-NLS-1$
-
-
 	/**
 	 * 
 	 * @param outfile
@@ -597,7 +633,9 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
+		// FIXME: not yet implemented
+		System.err.println("Progression.canCompute(): not yet implemented.");
 		return corpus != null;
 	}
 
Index: tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionChartCreator.java
===================================================================
--- tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionChartCreator.java	(revision 527)
+++ tmp/org.txm.progression.core/src/org/txm/progression/core/chartsengine/r/RProgressionChartCreator.java	(revision 528)
@@ -24,17 +24,8 @@
  */
 public class RProgressionChartCreator extends RChartCreator implements ProgressionChartCreator {
 
-	public RProgressionChartCreator() {
-		// TODO Auto-generated constructor stub
-	}
 
 	@Override
-	public Object createChart(TXMResult result) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	@Override
 	public File createChartFile(TXMResult result, File file) {
 
 		try {
Index: tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java
===================================================================
--- tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java	(revision 527)
+++ tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/functions/TextsBalance.java	(revision 528)
@@ -10,12 +10,8 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.txm.Toolbox;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.core.results.TXMParameters;
-
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.searchengine.cqp.AbstractCqiClient;
 import org.txm.searchengine.cqp.CQPEngine;
 import org.txm.searchengine.cqp.NetCqiClient;
@@ -36,7 +32,7 @@
  * @author sjacquot
  *
  */
-public class TextsBalance extends TXMResult {
+public class TextsBalance extends ChartResult {
 	
 	HashMap<Integer, Comparable[]> dataset;
 	
@@ -99,7 +95,7 @@
 	 * @param groupByTexts
 	 * @throws CqiClientException
 	 */
-	public boolean _compute() {
+	protected boolean _compute(boolean update) {
 		
 		this.name = su.getName() + "@" + suPropertyName + " (group by texts = " + groupByTexts + ")";
 		if (suPropertyName == null || suPropertyName.length() == 0) return false;
@@ -307,7 +303,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return getCorpus() != null;
 	}
 }
Index: tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/r/RBalanceSpiderChartCreator.java
===================================================================
--- tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/r/RBalanceSpiderChartCreator.java	(revision 527)
+++ tmp/org.txm.textsbalance.core/src/org/txm/textsbalance/core/chartsengine/r/RBalanceSpiderChartCreator.java	(revision 528)
@@ -13,11 +13,6 @@
 		// TODO Auto-generated constructor stub
 	}
 
-	@Override
-	public Object createChart(TXMResult result) {
-		// TODO Auto-generated method stub
-		return null;
-	}
 
 	@Override
 	public File createChartFile(TXMResult result, File file) {
Index: tmp/org.txm.concordance.core/src/TestConcordance.java
===================================================================
--- tmp/org.txm.concordance.core/src/TestConcordance.java	(revision 527)
+++ tmp/org.txm.concordance.core/src/TestConcordance.java	(revision 528)
@@ -104,7 +104,7 @@
 					leftCViewProperties, rightCViewProperties, keywordViewProperties,
 					referencePattern, refAnalysePattern, 
 					leftContextSize, rightContextSize);
-			conc.compute();
+			conc.compute(false);
 			conc.getLines(0, conc.getNLines());
 			
 			if (sortBy != null) {
Index: tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java
===================================================================
--- tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java	(revision 527)
+++ tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java	(revision 528)
@@ -42,7 +42,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.concordance.core.functions.comparators.LineComparator;
 import org.txm.concordance.core.messages.ConcordanceMessages;
 import org.txm.concordance.core.preferences.ConcordancePreferences;
@@ -264,7 +263,7 @@
 	 * @throws CqiClientException 
 	 */
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		this.queryResult = this.getCorpus().query(pQuery, pQuery.getQueryString()
 				.replace(" ", "_") + "_concordance", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
 
@@ -1507,7 +1506,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return getCorpus() != null;
 	}
 
Index: tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java
===================================================================
--- tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java	(revision 527)
+++ tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java	(revision 528)
@@ -8,7 +8,6 @@
 import org.txm.chartsengine.core.results.IChartResult;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.index.core.functions.Index;
 import org.txm.index.core.functions.Line;
 import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
@@ -213,7 +212,7 @@
 	}
 
 	@Override
-	public boolean _compute() {
+	protected boolean _compute(boolean update) {
 		// from corpus
 		if (source instanceof Corpus)	{// TODO: source must always be an Index because the corpus source produces an Index 
 			try {
@@ -236,7 +235,7 @@
 					corpus.addResult(index);
 				}
 
-				index.compute(monitor);
+				index.compute(false, monitor);
 				
 				index.addResult(this);
 					
@@ -264,7 +263,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return source != null;
 	}
 
Index: tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/chartsengine/r/RWordCloudChartCreator.java
===================================================================
--- tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/chartsengine/r/RWordCloudChartCreator.java	(revision 527)
+++ tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/chartsengine/r/RWordCloudChartCreator.java	(revision 528)
@@ -2,10 +2,9 @@
 
 import java.io.File;
 
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
 import org.txm.chartsengine.r.core.RChartCreator;
 import org.txm.chartsengine.r.core.RChartsEngine;
+import org.txm.core.results.TXMResult;
 import org.txm.statsengine.core.StatException;
 import org.txm.statsengine.r.core.RWorkspace;
 import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
@@ -14,11 +13,7 @@
 
 public class RWordCloudChartCreator extends RChartCreator {
 
-	public RWordCloudChartCreator() {
-		// TODO Auto-generated constructor stub
-	}
 
-
 	@Override
 	public File createChartFile(TXMResult result, File file) {
 		
Index: tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java
===================================================================
--- tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java	(revision 527)
+++ tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java	(revision 528)
@@ -261,7 +261,7 @@
 
 						index.setParameters(query, properties, Fmin, Fmax, Tmax, nLines);
 
-						if (index.validateParameters() && index.isDirty()) {
+						if (index.canCompute() && index.isDirty()) {
 
 							title = NLS.bind(IndexUIMessages.IndexEditor_2, new Object[]{
 									query.getQueryString(), properties, index.getCorpus().getName()});
@@ -272,7 +272,7 @@
 							System.out.println(title);
 							Log.info("Start computing Index...");
 
-							index.compute(this);
+							index.compute(false, this);
 						} else {
 							return Status.CANCEL_STATUS;
 						}
@@ -380,7 +380,7 @@
 		paramArea.setLayout(new FormLayout());
 		
 		// info&navigation panel
-		final Composite infosArea = this.topToolBar.installGroup("Infos", "Informations and Navigation", null);
+		final Composite infosArea = this.topToolBar.installGroup("Infos", "Informations and Navigation", null, true);
 
 		Composite resultArea = this.getDisplayArea();
 
Index: tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java
===================================================================
--- tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java	(revision 527)
+++ tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartsEngine.java	(revision 528)
@@ -9,12 +9,13 @@
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.Platform;
-import org.txm.Toolbox;
 import org.txm.chartsengine.core.messages.ChartsEngineCoreMessages;
 import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.chartsengine.core.results.IChartResult;
 import org.txm.core.preferences.TBXPreferences;
 import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
 import org.txm.utils.logger.Log;
 
 
@@ -139,6 +140,20 @@
 	}
 
 	/**
+	 * Gets a list of all installed chart creators for the specified result. 
+	 * @param resultDataType
+	 * @return
+	 */
+	public ArrayList<ChartCreator> getChartCreators(ChartResult result)	{
+		ArrayList<ChartCreator> chartCreators = new ArrayList<ChartCreator>();
+		HashMap<String, ChartCreator> map = this.chartCreators.get(result.getClass());
+		if(map != null)	{
+			chartCreators.addAll(map.values());
+		}
+		return chartCreators;
+	}
+	
+	/**
 	 * Adds a chart creator for the specified result data type and chart type.
 	 * @param resultDataType
 	 * @param chartCreator
@@ -288,6 +303,7 @@
 				
 				if(chartsEngineClass.equals(chartCreator.getChartsEngineClass()))	{
 					chartCreator.setFileNamePrefix(contributions[i].getAttribute("fileNamePrefix")); //$NON-NLS-1$
+					chartCreator.setChartType(contributions[i].getAttribute("chartType")); //$NON-NLS-1$
 					this.addChartCreator(chartCreator.getResultDataClass(), chartCreator, contributions[i].getAttribute("chartType")); //$NON-NLS-1$
 				}
 			}
@@ -369,6 +385,31 @@
 	 * @param outputFormat
 	 * @return
 	 */
+	// FIXME: original code
+//	public File createChartFile(TXMResult result, File file, String outputFormat)	{
+//		// FIXME : bad ? Switch the current charts engine output format, export the chart, and then roll back the output format
+//		String oldOutputFormat = this.outputFormat;
+//		this.setOutputFormat(outputFormat);
+//		
+//		
+//		Object chart = this.getChartCreator(result.getClass()).createChart(result);
+//		
+//		
+//		file = this.createChartFile(chart, file);
+//		//this.setOutputFormat(oldOutputFormat);
+//		this.outputFormat = oldOutputFormat;
+//		return file;
+//	}
+
+	
+	/**
+	 * Creates a chart according to the specified result and output format and writes it in the specified file.
+	 * @param result
+	 * @param file
+	 * @param outputFormat
+	 * @return
+	 */
+	//FIXME: check that modification works well
 	public File createChartFile(IChartResult result, File file, String outputFormat)	{
 		// FIXME : bad ? Switch the current charts engine output format, export the chart, and then roll back the output format
 		String oldOutputFormat = this.outputFormat;
@@ -378,6 +419,7 @@
 		this.outputFormat = oldOutputFormat;
 		return file;
 	}
+	
 
 	/**
 	 * Exports the chart to the specified file. Also crops the image according to the specified drawing area values.
@@ -511,4 +553,46 @@
 	public boolean isDirectComputing() {
 		return directComputing;
 	} 
+	
+	
+	/**
+	 * 
+	 * @param result
+	 * @param chartType
+	 * @return
+	 */
+	public Object createChart(ChartResult result, String chartType)	{
+		Object chart = null;
+		ChartCreator chartCreator = this.getChartCreator(result.getClass(), chartType);
+		if(chartCreator != null)	{
+			chart = chartCreator.createChart(result);
+		}
+		return chart;
+	}
+
+	/**
+	 * 
+	 * @param result
+	 * @return
+	 */
+	public Object createChart(ChartResult result)	{
+		return this.createChart(result, result.getChartType());
+	}
+
+	
+	
+	
+	/**
+	 * 
+	 * @param chart
+	 * @param result
+	 */
+	public void updateChart(Object chart, ChartResult result)	{
+		ChartCreator chartCreator = this.getChartCreator(result.getClass(), result.getChartType());
+		if(chartCreator != null)	{
+			chartCreator.updateChart(chart, result);
+		}
+	}
+	
+	
 }
Index: tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartCreator.java
===================================================================
--- tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartCreator.java	(revision 527)
+++ tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/ChartCreator.java	(revision 528)
@@ -37,6 +37,11 @@
 	protected String fileNamePrefix;
 	
 	/**
+	 * A string representing the chart type created by this creator.
+	 */
+	protected String chartType;
+	
+	/**
 	 * 
 	 */
 	public ChartCreator() {
@@ -144,4 +149,20 @@
 	public String getFileNamePrefix() {
 		return fileNamePrefix;
 	}
+
+
+	/**
+	 * @return the chartType
+	 */
+	public String getChartType() {
+		return chartType;
+	}
+
+
+	/**
+	 * @param chartType the chartType to set
+	 */
+	public void setChartType(String chartType) {
+		this.chartType = chartType;
+	}
 }
Index: tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java
===================================================================
--- tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java	(revision 527)
+++ tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java	(revision 528)
@@ -3,6 +3,8 @@
  */
 package org.txm.chartsengine.core.results;
 
+import org.txm.chartsengine.core.ChartCreator;
+import org.txm.chartsengine.core.ChartsEngine;
 import org.txm.core.results.TXMResult;
 
 /**
@@ -13,6 +15,16 @@
 public abstract class ChartResult extends TXMResult implements IChartResult {
 
 	/**
+	 * The chart object.
+	 */
+	protected Object chart;
+	
+	/**
+	 * The chart type;
+	 */
+	protected String chartType;
+	
+	/**
 	 * 
 	 * @param parent
 	 */
@@ -32,4 +44,74 @@
 	    return clone;
 	}
 	
+	/**
+	 * 
+	 * @param update
+	 * @return
+	 * @throws Exception
+	 */
+	public boolean computeChart(boolean update) throws Exception {
+
+		ChartCreator chartCreator = ChartsEngine.getCurrent().getChartCreator(this.getClass(), chartType);
+		if(chartCreator != null)	{
+			
+			if(update)	{
+				// FIXME: debug
+				System.err.println("ChartResult._compute(): updating chart.");
+				
+				chartCreator.updateChart(this.chart, this);
+			}
+			else	{
+				
+				// FIXME: debug
+				System.err.println("ChartResult._compute(): creating chart.");
+				
+				this.chart =  chartCreator.createChart(this);				
+			}
+			
+			this.dirty = false;
+			return true;
+			
+		}
+		return false;
+	}
+	
+	
+	
+	/**
+	 * @return the chart
+	 */
+	public Object getChart() {
+		return chart;
+	}
+
+
+	/**
+	 * @return the chartType
+	 */
+	public String getChartType() {
+		return chartType;
+	}
+
+
+	/**
+	 * @param chartType the chartType to set
+	 */
+	public void setChartType(String chartType) {
+		// set to null to match the way that the chart engine returns the creator
+		if(chartType.equals(this.getClass().getName()))	{
+			chartType = null;
+		}
+		this.chartType = chartType;
+	}
+	
+	
+
+	// FIXME
+//	public Object createChart(IProgressMonitor monitor, String chartType)	{
+//		Object chart = null;
+//		ChartCreator chartCreator = ChartsEngine.getCurrent().getChartCreator(this.getClass(), chartType);
+//		return chart;
+//	}
+	
 }
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/selection/Selection.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/selection/Selection.java	(revision 527)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/selection/Selection.java	(revision 528)
@@ -32,11 +32,9 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.core.messages.TXMCoreMessages;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
-
 import org.txm.metadatas.Metadata;
 import org.txm.metadatas.MetadataGroup;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
@@ -491,12 +489,12 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return corpus != null;
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		System.out.println("Selection.compute() not implemented");
 		return false;
 	}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/summary/Summary.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/summary/Summary.java	(revision 527)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/summary/Summary.java	(revision 528)
@@ -260,12 +260,12 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return corpus != null;
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		System.out.println("Summary.compute() not implemented");
 		return false;
 	}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/preview/Preview.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/preview/Preview.java	(revision 527)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/preview/Preview.java	(revision 528)
@@ -4,10 +4,8 @@
 import java.util.Collection;
 import java.util.List;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
-
 import org.txm.searchengine.cqp.corpus.Corpus;
 import org.txm.searchengine.cqp.corpus.Partition;
 import org.txm.searchengine.cqp.corpus.Property;
@@ -89,12 +87,12 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return corpus != null;
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		if (partition != null) {
 			return computePartition();
 		} else {
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/diagnostic/Diagnostic.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/diagnostic/Diagnostic.java	(revision 527)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/diagnostic/Diagnostic.java	(revision 528)
@@ -45,7 +45,6 @@
 import org.txm.core.messages.TXMCoreMessages;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.objects.Base;
 import org.txm.searchengine.cqp.AbstractCqiClient;
 import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
@@ -615,7 +614,7 @@
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		if (monitor != null) monitor.beginTask("Computing informations...", 3);
 		stepGeneralInfos();
 		if (monitor != null) monitor.worked(1);
@@ -628,7 +627,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return corpus != null;
 	}
 }
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java	(revision 527)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java	(revision 528)
@@ -717,12 +717,12 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return getCorpus() != null;
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		// TODO Auto-generated method stub
 		return false;
 	}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 527)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/MainCorpus.java	(revision 528)
@@ -40,6 +40,7 @@
 
 import org.txm.Toolbox;
 import org.txm.core.messages.TXMCoreMessages;
+import org.txm.core.preferences.___CorpusScope;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.objects.Base;
 import org.txm.objects.BaseParameters;
@@ -80,6 +81,7 @@
 		super(cqpId);
 		this.motherMainCorpus = this;
 		this.name = cqpId;
+		
 	}
 
 	/**
@@ -336,10 +338,32 @@
 	@Override
 	public boolean load() {
 		boolean ret = super.load();
+		
+		// FIXME: test to create a project scope
+//		CorpusScope scope = new CorpusScope(this.getName(), this.getBaseDirectory());
+//		CorpusScope.addScope(scope);
+		
 		return ret;
 	}
 
+
 	/* (non-Javadoc)
+	 * @see org.txm.objects.TxmObject#delete()
+	 */
+	@Override
+	public boolean delete() {
+		removeFromCWB();
+		Base b = this.getBase();
+		if (b != null) b.delete();
+		
+		// FIXME: test to remove the project scope
+//		CorpusScope.removeScope(this.getName());
+
+		
+		return super.delete();
+	}
+	
+	/* (non-Javadoc)
 	 * @see org.txm.objects.TxmObject#getParent()
 	 */
 	@Override
@@ -356,16 +380,6 @@
 		this.parent = base;
 	}
 
-	/* (non-Javadoc)
-	 * @see org.txm.objects.TxmObject#delete()
-	 */
-	@Override
-	public boolean delete() {
-		removeFromCWB();
-		Base b = this.getBase();
-		if (b != null) b.delete();
-		return super.delete();
-	}
 
 	/**
 	 * Removes the from cwb.
@@ -566,12 +580,12 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return true;
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		// TODO Auto-generated method stub
 		return false;
 	}
Index: tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java
===================================================================
--- tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 527)
+++ tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java	(revision 528)
@@ -524,7 +524,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		// TODO Auto-generated method stub
 		return false;
 	}
Index: tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/handlers/ComputeCA.java
===================================================================
--- tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/handlers/ComputeCA.java	(revision 527)
+++ tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/handlers/ComputeCA.java	(revision 528)
@@ -152,7 +152,7 @@
 			else 
 				CorporaView.refresh();
 
-			ca.compute();
+			ca.compute(false);
 			return open(ca);
 
 		} catch (Throwable e) {
Index: tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java
===================================================================
--- tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java	(revision 527)
+++ tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/editors/CAEditor.java	(revision 528)
@@ -202,7 +202,7 @@
 			// Set the parent multi pages editor of the CA factorial map editor to activate it from the child editor
 			caFactorialMapEditorPart.setParentMultiPagesEditor(this);
 
-			caFactorialMapEditorPart.createChart();
+			caFactorialMapEditorPart.createChartContainer();
 			caFactorialMapEditorPart.createPartControl(AFCgraph); // must be called AFTER createChart() because the initItemListener checks if getChart() is null
 			caFactorialMapEditorPart.loadChart();
 			caFactorialMapEditorPart.refresh();
@@ -324,8 +324,9 @@
 	 */
 	public void initCASingularValuesBarChartEditor()	{
 
+		// FIXME: need to create ChartResult for CASingularValues + some ChartCreators 
 		// Editor part
-		EditorPart caSingularValuesEditorPart = SWTChartsComponentsProvider.getCurrent().createChartEditor(ca, "Singular Values"); //$NON-NLS-1$
+		EditorPart caSingularValuesEditorPart = new ChartEditorPart(SWTChartsComponentsProvider.getCurrent().createChartEditorInput(ca, "Singular Values")); //$NON-NLS-1$ 
 		editors.add(caSingularValuesEditorPart);
 
 		// Editor input
@@ -676,7 +677,7 @@
 	public void computeResult() {
 		if (ca != null) {
 			try {
-				if (ca.validateParameters() && ca.isDirty())
+				if (ca.canCompute() && ca.isDirty())
 					ca.stepCompute();
 			} catch (StatException e) {
 				System.out.println("Error: could not compute CA: "+e.getLocalizedMessage());
Index: tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java
===================================================================
--- tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java	(revision 527)
+++ tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/views/RVariablesView.java	(revision 528)
@@ -60,7 +60,7 @@
 import org.eclipse.ui.part.ViewPart;
 import org.txm.Toolbox;
 import org.txm.ca.core.functions.CA;
-import org.txm.cah.core.functions.CAH;
+import org.txm.cah.core.functions.AHC;
 import org.txm.concordance.core.functions.Concordance;
 import org.txm.cooccurrence.core.functions.Cooccurrence;
 import org.txm.core.results.TXMResult;
@@ -372,7 +372,7 @@
 				return IImageKeys.getImage(IImageKeys.LEXICALTABLE);
 			else if (element instanceof CA)
 				return IImageKeys.getImage(IImageKeys.ACTION_CORRESPONDANCE_ANALYSIS);
-			else if (element instanceof CAH)
+			else if (element instanceof AHC)
 				return IImageKeys.getImage(IImageKeys.ACTION_CAH);
 			else if (element instanceof Referencer)
 				return IImageKeys.getImage(IImageKeys.ACTION_REFERENCER);
Index: tmp/org.txm.referencer.core/src/org/txm/functions/referencer/Referencer.java
===================================================================
--- tmp/org.txm.referencer.core/src/org/txm/functions/referencer/Referencer.java	(revision 527)
+++ tmp/org.txm.referencer.core/src/org/txm/functions/referencer/Referencer.java	(revision 528)
@@ -56,7 +56,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.core.messages.TXMCoreMessages;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
@@ -202,7 +201,7 @@
 	 *
 	 * @return true, if successful
 	 */
-	public boolean _compute()
+	protected boolean _compute(boolean update)
 	{
 		try {
 			if (this.parent == null || pQuery == null || pPattern == null || pProperty == null)
@@ -530,7 +529,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return getCorpus() != null;
 	}
 
Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesResult.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesResult.java	(revision 527)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitesResult.java	(revision 528)
@@ -39,9 +39,8 @@
 
 import org.rosuda.REngine.REXPMismatchException;
 import org.rosuda.REngine.Rserve.RserveException;
-import org.eclipse.core.runtime.IProgressMonitor;
+import org.txm.chartsengine.core.results.ChartResult;
 import org.txm.core.results.TXMParameters;
-import org.txm.core.results.TXMResult;
 import org.txm.lexicaltable.core.functions.LexicalTable;
 import org.txm.lexicaltable.core.functions.LexicalTableFactory;
 import org.txm.lexicon.core.corpusengine.cqp.Lexicon;
@@ -60,12 +59,13 @@
 import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
 
 /**
- * Hold specificites computation result.
+ * Hold specificities computation result.
  * 
- * @author sloiseau, mdecorde
+ * @author mdecorde
+ * @author sloiseau
  * 
  */
-public class SpecificitesResult extends TXMResult  {
+public class SpecificitesResult extends ChartResult  {
 
 	public static int MAXSPECIF = 1000;
 
@@ -131,7 +131,7 @@
 	protected double[][] selectedSpecificitiesIndex;
 	
 	
-	public boolean _compute() {
+	protected boolean _compute(boolean update) {
 		//TODO: not implemented yet. The specificitesResults should work with a LexicalTable only? if yes, then the calling commands must build it
 		return false;
 	}
@@ -757,7 +757,7 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return table != null;
 	}
 
Index: tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/r/RSpecificitiesBarChartCreator.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/r/RSpecificitiesBarChartCreator.java	(revision 527)
+++ tmp/org.txm.specificities.core/src/org/txm/specificities/core/chartsengine/r/RSpecificitiesBarChartCreator.java	(revision 528)
@@ -23,14 +23,7 @@
  */
 public class RSpecificitiesBarChartCreator extends RChartCreator {
 
-	public RSpecificitiesBarChartCreator() {
-	}
 
-	@Override
-	public Object createChart(TXMResult result) {
-		return null;
-	}
-
 	
 	@Override
 	public File createChartFile(TXMResult result, File file) {
Index: tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Specificites2.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Specificites2.java	(revision 527)
+++ tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Specificites2.java	(revision 528)
@@ -1,14 +1,8 @@
 package org.txm.functions.contrasts;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.core.results.TXMParameters;
 import org.txm.lexicaltable.core.functions.LexicalTable;
 import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
-import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
-import org.txm.searchengine.cqp.corpus.Corpus;
-import org.txm.searchengine.cqp.corpus.Partition;
-import org.txm.searchengine.cqp.corpus.Property;
-import org.txm.searchengine.cqp.corpus.Subcorpus;
 import org.txm.specificities.core.statsengine.r.function.SpecificitiesImpl;
 import org.txm.statsengine.core.StatException;
 import org.txm.statsengine.r.core.RWorkspace;
@@ -21,7 +15,7 @@
 		super(table);
 	}
 
-	public boolean _compute() throws StatException {
+	protected boolean _compute(boolean update) throws StatException {
 		itable = table.getData();
 		colNames = itable.getColNames().asStringsArray();
 		rowNames = itable.getRowNames().asStringsArray();
@@ -56,17 +50,11 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return itable != null;
 	}
 
 	@Override
-	public boolean compute(IProgressMonitor watcher) throws Exception {
-		System.out.println("Specificites2.compute() not implemented");
-		return false;
-	}
-
-	@Override
 	public boolean setParameters(TXMParameters parameters) {
 		return false;
 	}
Index: tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrast.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrast.java	(revision 527)
+++ tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrast.java	(revision 528)
@@ -9,7 +9,6 @@
 
 import org.txm.chartsengine.r.core.themes.DefaultTheme;
 import org.txm.core.results.TXMResult;
-
 import org.txm.lexicaltable.core.functions.LexicalTable;
 import org.txm.lexicaltable.core.functions.LexicalTableFactory;
 import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
@@ -60,7 +59,7 @@
 //		symbol = "Contrast_"+this.getClass().getSimpleName()+"_"+(no_contrast++);
 //	}
 
-	public abstract boolean _compute() throws Exception;
+	protected abstract boolean _compute(boolean update) throws Exception;
 
 	public abstract String getName();
 	
Index: tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/RelativeFrequency.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/RelativeFrequency.java	(revision 527)
+++ tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/RelativeFrequency.java	(revision 528)
@@ -23,7 +23,7 @@
 	}
 
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		itable = table.getData();
 		colNames = itable.getColNames().asStringsArray();
 		rowNames = itable.getRowNames().asStringsArray();
@@ -59,17 +59,11 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return itable != null;
 	}
 
 	@Override
-	public boolean compute(IProgressMonitor watcher) throws Exception {
-		System.out.println("RelativeFrequency.compute() not implemented");
-		return false;
-	}
-
-	@Override
 	public boolean setParameters(TXMParameters parameters) {
 		return false;
 	}
Index: tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/AbsoluteFrequency.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/AbsoluteFrequency.java	(revision 527)
+++ tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/AbsoluteFrequency.java	(revision 528)
@@ -21,7 +21,7 @@
 	}
 
 	@Override
-	public boolean _compute() throws StatException {
+	protected boolean _compute(boolean update) throws StatException {
 		itable = table.getData();
 		colNames = itable.getColNames().asStringsArray();
 		rowNames = itable.getRowNames().asStringsArray();
@@ -54,13 +54,8 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return itable != null;
 	}
 
-	@Override
-	public boolean compute(IProgressMonitor watcher) throws Exception {
-		System.out.println("AbsoluteFrequency.compute() not implemented");
-		return false;
-	}
 }
Index: tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrasts.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrasts.java	(revision 527)
+++ tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrasts.java	(revision 528)
@@ -39,7 +39,7 @@
 	public boolean compute() throws Exception {
 		for (Contrast m : mesures) {
 			System.out.println(TXMCoreMessages.Contrasts_0+m.getName());
-			m.compute();
+			m.compute(false);
 		}
 		return true;
 	}
Index: tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Chi2.java
===================================================================
--- tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Chi2.java	(revision 527)
+++ tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Chi2.java	(revision 528)
@@ -1,14 +1,8 @@
 package org.txm.functions.contrasts;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.core.results.TXMParameters;
 import org.txm.lexicaltable.core.functions.LexicalTable;
 import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
-import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
-import org.txm.searchengine.cqp.corpus.Corpus;
-import org.txm.searchengine.cqp.corpus.Partition;
-import org.txm.searchengine.cqp.corpus.Property;
-import org.txm.searchengine.cqp.corpus.Subcorpus;
 import org.txm.statsengine.core.StatException;
 import org.txm.statsengine.r.core.RWorkspace;
 
@@ -26,7 +20,7 @@
 	}
 	
 	@Override
-	public boolean _compute() throws StatException {
+	protected boolean _compute(boolean update) throws StatException {
 		itable = table.getData();
 		colNames = itable.getColNames().asStringsArray();
 		rowNames = itable.getRowNames().asStringsArray();
@@ -64,13 +58,8 @@
 	}
 
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return itable != null;
 	}
 
-	@Override
-	public boolean compute(IProgressMonitor watcher) throws Exception {
-		System.out.println("Chi2.compute() not implemented");
-		return false;
-	}
 }
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/test/CQPBenchmark.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/test/CQPBenchmark.groovy	(revision 527)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/test/CQPBenchmark.groovy	(revision 528)
@@ -42,7 +42,7 @@
 import org.txm.lexicaltable.core.functions.LexicalTable
 import org.txm.objects.Base;
 import org.txm.ca.core.functions.CA
-import org.txm.cah.core.functions.CAH
+import org.txm.cah.core.functions.AHC
 import org.txm.concordance.core.functions.Concordance
 import org.txm.cooccurrence.core.functions.Cooccurrence
 import org.txm.functions.*;
@@ -311,7 +311,7 @@
 	// CAH
 	print " CAH"
 	time = System.currentTimeMillis();
-	CAH cah = new CAH(ca, true, CAH.getDefaultMethod(), CAH.getDefaultMetric(), 4, false)
+	AHC cah = new AHC(ca, true, AHC.getDefaultMethod(), AHC.getDefaultMetric(), 4, false)
 	cah.stepCompute()
 	cah.toSVG(new File(exporttestdir, "dates_cah"),RDevice.SVG);
 	if (firstExecution == 0)
Index: tmp/org.txm.groovy.core/src/groovy/org/txm/export/ExportCAH.groovy
===================================================================
--- tmp/org.txm.groovy.core/src/groovy/org/txm/export/ExportCAH.groovy	(revision 527)
+++ tmp/org.txm.groovy.core/src/groovy/org/txm/export/ExportCAH.groovy	(revision 528)
@@ -1,6 +1,6 @@
 package org.txm.export
 
-import org.txm.cah.core.functions.CAH
+import org.txm.cah.core.functions.AHC
 import org.txm.rcp.views.*
 import org.txm.stat.engine.r.*
 // uncomment this
@@ -25,10 +25,10 @@
 	});
 println("Selected object: "+obj)
 
-if (obj != null && obj instanceof CAH) {
+if (obj != null && obj instanceof AHC) {
 	def rw = RWorkspace.getRWorkspaceInstance()
 	rw.eval("sink(file=\"" + outfile.getAbsolutePath().replace("\\", "\\\\")+"\")")
-	rw.eval("print("+((CAH)obj).getSymbol()+")")
+	rw.eval("print("+((AHC)obj).getSymbol()+")")
 	rw.eval("sink()")
 	println("CAH saved in file: "+outfile)
 }
\ No newline at end of file
Index: tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java
===================================================================
--- tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java	(revision 527)
+++ tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java	(revision 528)
@@ -7,7 +7,6 @@
 import java.util.HashMap;
 import java.util.List;
 
-import org.eclipse.core.runtime.IProgressMonitor;
 import org.txm.core.results.TXMParameters;
 import org.txm.core.results.TXMResult;
 import org.txm.index.core.functions.Index;
@@ -61,7 +60,7 @@
 	}
 	
 	@Override
-	public boolean _compute() throws Exception {
+	protected boolean _compute(boolean update) throws Exception {
 		System.out.println("LexicalTable.compute() not implemented");
 		return false;
 	}
@@ -311,7 +310,7 @@
 	}
 	
 	@Override
-	public boolean validateParameters() {
+	public boolean canCompute() {
 		return corpus != null || partition != null; // can be computed on partition or corpus
 	}
 
Index: tmp/org.txm.cah.core/src/org/txm/cah/core/preferences/CAHPreferences.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/preferences/CAHPreferences.java	(revision 527)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/preferences/CAHPreferences.java	(revision 528)
@@ -1,55 +0,0 @@
-package org.txm.cah.core.preferences;
-
-
-import org.eclipse.core.runtime.preferences.DefaultScope;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.service.prefs.Preferences;
-import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
-import org.txm.core.preferences.TXMPreferences;
-
-/**
- * Default preferences initializer.
- * 
- * @author mdecorde
- * @author sjacquot
- *
- */
-public class CAHPreferences extends TXMPreferences {
-
-	// auto populate the preference node qualifier from the current bundle id
-	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(CAHPreferences.class).getSymbolicName();
-
-	/** The Constant DISPLAY. */
-	public static final String DISPLAY_2D = "display_2d"; //$NON-NLS-1$
-	
-	/** The Constant METHOD. */
-	public static final String METHOD = "method"; //$NON-NLS-1$
-	
-	/** The Constant METRIC. */
-	public static final String METRIC = "metric"; //$NON-NLS-1$
-	
-	/** The Constant NCLUSTER. */
-	public static final String N_CLUSTERS = "n_clusters"; //$NON-NLS-1$
-	
-	public static final String COLUMNS_COMPUTING = "columns_computing"; //$NON-NLS-1$
-	
-	public CAHPreferences() {
-		// TODO Auto-generated constructor stub
-	}
-
-	@Override
-	public void initializeDefaultPreferences() {
-		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
-		
-		preferences.putBoolean(DISPLAY_2D, true);
-		preferences.putInt(N_CLUSTERS, 2);
-		preferences.put(METHOD, "ward");
-		preferences.put(METRIC, "euclidean");
-		
-		preferences.putBoolean(COLUMNS_COMPUTING, true);
-		
-		// shared charts rendering preferences
-		ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences);
-	}
-	
-}
Index: tmp/org.txm.cah.core/src/org/txm/cah/core/preferences/AHCPreferences.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/preferences/AHCPreferences.java	(revision 0)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/preferences/AHCPreferences.java	(revision 528)
@@ -0,0 +1,55 @@
+package org.txm.cah.core.preferences;
+
+
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.service.prefs.Preferences;
+import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
+import org.txm.core.preferences.TXMPreferences;
+
+/**
+ * Default preferences initializer.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class AHCPreferences extends TXMPreferences {
+
+	// auto populate the preference node qualifier from the current bundle id
+	public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(AHCPreferences.class).getSymbolicName();
+
+	/** The Constant DISPLAY. */
+	public static final String DISPLAY_2D = "display_2d"; //$NON-NLS-1$
+	
+	/** The Constant METHOD. */
+	public static final String METHOD = "method"; //$NON-NLS-1$
+	
+	/** The Constant METRIC. */
+	public static final String METRIC = "metric"; //$NON-NLS-1$
+	
+	/** The Constant NCLUSTER. */
+	public static final String N_CLUSTERS = "n_clusters"; //$NON-NLS-1$
+	
+	public static final String COLUMNS_COMPUTING = "columns_computing"; //$NON-NLS-1$
+	
+	public AHCPreferences() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public void initializeDefaultPreferences() {
+		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
+		
+		preferences.putBoolean(DISPLAY_2D, true);
+		preferences.putInt(N_CLUSTERS, 2);
+		preferences.put(METHOD, "ward");
+		preferences.put(METRIC, "euclidean");
+		
+		preferences.putBoolean(COLUMNS_COMPUTING, true);
+		
+		// shared charts rendering preferences
+		ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences);
+	}
+	
+}

Property changes on: tmp/org.txm.cah.core/src/org/txm/cah/core/preferences/AHCPreferences.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.cah.core/src/org/txm/cah/core/messages/CAHCoreMessages.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/messages/CAHCoreMessages.java	(revision 527)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/messages/CAHCoreMessages.java	(revision 528)
@@ -1,25 +0,0 @@
-package org.txm.cah.core.messages;
-
-import org.eclipse.osgi.util.NLS;
-import org.txm.utils.messages.Utf8NLS;
-
-public class CAHCoreMessages extends NLS {
-
-	private static final String BUNDLE_NAME = "org.txm.cah.core.messages.messages"; //$NON-NLS-1$
-
-	
-	public static String RESULT_TYPE;
-	
-	public static String ERROR_EXPORT_TXT;
-	public static String LOG_COMPUTE_CAH;
-	
-	
-	
-	static {
-		// initialize resource bundle
-		Utf8NLS.initializeMessages(BUNDLE_NAME, CAHCoreMessages.class);
-	}
-
-	private CAHCoreMessages() {
-	}
-}
Index: tmp/org.txm.cah.core/src/org/txm/cah/core/messages/AHCCoreMessages.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/messages/AHCCoreMessages.java	(revision 0)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/messages/AHCCoreMessages.java	(revision 528)
@@ -0,0 +1,25 @@
+package org.txm.cah.core.messages;
+
+import org.eclipse.osgi.util.NLS;
+import org.txm.utils.messages.Utf8NLS;
+
+public class AHCCoreMessages extends NLS {
+
+	private static final String BUNDLE_NAME = "org.txm.cah.core.messages.messages"; //$NON-NLS-1$
+
+	
+	public static String RESULT_TYPE;
+	
+	public static String ERROR_EXPORT_TXT;
+	public static String LOG_COMPUTE_CAH;
+	
+	
+	
+	static {
+		// initialize resource bundle
+		Utf8NLS.initializeMessages(BUNDLE_NAME, AHCCoreMessages.class);
+	}
+
+	private AHCCoreMessages() {
+	}
+}

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

Index: tmp/org.txm.cah.core/src/org/txm/cah/core/functions/CAH.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/functions/CAH.java	(revision 527)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/functions/CAH.java	(revision 528)
@@ -1,605 +0,0 @@
-// 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.cah.core.functions;
-
-import java.io.File;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.rosuda.REngine.REXP;
-import org.rosuda.REngine.REXPMismatchException;
-import org.txm.ca.core.functions.CA;
-import org.txm.cah.core.messages.CAHCoreMessages;
-import org.txm.cah.core.preferences.CAHPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMParameters;
-import org.txm.core.results.TXMResult;
-import org.txm.lexicaltable.core.functions.LexicalTable;
-import org.txm.statsengine.r.core.RWorkspace;
-import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
-import org.txm.utils.logger.Log;
-
-/**
- * The Class CAH.
- * 
- * @author mdecorde
- * @author sjacquot
- *
- */
-public class CAH extends TXMResult	{
-
-	/** The metric. */
-	String pMetric = "euclidean"; // euclidean, manhattan //$NON-NLS-1$
-
-	/** The method. */
-	String pMethod = "ward"; // METHODS <- c("average", "single", "complete", "ward", "weighted", "flexible") //$NON-NLS-1$
-
-	/** The N cluster. */
-	Integer pNCluster = 3;
-
-	/** if true classify columns values. */
-	Boolean pColumns = true;
-
-	/** The symbol. */
-	String symbol = null;
-
-	/** The CA symbol target. */
-	String target;
-
-	/**
-	 * The coordinates of the clusters.
-	 */
-	protected double[][] clusterCoords = null;
-
-	/**
-	 * The numbers of the clusters.
-	 */
-	protected int[] clusterNumbers = null;
-
-	/**
-	 * The names of the cluster rows.
-	 */
-	protected String[] clusterRowNames = null;
-
-	/**
-	 * The ordered names of the cluster rows.
-	 */
-	protected String[] clusterOrderedRowNames = null;
-
-	/**
-	 * The cluster tree heights.
-	 */
-	protected double[] clusterHeights = null;
-
-	/**
-	 * The cluster tree merges.
-	 */
-	protected double[][] clusterMerges = null;
-
-	/**
-	 * The inertia gains.
-	 */
-	protected double[] inertiaGains = null;
-
-	protected CA ca;
-	protected LexicalTable table;
-
-	/**
-	 * Instantiates a new cAH.
-	 *
-	 * @param ca the ca
-	 * @param col the col
-	 * @param pMethod the method
-	 * @param pMetric the metric
-	 * @param pNCluster the n cluster
-	 * @param display2D the display mode
-	 */
-	public CAH(CA ca)	{
-		super(ca);
-		this.ca = ca;
-		this.table = ca.getLexicalTable();
-		this.target = ca.getSymbol();
-	}
-
-	public void setParameters(Boolean columns, String metric, Integer nCluster, String method) {
-		if (columns != null) this.pColumns = columns;
-		if (metric != null) this.pMetric = metric;
-		if (nCluster != null) this.pNCluster = nCluster;
-		if (method != null) this.pMethod = method;
-		dirty = true;
-	}
-
-	@Override
-	public boolean setParameters(TXMParameters parameters) {
-		this.parameters = parameters;
-		
-		try {
-			Boolean columns = this.getBooleanParameterValue(CAHPreferences.COLUMNS_COMPUTING);
-			String metric = this.getStringParameterValue(CAHPreferences.METRIC);
-			Integer nCluster = this.getIntParameterValue(CAHPreferences.N_CLUSTERS);
-			String method = this.getStringParameterValue(CAHPreferences.METHOD);
-			this.setParameters(columns, metric, nCluster, method);
-		} catch(Exception e) {
-			System.out.println("Error while setting CAH parameters: "+e.getLocalizedMessage());
-			return false;
-		}
-		return true;
-	}
-
-	/**
-	 * Resets the cached data so the next getter calls will request the values from R.
-	 */
-	public void resetCache() {
-		this.clusterCoords = null;
-		this.clusterNumbers = null;
-		this.clusterRowNames = null;
-		this.clusterOrderedRowNames = null;
-		this.clusterHeights = null;
-		this.clusterMerges = null;
-	}
-
-	/**
-	 * Gets the symbol.
-	 *
-	 * @return the symbol
-	 */
-	public String getSymbol() {
-		return symbol;
-	}
-
-	/**
-	 * Gets the methods.
-	 *
-	 * @return the methods
-	 */
-	public static String[] getMethods() {
-		String[] methods = {"average", "single", "complete", "ward", "weighted", "flexible"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
-		return methods;
-	}
-
-	/**
-	 * Gets the metrics.
-	 *
-	 * @return the metrics
-	 */
-	public static String[] getMetrics() {
-		String[] metrics = {"euclidean", "manhattan"}; //$NON-NLS-1$ //$NON-NLS-2$
-		return metrics;
-	}
-
-	/** The prefix r. */
-	protected static String prefixR = "FactoMineRAHC"; //$NON-NLS-1$
-
-	/** The nocah. */
-	protected static int nocah = 1;
-
-	@Override
-	public boolean _compute()	{
-
-		Log.info("Computing CAH...");
-		try {
-			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-
-			String colOrLine = "columns"; //$NON-NLS-1$
-			if (!pColumns)
-				colOrLine ="rows"; //$NON-NLS-1$
-
-			if (symbol == null)	{
-				symbol = prefixR+(nocah++);
-			}
-
-			rw.eval("library(FactoMineR)"); //$NON-NLS-1$
-
-
-			rw.eval(symbol +" <- HCPC("+target + //$NON-NLS-1$
-					", cluster.CA=\""+colOrLine+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
-					", nb.clust="+pNCluster + //$NON-NLS-1$
-					", metric=\""+pMetric+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
-					", method=\""+pMethod+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
-					", graph=FALSE)"); //$NON-NLS-1$
-		} catch(RWorkspaceException e) {
-			System.out.println("Failed to compute CAH: "+e);
-			Log.printStackTrace(e);
-			return false;
-		}
-
-		// FIXME: persistence
-		TXMPreferences.putLocalInt(this, CAHPreferences.N_CLUSTERS, this.pNCluster);
-		TXMPreferences.putLocalBoolean(this, CAHPreferences.COLUMNS_COMPUTING, this.pColumns);
-
-		// Reset the cached data
-		this.resetCache();
-		dirty = false;
-		return true;
-	}
-
-	/**
-	 *
-	 * @param outfile
-	 * @param encoding
-	 * @return
-	 */
-	//FIXME: extract to future exporter extension
-	@Deprecated
-	public boolean toTxt(File outfile, String encoding)	{
-		boolean ret = true;
-		acquireSemaphore();
-		RWorkspace rw;
-		try {
-			rw = RWorkspace.getRWorkspaceInstance();
-			rw.eval("sink(file=\"" + outfile.getAbsolutePath().replace("\\", "\\\\")+"\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-			rw.eval("print("+symbol+"$call)"); //$NON-NLS-1$ //$NON-NLS-2$
-			rw.eval("sink()"); //$NON-NLS-1$
-		} catch (RWorkspaceException e) {
-			// TODO Auto-generated catch block
-			System.out.println(CAHCoreMessages.ERROR_EXPORT_TXT + e);
-			org.txm.utils.logger.Log.printStackTrace(e);
-			ret = false;
-		} finally {
-			releaseSemaphore();
-		}
-		return true;
-	}
-
-	//FIXME: extract to future exporter extension
-	@Deprecated
-	public boolean toTxt(File outfile, String encoding, String colsep, String txtsep) {
-		return toTxt(outfile, encoding);
-	}
-
-	/**
-	 * Gets the default method.
-	 *
-	 * @return the default method
-	 */
-	public static String getDefaultMethod() {
-		return "ward"; //$NON-NLS-1$
-	}
-
-	/**
-	 * Gets the default metric.
-	 *
-	 * @return the default metric
-	 */
-	public static String getDefaultMetric() {
-		return "euclidean"; //$NON-NLS-1$
-	}
-
-	@Override
-	public void clean() {
-		// TODO Auto-generated method stub
-
-	}
-
-	/**
-	 * Gets the clusters coordinates.
-	 * @return the clusters coordinates
-	 */
-	public double[][] getClusterCoords() {
-		if (this.clusterCoords == null) {
-			try {
-
-				// FIXME: check this code for the CAH 3D chart implementation
-				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-				for(int i = 0; i < 2; i++) { // 2 dimensions
-					REXP sv = rw.extractItemFromListByName(symbol, "data.clust[,"+ (i + 1)+ "]"); //$NON-NLS-1$
-					double[] coords = RWorkspace.toDouble(sv);
-					for(int j = 0; j < coords.length; j++) {
-						if(this.clusterCoords  == null)	{
-							this.clusterCoords = new double[coords.length][2];
-						}
-						this.clusterCoords[j][i] = coords[j];
-					}
-				}
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				org.txm.utils.logger.Log.printStackTrace(e);
-			}
-		}
-		return this.clusterCoords;
-	}
-
-
-	/**
-	 * Gets the clusters numbers.
-	 * @return
-	 */
-	public int[] getClusterNumbers() {
-		if (this.clusterNumbers == null) {
-			try {
-				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-				// FIXME: not sorted version
-				REXP sv = rw.extractItemFromListByName(symbol, "data$clust"); //$NON-NLS-1$
-				// FIXME: sorted version
-				//REXP sv = rw.extractItemFromListByName(symbol, "data$clust[c(" + symbol + "$call$t$tree$order)]"); //$NON-NLS-1$
-				this.clusterNumbers = sv.asIntegers();
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				org.txm.utils.logger.Log.printStackTrace(e);
-			}
-		}
-		return this.clusterNumbers;
-	}
-
-	/**
-	 * Gets the cluster row names.
-	 * @return
-	 */
-	public String[] getClusterRowNames() {
-		if (this.clusterRowNames == null) {
-			try {
-				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-
-				// FIXME: old method, Save the row names in the R data frame
-				//				rw.safeEval(symbol + "$rownames <- rownames(" + symbol + "$data)");
-				//				REXP sv = rw.extractItemFromListByName(symbol, "rownames"); //$NON-NLS-1$
-
-
-				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$labels"); //$NON-NLS-1$
-
-
-				this.clusterRowNames = sv.asStrings();
-
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				org.txm.utils.logger.Log.printStackTrace(e);
-			}
-		}
-		return this.clusterRowNames;
-	}
-
-
-
-	/**
-	 * Gets the cluster orderer row names.
-	 * @return
-	 */
-	public String[] getClusterOrderedRowNames() {
-		if (this.clusterOrderedRowNames == null) {
-			try {
-				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$labels[c(" + symbol + "$call$t$tree$order)]"); //$NON-NLS-1$
-				this.clusterOrderedRowNames = sv.asStrings();
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				org.txm.utils.logger.Log.printStackTrace(e);
-			}
-		}
-		return this.clusterOrderedRowNames;
-	}
-
-
-	/**
-	 * Gets the cluster tree heights.
-	 * @return
-	 */
-	public double[] getClusterTreeHeights() {
-		if (this.clusterHeights == null) {
-			try {
-				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$height"); //$NON-NLS-1$
-				this.clusterHeights = sv.asDoubles();
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				org.txm.utils.logger.Log.printStackTrace(e);
-			}
-		}
-		return this.clusterHeights;
-	}
-
-
-	/**
-	 * Gets the inertia gains.
-	 * @return
-	 */
-	// FIXME: for test purpose, this method is not used for the chart computing
-	public double[] getInertiaGains() {
-		if (this.inertiaGains == null) {
-			try {
-				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-				REXP sv = rw.extractItemFromListByName(symbol, "call$t$inert.gain"); //$NON-NLS-1$
-				// FIXME: tests
-				//			REXP sv = rw.extractItemFromListByName(symbol, "call$t$within"); //$NON-NLS-1$
-
-				this.inertiaGains = sv.asDoubles();
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				org.txm.utils.logger.Log.printStackTrace(e);
-			}
-		}
-		return this.inertiaGains;
-	}
-
-
-	/**
-	 * Gets the cluster tree merges.
-	 * @return
-	 */
-	public double[][] getClusterTreeMerges() {
-		if (this.clusterMerges == null) {
-			try {
-				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$merge"); //$NON-NLS-1$
-				this.clusterMerges = sv.asDoubleMatrix();
-			}
-			catch (Exception e) {
-				// TODO Auto-generated catch block
-				org.txm.utils.logger.Log.printStackTrace(e);
-			}
-		}
-		return this.clusterMerges;
-	}
-
-
-
-
-
-
-	/**
-	 * Sets the metric to use for computing.
-	 * @param metric the metric to set
-	 */
-	public void setMetric(String metric) {
-		this.pMetric = metric;
-	}
-
-	/**
-	 * Sets the method to use for computing
-	 * @param method the method to set
-	 */
-	public void setMethod(String method) {
-		this.pMethod = method;
-	}
-
-	/**
-	 * Sets the computing to columns or rows.
-	 * @param columns the columns to set
-	 */
-	public void setColumnsComputing(boolean columns) {
-		this.pColumns = columns;
-	}
-
-	/**
-	 * Sets the number of clusters to use for computing
-	 * @param nCluster the nCluster to set
-	 */
-	public void setNCluster(int nCluster) {
-		pNCluster = nCluster;
-	}
-
-	/**
-	 * Checks if the computing mode is set as columns. If not, the computing mode is set as rows.
-	 * @return the columns
-	 */
-	public boolean isColumnsComputing() {
-		return pColumns;
-	}
-
-	/**
-	 * Gets the maximum clusters available according to the current computing mode (columns or rows) and according to current source (<code>CA</code> or <code>LexicalTable</code>).
-	 * The maximum numbers of available clusters is for now limited to 16 by this method due of a limitation of FactoMineR plot.HCPC().
-	 * @return the maximum clusters available according to the current computing mode
-	 */
-	public int getMaxClustersCount()	{
-
-		int maxClustersCount = -1;
-
-		try {
-			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
-			REXP sv = rw.eval("min(length(" + symbol + "$data$clust) - 1, 16)"); //$NON-NLS-1$ //$NON-NLS-2$
-			maxClustersCount = sv.asInteger();
-		} catch(Exception e) {
-			System.out.println("Error: "+e.getLocalizedMessage());
-			Log.printStackTrace(e);
-		}
-
-		// FIXME: FactoMineR plot.HCPC doesn't manage more than 16 clusters when tree.barplot=TRUE, therefore we can't plot a SVG with more than that, see ticket #836 then use the code below in ChartsEngine to compute
-		// the real maximum available clusters count
-		//		// CA
-		//		if(this.source instanceof CA)	{
-		//			if(this.columns == true)	{
-		//				maxClustersCount = ((CA)this.source).getColumnsCount() - 1;
-		//			}
-		//			else	{
-		//				maxClustersCount = ((CA)this.source).getRowsCount() - 1;
-		//			}
-		//		}
-		//		// Lexical table
-		//		else if(this.source instanceof LexicalTable)	{
-		//			if(this.columns == true)	{
-		//				maxClustersCount = ((LexicalTable)this.source).getColumnsCount() - 1;
-		//			}
-		//			else	{
-		//				maxClustersCount = ((LexicalTable)this.source).getRowsCount() - 1;
-		//			}
-		//		}
-
-		return maxClustersCount;
-	}
-
-
-
-	@Override
-	public String[] getExportTXTExtensions() {
-		return new String[]{"*.txt"};
-	}
-
-
-	/**
-	 * Returns the number of clusters.
-	 * @return the nCluster
-	 */
-	public int getNCluster() {
-		return pNCluster;
-	}
-
-	public CA getCA() {
-		return ca;
-	}
-
-	public LexicalTable getLexicalTable() {
-		return table;
-	}
-
-
-	@Override
-	public String getName() {
-		return getParent().getName();
-	}
-
-
-	@Override
-	public String getSimpleName() {
-		StringBuffer buffer = new StringBuffer();
-		if (pColumns != null) buffer.append(pColumns?"cols":"rows");
-		if (pMethod != null) buffer.append(" "+pMethod);
-		if (pMetric != null) buffer.append(" "+pMetric);
-		if (pNCluster != null) buffer.append(" "+pNCluster);
-		return this.getName();
-	}
-
-	@Override
-	public String getDetails() {
-		return this.getName();
-	}
-
-	@Override
-	public boolean validateParameters() {
-
-		return ca != null 
-				&& Arrays.binarySearch(CAH.getMethods(), pMethod) >= 0 
-				&& Arrays.binarySearch(CAH.getMetrics(), pMetric) >= 0
-				&& pNCluster >= 2;
-	}
-}
Index: tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java	(revision 0)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java	(revision 528)
@@ -0,0 +1,603 @@
+// 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.cah.core.functions;
+
+import java.io.File;
+import java.util.Arrays;
+
+import org.rosuda.REngine.REXP;
+import org.txm.ca.core.functions.CA;
+import org.txm.cah.core.messages.AHCCoreMessages;
+import org.txm.cah.core.preferences.AHCPreferences;
+import org.txm.chartsengine.core.results.ChartResult;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMParameters;
+import org.txm.lexicaltable.core.functions.LexicalTable;
+import org.txm.statsengine.r.core.RWorkspace;
+import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
+import org.txm.utils.logger.Log;
+
+/**
+ * Agglomerative Hierarchical Clustering.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class AHC extends ChartResult	{
+
+	/** The metric. */
+	String pMetric = "euclidean"; // euclidean, manhattan //$NON-NLS-1$
+
+	/** The method. */
+	String pMethod = "ward"; // METHODS <- c("average", "single", "complete", "ward", "weighted", "flexible") //$NON-NLS-1$
+
+	/** The N cluster. */
+	Integer pNCluster = 3;
+
+	/** if true classify columns values. */
+	Boolean pColumns = true;
+
+	/** The symbol. */
+	String symbol = null;
+
+	/** The CA symbol target. */
+	String target;
+
+	/**
+	 * The coordinates of the clusters.
+	 */
+	protected double[][] clusterCoords = null;
+
+	/**
+	 * The numbers of the clusters.
+	 */
+	protected int[] clusterNumbers = null;
+
+	/**
+	 * The names of the cluster rows.
+	 */
+	protected String[] clusterRowNames = null;
+
+	/**
+	 * The ordered names of the cluster rows.
+	 */
+	protected String[] clusterOrderedRowNames = null;
+
+	/**
+	 * The cluster tree heights.
+	 */
+	protected double[] clusterHeights = null;
+
+	/**
+	 * The cluster tree merges.
+	 */
+	protected double[][] clusterMerges = null;
+
+	/**
+	 * The inertia gains.
+	 */
+	protected double[] inertiaGains = null;
+
+	protected CA ca;
+	protected LexicalTable table;
+
+	/**
+	 * Instantiates a new cAH.
+	 *
+	 * @param ca the ca
+	 * @param col the col
+	 * @param pMethod the method
+	 * @param pMetric the metric
+	 * @param pNCluster the n cluster
+	 * @param display2D the display mode
+	 */
+	public AHC(CA ca)	{
+		super(ca);
+		this.ca = ca;
+		this.table = ca.getLexicalTable();
+		this.target = ca.getSymbol();
+	}
+
+	public void setParameters(Boolean columns, String metric, Integer nCluster, String method) {
+		if (columns != null) this.pColumns = columns;
+		if (metric != null) this.pMetric = metric;
+		if (nCluster != null) this.pNCluster = nCluster;
+		if (method != null) this.pMethod = method;
+		dirty = true;
+	}
+
+	@Override
+	public boolean setParameters(TXMParameters parameters) {
+		this.parameters = parameters;
+		
+		try {
+			Boolean columns = this.getBooleanParameterValue(AHCPreferences.COLUMNS_COMPUTING);
+			String metric = this.getStringParameterValue(AHCPreferences.METRIC);
+			Integer nCluster = this.getIntParameterValue(AHCPreferences.N_CLUSTERS);
+			String method = this.getStringParameterValue(AHCPreferences.METHOD);
+			this.setParameters(columns, metric, nCluster, method);
+		} catch(Exception e) {
+			System.out.println("Error while setting CAH parameters: "+e.getLocalizedMessage());
+			return false;
+		}
+		return true;
+	}
+
+	/**
+	 * Resets the cached data so the next getter calls will request the values from R.
+	 */
+	public void resetCache() {
+		this.clusterCoords = null;
+		this.clusterNumbers = null;
+		this.clusterRowNames = null;
+		this.clusterOrderedRowNames = null;
+		this.clusterHeights = null;
+		this.clusterMerges = null;
+	}
+
+	/**
+	 * Gets the symbol.
+	 *
+	 * @return the symbol
+	 */
+	public String getSymbol() {
+		return symbol;
+	}
+
+	/**
+	 * Gets the methods.
+	 *
+	 * @return the methods
+	 */
+	public static String[] getMethods() {
+		String[] methods = {"average", "single", "complete", "ward", "weighted", "flexible"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+		return methods;
+	}
+
+	/**
+	 * Gets the metrics.
+	 *
+	 * @return the metrics
+	 */
+	public static String[] getMetrics() {
+		String[] metrics = {"euclidean", "manhattan"}; //$NON-NLS-1$ //$NON-NLS-2$
+		return metrics;
+	}
+
+	/** The prefix r. */
+	protected static String prefixR = "FactoMineRAHC"; //$NON-NLS-1$
+
+	/** The nocah. */
+	protected static int nocah = 1;
+
+	@Override
+	protected boolean _compute(boolean update)	{
+
+		Log.info("Computing CAH...");
+		try {
+			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+
+			String colOrLine = "columns"; //$NON-NLS-1$
+			if (!pColumns)
+				colOrLine ="rows"; //$NON-NLS-1$
+
+			if (symbol == null)	{
+				symbol = prefixR+(nocah++);
+			}
+
+			rw.eval("library(FactoMineR)"); //$NON-NLS-1$
+
+
+			rw.eval(symbol +" <- HCPC("+target + //$NON-NLS-1$
+					", cluster.CA=\""+colOrLine+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
+					", nb.clust="+pNCluster + //$NON-NLS-1$
+					", metric=\""+pMetric+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
+					", method=\""+pMethod+"\"" + //$NON-NLS-1$ //$NON-NLS-2$
+					", graph=FALSE)"); //$NON-NLS-1$
+		} catch(RWorkspaceException e) {
+			System.out.println("Failed to compute CAH: "+e);
+			Log.printStackTrace(e);
+			return false;
+		}
+
+		// FIXME: persistence
+		TXMPreferences.putLocalInt(this, AHCPreferences.N_CLUSTERS, this.pNCluster);
+		TXMPreferences.putLocalBoolean(this, AHCPreferences.COLUMNS_COMPUTING, this.pColumns);
+
+		// Reset the cached data
+		this.resetCache();
+		dirty = false;
+		return true;
+	}
+
+	/**
+	 *
+	 * @param outfile
+	 * @param encoding
+	 * @return
+	 */
+	//FIXME: extract to future exporter extension
+	@Deprecated
+	public boolean toTxt(File outfile, String encoding)	{
+		boolean ret = true;
+		acquireSemaphore();
+		RWorkspace rw;
+		try {
+			rw = RWorkspace.getRWorkspaceInstance();
+			rw.eval("sink(file=\"" + outfile.getAbsolutePath().replace("\\", "\\\\")+"\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+			rw.eval("print("+symbol+"$call)"); //$NON-NLS-1$ //$NON-NLS-2$
+			rw.eval("sink()"); //$NON-NLS-1$
+		} catch (RWorkspaceException e) {
+			// TODO Auto-generated catch block
+			System.out.println(AHCCoreMessages.ERROR_EXPORT_TXT + e);
+			org.txm.utils.logger.Log.printStackTrace(e);
+			ret = false;
+		} finally {
+			releaseSemaphore();
+		}
+		return true;
+	}
+
+	//FIXME: extract to future exporter extension
+	@Deprecated
+	public boolean toTxt(File outfile, String encoding, String colsep, String txtsep) {
+		return toTxt(outfile, encoding);
+	}
+
+	/**
+	 * Gets the default method.
+	 *
+	 * @return the default method
+	 */
+	public static String getDefaultMethod() {
+		return "ward"; //$NON-NLS-1$
+	}
+
+	/**
+	 * Gets the default metric.
+	 *
+	 * @return the default metric
+	 */
+	public static String getDefaultMetric() {
+		return "euclidean"; //$NON-NLS-1$
+	}
+
+	@Override
+	public void clean() {
+		// TODO Auto-generated method stub
+
+	}
+
+	/**
+	 * Gets the clusters coordinates.
+	 * @return the clusters coordinates
+	 */
+	public double[][] getClusterCoords() {
+		if (this.clusterCoords == null) {
+			try {
+
+				// FIXME: check this code for the CAH 3D chart implementation
+				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+				for(int i = 0; i < 2; i++) { // 2 dimensions
+					REXP sv = rw.extractItemFromListByName(symbol, "data.clust[,"+ (i + 1)+ "]"); //$NON-NLS-1$
+					double[] coords = RWorkspace.toDouble(sv);
+					for(int j = 0; j < coords.length; j++) {
+						if(this.clusterCoords  == null)	{
+							this.clusterCoords = new double[coords.length][2];
+						}
+						this.clusterCoords[j][i] = coords[j];
+					}
+				}
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return this.clusterCoords;
+	}
+
+
+	/**
+	 * Gets the clusters numbers.
+	 * @return
+	 */
+	public int[] getClusterNumbers() {
+		if (this.clusterNumbers == null) {
+			try {
+				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+				// FIXME: not sorted version
+				REXP sv = rw.extractItemFromListByName(symbol, "data$clust"); //$NON-NLS-1$
+				// FIXME: sorted version
+				//REXP sv = rw.extractItemFromListByName(symbol, "data$clust[c(" + symbol + "$call$t$tree$order)]"); //$NON-NLS-1$
+				this.clusterNumbers = sv.asIntegers();
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return this.clusterNumbers;
+	}
+
+	/**
+	 * Gets the cluster row names.
+	 * @return
+	 */
+	public String[] getClusterRowNames() {
+		if (this.clusterRowNames == null) {
+			try {
+				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+
+				// FIXME: old method, Save the row names in the R data frame
+				//				rw.safeEval(symbol + "$rownames <- rownames(" + symbol + "$data)");
+				//				REXP sv = rw.extractItemFromListByName(symbol, "rownames"); //$NON-NLS-1$
+
+
+				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$labels"); //$NON-NLS-1$
+
+
+				this.clusterRowNames = sv.asStrings();
+
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return this.clusterRowNames;
+	}
+
+
+
+	/**
+	 * Gets the cluster orderer row names.
+	 * @return
+	 */
+	public String[] getClusterOrderedRowNames() {
+		if (this.clusterOrderedRowNames == null) {
+			try {
+				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$labels[c(" + symbol + "$call$t$tree$order)]"); //$NON-NLS-1$
+				this.clusterOrderedRowNames = sv.asStrings();
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return this.clusterOrderedRowNames;
+	}
+
+
+	/**
+	 * Gets the cluster tree heights.
+	 * @return
+	 */
+	public double[] getClusterTreeHeights() {
+		if (this.clusterHeights == null) {
+			try {
+				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$height"); //$NON-NLS-1$
+				this.clusterHeights = sv.asDoubles();
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return this.clusterHeights;
+	}
+
+
+	/**
+	 * Gets the inertia gains.
+	 * @return
+	 */
+	// FIXME: for test purpose, this method is not used for the chart computing
+	public double[] getInertiaGains() {
+		if (this.inertiaGains == null) {
+			try {
+				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+				REXP sv = rw.extractItemFromListByName(symbol, "call$t$inert.gain"); //$NON-NLS-1$
+				// FIXME: tests
+				//			REXP sv = rw.extractItemFromListByName(symbol, "call$t$within"); //$NON-NLS-1$
+
+				this.inertiaGains = sv.asDoubles();
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return this.inertiaGains;
+	}
+
+
+	/**
+	 * Gets the cluster tree merges.
+	 * @return
+	 */
+	public double[][] getClusterTreeMerges() {
+		if (this.clusterMerges == null) {
+			try {
+				RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+				REXP sv = rw.extractItemFromListByName(symbol, "call$t$tree$merge"); //$NON-NLS-1$
+				this.clusterMerges = sv.asDoubleMatrix();
+			}
+			catch (Exception e) {
+				// TODO Auto-generated catch block
+				org.txm.utils.logger.Log.printStackTrace(e);
+			}
+		}
+		return this.clusterMerges;
+	}
+
+
+
+
+
+
+	/**
+	 * Sets the metric to use for computing.
+	 * @param metric the metric to set
+	 */
+	public void setMetric(String metric) {
+		this.pMetric = metric;
+	}
+
+	/**
+	 * Sets the method to use for computing
+	 * @param method the method to set
+	 */
+	public void setMethod(String method) {
+		this.pMethod = method;
+	}
+
+	/**
+	 * Sets the computing to columns or rows.
+	 * @param columns the columns to set
+	 */
+	public void setColumnsComputing(boolean columns) {
+		this.pColumns = columns;
+	}
+
+	/**
+	 * Sets the number of clusters to use for computing
+	 * @param nCluster the nCluster to set
+	 */
+	public void setNCluster(int nCluster) {
+		pNCluster = nCluster;
+	}
+
+	/**
+	 * Checks if the computing mode is set as columns. If not, the computing mode is set as rows.
+	 * @return the columns
+	 */
+	public boolean isColumnsComputing() {
+		return pColumns;
+	}
+
+	/**
+	 * Gets the maximum clusters available according to the current computing mode (columns or rows) and according to current source (<code>CA</code> or <code>LexicalTable</code>).
+	 * The maximum numbers of available clusters is for now limited to 16 by this method due of a limitation of FactoMineR plot.HCPC().
+	 * @return the maximum clusters available according to the current computing mode
+	 */
+	public int getMaxClustersCount()	{
+
+		int maxClustersCount = -1;
+
+		try {
+			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
+			REXP sv = rw.eval("min(length(" + symbol + "$data$clust) - 1, 16)"); //$NON-NLS-1$ //$NON-NLS-2$
+			maxClustersCount = sv.asInteger();
+		} catch(Exception e) {
+			System.out.println("Error: "+e.getLocalizedMessage());
+			Log.printStackTrace(e);
+		}
+
+		// FIXME: FactoMineR plot.HCPC doesn't manage more than 16 clusters when tree.barplot=TRUE, therefore we can't plot a SVG with more than that, see ticket #836 then use the code below in ChartsEngine to compute
+		// the real maximum available clusters count
+		//		// CA
+		//		if(this.source instanceof CA)	{
+		//			if(this.columns == true)	{
+		//				maxClustersCount = ((CA)this.source).getColumnsCount() - 1;
+		//			}
+		//			else	{
+		//				maxClustersCount = ((CA)this.source).getRowsCount() - 1;
+		//			}
+		//		}
+		//		// Lexical table
+		//		else if(this.source instanceof LexicalTable)	{
+		//			if(this.columns == true)	{
+		//				maxClustersCount = ((LexicalTable)this.source).getColumnsCount() - 1;
+		//			}
+		//			else	{
+		//				maxClustersCount = ((LexicalTable)this.source).getRowsCount() - 1;
+		//			}
+		//		}
+
+		return maxClustersCount;
+	}
+
+
+
+	@Override
+	public String[] getExportTXTExtensions() {
+		return new String[]{"*.txt"};
+	}
+
+
+	/**
+	 * Returns the number of clusters.
+	 * @return the nCluster
+	 */
+	public int getNCluster() {
+		return pNCluster;
+	}
+
+	public CA getCA() {
+		return ca;
+	}
+
+	public LexicalTable getLexicalTable() {
+		return table;
+	}
+
+
+	@Override
+	public String getName() {
+		return getParent().getName();
+	}
+
+
+	@Override
+	public String getSimpleName() {
+		StringBuffer buffer = new StringBuffer();
+		if (pColumns != null) buffer.append(pColumns?"cols":"rows");
+		if (pMethod != null) buffer.append(" "+pMethod);
+		if (pMetric != null) buffer.append(" "+pMetric);
+		if (pNCluster != null) buffer.append(" "+pNCluster);
+		return this.getName();
+	}
+
+	@Override
+	public String getDetails() {
+		return this.getName();
+	}
+
+	@Override
+	public boolean canCompute() {
+
+		return ca != null 
+				&& Arrays.binarySearch(AHC.getMethods(), pMethod) >= 0 
+				&& Arrays.binarySearch(AHC.getMetrics(), pMetric) >= 0
+				&& pNCluster >= 2;
+	}
+}

Property changes on: tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RCAHChartCreator.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RCAHChartCreator.java	(revision 527)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RCAHChartCreator.java	(revision 528)
@@ -1,66 +0,0 @@
-package org.txm.cah.core.chartsengine.r;
-
-import java.io.File;
-
-import org.txm.cah.core.functions.CAH;
-import org.txm.cah.core.preferences.CAHPreferences;
-import org.txm.core.preferences.TXMPreferences;
-import org.txm.core.results.TXMResult;
-import org.txm.chartsengine.r.core.RChartCreator;
-
-/**
- * R CAH chart creator.
- * 
- * @author mdecorde
- * @author sjacquot
- *
- */
-public class RCAHChartCreator extends RChartCreator {
-
-	public RCAHChartCreator() {
-		// TODO Auto-generated constructor stub
-	}
-
-	@Override
-	public Object createChart(TXMResult result) {
-		// TODO Auto-generated method stub
-		return null;
-	}
-	
-
-	@Override
-	public File createChartFile(TXMResult result, File file) {
-
-		CAH cah = (CAH) result;
-		
-		String cmd = null;
-		// 2D
-		if (result.getBooleanParameterValue(CAHPreferences.DISPLAY_2D)) {
-			cmd = "plot.HCPC(" + cah.getSymbol() + ", new.plot=FALSE, choice=\"tree\")";
-			
-		// FIXME: for tests without drawing the inertia barplot. Without it, the max available clusters can exceed 16
-		//cmd = "plot.HCPC(" + cah.getSymbol() + ", new.plot=FALSE, choice=\"tree\", tree.barplot=FALSE)"; //$NON-NLS-1$ //$NON-NLS-2$
-		// FIXME: Tests for drawing only the inertia bar plot. We may need to create a method for this : createCAHIntertiaChart() in the charts engines
-		//cmd= "plot.HCPC(" + cah.getSymbol() + ", new.plot=FALSE, choice=\"bar\")"; //$NON-NLS-1$ //$NON-NLS-2$
-
-			
-		}
-		// 3D
-		else {
-			cmd = "plot.HCPC("+ cah.getSymbol() +", new.plot=FALSE)";
-		}
-		
-		this.getChartsEngine().plot(file, cmd);
-		
-		return file;
-	}
-
-	
-	@Override
-	public Class getResultDataClass() {
-		return CAH.class;
-	}
-
-
-
-}
Index: tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RAHCChartCreator.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RAHCChartCreator.java	(revision 0)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RAHCChartCreator.java	(revision 528)
@@ -0,0 +1,56 @@
+package org.txm.cah.core.chartsengine.r;
+
+import java.io.File;
+
+import org.txm.cah.core.functions.AHC;
+import org.txm.cah.core.preferences.AHCPreferences;
+import org.txm.core.preferences.TXMPreferences;
+import org.txm.core.results.TXMResult;
+import org.txm.chartsengine.r.core.RChartCreator;
+
+/**
+ * R CAH chart creator.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ *
+ */
+public class RAHCChartCreator extends RChartCreator {
+
+
+	@Override
+	public File createChartFile(TXMResult result, File file) {
+
+		AHC cah = (AHC) result;
+		
+		String cmd = null;
+		// 2D
+		if (result.getBooleanParameterValue(AHCPreferences.DISPLAY_2D)) {
+			cmd = "plot.HCPC(" + cah.getSymbol() + ", new.plot=FALSE, choice=\"tree\")";
+			
+		// FIXME: for tests without drawing the inertia barplot. Without it, the max available clusters can exceed 16
+		//cmd = "plot.HCPC(" + cah.getSymbol() + ", new.plot=FALSE, choice=\"tree\", tree.barplot=FALSE)"; //$NON-NLS-1$ //$NON-NLS-2$
+		// FIXME: Tests for drawing only the inertia bar plot. We may need to create a method for this : createCAHIntertiaChart() in the charts engines
+		//cmd= "plot.HCPC(" + cah.getSymbol() + ", new.plot=FALSE, choice=\"bar\")"; //$NON-NLS-1$ //$NON-NLS-2$
+
+			
+		}
+		// 3D
+		else {
+			cmd = "plot.HCPC("+ cah.getSymbol() +", new.plot=FALSE)";
+		}
+		
+		this.getChartsEngine().plot(file, cmd);
+		
+		return file;
+	}
+
+	
+	@Override
+	public Class getResultDataClass() {
+		return AHC.class;
+	}
+
+
+
+}

Property changes on: tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/r/RAHCChartCreator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCCAHChartCreator.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCCAHChartCreator.java	(revision 527)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCCAHChartCreator.java	(revision 528)
@@ -1,706 +0,0 @@
-package org.txm.cah.core.chartsengine.jfreechart;
-
-import org.jfree.chart.JFreeChart;
-import org.txm.cah.core.functions.CAH;
-import org.txm.core.results.TXMResult;
-import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
-
-/**
- * JFC CAH chart creator.
- * 
- * @author mdecorde
- * @author sjacquot
- * 
- * 
- */
-public class JFCCAHChartCreator extends JFCChartCreator {
-
-	public JFCCAHChartCreator() {
-		// TODO Auto-generated constructor stub
-	}
-
-	@Override
-	public JFreeChart createChart(TXMResult result) {
-
-		System.err.println("JFCCAHChartCreator.createChart(): not yet implemented.");
-		
-		final CAH cah = (CAH) result;
-		
-		
-		return null;
-		
-	}
-
-	
-	@Override
-	// FIXME: to not load the chart creator, to remove when implemented 
-	public Class getChartsEngineClass() {
-		return null;
-	}
-
-	
-
-	@Override
-	public Class getResultDataClass() {
-		return CAH.class;
-	}
-
-
-
-
-	
-	// FIXME: old version with bar plot renderer
-//	@Override
-//	public JFreeChart createCAH2dChart(CAH cah) {
-//
-//
-//		JFreeChart chart = null;
-//
-//		// Creating the data set from the result
-//		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
-//		String category = "cluster ";
-//
-//
-//
-//		int[] clusterNumbers = cah.getClusterNumbers();
-//		String[] rowNames = cah.getClusterRowNames();
-//		String[] orderedRowNames = cah.getClusterOrderedRowNames();
-//		double[] clusterHeights = cah.getClusterTreeHeights();
-//		double[][] clusterMerges = cah.getClusterTreeMerges();
-//		double[][] clusterCoords = cah.getClusterCoords();
-//
-//		double[] yValuesByOrderedRowNames = new double[rowNames.length];
-//		double[] clusterNumbersValuesByOrderedRowNames = new double[rowNames.length];
-//
-//
-//
-//		// FIXME: Sort the cluster numbers in reverse order
-////			Arrays.sort(clusterNumbers);
-////			ArrayUtils.reverse(clusterNumbers);
-////			System.out.println(Arrays.toString(clusterNumbers));
-//
-//
-//		// FIXME: tests row names
-//		//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster row names: \t\t" + Arrays.toString(rowNames));
-//
-//		// FIXME: tests ordered row names
-//		//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster ordered row names: \t" + Arrays.toString(orderedRowNames));
-//
-//		// FIXME: tests, ordered cluster numbers
-//		//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster numbers: \t\t" + Arrays.toString(clusterNumbers));
-//
-//		// FIXME: tests, cluster tree merges
-//		//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster tree merges: \t\t" + Arrays.toString(clusterMerges));
-//
-//		// FIXME: tests, heights
-////		System.err.println("JFCChartsEngine.createCAH2dChart(): cluster heights: \t\t" + Arrays.toString(clusterHeights));
-//
-//
-//		// FIXME: tests
-//		System.err.println("JFCChartsEngine.createCAH2dChart(): tests: \t\t" + Arrays.toString(cah.getInertiaGains()));
-//
-//
-//
-//		System.out.println("JFCChartsEngine.createCAH2dChart() cluster heights count: " + clusterHeights.length);
-//		for(int i = 0; i < clusterHeights.length; i++) {
-//			System.out.println("JFCChartsEngine.createCAH2dChart() cluster height: " + new DecimalFormat("0.00000000000000000").format(clusterHeights[i]));
-//		}
-//
-////
-////		String[] clusterUnorderedRowNames = cah.getClusterRowNames();
-////		for(int i = 0; i < clusterUnorderedRowNames.length; i++) {
-////			System.out.println("JFCChartsEngine.createCAH2dChart() unordered row names " + i + " : " + clusterUnorderedRowNames[i]);
-////		}
-//
-//		// Parse the merge pairs
-//		// A negative number in the FactoMineR tree merge table means a singleton
-//		for (int i = 0 ; i < clusterMerges.length ; i++) {
-//
-//			// FIXME: debug
-//			//for (int j = 0 ; j < clusterMerges.length ; j++) {
-//				System.err.println("JFCChartsEngine.createCAH2dChart(): cluster tree merges: \t\t" + Arrays.toString(clusterMerges[i]));
-//				System.err.println("JFCChartsEngine.createCAH2dChart(): row names: \t\t" + rowNames[(int) Math.abs(clusterMerges[i][0]) - 1] + " | " + rowNames[(int) Math.abs(clusterMerges[i][1]) - 1]);
-//
-//
-//			//}
-//
-//			// Leaves pair
-//			if(clusterMerges[i][0] < 0)	{
-//
-//				//System.err.print("JFCChartsEngine.createCAH2dChart(): merging: " + rowNames[(int) Math.abs(clusterMerge[i][0]) - 1]);
-//
-//				// Put the height in the ordered by names values table
-//				for(int j = 0; j < orderedRowNames.length; j++) {
-//					if(orderedRowNames[j].equals(rowNames[(int) Math.abs(clusterMerges[i][0]) - 1]))	{
-//						yValuesByOrderedRowNames[j] = clusterHeights[i];
-//						//clusterNumbersValuesByOrderedRowNames[j] = clusterNumbers[(int) Math.abs(clusterMerge[i][0]) - 1];
-//					}
-//				}
-//
-//			}
-//			// Non-singleton
-////				else	{
-////					//System.err.print("JFCChartsEngine.createCAH2dChart(): merging aggregation: " +  clusterMerge[i][0]);
-////				}
-//
-//			// Leaves pair
-//			if(clusterMerges[i][1] < 0)	{
-//				//System.err.print(" with: " + rowNames[(int) Math.abs(clusterMerge[i][1]) - 1]);
-//
-//				// Put the height in the ordered by names values table
-//				for(int j = 0; j < orderedRowNames.length; j++) {
-//					if(orderedRowNames[j].equals(rowNames[(int) Math.abs(clusterMerges[i][1]) - 1]))	{
-//						yValuesByOrderedRowNames[j] = clusterHeights[i];
-//						//clusterNumbersValuesByOrderedRowNames[j] = clusterNumbers[(int) Math.abs(clusterMerge[i][1]) - 1];
-//					}
-//
-//				}
-//
-//			}
-//			// Non-singleton
-////				else	{
-////					//System.err.print(" with aggregation: " + clusterMerge[i][1]);
-////				}
-//
-//			//System.err.println(" and height: " + clusterHeights[i] + " as aggregation: " + (i + 1));
-//
-//		}
-//
-//
-//		//
-////		for (int i = 0 ; i <  cah.getClusterTreeMerges().length; i++) {
-////			System.err.println("JFCChartsEngine.createCAH2dChart() merges : ");
-////			for(int j = 0; j < cah.getClusterTreeMerges()[i].length; j++) {
-////				System.err.print(" : " + cah.getClusterTreeMerges()[i][j]);
-////			}
-////		}
-//
-//
-//
-////		ArrayList<Double> middlePoints = cah.getClusterTreeMiddlePoints();
-////
-////		for (int i = 0 ; i <  middlePoints.size(); i++) {
-////			System.err.println("JFCChartsEngine.createCAH2dChart() middle points X: " + middlePoints.get(i));
-////		}
-//
-//
-//
-////		for (int i = 0 ; i < cah.getClusterCoords().length ; i++) {
-////			for(int j = 0; j < cah.getClusterCoords()[i].length; j++) {
-////				//System.err.println("JFCChartsEngine.createCAH2dChart(): " + cah.getClusterCoords()[i][j]);
-////				dataset.setValue(cah.getClusterCoords()[i][j], category + clusterNumbers[i], rownames[i]);
-////			}
-////		}
-//
-//
-//
-//		// Create chart title
-//		String title = "title";
-//		String xAxisLabel = "Column";
-//		if(!cah.isColumnsComputing())	{
-//			xAxisLabel = "Row";
-//		}
-//
-//
-//
-//		// Create the data set
-//		// FIXME: bar plot test
-////		for(int i = 0; i < yValuesByOrderedRowNames.length; i++) {
-////			//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[clusterNumbers.length - 1 - i], orderedRowNames[i]);
-////
-////
-////			dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[yValuesByOrderedRowNames.length - 1 - i], orderedRowNames[i]);
-////			//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[i], orderedRowNames[i]);
-////
-////			//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbersValuesByOrderedRowNames[i], orderedRowNames[i]);
-////		}
-////
-////		// Create the chart
-////        chart = this.createCategoryBarChart(dataset, title, xAxisLabel, "Height", false, false, false);
-////        ((IItemSelectionRenderer) chart.getCategoryPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_CAH_2D);
-////
-////        // Draw tree
-////        for(int j = 0; j < chart.getCategoryPlot().getDataset().getColumnCount() - 1; j++) {
-////			//System.err.println("JFCChartsEngine.createCAH2dChart(): " + chart.getCategoryPlot().getDataset().getColumnKey(j));
-////
-////
-////        	// Non-singleton pairs lines
-////			if(yValuesByOrderedRowNames[j] == yValuesByOrderedRowNames[j + 1])	{
-////				chart.getCategoryPlot().addAnnotation(new CategoryLineAnnotation(chart.getCategoryPlot().getDataset().getColumnKey(j), yValuesByOrderedRowNames[j],
-////						chart.getCategoryPlot().getDataset().getColumnKey(j + 1), yValuesByOrderedRowNames[j + 1], Color.red, new BasicStroke(2.0f)));
-////			}
-////
-////
-////			//chart.getCategoryPlot().addAnnotation(new Cate
-////
-////
-////
-////		}
-//
-//
-//
-//		// Create the data set
-//		// FIXME: step chart test
-////		for(int i = 0; i < yValuesByOrderedRowNames.length - 1; i++) {
-////			if(yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i + 1])	{
-////				dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[yValuesByOrderedRowNames.length - 1 - i], orderedRowNames[i]);
-////			}
-////		}
-//////		dataset.addValue(0, "test", "truc 1");
-//////		dataset.addValue(0.5, "test", "truc 1");
-//////		dataset.addValue(0.9, "test", "truc 1");
-////		// Create the chart
-////        chart = this.createCategoryStepChart(dataset, title, xAxisLabel, "Height", false, false);
-////        ((IItemSelectionRenderer) chart.getCategoryPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_CAH_2D);
-//
-//
-//		// Create the data set
-//		// FIXME: XY category bar chart test
-//		XYSeriesCollection dataset2 = new XYSeriesCollection();
-//
-//		// Last tree level (leaves level)
-//		XYSeries series = new XYSeries("leaves");
-//		for(int i = 0; i < yValuesByOrderedRowNames.length - 1; i++) {
-//			series.add(i, 0);
-//			series.add(i, yValuesByOrderedRowNames[i]);
-//			if(yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i + 1])	{
-//				series.add(i + 1, yValuesByOrderedRowNames[i]);
-//				series.add(i + 1, 0);
-//			}
-//			else	{
-//				series.add(i + 1, null);
-//			}
-//		}
-//		dataset2.addSeries(series);
-//
-//
-//		// Link singletons to non singleton
-//		series = new XYSeries("singleton to non singleton links");
-//		for(int i = clusterHeights.length; i >= 0; i--) {
-//
-//			// Skip non singletons case
-//			if(i > 3 && yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i - 1] && yValuesByOrderedRowNames[i - 2] == yValuesByOrderedRowNames[i - 3])	{
-//				continue;
-//			}
-//
-//			// Link singletons to non singleton
-//			if(i > 1 && yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i - 1] && yValuesByOrderedRowNames[i - 1] != yValuesByOrderedRowNames[i - 2]) {
-//				series.add(i - 0.5, yValuesByOrderedRowNames[i - 2]);
-//				series.add(i - 0.5, yValuesByOrderedRowNames[i]);
-//				series.add(i - 0.5, null);
-//				series.add(i - 2, yValuesByOrderedRowNames[i - 2]);
-//			}
-//		}
-//		dataset2.addSeries(series);
-//
-//		// Link singletons to newly created pairs
-//		series = new XYSeries("singleton to newly created pairs");
-//		for(int i = clusterHeights.length; i >= 0; i--) {
-//
-//			// Skip non singletons case
-//			if(i > 0 && yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i - 1])	{
-//				series.add(i, null);
-//				continue;
-//			}
-//
-//			// Link singletons to newly created pairs
-//			if(i < clusterHeights.length - 1 && yValuesByOrderedRowNames[i] != yValuesByOrderedRowNames[i + 1]
-//					&& yValuesByOrderedRowNames[i + 1] != yValuesByOrderedRowNames[i + 2]
-//
-////						&& i > 1 &&
-//
-//							) {
-//
-//				series.add(i, null);
-//
-//				series.add(i, yValuesByOrderedRowNames[i]);
-//
-//				series.add(i + 1.75, yValuesByOrderedRowNames[i]);
-//				series.add(i + 1.75, yValuesByOrderedRowNames[i + 1]);
-//
-//
-//				//series.add(i - 2, yValuesByOrderedRowNames[i - 2]);
-//			}
-//		}
-//		dataset2.addSeries(series);
-//
-//
-//
-//		// Link singletons; test 2
-////		series = new XYSeries("singleton links");
-////		for(int i = 0; i <  clusterHeights.length - 2; i++) {
-////			if(i > 0 && i < clusterHeights.length - 2 && yValuesByOrderedRowNames[i] != yValuesByOrderedRowNames[i + 1] && yValuesByOrderedRowNames[i] != yValuesByOrderedRowNames[i - 1]) {
-////				series.add(i, yValuesByOrderedRowNames[i]);
-////				series.add(i + 1.5, yValuesByOrderedRowNames[i]);
-////				series.add(i + 1.5, yValuesByOrderedRowNames[i + 1]);
-////				series.add(i + 1.5, null);
-////			}
-////		}
-////		dataset2.addSeries(series);
-//
-//
-////		// Other clusters
-////		ArrayList<Double> otherClusters = new ArrayList<Double>();
-////		//series = new XYSeries("other clusters");
-////		for(int i = 0; i < clusterHeights.length; i++) {
-////			// If not a leaf
-////			boolean done = false;
-////			for(int j = 0; j < clusterNumbersValuesByOrderedRowNames.length; j++) {
-////				if(clusterHeights[i] == yValuesByOrderedRowNames[j])	{
-////					done = true;
-////					break;
-////				}
-////			}
-////			if(done)	{
-////				continue;
-////			}
-////			System.err.println("JFCChartsEngine.createCAH2dChart() other clusters: " + new DecimalFormat("0.0000000000000000").format(clusterHeights[i]));
-////		}
-////		//dataset2.addSeries(series);
-//
-//
-//
-////		dataset.addValue(0, "test", "truc 1");
-////		dataset.addValue(0.5, "test", "truc 1");
-////		dataset.addValue(0.9, "test", "truc 1");
-//		// Create the chart
-//        //chart = this.createXYBarChart(dataset2, title, xAxisLabel, "Height", false, false);
-//        chart = ChartFactory.createXYLineChart(
-//        		title,      // chart title
-//        		xAxisLabel,                      // x axis label
-//                "height",                      // y axis label
-//                dataset2,                  // data
-//                PlotOrientation.VERTICAL,
-//                true,                     // include legend
-//                true,                     // tooltips
-//                false                     // urls
-//            );
-//
-//
-//
-//
-//        chart.getXYPlot().setRenderer(this.theme.createXYLineAndShapeRenderer(true, false));
-//        ((IItemSelectionRenderer) chart.getXYPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_CAH_2D);
-//
-//
-//        //chart.getXYPlot().addAnnotation(new XYLineAnnotation(0.5,  yValuesByOrderedRowNames[0], 0.5,  yValuesByOrderedRowNames[0] + 0.002));
-//
-//
-//
-//
-//
-//
-//
-//
-//        //System.err.println("JFCChartsEngine.createCAH2dChart() " + chart.getCategoryPlot().getCategories().get(0));
-//        //chart.getCategoryPlot().addAnnotation(new CategoryLineAnnotation("1970-12-31", .0002, "1965-12-31", .00005, Color.red, new BasicStroke(2.0f)));
-//
-//        // Custom range axis for ticks drawing options
-//        //chart.getCategoryPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getCategoryPlot().getRangeAxis(), false, true, 0, DatasetUtilities.findMaximumRangeValue(chart.getCategoryPlot().getDataset()).doubleValue()));
-//
-//
-//
-//		// Apply theme to the chart
-//		this.theme.apply(chart);
-//
-//
-//
-//		// FIXME: test algo R
-//		int dimens = 2;
-//		int ax1 = 0;
-//		int ax2 = 1;
-//		double x1, y1, x2, y2, w1, w2;
-//
-//		double h1, h2; // FIXME: when using 3 dimensions
-//
-//
-//		double[][] aa = new double[clusterMerges.length][4];
-//		for(int i = 0; i < clusterMerges.length; i++) {
-//			for(int j = 0; j < 4; j++) {
-//				aa[i][j] = 0;
-//			}
-//		}
-//
-//
-//		   //aa=matrix(ncol=4, nrow=nrow(merge))
-//
-//
-//
-//
-//		// Decrement/increment the cluster merge value because the R algorithm uses 1 as first table index
-//
-//		for(int i = 0; i < clusterMerges.length; i++) {
-//			if(clusterMerges[i][0] < 0)	{
-//				clusterMerges[i][0]++;
-//			}
-//			else	{
-//				clusterMerges[i][0]--;
-//			}
-//
-//			if(clusterMerges[i][1] < 0)	{
-//				clusterMerges[i][1]++;
-//			}
-//			else	{
-//				clusterMerges[i][1]--;
-//			}
-//		}
-//
-//
-//		for(int i = 0; i < clusterMerges.length; i++) {
-//
-////		    for(i in 1:nrow(merge)){
-//			     // if(merge[i,1]<0){
-//			// Singleton
-//			if(clusterMerges[i][0] < 0)	{
-//
-//
-//			        x1 = clusterCoords[(int) -clusterMerges[i][0]][ax1];
-//			        y1 = clusterCoords[(int) -clusterMerges[i][0]][ax2];
-//
-//
-//			        h1 = 0;
-//			        w1 = 1;
-//			      }
-//			      else{
-//			        x1 = aa[(int) clusterMerges[i][0]][0];
-//			        y1 = aa[(int) clusterMerges[i][0]][1];
-//			        w1 = aa[(int) clusterMerges[i][0]][3];
-//			        h1 = aa[(int) clusterMerges[i][0]][2];
-//			      }
-//			// Singleton
-//			if(clusterMerges[i][1] < 0)	{
-//			      //if(merge[i,2]<0){
-//			        x2 = clusterCoords[-(int) clusterMerges[i][1]][ax1];
-//			        y2 = clusterCoords[-(int) clusterMerges[i][1]][ax2];
-//			        h2 = 0;
-//			        w2 = 1;
-//			      }
-//			      else{
-//			        x2 = aa[(int) clusterMerges[i][1]][0];
-//			        y2 = aa[(int) clusterMerges[i][1]][1];
-//			        w2 = aa[(int) clusterMerges[i][1]][3];
-//			        h2 = aa[(int) clusterMerges[i][1]][2];
-//			      }
-//			      aa[i][0] = (w1 * x1 + w2 * x2) / (w1 + w2);
-//			      aa[i][1] = (w1 * y1 + w2 * y2) / (w1 + w2);
-//
-//			      //if(i<=nrow(merge)-t.level+1)
-//			      if(i <= clusterMerges.length)	{
-//			    	  clusterHeights[i] = 0;
-//			      }
-//
-//			      aa[i][2] = clusterHeights[i];
-//			      aa[i][3] = w1 + w2;
-//
-////			      if(i>(nrow(merge)-t.level+1)){
-////			      if(i > clusterMerges[i][1]){ // FIXME: this test is strange
-////			        if(dimens==3) s$points3d(rbind(c(x1,y1,h1),c(x1,y1,height[i]), c(x2,y2,height[i]),c(x2,y2,h2)), lty=1, type="o", pch="")
-//			        if(dimens == 2)	{
-//			        //	lines(c(x1,x2), c(y1,y2), lwd=(height[i]/max(height))*3)
-//
-//			        	//chart.getXYPlot().addAnnotation(new XYLineAnnotation(x1, y1, x2, y2));
-//			        	// tests with steps lines
-//			        	x1 *= 10;
-//			        	x2 *= 10;
-//			        	y1 /= 100;
-//			        	y2 /= 100;
-//
-//			        	chart.getXYPlot().addAnnotation(new XYLineAnnotation(x1, y1, x1, y2));
-//			        	chart.getXYPlot().addAnnotation(new XYLineAnnotation(x1, y2, x2, y2));
-//			        	chart.getXYPlot().addAnnotation(new XYLineAnnotation(x2, y2, x2, y1));
-//
-//
-//			        	// FIXME: labels tests
-//			        	chart.getXYPlot().addAnnotation(new XYTextAnnotation(rowNames[(int) Math.abs(clusterMerges[i][0])], x1, y1));
-//			        	chart.getXYPlot().addAnnotation(new XYTextAnnotation(rowNames[(int) Math.abs(clusterMerges[i][1])], x2, y1));
-//
-//
-//
-////			        	chart.getXYPlot().addAnnotation(new XYLineAnnotation(y2, x1, y1, x1));
-//
-//
-//			        	//chart.getXYPlot().addAnnotation(new XYLineAnnotation(x2, y2, x2, y2));
-//
-//
-//			        	System.err.println("JFCChartsEngine.createCAH2dChart(): draw line " + x1 + ", " + y1 + " | " + x2 + "," + y2);
-//			        }
-////			      }
-//		//	    }
-//
-//
-//		}
-//
-//
-//		// FIXME: test symbol axis
-//		//chart.getXYPlot().setDomainAxis(new SymbolAxis("test symbol axis", new String[]{"A", "b", "c"}));
-//
-//		// FIXME: for cluster boxes we may use XYBoxAnnotation()
-//
-//
-//		//chart.getXYPlot().addAnnotation(new XYLineAnnotation(x1, y1, x2, y2));
-//
-//
-//        return chart;
-//
-//	}
-
-	// FIXME: new version with category step renderer
-//	@Override
-//	public JFreeChart createCAH2dChart(CAH cah) {
-//
-//
-//			JFreeChart chart = null;
-//
-//			// Creating the data set from the result
-//			DefaultCategoryDataset dataset = new DefaultCategoryDataset();
-//			String category = "cluster ";
-//
-//
-//
-//			int[] clusterNumbers = cah.getClusterNumbers();
-//			String[] rowNames = cah.getClusterRowNames();
-//			String[] orderedRowNames = cah.getClusterOrderedRowNames();
-//			double[] clusterHeights = cah.getClusterTreeHeights();
-//			double[][] clusterMerge = cah.getClusterTreeMerges();
-//
-//
-//			double[] yValuesByOrderedRowNames = new double[rowNames.length];
-//			double[] clusterNumbersValuesByOrderedRowNames = new double[rowNames.length];
-//
-//
-//
-//			// FIXME: Sort the cluster numbers in reverse order
-////			Arrays.sort(clusterNumbers);
-////			ArrayUtils.reverse(clusterNumbers);
-////			System.out.println(Arrays.toString(clusterNumbers));
-//
-//
-//			// FIXME: tests row names
-//			//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster row names: \t\t" + Arrays.toString(rowNames));
-//
-//			// FIXME: tests ordered row names
-//			//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster ordered row names: \t" + Arrays.toString(orderedRowNames));
-//
-//			// FIXME: tests, ordered cluster numbers
-//			//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster number: \t\t" + Arrays.toString(clusterNumbers));
-//
-//
-//
-//			for (int i = 0 ; i < clusterMerge.length ; i++) {
-//
-//				// Singleton
-//				if(clusterMerge[i][0] < 0)	{
-//
-//					//System.err.print("JFCChartsEngine.createCAH2dChart(): merging: " + rowNames[(int) Math.abs(clusterMerge[i][0]) - 1]);
-//
-//					// Put the height in the ordered by names values table
-//					for(int j = 0; j < orderedRowNames.length; j++) {
-//						if(orderedRowNames[j].equals(rowNames[(int) Math.abs(clusterMerge[i][0]) - 1]))	{
-//							yValuesByOrderedRowNames[j] = clusterHeights[i];
-//							//clusterNumbersValuesByOrderedRowNames[j] = clusterNumbers[(int) Math.abs(clusterMerge[i][0]) - 1];
-//						}
-//					}
-//
-//				}
-//				// Non-singleton
-//				else	{
-//					//System.err.print("JFCChartsEngine.createCAH2dChart(): merging aggregation: " +  clusterMerge[i][0]);
-//				}
-//
-//				// Singleton
-//				if(clusterMerge[i][1] < 0)	{
-//					//System.err.print(" with: " + rowNames[(int) Math.abs(clusterMerge[i][1]) - 1]);
-//
-//					// Put the height in the ordered by names values table
-//					for(int j = 0; j < orderedRowNames.length; j++) {
-//						if(orderedRowNames[j].equals(rowNames[(int) Math.abs(clusterMerge[i][1]) - 1]))	{
-//							yValuesByOrderedRowNames[j] = clusterHeights[i];
-//							//clusterNumbersValuesByOrderedRowNames[j] = clusterNumbers[(int) Math.abs(clusterMerge[i][1]) - 1];
-//						}
-//
-//					}
-//
-//				}
-//				// Non-singleton
-//				else	{
-//					//System.err.print(" with aggregation: " + clusterMerge[i][1]);
-//				}
-//
-//				//System.err.println(" and height: " + clusterHeights[i] + " as aggregation: " + (i + 1));
-//
-//			}
-//
-//
-//			// Create the data set
-//
-//			for(int i = 0; i < yValuesByOrderedRowNames.length; i++) {
-//				//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[clusterNumbers.length - 1 - i], orderedRowNames[i]);
-//
-//				dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[yValuesByOrderedRowNames.length - 1 - i], orderedRowNames[i]);
-//				//dataset.setValue(yValuesByOrderedRowNames[i], category, orderedRowNames[i]);
-//
-//				//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbersValuesByOrderedRowNames[i], orderedRowNames[i]);
-//			}
-//
-////
-////			for (int i = 0 ; i <  cah.getClusterTreeMerges().length; i++) {
-////				System.err.println("JFCChartsEngine.createCAH2dChart() merges : ");
-////				for(int j = 0; j < cah.getClusterTreeMerges()[i].length; j++) {
-////					System.err.print(" : " + cah.getClusterTreeMerges()[i][j]);
-////				}
-////			}
-//
-//
-//
-////			ArrayList<Double> middlePoints = cah.getClusterTreeMiddlePoints();
-////
-////			for (int i = 0 ; i <  middlePoints.size(); i++) {
-////				System.err.println("JFCChartsEngine.createCAH2dChart() middle points X: " + middlePoints.get(i));
-////			}
-//
-//
-//
-////			for (int i = 0 ; i < cah.getClusterCoords().length ; i++) {
-////				for(int j = 0; j < cah.getClusterCoords()[i].length; j++) {
-////					//System.err.println("JFCChartsEngine.createCAH2dChart(): " + cah.getClusterCoords()[i][j]);
-////					dataset.setValue(cah.getClusterCoords()[i][j], category + clusterNumbers[i], rownames[i]);
-////				}
-////			}
-//
-//
-//
-//			// Create chart title
-//			String title = "title";
-//			String xAxisLabel = "Column";
-//			if(!cah.isColumnsComputing())	{
-//				xAxisLabel = "Row";
-//			}
-//
-//
-//			// Create the chart
-//	        chart = this.createCategoryStepChart(dataset, title, xAxisLabel, "Height", false, false);
-//
-//
-//	        ((IItemSelectionRenderer) chart.getCategoryPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_CAH_2D);
-//
-//
-//	        // Draw tree
-//	        chart.getCategoryPlot().addAnnotation(new CategoryLineAnnotation(chart.getCategoryPlot().getDataset().getColumnKey(0), 5.0,
-//	        		chart.getCategoryPlot().getDataset().getColumnKey(1), 8.0, Color.red, new BasicStroke(2.0f)));
-//
-//	        // Custom range axis for ticks drawing options: cut the range to minimum and maximum values
-//	        chart.getCategoryPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getCategoryPlot().getRangeAxis(), false, true, 0, DatasetUtilities.findMaximumRangeValue(chart.getCategoryPlot().getDataset()).doubleValue()));
-//
-//
-//		return chart;
-//
-//
-//
-//
-//	}
-	
-
-
-	
-
-}
Index: tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCAHCChartCreator.java
===================================================================
--- tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCAHCChartCreator.java	(revision 0)
+++ tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCAHCChartCreator.java	(revision 528)
@@ -0,0 +1,706 @@
+package org.txm.cah.core.chartsengine.jfreechart;
+
+import org.jfree.chart.JFreeChart;
+import org.txm.cah.core.functions.AHC;
+import org.txm.core.results.TXMResult;
+import org.txm.chartsengine.jfreechart.core.JFCChartCreator;
+
+/**
+ * JFC CAH chart creator.
+ * 
+ * @author mdecorde
+ * @author sjacquot
+ * 
+ * 
+ */
+public class JFCAHCChartCreator extends JFCChartCreator {
+
+	public JFCAHCChartCreator() {
+		// TODO Auto-generated constructor stub
+	}
+
+	@Override
+	public JFreeChart createChart(TXMResult result) {
+
+		System.err.println("JFCCAHChartCreator.createChart(): not yet implemented.");
+		
+		final AHC cah = (AHC) result;
+		
+		
+		return null;
+		
+	}
+
+	
+	@Override
+	// FIXME: to not load the chart creator, to remove when implemented 
+	public Class getChartsEngineClass() {
+		return null;
+	}
+
+	
+
+	@Override
+	public Class getResultDataClass() {
+		return AHC.class;
+	}
+
+
+
+
+	
+	// FIXME: old version with bar plot renderer
+//	@Override
+//	public JFreeChart createCAH2dChart(CAH cah) {
+//
+//
+//		JFreeChart chart = null;
+//
+//		// Creating the data set from the result
+//		DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+//		String category = "cluster ";
+//
+//
+//
+//		int[] clusterNumbers = cah.getClusterNumbers();
+//		String[] rowNames = cah.getClusterRowNames();
+//		String[] orderedRowNames = cah.getClusterOrderedRowNames();
+//		double[] clusterHeights = cah.getClusterTreeHeights();
+//		double[][] clusterMerges = cah.getClusterTreeMerges();
+//		double[][] clusterCoords = cah.getClusterCoords();
+//
+//		double[] yValuesByOrderedRowNames = new double[rowNames.length];
+//		double[] clusterNumbersValuesByOrderedRowNames = new double[rowNames.length];
+//
+//
+//
+//		// FIXME: Sort the cluster numbers in reverse order
+////			Arrays.sort(clusterNumbers);
+////			ArrayUtils.reverse(clusterNumbers);
+////			System.out.println(Arrays.toString(clusterNumbers));
+//
+//
+//		// FIXME: tests row names
+//		//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster row names: \t\t" + Arrays.toString(rowNames));
+//
+//		// FIXME: tests ordered row names
+//		//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster ordered row names: \t" + Arrays.toString(orderedRowNames));
+//
+//		// FIXME: tests, ordered cluster numbers
+//		//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster numbers: \t\t" + Arrays.toString(clusterNumbers));
+//
+//		// FIXME: tests, cluster tree merges
+//		//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster tree merges: \t\t" + Arrays.toString(clusterMerges));
+//
+//		// FIXME: tests, heights
+////		System.err.println("JFCChartsEngine.createCAH2dChart(): cluster heights: \t\t" + Arrays.toString(clusterHeights));
+//
+//
+//		// FIXME: tests
+//		System.err.println("JFCChartsEngine.createCAH2dChart(): tests: \t\t" + Arrays.toString(cah.getInertiaGains()));
+//
+//
+//
+//		System.out.println("JFCChartsEngine.createCAH2dChart() cluster heights count: " + clusterHeights.length);
+//		for(int i = 0; i < clusterHeights.length; i++) {
+//			System.out.println("JFCChartsEngine.createCAH2dChart() cluster height: " + new DecimalFormat("0.00000000000000000").format(clusterHeights[i]));
+//		}
+//
+////
+////		String[] clusterUnorderedRowNames = cah.getClusterRowNames();
+////		for(int i = 0; i < clusterUnorderedRowNames.length; i++) {
+////			System.out.println("JFCChartsEngine.createCAH2dChart() unordered row names " + i + " : " + clusterUnorderedRowNames[i]);
+////		}
+//
+//		// Parse the merge pairs
+//		// A negative number in the FactoMineR tree merge table means a singleton
+//		for (int i = 0 ; i < clusterMerges.length ; i++) {
+//
+//			// FIXME: debug
+//			//for (int j = 0 ; j < clusterMerges.length ; j++) {
+//				System.err.println("JFCChartsEngine.createCAH2dChart(): cluster tree merges: \t\t" + Arrays.toString(clusterMerges[i]));
+//				System.err.println("JFCChartsEngine.createCAH2dChart(): row names: \t\t" + rowNames[(int) Math.abs(clusterMerges[i][0]) - 1] + " | " + rowNames[(int) Math.abs(clusterMerges[i][1]) - 1]);
+//
+//
+//			//}
+//
+//			// Leaves pair
+//			if(clusterMerges[i][0] < 0)	{
+//
+//				//System.err.print("JFCChartsEngine.createCAH2dChart(): merging: " + rowNames[(int) Math.abs(clusterMerge[i][0]) - 1]);
+//
+//				// Put the height in the ordered by names values table
+//				for(int j = 0; j < orderedRowNames.length; j++) {
+//					if(orderedRowNames[j].equals(rowNames[(int) Math.abs(clusterMerges[i][0]) - 1]))	{
+//						yValuesByOrderedRowNames[j] = clusterHeights[i];
+//						//clusterNumbersValuesByOrderedRowNames[j] = clusterNumbers[(int) Math.abs(clusterMerge[i][0]) - 1];
+//					}
+//				}
+//
+//			}
+//			// Non-singleton
+////				else	{
+////					//System.err.print("JFCChartsEngine.createCAH2dChart(): merging aggregation: " +  clusterMerge[i][0]);
+////				}
+//
+//			// Leaves pair
+//			if(clusterMerges[i][1] < 0)	{
+//				//System.err.print(" with: " + rowNames[(int) Math.abs(clusterMerge[i][1]) - 1]);
+//
+//				// Put the height in the ordered by names values table
+//				for(int j = 0; j < orderedRowNames.length; j++) {
+//					if(orderedRowNames[j].equals(rowNames[(int) Math.abs(clusterMerges[i][1]) - 1]))	{
+//						yValuesByOrderedRowNames[j] = clusterHeights[i];
+//						//clusterNumbersValuesByOrderedRowNames[j] = clusterNumbers[(int) Math.abs(clusterMerge[i][1]) - 1];
+//					}
+//
+//				}
+//
+//			}
+//			// Non-singleton
+////				else	{
+////					//System.err.print(" with aggregation: " + clusterMerge[i][1]);
+////				}
+//
+//			//System.err.println(" and height: " + clusterHeights[i] + " as aggregation: " + (i + 1));
+//
+//		}
+//
+//
+//		//
+////		for (int i = 0 ; i <  cah.getClusterTreeMerges().length; i++) {
+////			System.err.println("JFCChartsEngine.createCAH2dChart() merges : ");
+////			for(int j = 0; j < cah.getClusterTreeMerges()[i].length; j++) {
+////				System.err.print(" : " + cah.getClusterTreeMerges()[i][j]);
+////			}
+////		}
+//
+//
+//
+////		ArrayList<Double> middlePoints = cah.getClusterTreeMiddlePoints();
+////
+////		for (int i = 0 ; i <  middlePoints.size(); i++) {
+////			System.err.println("JFCChartsEngine.createCAH2dChart() middle points X: " + middlePoints.get(i));
+////		}
+//
+//
+//
+////		for (int i = 0 ; i < cah.getClusterCoords().length ; i++) {
+////			for(int j = 0; j < cah.getClusterCoords()[i].length; j++) {
+////				//System.err.println("JFCChartsEngine.createCAH2dChart(): " + cah.getClusterCoords()[i][j]);
+////				dataset.setValue(cah.getClusterCoords()[i][j], category + clusterNumbers[i], rownames[i]);
+////			}
+////		}
+//
+//
+//
+//		// Create chart title
+//		String title = "title";
+//		String xAxisLabel = "Column";
+//		if(!cah.isColumnsComputing())	{
+//			xAxisLabel = "Row";
+//		}
+//
+//
+//
+//		// Create the data set
+//		// FIXME: bar plot test
+////		for(int i = 0; i < yValuesByOrderedRowNames.length; i++) {
+////			//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[clusterNumbers.length - 1 - i], orderedRowNames[i]);
+////
+////
+////			dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[yValuesByOrderedRowNames.length - 1 - i], orderedRowNames[i]);
+////			//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[i], orderedRowNames[i]);
+////
+////			//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbersValuesByOrderedRowNames[i], orderedRowNames[i]);
+////		}
+////
+////		// Create the chart
+////        chart = this.createCategoryBarChart(dataset, title, xAxisLabel, "Height", false, false, false);
+////        ((IItemSelectionRenderer) chart.getCategoryPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_CAH_2D);
+////
+////        // Draw tree
+////        for(int j = 0; j < chart.getCategoryPlot().getDataset().getColumnCount() - 1; j++) {
+////			//System.err.println("JFCChartsEngine.createCAH2dChart(): " + chart.getCategoryPlot().getDataset().getColumnKey(j));
+////
+////
+////        	// Non-singleton pairs lines
+////			if(yValuesByOrderedRowNames[j] == yValuesByOrderedRowNames[j + 1])	{
+////				chart.getCategoryPlot().addAnnotation(new CategoryLineAnnotation(chart.getCategoryPlot().getDataset().getColumnKey(j), yValuesByOrderedRowNames[j],
+////						chart.getCategoryPlot().getDataset().getColumnKey(j + 1), yValuesByOrderedRowNames[j + 1], Color.red, new BasicStroke(2.0f)));
+////			}
+////
+////
+////			//chart.getCategoryPlot().addAnnotation(new Cate
+////
+////
+////
+////		}
+//
+//
+//
+//		// Create the data set
+//		// FIXME: step chart test
+////		for(int i = 0; i < yValuesByOrderedRowNames.length - 1; i++) {
+////			if(yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i + 1])	{
+////				dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[yValuesByOrderedRowNames.length - 1 - i], orderedRowNames[i]);
+////			}
+////		}
+//////		dataset.addValue(0, "test", "truc 1");
+//////		dataset.addValue(0.5, "test", "truc 1");
+//////		dataset.addValue(0.9, "test", "truc 1");
+////		// Create the chart
+////        chart = this.createCategoryStepChart(dataset, title, xAxisLabel, "Height", false, false);
+////        ((IItemSelectionRenderer) chart.getCategoryPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_CAH_2D);
+//
+//
+//		// Create the data set
+//		// FIXME: XY category bar chart test
+//		XYSeriesCollection dataset2 = new XYSeriesCollection();
+//
+//		// Last tree level (leaves level)
+//		XYSeries series = new XYSeries("leaves");
+//		for(int i = 0; i < yValuesByOrderedRowNames.length - 1; i++) {
+//			series.add(i, 0);
+//			series.add(i, yValuesByOrderedRowNames[i]);
+//			if(yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i + 1])	{
+//				series.add(i + 1, yValuesByOrderedRowNames[i]);
+//				series.add(i + 1, 0);
+//			}
+//			else	{
+//				series.add(i + 1, null);
+//			}
+//		}
+//		dataset2.addSeries(series);
+//
+//
+//		// Link singletons to non singleton
+//		series = new XYSeries("singleton to non singleton links");
+//		for(int i = clusterHeights.length; i >= 0; i--) {
+//
+//			// Skip non singletons case
+//			if(i > 3 && yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i - 1] && yValuesByOrderedRowNames[i - 2] == yValuesByOrderedRowNames[i - 3])	{
+//				continue;
+//			}
+//
+//			// Link singletons to non singleton
+//			if(i > 1 && yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i - 1] && yValuesByOrderedRowNames[i - 1] != yValuesByOrderedRowNames[i - 2]) {
+//				series.add(i - 0.5, yValuesByOrderedRowNames[i - 2]);
+//				series.add(i - 0.5, yValuesByOrderedRowNames[i]);
+//				series.add(i - 0.5, null);
+//				series.add(i - 2, yValuesByOrderedRowNames[i - 2]);
+//			}
+//		}
+//		dataset2.addSeries(series);
+//
+//		// Link singletons to newly created pairs
+//		series = new XYSeries("singleton to newly created pairs");
+//		for(int i = clusterHeights.length; i >= 0; i--) {
+//
+//			// Skip non singletons case
+//			if(i > 0 && yValuesByOrderedRowNames[i] == yValuesByOrderedRowNames[i - 1])	{
+//				series.add(i, null);
+//				continue;
+//			}
+//
+//			// Link singletons to newly created pairs
+//			if(i < clusterHeights.length - 1 && yValuesByOrderedRowNames[i] != yValuesByOrderedRowNames[i + 1]
+//					&& yValuesByOrderedRowNames[i + 1] != yValuesByOrderedRowNames[i + 2]
+//
+////						&& i > 1 &&
+//
+//							) {
+//
+//				series.add(i, null);
+//
+//				series.add(i, yValuesByOrderedRowNames[i]);
+//
+//				series.add(i + 1.75, yValuesByOrderedRowNames[i]);
+//				series.add(i + 1.75, yValuesByOrderedRowNames[i + 1]);
+//
+//
+//				//series.add(i - 2, yValuesByOrderedRowNames[i - 2]);
+//			}
+//		}
+//		dataset2.addSeries(series);
+//
+//
+//
+//		// Link singletons; test 2
+////		series = new XYSeries("singleton links");
+////		for(int i = 0; i <  clusterHeights.length - 2; i++) {
+////			if(i > 0 && i < clusterHeights.length - 2 && yValuesByOrderedRowNames[i] != yValuesByOrderedRowNames[i + 1] && yValuesByOrderedRowNames[i] != yValuesByOrderedRowNames[i - 1]) {
+////				series.add(i, yValuesByOrderedRowNames[i]);
+////				series.add(i + 1.5, yValuesByOrderedRowNames[i]);
+////				series.add(i + 1.5, yValuesByOrderedRowNames[i + 1]);
+////				series.add(i + 1.5, null);
+////			}
+////		}
+////		dataset2.addSeries(series);
+//
+//
+////		// Other clusters
+////		ArrayList<Double> otherClusters = new ArrayList<Double>();
+////		//series = new XYSeries("other clusters");
+////		for(int i = 0; i < clusterHeights.length; i++) {
+////			// If not a leaf
+////			boolean done = false;
+////			for(int j = 0; j < clusterNumbersValuesByOrderedRowNames.length; j++) {
+////				if(clusterHeights[i] == yValuesByOrderedRowNames[j])	{
+////					done = true;
+////					break;
+////				}
+////			}
+////			if(done)	{
+////				continue;
+////			}
+////			System.err.println("JFCChartsEngine.createCAH2dChart() other clusters: " + new DecimalFormat("0.0000000000000000").format(clusterHeights[i]));
+////		}
+////		//dataset2.addSeries(series);
+//
+//
+//
+////		dataset.addValue(0, "test", "truc 1");
+////		dataset.addValue(0.5, "test", "truc 1");
+////		dataset.addValue(0.9, "test", "truc 1");
+//		// Create the chart
+//        //chart = this.createXYBarChart(dataset2, title, xAxisLabel, "Height", false, false);
+//        chart = ChartFactory.createXYLineChart(
+//        		title,      // chart title
+//        		xAxisLabel,                      // x axis label
+//                "height",                      // y axis label
+//                dataset2,                  // data
+//                PlotOrientation.VERTICAL,
+//                true,                     // include legend
+//                true,                     // tooltips
+//                false                     // urls
+//            );
+//
+//
+//
+//
+//        chart.getXYPlot().setRenderer(this.theme.createXYLineAndShapeRenderer(true, false));
+//        ((IItemSelectionRenderer) chart.getXYPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_CAH_2D);
+//
+//
+//        //chart.getXYPlot().addAnnotation(new XYLineAnnotation(0.5,  yValuesByOrderedRowNames[0], 0.5,  yValuesByOrderedRowNames[0] + 0.002));
+//
+//
+//
+//
+//
+//
+//
+//
+//        //System.err.println("JFCChartsEngine.createCAH2dChart() " + chart.getCategoryPlot().getCategories().get(0));
+//        //chart.getCategoryPlot().addAnnotation(new CategoryLineAnnotation("1970-12-31", .0002, "1965-12-31", .00005, Color.red, new BasicStroke(2.0f)));
+//
+//        // Custom range axis for ticks drawing options
+//        //chart.getCategoryPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getCategoryPlot().getRangeAxis(), false, true, 0, DatasetUtilities.findMaximumRangeValue(chart.getCategoryPlot().getDataset()).doubleValue()));
+//
+//
+//
+//		// Apply theme to the chart
+//		this.theme.apply(chart);
+//
+//
+//
+//		// FIXME: test algo R
+//		int dimens = 2;
+//		int ax1 = 0;
+//		int ax2 = 1;
+//		double x1, y1, x2, y2, w1, w2;
+//
+//		double h1, h2; // FIXME: when using 3 dimensions
+//
+//
+//		double[][] aa = new double[clusterMerges.length][4];
+//		for(int i = 0; i < clusterMerges.length; i++) {
+//			for(int j = 0; j < 4; j++) {
+//				aa[i][j] = 0;
+//			}
+//		}
+//
+//
+//		   //aa=matrix(ncol=4, nrow=nrow(merge))
+//
+//
+//
+//
+//		// Decrement/increment the cluster merge value because the R algorithm uses 1 as first table index
+//
+//		for(int i = 0; i < clusterMerges.length; i++) {
+//			if(clusterMerges[i][0] < 0)	{
+//				clusterMerges[i][0]++;
+//			}
+//			else	{
+//				clusterMerges[i][0]--;
+//			}
+//
+//			if(clusterMerges[i][1] < 0)	{
+//				clusterMerges[i][1]++;
+//			}
+//			else	{
+//				clusterMerges[i][1]--;
+//			}
+//		}
+//
+//
+//		for(int i = 0; i < clusterMerges.length; i++) {
+//
+////		    for(i in 1:nrow(merge)){
+//			     // if(merge[i,1]<0){
+//			// Singleton
+//			if(clusterMerges[i][0] < 0)	{
+//
+//
+//			        x1 = clusterCoords[(int) -clusterMerges[i][0]][ax1];
+//			        y1 = clusterCoords[(int) -clusterMerges[i][0]][ax2];
+//
+//
+//			        h1 = 0;
+//			        w1 = 1;
+//			      }
+//			      else{
+//			        x1 = aa[(int) clusterMerges[i][0]][0];
+//			        y1 = aa[(int) clusterMerges[i][0]][1];
+//			        w1 = aa[(int) clusterMerges[i][0]][3];
+//			        h1 = aa[(int) clusterMerges[i][0]][2];
+//			      }
+//			// Singleton
+//			if(clusterMerges[i][1] < 0)	{
+//			      //if(merge[i,2]<0){
+//			        x2 = clusterCoords[-(int) clusterMerges[i][1]][ax1];
+//			        y2 = clusterCoords[-(int) clusterMerges[i][1]][ax2];
+//			        h2 = 0;
+//			        w2 = 1;
+//			      }
+//			      else{
+//			        x2 = aa[(int) clusterMerges[i][1]][0];
+//			        y2 = aa[(int) clusterMerges[i][1]][1];
+//			        w2 = aa[(int) clusterMerges[i][1]][3];
+//			        h2 = aa[(int) clusterMerges[i][1]][2];
+//			      }
+//			      aa[i][0] = (w1 * x1 + w2 * x2) / (w1 + w2);
+//			      aa[i][1] = (w1 * y1 + w2 * y2) / (w1 + w2);
+//
+//			      //if(i<=nrow(merge)-t.level+1)
+//			      if(i <= clusterMerges.length)	{
+//			    	  clusterHeights[i] = 0;
+//			      }
+//
+//			      aa[i][2] = clusterHeights[i];
+//			      aa[i][3] = w1 + w2;
+//
+////			      if(i>(nrow(merge)-t.level+1)){
+////			      if(i > clusterMerges[i][1]){ // FIXME: this test is strange
+////			        if(dimens==3) s$points3d(rbind(c(x1,y1,h1),c(x1,y1,height[i]), c(x2,y2,height[i]),c(x2,y2,h2)), lty=1, type="o", pch="")
+//			        if(dimens == 2)	{
+//			        //	lines(c(x1,x2), c(y1,y2), lwd=(height[i]/max(height))*3)
+//
+//			        	//chart.getXYPlot().addAnnotation(new XYLineAnnotation(x1, y1, x2, y2));
+//			        	// tests with steps lines
+//			        	x1 *= 10;
+//			        	x2 *= 10;
+//			        	y1 /= 100;
+//			        	y2 /= 100;
+//
+//			        	chart.getXYPlot().addAnnotation(new XYLineAnnotation(x1, y1, x1, y2));
+//			        	chart.getXYPlot().addAnnotation(new XYLineAnnotation(x1, y2, x2, y2));
+//			        	chart.getXYPlot().addAnnotation(new XYLineAnnotation(x2, y2, x2, y1));
+//
+//
+//			        	// FIXME: labels tests
+//			        	chart.getXYPlot().addAnnotation(new XYTextAnnotation(rowNames[(int) Math.abs(clusterMerges[i][0])], x1, y1));
+//			        	chart.getXYPlot().addAnnotation(new XYTextAnnotation(rowNames[(int) Math.abs(clusterMerges[i][1])], x2, y1));
+//
+//
+//
+////			        	chart.getXYPlot().addAnnotation(new XYLineAnnotation(y2, x1, y1, x1));
+//
+//
+//			        	//chart.getXYPlot().addAnnotation(new XYLineAnnotation(x2, y2, x2, y2));
+//
+//
+//			        	System.err.println("JFCChartsEngine.createCAH2dChart(): draw line " + x1 + ", " + y1 + " | " + x2 + "," + y2);
+//			        }
+////			      }
+//		//	    }
+//
+//
+//		}
+//
+//
+//		// FIXME: test symbol axis
+//		//chart.getXYPlot().setDomainAxis(new SymbolAxis("test symbol axis", new String[]{"A", "b", "c"}));
+//
+//		// FIXME: for cluster boxes we may use XYBoxAnnotation()
+//
+//
+//		//chart.getXYPlot().addAnnotation(new XYLineAnnotation(x1, y1, x2, y2));
+//
+//
+//        return chart;
+//
+//	}
+
+	// FIXME: new version with category step renderer
+//	@Override
+//	public JFreeChart createCAH2dChart(CAH cah) {
+//
+//
+//			JFreeChart chart = null;
+//
+//			// Creating the data set from the result
+//			DefaultCategoryDataset dataset = new DefaultCategoryDataset();
+//			String category = "cluster ";
+//
+//
+//
+//			int[] clusterNumbers = cah.getClusterNumbers();
+//			String[] rowNames = cah.getClusterRowNames();
+//			String[] orderedRowNames = cah.getClusterOrderedRowNames();
+//			double[] clusterHeights = cah.getClusterTreeHeights();
+//			double[][] clusterMerge = cah.getClusterTreeMerges();
+//
+//
+//			double[] yValuesByOrderedRowNames = new double[rowNames.length];
+//			double[] clusterNumbersValuesByOrderedRowNames = new double[rowNames.length];
+//
+//
+//
+//			// FIXME: Sort the cluster numbers in reverse order
+////			Arrays.sort(clusterNumbers);
+////			ArrayUtils.reverse(clusterNumbers);
+////			System.out.println(Arrays.toString(clusterNumbers));
+//
+//
+//			// FIXME: tests row names
+//			//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster row names: \t\t" + Arrays.toString(rowNames));
+//
+//			// FIXME: tests ordered row names
+//			//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster ordered row names: \t" + Arrays.toString(orderedRowNames));
+//
+//			// FIXME: tests, ordered cluster numbers
+//			//System.err.println("JFCChartsEngine.createCAH2dChart(): cluster number: \t\t" + Arrays.toString(clusterNumbers));
+//
+//
+//
+//			for (int i = 0 ; i < clusterMerge.length ; i++) {
+//
+//				// Singleton
+//				if(clusterMerge[i][0] < 0)	{
+//
+//					//System.err.print("JFCChartsEngine.createCAH2dChart(): merging: " + rowNames[(int) Math.abs(clusterMerge[i][0]) - 1]);
+//
+//					// Put the height in the ordered by names values table
+//					for(int j = 0; j < orderedRowNames.length; j++) {
+//						if(orderedRowNames[j].equals(rowNames[(int) Math.abs(clusterMerge[i][0]) - 1]))	{
+//							yValuesByOrderedRowNames[j] = clusterHeights[i];
+//							//clusterNumbersValuesByOrderedRowNames[j] = clusterNumbers[(int) Math.abs(clusterMerge[i][0]) - 1];
+//						}
+//					}
+//
+//				}
+//				// Non-singleton
+//				else	{
+//					//System.err.print("JFCChartsEngine.createCAH2dChart(): merging aggregation: " +  clusterMerge[i][0]);
+//				}
+//
+//				// Singleton
+//				if(clusterMerge[i][1] < 0)	{
+//					//System.err.print(" with: " + rowNames[(int) Math.abs(clusterMerge[i][1]) - 1]);
+//
+//					// Put the height in the ordered by names values table
+//					for(int j = 0; j < orderedRowNames.length; j++) {
+//						if(orderedRowNames[j].equals(rowNames[(int) Math.abs(clusterMerge[i][1]) - 1]))	{
+//							yValuesByOrderedRowNames[j] = clusterHeights[i];
+//							//clusterNumbersValuesByOrderedRowNames[j] = clusterNumbers[(int) Math.abs(clusterMerge[i][1]) - 1];
+//						}
+//
+//					}
+//
+//				}
+//				// Non-singleton
+//				else	{
+//					//System.err.print(" with aggregation: " + clusterMerge[i][1]);
+//				}
+//
+//				//System.err.println(" and height: " + clusterHeights[i] + " as aggregation: " + (i + 1));
+//
+//			}
+//
+//
+//			// Create the data set
+//
+//			for(int i = 0; i < yValuesByOrderedRowNames.length; i++) {
+//				//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[clusterNumbers.length - 1 - i], orderedRowNames[i]);
+//
+//				dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbers[yValuesByOrderedRowNames.length - 1 - i], orderedRowNames[i]);
+//				//dataset.setValue(yValuesByOrderedRowNames[i], category, orderedRowNames[i]);
+//
+//				//dataset.setValue(yValuesByOrderedRowNames[i], category + clusterNumbersValuesByOrderedRowNames[i], orderedRowNames[i]);
+//			}
+//
+////
+////			for (int i = 0 ; i <  cah.getClusterTreeMerges().length; i++) {
+////				System.err.println("JFCChartsEngine.createCAH2dChart() merges : ");
+////				for(int j = 0; j < cah.getClusterTreeMerges()[i].length; j++) {
+////					System.err.print(" : " + cah.getClusterTreeMerges()[i][j]);
+////				}
+////			}
+//
+//
+//
+////			ArrayList<Double> middlePoints = cah.getClusterTreeMiddlePoints();
+////
+////			for (int i = 0 ; i <  middlePoints.size(); i++) {
+////				System.err.println("JFCChartsEngine.createCAH2dChart() middle points X: " + middlePoints.get(i));
+////			}
+//
+//
+//
+////			for (int i = 0 ; i < cah.getClusterCoords().length ; i++) {
+////				for(int j = 0; j < cah.getClusterCoords()[i].length; j++) {
+////					//System.err.println("JFCChartsEngine.createCAH2dChart(): " + cah.getClusterCoords()[i][j]);
+////					dataset.setValue(cah.getClusterCoords()[i][j], category + clusterNumbers[i], rownames[i]);
+////				}
+////			}
+//
+//
+//
+//			// Create chart title
+//			String title = "title";
+//			String xAxisLabel = "Column";
+//			if(!cah.isColumnsComputing())	{
+//				xAxisLabel = "Row";
+//			}
+//
+//
+//			// Create the chart
+//	        chart = this.createCategoryStepChart(dataset, title, xAxisLabel, "Height", false, false);
+//
+//
+//	        ((IItemSelectionRenderer) chart.getCategoryPlot().getRenderer()).setChartType(ChartsEngine.CHART_TYPE_CAH_2D);
+//
+//
+//	        // Draw tree
+//	        chart.getCategoryPlot().addAnnotation(new CategoryLineAnnotation(chart.getCategoryPlot().getDataset().getColumnKey(0), 5.0,
+//	        		chart.getCategoryPlot().getDataset().getColumnKey(1), 8.0, Color.red, new BasicStroke(2.0f)));
+//
+//	        // Custom range axis for ticks drawing options: cut the range to minimum and maximum values
+//	        chart.getCategoryPlot().setRangeAxis(new ExtendedNumberAxis((NumberAxis) chart.getCategoryPlot().getRangeAxis(), false, true, 0, DatasetUtilities.findMaximumRangeValue(chart.getCategoryPlot().getDataset()).doubleValue()));
+//
+//
+//		return chart;
+//
+//
+//
+//
+//	}
+	
+
+
+	
+
+}

Property changes on: tmp/org.txm.cah.core/src/org/txm/cah/core/chartsengine/jfreechart/JFCAHCChartCreator.java
___________________________________________________________________
Added: svn:mime-type
   + text/plain

Index: tmp/org.txm.cah.core/plugin.xml
===================================================================
--- tmp/org.txm.cah.core/plugin.xml	(revision 527)
+++ tmp/org.txm.cah.core/plugin.xml	(revision 528)
@@ -4,14 +4,14 @@
    <extension
          point="org.eclipse.core.runtime.preferences">
       <initializer
-            class="org.txm.cah.core.preferences.CAHPreferences">
+            class="org.txm.cah.core.preferences.AHCPreferences">
       </initializer>
    </extension>
    <extension
          point="org.txm.chartsengine.chartcreator">
       <ChartCreator
-            class="org.txm.cah.core.chartsengine.r.RCAHChartCreator"
-            fileNamePrefix="cah">
+            class="org.txm.cah.core.chartsengine.r.RAHCChartCreator"
+            fileNamePrefix="ahc">
       </ChartCreator>
    </extension>
 
Index: tmp/org.txm.cah.core/META-INF/MANIFEST.MF
===================================================================
--- tmp/org.txm.cah.core/META-INF/MANIFEST.MF	(revision 527)
+++ tmp/org.txm.cah.core/META-INF/MANIFEST.MF	(revision 528)
@@ -1,6 +1,6 @@
 Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
-Bundle-Name: CAH Core
+Bundle-Name: AHC Core
 Bundle-SymbolicName: org.txm.cah.core;singleton:=true
 Bundle-Version: 1.0.0.qualifier
 Require-Bundle: org.txm.utils;bundle-version="1.0.0";visibility:=reexport,
Index: tmp/org.txm.internalview.rcp/src/org/txm/internal/rcp/editors/InternalViewEditor.java
===================================================================
--- tmp/org.txm.internalview.rcp/src/org/txm/internal/rcp/editors/InternalViewEditor.java	(revision 527)
+++ tmp/org.txm.internalview.rcp/src/org/txm/internal/rcp/editors/InternalViewEditor.java	(revision 528)
@@ -140,10 +140,10 @@
 				JobsTimer.start();
 				monitor.beginTask(Messages.InternalViewEditor_2, 100);
 				try {
-					if (!(internalView.validateParameters() && internalView.isDirty()))
+					if (!(internalView.canCompute() && internalView.isDirty()))
 						return Status.CANCEL_STATUS;
 
-					internalView.compute(monitor);
+					internalView.compute(false, monitor);
 					firePropertyChange(PROP_DIRTY); // refresh the dirtiness state
 					line = internalView.getCurrentPage(); // get the first page if pCurrentPage is not set
 					monitor.beginTask(Messages.InternalViewEditor_3, 100);
