Révision 3061

tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java (revision 3061)
70 70
	 */
71 71
	public static final String SHOW_EVAL_LOGS = "show_eval_logs"; //$NON-NLS-1$
72 72
	
73
	public static final String DEFAULT_REPOS = "default_repos";
73 74
	
75
	
74 76
	/**
75 77
	 * Gets the instance.
76 78
	 * 
......
165 167
			return;
166 168
		}
167 169
		
170
		preferences.put(DEFAULT_REPOS, "https://cloud.r-project.org");
168 171
		preferences.put(PATH_TO_EXECUTABLE, execFile.getAbsolutePath());
169 172
		preferences.putBoolean(IS_MANDATORY, false);
170 173
		preferences.put(SERVER_ADDRESS, "127.0.0.1");
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java (revision 3061)
1407 1407
				connection.eval("setwd(\"" + userdir.getAbsolutePath().replace("\\", "/") + "\")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
1408 1408
			}
1409 1409
			
1410
			// set the libraries directory to install new R packages
1410 1411
			File RLibrariesWorkspaceDirectory = new File(userdir, "libraries");
1411 1412
			RLibrariesWorkspaceDirectory.mkdir();
1412 1413
			if (!RLibrariesWorkspaceDirectory.exists()) {
......
1421 1422
				rPackagesPath = rPackagesPath.replace("\\", "/"); //$NON-NLS-1$ //$NON-NLS-2$
1422 1423
			}
1423 1424
			
1425
			// set the default R repository
1426
			String repos = RPreferences.getInstance().getString(RPreferences.DEFAULT_REPOS);
1427
			if (repos.length() > 0) {
1428
				Log.fine("Set the 'repos' R option to " + repos);
1429
				connection.eval("options(repos=\"" + repos + "\")");//$NON-NLS-1$ //$NON-NLS-2$
1430
			}
1431
			
1424 1432
			// set proxy configuration using detected system proxy if exists
1425 1433
			SystemProxyDetector conf = new SystemProxyDetector();
1426 1434
			this.initializeRWorkspaceConnectionConfiguration(conf);
tmp/org.txm.index.rcp/src/org/txm/index/rcp/handlers/SendIndexTo.java (revision 3061)
76 76
		Index index = (Index) result;
77 77
		CQPCorpus corpus = CQPCorpus.getFirstParentCorpus(index);
78 78
		
79
		
80 79
		// TODO enable subcorpus from index query when the hidden subcorpus deletion will be managed or another system implemented (eg new SubCorpus(TXMResult result)
81 80
		if (index.getQuery() instanceof CQLQuery && IndexPreferences.getInstance().getBoolean(IndexPreferences.LINK_USING_SUBCORPUS)) {
82 81
			CQLQuery cqlQuery = (CQLQuery) index.getQuery();
83 82
			if (cqlQuery == null || cqlQuery.isEmpty() || // no query
84
					cqlQuery.getQueryString().equals("[]")) { // don't bother creating a subcorpus use the parent corpus
83
					cqlQuery.getQueryString().equals("[]") ||
84
					cqlQuery.getQueryString().equals(".*")) { // don't bother creating a subcorpus use the parent corpus
85 85
				return corpus;
86 86
			}
87 87
			
tmp/org.txm.tokenizer.core/src/org/txm/tokenizer/TokenizerClasses.java (revision 3061)
30 30
import java.io.IOException;
31 31
import java.lang.reflect.Field;
32 32
import java.lang.reflect.Modifier;
33
import java.util.Locale;
33 34
import java.util.regex.Pattern;
34 35

  
35 36
import javax.xml.parsers.ParserConfigurationException;
......
48 49
 */
49 50
public class TokenizerClasses {
50 51
	
52
	public String lang;
53
	
54
	public TokenizerClasses(String lang) {
55
		if (lang != null) {
56
			this.lang = lang;
57
		}
58
		else {
59
			this.lang = Locale.getDefault().getCountry();
60
		}
61
		reset();
62
	}
63
	
64
	public TokenizerClasses() {
65
		this(Locale.getDefault().getCountry());
66
	}
67
	
68
	/**
69
	 * Helper
70
	 * 
71
	 * @param projectScope
72
	 * @return
73
	 */
74
	public static TokenizerClasses newTokenizerClasses(ProjectScope projectScope, String lang) {
75
		TokenizerClasses tc = new TokenizerClasses();
76
		tc.loadFromProject(projectScope);
77
		tc.lang = lang;
78
		return tc;
79
	}
80
	
51 81
	//// ROOTS ? ////
52
	public static boolean debug = false;
82
	public boolean debug = false;
53 83
	
54 84
	/** The tag_all. */
55
	public static String tag_all = null;
85
	public String tag_all = null;
56 86
	
57 87
	/** The Weblex enclitics. */
58
	public static String enclitics = null;
88
	public String enclitics = null;
59 89
	
60
	public static String encliticsFR = null;
90
	public String encliticsFR = null;
61 91
	
62 92
	/** The TT enclitics. */
63
	public static String FClitic_en = null;
93
	public String FClitic_en = null;
64 94
	
65
	public static String PClitic_fr = null;
95
	public String PClitic_fr = null;
66 96
	
67
	public static String FClitic_fr = null;
97
	public String FClitic_fr = null;
68 98
	
69
	public static String PClitic_it = null;
99
	public String PClitic_it = null;
70 100
	
71
	public static String FClitic_gl = null;
101
	public String FClitic_gl = null;
72 102
	
73 103
	/** The div_tags. */
74
	public static String div_tags = null;
104
	public String div_tags = null;
75 105
	
76 106
	/** The q_tags. */
77
	public static String q_tags = null;
107
	public String q_tags = null;
78 108
	
79 109
	/** The extraword_tags. */
80
	public static String extraword1_tags = null;
110
	public String extraword1_tags = null;
81 111
	
82 112
	/** The corr_tags_no_seg. */
83
	public static String corr_tags_no_seg = null;
113
	public String corr_tags_no_seg = null;
84 114
	
85 115
	/** The word_tags. */
86
	public static String word_tags = null;
116
	public String word_tags = null;
87 117
	
88 118
	/** the element to create when a word is created */
89
	public static String word_element_to_create = null;
119
	public String word_element_to_create = null;
90 120
	
91 121
	/** The intraword_tags. */
92
	public static String intraword_tags = null;
122
	public String intraword_tags = null;
93 123
	
94 124
	/** The punct_quotes. */
95
	public static String punct_quotes = null;
125
	public String punct_quotes = null;
96 126
	
97 127
	/** The punct_strong1. */
98
	public static String punct_strong1 = null;
128
	public String punct_strong1 = null;
99 129
	
100 130
	/** The punct_strong2. */
101
	public static String punct_strong2 = null;
131
	public String punct_strong2 = null;
102 132
	
103 133
	/** The punct_paren_open1. */
104
	public static String punct_paren_open1 = null;
134
	public String punct_paren_open1 = null;
105 135
	
106 136
	/** The punct_paren_open2. */
107
	public static String punct_paren_open2 = null;
137
	public String punct_paren_open2 = null;
108 138
	
109 139
	/** The punct_paren_close1. */
110
	public static String punct_paren_close1 = null;
140
	public String punct_paren_close1 = null;
111 141
	
112 142
	/** The punct_paren_close2. */
113
	public static String punct_paren_close2 = null;
143
	public String punct_paren_close2 = null;
114 144
	
115 145
	/** The punct_weak. */
116
	public static String punct_weak = null;
146
	public String punct_weak = null;
117 147
	
118
	public static String entity = null;
148
	public String entity = null;
119 149
	
120
	public static String seg_tags = null;
150
	public String seg_tags = null;
121 151
	
122 152
	//// COMBINAISONS ////
123 153
	
124 154
	/** The corr_tags. */
125
	public static String corr_tags = null;
155
	public String corr_tags = null;
126 156
	
127 157
	/** The extraword_tags. */
128
	public static String extraword_tags = null;
158
	public String extraword_tags = null;
129 159
	
130 160
	/** The punct_strong. */
131
	public static String punct_strong = null;
161
	public String punct_strong = null;
132 162
	
133 163
	/** The punct_paren_open. */
134
	public static String punct_paren_open = null;
164
	public String punct_paren_open = null;
135 165
	
136 166
	/** The punct_paren_close. */
137
	public static String punct_paren_close = null;
167
	public String punct_paren_close = null;
138 168
	
139 169
	/** The punct_paren. */
140
	public static String punct_paren = null;
170
	public String punct_paren = null;
141 171
	
142 172
	/** The punct_all. */
143
	public static String punct_all = null;
173
	public String punct_all = null;
144 174
	
145 175
	/** The word_chars. */
146
	public static String word_chars = null;
176
	public String word_chars = null;
147 177
	
148
	public static TTest[] tests = {
178
	public TTest[] tests = {
149 179
			// new TTest(/\A(.*-)(je|m[eo]i|tu|t[eo]i|lui|luy|ilz|ils?|no?u?s|vo?u?s|on|leurs|ce|ci|là|elles?)(.*)\Z/),
150 180
			// new TTest(/\A(.*)(-)()\Z/, "pon"),
151 181
			// new TTest(/\A(.*)(Bande dessinée|eau de vie|machine à écrire|Moyen Âge|petit pois|poule d'eau|Avoir l'air|se rendre compte|faire semblant|prendre froid|s'en aller|Comme il faut|bon
......
173 203
			// new TTest(/\A(.*)(\p{Ps}|\p{Pe}|\p{Pi}|\p{Pf}|\p{Po}|\p{S})(.*)\Z/, "pon")
174 204
	};
175 205
			
176
	public static String whitespaces = null;
206
	public String whitespaces = null;
177 207
	
178
	public static String regElision = null;
208
	public String regElision = null;
179 209
	
180
	public static String regPunct = null;
210
	public String regPunct = null;
181 211
	
182
	static {
183
		reset(); // Initialize static fields
184
	}
185
	
186 212
	// punct_strong1 = ".!?";
187 213
	// punct_strong2 = "\\.\\.|\\.\\.\\.|…|\\|";
188 214
	// punct_strong = "[$punct_strong1]|$punct_strong2";
......
197 223
	// punct_all = "$punct_strong|$punct_paren|[$punct_weak]";
198 224
	// word_chars = "[^ $punct_strong1$punct_paren_open1$punct_paren_close1$punct_weak]|&[^;]+;";
199 225
	
200
	public static void reset() {
226
	public void reset() {
201 227
		tag_all = "<[A-Za-z][^>]+>";
202 228
		
203 229
		div_tags = "TEI|text|front|body|div|div1|div2|div3|div4|div5|div6|back|head|trailer|p|ab|sp|speaker|list|notice|bibl|opener|dateline";
......
235 261
		recombine();
236 262
	}
237 263
	
238
	public static void recombine() {
264
	public void recombine() {
239 265
		corr_tags = "" + corr_tags_no_seg + "|" + seg_tags + "";
240 266
		extraword_tags = "" + div_tags + "|" + q_tags + "|" + extraword1_tags + "";
241 267
		punct_strong = "[" + punct_strong1 + "]|" + punct_strong2 + "";
......
254 280
	 * @return the java.lang. object
255 281
	 */
256 282
	@Deprecated
257
	public static void toDom(Document doc, Node parent) {
283
	public void toDom(Document doc, Node parent) {
258 284
		Element tokenizer = doc.createElement("tokenizer");
259 285
		tokenizer.setAttribute("onlyThoseTests", "false");
260 286
		parent.appendChild(tokenizer);
......
395 421
	/**
396 422
	 * Dump.
397 423
	 */
398
	public static void dump() {
424
	public void dump() {
399 425
		System.out.println("BRUT");
400 426
		System.out.println("tag_all = " + tag_all + "");
401 427
		System.out.println("enclitics = " + enclitics + "");
......
435 461
		}
436 462
	}
437 463
	
438
	public static boolean isValid() {
464
	public boolean isValid() {
439 465
		try {
440 466
			Pattern.compile(tag_all);
441 467
		}
......
699 725
	 * @return
700 726
	 */
701 727
	@Deprecated
702
	public static boolean loadFromNode(Element tokenizerElement) {
728
	public boolean loadFromNode(Element tokenizerElement) {
703 729
		// load params
704 730
		String tmp_strong_punct = null;
705 731
		NodeList params = tokenizerElement.getElementsByTagName("param");
......
811 837
		// System.out.println("OK? "+ TokenizerClasses.loadFromNode((Element) tokenizer));
812 838
	}
813 839
	
814
	public static boolean loadFromProject(ProjectScope projectScope) {
840
	public boolean loadFromProject(ProjectScope projectScope) {
815 841
		// load params
816 842
		IEclipsePreferences params = projectScope.getNode("Tokenizer");
817 843
		
tmp/org.txm.tokenizer.core/src/org/txm/tokenizer/SimpleStringTokenizer.groovy (revision 3061)
31 31
public class SimpleStringTokenizer implements StringTokenizer {
32 32
	
33 33
	/** The punct_strong. */
34
	String punct_strong = TokenizerClasses.punct_strong;
34
	String punct_strong;
35 35
	
36 36
	/** The punct_all. */
37
	String punct_all = TokenizerClasses.punct_all;
37
	String punct_all;
38 38
	
39 39
	/** The word_chars. */
40
	String word_chars = TokenizerClasses.word_chars;
40
	String word_chars;
41 41
	
42 42
	String fclitics = null; // default behavior don't manage clitics
43 43
	
......
66 66
	
67 67
	Pattern regSplitWhiteSpaces;
68 68
	
69
	TokenizerClasses tc;
70
	
69 71
	/**
70 72
	 * Instantiates a new simple string tokenizer.
71 73
	 *
72 74
	 * @param lang
73 75
	 */
74 76
	public SimpleStringTokenizer(String lang) {
75
		this.lang = lang;
77
		this(new TokenizerClasses(lang))
78
	}
79
	
80
	/**
81
	 * Instantiates a new simple string tokenizer.
82
	 *
83
	 * @param lang
84
	 */
85
	public SimpleStringTokenizer(TokenizerClasses tc) {
86
		this.tc = tc
87
		this.lang = tc.lang;
76 88
		if (lang != null)
77 89
			if (lang.startsWith("en")) {
78
				fclitics = TokenizerClasses.FClitic_en;
90
				fclitics = tc.FClitic_en;
79 91
			} else if (lang.startsWith("fr")) {
80
				fclitics = TokenizerClasses.FClitic_fr;
81
				pclitics = TokenizerClasses.PClitic_fr;
92
				fclitics = tc.FClitic_fr;
93
				pclitics = tc.PClitic_fr;
82 94
			} else if (lang.startsWith("gl")) {
83
				fclitics = TokenizerClasses.FClitic_gl;
95
				fclitics = tc.FClitic_gl;
84 96
			} else if (lang.startsWith("it")) {
85
				pclitics = TokenizerClasses.PClitic_it;
97
				pclitics = tc.PClitic_it;
86 98
			}
87 99
		
88
		punct_strong = TokenizerClasses.punct_strong;
89
		punct_all = TokenizerClasses.punct_all;
90
		word_chars = TokenizerClasses.word_chars;
100
		punct_strong = tc.punct_strong;
101
		punct_all = tc.punct_all;
102
		word_chars = tc.word_chars;
91 103
		
92
		String strRegElision = TokenizerClasses.regElision;
104
		String strRegElision = tc.regElision;
93 105
		if (strRegElision != null && strRegElision.length() > 0) {
94 106
			regElision = ~/^([\p{L}-]++${strRegElision}[\p{L}-]++)(.*)$/ // the test must start with the start of string  ^
95 107
		}
96 108
		reg3pts = ~/^(.*?)(\.\.\.)(.*)$/
97 109
		
98
		String strRegPunct = TokenizerClasses.regPunct;
110
		String strRegPunct = tc.regPunct;
99 111
		if (strRegPunct != null && strRegPunct.length() > 0) {
100 112
			regPunct = ~/^(.*?)($strRegPunct)(.*)$/
101 113
		}
......
105 117
		if (pclitics != null && pclitics.length() > 0)
106 118
			regPClitics = /^($pclitics)(.*)/ // the test must start with the start of string  ^
107 119
		
108
		if (TokenizerClasses.whitespaces != null && TokenizerClasses.whitespaces.length() > 0) {
109
			regWhitespaces = ~TokenizerClasses.whitespaces;
120
		if (tc.whitespaces != null && tc.whitespaces.length() > 0) {
121
			regWhitespaces = ~tc.whitespaces;
110 122
		}
111 123
		
112
		if (TokenizerClasses.whitespaces != null && TokenizerClasses.whitespaces.length() > 0) {
113
			regSplitWhiteSpaces = Pattern.compile(TokenizerClasses.whitespaces);
124
		if (tc.whitespaces != null && tc.whitespaces.length() > 0) {
125
			regSplitWhiteSpaces = Pattern.compile(tc.whitespaces);
114 126
		}
115 127
	}
116 128
	
......
160 172
	public String standardChecks(ArrayList<String> result, String s) {
161 173
		Matcher m;
162 174
		
163
		for (TTest test : TokenizerClasses.tests) {
175
		for (TTest test : tc.tests) {
164 176
			if ((m = s =~ test.regex)) {
165 177
				if (DEBUG) {println "test : "+test.regex}
166 178
				if (test.before > 0) {
tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/preferences/RPreferencePage.java (revision 3061)
42 42
import org.txm.statsengine.r.core.RWorkspace;
43 43
import org.txm.statsengine.r.core.preferences.RPreferences;
44 44
import org.txm.statsengine.r.rcp.messages.RUIMessages;
45

  
45 46
// TODO: Auto-generated Javadoc
46 47
/**
47 48
 * This class represents a preference page that is contributed to the
......
55 56
 */
56 57

  
57 58
public class RPreferencePage extends TXMPreferencePage {
58

  
59
	
59 60
	/** The r_path_to_executable. */
60 61
	private StringFieldEditor r_path_to_executable;
61 62
	
62 63
	/** The r_server_adress. */
63 64
	private StringFieldEditor r_server_adress;
65
	
64 66
	private IntegerFieldEditor r_port;
65 67
	
66 68
	/** The r_user. */
......
73 75
	private BooleanFieldEditor r_is_remote;
74 76
	
75 77
	private BooleanFieldEditor r_debug;
76

  
77 78
	
79
	
78 80
	/** The r_use_file_transfert. */
79 81
	private BooleanFieldEditor r_use_file_transfert;
80 82
	
81 83
	private StringFieldEditor r_svg_device;
82 84
	
83 85
	private StringFieldEditor r_rargs;
86
	
84 87
	private StringFieldEditor r_rserveargs;
85

  
86 88
	
89
	private StringFieldEditor r_repos;
87 90
	
91
	
92
	
88 93
	@Override
89 94
	public void init(IWorkbench workbench) {
90 95
		this.setPreferenceStore(new TXMPreferenceStore(RPreferences.getInstance().getPreferencesNodeQualifier()));
91
		//this.setTitle(RUIMessages.runRServeInDebugMode);
92
		//FIXME todo if needed
93
		//setDescription(Messages.RPreferencePage_1);
94
		//this.setImageDescriptor(SpecificitiesAdapterFactory.ICON);
96
		// this.setTitle(RUIMessages.runRServeInDebugMode);
97
		// FIXME todo if needed
98
		// setDescription(Messages.RPreferencePage_1);
99
		// this.setImageDescriptor(SpecificitiesAdapterFactory.ICON);
95 100
	}
96

  
97 101
	
98

  
99

  
102
	
103
	
104
	
100 105
	/**
101 106
	 * Creates the field editors. Field editors are abstractions of the common
102 107
	 * GUI blocks needed to manipulate various types of preferences. Each field
......
104 109
	 */
105 110
	@Override
106 111
	public void createFieldEditors() {
107

  
112
		
108 113
		r_debug = new BooleanFieldEditor(RPreferences.DEBUG, RUIMessages.runRServeInDebugMode, BooleanFieldEditor.DEFAULT, getFieldEditorParent());
109 114
		addField(r_debug);
110 115
		
111 116
		r_is_remote = new BooleanFieldEditor(RPreferences.REMOTE, RUIMessages.remoteConnection, BooleanFieldEditor.DEFAULT, getFieldEditorParent());
112 117
		addField(r_is_remote);
113

  
118
		
114 119
		r_path_to_executable = new FileFieldEditor(RPreferences.PATH_TO_EXECUTABLE, RUIMessages.pathToRBinary, getFieldEditorParent());
115 120
		addField(r_path_to_executable);
116 121
		
......
119 124
		
120 125
		r_rserveargs = new StringFieldEditor(RPreferences.RSERVEARGS, RUIMessages.rserveArgs, getFieldEditorParent());
121 126
		addField(r_rserveargs);
122
				
127
		
123 128
		r_use_file_transfert = new BooleanFieldEditor(RPreferences.FILE_TRANSFERT, RUIMessages.useFileBasedRDataTransfert, BooleanFieldEditor.DEFAULT,
124 129
				getFieldEditorParent());
125 130
		addField(r_use_file_transfert);
126

  
131
		
127 132
		r_server_adress = new StringFieldEditor(RPreferences.SERVER_ADDRESS, RUIMessages.serverAddress, getFieldEditorParent());
128 133
		addField(r_server_adress);
129 134
		
130 135
		r_port = new IntegerFieldEditor(RPreferences.PORT, RUIMessages.portDefaultIs6311, getFieldEditorParent());
131 136
		addField(r_port);
132

  
137
		
133 138
		r_user = new StringFieldEditor(RPreferences.USER, RUIMessages.user, getFieldEditorParent());
134 139
		addField(r_user);
135

  
140
		
136 141
		r_password = new StringFieldEditor(RPreferences.PASSWORD, RUIMessages.password, getFieldEditorParent());
137 142
		addField(r_password);
138 143
		
139
//		r_svg_device = new StringFieldEditor(R_SVG_DEVICE, Messages.RPreferencePage_5,
140
//				getFieldEditorParent());
141
//		addField(r_svg_device);
142

  
144
		// r_svg_device = new StringFieldEditor(R_SVG_DEVICE, Messages.RPreferencePage_5,
145
		// getFieldEditorParent());
146
		// addField(r_svg_device);
143 147
		
148
		
144 149
		changeFieldStates(RPreferences.getInstance().getBoolean(RPreferences.REMOTE));
145 150
		
146 151
		
147 152
		addField(new BooleanFieldEditor(RPreferences.SHOW_EVAL_LOGS, "Log the R eval command lines", getFieldEditorParent()));
148 153
		
154
		r_repos = new StringFieldEditor(RPreferences.DEFAULT_REPOS, "Defautl package repository", getFieldEditorParent());
155
		addField(r_repos);
156
		
149 157
	}
150 158
	
151 159
	
152 160
	/**
153 161
	 * Enable/disable the fields according to the remote mode activation.
162
	 * 
154 163
	 * @param serverIsRemote
155 164
	 */
156 165
	public void changeFieldStates(boolean serverIsRemote) {
......
163 172
			r_rargs.setEnabled(false, getFieldEditorParent());
164 173
			r_rserveargs.setEnabled(false, getFieldEditorParent());
165 174
			r_use_file_transfert.setEnabled(false, getFieldEditorParent());
166
		} else {
175
		}
176
		else {
167 177
			r_server_adress.setEnabled(false, getFieldEditorParent());
168 178
			r_user.setEnabled(false, getFieldEditorParent());
169 179
			r_password.setEnabled(false, getFieldEditorParent());
......
174 184
			r_use_file_transfert.setEnabled(true, getFieldEditorParent());
175 185
		}
176 186
	}
177

  
178
	/* (non-Javadoc)
187
	
188
	/*
189
	 * (non-Javadoc)
179 190
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#propertyChange(org.eclipse.jface.util.PropertyChangeEvent)
180 191
	 */
181 192
	@Override
......
184 195
			changeFieldStates((Boolean) event.getNewValue());
185 196
		}
186 197
	}
187

  
188
	/* (non-Javadoc)
198
	
199
	/*
200
	 * (non-Javadoc)
189 201
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
190 202
	 */
191 203
	@Override
192 204
	public boolean performOk() {
193 205
		try {
194 206
			super.performOk();
195
			//Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties());
207
			// Toolbox.updateProperties(ApplicationWorkbenchAdvisor.getProperties());
196 208
			
197 209
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
198
			if (rw != null)	{
210
			if (rw != null) {
199 211
				RWorkspace.setUseFileCommunication(RPreferences.getInstance().getBoolean(RPreferences.FILE_TRANSFERT));
200 212
				rw.setLog(RWorkspace.isLoggingEvalCommandLines());
201 213
			}
202
		} catch (Exception e) {
214
		}
215
		catch (Exception e) {
203 216
			System.err.println(NLS.bind(TXMUIMessages.failedToSavePreferencesColonP0, e));
204 217
		}
205 218
		return true;
206 219
	}
207
}
220
}
tmp/org.txm.internalview.rcp/src/org/txm/internalview/rcp/editors/InternalViewEditor.java (revision 3061)
125 125
		});
126 126
		
127 127
		// Word properties selector
128
		propertiesSelector = new PropertiesSelector<WordProperty>(parametersArea);
128
		propertiesSelector = new PropertiesSelector<>(parametersArea);
129 129
		propertiesSelector.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, true));
130 130
		propertiesSelector.setLayout(new GridLayout(3, false));
131 131
		try {
......
138 138
		propertiesSelector.addSelectionListener(computeSelectionListener);
139 139
		
140 140
		// Structural unit properties selector
141
		structuralUnitPropertiesSelector = new PropertiesSelector<StructuralUnitProperty>(parametersArea);
141
		structuralUnitPropertiesSelector = new PropertiesSelector<>(parametersArea);
142 142
		structuralUnitPropertiesSelector.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, true));
143 143
		structuralUnitPropertiesSelector.setLayout(new GridLayout(3, false));
144 144
		structuralUnitPropertiesSelector.setTitle(InternalViewUIMessages.structuralProperties);
......
188 188
				int nlines = internalView.getSegmentLength();
189 189
				List<WordProperty> props = internalView.getProperties();
190 190
				
191
				ArrayList<Object[]> lines = new ArrayList<Object[]>();
191
				ArrayList<Object[]> lines = new ArrayList<>();
192 192
				for (int i = 0; i < nlines; i++) {
193 193
					lines.add(new String[props.size()]);
194 194
				}
......
237 237
	}
238 238
	
239 239
	
240
	HashMap<Property, TableViewerColumn> columns = new HashMap<Property, TableViewerColumn>();
240
	HashMap<Property, TableViewerColumn> columns = new HashMap<>();
241 241
	
242
	HashMap<TableViewerColumn, Integer> columnsOrder = new HashMap<TableViewerColumn, Integer>();
242
	HashMap<TableViewerColumn, Integer> columnsOrder = new HashMap<>();
243 243
	
244 244
	private void initColumns() {
245 245
		
246 246
		for (TableViewerColumn col : columns.values()) {
247 247
			col.getColumn().dispose();
248 248
		}
249
		columnsOrder = new HashMap<TableViewerColumn, Integer>();
250
		columns = new HashMap<Property, TableViewerColumn>();
249
		columnsOrder = new HashMap<>();
250
		columns = new HashMap<>();
251 251
		
252 252
		if (internalView == null) {
253 253
			// System.out.println("REMOVE NON USED COLUMNS");
......
298 298
			else {
299 299
				query.append(col.getText() + "=\""); //$NON-NLS-1$
300 300
			}
301
			HashSet<String> values = new HashSet<String>();
301
			HashSet<String> values = new HashSet<>();
302 302
			for (int i = 0; i < indexes.length; i++) {
303 303
				int idx = indexes[i];
304 304
				values.add(CQLQuery.addBackSlash(items[idx].getText(icol)));
......
358 358
		navigation.setCurrentPosition(this.getResult().getCurrentPage());
359 359
		navigation.setMaxPosition(this.getResult().getSegmentsCount());
360 360
		
361
		navigation.setInfoLineText(" / " + this.getResult().getSegmentsCount()); //$NON-NLS-1$
362 361
		navigation.refresh();
363 362
		navigationPanel.layout();
364 363
	}
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginesManager.java (revision 3061)
10 10

  
11 11
/**
12 12
 * Search engines manager.
13
 * 
13 14
 * @author mdecorde
14 15
 *
15 16
 */
16
//FIXME: useless class, the type and priority/order should be defined in org.txm.core.engines.EnginesManager extension point
17
// FIXME: useless class, the type and priority/order should be defined in org.txm.core.engines.EnginesManager extension point
17 18
public class SearchEnginesManager extends EnginesManager<SearchEngine> {
18

  
19
	
20
	private static final long serialVersionUID = 8476457980915443357L;
21
	
19 22
	/**
20 23
	 * 
21 24
	 * @return
......
23 26
	public static SearchEngine getCQPSearchEngine() {
24 27
		return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine("CQP"); //$NON-NLS-1$
25 28
	}
26

  
29
	
27 30
	/**
28 31
	 * 
29 32
	 * @return
......
39 42
	public static SearchEngine getSearchEngine(String name) {
40 43
		return (SearchEngine) Toolbox.getEngineManager(EngineType.SEARCH).getEngine(name);
41 44
	}
42

  
45
	
43 46
	@Override
44 47
	public boolean fetchEngines() {
45 48
		return this.fetchEngines(SearchEngine.EXTENSION_POINT_ID);
46 49
	}
47

  
50
	
48 51
	@Override
49 52
	public EngineType getEnginesType() {
50 53
		return EngineType.SEARCH;
51 54
	}
52

  
55
	
53 56
	public static List<SearchEngine> getAvailableEngines(CorpusBuild corpus) {
54
		List<SearchEngine> availables = new ArrayList<SearchEngine>();
57
		List<SearchEngine> availables = new ArrayList<>();
55 58
		SearchEnginesManager em = (SearchEnginesManager) Toolbox.getEngineManager(EngineType.SEARCH);
56 59
		for (String name : em.getEngines().keySet()) {
57 60
			SearchEngine engine = em.getEngine(name);
tmp/org.txm.searchengine.core/src/org/txm/searchengine/core/SearchEnginePreferences.java (revision 3061)
1
package org.txm.searchengine.core;
2

  
3
import org.osgi.service.prefs.Preferences;
4
import org.txm.core.preferences.TXMPreferences;
5

  
6

  
7
public class SearchEnginePreferences extends TXMPreferences {
8
	
9
	/**
10
	 * contains the last bundle version setting the TreeTagger models directory
11
	 */
12
	public static final String DEFAULT_SEARCH_ENGINE = "default_search_engine"; //$NON-NLS-1$
13
	
14
	/**
15
	 * if set, the available search engines are shown in TXM interfaces
16
	 */
17
	public static final String SHOW_SEARCH_ENGINES = "show_search_engines"; //$NON-NLS-1$
18
	
19
	/**
20
	 * Gets the instance.
21
	 * 
22
	 * @return the instance
23
	 */
24
	public static TXMPreferences getInstance() {
25
		if (!TXMPreferences.instances.containsKey(SearchEnginePreferences.class)) {
26
			new SearchEnginePreferences();
27
		}
28
		return TXMPreferences.instances.get(SearchEnginePreferences.class);
29
	}
30
	
31
	@Override
32
	public void initializeDefaultPreferences() {
33
		super.initializeDefaultPreferences();
34
		
35
		// Default preferences if no org.txm.udpipe.core fragment is found
36
		Preferences preferences = this.getDefaultPreferencesNode();
37
		
38
		preferences.put(DEFAULT_SEARCH_ENGINE, "CQP");
39
		preferences.putBoolean(SHOW_SEARCH_ENGINES, false);
40
	}
41
}
0 42

  
tmp/org.txm.searchengine.core/plugin.xml (revision 3061)
10 10
            name="org.txm.searchengine.core.SearchEngines">
11 11
      </EngineManager>
12 12
   </extension>
13
   <extension
14
         point="org.eclipse.core.runtime.preferences">
15
      <initializer
16
            class="org.txm.searchengine.core.SearchEnginePreferences">
17
      </initializer>
18
   </extension>
13 19

  
14 20
</plugin>
tmp/org.txm.libs.cqp/src/org/txm/libs/cqp/CQPLibPreferences.java (revision 3061)
59 59
		// FIXME: SJ: some code in this method should be done only at TXM first run
60 60
		// Extra note: and be better to use P2.inf and install/uninstall Touchpoints
61 61
		
62
		
63 62
		Preferences preferences = this.getDefaultPreferencesNode();
64 63
		
65
		
66
		
67 64
		String CQPFRAGMENT = "org.txm.libs.cqp." + System.getProperty("osgi.os");
68 65
		// TODO: fix preferences logic between org.txm.cqp.lib and org.txm.searchengine.cqp
69 66
		Log.fine("CQPLibPreferences.initializeDefaultPreferences()");
70 67
		String saved = getString(CQPLibPreferences.VERSION);
71 68
		Version currentVersion = BundleUtils.getBundleVersion(CQPFRAGMENT); // the CQPFRAGMENT plugin contains the right version
72 69
		
73
		
74 70
		String os = "win";
75 71
		String ext = "";
76 72
		String osname = System.getProperty("os.name").toLowerCase();
tmp/org.txm.rcp.feature/feature.xml (revision 3061)
268 268
         install-size="0"
269 269
         version="0.0.0"/>
270 270

  
271
   <plugin
272
         id="org.txm.searchengine.rcp"
273
         download-size="0"
274
         install-size="0"
275
         version="0.0.0"
276
         unpack="false"/>
277

  
271 278
</feature>
tmp/org.txm.core/src/java/org/txm/scripts/importer/ReadImportParameters.groovy (revision 3061)
31 31
	String description;
32 32
	
33 33
	boolean debug;
34

  
35
	public ReadImportParameters()
36
	{
37

  
34
	
35
	public ReadImportParameters() {
38 36
	}
39

  
40
	public boolean read(File infile)
41
	{
37
	
38
	public boolean read(File infile) {
42 39
		try {
43 40
			def url = infile.toURI().toURL();
44 41
			def inputData = url.openStream();
......
53 50
		}catch (IOException ex) {
54 51
			System.out.println("IOException while parsing ");
55 52
		}
56
		
57 53
	}
58

  
59
	public boolean read(def parser)
60
	{
54
	
55
	public boolean read(def parser) {
61 56
		boolean startAlignInfos = false;
62 57
		boolean startEditions = false;
63 58
		boolean startMetadatas = false;
......
65 60
		boolean startSAttributes = false;
66 61
		boolean startTokenizer = false;
67 62
		
68
		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
69
		{
63
		for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {
70 64
			switch (event) {
71

  
65
				
72 66
				case XMLStreamConstants.END_ELEMENT:
73 67
					String localname = parser.getLocalName();
74
					if(localname == "linkGrp")
75
					{
68
					if(localname == "linkGrp") {
76 69
						startAlignInfos = false;
77 70
					}
78
					else if(localname == "metadatas")
79
					{
71
					else if(localname == "metadatas") {
80 72
						startMetadatas = false;
81 73
					}
82
					else if(localname == "editions")
83
					{
74
					else if(localname == "editions") {
84 75
						startEditions = false;
85 76
					}
86
					else if(localname == "pattributes")
87
					{
77
					else if(localname == "pattributes") {
88 78
						startPAttributes = false;
89 79
					}
90
					else if(localname == "sattributes")
91
					{
80
					else if(localname == "sattributes") {
92 81
						startSAttributes = false;
93 82
					}
94
					else if(localname == "tokenizer")
95
					{
83
					else if(localname == "tokenizer") {
96 84
						startSAttributes = false;
97 85
					}
98 86
					break;
99

  
87
				
100 88
				case XMLStreamConstants.START_ELEMENT:
101 89
					String localname = parser.getLocalName();
102
					if (localname == "import")
103
					{
90
					if (localname == "import") {
104 91
						basename = parser.getAttributeValue(null, "name");
105 92
						encoding = parser.getAttributeValue(null, "encoding");
106 93
						language = parser.getAttributeValue(null, "lang");
......
112 99
						
113 100
						boolean debug;
114 101
					}
115
					else if(localname == "editions")
116
					{
102
					else if(localname == "editions") {
117 103
						startEditions = true;
118 104
					}
119
					else if(localname == "edition")
120
					{
105
					else if(localname == "edition") {
121 106
						String corpus = parser.getAttributeValue(null, "corpus")
122 107
						if(!editions.containsKey(corpus))
123 108
							editions.put(corpus, []);
......
133 118
						startMetadatas = true;
134 119
					}
135 120
					else if (localname == "metadata" && startMetadatas) {
136
						metadatas.put(parser.getAttributeValue(null, "id"), 
137
							["id":parser.getAttributeValue(null, "id"),
138
							"shortname":parser.getAttributeValue(null, "shortname"),
139
							"longname":parser.getAttributeValue(null, "longname"),
140
							"type":parser.getAttributeValue(null, "type"),
141
							"selection":parser.getAttributeValue(null, "selection"),
142
							"partition":parser.getAttributeValue(null, "partition"),
143
							"display":parser.getAttributeValue(null, "display"),])
121
						metadatas.put(parser.getAttributeValue(null, "id"),
122
								["id":parser.getAttributeValue(null, "id"),
123
									"shortname":parser.getAttributeValue(null, "shortname"),
124
									"longname":parser.getAttributeValue(null, "longname"),
125
									"type":parser.getAttributeValue(null, "type"),
126
									"selection":parser.getAttributeValue(null, "selection"),
127
									"partition":parser.getAttributeValue(null, "partition"),
128
									"display":parser.getAttributeValue(null, "display"),])
144 129
					}
145 130
					else if (localname == "pattributes") {
146 131
						startPAttributes = true;
147 132
					} else if(localname == "pattribute" && startPAttributes) {
148
						pattributes.put(parser.getAttributeValue(null, "id"), 
149
							["id":parser.getAttributeValue(null, "id"),
150
							"shortname":parser.getAttributeValue(null, "shortname"),
151
							"longname":parser.getAttributeValue(null, "longname"),
152
							"type":parser.getAttributeValue(null, "type"),
153
							"renderer":parser.getAttributeValue(null, "renderer"),
154
							"tooltip":parser.getAttributeValue(null, "tooltip"),
155
							"display":parser.getAttributeValue(null, "display"),
156
							"min":parser.getAttributeValue(null, "min"),
157
							"max":parser.getAttributeValue(null, "max"),
158
							"inputFormat":parser.getAttributeValue(null, "inputFormat"),
159
							"outputFormat":parser.getAttributeValue(null, "outputFormat"),
160
							"position":parser.getAttributeValue(null, "position"),
161
							"sortBy":parser.getAttributeValue(null, "sortBy")])
133
						pattributes.put(parser.getAttributeValue(null, "id"),
134
								["id":parser.getAttributeValue(null, "id"),
135
									"shortname":parser.getAttributeValue(null, "shortname"),
136
									"longname":parser.getAttributeValue(null, "longname"),
137
									"type":parser.getAttributeValue(null, "type"),
138
									"renderer":parser.getAttributeValue(null, "renderer"),
139
									"tooltip":parser.getAttributeValue(null, "tooltip"),
140
									"display":parser.getAttributeValue(null, "display"),
141
									"min":parser.getAttributeValue(null, "min"),
142
									"max":parser.getAttributeValue(null, "max"),
143
									"inputFormat":parser.getAttributeValue(null, "inputFormat"),
144
									"outputFormat":parser.getAttributeValue(null, "outputFormat"),
145
									"position":parser.getAttributeValue(null, "position"),
146
									"sortBy":parser.getAttributeValue(null, "sortBy")])
162 147
					}
163 148
					else if (localname == "sattributes") {
164 149
						startSAttributes = true;
165 150
					}
166 151
					else if (localname == "sattribute" && startSAttributes) {
167
						sattributes.put(parser.getAttributeValue(null, "id"), 
168
							["id":parser.getAttributeValue(null, "id"),
169
							"shortname":parser.getAttributeValue(null, "shortname"),
170
							"longname":parser.getAttributeValue(null, "longname"),
171
							"type":parser.getAttributeValue(null, "type"),
172
							"renderer":parser.getAttributeValue(null, "renderer"),
173
							"tooltip":parser.getAttributeValue(null, "tooltip"),
174
							"pattern":parser.getAttributeValue(null, "renderer"),
175
							"import":parser.getAttributeValue(null, "import"),
176
							"min":parser.getAttributeValue(null, "min"),
177
							"max":parser.getAttributeValue(null, "max"),
178
							"mandatory":parser.getAttributeValue(null, "mandatory"),
179
							"order":parser.getAttributeValue(null, "order"),
180
							"inputFormat":parser.getAttributeValue(null, "inputFormat"),
181
							"outputFormat":parser.getAttributeValue(null, "outputFormat"),])
152
						sattributes.put(parser.getAttributeValue(null, "id"),
153
								["id":parser.getAttributeValue(null, "id"),
154
									"shortname":parser.getAttributeValue(null, "shortname"),
155
									"longname":parser.getAttributeValue(null, "longname"),
156
									"type":parser.getAttributeValue(null, "type"),
157
									"renderer":parser.getAttributeValue(null, "renderer"),
158
									"tooltip":parser.getAttributeValue(null, "tooltip"),
159
									"pattern":parser.getAttributeValue(null, "renderer"),
160
									"import":parser.getAttributeValue(null, "import"),
161
									"min":parser.getAttributeValue(null, "min"),
162
									"max":parser.getAttributeValue(null, "max"),
163
									"mandatory":parser.getAttributeValue(null, "mandatory"),
164
									"order":parser.getAttributeValue(null, "order"),
165
									"inputFormat":parser.getAttributeValue(null, "inputFormat"),
166
									"outputFormat":parser.getAttributeValue(null, "outputFormat"),])
182 167
					} else if (localname == "link" && startAlignInfos) {
183 168
						String target = parser.getAttributeValue(null, "target");
184 169
						String struct = parser.getAttributeValue(null, "alignElement");
......
191 176
								i--
192 177
							}
193 178
						}
194

  
179
						
195 180
						if (level == null)
196 181
							level = "1";
197

  
182
						
198 183
						if (corpora.size() == 0) {
199 184
							println "no corpus aligned: "+parser.getLocation()
200 185
							return false;
......
214 199
			}
215 200
		}
216 201
	}
217

  
218
	public Set<String> getAlignements()
219
	{
202
	
203
	public Set<String> getAlignements() {
220 204
		return links.keySet();
221 205
	}
222

  
223
	public ArrayList<String> getTargets(String alignement)
224
	{
206
	
207
	public ArrayList<String> getTargets(String alignement) {
225 208
		return links.get(alignement);
226 209
	}
227

  
228
	public String getStructure(String alignement)
229
	{
210
	
211
	public String getStructure(String alignement) {
230 212
		return structs.get(alignement);
231 213
	}
232

  
233
	public int getLevel(String alignement)
234
	{
214
	
215
	public int getLevel(String alignement) {
235 216
		return levels.get(alignement);
236 217
	}
237

  
238
	public void dump()
239
	{
218
	
219
	public void dump() {
240 220
		println "LINKS"
241
		for(String link : links.keySet())
242
		{
221
		for(String link : links.keySet()) {
243 222
			println link
244 223
			println " corpus: "+links.get(link)
245 224
			println " struct: "+structs.get(link)
......
268 247
		println " description $description"
269 248
		println "DEBUG: $debug"
270 249
	}
271

  
272
	public static void main(String[] args)
273
	{
250
	
251
	public static void main(String[] args) {
274 252
		String userhome = System.getProperty("user.home");
275 253
		File alignfile = new File(userhome, "xml/xmltxmpara/align.xml")
276 254
		ReadImportParameters parameters = new ReadImportParameters();
tmp/org.txm.core/src/java/org/txm/core/engines/EnginesManager.java (revision 3061)
19 19
 * @author sjacquot
20 20
 *
21 21
 */
22
public abstract class EnginesManager<T extends Engine> extends HashMap<String, T>{
23

  
22
public abstract class EnginesManager<T extends Engine> extends HashMap<String, T> {
23
	
24 24
	private static final long serialVersionUID = 9186978207738860351L;
25

  
25
	
26 26
	public static final String ENGINES_MANAGER_EXTENSION_POINT_ID = EnginesManager.class.getName();
27

  
27
	
28 28
	/**
29 29
	 * Current engine.
30 30
	 */
31 31
	protected T currentEngine = null;
32

  
33 32
	
34 33
	
34
	
35 35
	/**
36 36
	 * Finds out the engines that matches this manager engines extension point.
37 37
	 * 
38 38
	 * @return
39 39
	 */
40 40
	public abstract boolean fetchEngines();
41

  
41
	
42 42
	/**
43 43
	 * Creates and initializes the engines from contributions with the specified extension point id.
44 44
	 * 
......
46 46
	 * @return true if at least one engine has been created otherwise false
47 47
	 */
48 48
	protected boolean fetchEngines(String engineExtensionPointId) {
49

  
49
		
50 50
		IConfigurationElement[] contributions = RegistryFactory.getRegistry().getConfigurationElementsFor(engineExtensionPointId);
51

  
51
		
52 52
		Log.finest(TXMCoreMessages.bind("Looking for {0} engines contributions with extension point id {1}...", this.getEnginesDescription(), engineExtensionPointId)); //$NON-NLS-1$
53 53
		Log.finest(TXMCoreMessages.bind("{0} engine(s) found.", contributions.length)); //$NON-NLS-1$
54

  
54
		
55 55
		for (int i = 0; i < contributions.length; i++) {
56 56
			try {
57 57
				@SuppressWarnings("unchecked")
58 58
				T engine = (T) contributions[i].createExecutableExtension("class"); //$NON-NLS-1$
59

  
59
				
60 60
				Log.fine(TXMCoreMessages.bind("Initializing engine: {0}...", engine));
61

  
61
				
62 62
				if (engine.initialize()) {
63 63
					this.put(engine.getName(), engine);
64
				} else {
64
				}
65
				else {
65 66
					Log.severe("Failed to initialize " + engine.getName() + " engine.");
66 67
				}
67
			} catch (Exception e) {
68
			}
69
			catch (Exception e) {
68 70
				Log.severe("Error: failed to instantiate " + contributions[i].getName() + ".");
69 71
				e.printStackTrace();
70 72
			}
71 73
		}
72

  
74
		
73 75
		return this.size() > 0;
74 76
	}
75

  
77
	
76 78
	/**
77 79
	 * Starts the engines.
78 80
	 * 
......
81 83
	 */
82 84
	public boolean startEngines(IProgressMonitor monitor) {
83 85
		for (Engine engine : this.values()) {
84

  
86
			
85 87
			String log = "Starting " + this.getEnginesDescription() + " engine: " + engine.getName() + "...";
86 88
			Log.fine(log);
87

  
89
			
88 90
			if (monitor != null) {
89 91
				monitor.subTask(log);
90 92
			}
91

  
93
			
92 94
			try {
93 95
				engine.start(monitor);
94
			} catch (Exception e) {
96
			}
97
			catch (Exception e) {
95 98
				Log.severe("Error: failed to start engine " + engine.getName() + ".");
96 99
				e.printStackTrace();
97 100
			}
98 101
		}
99

  
102
		
100 103
		if (this.currentEngine == null && this.size() > 0) {
101 104
			this.setCurrentEngine((T) this.values().toArray()[0]);
102 105
		}
103 106
		return true;
104 107
	}
105

  
108
	
109
	@Override
106 110
	public String toString() {
107
		return getEnginesType()+": "+super.toString();
111
		return getEnginesType() + ": " + super.toString();
108 112
	}
109 113
	
110 114
	/**
......
115 119
		if (currentEngine == null) {
116 120
			return false;
117 121
		}
118

  
122
		
119 123
		return currentEngine.isRunning();
120 124
	}
121

  
125
	
122 126
	/**
123 127
	 * Stops the engines.
124 128
	 * 
......
126 130
	 */
127 131
	public boolean stopEngines() {
128 132
		for (Engine engine : this.values()) {
129

  
133
			
130 134
			Log.fine("Stopping " + this.getEnginesDescription() + " engine: " + engine.getName() + "..."); //$NON-NLS-1$
131

  
135
			
132 136
			try {
133 137
				engine.stop();
134
			} catch (Exception e) {
138
			}
139
			catch (Exception e) {
135 140
				Log.severe("Error: failed to stop engine " + engine.getName() + ".");
136 141
				e.printStackTrace();
137 142
			}
138 143
		}
139 144
		return true;
140 145
	}
141

  
146
	
142 147
	/**
143 148
	 * Restarts the engines.
144 149
	 * 
......
158 163
					Log.fine("Starting " + this.getEnginesDescription() + " engine: " + engine.getName() + "..."); //$NON-NLS-1$
159 164
					engine.start(new LogMonitor());
160 165
				}
161
			} catch (Exception e) {
166
			}
167
			catch (Exception e) {
162 168
				Log.severe("Error: failed to stop engine " + engine.getName() + ".");
163 169
				e.printStackTrace();
164 170
			}
165 171
		}
166 172
		return true;
167 173
	}
168

  
174
	
169 175
	/**
170 176
	 * Gets the engine type that this manager supports.
171 177
	 * 
172 178
	 * @return the engine type that this manager supports
173 179
	 */
174 180
	public abstract EngineType getEnginesType();
175

  
176 181
	
177 182
	
183
	
178 184
	/**
179 185
	 * Gets the engine description that this manager supports.
180 186
	 * 
......
183 189
	public String getEnginesDescription() {
184 190
		return this.getEnginesType().getDescription();
185 191
	}
186

  
192
	
187 193
	/**
188 194
	 * Gets the available engines.
189 195
	 * 
......
192 198
	public HashMap<String, T> getEngines() {
193 199
		return this;
194 200
	}
195

  
201
	
196 202
	/**
197 203
	 * Gets an engine specified by its name.
198 204
	 * 
......
211 217
	public T getCurrentEngine() {
212 218
		return this.currentEngine;
213 219
	}
214

  
220
	
215 221
	/**
216 222
	 * Sets the current engine.
217 223
	 * 
......
221 227
		Log.finest("Setting current " + this.getEnginesDescription() + " engine to " + engine + ".");
222 228
		this.currentEngine = engine;
223 229
	}
224

  
230
	
225 231
	/**
226 232
	 * Sets the current engine specified by its name.
227 233
	 * 
......
230 236
	public void setCurrentEngine(String name) {
231 237
		this.setCurrentEngine(this.getEngine(name));
232 238
	}
233

  
239
	
234 240
	/**
235 241
	 * Gets an installed engine according to its class type.
236 242
	 * 
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 3061)
117 117
	public static final String QUERY = "query"; //$NON-NLS-1$
118 118
	
119 119
	/**
120
	 * Result index.
121
	 */
122
	public static final String INDEX = "index"; //$NON-NLS-1$
123
	
124
	/**
125
	 * Result sub index.
126
	 */
127
	public static final String SUB_INDEX = "sub_index"; //$NON-NLS-1$
128
	
129
	/**
120 130
	 * Structural unit.
121 131
	 */
122 132
	public static final String STRUCTURAL_UNIT = "structural_unit"; //$NON-NLS-1$
tmp/org.txm.core/src/java/org/txm/objects/Match.java (revision 3061)
3 3
import java.util.ArrayList;
4 4
import java.util.List;
5 5

  
6
/**
7
 * Abstraction of a match. A Match is defined by its start-end positions.
8
 * 
9
 * It may have a target position to focus a position
10
 * 
11
 * TODO manage multiple target positions
12
 * TODO manage multiple labeled target positions
13
 * TODO store match index (hard to update the match indices ?)
14
 * TODO store sub match index (hard to update the submatch indices ?)
15
 * 
16
 * @author mdecorde
17
 *
18
 */
6 19
public abstract class Match implements Comparable<Match> {
20
	
7 21
	public abstract int getStart();
22
	
8 23
	public abstract int getEnd();
24
	
9 25
	public abstract int getTarget();
10 26
	
11 27
	public boolean contains(Match m) {
12 28
		return (this.getStart() <= m.getStart() && m.getEnd() <= this.getEnd());
13 29
	}
14 30
	
15
	/* (non-Javadoc)
31
	/*
32
	 * (non-Javadoc)
16 33
	 * @see java.lang.Comparable#compareTo(java.lang.Object)
17 34
	 */
18 35
	@Override
19 36
	public int compareTo(Match m) {
20

  
37
		
21 38
		if (m == null)
22 39
			return -1;
23 40
		if (this.getStart() < m.getStart())
......
28 45
			return -1;
29 46
		else
30 47
			return 1;
31

  
32 48
	}
33

  
34
	/* (non-Javadoc)
49
	
50
	/*
51
	 * (non-Javadoc)
35 52
	 * @see java.lang.Object#toString()
36 53
	 */
37 54
	@Override
......
49 66
	}
50 67
	
51 68
	public List<Integer> getRange() {
52
		List<Integer> ret = new ArrayList<Integer>(size());
53
		for (int i = getStart() ; i <= getEnd(); i++) ret.add(i);
69
		List<Integer> ret = new ArrayList<>(size());
70
		for (int i = getStart(); i <= getEnd(); i++)
71
			ret.add(i);
54 72
		return ret;
55 73
	}
56

  
74
	
57 75
	public abstract void setEnd(int p);
58

  
76
	
59 77
	public abstract void setStart(int p);
60 78
	
61 79
	public abstract void setTarget(int p);
62 80
	
63 81
	/**
64 82
	 * intersect sorted list of Matches
83
	 * 
65 84
	 * @param list1
66 85
	 * @param sublist2
67 86
	 * @param strict_inclusion if true the match must be exactly included
......
71 90
		ArrayList<Match> result = new ArrayList<>();
72 91
		int i1 = 0;
73 92
		int i2 = 0;
74
		for (; i2 < sublist2.size() && i1 < list1.size(); ) {
93
		for (; i2 < sublist2.size() && i1 < list1.size();) {
75 94
			Match m = list1.get(i1);
76 95
			Match subm = sublist2.get(i2);
77 96
			if (m.getEnd() < subm.getStart()) {
78 97
				i1++;
79
			} else if (subm.getEnd() < m.getStart()) {
98
			}
99
			else if (subm.getEnd() < m.getStart()) {
80 100
				i2++;
81
			} else {
101
			}
102
			else {
82 103
				if (strict_inclusion) {
83 104
					if (m.getStart() <= subm.getStart() && subm.getEnd() <= m.getEnd()) {
84 105
						result.add(subm);
85 106
					}
86
				} else {
107
				}
108
				else {
87 109
					result.add(subm);
88 110
				}
89

  
111
				
90 112
				i2++;
91 113
			}
92 114
		}
... Ce différentiel a été tronqué car il excède la taille maximale pouvant être affichée.

Formats disponibles : Unified diff