Revision 1983

tmp/org.txm.core/src/java/org/txm/objects/Text.java (revision 1983)
42 42
 */
43 43
public class Text extends TXMResult {
44 44

  
45
//	/** The editions. */
46
//	HashMap<String, Edition> editions = new HashMap<String, Edition>();
47
	
45
	//	/** The editions. */
46
	//	HashMap<String, Edition> editions = new HashMap<String, Edition>();
47

  
48 48
	/** The source file. */
49 49
	@Parameter(key=TBXPreferences.SOURCE)
50 50
	File pSource;
51 51
	/** The XML-TXM file. */
52 52
	@Parameter(key=TBXPreferences.XMLTXM)
53 53
	File pTXMFile;
54
	
54

  
55 55
	/**
56 56
	 * Instantiates a new text.
57 57
	 *
......
60 60
	 */
61 61
	public Text(Project project) {
62 62
		super(project);
63
		
63

  
64 64
		this.setVisible(false);
65 65
		this.internalPersistable = true;
66 66
	}
67
	
67

  
68 68
	public Project getParent() {
69 69
		return (Project) super.getParent();
70 70
	}
......
77 77
	 */
78 78
	public Text(String parametersNodePath) {
79 79
		super(parametersNodePath);
80
		
80

  
81 81
		this.setVisible(false);
82 82
		this.internalPersistable = true;
83 83
	}
84
	
84

  
85 85
	/* 
86
     * Retro compatiblity to load Editions from a XML Element 
86
	 * Retro compatiblity to load Editions from a XML Element 
87 87
	 */
88 88
	protected boolean _load(Element e) {
89 89
		Element src = (Element) e
......
92 92
		//sourcetype = src.getAttribute("type"); //$NON-NLS-1$
93 93
		try {
94 94
			String biblio = e.getAttribute("biblio"); //$NON-NLS-1$
95
			Edition ed = new Edition(this);
96
			ed.setName("biblio");
97
			ed.setIndex(biblio);
95
			if (biblio != null && biblio.length() > 0) {
96
				Edition ed = new Edition(this);
97
				ed.setName("biblio");
98
				ed.setIndex(biblio);
99
			}
98 100
		} catch (Exception e2) {	} 
99
		
101

  
100 102
		try {
101 103
			String pdf = e.getAttribute("pdf"); //$NON-NLS-1$
102
			Edition ed = new Edition(this);
103
			ed.setName("pdf");
104
			ed.setIndex(pdf);
104
			if (pdf != null && pdf.length() > 0) {
105
				Edition ed = new Edition(this);
106
				ed.setName("pdf");
107
				ed.setIndex(pdf);
108
			}
105 109
		} catch (Exception e2) {	} 
106
		
110

  
107 111
		userName = e.getAttribute("name"); //$NON-NLS-1$
108
		
112

  
109 113
		Element editionsnode = (Element) e.getElementsByTagName("editions").item(0); //$NON-NLS-1$
110 114
		NodeList editionList = editionsnode.getElementsByTagName("edition"); //$NON-NLS-1$
111 115

  
......
118 122

  
119 123
		return true;
120 124
	}
121
	
125

  
122 126
	/**
123 127
	 * Gets the editions.
124 128
	 *
......
145 149
		return null;
146 150
	}
147 151

  
148
//	/**
149
//	 * Adds the edition.
150
//	 *
151
//	 * @param name the name
152
//	 * @param type the type
153
//	 * @param index the index
154
//	 * @return the edition
155
//	 */
156
//	public Edition addEdition(String name, String type, File index) {
157
//		Document doc = getSelfElement().getOwnerDocument();
158
//		Element editionRoot = (Element) getSelfElement().getElementsByTagName(
159
//				"editions").item(0); //$NON-NLS-1$
160
//		Element editionElem = doc.createElement("edition"); //$NON-NLS-1$
161
//		editionElem.setAttribute("name", name); //$NON-NLS-1$
162
//		editionElem.setAttribute("type", type); //$NON-NLS-1$
163
//		editionElem.setAttribute("index", index.getAbsolutePath()); //$NON-NLS-1$
164
//		editionRoot.appendChild(editionElem);
165
//
166
//		Edition e = new Edition(this, editionElem);
167
//		e.setPath(this.getPath() + e.name);
168
//		editions.put(name, e);
169
//		return e;
170
//	}
171
//
172
//	/**
173
//	 * Removes the edition.
174
//	 *
175
//	 * @param name the name
176
//	 * @return the edition
177
//	 */
178
//	public Edition removeEdition(String name) {
179
//		Edition e = editions.get(name);
180
//		if (e != null) {
181
//			Element editionRoot = (Element) getSelfElement().getElementsByTagName(
182
//					"editions").item(0); //$NON-NLS-1$
183
//			editionRoot.removeChild(e.getSelfElement());
184
//			editions.remove(name);
185
//		}
186
//		return e;
187
//	}
152
	//	/**
153
	//	 * Adds the edition.
154
	//	 *
155
	//	 * @param name the name
156
	//	 * @param type the type
157
	//	 * @param index the index
158
	//	 * @return the edition
159
	//	 */
160
	//	public Edition addEdition(String name, String type, File index) {
161
	//		Document doc = getSelfElement().getOwnerDocument();
162
	//		Element editionRoot = (Element) getSelfElement().getElementsByTagName(
163
	//				"editions").item(0); //$NON-NLS-1$
164
	//		Element editionElem = doc.createElement("edition"); //$NON-NLS-1$
165
	//		editionElem.setAttribute("name", name); //$NON-NLS-1$
166
	//		editionElem.setAttribute("type", type); //$NON-NLS-1$
167
	//		editionElem.setAttribute("index", index.getAbsolutePath()); //$NON-NLS-1$
168
	//		editionRoot.appendChild(editionElem);
169
	//
170
	//		Edition e = new Edition(this, editionElem);
171
	//		e.setPath(this.getPath() + e.name);
172
	//		editions.put(name, e);
173
	//		return e;
174
	//	}
175
	//
176
	//	/**
177
	//	 * Removes the edition.
178
	//	 *
179
	//	 * @param name the name
180
	//	 * @return the edition
181
	//	 */
182
	//	public Edition removeEdition(String name) {
183
	//		Edition e = editions.get(name);
184
	//		if (e != null) {
185
	//			Element editionRoot = (Element) getSelfElement().getElementsByTagName(
186
	//					"editions").item(0); //$NON-NLS-1$
187
	//			editionRoot.removeChild(e.getSelfElement());
188
	//			editions.remove(name);
189
	//		}
190
	//		return e;
191
	//	}
188 192

  
189 193
	/**
190 194
	 * Gets the source file.
......
194 198
	public File getSource() {
195 199
		return pSource;
196 200
	}
197
	
201

  
198 202
	/**
199 203
	 * Gets the PDF edition page path.
200 204
	 *
......
220 224

  
221 225
	@Override
222 226
	public boolean loadParameters() throws Exception {
223
		
227

  
224 228
		String path = getStringParameterValue(TBXPreferences.SOURCE);
225 229
		if (path != null & path.length() > 0) {
226 230
			this.pSource = new File(path);
227 231
		}
228
		
232

  
229 233
		path = getStringParameterValue(TBXPreferences.XMLTXM);
230 234
		if (path != null & path.length() > 0) {
231 235
			this.pTXMFile = new File(path);
......
245 249
		}
246 250
		return true;
247 251
	}
248
	
252

  
249 253
	public void setName(String name) {
250 254
		this.userName = name;
251 255
	}
252
	
256

  
253 257
	public void setSourceFile(File src) {
254 258
		this.pSource = src;
255 259
		this.dirty = true;
256 260
	}
257
	
261

  
258 262
	public void setTXMFile(File txmFile) {
259 263
		this.pTXMFile = txmFile;
260 264
	}
......
280 284
			pTXMFile.delete();
281 285
		}
282 286
	}
283
	
287

  
284 288
	@Override
285 289
	public boolean canCompute() throws Exception {
286 290
		return true;//pSource.exists() || pTXMFile.exists();
......
301 305
	public String getResultType() {
302 306
		return "Text";
303 307
	}
304
	
308

  
305 309
	@Override
306 310
	public String toString() {
307 311
		return userName + " (file: " + pTXMFile + ")";
tmp/org.txm.analec.rcp/plugin.xml (revision 1983)
328 328
            class="org.txm.annotation.urs.toolbar.SchemaToolbar"
329 329
            position="2">
330 330
      </annotationtoolbar>
331
      <annotationtoolbar
332
            class="org.txm.annotation.urs.toolbar.UnitConcordanceToolbar"
333
            position="4">
334
      </annotationtoolbar>
335
      <annotationtoolbar
336
            class="org.txm.annotation.urs.toolbar.UnitConcordanceToolbar"
337
            position="4">
338
      </annotationtoolbar>
339
      <annotationtoolbar
340
            class="org.txm.annotation.urs.rcp.AnnotationArea:1"
341
            position="4">
342
      </annotationtoolbar>
343 331
   </extension>
344 332
   <extension
345 333
         point="org.txm.PostTXMHOMEInstallationStep">

Also available in: Unified diff