Révision 1043

tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 1043)
124 124
			//this.persistable = false; // FIXME: remove that later
125 125
			String p = this.getStringParameterValue(TBXPreferences.UNIT_PROPERTY);
126 126
			if (p != null && p.length() > 0) {
127
				this.pProperty = getParent().getProperty(p);
127
				Corpus parent = getParent();
128
				if (parent != null) {
129
					this.pProperty = parent.getProperty(p);
130
				} else {
131
					return false;
132
				}
128 133
			}
129 134
		}
130 135
		catch (CqiClientException e) {
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitiesSelection.java (revision 1043)
4 4
package org.txm.specificities.core.functions;
5 5

  
6 6
import java.io.File;
7
import java.util.ArrayList;
8 7
import java.util.Arrays;
9
import java.util.HashSet;
10 8
import java.util.List;
11 9

  
12 10
import org.apache.commons.lang.StringUtils;
13 11
import org.txm.chartsengine.core.results.ChartResult;
14 12
import org.txm.core.results.Parameter;
15 13
import org.txm.core.results.TXMParameters;
16
import org.txm.core.results.TXMResult;
17 14
import org.txm.specificities.core.messages.SpecificitiesCoreMessages;
18 15
import org.txm.specificities.core.preferences.SpecificitiesPreferences;
19 16
import org.txm.statsengine.core.StatException;
20 17

  
21 18
/**
22 19
 * A selection from a Specificities result dedicated to export or chart creation.
20
 * 
23 21
 * @author sjacquot
24
 *
22
 * 
25 23
 */
26 24
public class SpecificitiesSelection extends ChartResult {
27 25

  
......
50 48
	protected Boolean pGroupByLines;
51 49

  
52 50
	/**
53
	 * The selected specificities indices to focus on.
54
	 */
55
	protected double[][] selectedSpecificitiesIndex;
56

  
57

  
58

  
59
	/**
60 51
	 * The selected type names to focus on.
61 52
	 */
62 53
	@Parameter(key=SpecificitiesPreferences.VALUES, type=Parameter.RENDERING)
63 54
	protected List<String> pSelectedTypeNames;
55
	
56
	/**
57
	 * The selected specificities indices to focus on.
58
	 */
59
	protected double[][] selectedSpecificitiesIndex;
64 60

  
65 61
	/**
66 62
	 * Creates an empty SpecificitiesSelection.
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1043)
220 220
				retrievedParent.addChild(this);
221 221
			}
222 222
			else	{
223
				Log.severe("No parent found in workspace for puuid="+puuid);
223
				Log.severe("Warning: no parent was found in workspace for uuid="+uniqueID+" and puuid="+puuid);
224
				TBXPreferences.delete(this);
224 225
			}
225 226
		}
226 227

  
......
964 965

  
965 966
			this.clean();
966 967

  
967
			this.parent.removeResult(this);
968
			if (this.parent != null) {
969
				this.parent.removeResult(this);
970
			}
968 971
			this.parent = null;
969 972
			return true;
970
		} catch (NullPointerException e) {
971
			// does nothing
972 973
		} catch (Exception e) {
973 974
			e.printStackTrace();
974 975
		}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 1043)
401 401
	@Override
402 402
	public boolean delete() {
403 403
		try {
404
			this.getParent().dropPartition(this);
405
			super.delete();
406
			if (this.getSelfElement() != null) {
404
			this.getParent().dropPartition(this); // CQP Part
405
			
406
			super.delete(); // new preference based scheme
407
			
408
			if (this.getSelfElement() != null) { // old corpus import.xml data scheme
407 409
				this.getSelfElement().getParentNode().removeChild(getSelfElement());
408 410
			}
409 411
			return true;
410 412
		} catch (CqiClientException e) {
411
			// TODO Auto-generated catch block
412 413
			org.txm.utils.logger.Log.printStackTrace(e);
413 414
		}
414 415
		return false;
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/ReferencePattern.java (revision 1043)
125 125
		this.properties = properties;
126 126
	}
127 127

  
128

  
129 128
	/**
130 129
	 * Adds the property.
131 130
	 *
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java (revision 1043)
355 355

  
356 356
		if (isRServerOk) {
357 357
			Log.finest("RSERVE_ACTIVATED"); //$NON-NLS-1$
358
			System.out.println(RCoreMessages.info_connected); 
358
			//System.out.println(RCoreMessages.info_connected); 
359 359
			RserveProcess = StartRserve.rProcess;
360 360
		}
361 361
		return isRServerOk;
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java (revision 1043)
165 165
		int attempts = 10;
166 166
		while (attempts > 0) {
167 167
			try {
168
				System.out.print("."); //$NON-NLS-1$
168
				//System.out.print("."); //$NON-NLS-1$
169
				Log.info(".");
169 170
				RConnection c = new RConnection("127.0.0.1", port); //$NON-NLS-1$
170 171
				c.close();
171 172
				return true;
......
177 178

  
178 179
			attempts--;
179 180
		}
180
		System.out.println(""); //$NON-NLS-1$
181
		Log.info("R connection attemps done.");
181 182
		return false;
182 183
	}
183 184

  
tmp/org.txm.rcp/src/main/java/org/txm/rcp/ApplicationWorkbenchAdvisor.java (revision 1043)
280 280
						System.out.println("TXM initialization has been canceled by user. Please restart TXM.");
281 281
					}
282 282

  
283
					if (Toolbox.isInitialized()) {
284
						StatusLine.setMessage(TXMUIMessages.ApplicationWorkbenchAdvisor_ready);
285
						System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_ready);
286
					} else {
287
						StatusLine.setMessage(TXMUIMessages.ApplicationWorkbenchAdvisor_init_failed);
288
						System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_init_failed);
289
					}
290

  
291 283
					JobsTimer.stopAndPrint();
292 284
					return Status.OK_STATUS;
293 285
				}
......
1069 1061
									monitor.worked(1);
1070 1062
									monitor.setTaskName("Initializing Toolbox (engines and corpora)...");
1071 1063
									// init with Eclipse preference stores
1064
									
1072 1065
									if (Toolbox.initialize(TBXPreferences.class, monitor)) {
1066
										StatusLine.setMessage(TXMUIMessages.ApplicationWorkbenchAdvisor_ready);
1073 1067
										System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_ready);
1074 1068
									} else {
1075
										System.err.println(TXMUIMessages.ApplicationWorkbenchAdvisor_init_failed);
1069
										StatusLine.setMessage(TXMUIMessages.ApplicationWorkbenchAdvisor_init_failed);
1070
										System.out.println(TXMUIMessages.ApplicationWorkbenchAdvisor_init_failed);
1071
										
1076 1072
										monitor.done();
1077 1073
										return;
1078 1074
									}
1075

  
1079 1076
									monitor.setTaskName("Calling start script...");
1080 1077
									callStartScript();
1081 1078
								} catch (Exception e) {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java (revision 1043)
104 104
	public static synchronized boolean askContinueToDelete(final IStructuredSelection selection) {
105 105
		continueToDelete = true;
106 106
		
107
		boolean dontShowAlert = !TXMPreferences.getBoolean(RCPPreferences.USER_ALERT_DELETE, RCPPreferences.PREFERENCES_NODE);
107
		boolean showAlert = !TXMPreferences.getBoolean(RCPPreferences.USER_ALERT_DELETE, RCPPreferences.PREFERENCES_NODE);
108 108
		
109
		if (dontShowAlert) {
109
		if (showAlert) {
110 110
			Display.getDefault().syncExec(new Runnable() {
111 111
				@Override
112 112
				public void run() {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/SetTXMResultPersistentState.java (revision 1043)
82 82

  
83 83
	@Override
84 84
	public void updateElement(UIElement element, Map parameters) {
85
		Object object = this.getCorporaViewSelectedObject(null);
86
		if(object instanceof TXMResult)	{
87
			element.setChecked(((TXMResult)object).isUserPersistable());
88
		}
85
//		System.out.println("E="+element+" params="+parameters);
86
//		System.out.println("");
87
		//FIXME the method is called during RCP startup -> but the corpora view has no selection
88
//		Object object = this.getCorporaViewSelectedObject(null);
89
//		if(object instanceof TXMResult)	{
90
//			element.setChecked(((TXMResult)object).isUserPersistable());
91
//		}
89 92
	}
90 93
	
91 94
}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/BaseAbstractHandler.java (revision 1043)
78 78
		return true;
79 79
	}
80 80
	
81
	public Object getCorporaViewSelectedObject()	{
82
		return getCorporaViewSelectedObject(null);
83
	}
84
	
85 81
	/**
86 82
	 * Gets the current selected object.
87 83
	 * @param event the ExecutionEvent that provoke the command call.
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/corpora/CorporaView.java (revision 1043)
360 360
				if (arg0.keyCode == SWT.DEL) {
361 361
					final ISelection sel = treeViewer.getSelection();
362 362
					if (sel instanceof IStructuredSelection) {
363
						
363 364
						if (!DeleteObject.askContinueToDelete((IStructuredSelection)sel)) return;
365
						
364 366
						JobHandler job = new JobHandler("Deleting", true) {
365 367

  
366 368
							@Override
tmp/org.txm.cql2lsa.rcp/src/org/txm/functions/cql2lsa/ContextSubcorpus.java (revision 1043)
22 22
import org.txm.searchengine.cqp.serverException.CqiServerError;
23 23

  
24 24
public class ContextSubcorpus extends TXMResult {
25
	
25

  
26 26
	protected ArrayList<QueryResult> results = new ArrayList<QueryResult>();
27 27
	protected HashMap<String, String> keywordQueriestoName = new HashMap<String, String>();
28
	
28

  
29 29
	protected Corpus corpus;
30 30
	protected File keywordsFile;
31 31
	protected  int contextSize;
32
	
32

  
33 33
	public ContextSubcorpus(Corpus corpus, File keywordsFile, int contextSize) {
34 34
		super(corpus);
35 35
		this.corpus = corpus;
......
45 45

  
46 46
	@Override
47 47
	public void clean() {
48
		
48

  
49 49
	}
50 50

  
51 51
	@Override
......
63 63
			String name = keywordsFile.getName();
64 64
			int idx = name.indexOf(".");
65 65
			if (idx > 0) name = name.substring(0, idx);
66
			
66

  
67 67
			Subcorpus sub = corpus.createSubcorpus(name+"_contexts", results.get(0));
68 68
			return sub;
69 69
		}
......
72 72

  
73 73
	@Override
74 74
	public boolean compute(IProgressMonitor monitor) throws IOException, CqiClientException, CqiServerError, InvalidCqpIdException {
75
if (!(CQPSearchEngine.getCqiClient() instanceof MemCqiClient));
76 75
		
76
		if (!(CQPSearchEngine.getCqiClient() instanceof MemCqiClient));
77

  
77 78
		MemCqiClient CQI = (MemCqiClient) CQPSearchEngine.getCqiClient();
78
		
79

  
79 80
		BufferedReader keywordFileReader = new BufferedReader(new InputStreamReader(
80 81
				new FileInputStream(keywordsFile), "UTF-8")); //$NON-NLS-1$
81 82
		ArrayList<String> keywordLines = new ArrayList<String>();
......
88 89
		System.out.println("Number of keywords lines: "+keywordLines.size());
89 90
		System.out.println("context left and right size is: "+contextSize);
90 91
		monitor.beginTask("Querying keywords...", keywordLines.size());
91
		
92

  
92 93
		int nkeyword = 0;
93 94
		for (String line : keywordLines) {
94 95
			String[] split = line.split("=", 2); //$NON-NLS-1$
......
96 97
				Query q = new Query(split[1]+" expand to "+contextSize);
97 98
				keywordQueriestoName.put(split[1], split[0]);
98 99
				results.add(corpus.query(q, "K"+nkeyword++, false));
99
				
100

  
100 101
			}
101 102
		}
102 103
		keywordFileReader.close();
103
		
104

  
104 105
		// Loop over QueryResult to Merge them into one subcorpus
105 106
		int n = 0;
106 107
		monitor.beginTask("Creating subcorpus...", results.size());
107 108
		while(results.size() > 1) {
108
			
109

  
109 110
			QueryResult q1 = results.get(0);
110 111
			QueryResult q2 = results.get(1);
111 112
			//System.out.println("Mergin... "+q1+" "+q2);
112 113
			//System.out.println("match sizes "+q1.getNMatch()+" "+q2.getNMatch());
113
			
114

  
114 115
			String merge_name = "Merge"+(n++);
115 116
			CQI.query(merge_name+"= union "+q1.getQualifiedCqpId()+" "+q2.getQualifiedCqpId()+";");
116 117
			results.remove(0);
......
118 119
			results.add(new QueryResult(merge_name, merge_name, corpus, null));
119 120
			monitor.worked(1);
120 121
		}
121
		
122

  
122 123
		System.out.println("Done.");
123 124
		return true;
124 125
	}
......
169 170
		// TODO Auto-generated method stub
170 171
		return false;
171 172
	}
172
	
173

  
173 174
	@Override
174 175
	public String getResultype() {
175 176
		// TODO

Formats disponibles : Unified diff