Révision 3432

TXM/trunk/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java (revision 3432)
19 19
import org.eclipse.jface.viewers.ISelectionProvider;
20 20
import org.eclipse.swt.SWT;
21 21
import org.eclipse.swt.browser.Browser;
22
import org.eclipse.swt.browser.LocationEvent;
23
import org.eclipse.swt.browser.LocationListener;
22 24
import org.eclipse.swt.browser.ProgressEvent;
23 25
import org.eclipse.swt.browser.ProgressListener;
26
import org.eclipse.swt.events.DisposeEvent;
27
import org.eclipse.swt.events.DisposeListener;
24 28
import org.eclipse.swt.events.KeyEvent;
25 29
import org.eclipse.swt.events.KeyListener;
26 30
import org.eclipse.swt.events.MenuEvent;
......
126 130
			// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
127 131
			// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
128 132
			"} catch (e) { };"; //$NON-NLS-1$
129
			
133
	
130 134
	public static final String highlightscriptRuleFast = "sheet.insertRule(\"#%s {background-color:rgba(%s,%s,%s,%s);}\", 0);"; //$NON-NLS-1$
131 135
	
132 136
	public static final String colorscriptRuleFast = "sheet.insertRule(\"#%s {color:rgba(%s,%s,%s,%s);}\", 0);"; //$NON-NLS-1$
......
269 273
	
270 274
	private ArrayList<ProgressListener> afterHighlighListeners;
271 275
	
276
	private CommandLink cmdLink;
277
	
278
	private EditionLink editionLink;
279
	
272 280
	public ArrayList<ProgressListener> getAfterHighlighListeners() {
273 281
		
274 282
		return beforeHighlighListeners;
......
294 302
		
295 303
		if (Log.getLevel().intValue() <= Level.FINEST.intValue()) System.out.println(code);
296 304
		try {
305
			//System.out.println("EXECUTE: "+code.replace("\n", " RET ").subSequence(0, Math.min(200, code.length())));
297 306
			return getBrowser().execute(code);
298 307
		}
299 308
		catch (Throwable e) {
......
327 336
		beforeHighlighListeners = new ArrayList<>();
328 337
		afterHighlighListeners = new ArrayList<>();
329 338
		
339
		//		this.browser.addLocationListener(new LocationListener() {
340
		//			
341
		//			@Override
342
		//			public void changing(LocationEvent event) {
343
		//				
344
		//				// TODO Auto-generated method stub
345
		//				
346
		//			}
347
		//			
348
		//			@Override
349
		//			public void changed(LocationEvent event) {
350
		//				if (cmdLink != null) cmdLink.dispose();
351
		//				if (editionLink != null) cmdLink.dispose();
352
		//			}
353
		//		});
354
		
355
		
356
		this.addDisposeListener(new DisposeListener() { // clean the BrowserFunction s
357
			
358
			@Override
359
			public void widgetDisposed(DisposeEvent e) {
360
				//				System.out.println("dispose listener called");
361
				if (cmdLink != null) cmdLink.dispose();
362
				if (editionLink != null) editionLink.dispose();
363
				browser.dispose();
364
			}
365
		});
366
		
367
		if (cmdLink == null) {
368
			cmdLink = new CommandLink(synopticEditionEditor, browser);
369
		}
370
		if (editionLink == null) {
371
			editionLink = new EditionLink(synopticEditionEditor, browser);
372
		}
373
		//		
374
		//		browser.addLocationListener(new LocationListener() {
375
		//			
376
		//			@Override
377
		//			public void changing(LocationEvent event) { }
378
		//			
379
		//			@Override
380
		//			public void changed(LocationEvent event) { // need to update the BrowserFunctions when a page is 
381
		//				if (cmdLink != null) {
382
		//					cmdLink.dispose();
383
		//				}
384
		//				cmdLink = new CommandLink(synopticEditionEditor, browser);
385
		//				if (editionLink != null) {
386
		//					editionLink.dispose();
387
		//				}
388
		//				editionLink = new EditionLink(synopticEditionEditor, browser);
389
		//			}
390
		//		});
391
		
330 392
		progressListener = new ProgressListener() {
331 393
			
332 394
			@Override
......
335 397
			@Override
336 398
			public synchronized void completed(ProgressEvent event) {
337 399
				
338
				Object o = getBrowser().evaluate("return typeof " + CommandLink.FCT + ";");
400
				Browser browser = getBrowser();
401
				Object o = browser.evaluate("return typeof " + CommandLink.FCT + ";");
339 402
				if ("undefined".equals(o)) {
340
					new CommandLink(synopticEditionEditor, getBrowser());
403
					if (cmdLink != null) {
404
						cmdLink.dispose();
405
					}
406
					cmdLink = new CommandLink(synopticEditionEditor, browser);
407
					//System.out.println("rebuild cmdLink");
341 408
				}
342
				o = getBrowser().evaluate("return typeof " + EditionLink.FCT + ";");
409
				o = browser.evaluate("return typeof " + EditionLink.FCT + ";");
343 410
				if ("undefined".equals(o)) {
344
					new EditionLink(synopticEditionEditor, getBrowser());
411
					if (editionLink != null) {
412
						editionLink.dispose();
413
					}
414
					editionLink = new EditionLink(synopticEditionEditor, browser);
415
					//System.out.println("rebuild editionLink");
345 416
				}
346 417
				
418
				
419
				
347 420
				Object rez = evaluate("return typeof sheet;"); //$NON-NLS-1$
348 421
				if ("undefined".equals(rez)) { //$NON-NLS-1$
349 422
					Object loadResult = evaluate(functions);
......
432 505
							// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
433 506
							s = "try { document.getElementById(\"" + wordid + "\").style.backgroundColor=\"rgba(" + composite.r + "," + composite.g + "," + composite.b + "," + composite.a + ")\";" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
434 507
									+
435
							// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
436
							// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
437
							// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
438
							// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
508
									// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
509
									// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
510
									// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
511
									// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
439 512
									"} catch (e) { };"; //$NON-NLS-1$
440 513
						}
441 514
						else {
......
516 589
						// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
517 590
						s = "try { document.getElementById(\"" + wordid + "\").style.fontWeight=\"" + fontWeightPerWordIDS.get(wordid) + "\";" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
518 591
								+
519
						// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
520
						// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
521
						// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
522
						// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
592
								// "elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
593
								// "elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
594
								// "elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
595
								// "elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
523 596
								"} catch (e) { };"; //$NON-NLS-1$
524 597
						// s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
525 598
						// s = "try { var elt = document.getElementById(\"" + wordid + "\");" + //$NON-NLS-1$ //$NON-NLS-2$
......
558 631
				}
559 632
				
560 633
				if (buffer.length() > 0) {
561
				//Object rez2 = execute(buffer.toString());
634
					//Object rez2 = execute(buffer.toString());
562 635
					if (execute(buffer.toString())) {
563 636
						focusedWordID = null; // focus one time
564 637
					}
......
1160 1233
	// this.currentEdition = edition;
1161 1234
	// }
1162 1235
	
1163
	static String SCRIPT01 = 
1236
	String EMPTYSELECTIONTEST =
1237
			"if (typeof window.getSelection != \"undefined\") {" + // modern Web browsers //$NON-NLS-1$
1238
					"var sel = window.getSelection();" + //$NON-NLS-1$
1239
					"return sel.rangeCount == 0" + //$NON-NLS-1$
1240
					"} else if (typeof document.selection != \"undefined\") {" + // for IE < 11 //$NON-NLS-1$
1241
					"if (document.selection.type == \"Text\") {" + //$NON-NLS-1$
1242
					"return document.selection.createRange().htmlText.length() == 0;" + //$NON-NLS-1$
1243
					"}" + //$NON-NLS-1$
1244
					"}" + //$NON-NLS-1$
1245
					"return false"; //$NON-NLS-1$
1246
	
1247
	String SCRIPT01 = 
1164 1248
			"var html = \"\";" + //$NON-NLS-1$
1165
			"if (typeof window.getSelection != \"undefined\") {" + // modern Web browsers //$NON-NLS-1$
1166
				"var sel = window.getSelection();" + //$NON-NLS-1$
1167
				"if (sel.rangeCount) {" + //$NON-NLS-1$
1249
					"if (typeof window.getSelection != \"undefined\") {" + // modern Web browsers //$NON-NLS-1$
1250
					"var sel = window.getSelection();" + //$NON-NLS-1$
1251
					"if (sel.rangeCount) {" + //$NON-NLS-1$
1168 1252
					"var container = document.createElement(\"div\");" + //$NON-NLS-1$
1169 1253
					"for (var i = 0, len = sel.rangeCount; i < len; ++i) {" + //$NON-NLS-1$
1170
						"container.appendChild(sel.getRangeAt(i).cloneContents());" + //$NON-NLS-1$
1254
					"container.appendChild(sel.getRangeAt(i).cloneContents());" + //$NON-NLS-1$
1171 1255
					"}" + //$NON-NLS-1$
1172 1256
					"html = container.innerHTML;" + //$NON-NLS-1$
1173
				"}" + //$NON-NLS-1$
1174
			"} else if (typeof document.selection != \"undefined\") {" + // for IE < 11 //$NON-NLS-1$
1175
				"if (document.selection.type == \"Text\") {" + //$NON-NLS-1$
1257
					"container.remove()" +
1258
					"}" + //$NON-NLS-1$
1259
					"} else if (typeof document.selection != \"undefined\") {" + // for IE < 11 //$NON-NLS-1$
1260
					"if (document.selection.type == \"Text\") {" + //$NON-NLS-1$
1176 1261
					"html = document.selection.createRange().htmlText;" + //$NON-NLS-1$
1177
				"}" + //$NON-NLS-1$
1178
			"}" + //$NON-NLS-1$
1179
			"return html"; //$NON-NLS-1$
1262
					"}" + //$NON-NLS-1$
1263
					"}" + //$NON-NLS-1$
1264
					"return html"; //$NON-NLS-1$
1180 1265
	
1181 1266
	public String getTextSelectionDOM() {
1182 1267
		
......
1225 1310
				+ "\n}" //$NON-NLS-1$
1226 1311
				// +"alert('result='+all)"
1227 1312
				+ "\nreturn all;"; //$NON-NLS-1$
1228
				
1313
		
1229 1314
		// System.out.println(functions);
1230 1315
		// System.out.println(SCRIPT02_getspans);
1231 1316
		
......
1253 1338
		}
1254 1339
	}
1255 1340
	
1341
	public boolean isTextSelectionEmpty() {
1342
		return browser.evaluate(EMPTYSELECTIONTEST).equals(true);
1343
	}
1344
	
1256 1345
	public String getTextSelection() {
1257 1346
		
1258 1347
		// System.out.println("DOM="+getTextSelectionDOM());
......
1458 1547
					@Override
1459 1548
					public boolean isEmpty() {
1460 1549
						if (EditionPanel.this.isDisposed()) return true;
1461
						return EditionPanel.this.getTextSelection().length() == 0;
1550
						boolean r = EditionPanel.this.getTextSelection().length() == 0; // EditionPanel.this.isTextSelectionEmpty();
1551
						//System.out.println("EMPTY? "+r);
1552
						return r;
1462 1553
					}
1463 1554
					
1464 1555
					@Override
......
1565 1656
				+ "sel.addRange(range);\n" //$NON-NLS-1$
1566 1657
				+ "\n" //$NON-NLS-1$
1567 1658
				+ "return null;"; //$NON-NLS-1$
1568
				
1659
		
1569 1660
		// System.out.println("Eval...\n"+SCRIPT02_expand);
1570 1661
		evaluate(SCRIPT02_expand);
1571 1662
		return;
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/CommandLink.java (revision 3432)
11 11
import org.eclipse.osgi.util.NLS;
12 12
import org.eclipse.swt.browser.Browser;
13 13
import org.eclipse.swt.browser.BrowserFunction;
14
import org.eclipse.swt.browser.LocationEvent;
15
import org.eclipse.swt.browser.LocationListener;
14 16
import org.eclipse.ui.IEditorPart;
15 17
import org.eclipse.ui.IWorkbenchWindow;
16 18
import org.eclipse.ui.PlatformUI;
......
42 44
	
43 45
	@Override
44 46
	public synchronized Object function(Object[] arguments) {
45
		
47
		//System.out.println("CALL: "+Arrays.toString(arguments));
46 48
		Log.finer("txmcommand() called: "+Arrays.toString(arguments));
47 49
		if (editor != null) {
48 50
			try { // TODO add option (or another browser command) to not force activated editor
49 51
				editor.getSite().getPage().activate(editor);
50 52
			}
51 53
			catch (Exception e) {
52
				System.out.println(e);
54
				Log.printStackTrace(e);
53 55
			}
54 56
		}
55 57
		ret = null;
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditor.java (revision 3432)
335 335
			public void partActivated(IWorkbenchPartReference partRef) {
336 336
				
337 337
				// FIXME: SJ: why? when opening a new Editor the view will be refreshed twice...
338
				//CorporaView.refresh();
339
			}
338
				CorporaView.refresh(); // this will refreshed the view selected element (this editor's result)
339
			} 
340 340
			
341 341
			@Override
342 342
			public void partBroughtToTop(IWorkbenchPartReference partRef) {}
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMBrowserEditor.java (revision 3432)
27 27
//
28 28
package org.txm.rcp.editors;
29 29

  
30
import java.io.File;
31

  
30 32
import org.eclipse.jface.action.MenuManager;
31 33
import org.eclipse.jface.text.ITextSelection;
32 34
import org.eclipse.jface.viewers.ISelection;
33 35
import org.eclipse.jface.viewers.ISelectionChangedListener;
34 36
import org.eclipse.jface.viewers.ISelectionProvider;
37
import org.eclipse.swt.SWT;
35 38
import org.eclipse.swt.browser.Browser;
36 39
import org.eclipse.swt.browser.ProgressEvent;
37 40
import org.eclipse.swt.browser.ProgressListener;
41
import org.eclipse.swt.events.DisposeEvent;
42
import org.eclipse.swt.events.DisposeListener;
43
import org.eclipse.swt.events.MenuEvent;
44
import org.eclipse.swt.events.MenuListener;
45
import org.eclipse.swt.events.SelectionEvent;
46
import org.eclipse.swt.events.SelectionListener;
38 47
import org.eclipse.swt.graphics.Image;
39 48
import org.eclipse.swt.widgets.Composite;
40 49
import org.eclipse.swt.widgets.Menu;
50
import org.eclipse.swt.widgets.MenuItem;
41 51
import org.eclipse.ui.internal.browser.BrowserViewer;
42 52
import org.eclipse.ui.internal.browser.WebBrowserEditor;
53
import org.txm.rcp.commands.ShowSelected;
43 54
import org.txm.rcp.messages.TXMUIMessages;
55
import org.txm.rcp.utils.IOClipboard;
44 56

  
45 57
/**
46 58
 * Call the internal browser of RCP specialized for TXM editions.
......
53 65
	
54 66
	/** The Constant ID. */
55 67
	public final static String ID = TXMBrowserEditor.class.getName(); //$NON-NLS-1$
56

  
68
	
57 69
	/**
58 70
	 * Instantiates a new TXM browser.
59 71
	 */
......
83 95
	
84 96
	CommandLink cmdLink;
85 97
	
98
	private MenuManager menuManager;
99
	
86 100
	/**
87 101
	 * 
88 102
	 * @param wordids2 all the words to highlight
......
98 112
			
99 113
			@Override
100 114
			public void completed(ProgressEvent event) {
101
				cmdLink = new CommandLink(TXMBrowserEditor.this, TXMBrowserEditor.this.getBrowser());
115
				
116
				Object o = TXMBrowserEditor.this.getBrowser().evaluate("return typeof " + CommandLink.FCT + ";");
117
				if ("undefined".equals(o)) {
118
					if (cmdLink != null) {
119
						cmdLink.dispose();
120
					}
121
					cmdLink = new CommandLink(TXMBrowserEditor.this, TXMBrowserEditor.this.getBrowser());
122
				}
102 123
			}
103 124
		};
104 125
		getBrowser().addProgressListener(progresslistener);
126
	}
127
	
128
	public void initMenu() {
105 129
		
130
		// create a new menu
131
		menuManager = new MenuManager();
132
		
133
		Menu menu = menuManager.createContextMenu(this.getBrowser());
134
		
135
		menu.addMenuListener(new MenuListener() {
136
			
137
			@Override
138
			public void menuShown(MenuEvent e) {
139
				
140
				Menu menu = menuManager.getMenu();
141
				if (menu == null) return;
142
				new MenuItem(menu, SWT.SEPARATOR);
143
				
144
				MenuItem copyItem = new MenuItem(menu, SWT.NONE);
145
				copyItem.setText("Copy");
146
				copyItem.addSelectionListener(new SelectionListener() {
147
					
148
					@Override
149
					public void widgetSelected(SelectionEvent e) {
150
						
151
						String text = TXMBrowserEditor.this.getTextSelection();
152
						if (text != null && text.length() > 0) {
153
							IOClipboard.write(text);
154
						}
155
					}
156
					
157
					@Override
158
					public void widgetDefaultSelected(SelectionEvent e) {}
159
				});
160
				String text = TXMBrowserEditor.this.getTextSelection();
161
				copyItem.setEnabled(text != null && text.length() > 0);
162
				
163
				MenuItem reloadItem = new MenuItem(menu, SWT.NONE);
164
				reloadItem.setText("Reload");
165
				reloadItem.addSelectionListener(new SelectionListener() {
166
					
167
					@Override
168
					public void widgetSelected(SelectionEvent e) {
169
						
170
						TXMBrowserEditor.this.getBrowser().refresh();
171
					}
172
					
173
					@Override
174
					public void widgetDefaultSelected(SelectionEvent e) {}
175
				});
176
				MenuItem backItem = new MenuItem(menu, SWT.NONE);
177
				backItem.setText("Back");
178
				backItem.addSelectionListener(new SelectionListener() {
179
					
180
					@Override
181
					public void widgetSelected(SelectionEvent e) {
182
						
183
						TXMBrowserEditor.this.getBrowser().back();
184
					}
185
					
186
					@Override
187
					public void widgetDefaultSelected(SelectionEvent e) {}
188
				});
189
				MenuItem forwardItem = new MenuItem(menu, SWT.NONE);
190
				forwardItem.setText("Forward");
191
				forwardItem.addSelectionListener(new SelectionListener() {
192
					
193
					@Override
194
					public void widgetSelected(SelectionEvent e) {
195
						
196
						TXMBrowserEditor.this.getBrowser().forward();
197
					}
198
					
199
					@Override
200
					public void widgetDefaultSelected(SelectionEvent e) {}
201
				});
202
				
203
				MenuItem propertiesItem = new MenuItem(menu, SWT.NONE);
204
				propertiesItem.setText("Properties");
205
				propertiesItem.addSelectionListener(new SelectionListener() {
206
					
207
					@Override
208
					public void widgetSelected(SelectionEvent e) {
209
						
210
						ShowSelected.print(new File(TXMBrowserEditor.this.getBrowser().getUrl()));
211
					}
212
					
213
					@Override
214
					public void widgetDefaultSelected(SelectionEvent e) {}
215
				});
216
			}
217
			
218
			@Override
219
			public void menuHidden(MenuEvent e) {
220
				// TODO Auto-generated method stub
221
			}
222
		});
223
		// // restore old listeners
224
		// Menu origMenu = this.browser.getMenu();
225
		// if (origMenu != null) {
226
		// if (origMenu.getListeners(SWT.Hide) != null)
227
		// for (Listener listener : origMenu.getListeners(SWT.Hide)) menu.addListener(SWT.Hide, listener);
228
		// if (origMenu.getListeners(SWT.Show) != null)
229
		// for (Listener listener : origMenu.getListeners(SWT.Show)) menu.addListener(SWT.Show, listener);
230
		// for (MenuItem origItem : origMenu.getItems()) { // restore old menu items
231
		// MenuItem item = new MenuItem(menu, origItem.getStyle());
232
		// item.setText(origItem.getText());
233
		// item.setImage(origItem.getImage());
234
		// if (origItem.getListeners(SWT.Selection) != null && origItem.getListeners(SWT.Selection).length > 0)
235
		// item.addListener(SWT.Selection, origItem.getListeners(SWT.Selection)[0]);
236
		// }
237
		// }
238
		// replace the menu
239
		this.getBrowser().setMenu(menu);
106 240
	}
107 241
	
108
//	/**
109
//	 * Sets the edition.
110
//	 *
111
//	 * @param edition the new edition
112
//	 */
113
//	public void setEdition(Edition edition) {
114
//		this.edition = edition;
115
//	}
242
	//	/**
243
	//	 * Sets the edition.
244
	//	 *
245
	//	 * @param edition the new edition
246
	//	 */
247
	//	public void setEdition(Edition edition) {
248
	//		this.edition = edition;
249
	//	}
116 250
	
117
//	/**
118
//	 * Make page label.
119
//	 *
120
//	 * @return the string
121
//	 */
122
//	public String makePageLabel() {
123
//		return currentPage.getName()
124
//				+ " / " + currentPage.getEdition().getNumPages(); //$NON-NLS-1$
125
//	}
126
//	
127
//	/**
128
//	 * Show page.
129
//	 *
130
//	 * @param page the page
131
//	 */
132
//	public void showPage(Page page) {
133
//		edition = page.getEdition();
134
//		currentPage = page;
135
//		this.webBrowser.setURL(currentPage.toURL());
136
//		page_label.setText(makePageLabel());
137
//	}
251
	//	/**
252
	//	 * Make page label.
253
	//	 *
254
	//	 * @return the string
255
	//	 */
256
	//	public String makePageLabel() {
257
	//		return currentPage.getName()
258
	//				+ " / " + currentPage.getEdition().getNumPages(); //$NON-NLS-1$
259
	//	}
260
	//	
261
	//	/**
262
	//	 * Show page.
263
	//	 *
264
	//	 * @param page the page
265
	//	 */
266
	//	public void showPage(Page page) {
267
	//		edition = page.getEdition();
268
	//		currentPage = page;
269
	//		this.webBrowser.setURL(currentPage.toURL());
270
	//		page_label.setText(makePageLabel());
271
	//	}
138 272
	
139
//	/**
140
//	 * First text.
141
//	 */
142
//	public void firstText() {
143
//		Text current = this.currentPage.getEdition().getText();
144
//		Project corpus = current.getProject();
145
//		Text firstText = corpus.getFirstText();
146
//		
147
//		if (firstText != null) {
148
//			String editionName = corpus.getDefaultEditionName();
149
//			currentPage = firstText.getEdition(editionName).getFirstPage();
150
//			if (currentPage == null) {
151
//				StatusLine.setMessage(TXMUIMessages.noPreviousText);
152
//				return;
153
//			}
154
//			this.setEdition(firstText.getEdition(editionName));
155
//			this.webBrowser.setURL(currentPage.toURL());
156
//			page_label.setText(makePageLabel());
157
//		}
158
//	}
159
//	
160
//	/**
161
//	 * Last text.
162
//	 */
163
//	public void lastText() {
164
//		Text current = this.currentPage.getEdition().getText();
165
//		Project b = current.getProject();
166
//		Text lastText = b.getLastText();
167
//		
168
//		if (lastText != null) {
169
//			currentPage = lastText.getEdition(b.getDefaultEditionName()).getFirstPage();
170
//			if (currentPage == null) {
171
//				StatusLine.setMessage(TXMUIMessages.noTextNext);
172
//				return;
173
//			}
174
//			this.setEdition(lastText.getEdition(b.getDefaultEditionName()));
175
//			this.webBrowser.setURL(currentPage.toURL());
176
//			page_label.setText(makePageLabel());
177
//		}
178
//	}
179
//	
180
//	/**
181
//	 * First page.
182
//	 */
183
//	public void firstPage() {
184
//		// System.out.println(Messages.TxmBrowser_1+currentPage);
185
//		currentPage = edition.getFirstPage();
186
//		this.webBrowser.setURL(currentPage.toURL());
187
//		page_label.setText(makePageLabel());
188
//	}
189
//	
190
//	/**
191
//	 * Last page.
192
//	 */
193
//	public void lastPage() {
194
//		// System.out.println(Messages.TxmBrowser_2+currentPage);
195
//		
196
//		if (currentPage != null && currentPage.getFile().equals(edition.getLastPage().getFile()))
197
//			return;
198
//		currentPage = edition.getLastPage();
199
//		this.webBrowser.setURL(currentPage.toURL());
200
//		page_label.setText(makePageLabel());
201
//	}
202
//	
203
//	/**
204
//	 * Previous page.
205
//	 */
206
//	public void previousPage() {
207
//		// System.out.println(Messages.TxmBrowser_3+currentPage);
208
//		if (currentPage != null) {
209
//			Page previous = edition.getPreviousPage(currentPage);
210
//			if (previous == currentPage) {
211
//				previousText(true);
212
//			}
213
//			else {
214
//				currentPage = previous;
215
//				this.webBrowser.setURL(currentPage.toURL());
216
//			}
217
//		}
218
//		else
219
//			firstPage();
220
//		page_label.setText(makePageLabel());
221
//	}
222
//	
223
//	/**
224
//	 * Next page.
225
//	 */
226
//	public void nextPage() {
227
//		// System.out.println(Messages.TxmBrowser_4+currentPage);
228
//		if (currentPage != null) {
229
//			Page next = edition.getNextPage(currentPage);
230
//			if (currentPage == next) {
231
//				nextText();
232
//			}
233
//			else {
234
//				currentPage = next;
235
//				this.webBrowser.setURL(currentPage.toURL());
236
//			}
237
//			
238
//		}
239
//		else
240
//			firstPage();
241
//		page_label.setText(makePageLabel());
242
//	}
243
//	
244
//	/**
245
//	 * Previous text.
246
//	 * 
247
//	 * @param fromNextText
248
//	 */
249
//	public void previousText(boolean fromNextText) {
250
//		
251
//		Text current = this.currentPage.getEdition().getText();
252
//		Project corpus = current.getProject();
253
//		Text previousText = corpus.getPreviousText(current);
254
//		
255
//		if (previousText != null) {
256
//			String editionName = corpus.getDefaultEditionName();
257
//			if (fromNextText) {
258
//				currentPage = previousText.getEdition(editionName).getLastPage();
259
//			}
260
//			else {
261
//				currentPage = previousText.getEdition(editionName).getFirstPage();
262
//			}
263
//			if (currentPage == null) {
264
//				StatusLine.setMessage(TXMUIMessages.noPreviousText);
265
//				return;
266
//			}
267
//			this.setEdition(previousText.getEdition(editionName));
268
//			this.webBrowser.setURL(currentPage.toURL());
269
//			page_label.setText(makePageLabel());
270
//		}
271
//		// System.out.println("Previous texts "+previousText);
272
//	}
273
//	
274
//	/**
275
//	 * Next text.
276
//	 */
277
//	public void nextText() {
278
//		Text current = this.currentPage.getEdition().getText();
279
//		Project b = current.getProject();
280
//		Text nextText = b.getNextText(current);
281
//		
282
//		if (nextText != null) {
283
//			currentPage = nextText.getEdition(b.getDefaultEditionName()).getFirstPage();
284
//			if (currentPage == null) {
285
//				StatusLine.setMessage(TXMUIMessages.noTextNext);
286
//				return;
287
//			}
288
//			this.setEdition(nextText.getEdition(b.getDefaultEditionName()));
289
//			this.webBrowser.setURL(currentPage.toURL());
290
//			page_label.setText(makePageLabel());
291
//		}
292
//		// System.out.println("Next texts "+nextText);
293
//	}
273
	//	/**
274
	//	 * First text.
275
	//	 */
276
	//	public void firstText() {
277
	//		Text current = this.currentPage.getEdition().getText();
278
	//		Project corpus = current.getProject();
279
	//		Text firstText = corpus.getFirstText();
280
	//		
281
	//		if (firstText != null) {
282
	//			String editionName = corpus.getDefaultEditionName();
283
	//			currentPage = firstText.getEdition(editionName).getFirstPage();
284
	//			if (currentPage == null) {
285
	//				StatusLine.setMessage(TXMUIMessages.noPreviousText);
286
	//				return;
287
	//			}
288
	//			this.setEdition(firstText.getEdition(editionName));
289
	//			this.webBrowser.setURL(currentPage.toURL());
290
	//			page_label.setText(makePageLabel());
291
	//		}
292
	//	}
293
	//	
294
	//	/**
295
	//	 * Last text.
296
	//	 */
297
	//	public void lastText() {
298
	//		Text current = this.currentPage.getEdition().getText();
299
	//		Project b = current.getProject();
300
	//		Text lastText = b.getLastText();
301
	//		
302
	//		if (lastText != null) {
303
	//			currentPage = lastText.getEdition(b.getDefaultEditionName()).getFirstPage();
304
	//			if (currentPage == null) {
305
	//				StatusLine.setMessage(TXMUIMessages.noTextNext);
306
	//				return;
307
	//			}
308
	//			this.setEdition(lastText.getEdition(b.getDefaultEditionName()));
309
	//			this.webBrowser.setURL(currentPage.toURL());
310
	//			page_label.setText(makePageLabel());
311
	//		}
312
	//	}
313
	//	
314
	//	/**
315
	//	 * First page.
316
	//	 */
317
	//	public void firstPage() {
318
	//		// System.out.println(Messages.TxmBrowser_1+currentPage);
319
	//		currentPage = edition.getFirstPage();
320
	//		this.webBrowser.setURL(currentPage.toURL());
321
	//		page_label.setText(makePageLabel());
322
	//	}
323
	//	
324
	//	/**
325
	//	 * Last page.
326
	//	 */
327
	//	public void lastPage() {
328
	//		// System.out.println(Messages.TxmBrowser_2+currentPage);
329
	//		
330
	//		if (currentPage != null && currentPage.getFile().equals(edition.getLastPage().getFile()))
331
	//			return;
332
	//		currentPage = edition.getLastPage();
333
	//		this.webBrowser.setURL(currentPage.toURL());
334
	//		page_label.setText(makePageLabel());
335
	//	}
336
	//	
337
	//	/**
338
	//	 * Previous page.
339
	//	 */
340
	//	public void previousPage() {
341
	//		// System.out.println(Messages.TxmBrowser_3+currentPage);
342
	//		if (currentPage != null) {
343
	//			Page previous = edition.getPreviousPage(currentPage);
344
	//			if (previous == currentPage) {
345
	//				previousText(true);
346
	//			}
347
	//			else {
348
	//				currentPage = previous;
349
	//				this.webBrowser.setURL(currentPage.toURL());
350
	//			}
351
	//		}
352
	//		else
353
	//			firstPage();
354
	//		page_label.setText(makePageLabel());
355
	//	}
356
	//	
357
	//	/**
358
	//	 * Next page.
359
	//	 */
360
	//	public void nextPage() {
361
	//		// System.out.println(Messages.TxmBrowser_4+currentPage);
362
	//		if (currentPage != null) {
363
	//			Page next = edition.getNextPage(currentPage);
364
	//			if (currentPage == next) {
365
	//				nextText();
366
	//			}
367
	//			else {
368
	//				currentPage = next;
369
	//				this.webBrowser.setURL(currentPage.toURL());
370
	//			}
371
	//			
372
	//		}
373
	//		else
374
	//			firstPage();
375
	//		page_label.setText(makePageLabel());
376
	//	}
377
	//	
378
	//	/**
379
	//	 * Previous text.
380
	//	 * 
381
	//	 * @param fromNextText
382
	//	 */
383
	//	public void previousText(boolean fromNextText) {
384
	//		
385
	//		Text current = this.currentPage.getEdition().getText();
386
	//		Project corpus = current.getProject();
387
	//		Text previousText = corpus.getPreviousText(current);
388
	//		
389
	//		if (previousText != null) {
390
	//			String editionName = corpus.getDefaultEditionName();
391
	//			if (fromNextText) {
392
	//				currentPage = previousText.getEdition(editionName).getLastPage();
393
	//			}
394
	//			else {
395
	//				currentPage = previousText.getEdition(editionName).getFirstPage();
396
	//			}
397
	//			if (currentPage == null) {
398
	//				StatusLine.setMessage(TXMUIMessages.noPreviousText);
399
	//				return;
400
	//			}
401
	//			this.setEdition(previousText.getEdition(editionName));
402
	//			this.webBrowser.setURL(currentPage.toURL());
403
	//			page_label.setText(makePageLabel());
404
	//		}
405
	//		// System.out.println("Previous texts "+previousText);
406
	//	}
407
	//	
408
	//	/**
409
	//	 * Next text.
410
	//	 */
411
	//	public void nextText() {
412
	//		Text current = this.currentPage.getEdition().getText();
413
	//		Project b = current.getProject();
414
	//		Text nextText = b.getNextText(current);
415
	//		
416
	//		if (nextText != null) {
417
	//			currentPage = nextText.getEdition(b.getDefaultEditionName()).getFirstPage();
418
	//			if (currentPage == null) {
419
	//				StatusLine.setMessage(TXMUIMessages.noTextNext);
420
	//				return;
421
	//			}
422
	//			this.setEdition(nextText.getEdition(b.getDefaultEditionName()));
423
	//			this.webBrowser.setURL(currentPage.toURL());
424
	//			page_label.setText(makePageLabel());
425
	//		}
426
	//		// System.out.println("Next texts "+nextText);
427
	//	}
294 428
	
295 429
	/*
296 430
	 * (non-Javadoc)
......
300 434
	public void createPartControl(Composite parent) {
301 435
		try {
302 436
			super.createPartControl(parent);
437
			
438
			cmdLink = new CommandLink(TXMBrowserEditor.this, TXMBrowserEditor.this.getBrowser());
439
			
440
			parent.addDisposeListener(new DisposeListener() {
441
				
442
				@Override
443
				public void widgetDisposed(DisposeEvent e) {
444
					
445
					cmdLink.dispose();
446
				}
447
			});
448
			
303 449
		}
304 450
		catch (Exception e) {
305 451
			System.err.println(TXMUIMessages.couldNotLaunchTheInternalWebBrowserYouMustSetThatParameterInThePreferencesMenuColonGeneralSupWebNavigator);
306 452
			return;
307 453
		}
308 454
		
309
//		RowLayout navigLayout = new RowLayout(SWT.HORIZONTAL);
310
//		navigLayout.justify = true;
311
//		Composite panneau = new Composite(parent, SWT.NONE);
312
//		panneau.setLayout(navigLayout);
313
//		
314
//		RowLayout subLayout = new RowLayout(SWT.HORIZONTAL);
315
//		subLayout.pack = true;
316
//		subLayout.center = true;
317
//		subLayout.marginBottom = subLayout.marginHeight = 0;
318
//		subLayout.marginTop = subLayout.marginWidth = 0;
319
//		Composite subPanneau = new Composite(panneau, SWT.NONE);
320
//		subPanneau.setLayout(subLayout);
321
//		subPanneau.setLayoutData(new RowData(450, 22));
322
//		
323
//		Button firstText = new Button(subPanneau, SWT.FLAT);
324
//		Button previousText = new Button(subPanneau, SWT.FLAT);
325
//		Button first = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
326
//		Button previous = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
327
//		page_label = new Label(subPanneau, SWT.NONE);
328
//		Button next = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
329
//		Button last = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
330
//		Button nextText = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
331
//		Button lastText = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
332
//		
333
//		// set sizes
334
//		page_label.setLayoutData(new RowData(50, 20));
335
//		firstText.setLayoutData(new RowData(30, 20));
336
//		first.setLayoutData(new RowData(30, 20));
337
//		previous.setLayoutData(new RowData(30, 20));
338
//		next.setLayoutData(new RowData(30, 20));
339
//		last.setLayoutData(new RowData(30, 20));
340
//		nextText.setLayoutData(new RowData(30, 20));
341
//		previousText.setLayoutData(new RowData(30, 20));
342
//		lastText.setLayoutData(new RowData(30, 20));
455
		//		RowLayout navigLayout = new RowLayout(SWT.HORIZONTAL);
456
		//		navigLayout.justify = true;
457
		//		Composite panneau = new Composite(parent, SWT.NONE);
458
		//		panneau.setLayout(navigLayout);
459
		//		
460
		//		RowLayout subLayout = new RowLayout(SWT.HORIZONTAL);
461
		//		subLayout.pack = true;
462
		//		subLayout.center = true;
463
		//		subLayout.marginBottom = subLayout.marginHeight = 0;
464
		//		subLayout.marginTop = subLayout.marginWidth = 0;
465
		//		Composite subPanneau = new Composite(panneau, SWT.NONE);
466
		//		subPanneau.setLayout(subLayout);
467
		//		subPanneau.setLayoutData(new RowData(450, 22));
468
		//		
469
		//		Button firstText = new Button(subPanneau, SWT.FLAT);
470
		//		Button previousText = new Button(subPanneau, SWT.FLAT);
471
		//		Button first = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
472
		//		Button previous = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
473
		//		page_label = new Label(subPanneau, SWT.NONE);
474
		//		Button next = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
475
		//		Button last = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
476
		//		Button nextText = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
477
		//		Button lastText = new Button(subPanneau, SWT.FLAT | SWT.PUSH);
478
		//		
479
		//		// set sizes
480
		//		page_label.setLayoutData(new RowData(50, 20));
481
		//		firstText.setLayoutData(new RowData(30, 20));
482
		//		first.setLayoutData(new RowData(30, 20));
483
		//		previous.setLayoutData(new RowData(30, 20));
484
		//		next.setLayoutData(new RowData(30, 20));
485
		//		last.setLayoutData(new RowData(30, 20));
486
		//		nextText.setLayoutData(new RowData(30, 20));
487
		//		previousText.setLayoutData(new RowData(30, 20));
488
		//		lastText.setLayoutData(new RowData(30, 20));
343 489
		
344 490
		
345
//		// set labels
346
//		page_label.setText(""); //$NON-NLS-1$
347
//		firstText.setImage(IImageKeys.getImage(IImageKeys.CTRLREWINDSTART));
348
//		firstText.setToolTipText("|<<");
349
//		previousText.setImage(IImageKeys.getImage(IImageKeys.CTRLREWIND));
350
//		previousText.setToolTipText(TXMUIMessages.previousText);
351
//		first.setImage(IImageKeys.getImage(IImageKeys.CTRLSTART));
352
//		first.setToolTipText(TXMUIMessages.common_beginning);
353
//		previous.setImage(IImageKeys.getImage(IImageKeys.CTRLREVERSE));
354
//		previous.setToolTipText(TXMUIMessages.previousPage);
355
//		next.setImage(IImageKeys.getImage(IImageKeys.CTRLPLAY));
356
//		next.setToolTipText(TXMUIMessages.nextPage);
357
//		last.setImage(IImageKeys.getImage(IImageKeys.CTRLEND));
358
//		last.setToolTipText(TXMUIMessages.common_end);
359
//		nextText.setImage(IImageKeys.getImage(IImageKeys.CTRLFASTFORWARD));
360
//		nextText.setToolTipText(TXMUIMessages.nextText);
361
//		lastText.setImage(IImageKeys.getImage(IImageKeys.CTRLFASTFORWARDEND));
362
//		lastText.setToolTipText(">>|");
363
//		
364
//		
365
//		// set listeners
366
//		first.addSelectionListener(new SelectionListener() {
367
//			
368
//			@Override
369
//			public void widgetDefaultSelected(SelectionEvent e) {
370
//				firstPage();
371
//			}
372
//			
373
//			@Override
374
//			public void widgetSelected(SelectionEvent e) {
375
//				firstPage();
376
//			}
377
//		});
378
//		previous.addSelectionListener(new SelectionListener() {
379
//			
380
//			@Override
381
//			public void widgetDefaultSelected(SelectionEvent e) {
382
//				previousPage();
383
//			}
384
//			
385
//			@Override
386
//			public void widgetSelected(SelectionEvent e) {
387
//				previousPage();
388
//			}
389
//		});
390
//		next.addSelectionListener(new SelectionListener() {
391
//			
392
//			@Override
393
//			public void widgetDefaultSelected(SelectionEvent e) {
394
//				nextPage();
395
//			}
396
//			
397
//			@Override
398
//			public void widgetSelected(SelectionEvent e) {
399
//				nextPage();
400
//			}
401
//		});
402
//		last.addSelectionListener(new SelectionListener() {
403
//			
404
//			@Override
405
//			public void widgetDefaultSelected(SelectionEvent e) {
406
//				lastPage();
407
//			}
408
//			
409
//			@Override
410
//			public void widgetSelected(SelectionEvent e) {
411
//				lastPage();
412
//			}
413
//		});
414
//		nextText.addSelectionListener(new SelectionListener() {
415
//			
416
//			@Override
417
//			public void widgetDefaultSelected(SelectionEvent e) {
418
//				nextText();
419
//			}
420
//			
421
//			@Override
422
//			public void widgetSelected(SelectionEvent e) {
423
//				nextText();
424
//			}
425
//		});
426
//		// set listeners
427
//		previousText.addSelectionListener(new SelectionListener() {
428
//			
429
//			@Override
430
//			public void widgetDefaultSelected(SelectionEvent e) {
431
//				previousText(false);
432
//			}
433
//			
434
//			@Override
435
//			public void widgetSelected(SelectionEvent e) {
436
//				previousText(false);
437
//			}
438
//		});
439
//		lastText.addSelectionListener(new SelectionListener() {
440
//			
441
//			@Override
442
//			public void widgetDefaultSelected(SelectionEvent e) {
443
//				lastText();
444
//			}
445
//			
446
//			@Override
447
//			public void widgetSelected(SelectionEvent e) {
448
//				lastText();
449
//			}
450
//		});
451
//		// set listeners
452
//		firstText.addSelectionListener(new SelectionListener() {
453
//			
454
//			@Override
455
//			public void widgetDefaultSelected(SelectionEvent e) {
456
//				firstText();
457
//			}
458
//			
459
//			@Override
460
//			public void widgetSelected(SelectionEvent e) {
461
//				firstText();
462
//			}
463
//		});
464
//		
465
//		subPanneau.pack();
466
//		panneau.pack();
491
		//		// set labels
492
		//		page_label.setText(""); //$NON-NLS-1$
493
		//		firstText.setImage(IImageKeys.getImage(IImageKeys.CTRLREWINDSTART));
494
		//		firstText.setToolTipText("|<<");
495
		//		previousText.setImage(IImageKeys.getImage(IImageKeys.CTRLREWIND));
496
		//		previousText.setToolTipText(TXMUIMessages.previousText);
497
		//		first.setImage(IImageKeys.getImage(IImageKeys.CTRLSTART));
498
		//		first.setToolTipText(TXMUIMessages.common_beginning);
499
		//		previous.setImage(IImageKeys.getImage(IImageKeys.CTRLREVERSE));
500
		//		previous.setToolTipText(TXMUIMessages.previousPage);
501
		//		next.setImage(IImageKeys.getImage(IImageKeys.CTRLPLAY));
502
		//		next.setToolTipText(TXMUIMessages.nextPage);
503
		//		last.setImage(IImageKeys.getImage(IImageKeys.CTRLEND));
504
		//		last.setToolTipText(TXMUIMessages.common_end);
505
		//		nextText.setImage(IImageKeys.getImage(IImageKeys.CTRLFASTFORWARD));
506
		//		nextText.setToolTipText(TXMUIMessages.nextText);
507
		//		lastText.setImage(IImageKeys.getImage(IImageKeys.CTRLFASTFORWARDEND));
508
		//		lastText.setToolTipText(">>|");
509
		//		
510
		//		
511
		//		// set listeners
512
		//		first.addSelectionListener(new SelectionListener() {
513
		//			
514
		//			@Override
515
		//			public void widgetDefaultSelected(SelectionEvent e) {
516
		//				firstPage();
517
		//			}
518
		//			
519
		//			@Override
520
		//			public void widgetSelected(SelectionEvent e) {
521
		//				firstPage();
522
		//			}
523
		//		});
524
		//		previous.addSelectionListener(new SelectionListener() {
525
		//			
526
		//			@Override
527
		//			public void widgetDefaultSelected(SelectionEvent e) {
528
		//				previousPage();
529
		//			}
530
		//			
531
		//			@Override
532
		//			public void widgetSelected(SelectionEvent e) {
533
		//				previousPage();
534
		//			}
535
		//		});
536
		//		next.addSelectionListener(new SelectionListener() {
537
		//			
538
		//			@Override
539
		//			public void widgetDefaultSelected(SelectionEvent e) {
540
		//				nextPage();
541
		//			}
542
		//			
543
		//			@Override
544
		//			public void widgetSelected(SelectionEvent e) {
545
		//				nextPage();
546
		//			}
547
		//		});
548
		//		last.addSelectionListener(new SelectionListener() {
549
		//			
550
		//			@Override
551
		//			public void widgetDefaultSelected(SelectionEvent e) {
552
		//				lastPage();
553
		//			}
554
		//			
555
		//			@Override
556
		//			public void widgetSelected(SelectionEvent e) {
557
		//				lastPage();
558
		//			}
559
		//		});
560
		//		nextText.addSelectionListener(new SelectionListener() {
561
		//			
562
		//			@Override
563
		//			public void widgetDefaultSelected(SelectionEvent e) {
564
		//				nextText();
565
		//			}
566
		//			
567
		//			@Override
568
		//			public void widgetSelected(SelectionEvent e) {
569
		//				nextText();
570
		//			}
571
		//		});
572
		//		// set listeners
573
		//		previousText.addSelectionListener(new SelectionListener() {
574
		//			
575
		//			@Override
576
		//			public void widgetDefaultSelected(SelectionEvent e) {
577
		//				previousText(false);
578
		//			}
579
		//			
580
		//			@Override
581
		//			public void widgetSelected(SelectionEvent e) {
582
		//				previousText(false);
583
		//			}
584
		//		});
585
		//		lastText.addSelectionListener(new SelectionListener() {
586
		//			
587
		//			@Override
588
		//			public void widgetDefaultSelected(SelectionEvent e) {
589
		//				lastText();
590
		//			}
591
		//			
592
		//			@Override
593
		//			public void widgetSelected(SelectionEvent e) {
594
		//				lastText();
595
		//			}
596
		//		});
597
		//		// set listeners
598
		//		firstText.addSelectionListener(new SelectionListener() {
599
		//			
600
		//			@Override
601
		//			public void widgetDefaultSelected(SelectionEvent e) {
602
		//				firstText();
603
		//			}
604
		//			
605
		//			@Override
606
		//			public void widgetSelected(SelectionEvent e) {
607
		//				firstText();
608
		//			}
609
		//		});
610
		//		
611
		//		subPanneau.pack();
612
		//		panneau.pack();
467 613
		
468
//		FormLayout parentLayout = new FormLayout();
614
		//		FormLayout parentLayout = new FormLayout();
469 615
		
470
//		FormData datatop = new FormData();
471
//		datatop.top = new FormAttachment(0, 0);
472
//		datatop.left = new FormAttachment(0, 0);
473
//		datatop.right = new FormAttachment(100, 0);
474
//		datatop.bottom = new FormAttachment(panneau, 0);
475
//		webBrowser.setLayoutData(datatop);
616
		//		FormData datatop = new FormData();
617
		//		datatop.top = new FormAttachment(0, 0);
618
		//		datatop.left = new FormAttachment(0, 0);
619
		//		datatop.right = new FormAttachment(100, 0);
620
		//		datatop.bottom = new FormAttachment(panneau, 0);
621
		//		webBrowser.setLayoutData(datatop);
622
		//		
623
		//		FormData databottom = new FormData(200, 30);
624
		//		databottom.bottom = new FormAttachment(100, 0);
625
		//		databottom.left = new FormAttachment(30, -100);
626
		//		databottom.right = new FormAttachment(80, 100);
627
		//		panneau.setLayoutData(databottom);
628
		//		
629
		//		parent.setLayout(parentLayout);
630
		//		parent.pack();
631
		
632
//		MenuManager menuManager = new MenuManager();
633
//		Menu menu = menuManager.createContextMenu(getBrowser());
476 634
//		
477
//		FormData databottom = new FormData(200, 30);
478
//		databottom.bottom = new FormAttachment(100, 0);
479
//		databottom.left = new FormAttachment(30, -100);
480
//		databottom.right = new FormAttachment(80, 100);
481
//		panneau.setLayoutData(databottom);
482
//		
483
//		parent.setLayout(parentLayout);
484
//		parent.pack();
635
//		// Set the MenuManager
636
//		getBrowser().setMenu(menu);
485 637
		
486
		MenuManager menuManager = new MenuManager();
487
		Menu menu = menuManager.createContextMenu(getBrowser());
638
		initMenu();
488 639
		
489
		// Set the MenuManager
490
		getBrowser().setMenu(menu);
491 640
		ISelectionProvider selProvider = new ISelectionProvider() {
492 641
			
493 642
			@Override
......
594 743
		return ((String) getBrowser().evaluate(SCRIPT01));
595 744
	}
596 745
	
597
//	public Object getWordIDsSelection() {
598
//		System.out.println("WORDS IDS " + getBrowser().evaluate(SCRIPT02));
599
//		return getBrowser().evaluate(SCRIPT02);
600
//	}
746
	//	public Object getWordIDsSelection() {
747
	//		System.out.println("WORDS IDS " + getBrowser().evaluate(SCRIPT02));
748
	//		return getBrowser().evaluate(SCRIPT02);
749
	//	}
601 750
	
602 751
	public String getTextSelection() {
603
		System.out.println("DOM=" + getTextSelectionDOM());
752
		//System.out.println("DOM=" + getTextSelectionDOM());
604 753
		String rez = getTextSelectionDOM().replaceAll("<[^>]+>", "");
605
		System.out.println("STR=" + rez);
754
		//System.out.println("STR=" + rez);
606 755
		return rez;
607 756
	}
608 757
	
609
//	/**
610
//	 * Gets the current page.
611
//	 *
612
//	 * @return the current page
613
//	 */
614
//	public Page getCurrentPage() {
615
//		return currentPage;
616
//	}
758
	//	/**
759
	//	 * Gets the current page.
760
	//	 *
761
	//	 * @return the current page
762
	//	 */
763
	//	public Page getCurrentPage() {
764
	//		return currentPage;
765
	//	}
617 766
}
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/swt/GLComposite.java (revision 3432)
34 34
		this.name = name;
35 35
	}
36 36
	
37
//	@Override
38
//	public void dispose() {
39
//		System.out.println("Disposing: "+this.name);
40
//		super.dispose();
41
//	}
42
	
37 43
	/**
38 44
	 * Warning : this composite layout cannot be changed
39 45
	 */
TXM/trunk/org.txm.rcp/src/main/java/org/txm/rcp/commands/function/WordPropertiesFromTable.java (revision 3432)
3 3
import java.io.File;
4 4
import java.util.HashMap;
5 5

  
6
import org.apache.commons.lang.StringUtils;
7 6
import org.eclipse.core.commands.AbstractHandler;
8 7
import org.eclipse.core.commands.ExecutionEvent;
9 8
import org.eclipse.core.commands.ExecutionException;
......
12 11
import org.eclipse.ui.handlers.HandlerUtil;
13 12
import org.txm.Toolbox;
14 13
import org.txm.rcp.handlers.scripts.ExecuteGroovyMacro;
15
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
16 14
import org.txm.searchengine.cqp.corpus.MainCorpus;
17 15
import org.txm.utils.logger.Log;
18 16

  
......
32 30
		MainCorpus corpus = (MainCorpus)first;
33 31
		
34 32
		File script = new File(Toolbox.getTxmHomePath(),         "/scripts/groovy/user/org/txm/macro/annotation/ImportWordPropertiesFromTableMacro.groovy");
35
		File parametersFile = new File(Toolbox.getTxmHomePath(), "/scripts/groovy/user/org/txm/macro/annotation/ImportWordPropertiesFromTableMacro.properties");
33
		//File parametersFile = new File(Toolbox.getTxmHomePath(), "/scripts/groovy/user/org/txm/macro/annotation/ImportWordPropertiesFromTableMacro.properties");
36 34

  
37 35
		HashMap<String, Object> defaultParameters = new HashMap<String, Object>();
38 36
		defaultParameters.put("properties", "frpos,frlemma");

Formats disponibles : Unified diff