Révision 1760

tmp/org.txm.statsengine.r.rcp/src/org/txm/statsengine/r/rcp/preferences/RPreferencePage.java (revision 1760)
185 185
		}
186 186
	}
187 187

  
188

  
189

  
190 188
	/* (non-Javadoc)
191 189
	 * @see org.eclipse.jface.preference.FieldEditorPreferencePage#performOk()
192 190
	 */
......
199 197
			RWorkspace rw = RWorkspace.getRWorkspaceInstance();
200 198
			if (rw != null)	{
201 199
				RWorkspace.setUseFileCommunication(RPreferences.getInstance().getBoolean(RPreferences.FILE_TRANSFERT));
200
				rw.setLog(RWorkspace.isLoggingEvalCommandLines());
202 201
			}
203 202
		} catch (Exception e) {
204 203
			System.err.println(NLS.bind(TXMUIMessages.failedToSavePreferencesColonP0, e));
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/RWorkspace.java (revision 1760)
185 185
			Log.fine(RCoreMessages.bind(RCoreMessages.info_connectingToRAt, host, port));
186 186
			connection = new RConnection(host, port);
187 187
			connection.setStringEncoding("utf8"); // mandatory !
188

  
189 188
			return isConnected();
190 189
		} catch (RserveException x) {
191 190
			throw new RWorkspaceException(x);
......
290 289
	}
291 290

  
292 291
	/**
293
	 * Default initialisation of RWorkspace with defautl parameters :
292
	 * Default initialisation of RWorkspace with default parameters :
294 293
	 * address = 127.0.0.1
295 294
	 * port = 6311
296 295
	 * debug = false.
297 296
	 *
298
	 * @param pathToRExecutalbe the path to r executalbe
297
	 * @param pathToRExecutalbe the path to r executable
299 298
	 * @throws RWorkspaceException the r workspace exception
300 299
	 */
301 300
	public static final void initializeRWorkspace(String pathToRExecutalbe)
302 301
			throws RWorkspaceException {
303
		workspace = new RWorkspace(pathToRExecutalbe, "127.0.0.1", 6311, false); //$NON-NLS-1$
302
		initializeRWorkspace(pathToRExecutalbe, "127.0.0.1", 6311); //$NON-NLS-1$
304 303
	}
305 304

  
306 305
	/**
307 306
	 * Initialize r workspace.
308 307
	 * debug = false
309 308
	 *
310
	 * @param pathToRExecutalbe the path to r executalbe
309
	 * @param pathToRExecutalbe the path to r executable
311 310
	 * @param host the host
312 311
	 * @param port the port
313 312
	 * @throws RWorkspaceException the r workspace exception
314 313
	 */
315 314
	public static final void initializeRWorkspace(String pathToRExecutalbe,
316 315
			String host, int port) throws RWorkspaceException {
317
		workspace = new RWorkspace(pathToRExecutalbe, host, port, false);
316
		workspace = new RWorkspace(pathToRExecutalbe, host, port, isDebugMode());
318 317
	}
319 318

  
320 319
	// --------------------------------------
......
582 581
	 */
583 582
	public RWorkspace(File userDir) throws RWorkspaceException {
584 583
		this.userdir = userDir;
584
		setLog(isLoggingEvalCommandLines());
585 585
	}
586 586

  
587 587
	// --------------------------------------
......
1178 1178
		} catch (Exception e) {
1179 1179
			throw new RException(exp + "; " + e.getMessage(), e); //$NON-NLS-1$
1180 1180
		}
1181
//		if(this.isLoggingEvalCommandLines())	{
1182
			//Log.finest("EVALUATED_EXPRESSION" + exp ); //$NON-NLS-1$
1183
	//	}
1181

  
1184 1182
		return res;
1185 1183
	}
1186 1184

  
......
1515 1513
		expr = "try({" + expr + "}, silent=TRUE)";
1516 1514
		
1517 1515
		if(this.isLoggingEvalCommandLines())	{
1518
			// normal code
1519
			//Log.finest("RWorkspace.safeEval(): " + expr); //$NON-NLS-1$
1520
			// FIXME: SJ: for debugging purpose
1521
			Log.finest("RWorkspace.safeEval(): " + expr, 8); //$NON-NLS-1$
1516
			//TODO Log.finest("R safeEval: " + expr, 8); //$NON-NLS-1$
1517
			Log.finest("R safeEval: " + expr); //$NON-NLS-1$
1522 1518
		}
1523 1519
		
1524 1520
		REXP r = null;
......
1539 1535

  
1540 1536
	
1541 1537
	/**
1542
	 * Checks if the eval command lines must be logged.
1538
	 * Checks if the eval command lines preference is set
1543 1539
	 * @return
1544 1540
	 */
1545
	public boolean isLoggingEvalCommandLines()	{
1541
	public static boolean isLoggingEvalCommandLines()	{
1546 1542
		return RPreferences.getInstance().getBoolean(RPreferences.SHOW_EVAL_LOGS); 
1547 1543
	}
1548 1544
	
1549 1545
	/**
1546
	 * Checks if the debug mode preference is set.
1547
	 * @return
1548
	 */
1549
	public static boolean isDebugMode()	{
1550
		return RPreferences.getInstance().getBoolean(RPreferences.DEBUG); 
1551
	}
1552
	
1553
	/**
1550 1554
	 * Sets the log.
1551 1555
	 *
1552 1556
	 * @param start the new log
......
1608 1612

  
1609 1613
		String out = null;
1610 1614
		try {
1615
			if(this.isLoggingEvalCommandLines())	{
1616
				Log.finest("R userEval: " + exp ); //$NON-NLS-1$
1617
			}
1611 1618
			//out = connection.eval("paste(capture.output(print(" + trybegin + trybegin +"("+ exp+")" + tryend + tryend + ")),collapse=\"\\n\")").asString(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
1612 1619
			//String cmd = "paste(capture.output(print(" + trybegin + "("+ exp+")" + tryend + ")),collapse=\"\\n\")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
1613
			Log.fine("R eval: "+exp);
1614 1620
			REXP ret = connection.eval(exp); 
1615 1621
			//REXP ret = connection.eval(exp);
1616 1622

  
......
1645 1651
			System.out.println("REXPMismatchException: "+e);
1646 1652
			Log.printStackTrace(e);
1647 1653
		}
1648
		if(this.isLoggingEvalCommandLines())	{
1649
			Log.finest("EVALUATED_EXPRESSION: " + exp ); //$NON-NLS-1$
1650
		}
1654
		
1651 1655
		return out;
1652 1656
	}
1653 1657

  
......
1670 1674
		} catch (Exception e) {
1671 1675
			org.txm.utils.logger.Log.printStackTrace(e);
1672 1676
		}
1673

  
1674
		if(this.isLoggingEvalCommandLines())	{
1675
			Log.finest("EVALUATED_EXPRESSION: " + exp ); //$NON-NLS-1$
1676
		}
1677 1677
	}
1678 1678
	
1679 1679
	
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/preferences/RPreferences.java (revision 1760)
67 67
	 */
68 68
	public static final String SHOW_EVAL_LOGS = "show_eval_logs"; //$NON-NLS-1$
69 69
	
70

  
71
	
70 72
	/**
71 73
	 * 
72 74
	 */
......
96 98
		preferences.put(RSERVEARGS, "");
97 99
		preferences.putBoolean(FILE_TRANSFERT, false);
98 100
		preferences.put(SVG_DEVICE, "svg");
99
		preferences.putBoolean(SHOW_EVAL_LOGS, true);
101
		preferences.putBoolean(SHOW_EVAL_LOGS, false);
100 102
		
101
		
102 103
		String RFRAGMENT = "org.txm.statsengine.r.core."+System.getProperty("osgi.os"); //$NON-NLS-1$
103 104
		
104 105
		Log.fine("RPreferences.initializeDefaultPreferences()");
......
187 188
		put(RSERVEARGS, ""); //$NON-NLS-1$
188 189
		put(FILE_TRANSFERT, false);
189 190
		put(SVG_DEVICE, "svg"); //$NON-NLS-1$
190
		put(SHOW_EVAL_LOGS, true);
191
		put(SHOW_EVAL_LOGS, false);
191 192
		
192 193
		Log.fine(TXMCoreMessages.bind("R stats engine preferences set with: {0} and {1}.", OSDir.getAbsolutePath(), execFile.getAbsolutePath())); //$NON-NLS-1$
193 194
	}
tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java (revision 1760)
144 144
			rProcess = runtime.exec(cmdline);
145 145
			
146 146
			//Log.info(Messages.StartRserve_0+Arrays.toString(cmdline));
147
			StreamHog errStream = new StreamHog(rProcess.getErrorStream(), debug);
148
			StreamHog inStream = new StreamHog(rProcess.getInputStream(), debug);
147
			StreamHog errStream = new StreamHog(rProcess.getErrorStream(), RWorkspace.isLoggingEvalCommandLines());
148
			StreamHog inStream = new StreamHog(rProcess.getInputStream(), RWorkspace.isLoggingEvalCommandLines());
149 149
			RWorkspace.getRWorkspaceInstance().registerLogger(errStream, inStream);
150 150

  
151 151
			//if (!debug && !isWindows) Rserveprocess.waitFor();

Formats disponibles : Unified diff