Révision 1019

tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 1019)
980 980
	}
981 981

  
982 982
	/**
983
	 * Gets the default preference node of the initializer instance.
984
	 * @return
985
	 */
986
	public IEclipsePreferences getDefaultPreferencesNode()	{
987
		return DefaultScope.INSTANCE.getNode(this.preferencesNode);
988
	}
989
	
990
	/**
983 991
	 * print TxmPreferences in the console.
984 992
	 */
985 993
	public static String dumpToString(String nodeQualifier) {
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1019)
175 175
			throw new IllegalArgumentException("A result can not be parent of itself.");
176 176
		}
177 177
		if(uuid == null)	{
178
			uuid = createUUID();
178
			uuid = createUUID() + "_" + this.getClass().getSimpleName();
179 179
		}
180 180
		this.uniqueID = uuid;
181 181

  
......
200 200
		// + this.preferencesNodeQualifier + ", class = " + getClass());
201 201

  
202 202
		this.dirty = true;
203
		this.persistable = true;
204
		this.userPersistable = false;
203
		this.persistable = false;
204
		this.userPersistable = TXMPreferences.getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED, TBXPreferences.PREFERENCES_NODE);
205 205
		
206 206

  
207 207
		// retrieving parent from UUID
......
1417 1417
	// FIXME: to discuss and/or to move in export layer
1418 1418
	public String getValidFileName() {
1419 1419
		try {
1420
			return FILE_NAME_PATTERN.matcher(this.getName()).replaceAll(UNDERSCORE); //$NON-NLS-1$
1420
			return FILE_NAME_PATTERN.matcher(this.getCurrentName()).replaceAll(UNDERSCORE);
1421 1421
		} catch (Exception e) {
1422 1422
			Log.printStackTrace(e);
1423 1423
		}
......
1442 1442
		// create the reversed string
1443 1443
		StringBuilder b = new StringBuilder();
1444 1444
		for (int i = branch.size() - 1; i >= 0; i--) {
1445
			b.append("[" + branch.get(i).getClass().getSimpleName() + ": \"" + branch.get(i).getSimpleName() + "\"] / ");
1445
			b.append("[" + branch.get(i).getClass().getSimpleName() + ": \"" + branch.get(i).getSimpleName() + "\"] / "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1446 1446
		}
1447 1447
		b.deleteCharAt(b.length() - 3);
1448 1448
		b.deleteCharAt(b.length() - 2);
......
1693 1693
	 * @return
1694 1694
	 */
1695 1695
	public boolean mustBePersisted()	{
1696
		return (this.persistable && TBXPreferences.getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED, TBXPreferences.PREFERENCES_NODE)
1697
				|| this.userPersistable);
1696
		if(this.persistable || TBXPreferences.getBoolean(TBXPreferences.AUTO_PERSISTENCE_ENABLED, TBXPreferences.PREFERENCES_NODE) || this.userPersistable)	{
1697
			return true;
1698
		}
1699
		return false;
1698 1700
	}
1699 1701
	
1700 1702
	/**
tmp/org.txm.core/src/java/org/txm/objects/Corpus.java (revision 1019)
166 166
	 */
167 167
	public Corpus(Base base, Element c, String uuid) {
168 168
		super(uuid, base);
169
		this.persistable = true;
170
		this.userPersistable = false;
169 171
		if(base != null && c != null) {
170 172
			this.base = base;
171 173
			this.setPath(base.getPath() + getName());
tmp/org.txm.core/src/java/org/txm/objects/Page.java (revision 1019)
66 66
	 */
67 67
	public Page(Edition edition, Element page) {
68 68
		super(edition);
69
		this.persistable = true;
70
		this.userPersistable = false;
71
		
69 72
		this.setPath(edition.getPath() + getName());
70 73
		setSelfElement(page);
71 74
		this.edition = edition;
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 1019)
341 341
			//clone.chart = this.chart.clone();
342 342
			clone.clearLastRenderingParameters(); // to force recreation of the chart at next computing
343 343
			clone.chartDirty = true;
344
			clone.hasBeenComputedOnce = false;
344 345
		}
345 346
		catch(Exception e) {
346 347
		}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/FixUpdateHandler.java (revision 1019)
9 9
import org.eclipse.equinox.p2.ui.ProvisioningUI;
10 10
import org.txm.rcp.TxmPreferences;
11 11
import org.txm.rcp.messages.TXMUIMessages;
12
import org.txm.rcp.preferences.AdvancePreferencePage;
12
import org.txm.rcp.preferences.AdvancedPreferencePage;
13 13
import org.txm.utils.logger.Log;
14 14

  
15 15
public class FixUpdateHandler extends UpdateHandler {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/p2/plugins/TXMUpdateHandler.java (revision 1019)
46 46
import org.txm.rcp.Activator;
47 47
import org.txm.rcp.TxmPreferences;
48 48
import org.txm.rcp.messages.TXMUIMessages;
49
import org.txm.rcp.preferences.AdvancePreferencePage;
49
import org.txm.rcp.preferences.AdvancedPreferencePage;
50 50
import org.txm.rcp.preferences.RCPPreferences;
51 51
import org.txm.utils.BundleUtils;
52 52
import org.txm.utils.logger.Log;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 1019)
590 590
			corporaView.treeViewer.expandToLevel(obj, 1);
591 591
		}
592 592
	}
593

  
594

  
595
	// FIXMLE: deprecated
596
	/**
597
	 * Adds a double click listener to the tree view for the specified result data type and executing the command specified by its ID which must be equal to its class simple name
598
	 * (eg. to do the link, the command ID must be "ComputeCA" for an handler class named "ComputeCA.java").
599
	 * 
600
	 * warning: There can be only one DoubleClickListener per resultDataClass
601
	 * 
602
	 * @param resultDataClass
603
	 * @param commandClass
604
	 */
605
	//	public static void addDoubleClickListener(final Class resultDataClass, final Class commandClass)	{
606
	//		if (managedDoubleClickClasses.containsKey(managedDoubleClickClasses)) {
607
	//			Log.warning("The " + commandClass + " class for result " + resultDataClass + " is already managed by the Corpora view.");
608
	//			return;
609
	//		}
610
	//		//FIXME: this won't works if the ComputeXXX commands is not called -> we can't do lazy load
611
	//		// also not work for the intermediate results (eg. lexical table of a CA computed from a partition)
612
	//		managedDoubleClickClasses.put(resultDataClass, commandClass);
613
	//	}
614 593
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/debug/TXMResultDebugView.java (revision 1019)
131 131
		buffer.append("Node visible = " + this.currentResult.isVisible() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
132 132
		buffer.append("Node weight = " + this.currentResult.getWeight() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
133 133
		buffer.append("Persistable = " + this.currentResult.isPersistable() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
134
		buffer.append("User persistable = " + this.currentResult.isUserPersistable() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
134 135
//		if (this.currentResult instanceof ChartResult) 	{
135 136
//			buffer.append("Chart engine = " + ((ChartResult)this.currentResult).getChartsEngine() + ", chart object = " + ((ChartResult)this.currentResult).getChart()
136 137
//					+ ", chart type = " + ((ChartResult)this.currentResult).getChartType()
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/SetTXMResultPersistentState.java (revision 1019)
71 71
		if(object instanceof TXMResult)	{
72 72
			TXMResult result = ((TXMResult)object);
73 73
			result.swapUserPersistableState();
74
			if(result.mustBePersisted())	{
75
				TXMPreferences.flush(result);
76
			}
74
//			if(result.mustBePersisted())	{
75
//				TXMPreferences.flush(result);
76
//			}
77 77
			CorporaView.refresh();
78 78
			return null;
79 79
		}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/AdvancePreferencePage.java (revision 1019)
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.rcp.preferences;
29

  
30
import org.eclipse.jface.preference.BooleanFieldEditor;
31
import org.eclipse.jface.preference.ComboFieldEditor;
32
import org.eclipse.jface.preference.DirectoryFieldEditor;
33
import org.eclipse.swt.SWT;
34
import org.eclipse.swt.layout.GridData;
35
import org.eclipse.swt.layout.RowLayout;
36
import org.eclipse.swt.widgets.Group;
37
import org.eclipse.ui.IWorkbench;
38
import org.eclipse.ui.PlatformUI;
39
import org.eclipse.ui.handlers.IHandlerService;
40
import org.txm.core.preferences.TBXPreferences;
41
import org.txm.rcp.messages.TXMUIMessages;
42
import org.txm.rcp.views.corpora.CorporaView;
43
import org.txm.rcp.views.fileexplorer.MacroExplorer;
44

  
45
/**
46
 * Advanced preferences page.
47
 */
48
public class AdvancePreferencePage extends TXMPreferencePage {
49
	
50

  
51
	/* (non-Javadoc)
52
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
53
	 */
54
	@Override
55
	protected void createFieldEditors() {
56

  
57
		// install directory
58
		addField(new DirectoryFieldEditor(TBXPreferences.INSTALL_DIR, TXMUIMessages.AdvancePreferencePage_1, getFieldEditorParent()));
59
		
60
		// txmhome directory
61
		addField(new DirectoryFieldEditor(TBXPreferences.USER_TXM_HOME, TXMUIMessages.AdvancePreferencePage_2, getFieldEditorParent()));
62
		
63
		Group updateGroup = new Group(getFieldEditorParent(), SWT.NONE);
64
		updateGroup.setText(TXMUIMessages.AdvancePreferencePage_6);
65
		GridData gridData2 = new GridData(SWT.FILL, SWT.FILL, true, false);
66
		gridData2.horizontalSpan = 3;
67
		gridData2.verticalIndent = 10;
68
		updateGroup.setLayoutData(gridData2);
69
		RowLayout rlayout = new RowLayout(SWT.VERTICAL);
70
		rlayout.marginHeight = 5;
71
		updateGroup.setLayout(rlayout);
72
		
73
		// Log level
74
		String[][] choices = new String[9][2];
75
		choices[0][0] = choices[0][1] = "OFF"; //$NON-NLS-1$
76
		choices[1][0] = choices[1][1] = "SEVERE"; //$NON-NLS-1$
77
		choices[2][0] = choices[2][1] = "WARNING"; //$NON-NLS-1$
78
		choices[3][0] = choices[3][1] = "INFO"; //$NON-NLS-1$
79
		choices[4][0] = choices[4][1] = "CONFIG"; //$NON-NLS-1$
80
		choices[5][0] = choices[5][1] = "FINE"; //$NON-NLS-1$
81
		choices[6][0] = choices[6][1] = "FINER"; //$NON-NLS-1$
82
		choices[7][0] = choices[7][1] = "FINEST"; //$NON-NLS-1$
83
		choices[8][0] = choices[8][1] = "ALL"; //$NON-NLS-1$
84
		addField(new ComboFieldEditor(TBXPreferences.LOG_LEVEL, TXMUIMessages.AdvancePreferencePage_12, choices, updateGroup));
85

  
86
		// Log timings
87
		addField(new BooleanFieldEditor(TBXPreferences.SHOW_TIMINGS, TXMUIMessages.AdvancePreferencePage_3, updateGroup));
88
		
89
		// Log stack trace
90
		addField(new BooleanFieldEditor(TBXPreferences.LOG_STACKTRACE, TXMUIMessages.AdvancePreferencePage_0, updateGroup));
91
		
92
		// Log console
93
		addField(new BooleanFieldEditor(TBXPreferences.ADD_TECH_LOGS, TXMUIMessages.AdvancePreferencePage_13, updateGroup));
94
		
95
		// Show dialog on severe error
96
		addField(new BooleanFieldEditor(RCPPreferences.SHOW_SEVERE_DIALOG, "Show a dialog box when a severe error occurs", updateGroup));
97

  
98
		// Log in file
99
		addField(new BooleanFieldEditor(TBXPreferences.LOG_IN_FILE, TXMUIMessages.AdvancePreferencePage_14, updateGroup));
100
		
101
		// Update level
102
		String[][] choices2 = new String[4][2];
103
		choices2[0][0] = choices2[0][1]= "STABLE"; //$NON-NLS-1$
104
		choices2[1][0] = choices2[1][1] = "BETA"; //$NON-NLS-1$
105
		choices2[2][0] = choices2[2][1] = "ALPHA"; //$NON-NLS-1$
106
		choices2[3][0] = choices2[3][1] = "DEV"; //$NON-NLS-1$
107
		addField(new ComboFieldEditor(RCPPreferences.UPDATE_LEVEL, TXMUIMessages.AdvancePreferencePage_7,choices2, getFieldEditorParent()));
108
		
109
		// Expert mode
110
		addField(new BooleanFieldEditor(TBXPreferences.EXPERT_USER, TXMUIMessages.AdvancePreferencePage_4, getFieldEditorParent()));
111

  
112
		// Auto save each result after computing and auto load them at startup
113
		addField(new BooleanFieldEditor(TBXPreferences.AUTO_PERSISTENCE_ENABLED, TXMUIMessages.preferences_advanced_enableResultsPersistence, getFieldEditorParent()));
114

  
115
	}
116

  
117
	/* (non-Javadoc)
118
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
119
	 */
120
	@Override
121
	public boolean performOk() {
122
		super.performOk();
123
		try {
124
			MacroExplorer.refresh();
125
			CorporaView.refresh();
126
			
127
			// update repositories
128
			IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
129
			service.executeCommand("org.txm.rcp.p2.plugins.FixUpdateHandler", null); //$NON-NLS-1$
130
			
131
		} catch (Exception e) {
132
			System.err.println(TXMUIMessages.FAILED_TO_SAVE_PREFERENCES + e);
133
		}
134
		return true;
135
	}
136

  
137
	@Override
138
	public void init(IWorkbench workbench) {
139
		this.setPreferenceStore(new TXMPreferenceStore(TBXPreferences.PREFERENCES_NODE));
140
	}
141
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/AdvancedPreferencePage.java (revision 1019)
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.rcp.preferences;
29

  
30
import org.eclipse.jface.preference.BooleanFieldEditor;
31
import org.eclipse.jface.preference.ComboFieldEditor;
32
import org.eclipse.jface.preference.DirectoryFieldEditor;
33
import org.eclipse.swt.SWT;
34
import org.eclipse.swt.layout.GridData;
35
import org.eclipse.swt.layout.RowLayout;
36
import org.eclipse.swt.widgets.Group;
37
import org.eclipse.ui.IWorkbench;
38
import org.eclipse.ui.PlatformUI;
39
import org.eclipse.ui.handlers.IHandlerService;
40
import org.txm.core.preferences.TBXPreferences;
41
import org.txm.rcp.messages.TXMUIMessages;
42
import org.txm.rcp.views.corpora.CorporaView;
43
import org.txm.rcp.views.fileexplorer.MacroExplorer;
44

  
45
/**
46
 * Advanced preferences page.
47
 */
48
public class AdvancedPreferencePage extends TXMPreferencePage {
49
	
50

  
51
	/* (non-Javadoc)
52
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
53
	 */
54
	@Override
55
	protected void createFieldEditors() {
56

  
57
		// install directory
58
		addField(new DirectoryFieldEditor(TBXPreferences.INSTALL_DIR, TXMUIMessages.AdvancePreferencePage_1, getFieldEditorParent()));
59
		
60
		// txmhome directory
61
		addField(new DirectoryFieldEditor(TBXPreferences.USER_TXM_HOME, TXMUIMessages.AdvancePreferencePage_2, getFieldEditorParent()));
62
		
63
		Group updateGroup = new Group(getFieldEditorParent(), SWT.NONE);
64
		updateGroup.setText(TXMUIMessages.AdvancePreferencePage_6);
65
		GridData gridData2 = new GridData(SWT.FILL, SWT.FILL, true, false);
66
		gridData2.horizontalSpan = 3;
67
		gridData2.verticalIndent = 10;
68
		updateGroup.setLayoutData(gridData2);
69
		RowLayout rlayout = new RowLayout(SWT.VERTICAL);
70
		rlayout.marginHeight = 5;
71
		updateGroup.setLayout(rlayout);
72
		
73
		// Log level
74
		String[][] choices = new String[9][2];
75
		choices[0][0] = choices[0][1] = "OFF"; //$NON-NLS-1$
76
		choices[1][0] = choices[1][1] = "SEVERE"; //$NON-NLS-1$
77
		choices[2][0] = choices[2][1] = "WARNING"; //$NON-NLS-1$
78
		choices[3][0] = choices[3][1] = "INFO"; //$NON-NLS-1$
79
		choices[4][0] = choices[4][1] = "CONFIG"; //$NON-NLS-1$
80
		choices[5][0] = choices[5][1] = "FINE"; //$NON-NLS-1$
81
		choices[6][0] = choices[6][1] = "FINER"; //$NON-NLS-1$
82
		choices[7][0] = choices[7][1] = "FINEST"; //$NON-NLS-1$
83
		choices[8][0] = choices[8][1] = "ALL"; //$NON-NLS-1$
84
		addField(new ComboFieldEditor(TBXPreferences.LOG_LEVEL, TXMUIMessages.AdvancePreferencePage_12, choices, updateGroup));
85

  
86
		// Log timings
87
		addField(new BooleanFieldEditor(TBXPreferences.SHOW_TIMINGS, TXMUIMessages.AdvancePreferencePage_3, updateGroup));
88
		
89
		// Log stack trace
90
		addField(new BooleanFieldEditor(TBXPreferences.LOG_STACKTRACE, TXMUIMessages.AdvancePreferencePage_0, updateGroup));
91
		
92
		// Log console
93
		addField(new BooleanFieldEditor(TBXPreferences.ADD_TECH_LOGS, TXMUIMessages.AdvancePreferencePage_13, updateGroup));
94
		
95
		// Show dialog on severe error
96
		addField(new BooleanFieldEditor(RCPPreferences.SHOW_SEVERE_DIALOG, "Show a dialog box when a severe error occurs", updateGroup));
97

  
98
		// Log in file
99
		addField(new BooleanFieldEditor(TBXPreferences.LOG_IN_FILE, TXMUIMessages.AdvancePreferencePage_14, updateGroup));
100
		
101
		// Update level
102
		String[][] choices2 = new String[4][2];
103
		choices2[0][0] = choices2[0][1]= "STABLE"; //$NON-NLS-1$
104
		choices2[1][0] = choices2[1][1] = "BETA"; //$NON-NLS-1$
105
		choices2[2][0] = choices2[2][1] = "ALPHA"; //$NON-NLS-1$
106
		choices2[3][0] = choices2[3][1] = "DEV"; //$NON-NLS-1$
107
		addField(new ComboFieldEditor(RCPPreferences.UPDATE_LEVEL, TXMUIMessages.AdvancePreferencePage_7,choices2, getFieldEditorParent()));
108
		
109
		// Expert mode
110
		addField(new BooleanFieldEditor(TBXPreferences.EXPERT_USER, TXMUIMessages.AdvancePreferencePage_4, getFieldEditorParent()));
111

  
112
		// Auto save each result after computing and auto load them at startup
113
		addField(new BooleanFieldEditor(TBXPreferences.AUTO_PERSISTENCE_ENABLED, TXMUIMessages.preferences_advanced_enableResultsPersistence, getFieldEditorParent()));
114

  
115
	}
116

  
117
	/* (non-Javadoc)
118
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
119
	 */
120
	@Override
121
	public boolean performOk() {
122
		super.performOk();
123
		try {
124
			MacroExplorer.refresh();
125
			CorporaView.refresh();
126
			
127
			// update repositories
128
			IHandlerService service = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);
129
			service.executeCommand("org.txm.rcp.p2.plugins.FixUpdateHandler", null); //$NON-NLS-1$
130
			
131
		} catch (Exception e) {
132
			System.err.println(TXMUIMessages.FAILED_TO_SAVE_PREFERENCES + e);
133
		}
134
		return true;
135
	}
136

  
137
	@Override
138
	public void init(IWorkbench workbench) {
139
		this.setPreferenceStore(new TXMPreferenceStore(TBXPreferences.PREFERENCES_NODE));
140
	}
141
}
0 142

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/TXMResultAdapter.java (revision 1019)
3 3
 */
4 4
package org.txm.rcp.adapters;
5 5

  
6
import java.util.Random;
7

  
8 6
import org.eclipse.swt.SWT;
9 7
import org.eclipse.swt.graphics.Color;
10 8
import org.eclipse.swt.graphics.FontData;
11 9
import org.eclipse.swt.graphics.RGB;
12 10
import org.eclipse.swt.widgets.Display;
13
import org.eclipse.ui.ISharedImages;
14
import org.eclipse.ui.PlatformUI;
15 11
import org.eclipse.ui.model.WorkbenchAdapter;
16 12
import org.txm.core.preferences.TBXPreferences;
17 13
import org.txm.core.results.TXMResult;
......
68 64
    public RGB getForeground(Object element) {
69 65
		if(element instanceof TXMResult && !((TXMResult)element).hasBeenComputedOnce())	{
70 66
	    	Display display = Display.getCurrent();
71
	    	Color color = display.getSystemColor(SWT.COLOR_GRAY);
67
	    	Color color = display.getSystemColor(SWT.COLOR_DARK_GRAY);
72 68
	    	return color.getRGB();
73 69
		}
74 70
		return null;
......
78 74
    public RGB getBackground(Object element) {
79 75
		if(element instanceof TXMResult && ((TXMResult)element).isUserPersistable())	{
80 76
	    	Display display = Display.getCurrent();
81
	    	Color color = display.getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
77
	    	Color color = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
82 78

  
83 79
	    	// FIXME: random color tests
84 80
//	    	Random rnd = new Random();
tmp/org.txm.rcp/src/main/java/org/txm/rcp/adapters/DefaultAdapterFactory.java (revision 1019)
1
// Copyright © 2010-2013 ENS de Lyon.
2
package org.txm.rcp.adapters;
3

  
4
import org.eclipse.jface.resource.ImageDescriptor;
5
import org.eclipse.ui.ISharedImages;
6
import org.eclipse.ui.PlatformUI;
7
import org.txm.core.results.TXMResult;
8

  
9

  
10
/**
11
 * Default TXMResult adapter factory.
12
 * Essentially dedicated to debug purpose.
13
 *  
14
 * @author mdecorde
15
 * @author sjacquot
16
 */
17
public class DefaultAdapterFactory extends TXMResultAdapterFactory {
18

  
19

  
20
	@Override
21
	public Object getAdapter(Object adaptableObject, Class adapterType) {
22
		if(this.canAdapt(adapterType)
23
				&& (
24
				adaptableObject instanceof TXMResult
25
//				|| adaptableObject instanceof Edition
26
//				|| adaptableObject instanceof Text
27
//				|| adaptableObject instanceof SavedQuery
28
				
29
				))	{
30
			return new TXMResultAdapter() {
31
				@Override
32
				public ImageDescriptor getImageDescriptor(Object object) {
33
					return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_ELCL_STOP_DISABLED);
34
				}
35
				
36
				@Override
37
				public String getLabel(Object result) {
38
					if (result instanceof TXMResult) {
39
						return ((TXMResult) result).getCurrentName() + " - " + result.getClass().getSimpleName();
40
					}
41
					else {
42
						return result.toString();
43
					}
44
				}
45

  
46
				
47
			};
48
		}
49
		return null;
50
	}
51

  
52

  
53
}
0 54

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 1019)
702 702

  
703 703
error_invalidRegularExpression = Invalid regular expression: {0}
704 704

  
705
preferences_advanced_enableResultsPersistence        = Enable results persistence
705
preferences_advanced_enableResultsPersistence        = Enable automatic save of all results (persistence)
706 706
preferences_advanced_showAllResultNodesInCorporaView = Show all result nodes in corpora view
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 1019)
641 641

  
642 642
error_invalidRegularExpression = Expression régulière invalide : {0}
643 643

  
644
preferences_advanced_enableResultsPersistence        = Activer la perstistance des résultats
644
preferences_advanced_enableResultsPersistence        = Activer la sauvegarde automatique de tous les résultats (perstistance)
645 645
preferences_advanced_showAllResultNodesInCorporaView = Afficher les noeuds de tous les résultats dans la vue corpus
tmp/org.txm.rcp/plugin.xml (revision 1019)
202 202
            class="org.txm.rcp.AdapterFactory">
203 203
         <adapter type="org.eclipse.ui.model.IWorkbenchAdapter"/>
204 204
      </factory>
205
      <factory
206
            adaptableType="org.txm.core.results.TXMResult"
207
            class="org.txm.rcp.adapters.DefaultAdapterFactory">
208
         <adapter
209
               type="org.eclipse.ui.model.IWorkbenchAdapter">
210
         </adapter>
211
         <adapter
212
               type="org.eclipse.ui.model.IWorkbenchAdapter2">
213
         </adapter>
214
      </factory>
205 215

  
206 216

  
207 217

  
......
280 290
      </page>
281 291
      <page
282 292
            category="org.txm.rcp.preferences.TextometriePreferencePage"
283
            class="org.txm.rcp.preferences.AdvancePreferencePage"
293
            class="org.txm.rcp.preferences.AdvancedPreferencePage"
284 294
            id="org.txm.rcp.preferences.AdvancePreferencePage"
285 295
            name="%page.name.0">
286 296
      </page>
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/adapters/CorpusAdapterFactory.java (revision 1019)
2 2
package org.txm.searchengine.cqp.rcp.adapters;
3 3

  
4 4
import java.util.ArrayList;
5
import java.util.Collection;
6 5
import java.util.Collections;
7 6

  
8 7
import org.eclipse.jface.resource.ImageDescriptor;
......
10 9
import org.eclipse.ui.plugin.AbstractUIPlugin;
11 10
import org.txm.core.preferences.TBXPreferences;
12 11
import org.txm.core.results.TXMResult;
13
import org.txm.objects.SavedQuery;
14
import org.txm.objects.Text;
15 12
import org.txm.rcp.Application;
16 13
import org.txm.rcp.IImageKeys;
17 14
import org.txm.rcp.adapters.TXMResultAdapter;
......
38 35
			return new TXMResultAdapter() {
39 36
				@Override
40 37
				public Object[] getChildren(Object corpus) {
41
					ArrayList<TXMResult> allChildren = ((Corpus) corpus).getChildren(!TBXPreferences.getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES, TBXPreferences.PREFERENCES_NODE));
38
					ArrayList<TXMResult> allChildren = ((Corpus) corpus).getChildren();
42 39

  
43 40
					ArrayList partitions = new ArrayList();
44 41
					ArrayList subcorporas = new ArrayList();
45
					ArrayList otherChildren = new ArrayList();
42
					ArrayList resultsChildren = new ArrayList();
43
					ArrayList hiddentResultsChildren = new ArrayList();
46 44
					ArrayList children = new ArrayList();
47 45
					
48 46
					// FIXME: remove Text and SavedQuery from the corpora view
49 47
					// + sort and group the partitions and subcorpus 
50 48
					for (int i = 0; i < allChildren.size(); i++) {
51 49
						Object element = allChildren.get(i);
52
						if (
53
								//!TBXPreferences.getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES, TBXPreferences.PREFERENCES_NODE) && 
54
								!(element instanceof Text)
55
								&& !(element instanceof SavedQuery)
56
								&& !(element instanceof Corpus)
57
								&& !(element instanceof Partition)
58
								) {
59
							otherChildren.add(element);
60
						}
61
						else if(element instanceof Partition)	{
50
						// partitions
51
						if(element instanceof Partition)	{
62 52
							partitions.add(element);
63 53
						}
54
						// corpus
64 55
						else if(element instanceof Corpus)	{
65 56
							subcorporas.add(element);
66 57
						}
58
						// results
59
						else if (((TXMResult)element).isVisible()) {
60
							resultsChildren.add(element);
61
						}
62
						// hidden results
63
						else if(TBXPreferences.getBoolean(TBXPreferences.SHOW_ALL_RESULT_NODES, TBXPreferences.PREFERENCES_NODE))	{
64
							hiddentResultsChildren.add(element);
65
						}
66

  
67 67
					}
68 68
					
69 69
					Collections.sort(partitions);
......
71 71
					
72 72
					children.addAll(partitions);
73 73
					children.addAll(subcorporas);
74
					children.addAll(otherChildren);
74
					children.addAll(resultsChildren);
75
					children.addAll(hiddentResultsChildren);
75 76
					
76 77
					return children.toArray();
77 78
				}
tmp/org.txm.progression.core/src/org/txm/progression/core/preferences/ProgressionPreferences.java (revision 1019)
1 1
package org.txm.progression.core.preferences;
2 2

  
3 3

  
4
import org.eclipse.core.runtime.preferences.DefaultScope;
5
import org.osgi.framework.FrameworkUtil;
6 4
import org.osgi.service.prefs.Preferences;
7 5
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences;
8 6
import org.txm.core.preferences.TXMPreferences;
......
33 31
	/** The Constant CUMULATIVE. */
34 32
	public static final String CHART_CUMULATIVE = "cumulative_chart"; //$NON-NLS-1$
35 33
	
36
	
37
//	/**
38
//	 * 
39
//	 */
40
//	public ProgressionPreferences() {
41
//		super();
42
////		TXMPreferences.instances.put(this.getClass(), this);
43
//	}
44 34

  
45

  
35
	
36
	/**
37
	 * Gets the instance.
38
	 * @return
39
	 */
46 40
	public static TXMPreferences getInstance()	{
47 41
		if (!TXMPreferences.instances.containsKey(ProgressionPreferences.class)) {
48 42
			new ProgressionPreferences();
......
53 47
	
54 48
	@Override
55 49
	public void initializeDefaultPreferences() {
56
		Preferences preferences = DefaultScope.INSTANCE.getNode(this.preferencesNode);
50
		Preferences preferences = this.getDefaultPreferencesNode();
57 51
		preferences.putBoolean(CHART_CUMULATIVE, true);
58 52
		preferences.putBoolean(REPEAT_SAME_VALUES, false);
59 53
		preferences.putDouble(BANDE_MULTIPLIER, 1.0d);
60

  
61 54
		
62
		System.err.println("**************** ProgressionPreferences.initializeDefaultPreferences(): bande multiplier = " + ProgressionPreferences.getInstance().getDouble(BANDE_MULTIPLIER));
63

  
64
		
65 55
		// shared charts rendering preferences
66 56
		ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences);
67 57
	}
tmp/org.txm.progression.core/src/org/txm/progression/core/functions/Progression.java (revision 1019)
149 149
	 * @param parent
150 150
	 */
151 151
	public Progression(Corpus parent)	{
152
		this(null, parent);
152
		super(parent);
153 153
	}
154 154

  
155 155
	/**
......
157 157
	 * @param uuid
158 158
	 */
159 159
	public Progression(String uuid)	{
160
		this(uuid, null);
160
		super(uuid);
161 161
	}
162 162
	
163
	/**
164
	 * 
165
	 * @param uuid
166
	 * @param parent
167
	 */
168
	public Progression(String uuid, Corpus parent)	{
169
		super(uuid, parent);
170
	}
171 163
	
172 164
	@Override
173 165
	public boolean loadParameters() {
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 1019)
131 131
	//		this(corpus, name, queries, null);
132 132
	//	}
133 133

  
134
	public Partition(Corpus corpus) {
135
		super(corpus);
134
	/**
135
	 * 
136
	 * @param parent
137
	 */
138
	public Partition(Corpus parent)	{
139
		this(null, parent);
136 140
	}
137 141

  
138
	public Partition(String uuid) {
139
		super(uuid);
142
	/**
143
	 * 
144
	 * @param uuid
145
	 */
146
	public Partition(String uuid)	{
147
		this(uuid, null);
140 148
	}
149
	
141 150
	/**
151
	 * 
152
	 * @param uuid
153
	 * @param parent
154
	 */
155
	public Partition(String uuid, Corpus parent)	{
156
		super(uuid, parent);
157
		this.persistable = true;
158
		this.userPersistable = false;
159
	}
160
	
161
	/**
142 162
	 * Instantiates a new partition.
143 163
	 *
144 164
	 * @param corpus the corpus
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/CQPSearchEngine.java (revision 1019)
199 199
		// initialize pre-configured subcorpus and partition of corpus registered in the default.xml workspace file
200 200
		System.out.print(TXMCoreMessages.Toolbox_workspace_init);
201 201
		for (Base b : Toolbox.workspace.getProject("default").getBases()) {
202
			
203
			Log.info("Loading CQP corpora of " + b.getName() + " corpus...");
204
			
202 205
			if (!loadCQPCorpora(b, monitor)) {
203
				System.out.println("Failed to load CQP corpora of "+b.getName()+" corpus.");
206
				Log.severe("Failed to load CQP corpora of " + b.getName() + " corpus.");
204 207
			}
205 208
		}
206 209
		
......
215 218
			Element c = base.getBaseParameters().corpora.get(corpusname);
216 219
			try {
217 220
				MainCorpus corp = CorpusManager.getCorpusManager().getCorpus(corpusname);
218
				if (monitor != null) monitor.subTask("Loading "+corp+" subcorpora and partitions...");
221
				if (monitor != null) {
222
					monitor.subTask("Loading " + corp + " subcorpora and partitions of corpus " + corpusname + "...");
223
				}
219 224
				corp.setSelfElement(c);
220 225
				corp.setParent(base);
221 226
				corp.load(); // don't load corpus right now, wait for the search engine to be ready

Formats disponibles : Unified diff