Revision 633

tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swing/SVGPanel.java (revision 633)
46 46
import org.apache.batik.swing.gvt.Interactor;
47 47
import org.txm.chartsengine.rcp.IChartComponent;
48 48
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
49
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
49
import org.txm.chartsengine.rcp.editors.ChartEditor;
50 50
import org.txm.chartsengine.rcp.events.ChartKeyListener;
51 51
import org.w3c.dom.svg.SVGDocument;
52 52

  
......
60 60
	/**
61 61
	 * The linked editor.
62 62
	 */
63
	protected ChartEditorPart editor;
63
	protected ChartEditor editor;
64 64

  
65 65
	/**
66 66
	 *  The Constant serialVersionUID.
......
404 404
	}
405 405

  
406 406
	@Override
407
	public ChartEditorPart getChartEditor() {
407
	public ChartEditor getChartEditor() {
408 408
		return this.editor;
409 409
	}
410 410

  
411 411
	@Override
412
	public void setChartEditor(ChartEditorPart editor) {
412
	public void setChartEditor(ChartEditor editor) {
413 413
		this.editor = editor;
414 414
	}
415 415

  
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/swt/SVGComposite.java (revision 633)
19 19
import org.eclipse.swt.awt.SWT_AWT;
20 20
import org.eclipse.swt.widgets.Composite;
21 21
import org.txm.chartsengine.rcp.IChartComponent;
22
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
22
import org.txm.chartsengine.rcp.editors.ChartEditor;
23 23
import org.txm.chartsengine.rcp.events.EventCallBackHandler;
24 24
import org.txm.chartsengine.rcp.swt.ChartComposite;
25 25
import org.txm.chartsengine.svgbatik.rcp.swing.SVGPanel;
......
57 57
	 * @param parent
58 58
	 * @param style
59 59
	 */
60
	public SVGComposite(ChartEditorPart chartEditor, Composite parent, int style) {
60
	public SVGComposite(ChartEditor chartEditor, Composite parent, int style) {
61 61
		super(chartEditor, parent, style);
62 62
	
63 63
		this.file = null;
tmp/org.txm.chartsengine.svgbatik.rcp/src/org/txm/chartsengine/svgbatik/rcp/SVGSWTChartsComponentsProvider.java (revision 633)
20 20
import org.txm.chartsengine.core.ChartsEngine;
21 21
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
22 22
import org.txm.chartsengine.rcp.editors.ChartEditorInput;
23
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
23
import org.txm.chartsengine.rcp.editors.ChartEditor;
24 24
import org.txm.chartsengine.rcp.swt.ChartComposite;
25 25
import org.txm.chartsengine.svgbatik.rcp.swing.SVGPanel;
26 26
import org.txm.chartsengine.svgbatik.rcp.swt.SVGComposite;
......
65 65

  
66 66

  
67 67
	 @Override
68
	 public ChartComposite createComposite(ChartEditorPart chartEditor, Composite parent)	{
68
	 public ChartComposite createComposite(ChartEditor chartEditor, Composite parent)	{
69 69
		 return SVGSWTChartsComponentsProvider.createCompositeStatic(chartEditor, parent);
70 70
	 }
71 71

  
......
76 76
	  * @param parent
77 77
	  * @return
78 78
	  */
79
	 public static SVGComposite createCompositeStatic(ChartEditorPart chartEditor, Composite parent)	{
79
	 public static SVGComposite createCompositeStatic(ChartEditor chartEditor, Composite parent)	{
80 80
		 return new SVGComposite(chartEditor, parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
81 81
	 }
82 82

  
......
107 107

  
108 108

  
109 109
	@Override
110
	public File exportView(ChartEditorPart chartEditor, File file, String fileFormat) {
110
	public File exportView(ChartEditor chartEditor, File file, String fileFormat) {
111 111
		return SVGSWTChartsComponentsProvider.exportViewStatic(chartEditor, file, fileFormat);
112 112
	}
113 113

  
......
119 119
	 * @param fileFormat
120 120
	 * @return
121 121
	 */
122
	public static File exportViewStatic(ChartEditorPart chartEditor, File file, String fileFormat)	{
122
	public static File exportViewStatic(ChartEditor chartEditor, File file, String fileFormat)	{
123 123

  
124 124
		SVGComposite composite = ((SVGComposite) chartEditor.getComposite());
125 125

  
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 633)
20 20
import org.eclipse.swt.widgets.Text;
21 21
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
22 22
import org.txm.chartsengine.r.core.themes.DefaultTheme;
23
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
23
import org.txm.chartsengine.rcp.editors.ChartEditor;
24 24
import org.txm.core.results.Parameter;
25 25
import org.txm.progression.core.functions.Progression;
26 26
import org.txm.progression.core.preferences.ProgressionPreferences;
27 27
import org.txm.progression.rcp.messages.ProgressionUIMessages;
28 28
import org.txm.rcp.IImageKeys;
29 29
import org.txm.rcp.StatusLine;
30
import org.txm.rcp.editors.TXMEditorPart;
30
import org.txm.rcp.editors.TXMEditor;
31 31
import org.txm.rcp.editors.listeners.ComputeKeyListener;
32 32
import org.txm.rcp.editors.listeners.ComputeSelectionListener;
33 33
import org.txm.rcp.swt.widget.AssistedQueryWidget;
......
43 43
 * @author sjacquot
44 44
 *
45 45
 */
46
public class ProgressionEditor extends ChartEditorPart<Progression> {
46
public class ProgressionEditor extends ChartEditor<Progression> {
47 47

  
48 48

  
49 49
	/** The query widgets. */
......
326 326

  
327 327
		protected AssistedQueryWidget focusTextBox;
328 328
		
329
		protected TXMEditorPart editor;
329
		protected TXMEditor editor;
330 330
		
331 331
		/**
332 332
		 * 
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/chartsengine/events/ProgressionSelectionListener.java (revision 633)
2 2

  
3 3
import org.eclipse.swt.events.SelectionEvent;
4 4
import org.eclipse.swt.events.SelectionListener;
5
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
5
import org.txm.chartsengine.rcp.editors.ChartEditor;
6 6

  
7 7
/**
8 8
 * Progression selection listener.
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 633)
32 32
import org.txm.chartsengine.core.ChartsEngine;
33 33
import org.txm.chartsengine.r.core.RChartsEngine;
34 34
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
35
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
35
import org.txm.chartsengine.rcp.editors.ChartEditor;
36 36
import org.txm.chartsengine.svgbatik.rcp.SVGSWTChartsComponentsProvider;
37 37
import org.txm.progression.core.functions.Progression;
38 38
import org.txm.progression.core.messages.ProgressionCoreMessages;
......
97 97
			tmpSWTComponentsProvider.setChartsEngine(tmpChartsEngine);
98 98
			
99 99
			// Create and open the chart editor
100
			//ChartEditorPart.compute(progression, tmpSWTComponentsProvider);
100
			//ChartEditor.compute(progression, tmpSWTComponentsProvider);
101 101
			
102 102
		}
103 103
		else	{
104 104
			// Create and open the chart editor
105
			//ChartEditorPart.compute(progression);
105
			//ChartEditor.compute(progression);
106 106
		}
107 107

  
108
		ChartEditorPart.openEditor(progression);
108
		ChartEditor.openEditor(progression);
109 109
		
110 110
		return null;
111 111
	}
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/ComputeCooccurrences.java (revision 633)
39 39
import org.txm.core.preferences.TXMPreferences;
40 40
import org.txm.rcp.RCPMessages;
41 41
import org.txm.rcp.StatusLine;
42
import org.txm.rcp.editors.TXMEditorPart;
42
import org.txm.rcp.editors.TXMEditor;
43 43
import org.txm.rcp.editors.TXMResultEditorInput;
44 44
import org.txm.rcp.handlers.BaseAbstractHandler;
45 45
import org.txm.rcp.utils.Logger;
......
128 128
			StatusLine.setMessage(RCPMessages.ComputeCooccurrences_0);
129 129

  
130 130
			//System.out.println("DEBUG: opening cooc: "+cooc+" corpus="+cooc.getCorpus());
131
			TXMEditorPart.openEditor(cooc, CooccurrencesEditor.ID);
131
			TXMEditor.openEditor(cooc, CooccurrencesEditor.ID);
132 132
			
133 133
			return true;
134 134
		} catch (Exception e) {
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 633)
78 78
import org.txm.core.preferences.TXMPreferences;
79 79
import org.txm.core.results.TXMParameters;
80 80
import org.txm.rcp.RCPMessages;
81
import org.txm.rcp.editors.TXMEditorPart;
81
import org.txm.rcp.editors.TXMEditor;
82 82
import org.txm.rcp.editors.TXMResultEditorInput;
83 83
import org.txm.rcp.editors.TableKeyListener;
84 84
import org.txm.rcp.preferences.RCPPreferences;
......
97 97
 * 
98 98
 * @author mdecorde
99 99
 */
100
public class CooccurrencesEditor extends TXMEditorPart<Cooccurrence> {
100
public class CooccurrencesEditor extends TXMEditor<Cooccurrence> {
101 101

  
102 102
	/** The Constant ID. */
103 103
	public static final String ID = CooccurrencesEditor.class.getName(); //$NON-NLS-1$
......
275 275
//				updateResultFromEditor();
276 276
//				compute(true);
277 277
//				// FIXME old method
278
//				//TXMEditorPart.compute(CooccurrencesEditor.this.getResultData(), true, CooccurrencesEditor.this);
278
//				//TXMEditor.compute(CooccurrencesEditor.this.getResultData(), true, CooccurrencesEditor.this);
279 279
//			}
280 280
//
281 281
//			@Override
......
757 757
				sort();
758 758

  
759 759
				// Pack the columns
760
				TXMEditorPart.packColumns(viewer);
760
				TXMEditor.packColumns(viewer);
761 761
				
762 762
				// FIXME: need to be done in another way with after the plugin split
763 763
				QueriesView.refresh();
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 633)
122 122
import org.txm.rcp.StatusLine;
123 123
import org.txm.rcp.TXMWindows;
124 124
import org.txm.rcp.editors.TXMBrowser;
125
import org.txm.rcp.editors.TXMEditorPart;
125
import org.txm.rcp.editors.TXMEditor;
126 126
import org.txm.rcp.editors.TXMResultEditorInput;
127 127
import org.txm.rcp.editors.TableKeyListener;
128 128
import org.txm.rcp.preferences.RCPPreferences;
......
148 148
 * 
149 149
 * @author mdecorde.
150 150
 */
151
public class ConcordanceEditor extends TXMEditorPart<Concordance> {
151
public class ConcordanceEditor extends TXMEditor<Concordance> {
152 152

  
153 153
	public static final String ID = ConcordanceEditor.class.getName();
154 154

  
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifictiesSelectionChart.java (revision 633)
7 7
import org.eclipse.ui.IWorkbenchPage;
8 8
import org.eclipse.ui.IWorkbenchWindow;
9 9
import org.eclipse.ui.handlers.HandlerUtil;
10
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
10
import org.txm.chartsengine.rcp.editors.ChartEditor;
11 11
import org.txm.rcp.handlers.BaseAbstractHandler;
12 12
import org.txm.rcp.views.corpora.CorporaView;
13 13
import org.txm.specificities.core.functions.Specificities;
......
80 80
		}
81 81
		
82 82
		
83
		ChartEditorPart.openEditor(specificitiesSelection);
83
		ChartEditor.openEditor(specificitiesSelection);
84 84
		
85 85
		return null;
86 86
	}
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifities.java (revision 633)
34 34
import org.txm.lexicaltable.core.preferences.LexicalTablePreferences;
35 35
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor;
36 36
import org.txm.rcp.RCPMessages;
37
import org.txm.rcp.editors.TXMEditorPart;
37
import org.txm.rcp.editors.TXMEditor;
38 38
import org.txm.rcp.handlers.BaseAbstractHandler;
39 39
import org.txm.rcp.views.corpora.CorporaView;
40 40
import org.txm.searchengine.cqp.corpus.Partition;
......
113 113
				
114 114
			}
115 115
			
116
			TXMEditorPart.openEditor(specificities, SpecificitiesEditor.ID);
116
			TXMEditor.openEditor(specificities, SpecificitiesEditor.ID);
117 117
			
118 118
		}
119 119
		catch (Exception e) {
......
200 200
//
201 201
//							//editorInput = new SpecificitiesResultEditorInput(specifResFinal);
202 202
//							
203
//							//TXMEditorPart.openEditor(new TXMResultEditorInput(new Specificities(lexicalTable, maxScore)), SpecificitiesEditor.ID);
203
//							//TXMEditor.openEditor(new TXMResultEditorInput(new Specificities(lexicalTable, maxScore)), SpecificitiesEditor.ID);
204 204
//						}
205 205
//					});
206 206
//					
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 633)
7 7
import org.eclipse.swt.widgets.Label;
8 8
import org.eclipse.swt.widgets.Spinner;
9 9
import org.eclipse.swt.widgets.ToolItem;
10
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
10
import org.txm.chartsengine.rcp.editors.ChartEditor;
11 11
import org.txm.rcp.IImageKeys;
12 12
import org.txm.specificities.core.functions.SpecificitiesSelection;
13 13
import org.txm.specificities.rcp.handlers.ComputeSpecifities;
......
20 20
 * @author sjacquot
21 21
 *
22 22
 */
23
public class SpecificitiesSelectionEditor extends ChartEditorPart<SpecificitiesSelection> {
23
public class SpecificitiesSelectionEditor extends ChartEditor<SpecificitiesSelection> {
24 24

  
25 25

  
26 26
	@Override
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesTableLabelProvider.java (revision 633)
27 27
//
28 28
package org.txm.specificities.rcp.editors;
29 29

  
30
import org.eclipse.jface.viewers.ILabelProviderListener;
31 30
import org.eclipse.jface.viewers.ITableLabelProvider;
32 31
import org.eclipse.jface.viewers.LabelProvider;
33 32
import org.eclipse.swt.graphics.Image;
34 33
import org.txm.core.preferences.TXMPreferences;
35 34
import org.txm.specificities.core.preferences.SpecificitiesPreferences;
36 35

  
37
// TODO: Auto-generated Javadoc
38
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
39
// create the specificites table (as many columns as parts)
40
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
41

  
42 36
/**
43 37
 * The Class SpecificitesTableLabelProvider.
38
 * create the specificites table (as many columns as parts)
44 39
 */
45 40
class SpecificitiesTableLabelProvider extends LabelProvider implements ITableLabelProvider {
46 41

  
......
59 54
		//this.partindexes = partindexes;
60 55
		//showPValues = "true".equals(Toolbox.getParam(SpecificitiesPreferencePage.SPECIF_PVALUES)); //$NON-NLS-1$
61 56
		this.format = TXMPreferences.getString(SpecificitiesPreferences.FORMAT, SpecificitiesPreferences.PREFERENCES_NODE);
62
		if (format == null || format.trim().length() == 0) format = "%,.1f"; //$NON-NLS-1$
57
		if (format == null || format.trim().length() == 0) {
58
			format = "%,.1f"; //$NON-NLS-1$
59
		}
63 60
	}
64 61

  
65 62
	/* (non-Javadoc)
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 633)
30 30
import java.text.Collator;
31 31
import java.util.Locale;
32 32

  
33
import org.eclipse.jface.viewers.ArrayContentProvider;
33 34
import org.eclipse.jface.viewers.ISelection;
34
import org.eclipse.jface.viewers.IStructuredContentProvider;
35 35
import org.eclipse.jface.viewers.TableViewer;
36
import org.eclipse.jface.viewers.Viewer;
37 36
import org.eclipse.osgi.util.NLS;
38 37
import org.eclipse.swt.SWT;
39 38
import org.eclipse.swt.layout.GridData;
40 39
import org.eclipse.swt.layout.GridLayout;
41 40
import org.eclipse.swt.widgets.Composite;
42
import org.eclipse.swt.widgets.Display;
43 41
import org.eclipse.swt.widgets.Label;
44 42
import org.eclipse.swt.widgets.ScrollBar;
45 43
import org.eclipse.swt.widgets.Spinner;
46 44
import org.eclipse.swt.widgets.Table;
47 45
import org.eclipse.swt.widgets.TableColumn;
46
import org.txm.core.results.Parameter;
48 47
import org.txm.objects.TxmObject;
49 48
import org.txm.rcp.RCPMessages;
50
import org.txm.rcp.editors.TXMEditorPart;
49
import org.txm.rcp.editors.TXMEditor;
51 50
import org.txm.rcp.editors.TableKeyListener;
52 51
import org.txm.specificities.core.functions.Specificities;
52
import org.txm.specificities.core.preferences.SpecificitiesPreferences;
53 53
import org.txm.specificities.rcp.messages.SpecificitiesUIMessages;
54 54
import org.txm.statsengine.core.StatException;
55 55
import org.txm.utils.logger.Log;
......
62 62
 * @author sloiseau 
63 63
 * 
64 64
 */
65
public class SpecificitiesEditor extends TXMEditorPart<Specificities> {
65
public class SpecificitiesEditor extends TXMEditor<Specificities> {
66 66

  
67 67
	public final static String ID = SpecificitiesEditor.class.getName();
68 68

  
......
76 76
	/** Column for table typeFrequencyColumn. */
77 77
	private TableColumn typeFrequencyColumn;
78 78

  
79
	protected Spinner maxScore;
80 79
	
81 80
	/**
82 81
	 * Viewer comparator for sorting.
83 82
	 */
84 83
	protected SpecificitiesLinesViewerComparator viewerComparator;
84

  
85 85
	
86
	/**
87
	 * Maximum score.
88
	 */
89
	@Parameter(key=SpecificitiesPreferences.MAX_SCORE)
90
	protected Spinner maxScore;
91

  
86 92
	
87 93
	
88 94
	
89 95
	@Override
90 96
	public void _createPartControl(Composite parent) {
91
//		super.createPartControl(parent);
92 97

  
93 98
		// max score parameter
94 99
		Composite parametersArea = this.getCommandParametersGroup();
......
97 102
		this.maxScore = new Spinner(parametersArea, SWT.BORDER);
98 103
		this.maxScore.setToolTipText("The maximum score to show");
99 104
		this.maxScore.setMinimum(0);
100
		this.maxScore.setSelection(this.getResult().getMaxScore());
105
		
106
		// result area
101 107
		try {
102
			composeDisplayArea();
103
			this.refresh(false);
104
		} catch (StatException e) {
105
			System.err.println(NLS.bind(SpecificitiesUIMessages.SpecificitiesTableEditor_0, e.getMessage()));
106
			e.printStackTrace();
107
		}
108
	}
108
			
109
			Composite resultArea = this.getResultArea();
110
			
111
			GridLayout layout = new GridLayout(2, false);
112
			layout.marginWidth = layout.marginHeight = layout.horizontalSpacing = 0;
113
			resultArea.setLayout(layout);
109 114

  
115
			// create table viewer
116
			viewer = new TableViewer(resultArea, SWT.VIRTUAL | SWT.MULTI | SWT.FULL_SELECTION);
117
			viewer.getTable().addKeyListener(new TableKeyListener(viewer));
118
			viewer.getTable().setLinesVisible(true);
119
			viewer.getTable().setHeaderVisible(true);
120
			viewer.setLabelProvider(new SpecificitiesTableLabelProvider());
121
			viewer.setContentProvider(ArrayContentProvider.getInstance());
110 122

  
111
	/**
112
	 * Compose display area.
113
	 *
114
	 * @param parent the parent
115
	 * @throws StatException the stat exception
116
	 */
117
	private void composeDisplayArea() throws StatException {
123
			// Creates the collator for sorting the lines
124
			Object resultParent = this.getResult().getParent();
125
			Locale locale = Locale.getDefault();
126
			if (resultParent instanceof TxmObject) {
127
				String lang = (String) ((TxmObject) resultParent).getAttribute("lang"); //$NON-NLS-1$
128
				if (lang != null) {
129
					locale = new Locale(lang);
130
				}
131
			}
132
			final Collator collator = Collator.getInstance(locale);
133
			collator.setStrength(Collator.TERTIARY);
118 134

  
119
		Composite parent = this.getResultArea();
120
		//parent.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
135
			// creates the viewer comparator
136
			this.viewerComparator = new SpecificitiesLinesViewerComparator(collator);
137
			viewer.setComparator(this.viewerComparator);
121 138

  
122
		
123
		GridLayout layout = new GridLayout(2, false);
124
		layout.marginWidth = layout.marginHeight = layout.horizontalSpacing = 0;
125
		parent.setLayout(layout);
139
			specificitesTable = viewer.getTable();
140
			specificitesTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2));
126 141

  
127
		// create table viewer
128
		viewer = new TableViewer(parent, SWT.VIRTUAL | SWT.MULTI | SWT.FULL_SELECTION);
129
		viewer.getTable().addKeyListener(new TableKeyListener(viewer));
130
		viewer.getTable().setLinesVisible(true);
131
		viewer.getTable().setHeaderVisible(true);
132
		viewer.setLabelProvider(new SpecificitiesTableLabelProvider());
133
		viewer.setContentProvider(new IStructuredContentProvider() {
134
			@Override
135
			public Object[] getElements(Object inputElement) {
136
				return (Object[]) inputElement;
137
			}
142
			// create 1st column
143
			typeNameColumn = new TableColumn(specificitesTable, SWT.NONE);
144
			typeNameColumn.setText(RCPMessages.ReferencerEditor_9);
145
			typeNameColumn.setToolTipText(RCPMessages.ReferencerEditor_9);
146
			typeNameColumn.setAlignment(SWT.RIGHT);
147
			typeNameColumn.pack();
148
			typeNameColumn.setWidth((int) (typeNameColumn.getWidth() * 1.5));
149
			viewerComparator.addSelectionAdapter(viewer, typeNameColumn, 0);
150
			
151
			
152
			// create 2nd column
153
			typeFrequencyColumn = new TableColumn(viewer.getTable(), SWT.NONE);
154
			typeFrequencyColumn.setText(RCPMessages.FrequencyListEditorInput_4 + " " + SpecificitiesUIMessages.SpecificitiesTableEditor_11 + " " + this.getResult().getCorpusSize()); //$NON-NLS-1$ //$NON-NLS-2$
155
			typeFrequencyColumn.setToolTipText(RCPMessages.FrequencyListEditorInput_4 + SpecificitiesUIMessages.SpecificitiesTableEditor_11 + this.getResult().getCorpusSize()); 
156
			typeFrequencyColumn.setAlignment(SWT.RIGHT);
157
			typeFrequencyColumn.pack();
158
			
159
			viewerComparator.addSelectionAdapter(viewer, typeFrequencyColumn, 1);
160
			
161
			
162
			// add a separator column
163
			TableColumn separatorColumn = new TableColumn(specificitesTable, SWT.NONE);
164
			separatorColumn.setResizable(false);
138 165

  
139
			@Override
140
			public void dispose() {
166
			String[] partNames = null;
167
			int[] partSize = null;
168
			try {
169
				partNames = this.getResult().getPartShortNames();
170
				partSize = this.getResult().getPartSizes();
171
			} catch (StatException e) {
172
				System.err.println(NLS.bind(SpecificitiesUIMessages.SpecificitiesTableEditor_5, e));
173
				Log.printStackTrace(e);
174
				return;
141 175
			}
176
			// System.out.println("partnames: "+Arrays.toString(partNames));
177
			for (int i = 0, columnIndex = 2; i < partNames.length ; i++) { // for each part
142 178

  
143
			@Override
144
			public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
145
			}
146
		});
179
				//FREQ COLUMN
180
				final TableColumn freqpartTableColumn = new TableColumn(specificitesTable, SWT.NONE);
181
				freqpartTableColumn.setText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
182
				freqpartTableColumn.setToolTipText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
183
				// System.out.println("create column "+partNames[i]);
184
				freqpartTableColumn.setAlignment(SWT.RIGHT);
185
				freqpartTableColumn.pack();
186
				
187
				viewerComparator.addSelectionAdapter(viewer, freqpartTableColumn, ++columnIndex);
147 188

  
189
				//SCORE COLUMN
190
				final TableColumn partTableColumn = new TableColumn(specificitesTable, SWT.NONE);
191
				partTableColumn.setText("score");//partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
192
				partTableColumn.setToolTipText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
193
				// System.out.println("create column "+partNames[i]);
194
				partTableColumn.setAlignment(SWT.RIGHT);
195
				partTableColumn.pack();
148 196

  
149
		// Creates the collator for sorting the lines
150
		Object oparent = this.getResult().getParent();
151
		Locale locale = Locale.getDefault();
152
		if (oparent instanceof TxmObject) {
153
			String lang = (String) ((TxmObject) oparent).getAttribute("lang"); //$NON-NLS-1$
154
			if (lang != null) {
155
				locale = new Locale(lang);
197
				viewerComparator.addSelectionAdapter(viewer, partTableColumn, ++columnIndex);
198
				
156 199
			}
157
		}
158
		final Collator collator = Collator.getInstance(locale);
159
		collator.setStrength(Collator.TERTIARY);
160 200

  
161
		// creates the viewer comparator
162
		this.viewerComparator = new SpecificitiesLinesViewerComparator(collator);
163
		viewer.setComparator(this.viewerComparator);
201
			specificitesTable.setHeaderVisible(true);
164 202

  
165
		
166
		
167
		specificitesTable = viewer.getTable();
168
		GridData table2Data = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2);
169
		specificitesTable.setLayoutData(table2Data);
203
			// Horizontal bar on second table takes up a little extra space.
204
			// To keep vertical scroll bars in sink, force table1 to end above
205
			// horizontal scrollbar
206
			ScrollBar hBarRight = specificitesTable.getHorizontalBar();
207
			Label spacer = new Label(resultArea, SWT.NONE);
208
			GridData spacerData = new GridData();
209
			spacerData.heightHint = hBarRight.getSize().y;
210
			spacer.setLayoutData(spacerData);
211
			spacer.setVisible(false);
170 212

  
171
		// create 1st column
172
		typeNameColumn = new TableColumn(specificitesTable, SWT.NONE);
173
		typeNameColumn.setText(RCPMessages.ReferencerEditor_9);
174
		typeNameColumn.setToolTipText(RCPMessages.ReferencerEditor_9);
175
		typeNameColumn.setAlignment(SWT.RIGHT);
176
		typeNameColumn.pack();
177
		typeNameColumn.setWidth((int) (typeNameColumn.getWidth() * 1.5));
178

  
179
//		typeNameColumn.addSelectionListener(new SelectionListener() {
180
//			@Override
181
//			public void widgetSelected(SelectionEvent e) {
182
//				StatusLine.setMessage(RCPMessages.SORT_COLUMN);
183
//				Comparator column_comparator = new Comparator() {
184
//					@Override
185
//					public int compare(Object o1, Object o2) {
186
//						Object[] line1 = (Object[]) o1;
187
//						Object[] line2 = (Object[]) o2;
188
//						return collator.compare(line1[0], line2[0]);
189
//					}
190
//				};
191
//				if (specificitesTable.getSortColumn() != typeNameColumn) {
192
//					specificitesTable.setSortColumn(typeNameColumn);
193
//					specificitesTable.setSortDirection(SWT.UP);
194
//				}
195
//				else if (specificitesTable.getSortDirection() == SWT.UP) {
196
//					specificitesTable.setSortDirection(SWT.DOWN);
197
//					column_comparator = new ReverseComparator(column_comparator);
198
//				}
199
//				else {
200
//					specificitesTable.setSortDirection(SWT.UP);
201
//				}
202
//				currentComparator = column_comparator;
203
//				sort();
204
//				StatusLine.setMessage(""); //$NON-NLS-1$
205
//			}
206
//
207
//			@Override
208
//			public void widgetDefaultSelected(SelectionEvent e) {
209
//			}
210
//		});
211

  
212
		viewerComparator.addSelectionAdapter(viewer, typeNameColumn, 0);
213
		
214
		
215
		// create 2nd column
216
		typeFrequencyColumn = new TableColumn(viewer.getTable(), SWT.NONE);
217
		typeFrequencyColumn.setText(RCPMessages.FrequencyListEditorInput_4 + " " + SpecificitiesUIMessages.SpecificitiesTableEditor_11 + " " + this.getResult().getCorpusSize()); 
218
		typeFrequencyColumn.setToolTipText(RCPMessages.FrequencyListEditorInput_4 + SpecificitiesUIMessages.SpecificitiesTableEditor_11 + this.getResult().getCorpusSize()); 
219
		typeFrequencyColumn.setAlignment(SWT.RIGHT);
220
		typeFrequencyColumn.pack();
221
//		typeFrequencyColumn.addSelectionListener(new SelectionListener() {
222
//			@Override
223
//			public void widgetSelected(SelectionEvent e) {
224
//				StatusLine.setMessage(RCPMessages.SORT_COLUMN);
225
//				Comparator<Object[]> column_comparator = new Comparator<Object[]>() {
226
//					@Override
227
//					public int compare(Object[] line1, Object[] line2) { // Compare two
228
//						return ((Integer) line1[1]).compareTo(((Integer) line2[1]));
229
//					}
230
//				};
231
//				if (specificitesTable.getSortColumn() != typeFrequencyColumn) {
232
//					specificitesTable.setSortColumn(typeFrequencyColumn);
233
//					specificitesTable.setSortDirection(SWT.UP);
234
//				}
235
//				else if (specificitesTable.getSortDirection() == SWT.UP) {
236
//					specificitesTable.setSortDirection(SWT.DOWN);
237
//					column_comparator = new ReverseComparator(column_comparator);
238
//				}
239
//				else {
240
//					specificitesTable.setSortDirection(SWT.UP);
241
//				}
242
//				currentComparator = column_comparator;
243
//				sort();
244
//				StatusLine.setMessage(""); //$NON-NLS-1$
245
//			}
246
//
247
//			@Override
248
//			public void widgetDefaultSelected(SelectionEvent e) {
249
//			}
250
//		});
251

  
252
		
253
		viewerComparator.addSelectionAdapter(viewer, typeFrequencyColumn, 1);
254
		
255
		
256
		// add a separator column
257
		TableColumn separatorColumn = new TableColumn(specificitesTable, SWT.NONE);
258
		separatorColumn.setResizable(false);
259

  
260
		String[] partNames = null;
261
		int[] partSize = null;
262
		try {
263
			partNames = this.getResult().getPartShortNames();
264
			partSize = this.getResult().getPartSizes();
265
		} catch (StatException e) {
266
			System.err.println(NLS.bind(SpecificitiesUIMessages.SpecificitiesTableEditor_5, e));
267
			Log.printStackTrace(e);
268
			return;
269
		}
270
		// System.out.println("partnames: "+Arrays.toString(partNames));
271
		// for (int i = 0; i <
272
		// specificitesResult.getSpecificitesIndex()[0].length; i++)
273
		for (int i = 0, columnIndex = 2; i < partNames.length ; i++) { // for each part
274
			//final int columnIndex = i;
275

  
276
			//FREQ COLUMN
277
			final TableColumn freqpartTableColumn = new TableColumn(specificitesTable, SWT.NONE);
278
			freqpartTableColumn.setText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
279
			freqpartTableColumn.setToolTipText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
280
			// System.out.println("create column "+partNames[i]);
281
			freqpartTableColumn.setAlignment(SWT.RIGHT);
282
			freqpartTableColumn.pack();
213
			// Register the context menu
214
			TXMEditor.initContextMenu(specificitesTable, "SpecificitiesEditorContextMenu", this.getSite(), this.viewer); // $NON-NLS-1$
283 215
			
284
			viewerComparator.addSelectionAdapter(viewer, freqpartTableColumn, ++columnIndex);
285

  
286
//			freqpartTableColumn.addSelectionListener(new SelectionListener() {
287
//				@Override
288
//				public void widgetSelected(SelectionEvent e) {
289
//					StatusLine.setMessage(RCPMessages.SORT_COLUMN);
290
//					Comparator<Object> column_comparator = new Comparator<Object>() {
291
//						@Override
292
//						public int compare(Object o1, Object o2) { // Compare
293
//							// two Integer
294
//							Object[] line1 = (Object[]) o1;
295
//							Object[] line2 = (Object[]) o2;
296
//							return new Integer(((int[]) line1[2])[columnIndex]).compareTo(new Integer(((int[]) line2[2])[columnIndex]));
297
//						}
298
//					};
299
//
300
//					if (specificitesTable.getSortColumn() != freqpartTableColumn) {
301
//						specificitesTable.setSortColumn(freqpartTableColumn);
302
//						specificitesTable.setSortDirection(SWT.DOWN);
303
//						column_comparator = new ReverseComparator(column_comparator);
304
//					}
305
//					else if (specificitesTable.getSortDirection() == SWT.UP) {
306
//						specificitesTable.setSortDirection(SWT.DOWN);
307
//						column_comparator = new ReverseComparator(column_comparator);
308
//					}
309
//					else {
310
//						specificitesTable.setSortDirection(SWT.UP);
311
//					}
312
//					currentComparator = column_comparator;
313
//					sort();
314
//					StatusLine.setMessage(""); //$NON-NLS-1$
315
//				}
316
//
317
//				@Override
318
//				public void widgetDefaultSelected(SelectionEvent e) {
319
//				}
320
//			});
321
			//specificitesTableColumn.add(freqpartTableColumn);
322

  
323
			//SCORE COLUMN
324
			final TableColumn partTableColumn = new TableColumn(specificitesTable, SWT.NONE);
325
			partTableColumn.setText("score");//partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
326
			partTableColumn.setToolTipText(partNames[i] + " t=" + partSize[i]); //$NON-NLS-1$ 
327
			// System.out.println("create column "+partNames[i]);
328
			partTableColumn.setAlignment(SWT.RIGHT);
329
			partTableColumn.pack();
330

  
331
			viewerComparator.addSelectionAdapter(viewer, partTableColumn, ++columnIndex);
216
			// adjust UI to the original sorting
217
			specificitesTable.setSortColumn(typeNameColumn);
218
			specificitesTable.setSortDirection(SWT.UP);
332 219
			
333
//			partTableColumn.addSelectionListener(new SelectionListener() {
334
//				@Override
335
//				public void widgetSelected(SelectionEvent e) {
336
//					StatusLine.setMessage(RCPMessages.SORT_COLUMN);
337
//					Comparator<Object> column_comparator = new Comparator<Object>() {
338
//						@Override
339
//						public int compare(Object o1, Object o2) { // Compare
340
//							Object[] line1 = (Object[]) o1;
341
//							Object[] line2 = (Object[]) o2;
342
//							return new Double(((double[]) line1[3])[columnIndex]).compareTo(new Double(((double[]) line2[3])[columnIndex]));
343
//						}
344
//					};
345
//					if (specificitesTable.getSortColumn() != partTableColumn) {
346
//						specificitesTable.setSortColumn(partTableColumn);
347
//						specificitesTable.setSortDirection(SWT.DOWN);
348
//						column_comparator = new ReverseComparator(column_comparator);
349
//					}
350
//					else if (specificitesTable.getSortDirection() == SWT.UP) {
351
//						specificitesTable.setSortDirection(SWT.DOWN);
352
//						column_comparator = new ReverseComparator(column_comparator);
353
//					}
354
//					else {
355
//						specificitesTable.setSortDirection(SWT.UP);
356
//					}
357
//					currentComparator = column_comparator;
358
//					sort();
359
//					StatusLine.setMessage(""); //$NON-NLS-1$
360
//				}
361
//
362
//				@Override
363
//				public void widgetDefaultSelected(SelectionEvent e) {
364
//				}
365
//			});
366

  
367
			//specificitesTableColumn.add(partTableColumn);
220
		} catch (StatException e) {
221
			System.err.println(NLS.bind(SpecificitiesUIMessages.SpecificitiesTableEditor_0, e.getMessage()));
222
			e.printStackTrace();
368 223
		}
369

  
370
		specificitesTable.setHeaderVisible(true);
371

  
372
		// Horizontal bar on second table takes up a little extra space.
373
		// To keep vertical scroll bars in sink, force table1 to end above
374
		// horizontal scrollbar
375
		ScrollBar hBarRight = specificitesTable.getHorizontalBar();
376
		Label spacer = new Label(parent, SWT.NONE);
377
		GridData spacerData = new GridData();
378
		spacerData.heightHint = hBarRight.getSize().y;
379
		spacer.setLayoutData(spacerData);
380
		spacer.setVisible(false);
381

  
382
		// Register the context menu
383
		TXMEditorPart.initContextMenu(specificitesTable, "SpecificitiesEditorContextMenu", this.getSite(), this.viewer); // $NON-NLS-1$
384
		
385
		// adjust UI to the original sorting
386
		specificitesTable.setSortColumn(typeNameColumn);
387
		specificitesTable.setSortDirection(SWT.UP);
388

  
389 224
	}
390 225

  
226

  
391 227
	
392 228
	@Override
393 229
	public void updateEditorFromResult(boolean update) {
394
		this.fillDisplay();
395
	}
230
		try {
231
			// units
232
			String[] typeNames = getResult().getTypeNames();
233
			// units' total freq
234
			int[] typeFreq = getResult().getFormFrequencies();
235
			// units' index fr each part
236
			double[][] specIndex = getResult().getSpecificitesIndex();
237
			int[][] specFreqs = getResult().getFrequency();
238
			
239
			// units' total in parts
240
			//final int[] sortedPartIndexes = specificitesResult.getSortedPartIndexes();
396 241

  
397
	
398
	/**
399
	 * Fills display.
400
	 */
401
	private void fillDisplay() {
402

  
403
		
404
		Display.getDefault().syncExec(new Runnable() {
405
			@Override
406
			public void run() {
407
				try {
408
					// units
409
					String[] typeNames = getResult().getTypeNames();
410
					// units' total freq
411
					int[] typeFreq = getResult().getFormFrequencies();
412
					// units' index fr each part
413
					double[][] specIndex = getResult().getSpecificitesIndex();
414
					int[][] specFreqs = getResult().getFrequency();
415
					
416
					// units' total in parts
417
					//final int[] sortedPartIndexes = specificitesResult.getSortedPartIndexes();
418

  
419
					// Create an array of lines to fill the tables
420
					//		System.out.println("len types: "+typeNames.length);
421
					//		System.out.println("len freq: "+typeFreq.length);
422
					//		System.out.println("len spec: "+specFreqs.length);
423
					//		System.out.println("len specidx: "+specIndex.length);
424
					 Object[] tableLines = new Object[typeNames.length];
425
					for (int j = 0; j < tableLines.length; j++) {
426
						tableLines[j] = new Object[] { typeNames[j], new Integer(typeFreq[j]), specFreqs[j], specIndex[j] };
427
					}
428
					viewer.setInput(tableLines);
429

  
430
					// Pack the columns so the label of the sort column is not truncated due of the sorting order arrow display			
431
					TXMEditorPart.packColumns(viewer);
432
					
433
				}
434
				catch (StatException e) {
435
					// TODO Auto-generated catch block
436
					e.printStackTrace();
437
				}
438

  
242
			// Create an array of lines to fill the tables
243
			//		System.out.println("len types: "+typeNames.length);
244
			//		System.out.println("len freq: "+typeFreq.length);
245
			//		System.out.println("len spec: "+specFreqs.length);
246
			//		System.out.println("len specidx: "+specIndex.length);
247
			 Object[] tableLines = new Object[typeNames.length];
248
			for (int j = 0; j < tableLines.length; j++) {
249
				tableLines[j] = new Object[] { typeNames[j], new Integer(typeFreq[j]), specFreqs[j], specIndex[j] };
439 250
			}
440
		});
441
		
442
		
251
			viewer.setInput(tableLines);
252

  
253
			// Pack the columns so the label of the sort column is not truncated due of the sorting order arrow display			
254
			TXMEditor.packColumns(viewer);
255
			
256
		}
257
		catch (StatException e) {
258
			// TODO Auto-generated catch block
259
			e.printStackTrace();
260
		}
443 261
	}
444 262

  
445
	/* (non-Javadoc)
446
	 * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
447
	 */
263

  
448 264
	@Override
449 265
	public void setFocus() {
450
		//StatusLine.setMessage(SpecificitiesUIMessages.SpecificitiesTableEditor_17);
451 266
		this.specificitesTable.setFocus();
452 267
	}
453 268

  
......
462 277

  
463 278
	@Override
464 279
	public void updateResultFromEditor() {
465
		this.getResult().setMaxScore(this.maxScore.getSelection());
280
		// nothing to do
466 281
	}
467 282

  
468 283

  
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/testers/__IsJFCComposite.java (revision 633)
25 25
//		System.out.println("IsJFCComposite.test() args = " + args);
26 26
//		System.out.println("IsJFCComposite.test() expectedValue = " + expectedValue);
27 27
		
28
//		ChartEditorPart editor = SWTChartsComponentsProvider.getActiveChartEditor(null);
28
//		ChartEditor editor = SWTChartsComponentsProvider.getActiveChartEditor(null);
29 29
//		return (editor != null && editor.getComposite() instanceof JFCComposite);
30 30
		return true;
31 31
	}
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java (revision 633)
21 21
import org.txm.chartsengine.jfreechart.core.renderers.MultipleItemsSelector;
22 22
import org.txm.chartsengine.jfreechart.core.renderers.interfaces.IRendererWithItemSelection;
23 23
import org.txm.chartsengine.rcp.IChartComponent;
24
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
24
import org.txm.chartsengine.rcp.editors.ChartEditor;
25 25
import org.txm.chartsengine.rcp.events.EventCallBackHandler;
26 26
import org.txm.chartsengine.rcp.swt.ChartComposite;
27 27

  
......
57 57
	 * @param parent
58 58
	 * @param panel
59 59
	 */
60
	public JFCComposite(ChartEditorPart chartEditor, Composite parent) {
60
	public JFCComposite(ChartEditor chartEditor, Composite parent) {
61 61
		//super(chartEditor, parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
62 62
		super(chartEditor, parent, SWT.EMBEDDED);
63 63
		//super(parent, SWT.EMBEDDED | SWT.NO_MERGE_PAINTS | SWT.NO_BACKGROUND); // do not fix the transparency problem
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/handlers/OpenJFCChartPropertiesEditor.java (revision 633)
10 10
import org.jfree.chart.ChartPanel;
11 11
import org.txm.chartsengine.jfreechart.core.JFCChartsEngine;
12 12
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
13
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
13
import org.txm.chartsengine.rcp.editors.ChartEditor;
14 14

  
15 15
/**
16 16
 * Resets the chart view of the active chart editor part.
......
43 43
	@Override
44 44
	public Object execute(ExecutionEvent event) throws ExecutionException {
45 45

  
46
		final ChartEditorPart chartEditor = SWTChartsComponentsProvider.getActiveChartEditor(event);
46
		final ChartEditor chartEditor = SWTChartsComponentsProvider.getActiveChartEditor(event);
47 47

  
48 48
		if(chartEditor.getChartsEngine() instanceof JFCChartsEngine)	{
49 49
			chartEditor.getComposite().getDisplay().asyncExec(new Runnable() {
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/themes/base/swing/ItemSelectionJFCChartPanel.java (revision 633)
22 22
import org.txm.chartsengine.jfreechart.rcp.themes.highcharts.events.JFCItemsKeyboardSelectionCallBack;
23 23
import org.txm.chartsengine.rcp.IChartComponent;
24 24
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
25
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
25
import org.txm.chartsengine.rcp.editors.ChartEditor;
26 26
import org.txm.chartsengine.rcp.events.AbstractChartMouseListener;
27 27
import org.txm.chartsengine.rcp.events.ChartKeyListener;
28 28
import org.txm.utils.OSDetector;
......
58 58
	/**
59 59
	 * The parent editor.
60 60
	 */
61
	protected ChartEditorPart editor;
61
	protected ChartEditor editor;
62 62

  
63 63

  
64 64
	
......
297 297

  
298 298

  
299 299
	@Override
300
	public ChartEditorPart getChartEditor() {
300
	public ChartEditor getChartEditor() {
301 301
		return this.editor;
302 302
	}
303 303

  
304 304
	@Override
305
	public void setChartEditor(ChartEditorPart editor) {
305
	public void setChartEditor(ChartEditor editor) {
306 306
		this.editor = editor;
307 307
	}
308 308

  
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/JFCSWTChartsComponentsProvider.java (revision 633)
21 21
import org.txm.chartsengine.rcp.IChartComponent;
22 22
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
23 23
import org.txm.chartsengine.rcp.editors.ChartEditorInput;
24
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
24
import org.txm.chartsengine.rcp.editors.ChartEditor;
25 25
import org.txm.chartsengine.rcp.swt.ChartComposite;
26 26

  
27 27

  
......
99 99
	}
100 100

  
101 101
	@Override
102
	public ChartComposite createComposite(ChartEditorPart chartEditor, Composite parent)	{
102
	public ChartComposite createComposite(ChartEditor chartEditor, Composite parent)	{
103 103
		return JFCSWTChartsComponentsProvider.createCompositeStatic(chartEditor, parent);
104 104
	}
105 105

  
......
110 110
	 * @param parent
111 111
	 * @return
112 112
	 */
113
	public static JFCComposite createCompositeStatic(ChartEditorPart chartEditor, Composite parent)	{
113
	public static JFCComposite createCompositeStatic(ChartEditor chartEditor, Composite parent)	{
114 114
		return new JFCComposite(chartEditor, parent);
115 115
	}
116 116

  
......
128 128

  
129 129

  
130 130
	@Override
131
	public File exportView(ChartEditorPart chartEditor, File file, String fileFormat) {
131
	public File exportView(ChartEditor chartEditor, File file, String fileFormat) {
132 132
		return JFCSWTChartsComponentsProvider.exportViewStatic(chartEditor, file, fileFormat);
133 133
	}
134 134

  
......
139 139
	 * @param fileFormat
140 140
	 * @return
141 141
	 */
142
	public static File exportViewStatic(ChartEditorPart chartEditor, File file, String fileFormat) {
142
	public static File exportViewStatic(ChartEditor chartEditor, File file, String fileFormat) {
143 143

  
144 144
		JFCComposite composite = (JFCComposite) chartEditor.getComposite();
145 145

  
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/AHCChartEditor.java (revision 633)
16 16
import org.txm.cah.core.preferences.AHCPreferences;
17 17
import org.txm.cah.rcp.messages.AHCUIMessages;
18 18
import org.txm.chartsengine.core.results.ChartResult;
19
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
19
import org.txm.chartsengine.rcp.editors.ChartEditor;
20 20
import org.txm.core.preferences.TXMPreferences;
21 21
import org.txm.rcp.IImageKeys;
22 22
import org.txm.rcp.JobsTimer;
......
32 32
 * @author sjacquot
33 33
 *
34 34
 */
35
public class AHCChartEditor extends ChartEditorPart<AHC> {
35
public class AHCChartEditor extends ChartEditor<AHC> {
36 36

  
37 37
	/**
38 38
	 * Numbers of clusters.
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeAHC.java (revision 633)
46 46
import org.txm.cah.core.messages.AHCCoreMessages;
47 47
import org.txm.cah.core.preferences.AHCPreferences;
48 48
import org.txm.cah.rcp.messages.AHCUIMessages;
49
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
49
import org.txm.chartsengine.rcp.editors.ChartEditor;
50 50
import org.txm.core.preferences.TXMPreferences;
51 51
import org.txm.lexicaltable.core.functions.LexicalTable;
52 52
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog;
......
139 139
			} 
140 140
		}
141 141

  
142
		ChartEditorPart.openEditor(ahc);
142
		ChartEditor.openEditor(ahc);
143 143

  
144 144

  
145 145
		return null;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 633)
74 74
import org.txm.rcp.StatusLine;
75 75
import org.txm.rcp.TXMWindows;
76 76
import org.txm.rcp.commands.base.DeleteObject;
77
import org.txm.rcp.editors.TXMEditorPart;
77
import org.txm.rcp.editors.TXMEditor;
78 78
import org.txm.rcp.editors.TXMResultEditorInput;
79 79
import org.txm.rcp.utils.JobHandler;
80 80
import org.txm.searchengine.cqp.corpus.Corpus;
......
489 489
	}
490 490

  
491 491
	/**
492
	 * Refreshes the specified result node in the tree view, also synchronizes the TXMResult and the TXMEditorPart (as the editor part name from the result name, for example).
492
	 * Refreshes the specified result node in the tree view, also synchronizes the TXMResult and the TXMEditor (as the editor part name from the result name, for example).
493 493
	 * @param editor
494 494
	 */
495
	public static void refreshObject(TXMEditorPart editor) {
495
	public static void refreshObject(TXMEditor editor) {
496 496
		refreshObject(editor.getResult());
497 497
	}
498 498

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/ParametersView.java (revision 633)
60 60
import org.txm.core.results.Parameter;
61 61
import org.txm.core.results.TXMResult;
62 62
import org.txm.rcp.IImageKeys;
63
import org.txm.rcp.editors.TXMEditorPart;
63
import org.txm.rcp.editors.TXMEditor;
64 64
import org.txm.rcp.swt.widget.PropertiesSelector;
65 65
import org.txm.rcp.swt.widget.QueryWidget;
66 66
import org.txm.searchengine.cqp.ReferencePattern;
......
103 103

  
104 104
	}
105 105

  
106
	TXMEditorPart<? extends TXMResult> activated;
106
	TXMEditor<? extends TXMResult> activated;
107 107
	private Composite panel;
108 108
	private ScrolledComposite scrollC;
109 109
	private Button recompute;
......
122 122
			return;
123 123
		}
124 124

  
125
		if (!(editor instanceof TXMEditorPart)) {
125
		if (!(editor instanceof TXMEditor)) {
126 126
			new Label(panel, SWT.NONE).setText("Editor is not a TXMPartEditor: " + editor);
127 127
			return;
128 128
		}
129 129
		recompute.setEnabled(true);
130
		TXMEditorPart reditor = (TXMEditorPart) editor;
130
		TXMEditor reditor = (TXMEditor) editor;
131 131
		final TXMResult result = reditor.getResult();
132 132

  
133 133
		List<Field> allfields = result.getAllFields();
......
551 551
		if (part == null)
552 552
			return;
553 553
		// System.out.println("partActivated: "+part);
554
		if (part instanceof TXMEditorPart)
555
			activated = (TXMEditorPart) part;
554
		if (part instanceof TXMEditor)
555
			activated = (TXMEditor) part;
556 556
		if (activated == null)
557 557
			return;
558 558
		activated.addPropertyListener(this);
......
592 592
		if (part == null)
593 593
			return;
594 594
		// System.out.println("partDeactivated: "+part);
595
		//		if (part instanceof TXMEditorPart)
595
		//		if (part instanceof TXMEditor)
596 596
		//			activated = null;
597 597
		//		try {
598 598
		//			updateEditorParameters();
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/ComputeTXMResult.java (revision 633)
1
package org.txm.rcp.commands;
2

  
3
import org.eclipse.core.commands.AbstractHandler;
4
import org.eclipse.core.commands.ExecutionEvent;
5
import org.eclipse.core.commands.ExecutionException;
6
import org.eclipse.ui.IWorkbenchPart;
7
import org.eclipse.ui.handlers.HandlerUtil;
8
import org.txm.rcp.editors.TXMEditorPart;
9

  
10
public class ComputeTXMResult extends AbstractHandler {
11

  
12
	@Override
13
	public Object execute(ExecutionEvent event) throws ExecutionException {
14
		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
15
		if (!(page instanceof TXMEditorPart)) {
16
			System.out.println("Active editor is not a TXMEditorPart. Aborting.");
17
			return null;
18
		}
19

  
20
		TXMEditorPart editor = (TXMEditorPart) page;
21
		//editor.updateResultFromEditor();
22
		editor.compute(false);
23

  
24
		return null;
25
	}
26
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/CloseEditorsUsing.java (revision 633)
7 7
import org.eclipse.ui.IEditorReference;
8 8
import org.eclipse.ui.IWorkbenchPage;
9 9
import org.txm.rcp.commands.base.DeleteObject;
10
import org.txm.rcp.editors.TXMEditorPart;
10
import org.txm.rcp.editors.TXMEditor;
11 11
import org.txm.searchengine.cqp.corpus.Corpus;
12 12

  
13 13
public class CloseEditorsUsing extends AbstractHandler {
......
25 25
			for (IEditorReference editorref : page.getEditorReferences()) {
26 26
				IEditorPart editor = editorref.getEditor(false);
27 27

  
28
				if (editor instanceof TXMEditorPart) {
28
				if (editor instanceof TXMEditor) {
29 29
					//System.out.println("checking editor "+editor.getTitle());
30
					TXMEditorPart ceditor = ((TXMEditorPart)editor);
30
					TXMEditor ceditor = ((TXMEditor)editor);
31 31
					if (corpus.equals(ceditor.getResult()))
32 32
						editor.getEditorSite().getPage().closeEditor(editor, true);
33 33
					else if (corpus.equals(ceditor.getResult().getParent())) {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/base/DeleteObject.java (revision 633)
58 58
import org.txm.rcp.RCPMessages;
59 59
import org.txm.rcp.StatusLine;
60 60
import org.txm.rcp.commands.RestartTXM;
61
import org.txm.rcp.editors.TXMEditorPart;
61
import org.txm.rcp.editors.TXMEditor;
62 62
import org.txm.rcp.preferences.RCPPreferences;
63 63
import org.txm.rcp.utils.JobHandler;
64 64
import org.txm.searchengine.cqp.corpus.Corpus;
......
337 337
			for (IEditorReference editorref : page.getEditorReferences()) {
338 338
				IEditorPart editor = editorref.getEditor(false);
339 339

  
340
				if(editor instanceof TXMEditorPart)	{
341
					if (o == ((TXMEditorPart)editor).getResult())	{
340
				if(editor instanceof TXMEditor)	{
341
					if (o == ((TXMEditor)editor).getResult())	{
342 342
						editor.getEditorSite().getPage().closeEditor(editor, true);
343 343
					}
344 344
				}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 633)
1
/**
2
 * 
3
 */
4
package org.txm.rcp.editors;
5

  
6
import java.lang.reflect.Field;
7
import java.util.ArrayList;
8
import java.util.Arrays;
9
import java.util.HashMap;
10
import java.util.List;
11

  
12
import org.eclipse.core.runtime.IProgressMonitor;
13
import org.eclipse.core.runtime.IStatus;
14
import org.eclipse.core.runtime.Status;
15
import org.eclipse.core.runtime.jobs.Job;
16
import org.eclipse.jface.action.MenuManager;
17
import org.eclipse.jface.viewers.ISelectionProvider;
18
import org.eclipse.jface.viewers.IStructuredSelection;
19
import org.eclipse.jface.viewers.StructuredSelection;
20
import org.eclipse.jface.viewers.TableViewer;
21
import org.eclipse.jface.viewers.Viewer;
22
import org.eclipse.swt.SWT;
23
import org.eclipse.swt.layout.GridData;
24
import org.eclipse.swt.layout.GridLayout;
25
import org.eclipse.swt.layout.RowLayout;
26
import org.eclipse.swt.widgets.Button;
27
import org.eclipse.swt.widgets.Composite;
28
import org.eclipse.swt.widgets.Menu;
29
import org.eclipse.swt.widgets.Spinner;
30
import org.eclipse.swt.widgets.TableColumn;
31
import org.eclipse.swt.widgets.Text;
32
import org.eclipse.swt.widgets.ToolItem;
33
import org.eclipse.ui.IEditorInput;
34
import org.eclipse.ui.IEditorSite;
35
import org.eclipse.ui.IWorkbenchPage;
36
import org.eclipse.ui.IWorkbenchPartSite;
37
import org.eclipse.ui.IWorkbenchWindow;
38
import org.eclipse.ui.PartInitException;
39
import org.eclipse.ui.PlatformUI;
40
import org.eclipse.ui.menus.IMenuService;
41
import org.eclipse.ui.part.EditorPart;
42
import org.txm.core.results.Parameter;
43
import org.txm.core.results.TXMResult;
44
import org.txm.rcp.JobsTimer;
45
import org.txm.rcp.StatusLine;
46
import org.txm.rcp.TXMWindows;
47
import org.txm.rcp.swt.widget.NewNavigationWidget;
48
import org.txm.rcp.swt.widget.PropertiesSelector;
49
import org.txm.rcp.utils.JobHandler;
50
import org.txm.rcp.views.corpora.CorporaView;
51
import org.txm.rcp.views.debug.TXMResultDebugView;
52
import org.txm.utils.logger.Log;
53

  
54
/**
55
 * Base TXM result <code>EditorPart</code> composed of 
56
 * - a main toolbar at the top
57
 * - display area
58
 * - a bottom toolbar at the bottom of the ditor
59
 * 
60
 * @author mdecorde
61
 * @author sjacquot
62
 *
63
 */
64
public abstract class TXMEditorPart<T extends TXMResult> extends EditorPart {
65

  
66
	/**
67
	 * The editor main tool bar, positioned at the top of the editor.
68
	 */
69
	protected TXMEditorToolBar topToolBar;
70

  
71
	protected Composite resultArea;
72

  
73
	/**
74
	 * The editor bottom tool bar, positioned at the bottom of the editor.
75
	 */
76
	protected TXMEditorToolBar bottomToolBar;
77

  
78
	/**
79
	 * the parameters groups are added to this composite
80
	 */
81
	private Composite parametersGroupsComposite;
82

  
83
	/**
84
	 * The command parameters composite that can be hidden. To add main parameters.
85
	 */
86
	protected Composite computingParametersGroup;
87

  
88
	/**
89
	 * 
90
	 */
91
	Composite parent;
92

  
93
	private Composite topToolBarContainer;
94

  
95
	/**
96
	 * contains the bottom toolbars
97
	 */
98
	protected Composite bottomToolBarContainer;
99

  
100
	
101
	/**
102
	 * To keep track of the parameters used for the last computing and updates only the widgets if a parameter has changed. 
103
	 */
104
	protected HashMap<String, Object> lastComputingParameters = new HashMap<String, Object>();
105
	
106

  
107
	@Override
108
	public void init(IEditorSite site, IEditorInput input) throws PartInitException {
109
		this.setSite(site);
110
		this.setInput(input);
111
		// FIXME: see how to use the Adapters and AdapterFactory to define image and title of Editor in the contributing plug-ins
112
		// another way is to use editors extension in plug-ins and redefine icon and name, using this solution the problem is that the name (which is also editor title) can not be dynamic according to the result data
113
		// so it seems better to use Adapters if it's possible
114
		this.setPartName(input.getName());
115
	}
116

  
117
	/**
118
	 * Creates the default toolbar (empty) and default result area (empty).
119
	 * 
120
	 */
121
	@Override
122
	public final void createPartControl(Composite parent) {
123

  
124
		try {
125
			this.parent = parent;
126

  
127
			// to hide and display the command parameters composite
128
			this.initParentLayout(parent, 1);
129

  
130
			// create the top tool bar
131
			this.topToolBarContainer = new Composite(parent, SWT.NONE);
132
			this.topToolBarContainer.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
133
			RowLayout rl = new RowLayout(SWT.HORIZONTAL);
134
			rl.marginTop = rl.marginHeight = rl.marginWidth = rl.marginBottom = 0;
135
			this.topToolBarContainer.setLayout(rl);
136

  
137
			this.topToolBar = new TXMEditorToolBar(this, SWT.FLAT | SWT.RIGHT, "top");
138

  
139

  
140
			this.parametersGroupsComposite = new Composite(parent, SWT.NONE);
141
			GridLayout gl = new GridLayout(1, true);
142
			gl.marginBottom = gl.marginHeight = gl.marginWidth = gl.marginTop = 0;
143
			this.parametersGroupsComposite.setLayout(gl);
144
			if (parent.getLayout() instanceof GridLayout)	{
145
				this.parametersGroupsComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
146
			}
147

  
148
			// computing parameters components
149
			boolean showComputingParameters = false;
150
			// only show the area if the result can not compute and is dirty
151
			if(!this.getResult().canCompute() && this.getResult().isDirty())	{
152
				showComputingParameters = true;
153
			}
154
			this.computingParametersGroup = this.topToolBar.installGroup("Computing parameters", "Show/Hide command parameters", "icons/show_computing_parameters.png", showComputingParameters);
155

  
156

  
157
			// display main area
158
			this.resultArea = new Composite(parent, SWT.NONE);
159
			this.resultArea.setLayoutData(new GridData(GridData.FILL_BOTH));
160

  
161
			// create the top tool bar
162
			this.bottomToolBarContainer = new Composite(parent, SWT.NONE);
163
			this.bottomToolBarContainer.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
164
			rl = new RowLayout(SWT.HORIZONTAL);
165
			rl.marginTop = rl.marginHeight = rl.marginWidth = rl.marginBottom = 0;
166
			this.bottomToolBarContainer.setLayout(rl);
167

  
168
			// bottom tool bar
169
			this.bottomToolBar = new TXMEditorToolBar(this, SWT.FLAT, "bottom");
170
			
171
			this.__createPartControl(parent); // essentially for the ChartEditor
172
			this._createPartControl(parent); // child editor create its parameters and display widgets
173
			
174
			
175
			
176
			if (!this.getResult().isDirty()) {
177
				this.topToolBar.setComputingParametersVisible(false);
178
			}
179
			
180
			// remove empty toolbars
181
			// SJ: Hack?
182
			if (this.bottomToolBar.getChildren().length > 0) {
183
				this.bottomToolBar.dispose();
184
			}
185
		}
186
		catch(Exception e) {
187
			System.err.println("TXMEditorPart.createPartControl(): can not create the editor.");
188
			e.printStackTrace();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff