Revision 1006

tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/handlers/ComputeCA.java (revision 1006)
90 90
				}
91 91
				// ask property and Fmins and Vmax
92 92
				String title = TXMUIMessages.bind(CAUIMessages.ComputeCorrespondanceAnalysisDialog_0, partition.getName());
93
				CAParametersDialog d = new CAParametersDialog(window.getShell(), partition.getCorpus(), title);
93
				CAParametersDialog d = new CAParametersDialog(window.getShell(), partition.getParent(), title);
94 94

  
95 95
				if (d.open() == MessageDialog.OK) {
96 96
					Property property = d.getProperty();
tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/___TableEditor.java (revision 1006)
174 174
		tableSorter.setColumnTypes(tableInput.getColumnTypes());
175 175
		if (this.iEditorInput instanceof ___LexicalTableEditorInput) {
176 176
			___LexicalTableEditorInput ed = (___LexicalTableEditorInput) this.iEditorInput;
177
			tableSorter.setLocale(ed.getResult().getPartition().getCorpus().getLocale());
177
			tableSorter.setLocale(ed.getResult().getPartition().getParent().getLocale());
178 178
		}
179 179
		viewer.setSorter(tableSorter);
180 180

  
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/AbbreviationsAndLines.java (revision 1006)
21 21
		super(corpus, tsvFile);
22 22
	}
23 23
	
24
	public boolean process() throws CqiClientException, IOException, CqiServerError {
24
	public boolean process() throws Exception {
25 25

  
26 26
		dist_start = Math.abs(dist_start);
27 27
		dist_end = Math.abs(dist_end);
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/AbbreviationsAndSementics.java (revision 1006)
36 36

  
37 37
	}
38 38
	
39
	public boolean process() throws CqiClientException, IOException, CqiServerError {
39
	public boolean process() throws Exception {
40 40
		
41 41
		System.out.println("Dénombrement des abbréviations de "+corpus+" en '"+(wordCorpus?"mots":"lettres")+"' pour les entités "+entities);
42 42
		if (structures.size() == 0) {
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/Allographs.java (revision 1006)
31 31
		this.sign = sign;
32 32
	}
33 33

  
34
	public boolean process() throws CqiClientException, IOException, CqiServerError {
34
	public boolean process() throws Exception {
35 35
		String[] props = {"sign", "allograph-expert", "allograph-auto", "characters"};
36 36
		System.out.println("Dénombrement des allographes '"+allograph+"' de signe '"+sign+"' dans le contexte '"+query+"'");
37 37

  
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/functions/OriflammsFunction.java (revision 1006)
51 51
		this.corpus = corpus;
52 52
	}
53 53

  
54
	boolean process() throws CqiClientException, IOException, CqiServerError {
54
	boolean process() throws Exception {
55 55
		
56 56
		StructuralUnit w = corpus.getStructuralUnit("w");
57 57

  
......
85 85
		
86 86
		writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tsvFile), "UTF-8")));
87 87
		writer.println("text_id\tpb_id\tcb_id\tlb_id\tline part\tNabbr\tNcharAbbr\ttotal\t%=NcharAbbr/Ntotal");
88
		Partition p = corpus.createPartition("tmp", text_su,text_id);
88
		Partition p = corpus.createPartition("tmp", text_su,text_id, null, false);
89 89
		for (Part part : p.getParts()) {
90 90
			processText(part, part.getName());
91 91
		}
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/commands/ComputeAbbreviationsAndLines.java (revision 1006)
64 64
		return null;
65 65
	}
66 66
	
67
	public boolean compute(Corpus corpus, int dist_start, int dist_end, File tsvFile) throws CqiClientException, IOException, CqiServerError {
67
	public boolean compute(Corpus corpus, int dist_start, int dist_end, File tsvFile) throws Exception {
68 68
		AbbreviationsAndLines aal = new AbbreviationsAndLines(corpus, tsvFile,dist_start, dist_end);
69 69
		return aal.process();
70 70
	}
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/commands/ComputeAllographs.java (revision 1006)
66 66
		return null;
67 67
	}
68 68
	
69
	public boolean compute(Corpus corpus, File tsvFile, String sign, String allograph, Query query) throws CqiClientException, IOException, CqiServerError {
69
	public boolean compute(Corpus corpus, File tsvFile, String sign, String allograph, Query query) throws Exception {
70 70
		Allographs a = new Allographs(corpus, tsvFile, sign , query, allograph);
71 71
		return a.process();
72 72
	}
tmp/org.txm.oriflamms.rcp/src/org/txm/oriflamms/commands/ComputeAbbreviationsAndSemantics.java (revision 1006)
59 59
		return null;
60 60
	}
61 61
	
62
	public boolean compute(Corpus corpus, String entities, File tsvFile) throws CqiClientException, IOException, CqiServerError {
62
	public boolean compute(Corpus corpus, String entities, File tsvFile) throws Exception {
63 63
		AbbreviationsAndSementics aas = new AbbreviationsAndSementics(corpus, tsvFile, entities);
64 64
		return aas.process();
65 65
	}
tmp/org.txm.rcp/src/main/java/org/txm/rcp/swt/widget/PartitionComposer.java (revision 1006)
581 581
	 *
582 582
	 * @return the partition
583 583
	 */
584
	public Partition getPartition() {
584
	public Partition getPartition(String name) {
585 585
		if (this.parts.size() == 0) {
586 586
			System.out.println(TXMUIMessages.PartitionComposer_1);
587 587
			return null;
......
602 602
		}
603 603

  
604 604
		try {
605
			Partition p = corpus.createPartition("", queries, partnames); //$NON-NLS-1$
605
			Partition p = corpus.createPartition(name, queries, partnames, false); //$NON-NLS-1$
606 606
			return p;
607
		} catch (CqiClientException e) {
607
		} catch (Exception e) {
608 608
			org.txm.rcp.utils.Logger.printStackTrace(e);
609 609
		}
610 610
		return null;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/___DeleteInCorporaView.java (revision 1006)
105 105
		if (selection.getFirstElement() instanceof Partition) {
106 106
			Partition partition = (Partition) selection.getFirstElement();
107 107
			try {
108
				partition.getCorpus().dropPartition(partition);
108
				partition.getParent().dropPartition(partition);
109 109
			} catch (CqiClientException e) {
110 110
				System.err.println(NLS.bind(
111 111
						TXMUIMessages.DeleteInCorporaView_2, e));
tmp/org.txm.rcp/src/main/java/org/txm/rcp/actions/CreatePartitionDialog.java (revision 1006)
599 599
			StructuralUnit structuralUnit = this.structuralUnitsFinal.get(this.structuralUnitsCombo.getSelectionIndex());
600 600
			StructuralUnitProperty property = structuralUnit.getProperty(this.propertyCombo.getText());
601 601
			try {
602
				p = corpus.createPartition(structuralUnit, property);
603
			} catch (CqiClientException e) {
602
				p = corpus.createPartition(getName(), structuralUnit, property, null, false);
603
			} catch (Exception e) {
604 604
				org.txm.rcp.utils.Logger.printStackTrace(e);
605 605
				return null;
606 606
			}
607 607
		} else if (isAssistedSelected) {
608
			p = this.compositeForAssisted.getPartition();
608
			p = this.compositeForAssisted.getPartition(getName());
609 609
		} else if (isAdvancedSelected) {
610 610
			try {
611
				p = corpus.createPartition(getName(), getQueries(), getAdvancePartNames());
612
			} catch (CqiClientException e) {
611
				p = corpus.createPartition(getName(), getQueries(), getAdvancePartNames(), false);
612
			} catch (Exception e) {
613 613
				org.txm.rcp.utils.Logger.printStackTrace(e);
614 614
				return null;
615 615
			}
......
625 625
			return null;
626 626
		}
627 627
		
628
		if (this.getName() != null && !this.getName().trim().equals("")) //$NON-NLS-1$
629
			p.setName(this.getName().trim());
630

  
631 628
		return p;
632 629
	}
633 630

  
tmp/org.txm.queryindex.rcp/src/org/txm/rcp/editors/input/QueryIndexEditorInput.java (revision 1006)
82 82
	 */
83 83
	public QueryIndexEditorInput(Partition partition) {
84 84
		super();
85
		this.corpus = partition.getCorpus();
85
		this.corpus = partition.getParent();
86 86
		this.partition = partition;
87 87
		this.qindex = null;
88 88
	}
tmp/org.txm.queryindex.rcp/src/org/txm/functions/queryindex/QueryIndex.java (revision 1006)
106 106

  
107 107
	public QueryIndex(Partition partition) {
108 108
		super(partition);
109
		this.corpus = partition.getCorpus();
109
		this.corpus = partition.getParent();
110 110
		this.partition = partition;
111 111
		partnames = partition.getPartNames();
112 112
	}
tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/rcp/editors/input/QueryIndexEditorInput.java (revision 1006)
82 82
	 */
83 83
	public QueryIndexEditorInput(Partition partition) {
84 84
		super();
85
		this.corpus = partition.getCorpus();
85
		this.corpus = partition.getParent();
86 86
		this.partition = partition;
87 87
		this.qindex = null;
88 88
	}
tmp/org.txm.queryindex.rcp/src/org/txm/queryindex/core/functions/QueryIndex.java (revision 1006)
106 106

  
107 107
	public QueryIndex(Partition partition) {
108 108
		super(partition);
109
		this.corpus = partition.getCorpus();
109
		this.corpus = partition.getParent();
110 110
		this.partition = partition;
111 111
		partnames = partition.getPartNames();
112 112
	}
tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 1006)
119 119
		try {
120 120
			//this.persistable = false; // FIXME: remove that later
121 121
			String p = this.getStringParameterValue(TBXPreferences.UNIT_PROPERTY);
122
			this.pProperty = getCorpus().getProperty(p);
122
			if (p != null && p.length() > 0) {
123
				this.pProperty = getCorpus().getProperty(p);
124
			}
123 125
		}
124 126
		catch (CqiClientException e) {
125 127
			// TODO Auto-generated catch block
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 1006)
406 406
	/**
407 407
	 * Initializes the index using a lexicon.
408 408
	 *
409
	 * @param corpus the corpus
410
	 * @param property the property
411 409
	 */
412 410
	private void computeWithCorpusAndNoQuery() {
413 411
		try {
......
541 539
		if (this.parent instanceof Corpus) {
542 540
			return (Corpus) this.parent;
543 541
		} else if (this.parent instanceof Partition) {
544
			return ((Partition)this.parent).getCorpus();
542
			return ((Partition)this.parent).getParent();
545 543
		} else if (this.lexicon != null) {
546 544
			return this.lexicon.getCorpus();
547 545
		} else {
tmp/org.txm.partition.core/src/org/txm/partition/core/functions/PartitionDimensions.java (revision 1006)
178 178
	 * @return
179 179
	 */
180 180
	public Corpus getCorpus()	{
181
		return this.getPartition().getCorpus();
181
		return this.getPartition().getParent();
182 182
	}
183 183

  
184 184

  
tmp/org.txm.ahc.rcp/src/org/txm/ahc/rcp/handlers/ComputeAHC.java (revision 1006)
111 111
				int vMax = TXMPreferences.getInt(TXMPreferences.V_MAX, CAPreferences.PREFERENCES_NODE);
112 112
				int fMin = TXMPreferences.getInt(TXMPreferences.F_MIN, CAPreferences.PREFERENCES_NODE);
113 113
				Shell shell = Display.getCurrent().getActiveShell();
114
				CAParametersDialog d = new CAParametersDialog(shell, partition.getCorpus(), title);
114
				CAParametersDialog d = new CAParametersDialog(shell, partition.getParent(), title);
115 115
				d.setFminAndVMax(fMin, vMax);
116 116
				
117 117
				if (d.open() == Window.OK) {
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 1006)
205 205
		}
206 206
		
207 207
		// Corpus global lexicon
208
		Lexicon corpusLexicon = Lexicon.getLexicon(partition.getCorpus(), this.property, this.monitor);
208
		Lexicon corpusLexicon = Lexicon.getLexicon(partition.getParent(), this.property, this.monitor);
209 209
		
210 210
		ArrayList<String> filteredForms = new ArrayList<String>();
211 211
		//create a copy and filter line with Fmin;
tmp/org.txm.core/src/java/org/txm/core/CorpusProject.java (revision 1006)
1
package org.txm.core;
2

  
3
import org.eclipse.core.resources.IProject;
4
import org.eclipse.core.resources.IProjectNature;
5
import org.eclipse.core.runtime.CoreException;
6

  
7
public class CorpusProject implements IProjectNature {
8

  
9
	public static final String NATURE_ID = "org.txm.core.project.corpus";
10
	
11
	/**
12
	 * the eclipse project pointing to the TXM corpus project
13
	 */
14
	private IProject project;
15
	
16
	@Override
17
	public void configure() throws CoreException {
18
		// TODO Auto-generated method stub
19

  
20
	}
21

  
22
	@Override
23
	public void deconfigure() throws CoreException {
24
		// nothing to do
25
	}
26

  
27
	@Override
28
	public IProject getProject() {
29
		// TODO Auto-generated method stub
30
		return project;
31
	}
32

  
33
	@Override
34
	public void setProject(IProject project) {
35
		this.project = project;
36
	}
37
}
tmp/org.txm.core/src/java/org/txm/core/preferences/TXMPreferences.java (revision 1006)
124 124
	 * Unit properties.
125 125
	 */
126 126
	public static final String UNIT_PROPERTIES =  "unit_properties"; //$NON-NLS-1$
127
	
128
	/**
129
	 * List of values
130
	 */
131
	public static final String VALUES = "values";
127 132

  
128 133
	/**
129 134
	 * Matches.
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1006)
68 68
	/**
69 69
	 * Unique ID of the result.
70 70
	 */
71
	protected String uniqueID;
71
	private String uniqueID;
72 72

  
73 73
	/**
74 74
	 * Editor can use this to test if the result has been computed once.
......
1557 1557
	 * @throws Exception
1558 1558
	 */
1559 1559
	public boolean compute(IProgressMonitor monitor) throws Exception {
1560
		return this.compute(monitor, true);
1560
		return this.compute(monitor, false);
1561 1561
	}
1562 1562

  
1563 1563

  
tmp/org.txm.core/src/java/org/txm/core/results/TXMParameters.java (revision 1006)
40 40
		}
41 41
	}
42 42

  
43
	public String getString(String key) {
44
		Object v = get(key);
45
		if (v == null) {
46
			return null;
47
		} else {
48
			return v.toString();
49
		}
50
	}
51
	
43 52
	public Integer getInteger(String key) {
44 53
		Object v = get(key);
45 54
		if (v == null) {
tmp/org.txm.core/src/java/org/txm/core/CorpusNature.java (revision 1006)
1
package org.txm.core;
2

  
3
import org.eclipse.core.resources.IProject;
4
import org.eclipse.core.resources.IProjectNature;
5
import org.eclipse.core.runtime.CoreException;
6

  
7
public class CorpusNature implements IProjectNature {
8

  
9
	public static final String NATURE_ID = "org.txm.core.project.corpus";
10
	
11
	/**
12
	 * the eclipse project pointing to the TXM corpus project
13
	 */
14
	private IProject project;
15
	
16
	@Override
17
	public void configure() throws CoreException {
18
		// TODO Auto-generated method stub
19

  
20
	}
21

  
22
	@Override
23
	public void deconfigure() throws CoreException {
24
		// nothing to do
25
	}
26

  
27
	@Override
28
	public IProject getProject() {
29
		return project;
30
	}
31

  
32
	@Override
33
	public void setProject(IProject project) {
34
		this.project = project;
35
	}
36
}
0 37

  
tmp/org.txm.core/src/java/org/txm/objects/Corpus.java (revision 1006)
164 164
	 * @param base the base
165 165
	 * @param c the c
166 166
	 */
167
	public Corpus(Base base, Element c) {
168
		super(base);
167
	public Corpus(Base base, Element c, String uuid) {
168
		super(uuid, base);
169 169
		if(base != null && c != null) {
170 170
			this.base = base;
171 171
			this.setPath(base.getPath() + getName());
tmp/org.txm.core/src/java/org/txm/objects/Workspace.java (revision 1006)
55 55
import org.txm.core.messages.TXMCoreMessages;
56 56
import org.txm.core.preferences.TBXPreferences;
57 57
import org.txm.core.preferences.TXMPreferences;
58
import org.txm.core.results.TXMResult;
58 59
import org.txm.utils.DeleteDir;
59 60
import org.txm.utils.io.FileCopy;
60 61
import org.txm.utils.logger.Log;
......
215 216
	 * @param xmlproject the xmlproject
216 217
	 */
217 218
	public Workspace(File xmlfile) {
218
		super(null);
219
		super((TXMResult)null);
219 220
		name = xmlfile.getName();
220 221
		this.setPath("/"+name); 
221 222
		this.xmlDefinitionFile = xmlfile;
tmp/org.txm.core/src/java/org/txm/objects/TxmObject.java (revision 1006)
69 69
		metadatas = new HashMap<String, Property>();
70 70
	}
71 71
	
72
	public TxmObject(String uuid, TXMResult parent) {
73
		super(uuid, parent);
74
		metadatas = new HashMap<String, Property>();
75
	}
76
	
77
	public TxmObject(String uuid) {
78
		super(uuid);
79
		metadatas = new HashMap<String, Property>();
80
	}
81
	
72 82
	/**
73 83
	 * Gets the name.
74 84
	 *
......
113 123
	public final boolean load() {
114 124
		String id = this.selfElement.getAttribute(TXMPreferences.RESULT_UUID);
115 125
		if (id != null && id.length() > 0) {
116
			this.uniqueID = id;
126
		//	this.uniqueID = id;
117 127
		}
118 128
		return _load();
119 129
	}
......
125 135
	 */
126 136
	public final boolean save() {
127 137
		if (selfElement != null) {
128
			this.selfElement.setAttribute(TXMPreferences.RESULT_UUID, this.uniqueID);
138
			this.selfElement.setAttribute(TXMPreferences.RESULT_UUID, getUUID());
129 139
		}
130 140
		for (TXMResult child : getChildren())	{
131 141
			if (child instanceof TxmObject) {
......
316 326
	}
317 327
	
318 328
	@Override
319
	public String getResultype() {
320
		// TODO later we must implement this method in each TXMObject subclasses
329
	public final String getResultype() {
321 330
		return this.getClass().getSimpleName();
322 331
	}
323 332
}
tmp/org.txm.core/plugin.xml (revision 1006)
17 17
         point="org.eclipse.core.resources.natures">
18 18
      <runtime>
19 19
         <run
20
               class="org.txm.core.CorpusProject">
20
               class="org.txm.core.CorpusNature">
21 21
         </run>
22 22
      </runtime>
23 23
   </extension>

Also available in: Unified diff