Revision 163

tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/handlers/ComputeProgression.java (revision 163)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.progression.rcp.handlers;
29

  
30
import org.eclipse.core.commands.AbstractHandler;
31
import org.eclipse.core.commands.ExecutionEvent;
32
import org.eclipse.core.commands.ExecutionException;
33
import org.eclipse.core.runtime.IProgressMonitor;
34
import org.eclipse.core.runtime.IStatus;
35
import org.eclipse.core.runtime.Status;
36
import org.eclipse.jface.viewers.IStructuredSelection;
37
import org.eclipse.jface.window.Window;
38
import org.eclipse.osgi.util.NLS;
39
import org.eclipse.swt.SWT;
40
import org.eclipse.swt.widgets.Shell;
41
import org.eclipse.ui.handlers.HandlerUtil;
42
import org.txm.Toolbox;
43
import org.txm.chartsengine.core.ChartsEngine;
44
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
45
import org.txm.chartsengine.r.core.RChartsEngine;
46
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
47
import org.txm.chartsengine.rcp.editors.ChartEditorPart;
48
import org.txm.chartsengine.svgbatik.rcp.SVGSWTChartsComponentsProvider;
49
import org.txm.core.preferences.TXMPreferences;
50
import org.txm.progression.core.functions.Progression;
51
import org.txm.progression.core.messages.ProgressionCoreMessages;
52
import org.txm.progression.core.preferences.ProgressionPreferences;
53
import org.txm.progression.rcp.dialogs.ProgressionDialog;
54
import org.txm.progression.rcp.forms.ProgressionParametersComposite;
55
import org.txm.rcpapplication.JobsTimer;
56
import org.txm.rcpapplication.Messages;
57
import org.txm.rcpapplication.StatusLine;
58
import org.txm.rcpapplication.utils.JobHandler;
59
import org.txm.rcpapplication.views.CorporaView;
60
import org.txm.searchengine.cqp.corpus.Corpus;
61
import org.txm.utils.logger.Log;
62

  
63
/**
64
 * Open the ProgressionDialog, computes and opens the result editor part.
65
 * 
66
 * @author mdecorde
67
 * @author sjacquot
68
 */
69
public class ComputeProgression extends AbstractHandler {
70
	
71
	
72
	// FIXME: should be put in an Activator? or better in an extension point loaded by the corpora view? or in a method called here as initTreeDoubleClickListener(Class resultDataType, String commandId)?
73
	// adds a double click listener to the Corpus View
74
	static	{
75
		CorporaView.addDoubleClickListener(Progression.class, "ComputeProgression"); //$NON-NLS-1$
76
	}
77
	
78
	
79
	
80
	/* (non-Javadoc)
81
	 * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
82
	 */
83
	@Override
84
	public Object execute(ExecutionEvent event) throws ExecutionException {
85
		if (!Toolbox.isSearchEngineInitialized()) return false;
86
		
87
		if (!Toolbox.isStatEngineInitialized()) {
88
			Log.severe(ProgressionCoreMessages.ComputeProgression_5);
89
			return null;
90
		}
91
		
92
		IStructuredSelection selection = (IStructuredSelection) HandlerUtil.getCurrentSelection(event);
93

  
94
		
95
		 
96
		// Computes a new progression
97
		if(selection.getFirstElement() instanceof Corpus)	{
98
			Corpus corpus = (Corpus) selection.getFirstElement();
99

  
100
			if (!Progression.canRunProgression(corpus)) {
101
				Log.severe(ProgressionCoreMessages.ComputeProgression_0);
102
				// La fonctionnalité Progression n'est pas encore disponible pour les sous-corpus discontinus.
103
				return null;
104
			}
105

  
106
			
107
			Shell shell = HandlerUtil.getActiveWorkbenchWindowChecked(event).getShell();
108
			ProgressionDialog d = new ProgressionDialog(shell, corpus);
109
			
110
			int code = d.open();
111
			if (code == Window.OK) {
112
				computeProgression(d);
113
			}
114

  
115
		}
116
		// Reopens a progression result with default preferences
117
		else if(selection.getFirstElement() instanceof Progression)	{
118
			openEditor((Progression) selection.getFirstElement());
119
		}
120
		
121
		return null;
122
	}
123

  
124
	
125
	
126
	
127
	/**
128
	 * 
129
	 * @param progression
130
	 * @param blackAndWhite
131
	 * @param monoStyle
132
	 * @param cumulative
133
	 * @return
134
	 */
135
	public static ChartEditorPart openEditor(Progression progression) {
136
		
137
		
138
		
139
		ChartEditorPart editor = null;
140
		
141
		// FIXME: temporary force R/SVG version because the Progression density chart is not yet implemented in JFC mode
142
		if(!TXMPreferences.getBoolean(progression, ProgressionPreferences.CHART_CUMULATIVE))	{
143
			SVGSWTChartsComponentsProvider tmpSWTComponentsProvider = (SVGSWTChartsComponentsProvider) SWTChartsComponentsProvider.getComponentsProvider(SVGSWTChartsComponentsProvider.class);
144
			RChartsEngine tmpChartsEngine = (RChartsEngine) ChartsEngine.getChartsEngine(RChartsEngine.class);									
145
			tmpSWTComponentsProvider.setChartsEngine(tmpChartsEngine);
146
			
147
			// Create and open the chart editor
148
			editor = tmpSWTComponentsProvider.openEditor(progression.getCorpus().getName() + ": " + progression.getName(), progression, ProgressionPreferences.PREFERENCES_NODE);
149
		}
150
		else	{
151
			// Create and open the chart editor
152
			editor = SWTChartsComponentsProvider.getCurrent().openEditor(progression.getCorpus().getName() + ": " + progression.getName(), progression, ProgressionPreferences.PREFERENCES_NODE);
153

  
154
			
155

  
156
			// FIXME: tests parameters composite extension
157
			if(!editor.wasAlreadyOpened())	{
158
				new ProgressionParametersComposite(editor.getParametersComposite(), SWT.NONE);
159
			}
160
			// FIXME: tests to use Fields editor and ScopedPreferenceStore for command parameters
161
//			BooleanFieldEditor field = new BooleanFieldEditor(ChartsEnginePreferences.SHOW_TITLE, "test2 show title store", editor.getParametersComposite());
162
//			field.setPreferenceStore(new TXMPreferenceStore(TXMPreferences.getId(progression)));
163
//			field.load();
164
//			field.store();
165
//			try {
166
//				((ScopedPreferenceStore) field.getPreferenceStore()).save();
167
//			}
168
//			catch(IOException e) {
169
//				// TODO Auto-generated catch block
170
//				e.printStackTrace();
171
//			}
172
			
173
			
174
			// FIXME: to discuss
175
//			// initialize extended menus for item selection
176
//			Menu menu = editor.getComposite().getContextMenu(EventCallBack.AREA_ITEM);
177
//			
178
//			// send to index
179
//			MenuItem sendToIndex = new MenuItem(menu.getItem(0).getMenu(), SWT.CASCADE);
180
//		    sendToIndex.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHARED_SEND_SELECTION_TO_INDEX);
181
//		    sendToIndex.setImage(IImageKeys.getImage(IImageKeys.ACTION_INDEX));
182
//		    sendToIndex.addSelectionListener(new ProgressionSelectionListener(editor, BaseSelectionListener.SEND_TO_INDEX));
183
//
184
//		    // send to concordance
185
//			MenuItem sendToConcordance = new MenuItem(menu.getItem(0).getMenu(), SWT.CASCADE);
186
//		    sendToConcordance.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHARED_SEND_SELECTION_TO_CONCORDANCE);
187
//		    sendToConcordance.setImage(IImageKeys.getImage(IImageKeys.ACTION_CONCORDANCES));
188
//		    sendToConcordance.addSelectionListener(new ProgressionSelectionListener(editor, BaseSelectionListener.SEND_TO_CONCORDANCE));
189
//		    
190
//		    // send to cooccurrence
191
//			MenuItem sendToCoorccurrence = new MenuItem(menu.getItem(0).getMenu(), SWT.CASCADE);
192
//		    sendToCoorccurrence.setText(SWTComponentsProviderMessages.SWTChartsComponentProvider_SHARED_SEND_SELECTION_TO_COOCCURRENCE);
193
//		    sendToCoorccurrence.setImage(IImageKeys.getImage(IImageKeys.ACTION_COOCCURRENCE));
194
//		    sendToCoorccurrence.addSelectionListener(new ProgressionSelectionListener(editor, BaseSelectionListener.SEND_TO_COOCCURRENCE));
195
//		    //*****************************************************
196

  
197
		}
198
		
199
		return editor;
200
	}
201
	
202
	
203
	
204
	
205
	/**
206
	 * Computes progression and open the result editor.
207
	 *
208
	 * @param dialog the dialog box
209
	 */
210
	public static Object computeProgression(final ProgressionDialog dialog) {
211
		if (!Toolbox.isSearchEngineInitialized()) return false;
212
		
213
		JobHandler jobhandler = new JobHandler(NLS.bind(ProgressionCoreMessages.ComputeProgression_2, dialog.getQueries(), dialog.getCorpus().getName())) {
214
			@Override
215
			protected IStatus run(IProgressMonitor monitor) {
216
				this.runInit(monitor);
217
				JobsTimer.start();
218
				try {
219
					final Corpus corpus = dialog.getCorpus();
220
					if (dialog.getQueries().size() == 0) {
221
						Log.severe(ProgressionCoreMessages.ComputeProgression_6);
222
						return Status.CANCEL_STATUS;
223
					}
224

  
225
					
226
					final Progression progression = new Progression(dialog.getCorpus(), dialog.getQueries(), dialog.getStructuralUnit(), dialog.getStructuralProperty(), dialog.getPropertyregex(),
227
							dialog.isCumulativeType(), dialog.getLineWidth(), dialog.isRepeatvalues(), dialog.getBandeMultiplier());
228

  
229
					
230
					// persistence
231
					if(dialog.isBlackAndWhite())	{
232
						TXMPreferences.putLocalInt(progression, ChartsEnginePreferences.RENDERING_COLORS_MODE, ChartsEngine.RENDERING_MONOCHROME_MODE);	
233
					}
234
					TXMPreferences.putLocalBoolean(progression, ProgressionPreferences.CHART_MONO_STYLE, dialog.isMonoStyle());
235
					TXMPreferences.putLocalBoolean(progression, ProgressionPreferences.CHART_CUMULATIVE, dialog.isCumulativeType());
236
					
237
					
238
					
239
					Log.info(NLS.bind(ProgressionCoreMessages.ComputeProgression_4, 
240
							new Object[]{dialog.getCorpus(), dialog.getQueries(), dialog.getStructuralUnit(), dialog.getStructuralProperty(), dialog.isCumulativeType()}));
241
					
242
					
243
					
244
					monitor.worked(50);
245
					if (monitor.isCanceled())
246
						return Status.CANCEL_STATUS;
247
					boolean success = true;//progression.process();
248

  
249
					if (!progression.stepQueries()) {
250
						System.out.println(ProgressionCoreMessages.ComputeProgression_3);
251
						return Status.CANCEL_STATUS;
252
					}
253
					if (monitor.isCanceled()) return Status.CANCEL_STATUS;
254
					monitor.worked(10);
255

  
256
					if (!progression.stepStructuralUnits() || monitor.isCanceled())
257
						return Status.CANCEL_STATUS;
258
					monitor.worked(20);
259

  
260
					if (!progression.stepFinalize() || monitor.isCanceled())
261
						return Status.CANCEL_STATUS;
262
					monitor.worked(20);
263

  
264
					// System.out.println("success : "+success);
265
					if (success) {
266
						syncExec(new Runnable() {
267
							@Override
268
							public void run() {
269
								
270
								openEditor(progression);
271
									
272
								StatusLine.setMessage(ProgressionCoreMessages.ComputeProgression_10);
273
								
274
							}
275
						});
276
					}
277
					monitor.worked(45);
278

  
279
					monitor.subTask(Messages.CreatePartition_9);
280
					CorporaView.storeResult(corpus, progression);
281
					
282
					monitor.worked(5);
283
					System.out.println(NLS.bind(ProgressionCoreMessages.ComputeProgression_12, progression.getPositionsCounts()));
284
				} catch (ThreadDeath td) { 
285
					return Status.CANCEL_STATUS;
286
				} catch (Exception e) {
287
					System.out.println(NLS.bind(ProgressionCoreMessages.ComputeProgression_13, e));
288
					Log.severe(ProgressionCoreMessages.ComputeProgression_13 + Log.toString(e));
289
					try {
290
						System.out.println(Messages.LastCQPError + Toolbox.getCqiClient().getLastCQPError());
291
					} catch (Exception e1) {
292
						System.out.println(ProgressionCoreMessages.ComputeProgression_1 + e1);
293
						Log.printStackTrace(e1);
294
					}
295
				} finally {
296
					monitor.done();
297
					JobsTimer.stopAndPrint();
298
				}
299
				return Status.OK_STATUS;
300
			}
301
		};
302
		jobhandler.startJob();
303
		return null;
304
	}
305
}
0 306

  
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java (revision 163)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.progression.rcp.preferences;
29

  
30
import org.eclipse.jface.preference.BooleanFieldEditor;
31
import org.eclipse.swt.widgets.Composite;
32
import org.eclipse.ui.IWorkbench;
33
import org.txm.chartsengine.rcp.SWTChartsComponentsProvider;
34
import org.txm.progression.core.preferences.ProgressionPreferences;
35
import org.txm.progression.rcp.adapters.ProgressionAdapterFactory;
36
import org.txm.progression.rcp.messages.ProgressionUIMessages;
37
import org.txm.rcp.preferences.TXMPreferencePage;
38
import org.txm.rcp.preferences.TXMPreferenceStore;
39
import org.txm.rcpapplication.TxmPreferences;
40
import org.txm.rcpapplication.jface.DoubleFieldEditor;
41
// TODO: Auto-generated Javadoc
42
/**
43
 * This class represents a preference page that is contributed to the
44
 * Preferences dialog. By subclassing <samp>FieldEditorPreferencePage</samp>, we
45
 * can use the field support built into JFace that allows us to create a page
46
 * that is small and knows how to save, restore and apply itself.
47
 * <p>
48
 * This page is used to modif y preferences only. They are stored in the
49
 * preference store that belongs to the main plug-in class. That way,
50
 * preferences can be accessed directly via the preference store.
51
 */
52

  
53
public class ProgressionPreferencePage extends TXMPreferencePage {
54

  
55

  
56
	
57
	/**
58
	 * Creates the field editors. Field editors are abstractions of the common
59
	 * GUI blocks needed to manipulate various types of preferences. Each field
60
	 * editor knows how to save and restore itself.
61
	 */
62
	@Override
63
	public void createFieldEditors() {
64

  
65
		
66
		// Charts rendering
67
		Composite chartsTab = SWTChartsComponentsProvider.createChartsRenderingPreferencesTabFolderComposite(this.getFieldEditorParent());
68
		
69
		this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_CUMULATIVE, ProgressionUIMessages.ProgressionPreferencePage_3, chartsTab));
70
		this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_MONO_STYLE, ProgressionUIMessages.ProgressionPreferencePage_5, chartsTab));
71
		this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_REPEAT_VALUES, ProgressionUIMessages.ProgressionPreferencePage_6, chartsTab));
72
		
73
		float test = TxmPreferences.getFloat(ProgressionPreferences.CHART_BANDE_MULTIPLIER, 999f);
74
		if (test == 999f)	{
75
			TxmPreferences.set(ProgressionPreferences.CHART_BANDE_MULTIPLIER, 1.0f);
76
		}
77
		
78
		DoubleFieldEditor bandemultiplierfield = new DoubleFieldEditor(ProgressionPreferences.CHART_BANDE_MULTIPLIER, ProgressionUIMessages.ProgressionPreferencePage_7, chartsTab);
79
		this.addField(bandemultiplierfield);
80
		// FIXME: valid range
81
		//if (bandemultiplierfield.getIntValue() == 0)
82
		//	bandemultiplierfield.setStringValue("1");
83
		//bandemultiplierfield.setValidRange(1, 10);
84
		
85
		// other shared preferences
86
		SWTChartsComponentsProvider.createChartsRenderingPreferencesFields(this, chartsTab);
87

  
88
	}
89

  
90
	@Override
91
	public void init(IWorkbench workbench) {
92
		this.setPreferenceStore(new TXMPreferenceStore(ProgressionPreferences.PREFERENCES_NODE));
93
		//setDescription("Progression");
94
		this.setTitle(ProgressionUIMessages.ProgressionPreferencePage_2);
95
		this.setImageDescriptor(ProgressionAdapterFactory.ICON);
96
	}
97

  
98
}
0 99

  
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/dialogs/ProgressionDialog.java (revision 163)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.progression.rcp.dialogs;
29

  
30
import java.util.ArrayList;
31
import java.util.List;
32
import java.util.regex.Pattern;
33
import java.util.regex.PatternSyntaxException;
34

  
35
import org.eclipse.jface.dialogs.Dialog;
36
import org.eclipse.swt.SWT;
37
import org.eclipse.swt.custom.ScrolledComposite;
38
import org.eclipse.swt.events.SelectionEvent;
39
import org.eclipse.swt.events.SelectionListener;
40
import org.eclipse.swt.layout.FormAttachment;
41
import org.eclipse.swt.layout.FormData;
42
import org.eclipse.swt.layout.FormLayout;
43
import org.eclipse.swt.layout.GridData;
44
import org.eclipse.swt.layout.GridLayout;
45
import org.eclipse.swt.widgets.Button;
46
import org.eclipse.swt.widgets.Combo;
47
import org.eclipse.swt.widgets.Composite;
48
import org.eclipse.swt.widgets.Control;
49
import org.eclipse.swt.widgets.Event;
50
import org.eclipse.swt.widgets.Group;
51
import org.eclipse.swt.widgets.Label;
52
import org.eclipse.swt.widgets.Listener;
53
import org.eclipse.swt.widgets.Shell;
54
import org.eclipse.swt.widgets.Text;
55
import org.txm.chartsengine.core.ChartsEngine;
56
import org.txm.chartsengine.core.messages.ChartsEngineCoreMessages;
57
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
58
import org.txm.chartsengine.rcp.messages.SWTComponentsProviderMessages;
59
import org.txm.core.preferences.TXMPreferences;
60
import org.txm.progression.core.functions.Progression;
61
import org.txm.progression.core.preferences.ProgressionPreferences;
62
import org.txm.progression.rcp.preferences.ProgressionPreferencePage;
63
import org.txm.rcp.preferences.TXMPreferenceStore;
64
import org.txm.rcpapplication.Messages;
65
import org.txm.rcpapplication.StatusLine;
66
import org.txm.rcpapplication.swt.widget.AssistedQueryWidget;
67
import org.txm.searchengine.cqp.corpus.Corpus;
68
import org.txm.searchengine.cqp.corpus.StructuralUnit;
69
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty;
70
import org.txm.searchengine.cqp.corpus.query.Query;
71
import org.txm.utils.logger.Log;
72

  
73
/**
74
 * Allow the user to choose : the type of the graphic the structural units,
75
 * property and values to be shown the queries of each curves.
76
 *
77
 * @author mdecorde
78
 * @author sjacquot
79
 */
80
public class ProgressionDialog extends Dialog {
81

  
82
	/** The query widgets. */
83
	protected List<AssistedQueryWidget> queryWidgets = new ArrayList<AssistedQueryWidget>();
84
	
85
	/** The queries. */
86
	List<Query> queries;
87
	
88
	/** The corpus. */
89
	private Corpus corpus;
90
	
91
	/** The selected structural unit. */
92
	private StructuralUnit selectedStructuralUnit;
93
	
94
	/** The selected structural unit property. */
95
	private StructuralUnitProperty selectedStructuralUnitProperty;
96
	
97
	/** The regexproperty value. */
98
	private String regexpropertyValue;
99
	
100
	/** The graphtype. */
101
	private boolean cumulative = true;
102
	
103
	private boolean blackAndWhite = true;
104
	
105
	/** The monostyle. */
106
	private boolean monostyle = true;
107
	
108
	/** The repeatvalues. */
109
	private boolean repeatvalues = false;
110
	
111
	/** The linewidth. */
112
	private int linewidth = 2;
113
	
114
	/** The bandemultiplier. */
115
	private float bandemultiplier = 2;
116

  
117
	/** The structural units combo. */
118
	Combo structuralUnitsCombo;
119
	
120
	/** The structural units. */
121
	List<StructuralUnit> structuralUnits;
122
	
123
	/** The structural units properties. */
124
	List<StructuralUnitProperty> structuralUnitsProperties;
125
	
126
	/** The property combo. */
127
	private Combo propertyCombo;
128
	
129
	/** The regex value. */
130
	private Text regexValue;
131

  
132
	/** The focus composite. */
133
	Composite focusComposite;
134
	
135
	/** The main panel. */
136
	Composite mainPanel;
137
	
138
	/** The bande field. */
139
	Text bandeField;
140
	
141
	/** The cumu button. */
142
	Button cumuButton;
143
	
144
	/** The repeat button. */
145
	Button repeatButton;
146
	
147
	/** The color button. */
148
	Button colorButton;
149
	
150
	/** The style button. */
151
	Button styleButton;
152
	
153
	/** The colors. */
154
	String[] colors = Progression.colors;
155
	
156
	/** The self. */
157
	ProgressionDialog self;
158
	
159
	/** The parent. */
160
	private Composite parent;
161

  
162
	private ScrolledComposite sc1;
163

  
164

  
165

  
166
	/**
167
	 * Instantiates a new progression dialog.
168
	 *
169
	 * @param parentShell the parent shell
170
	 * @param corpus the corpus
171
	 */
172
	public ProgressionDialog(Shell parentShell, Corpus corpus) {
173
		super(parentShell);
174
		this.corpus = corpus;
175
		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
176
	}
177

  
178
	/**
179
	 * Instantiates a new progression dialog.
180
	 *
181
	 * @param parentShell the parent shell
182
	 * @param corpus the corpus
183
	 * @param queries the queries
184
	 */
185
	public ProgressionDialog(Shell parentShell, Corpus corpus,
186
			List<Query> queries) {
187
		super(parentShell);
188
		this.corpus = corpus;
189
		this.queries = queries;
190
		this.setShellStyle(this.getShellStyle() | SWT.RESIZE);
191
	}
192

  
193
	/* (non-Javadoc)
194
	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
195
	 */
196
	@Override
197
	protected void configureShell(Shell newShell) {
198
		super.configureShell(newShell);
199
		newShell.setText(Messages.ProgressionDialog_0);
200
		newShell.setMinimumSize(300, 460);
201

  
202
	}
203

  
204
	/* (non-Javadoc)
205
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
206
	 */
207
	@Override
208
	protected Control createDialogArea(Composite p) {
209
		try {
210
			this.self = this;
211
			this.parent = p;
212

  
213
			// get preferences values
214
			TXMPreferenceStore store = new TXMPreferenceStore(ProgressionPreferences.PREFERENCES_NODE);
215
			
216
			this.blackAndWhite = (TXMPreferences.getInt(ProgressionPreferences.PREFERENCES_NODE, ChartsEnginePreferences.RENDERING_COLORS_MODE) == ChartsEngine.RENDERING_MONOCHROME_MODE);
217
			
218
			this.monostyle = store.getBoolean(ProgressionPreferences.CHART_MONO_STYLE);
219
			this.cumulative = store.getBoolean(ProgressionPreferences.CHART_CUMULATIVE);
220
			this.repeatvalues = store.getBoolean(ProgressionPreferences.CHART_REPEAT_VALUES);
221
			this.bandemultiplier = store.getFloat(ProgressionPreferences.CHART_BANDE_MULTIPLIER);
222

  
223
			// System.out.println(parent.getLayout());
224
			FormLayout mainlayout = new FormLayout();
225
			mainPanel = new Composite(parent, SWT.NONE);
226
			mainPanel.setLayout(mainlayout);
227
			GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
228
			mainPanel.setLayoutData(gridData);
229

  
230
			Composite paramPanel = new Composite(mainPanel, SWT.NONE);
231
			// set the QueryWidget's tab
232
			
233
			sc1 = new ScrolledComposite(mainPanel, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
234
			sc1.setLayout(new GridLayout(1, true));
235
			sc1.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
236
			sc1.setExpandHorizontal( true );
237
			sc1.setExpandVertical( true );
238
			sc1.setMinSize( 0, 250 );
239
			
240
			focusComposite = new Composite(sc1, SWT.NONE);
241
			focusComposite.setLayout(new GridLayout(1, true));
242
			sc1.setContent(focusComposite);
243

  
244
			FormData paramPanelData = new FormData();
245
			paramPanelData.top = new FormAttachment(0);
246
			paramPanelData.left = new FormAttachment(0);
247
			paramPanelData.right = new FormAttachment(100);
248
			paramPanel.setLayoutData(paramPanelData);
249

  
250
			FormData queriesPanelData = new FormData();
251
			queriesPanelData.top = new FormAttachment(paramPanel);
252
			queriesPanelData.left = new FormAttachment(0);
253
			queriesPanelData.right = new FormAttachment(100);
254
			queriesPanelData.bottom = new FormAttachment(100);
255
			sc1.setLayoutData(queriesPanelData);
256

  
257
			paramPanel.setLayout(new GridLayout(3, true));
258

  
259
			// controls
260
			// graph param
261
			Label typeLabel = new Label(paramPanel, SWT.NONE);
262
			typeLabel.setText(Messages.ProgressionDialog_1);
263
			typeLabel.setAlignment(SWT.CENTER);
264

  
265
			cumuButton = new Button(paramPanel, SWT.RADIO);
266
			cumuButton.setText(Messages.ProgressionDialog_2);
267
			cumuButton.setSelection(cumulative);
268

  
269
			Button densityButton = new Button(paramPanel, SWT.RADIO);
270
			densityButton.setText(Messages.ProgressionDialog_3);
271
			densityButton.setSelection(!cumulative);
272

  
273
			//Bande size
274
			typeLabel = new Label(paramPanel, SWT.NONE);
275
			typeLabel.setText(Messages.ProgressionDialog_11);
276
			typeLabel.setAlignment(SWT.CENTER);
277

  
278
			bandeField = new Text(paramPanel, SWT.BORDER);
279
			bandeField.setText(""+bandemultiplier); //$NON-NLS-1$
280
			bandeField.setLayoutData(new GridData(GridData.FILL,
281
					GridData.FILL, true, true, 2, 1));
282
			// Structural units param
283
			Group displayParam = new Group(paramPanel, SWT.BORDER);
284
			displayParam.setText(Messages.ProgressionDialog_13);
285
			displayParam.setLayout(new GridLayout(3, true));
286
			displayParam.setLayoutData(new GridData(GridData.FILL,
287
					GridData.FILL, true, true, 3, 1));
288

  
289
			Label structLabel = new Label(displayParam, SWT.NONE);
290
			structLabel.setText(Messages.ProgressionDialog_4);
291
			structLabel.setAlignment(SWT.CENTER);
292

  
293
			structuralUnitsCombo = new Combo(displayParam, SWT.READ_ONLY);
294
			structuralUnitsCombo.setLayoutData(new GridData(GridData.FILL,
295
					GridData.FILL, true, true, 2, 1));
296

  
297
			structuralUnitsCombo.addSelectionListener(new SelectionListener() {
298
				@Override
299
				public void widgetDefaultSelected(SelectionEvent e) {
300
				}
301

  
302
				@Override
303
				public void widgetSelected(SelectionEvent event) {
304
					reloadProperties();
305
				}
306
			});
307

  
308
			try {// get
309
				structuralUnitsCombo.add("    "); //$NON-NLS-1$
310
				structuralUnits = corpus.getOrderedStructuralUnits();
311
				for (StructuralUnit unit : structuralUnits) {
312
					structuralUnitsCombo.add(unit.getName());
313
				}
314
			} catch (Exception e) {
315
				Log.severe(Messages.ObjectExplorer_9
316
						+ Log.toString(e));
317
				return null;
318
			}
319
			structuralUnitsCombo.select(0);
320
			
321
//			if (structuralUnitsCombo.getItemCount() == 0) {
322
//				this.getButton(IDialogConstants.OK_ID).setEnabled(false);
323
//			} else {
324
//				selectedStructuralUnit = structuralUnits.get(0);
325
//			}
326

  
327
			// properties combo
328
			Label propLabel = new Label(displayParam, SWT.NONE);
329
			propLabel.setText(Messages.LexicalTable_1);
330
			propLabel.setAlignment(SWT.CENTER);
331

  
332
			propertyCombo = new Combo(displayParam, SWT.READ_ONLY);
333
			propertyCombo.setLayoutData(new GridData(GridData.FILL,
334
					GridData.FILL, true, true, 2, 1));
335
			reloadProperties();
336

  
337
			// property value field
338
			Label regexLabel = new Label(displayParam, SWT.NONE);
339
			regexLabel.setText(Messages.ProgressionDialog_7);
340
			regexLabel.setAlignment(SWT.CENTER);
341

  
342
			regexValue = new Text(displayParam, SWT.SINGLE | SWT.BORDER);
343
			regexValue.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
344
					true, true, 2, 1));
345

  
346
			//spacer
347
			styleButton = new Button(displayParam, SWT.CHECK);
348
			styleButton.setText(Messages.ProgressionDialog_14);
349
			styleButton.setSelection(monostyle);
350

  
351
			//Repeat options
352
			repeatButton = new Button(displayParam, SWT.CHECK);
353
			repeatButton.setText(Messages.ProgressionDialog_15);
354
			repeatButton.setSelection(repeatvalues);
355

  
356
			//Color options
357
			colorButton = new Button(displayParam, SWT.CHECK);
358
			colorButton.setText(SWTComponentsProviderMessages.ChartsEnginePreferencePage_RenderingModeBlackAndWhite);
359
			colorButton.setSelection(blackAndWhite);
360

  
361
			// queries param
362
			Label focusLabel = new Label(paramPanel, SWT.NONE);
363
			focusLabel.setText(Messages.ProgressionDialog_8);
364
			focusLabel.setAlignment(SWT.CENTER);
365

  
366
			Button plusButton = new Button(paramPanel, SWT.NONE);
367
			plusButton.setLayoutData(new GridData(GridData.FILL, GridData.FILL,
368
					true, true));
369
			plusButton.setText(Messages.ProgressionDialog_9);
370
			plusButton.addListener(SWT.Selection, new Listener() {
371
				@Override
372
				public void handleEvent(Event event) {
373
					if (colors.length > queryWidgets.size()) {
374
						Log.info("add query field");
375
						createTypeFocusField();
376
						sc1.layout(true);
377
						focusComposite.layout(true);
378
						sc1.setMinSize(focusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
379
					}
380
				}
381
			});
382

  
383
			Button minusButton = new Button(paramPanel, SWT.NONE);
384
			minusButton.setLayoutData(new GridData(GridData.FILL,
385
					GridData.FILL, true, true));
386
			minusButton.setText(Messages.ProgressionDialog_5);
387
			minusButton.addListener(SWT.Selection, new Listener() {
388
				@Override
389
				public void handleEvent(Event event) {
390
					if (queryWidgets.size() > 0) {
391
						// System.out.println("remove field");
392
						AssistedQueryWidget lastwidget = queryWidgets
393
						.get(queryWidgets.size() - 1);
394
						lastwidget.setSize(200, 30);
395
						queryWidgets.remove(queryWidgets.size() - 1);
396
						lastwidget.dispose();
397
						sc1.layout(true);
398
						focusComposite.layout(true);
399
						sc1.setMinSize(focusComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
400
					}
401
				}
402
			});
403

  
404
			if (queries == null) {
405
				createTypeFocusField();
406
			} else {
407
				for (Query q : queries) {
408
					createTypeFocusField().setText(q.getQueryString());
409
				}
410
			}
411
			return mainPanel;
412
		} catch (Exception e) {
413
			Log.printStackTrace(e);
414
		}
415
		return null;
416
	}
417

  
418
	/**
419
	 * Creates the type focus field.
420
	 *
421
	 * @return the assisted query widget
422
	 */
423
	private AssistedQueryWidget createTypeFocusField() {
424
		AssistedQueryWidget focusTextBox = new AssistedQueryWidget(
425
				focusComposite, SWT.BORDER, this.corpus);
426
		GridData gridData = new GridData(GridData.FILL, GridData.FILL, true,
427
				false);
428
		focusTextBox.setLayoutData(gridData);
429
		focusTextBox.setFocus();
430
		queryWidgets.add(focusTextBox);
431
		return focusTextBox;
432
	}
433

  
434
	/* (non-Javadoc)
435
	 * @see org.eclipse.jface.dialogs.Dialog#okPressed()
436
	 */
437
	@Override
438
	protected void okPressed() {
439

  
440
		queries = new ArrayList<Query>();
441
		for (AssistedQueryWidget wid : queryWidgets) {
442
			if (!wid.getQueryString().equals("\"\"")) //$NON-NLS-1$
443
			{
444
				queries.add(new Query(wid.getQueryString()));
445
				wid.memorize();
446
			}
447
		}
448

  
449
		if (propertyCombo.getSelectionIndex() > 0)
450
			selectedStructuralUnitProperty = structuralUnitsProperties
451
			.get(propertyCombo.getSelectionIndex() - 1);
452
		else
453
			selectedStructuralUnitProperty = null;
454

  
455
		if (structuralUnitsCombo.getSelectionIndex() > 0)
456
			selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo
457
					.getSelectionIndex() - 1);
458
		else {
459
			selectedStructuralUnit = null;
460
			selectedStructuralUnitProperty = null;// need a structuralunit
461
		}
462

  
463
		try {
464
			Pattern.compile(regexValue.getText());
465
			regexpropertyValue = regexValue.getText();
466

  
467
			if (regexpropertyValue.length() == 0)
468
				regexpropertyValue = null;
469
		} catch (PatternSyntaxException e) {
470
			System.out.println(Messages.ProgressionDialog_10 + e);
471
		}
472

  
473
		cumulative = cumuButton.getSelection();
474
		blackAndWhite = colorButton.getSelection();
475
		monostyle = styleButton.getSelection();
476
		repeatvalues = repeatButton.getSelection();
477
		String smultibande = bandeField.getText();
478
		if (smultibande != null && smultibande.length() > 0)
479
		{
480
			try
481
			{	bandemultiplier = Float.parseFloat(smultibande);
482

  
483
			}catch(Exception e){
484
				bandemultiplier = 1.0f;
485
				System.out.println(Messages.ProgressionDialog_17+e);
486
				StatusLine.error(Messages.ProgressionDialog_17+e);
487
			}
488
		}
489
		else
490
			bandemultiplier = 1.0f;
491

  
492
		super.okPressed();
493
	}
494

  
495
	/**
496
	 * Reload properties.
497
	 */
498
	private void reloadProperties() {
499
		propertyCombo.removeAll();
500
		propertyCombo.add("    "); //$NON-NLS-1$
501

  
502
		if (structuralUnitsCombo.getSelectionIndex() > 0) {
503
			selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo
504
					.getSelectionIndex() - 1);
505
			structuralUnitsProperties = selectedStructuralUnit.getOrderedProperties();
506
			for (StructuralUnitProperty property : structuralUnitsProperties) {
507
				propertyCombo.add(property.getName());
508
			}
509
		}
510
		if (propertyCombo.getItemCount() > 0) {
511
			propertyCombo.select(0);
512
		}
513
	}
514

  
515
	/**
516
	 * Gets the corpus.
517
	 *
518
	 * @return the corpus
519
	 */
520
	public Corpus getCorpus() {
521
		return corpus;
522
	}
523

  
524
	/**
525
	 * Gets the queries.
526
	 *
527
	 * @return the queries
528
	 */
529
	public List<Query> getQueries() {
530
		return queries;
531
	}
532

  
533
	/**
534
	 * Gets the colors.
535
	 *
536
	 * @return the colors
537
	 */
538
	public List<String> getColors() {
539
		return null;
540
	}
541

  
542
	/**
543
	 * Gets the structural unit.
544
	 *
545
	 * @return the structural unit
546
	 */
547
	public StructuralUnit getStructuralUnit() {
548
		return selectedStructuralUnit;
549
	}
550

  
551
	/**
552
	 * Gets the graph type.
553
	 *
554
	 * @return the graph type
555
	 */
556
	public boolean isCumulativeType() {
557
		return cumulative;
558
	}
559

  
560
	/**
561
	 * Gets the bande multiplier.
562
	 *
563
	 * @return the bande multiplier
564
	 */
565
	public float getBandeMultiplier()
566
	{
567
		return bandemultiplier;
568
	}
569

  
570
	/**
571
	 * Checks if is monochrome.
572
	 *
573
	 * @return true, if is monochrome
574
	 */
575
	public boolean isBlackAndWhite() {
576
		return blackAndWhite;
577
	}
578

  
579
	/**
580
	 * Checks if is repeatvalues.
581
	 *
582
	 * @return true, if is repeatvalues
583
	 */
584
	public boolean isRepeatvalues() {
585
		return repeatvalues;
586
	}
587

  
588
	/**
589
	 * Gets the structural property.
590
	 *
591
	 * @return the structural property
592
	 */
593
	public StructuralUnitProperty getStructuralProperty() {
594
		return selectedStructuralUnitProperty;
595
	}
596

  
597
	/**
598
	 * Gets the propertyregex.
599
	 *
600
	 * @return the propertyregex
601
	 */
602
	public String getPropertyregex() {
603
		return regexpropertyValue;
604
	}
605

  
606
	/**
607
	 * Checks if is mono style.
608
	 *
609
	 * @return true, if is mono style
610
	 */
611
	public boolean isMonoStyle() {
612

  
613
		return monostyle;
614
	}
615

  
616
	/**
617
	 * Gets the line width.
618
	 *
619
	 * @return the line width
620
	 */
621
	public int getLineWidth()
622
	{
623
		return linewidth;
624
	}
625
}
0 626

  
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/adapters/ProgressionAdapterFactory.java (revision 163)
1
// Copyright © 2010-2013 ENS de Lyon.
2
package org.txm.progression.rcp.adapters;
3

  
4
import org.eclipse.jface.resource.ImageDescriptor;
5
import org.eclipse.ui.model.IWorkbenchAdapter;
6
import org.eclipse.ui.plugin.AbstractUIPlugin;
7
import org.osgi.framework.FrameworkUtil;
8
import org.txm.progression.core.functions.Progression;
9
import org.txm.rcp.adapters.BaseAdapterFactory;
10

  
11

  
12
/**
13
 * A factory for creating Adapter objects.
14
 *  
15
 * @author mdecorde
16
 * @author sjacquot
17
 */
18
public class ProgressionAdapterFactory extends BaseAdapterFactory {
19

  
20
	
21
	public static final ImageDescriptor ICON =
22
			AbstractUIPlugin.imageDescriptorFromPlugin(FrameworkUtil.getBundle(ProgressionAdapterFactory.class).getSymbolicName(),
23
					"platform:/plugin/"+ FrameworkUtil.getBundle(ProgressionAdapterFactory.class).getSymbolicName() + "/icons/functions/progression.png"); //$NON-NLS-1$
24
	
25
	/**
26
	 * Gets the adapter.
27
	 *
28
	 * @param adaptableObject the adaptable object
29
	 * @param adapterType the adapter type
30
	 * @return the adapter
31
	 * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
32
	 */
33
	@Override
34
	public Object getAdapter(Object adaptableObject, Class adapterType) {
35
		
36
		if(adapterType == IWorkbenchAdapter.class)	{
37
			if(adaptableObject instanceof Progression)	{
38
				return new IWorkbenchAdapter() {
39
					@Override
40
					public Object[] getChildren(Object resultData) {
41
						return new Object[0];
42
					}
43
	
44
					@Override
45
					public ImageDescriptor getImageDescriptor(Object object) {
46
						return ICON;
47
					}
48
	
49
					@Override
50
					public String getLabel(Object resultData) {
51
						return ((Progression) resultData).getDetails(); 
52
					}
53
	
54
					@Override
55
					public Object getParent(Object resultData) {
56
						return ((Progression) resultData).getCorpus();
57
					}
58
				};
59
			}
60
		}
61
		return null;
62
	}
63

  
64

  
65
}
0 66

  
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/forms/ProgressionParametersComposite.java (revision 163)
1
package org.txm.progression.rcp.forms;
2
import org.eclipse.swt.SWT;
3
import org.eclipse.swt.custom.SashForm;
4
import org.eclipse.swt.custom.ScrolledComposite;
5
import org.eclipse.swt.layout.FillLayout;
6
import org.eclipse.swt.layout.GridData;
7
import org.eclipse.swt.layout.GridLayout;
8
import org.eclipse.swt.widgets.Button;
9
import org.eclipse.swt.widgets.Combo;
10
import org.eclipse.swt.widgets.Composite;
11
import org.eclipse.swt.widgets.Label;
12
import org.eclipse.swt.widgets.Table;
13
import org.eclipse.swt.widgets.Text;
14
import org.txm.rcpapplication.Messages;
15

  
16

  
17
public class ProgressionParametersComposite extends Composite {
18
	SashForm sashForm;
19
	
20
	private Table table;
21
	private Text scaleTextEdit;
22
	private Text regTextEdit;
23
	
24
	Button btnSupprimer;
25
	Button cumulBtn;
26
	Button densiBtn;
27
	
28
	Combo structCombo;
29
	Combo propCombo;
30
	private Button styleRadio;
31
	private Button repeatRadio;
32
	private Button NBRadio;
33
	private Button btnNewButton;
34

  
35
	
36
	/**
37
	 * Creates the composite.
38
	 * @param parent
39
	 * @param style
40
	 */
41
	public ProgressionParametersComposite(Composite parent, int style) {
42
		super(parent, style);
43
		
44
		
45
		//parent.setLayout(new GridLayout(1, true));
46
		
47
//		ExpandBar bar = new ExpandBar(parent, SWT.NONE);
48
		
49
//		sashForm = new SashForm(parent, SWT.VERTICAL);
50
//		sashForm.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
51
		
52
		
53
		
54
		ScrolledComposite scrolledComposite_1 = new ScrolledComposite(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
55
		scrolledComposite_1.setExpandHorizontal(true);
56
		scrolledComposite_1.setExpandVertical(true);
57

  
58
//		Composite scrolledComposite_1 = new Composite(this, SWT.BORDER);
59
		
60
		Composite composite_1 = new Composite(scrolledComposite_1, SWT.NONE);
61
		composite_1.setLayout(new FillLayout(SWT.VERTICAL));
62
		
63
		Composite composite = new Composite(composite_1, SWT.NONE);
64
		composite.setLayout(new GridLayout(5, false));
65
		
66
		Label label = new Label(composite, SWT.NONE);
67
		GridData gd_label = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
68
		gd_label.widthHint = 29;
69
		label.setLayoutData(gd_label);
70
		label.setText(Messages.ProgressionForm_0);
71
		
72
		cumulBtn = new Button(composite, SWT.RADIO);
73
		cumulBtn.setText(Messages.ProgressionForm_1);
74
		cumulBtn.setSelection(true);
75
		
76
		densiBtn = new Button(composite, SWT.RADIO);
77
		densiBtn.setText(Messages.ProgressionForm_2);
78
		
79
		Label lblEchelle = new Label(composite, SWT.NONE);
80
		lblEchelle.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
81
		lblEchelle.setText(Messages.ProgressionForm_3);
82
		
83
		scaleTextEdit = new Text(composite, SWT.BORDER);
84
		scaleTextEdit.setText("1.0"); //$NON-NLS-1$
85
		
86
		Label lblOptionsDaffichage = new Label(composite, SWT.NONE);
87
		lblOptionsDaffichage.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
88
		lblOptionsDaffichage.setText(Messages.ProgressionForm_5);
89
		new Label(composite, SWT.NONE);
90
		
91
		Label label_6 = new Label(composite, SWT.NONE);
92
		label_6.setText(Messages.ProgressionForm_6);
93
		
94
		structCombo = new Combo(composite, SWT.NONE);
95
		
96
		Label label_5 = new Label(composite, SWT.NONE);
97
		label_5.setText(Messages.ProgressionForm_7);
98
		
99
		propCombo = new Combo(composite, SWT.NONE);
100
		propCombo.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
101
		new Label(composite, SWT.NONE);
102
		new Label(composite, SWT.NONE);
103
		
104
		Label label_7 = new Label(composite, SWT.NONE);
105
		label_7.setText(Messages.ProgressionForm_8);
106
		
107
		regTextEdit = new Text(composite, SWT.BORDER);
108
		regTextEdit.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
109
		new Label(composite, SWT.NONE);
110
		
111
		styleRadio = new Button(composite, SWT.CHECK);
112
		styleRadio.setText(Messages.ProgressionForm_9);
113
		styleRadio.setSelection(true);
114
		
115
		repeatRadio = new Button(composite, SWT.CHECK);
116
		repeatRadio.setText(Messages.ProgressionForm_10);
117
		
118
		NBRadio = new Button(composite, SWT.CHECK);
119
		NBRadio.setText(Messages.ProgressionForm_11);
120
		new Label(composite, SWT.NONE);
121
	
122
		Composite composite_2 = new Composite(composite_1, SWT.NONE);
123
		composite_2.setLayout(new GridLayout(1, false));
124
		
125
		Composite composite_3 = new Composite(composite_2, SWT.NONE);
126
		composite_3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
127
		composite_3.setLayout(new FillLayout(SWT.HORIZONTAL));
128
		
129
		Label lblRequetes = new Label(composite_3, SWT.NONE);
130
		lblRequetes.setText(Messages.ProgressionForm_12);
131
		
132
		btnNewButton = new Button(composite_3, SWT.NONE);
133
		btnNewButton.setText(Messages.ProgressionForm_13);
134
		
135
		btnSupprimer = new Button(composite_3, SWT.NONE);
136
		btnSupprimer.setText(Messages.ProgressionForm_14);
137
		
138
		scrolledComposite_1.setContent(composite_1);
139
		scrolledComposite_1.setMinSize(composite_1.computeSize(SWT.DEFAULT, SWT.DEFAULT));
140
		
141
		
142
//		table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
143
//		table.setHeaderVisible(true);
144
//		table.setLinesVisible(true);
145
//		sashForm.setWeights(new int[] {215, 334});
146
		//return sashForm;
147
		
148
		
149
		scrolledComposite_1.setBounds(20, 20, 800, 800);
150

  
151
	}
152
	
153
	
154
	
155
	public void setTable(Table table) {
156
		this.table = table;
157
		//table = new Table(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
158
		table.setHeaderVisible(true);
159
		table.setLinesVisible(true);
160
		sashForm.setWeights(new int[] {215, 334});
161
	}
162
	
163

  
164

  
165
	public SashForm getSash() {
166
		return sashForm;
167
	}
168
	
169
	/**
170
	 * @return the table
171
	 */
172
	public Table getTable() {
173
		return table;
174
	}
175

  
176
	/**
177
	 * @return the scaleTextEdit
178
	 */
179
	public Text getScaleTextEdit() {
180
		return scaleTextEdit;
181
	}
182

  
183
	/**
184
	 * @return the regTextEdit
185
	 */
186
	public Text getRegTextEdit() {
187
		return regTextEdit;
188
	}
189

  
190
	/**
191
	 * @return the btnSupprimer
192
	 */
193
	public Button getBtnSupprimer() {
194
		return btnSupprimer;
195
	}
196

  
197
	/**
198
	 * @return the cumulBtn
199
	 */
200
	public Button getCumulBtn() {
201
		return cumulBtn;
202
	}
203

  
204
	/**
205
	 * @return the densiBtn
206
	 */
207
	public Button getDensiBtn() {
208
		return densiBtn;
209
	}
210

  
211
	/**
212
	 * @return the structCombo
213
	 */
214
	public Combo getStructCombo() {
215
		return structCombo;
216
	}
217

  
218
	/**
219
	 * @return the propCombo
220
	 */
221
	public Combo getPropCombo() {
222
		return propCombo;
223
	}
224

  
225
	/**
226
	 * @return the styleRadio
227
	 */
228
	public Button getStyleRadio() {
229
		return styleRadio;
230
	}
231

  
232
	/**
233
	 * @return the repeatRadio
234
	 */
235
	public Button getRepeatRadio() {
236
		return repeatRadio;
237
	}
238

  
239
	/**
240
	 * @return the nBRadio
241
	 */
242
	public Button getNBRadio() {
243
		return NBRadio;
244
	}
245

  
246
	/**
247
	 * @return the btnNewButton
248
	 */
249
	public Button getBtnNewButton() {
250
		return btnNewButton;
251
	}
252

  
253

  
254
}
0 255

  
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/ProgressionUIMessages.java (revision 163)
1
package org.txm.progression.rcp.messages;
2

  
3
import org.eclipse.osgi.util.NLS;
4
import org.txm.core.messages.TXMCoreMessages;
5

  
6
public class ProgressionUIMessages extends NLS {
7

  
8
	// FIXME: use the same properties file than the bundle
9
	private static final String BUNDLE_NAME = "l10n.bundle"; //$NON-NLS-1$
10

  
11
	public static String ProgressionPreferencePage_2;
12
	public static String ProgressionPreferencePage_3;
13
	public static String ProgressionPreferencePage_4;
14
	public static String ProgressionPreferencePage_5;
15
	public static String ProgressionPreferencePage_6;
16
	public static String ProgressionPreferencePage_7;
17

  
18
	static {
19
		// initializes resource bundle
20
		TXMCoreMessages.initializeMessages(BUNDLE_NAME, ProgressionUIMessages.class);
21
		//NLS.initializeMessages(BUNDLE_NAME, RCPProgressionMessages.class);
22
	}
23
	
24
	private ProgressionUIMessages() {
25
	}
26
}
0 27

  
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/___ProgressionEditorInput.java (revision 163)
1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
// 
22
// 
23
// 
24
// $LastChangedDate:$
25
// $LastChangedRevision:$
26
// $LastChangedBy:$ 
27
//
28
package org.txm.progression.rcp.editors;
29

  
30
import org.eclipse.jface.resource.ImageDescriptor;
31
import org.eclipse.ui.IEditorInput;
32
import org.eclipse.ui.IPersistableElement;
33
import org.eclipse.ui.plugin.AbstractUIPlugin;
34
import org.txm.progression.core.functions.Progression;
35
import org.txm.rcpapplication.Application;
36
import org.txm.rcpapplication.IImageKeys;
37
import org.txm.rcpapplication.Messages;
38
// TODO: Auto-generated Javadoc
39
/**
40
 * The Class ProgressionEditorInput.
41
 *
42
 * @author mdecorde
43
 */
44
public class ___ProgressionEditorInput implements IEditorInput {
45
	
46
	/** The progression. */
47
	private Progression progression;
48

  
49
	/**
50
	 * Instantiates a new progression editor input.
51
	 *
52
	 * @param progression the progression
53
	 */
54
	public ___ProgressionEditorInput(Progression progression) {
55
		super();
56
		this.progression = progression;
57
	}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff