Révision 1986

tmp/org.txm.core/src/java/org/txm/objects/Edition.java (revision 1986)
86 86
		this.setVisible(false);
87 87
		this.internalPersistable = true;
88 88
	}
89

  
89
	
90 90
	/**
91 91
	 * Gets the text.
92 92
	 *
tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 1986)
28 28
package org.txm.objects;
29 29

  
30 30
import java.io.File;
31
import java.io.FileOutputStream;
32
import java.io.IOException;
33
import java.io.OutputStreamWriter;
34
import java.lang.reflect.Constructor;
35
import java.util.ArrayList;
36
import java.util.Arrays;
37 31
import java.util.List;
38 32

  
39
import org.eclipse.core.resources.IFile;
40
import org.eclipse.core.resources.IFolder;
41 33
import org.eclipse.core.resources.IProject;
42 34
import org.eclipse.core.resources.IProjectDescription;
43 35
import org.eclipse.core.resources.IWorkspace;
44 36
import org.eclipse.core.resources.IWorkspaceRoot;
45 37
import org.eclipse.core.resources.ResourcesPlugin;
46 38
import org.eclipse.core.runtime.CoreException;
47
import org.eclipse.core.runtime.IConfigurationElement;
48
import org.eclipse.core.runtime.IPath;
49 39
import org.eclipse.core.runtime.Path;
50
import org.eclipse.core.runtime.Platform;
51 40
import org.eclipse.osgi.util.NLS;
52
import org.osgi.framework.Bundle;
53
import org.txm.PostTXMHOMEInstallationStep;
54 41
import org.txm.Toolbox;
55 42
import org.txm.core.messages.TXMCoreMessages;
56
import org.txm.core.preferences.TBXPreferences;
57
import org.txm.core.preferences.TXMPreferences;
58
import org.txm.core.results.Parameter;
59 43
import org.txm.core.results.TXMParameters;
60 44
import org.txm.core.results.TXMResult;
61
import org.txm.utils.DeleteDir;
62 45
import org.txm.utils.LogMonitor;
63
import org.txm.utils.io.FileCopy;
64 46
import org.txm.utils.logger.Log;
65
import org.txm.utils.xml.DomUtils;
66
import org.w3c.dom.Document;
67 47
import org.w3c.dom.Element;
68
import org.w3c.dom.NodeList;
69 48

  
70 49
/**
71 50
 * The Class Workspace: manages the TXM corpora in the $TXMHOME/corpora directory
......
258 237

  
259 238
			// load the project from the project .settings directory
260 239
			IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace();
261
			
240

  
262 241
			//rcpWorkspace.getRoot().refreshLocal(1, new LogMonitor());
263
			
242

  
264 243
			IProjectDescription description = rcpWorkspace.loadProjectDescription(new Path(binCorpusDir.getAbsolutePath()+"/.project"));
265 244
			description.setLocation(new Path(binCorpusDir.getAbsolutePath()));
266 245
			IProject rcpProject = rcpWorkspace.getRoot().getProject(description.getName());
267
			
246

  
268 247
			if (!rcpProject.exists()) {
269 248
				rcpProject.create(description, new LogMonitor());
270 249
			}
......
436 415
			}
437 416
		}
438 417

  
439
		for (TXMResult corpus : this.getDeepChildren(CorpusBuild.class)) {
440
			CorpusBuild cb = (CorpusBuild)corpus;
441
			if (!cb.compute(false)) {
442
				System.out.println("Deleting duplicated corpus: "+cb+" of "+cb.getProject());
443
				cb.delete();
418
		// force the initialization of CorpusBuilds
419
		for (TXMResult project : this.getChildren(Project.class)) {
420
			for (TXMResult corpus : project.getChildren(CorpusBuild.class)) {
421
				CorpusBuild cb = (CorpusBuild)corpus;
422
				if (!cb.compute(false)) {
423
					System.out.println("Deleting duplicated corpus: "+cb+" of "+cb.getProject());
424
					cb.delete();
425
				}
444 426
			}
445 427
		}
446 428
	}
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1986)
386 386

  
387 387
		//TXMPreferences.dump();
388 388

  
389
		HashMap<String, TXMResult> loaded = new HashMap<String, TXMResult>();
389 390
		ArrayList<String> errors = new ArrayList<String>();
390 391
		for (String resultNodePath : resultNodePaths) {
391 392

  
392 393
			try {
393 394
				Preferences node = TXMPreferences.preferencesRootNode.node(resultNodePath);
394 395

  
395

  
396 396
				String className = node.get("class", ""); //$NON-NLS-1$ //$NON-NLS-2$
397 397

  
398 398
				// Skip Project object
......
413 413
				Log.fine("\nProject.loadResults(): loading from result node qualifier " + resultNodePath);
414 414
				//Log.finest("Toolbox.initialize(): class = " + TXMPreferences.getString("class", nodeQualifier));
415 415
				//TXMPreferences.dump();
416
				TXMResult result = TXMResult.getResult(this, resultNodePath);
417
				if (result != null) { // result already restored
418
					continue;
419
				}
416
				
417
//				//TODO see if necessary to prevent errors
418
//				TXMResult result2 = TXMResult.getResult(this, resultNodePath);
419
//				if (result2 != null) { // result already restored
420
//					continue;
421
//				}
420 422
				Log.fine("Project.loadResults(): class = " + className); //$NON-NLS-1$
421 423
				//					Log.finest("Toolbox.initialize(): parent_uuid = " + TXMPreferences.getString(TXMPreferences.PARENT_UUID, nodeQualifier));
422 424
				Log.fine("Project.loadResults(): parent_uuid = " + node.get(TXMPreferences.PARENT_PARAMETERS_NODE_PATH, "")); //$NON-NLS-1$
......
435 437
				}
436 438

  
437 439
				Class<?> cl = bundle.loadClass(className);
438
				Constructor<?> cons = cl.getConstructor(String.class);
439
				result = (TXMResult) cons.newInstance(resultNodePath);
440

  
440
				
441
//				TXMResult parent = loaded.get(node.get(TXMPreferences.PARENT_PARAMETERS_NODE_PATH, null));
442
//				TXMResult result = null;
443
//				if (parent == null) {
444
					Constructor<?> cons = cl.getConstructor(String.class);
445
					TXMResult result = (TXMResult) cons.newInstance(resultNodePath);
446
//				} else {
447
//					Constructor<?> cons = cl.getConstructor(String.class, TXMResult.class);
448
//					result = (TXMResult) cons.newInstance(resultNodePath, parent);
449
//				}
450
				loaded.put(resultNodePath, result);
441 451
				// not an internal persistence (eg. corpus or partition)
442 452
				if (!result.isInternalPersistable())	{
443 453
					result.setUserPersistable(true);	

Formats disponibles : Unified diff