Révision 1180

tmp/org.txm.core/src/java/org/txm/importer/xtz/ImportModule.java (revision 1180)
7 7
import java.util.Collections;
8 8
import java.util.logging.Level;
9 9

  
10
import org.eclipse.core.resources.IResource;
11
import org.eclipse.core.runtime.CoreException;
12
import org.eclipse.core.runtime.IPath;
10 13
import org.eclipse.core.runtime.IProgressMonitor;
11 14
import org.txm.Toolbox;
12 15
import org.txm.objects.Project;
16
import org.txm.stat.utils.LogMonitor;
13 17
import org.txm.utils.DeleteDir;
14 18
import org.txm.utils.logger.Log;
15 19
import org.txm.utils.xml.DomUtils;
......
78 82
			
79 83
		if (!updateCorpus) { // clean directories only if it's a new import	
80 84
			File txmDir = new File(binaryDirectory, "txm");
81
			DeleteDir.deleteDirectory(binaryDirectory);
85
			//DeleteDir.deleteDirectory(binaryDirectory);
86
			try {
87
				IPath path = p.getRCPProject().getFullPath();
88
				for (IResource r : p.getRCPProject().members()) {
89
					if (r.isHidden()) continue;
90
					r.delete(true, new LogMonitor("XTZ delete project content"));
91
				}
92
//				p.getRCPProject().getFolder("txm").delete(true, );
93
//				p.getRCPProject().getFolder("data").delete(true, new LogMonitor("XTZ delete project content"));
94
//				p.getRCPProject().getFolder("HTML").delete(true, new LogMonitor("XTZ delete project content"));
95
				
96
			} catch (CoreException e) {
97
				// TODO Auto-generated catch block
98
				e.printStackTrace();
99
			}
82 100
			txmDir.mkdirs();
83 101
		}
84 102
	}
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1180)
247 247
				retrievedParent.addChild(this);
248 248
			}
249 249
			else {
250
				Log.severe("Warning: no parent was found in workspace for uuid=" + uniqueID + " and puuid=" + parentUUID + " preferences=" + this.dumpParameters());
250
				Log.severe("Warning: no parent was found in project for path=" + parametersNodePath + " and puuid=" + parentUUID + " preferences=" + this.dumpParameters());
251 251
				// FIXME: commented for now
252 252
				//TBXPreferences.delete(this);
253 253
				return;
tmp/org.txm.core/src/java/org/txm/objects/Project.java (revision 1180)
89 89
	@Parameter(key=TBXPreferences.CLEAN)
90 90
	private boolean pCleanAfterBuild;
91 91

  
92

  
93
	
94 92
	/**
95
	 * Name.
96
	 */
97
	@Parameter(key=TBXPreferences.NAME)
98
	String pName;
99

  
100
	/**
101 93
	 * Name of import module.
102 94
	 */
103 95
	@Parameter(key=TBXPreferences.IMPORT_MODULE_NAME)
......
188 180

  
189 181
		this.needToBuild = needToBuild;
190 182
		this.internalPersistable = true;
191
		this.pName = name;
183
		this.userName = name;
192 184
		this.dirty = false;
193 185
		this.hasBeenComputedOnce = true;
194 186
		this.setVisible(false);
......
199 191
		this.autoSaveParametersFromAnnotations();
200 192
		this.saveParameters();
201 193
		TXMPreferences.flush(this);
202

  
203 194
	}
204 195

  
205 196
	/**
......
236 227
		//		setSelfElement(params.root);
237 228
		//		this.project = project;
238 229
		//		//load();
239
		//		this.pName = params.name;
240
		//		if (!pName.equals(pName.toUpperCase())) {
241
		//			System.out.println("Warning in Base.init: binary corpus name contains lower case letters: "+this.pName);
230
		//		this.userName = params.name;
231
		//		if (!userName.equals(userName.toUpperCase())) {
232
		//			System.out.println("Warning in Base.init: binary corpus name contains lower case letters: "+this.userName);
242 233
		//		}
243 234
		//		
244 235
		//		this.scope = new BasePreferenceScope(this);
......
250 241

  
251 242
	@Override
252 243
	public boolean canCompute() throws Exception {
253
		if(pName == null)	{
244
		if(userName == null)	{
254 245
			Log.severe("Project.canCompute(): can not compute with missing name.");
255 246
			return false;
256 247
		}
......
261 252
		}
262 253
		return true;
263 254
	}
255
	
256
	/**
257
	 * flag the project to be rebuild with the Import module
258
	 */
259
	public void setNeedToBuild() {
260
		needToBuild = true;
261
	}
264 262

  
265 263

  
266 264
	@Override
......
275 273
			//			// convert to new preferences persistence
276 274
			//		}
277 275
	
278
			if (!rcpProject.getName().equals(pName)) { // project directory and project name must stay in sync
276
			if (!rcpProject.getName().equals(userName)) { // project directory and project name must stay in sync
279 277
				IPath destination = new Path(this.getName());
280 278
				if (destination.toFile().exists()) {
281 279
					System.out.println("Error: could not rename project since one already existing with the same new name="+this.getName());
......
474 472
	 */
475 473
	public boolean _load(BaseOldParameters params) throws Exception {
476 474
		params.load();
477
		pName = userName = params.name;
475
		userName = params.name;
478 476
		File dir = new File(this.getWorkspace().getLocation(), userName);
479 477
		File paramFile = new File(dir, "import.xml");
480 478
		if (!paramFile.exists()) return false;
......
762 760
	 */
763 761
	public File getProjectDirectory() {
764 762
		if (this.rcpProject == null || this.rcpProject.getLocation() == null) {
765
			return new File(Toolbox.workspace.getLocation(), this.pName);
763
			return new File(Toolbox.workspace.getLocation(), this.userName);
766 764
		}
767 765
		return this.rcpProject.getLocation().toFile();
768 766
	}
......
867 865

  
868 866
	@Override
869 867
	public String getName() {
870
		return pName;
868
		return userName;
871 869
	}
872 870

  
873 871
	@Override
874 872
	public String getSimpleName() {
875
		return pName;
873
		return userName;
876 874
	}
877 875

  
878 876
	@Override
879 877
	public String getDetails() {
880
		return pName;
878
		return userName;
881 879
	}
882 880

  
883 881
	@Override
......
894 892
	}
895 893

  
896 894
	public void setName(String name) {
897
		this.pName = name;
895
		this.userName = name;
898 896
	}
899 897

  
900 898

  
tmp/org.txm.core/src/java/org/txm/objects/Text.java (revision 1180)
51 51
	/** The XML-TXM file. */
52 52
	@Parameter(key=TBXPreferences.XMLTXM)
53 53
	File pTXMFile;
54
	@Parameter(key=TBXPreferences.NAME)
55
	String pName;
56 54
	
57 55
	/**
58 56
	 * Instantiates a new text.
......
102 100
			ed.setIndex(pdf);
103 101
		} catch (Exception e2) {	} 
104 102
		
105
		userName = pName = e.getAttribute("name"); //$NON-NLS-1$
103
		userName = e.getAttribute("name"); //$NON-NLS-1$
106 104
		
107 105
		Element editionsnode = (Element) e.getElementsByTagName("editions").item(0); //$NON-NLS-1$
108 106
		NodeList editionList = editionsnode.getElementsByTagName("edition"); //$NON-NLS-1$
......
233 231

  
234 232
	@Override
235 233
	public boolean setParameters(TXMParameters parameters) throws Exception {
236
		this.pName = parameters.getString(TBXPreferences.NAME);
237 234
		String path = parameters.getString(TBXPreferences.SOURCE);
238 235
		if (path != null & path.length() > 0) {
239 236
			this.pSource = new File(path);
......
246 243
	}
247 244
	
248 245
	public void setName(String name) {
249
		this.pName = name;
246
		this.userName = name;
250 247
	}
251 248
	
252 249
	public void setSourceFile(File src) {
......
260 257

  
261 258
	@Override
262 259
	public String getName() {
263
		return pName;
260
		return userName;
264 261
	}
265 262

  
266 263
	@Override
267 264
	public String getSimpleName() {
268
		return pName;
265
		return userName;
269 266
	}
270 267

  
271 268
	@Override
272 269
	public String getDetails() {
273
		return pName;
270
		return userName;
274 271
	}
275 272

  
276 273
	@Override
......
287 284

  
288 285
	@Override
289 286
	protected boolean _compute() throws Exception {
290
		//System.out.println("CALL IMPORTMODULE TO BUILD TEXT="+pName);
287
		//System.out.println("CALL IMPORTMODULE TO BUILD TEXT="+userName);
291 288
		return true;
292 289
	}
293 290

  
tmp/org.txm.core/src/java/org/txm/objects/SavedQuery.java (revision 1180)
62 62
	
63 63
	@Parameter(key=TBXPreferences.VALUE)
64 64
	String pValue;
65
	@Parameter(key=TBXPreferences.NAME)
66
	String pName;
67 65
	
68 66
	/** The examples. */
69 67
	List<String> examples;
......
88 86
	}
89 87

  
90 88
	protected boolean setParameters(Element pElement) {
91
		this.pName = pElement.getAttribute("name"); //$NON-NLS-1$
89
		this.userName = pElement.getAttribute("name"); //$NON-NLS-1$
92 90
		this.pValue = pElement.getAttribute("value"); //$NON-NLS-1$
93 91
		this.examples = new ArrayList<String>();
94 92
		NodeList examplesN = pElement.getElementsByTagName("example"); //$NON-NLS-1$
......
96 94
			Element e = (Element) examplesN.item(i);
97 95
			examples.add(e.getTextContent());
98 96
		}
99
		if (this.pName == null || this.pValue == null)
97
		if (this.userName == null || this.pValue == null)
100 98
			return false;
101 99
		return true;
102 100
	}
......
124 122
	 */
125 123
	@Override
126 124
	public String toString() {
127
		return this.pName + "=" + this.pValue; //+ " >> " + this.examples; //$NON-NLS-1$ 
125
		return this.userName + "=" + this.pValue; //+ " >> " + this.examples; //$NON-NLS-1$ 
128 126
	}
129 127

  
130 128
	@Override
......
139 137

  
140 138
	@Override
141 139
	public boolean setParameters(TXMParameters parameters) throws Exception {
142
		this.pName = parameters.getString(TBXPreferences.NAME);
140
		this.userName = parameters.getString(TBXPreferences.NAME);
143 141
		this.pValue = parameters.getString(TBXPreferences.VALUE);
144 142
		return true;
145 143
	}
146 144

  
147 145
	@Override
148 146
	public String getName() {
149
		return pName;
147
		return userName;
150 148
	}
151 149

  
152 150
	@Override
153 151
	public String getSimpleName() {
154
		return pName;
152
		return userName;
155 153
	}
156 154

  
157 155
	@Override
......
180 178
	}
181 179

  
182 180
	public void setParameters(String query, ArrayList<String> examples) {
183
		this.pName = query;
181
		this.userName = query;
184 182
		this.pValue = query;
185 183
		this.examples = examples;
186 184
	}
tmp/org.txm.core/src/java/org/txm/objects/Edition.java (revision 1180)
50 50
 */
51 51
public class Edition extends TXMResult {
52 52

  
53
	/** The name. */
54
	@Parameter(key=TBXPreferences.NAME)
55
	String pName;
56

  
57 53
	/** The index page path. */
58 54
	@Parameter(key=TBXPreferences.INDEX)
59 55
	String pIndex;
......
115 111
	protected boolean _load(Element e) {
116 112
		//		pType = e.getAttribute("type"); //$NON-NLS-1$
117 113
		pIndex = e.getAttribute("index"); //$NON-NLS-1$
118
		pName = e.getAttribute("name"); //$NON-NLS-1$
114
		userName = e.getAttribute("name"); //$NON-NLS-1$
119 115

  
120 116
		// System.out.println("  build edition "+name);
121 117
		NodeList pagesList = e.getElementsByTagName("page"); //$NON-NLS-1$
......
323 319
	@Override
324 320
	public String toString() {
325 321
		try {
326
			return "Edition [name="+pName+" index=" + pIndex + ", \npages=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
322
			return "Edition [name="+userName+" index=" + pIndex + ", \npages=" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
327 323
					+ pages.size() + "]"; //$NON-NLS-1$
328 324
		}
329 325
		catch (Exception e) {
......
378 374

  
379 375
	@Override
380 376
	public String getName() {
381
		return pName;
377
		return userName;
382 378
	}
383 379

  
384 380
	@Override
385 381
	public String getSimpleName() {
386
		return pName;
382
		return userName;
387 383
	}
388 384

  
389 385
	@Override
390 386
	public String getDetails() {
391
		return pName;
387
		return userName;
392 388
	}
393 389

  
394 390
	@Override
......
406 402

  
407 403
	@Override
408 404
	protected boolean _compute() throws Exception {
409
		//System.out.println("USE THE PROJECT IMPORTMODULE TO BUILD THE EDITION="+pName);
405
		//System.out.println("USE THE PROJECT IMPORTMODULE TO BUILD THE EDITION="+userName);
410 406
		if (pages == null) {
411 407
			pages = new ArrayList<Page>();
412 408
		} else {
......
437 433
	}
438 434

  
439 435
	public void setName(String name) {
440
		this.pName = name;
436
		this.userName = name;
441 437
	}
442 438
}
tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 1180)
71 71

  
72 72
	private static final String NAME = "name";
73 73
	
74
	@Parameter(key=TBXPreferences.NAME)
75
	String pName;
76

  
77 74
//	/** The xmlfile. */
78 75
//	File xmlDefinitionFile;
79 76
//
......
133 130
		
134 131
		IWorkspace rcpWorkspace = ResourcesPlugin.getWorkspace();
135 132
		this.internalPersistable = true;
136
		this.pName = rcpWorkspace.getRoot().getName(); // corpora
133
		this.userName = rcpWorkspace.getRoot().getName(); // corpora
137 134
		//		this.setPath("/"+pName); 
138 135
//		this.xmlDefinitionFile = xmlfile;
139 136
	}
......
173 170

  
174 171
	@Override
175 172
	public String getSimpleName() {
176
		return pName;
173
		return userName;
177 174
	}
178 175

  
179 176
	@Override
180 177
	public String getDetails() {
181
		return pName;
178
		return userName;
182 179
	}
183 180

  
184 181
	@Override
......
297 294
			//FIXME: SJ: old version where there is a bug if the name or path are not in same case
298 295
			//Project project = new Project(this, parameters.name, false);
299 296
			//FIXME: SJ: new version that fix the bug but whe may want to not modify the case of the name? 
300
			Project project = new Project(this, parameters.name.toLowerCase(), false);
297
			Project project = new Project(this, parameters.name.toUpperCase(), false);
301 298
			
302 299
			project._load(parameters);
303 300
			
......
346 343

  
347 344
	@Override
348 345
	public String getName() {
349
		return pName;
346
		return userName;
350 347
	}
351 348

  
352 349
	@Override
tmp/org.txm.setups/shared/debian/usr/bin/TXM (revision 1180)
107 107
		exit 1
108 108
    fi
109 109
    
110
	mkdir "$DOTTXMHOME/data"
111
    if [ ! -d "$DOTTXMHOME/data" ]; then
112
		echo "TXM: Impossible to access '$DOTTXMHOME/data' directory. Aborting$LOGFILESMSG"
110
	mkdir "$TXMHOME/corpora"
111
    if [ ! -d "$TXMHOME/corpora" ]; then
112
		echo "TXM: Impossible to access '$TXMHOME/corpora' directory. Aborting$LOGFILESMSG"
113 113
		exit 1
114 114
    fi
115 115
    
......
150 150
## uncomment next lien to enable full debug
151 151
#DEBUGOPTIONS="-log -consolelog -clean -debug -console -noexit"
152 152

  
153
SWT_GTK3=0 UBUNTU_MENUPROXY=0 exec "${TXMINSTALL}/TXM" -run --launcher.ini "$DOTTXMHOME/TXM.ini" $DEBUGOPTIONS -data "$DOTTXMHOME/data" -user "$DOTTXMHOME/user" -install "$TXMINSTALL"
153
SWT_GTK3=0 UBUNTU_MENUPROXY=0 exec "${TXMINSTALL}/TXM" -run --launcher.ini "$DOTTXMHOME/TXM.ini" $DEBUGOPTIONS -data "$TXMHOME/corpora" -user "$DOTTXMHOME/user" -install "$TXMINSTALL"
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/imports/CorpusPage.java (revision 1180)
1012 1012
		} catch (Exception e1) {
1013 1013
			org.txm.rcp.utils.Logger.printStackTrace(e1);
1014 1014
		}
1015

  
1016 1015
	}
1017 1016

  
1018 1017
	public void startImport() {
1019 1018
		//TODO: test all sections here
1020 1019
		project.setDirty();
1020
		project.setNeedToBuild();
1021 1021
		ExecuteImportScript.executeScript(project);
1022 1022

  
1023 1023
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/Load080BinaryCorpus.java (revision 1180)
60 60
		String basedirname = Zip.getRoot(zipFile);
61 61
		
62 62
		if (!Zip.hasEntries(zipFile, basedirname+"/.settings/", basedirname+"/.project", basedirname+"/data/", basedirname+"/txm/", basedirname+"/HTML/", basedirname+"/registry/")) {
63
			System.out.println("Binary corpus is not a TXM 0.8.0 corpus (no .settings nor .project file)");
63
			System.out.println(zipFile.getName()+" binary corpus is not a TXM 0.8.0 corpus (no .settings nor .project file)");
64 64
			return null;
65 65
		}
66 66
		
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorporaDirectory.java (revision 1180)
78 78
		if (dialog.open() != null) {
79 79

  
80 80
			File directory = new File(dialog.getFilterPath());
81

  
81
			
82 82
			if (directory.exists()) {
83 83
				LastOpened.set(ID, directory);
84 84
				return loadBinaryCorpusFromCorporaDirectory(directory);
......
136 136
						for (Project newProject2 : newProjects) {
137 137
							newProject2.compute();
138 138
						}
139
						
139
						System.out.println(newProjects.size()+" corpus loaded.");
140 140
						RestartTXM.reloadViews();
141 141
						System.err.println(TXMUIMessages.info_txmIsReady);
142 142
						StatusLine.setMessage(TXMUIMessages.info_txmIsReady);
......
178 178
			monitor.subTask(TXMUIMessages.AddBase_32);
179 179
			for (File corpusDirectory : corporaDirectory.listFiles()) {
180 180
				
181
				if (corpusDirectory.isFile()) continue;
182 181
				if (corpusDirectory.isHidden()) continue;
183 182
				
184
				Project project = null;
183
				Project project = Toolbox.workspace.getProject(corpusDirectory.getName().toUpperCase());
184
				if (project != null) {
185
					System.out.println("A corpus named "+corpusDirectory.getName().toUpperCase()+" is already loaded. Aborting the loading of "+corpusDirectory);
186
					continue;
187
				}
188
				
185 189
				if (corpusDirectory.isDirectory()) {
186 190
					project = LoadBinaryCorpus.loadBinaryCorpusAsDirectory(corpusDirectory, monitor);
187 191
				} else if (corpusDirectory.getName().endsWith(".txm")) {
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java (revision 1180)
137 137
		String basedirname = Zip.getRoot(zipFile);
138 138
		
139 139
		File corpusdir = new File(corporaDir, basedirname);
140

  
141
		if (corpusdir.exists()) {
140
		Project p = Toolbox.workspace.getProject(basedirname);
141
		
142
		if (corpusdir.exists() || p != null) {
142 143
			boolean b = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), TXMUIMessages.AddBase_19, NLS.bind(TXMUIMessages.AddBase_20, corpusdir.getName().toUpperCase()));
143 144
			if (b) {
144 145
				//TODO: to enable backup of binary corpus I need to be able to reload correctly a corpus in CQP corpus manager
......
153 154
//					return false;
154 155
//				}
155 156
				
156
				Project p = Toolbox.workspace.getProject(basedirname);
157 157
				if (p != null) {
158
					p.delete();
158
					p.delete(); // the user said yes, so delete the previous project
159 159
				} else {
160 160
					DeleteDir.deleteDirectory(corpusdir);
161 161
				}
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Subcorpus.java (revision 1180)
283 283
	@Override
284 284
	protected boolean _load(Element e) {
285 285
		if (e != null) {
286
			this.userName = this.pID = e.getAttribute(NAME);
286
			this.userName = e.getAttribute(NAME);
287
			this.pID = "S"+getNextSubcorpusCounter();
287 288
			this.pQuery = new CQLQuery(e.getAttribute("query")); //$NON-NLS-1$
288 289

  
289 290
			NodeList subcorpusElems = e.getElementsByTagName("subcorpus"); //$NON-NLS-1$

Formats disponibles : Unified diff