Révision 1053

tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionLink.java (revision 1053)
5 5
import org.eclipse.swt.browser.Browser;
6 6
import org.eclipse.swt.browser.BrowserFunction;
7 7
import org.txm.edition.rcp.handlers.BackToText;
8
import org.txm.edition.rcp.messages.EditionUIMessages;
8 9

  
9 10
public class EditionLink extends BrowserFunction {
10
		String data = "";
11
		Browser browser;
12
		SynopticEditionEditor synopticEditionEditor;
13
		EditionLink (SynopticEditionEditor synopticEditionEditor, Browser browser) {
14
			super (browser, "txmedition");
15
			this.browser = browser;
16
			this.synopticEditionEditor = synopticEditionEditor;
17
		}
18
		public Object function (Object[] arguments) { // corpus id, edition id, text id, word id
19
			HashMap<String, String> params = new HashMap<String, String>();
20 11

  
21
			String id = BackToText.class.getName();
12
	String data = ""; //$NON-NLS-1$
13
	Browser browser;
14
	SynopticEditionEditor synopticEditionEditor;
22 15

  
23
			if (arguments.length == 4) {
24
				params.put(id+".corpusid", arguments[0].toString());
25
				params.put(id+".editionid", arguments[1].toString());
26
				params.put(id+".textid", arguments[2].toString());
27
				params.put(id+".wordid", arguments[3].toString());
28
			} else if (arguments.length == 3) {
29
				params.put(id+".corpusid", arguments[0].toString());
30
				params.put(id+".editionid", arguments[1].toString());
31
				params.put(id+".textid", arguments[2].toString());
32
				params.put(id+".wordid", null);
33
			} else if (arguments.length == 2) {
34
				params.put(id+".corpusid", arguments[0].toString());
35
				params.put(id+".editionid", arguments[1].toString());
36
				params.put(id+".textid", null);
37
				params.put(id+".wordid", null);
38
			} else if (arguments.length == 1) {
39
				params.put(id+".corpusid", arguments[0].toString());
40
				params.put(id+".editionid", null);
41
				params.put(id+".textid", null);
42
				params.put(id+".wordid", null);
43
			} else {
44
				System.out.println("Error: txmedition(corpusid, editionid?, textid?, wordid?) called with no arguments");
45
				return null;
46
			}
16
	EditionLink (SynopticEditionEditor synopticEditionEditor, Browser browser) {
17
		super (browser, "txmedition"); //$NON-NLS-1$
18
		this.browser = browser;
19
		this.synopticEditionEditor = synopticEditionEditor;
20
	}
47 21

  
48
			return SynopticEditionEditor.callTXMCommand(id, params);
22
	public Object function (Object[] arguments) { // corpus id, edition id, text id, word id
23
		HashMap<String, String> params = new HashMap<String, String>();
24

  
25
		String id = BackToText.class.getName();
26

  
27
		if (arguments.length == 4) {
28
			params.put(id+".corpusid", arguments[0].toString()); //$NON-NLS-1$
29
			params.put(id+".editionid", arguments[1].toString()); //$NON-NLS-1$
30
			params.put(id+".textid", arguments[2].toString()); //$NON-NLS-1$
31
			params.put(id+".wordid", arguments[3].toString()); //$NON-NLS-1$
32
		} else if (arguments.length == 3) {
33
			params.put(id+".corpusid", arguments[0].toString()); //$NON-NLS-1$
34
			params.put(id+".editionid", arguments[1].toString()); //$NON-NLS-1$
35
			params.put(id+".textid", arguments[2].toString()); //$NON-NLS-1$
36
			params.put(id+".wordid", null); //$NON-NLS-1$
37
		} else if (arguments.length == 2) {
38
			params.put(id+".corpusid", arguments[0].toString()); //$NON-NLS-1$
39
			params.put(id+".editionid", arguments[1].toString()); //$NON-NLS-1$
40
			params.put(id+".textid", null); //$NON-NLS-1$
41
			params.put(id+".wordid", null); //$NON-NLS-1$
42
		} else if (arguments.length == 1) {
43
			params.put(id+".corpusid", arguments[0].toString()); //$NON-NLS-1$
44
			params.put(id+".editionid", null); //$NON-NLS-1$
45
			params.put(id+".textid", null); //$NON-NLS-1$
46
			params.put(id+".wordid", null); //$NON-NLS-1$
47
		} else {
48
			System.out.println(EditionUIMessages.EditionLink_error_no_arguments);
49
			return null;
49 50
		}
50
	}
51

  
52
		return SynopticEditionEditor.callTXMCommand(id, params);
53
	}
54
}
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/EditionPanel.java (revision 1053)
11 11
import java.util.Set;
12 12
import java.util.logging.Level;
13 13

  
14
import org.eclipse.core.commands.Command;
15
import org.eclipse.core.commands.ExecutionException;
16
import org.eclipse.core.commands.IParameter;
17
import org.eclipse.core.commands.NotEnabledException;
18
import org.eclipse.core.commands.NotHandledException;
19
import org.eclipse.core.commands.Parameterization;
20
import org.eclipse.core.commands.ParameterizedCommand;
21
import org.eclipse.core.commands.common.NotDefinedException;
22 14
import org.eclipse.core.runtime.FileLocator;
23 15
import org.eclipse.core.runtime.Platform;
24 16
import org.eclipse.jface.action.MenuManager;
......
28 20
import org.eclipse.jface.viewers.ISelectionProvider;
29 21
import org.eclipse.swt.SWT;
30 22
import org.eclipse.swt.browser.Browser;
31
import org.eclipse.swt.browser.BrowserFunction;
32 23
import org.eclipse.swt.browser.ProgressEvent;
33 24
import org.eclipse.swt.browser.ProgressListener;
34 25
import org.eclipse.swt.events.MenuEvent;
......
38 29
import org.eclipse.swt.widgets.Composite;
39 30
import org.eclipse.swt.widgets.Menu;
40 31
import org.eclipse.swt.widgets.MenuItem;
41
import org.eclipse.ui.IWorkbenchWindow;
42
import org.eclipse.ui.PlatformUI;
43
import org.eclipse.ui.commands.ICommandService;
44
import org.eclipse.ui.handlers.IHandlerService;
45 32
import org.eclipse.ui.internal.browser.BrowserViewer;
46 33
import org.osgi.framework.Bundle;
47
import org.txm.concordance.rcp.actions.BackToText;
48
import org.txm.core.preferences.TXMPreferences;
49 34
import org.txm.edition.rcp.messages.EditionUIMessages;
50
import org.txm.edition.rcp.preferences.SynopticEditionPreferencePage;
51 35
import org.txm.edition.rcp.preferences.SynopticEditionPreferences;
52 36
import org.txm.objects.CorpusBuild;
53 37
import org.txm.objects.Edition;
......
77 61
	//HashMap<String, ArrayList<RGBA>> highlightedColorSpans = new HashMap<String, ArrayList<RGBA>>(); // background color
78 62

  
79 63
	HashMap<String, ArrayList<RGBA>> highlightedColorPerWordIDS = new HashMap<String, ArrayList<RGBA>>(); // background color
80
	public static final String STYLE_NORMAL = "normal";
81
	public static final String STYLE_ITALIC = "italic";
82
	public static final String STYLE_OBLIQUE = "oblique";
64
	public static final String STYLE_NORMAL = "normal"; //$NON-NLS-1$
65
	public static final String STYLE_ITALIC = "italic"; //$NON-NLS-1$
66
	public static final String STYLE_OBLIQUE = "oblique"; //$NON-NLS-1$
83 67
	HashMap<String, String> fontStylePerWordIDS = new HashMap<String, String>();
84
	public static final String WEIGHT_NORMAL = "normal";
85
	public static final String WEIGHT_BOLD = "bold";
68
	public static final String WEIGHT_NORMAL = "normal"; //$NON-NLS-1$
69
	public static final String WEIGHT_BOLD = "bold"; //$NON-NLS-1$
86 70
	HashMap<String, String> fontWeightPerWordIDS = new HashMap<String, String>();
87 71
	HashMap<String, ArrayList<RGBA>> fontColorPerWordIDS = new HashMap<String, ArrayList<RGBA>>();
88
	public static final String SIZE_SMALL = "small";
89
	public static final String SIZE_MEDIUM = "medium";
90
	public static final String SIZE_LARGE = "larger";
91
	public static final String SIZE_SMALLER = "smaller";
92
	public static final String SIZE_LARGER = "larger";
72
	public static final String SIZE_SMALL = "small"; //$NON-NLS-1$
73
	public static final String SIZE_MEDIUM = "medium"; //$NON-NLS-1$
74
	public static final String SIZE_LARGE = "larger"; //$NON-NLS-1$
75
	public static final String SIZE_SMALLER = "smaller"; //$NON-NLS-1$
76
	public static final String SIZE_LARGER = "larger"; //$NON-NLS-1$
93 77
	HashMap<String, String> fontSizePerWordIDS = new HashMap<String, String>();
94
	public static final String FAMILLY_TIMES = "\"Times New Roman\", Times";
95
	public static final String FAMILLY_ARIAL = "Arial";
96
	public static final String FAMILLY_COURIER = "\"Courier New\", Courier";
78
	public static final String FAMILLY_TIMES = "\"Times New Roman\", Times"; //$NON-NLS-1$
79
	public static final String FAMILLY_ARIAL = "Arial"; //$NON-NLS-1$
80
	public static final String FAMILLY_COURIER = "\"Courier New\", Courier"; //$NON-NLS-1$
97 81
	HashMap<String, String> fontFamillyPerWordIDS = new HashMap<String, String>();
98
	public static final String VARIANT_NORMAL = "normal";
99
	public static final String VARIANT_SMALLCAPS = "small-caps";
82
	public static final String VARIANT_NORMAL = "normal"; //$NON-NLS-1$
83
	public static final String VARIANT_SMALLCAPS = "small-caps"; //$NON-NLS-1$
100 84
	HashMap<String, String> fontVariantPerWordIDS = new HashMap<String, String>();
101 85
	String focusedWordID = null;
102 86

  
......
107 91
			//"elt.style.paddingTop=\"1px\";" + //$NON-NLS-1$
108 92
			//"elt.style.paddingBottom=\"1px\";" + //$NON-NLS-1$
109 93
			"} catch (e) { };"; //$NON-NLS-1$
110
	public static final String highlightscriptRuleFast = "sheet.insertRule(\"#%s {background-color:rgba(%s,%s,%s,%s);}\", 0);";
111
	public static final String colorscriptRuleFast = "sheet.insertRule(\"#%s {color:rgba(%s,%s,%s,%s);}\", 0);";
112
	public static final String sizescriptRuleFast = "sheet.insertRule(\"#%s {font-size:%s;}\", 0);";
113
	public static final String stylescriptRuleFast = "sheet.insertRule(\"#%s {font-style:%s;}\", 0);";
114
	public static final String variantscriptRuleFast = "sheet.insertRule(\"#%s {font-variant:%s;}\", 0);";
115
	public static final String famillyscriptRuleFast = "sheet.insertRule(\"#%s {font-familly:%s;}\", 0);";
116
	public static final String weightscriptRuleFast = "sheet.insertRule(\"#%s {font-weight:%s;}\", 0);";
94
	public static final String highlightscriptRuleFast = "sheet.insertRule(\"#%s {background-color:rgba(%s,%s,%s,%s);}\", 0);"; //$NON-NLS-1$
95
	public static final String colorscriptRuleFast = "sheet.insertRule(\"#%s {color:rgba(%s,%s,%s,%s);}\", 0);"; //$NON-NLS-1$
96
	public static final String sizescriptRuleFast = "sheet.insertRule(\"#%s {font-size:%s;}\", 0);"; //$NON-NLS-1$
97
	public static final String stylescriptRuleFast = "sheet.insertRule(\"#%s {font-style:%s;}\", 0);"; //$NON-NLS-1$
98
	public static final String variantscriptRuleFast = "sheet.insertRule(\"#%s {font-variant:%s;}\", 0);"; //$NON-NLS-1$
99
	public static final String famillyscriptRuleFast = "sheet.insertRule(\"#%s {font-familly:%s;}\", 0);"; //$NON-NLS-1$
100
	public static final String weightscriptRuleFast = "sheet.insertRule(\"#%s {font-weight:%s;}\", 0);"; //$NON-NLS-1$
117 101

  
118
	public static final String highlightscriptRule = "sheet.insertRule(\"span[id=\\\"%s\\\"] {background-color:rgba(%s,%s,%s,%s); }\", 0);";
102
	public static final String highlightscriptRule = "sheet.insertRule(\"span[id=\\\"%s\\\"] {background-color:rgba(%s,%s,%s,%s); }\", 0);"; //$NON-NLS-1$
119 103

  
120 104
	public static final String clearhighlightscript = "try { var elt = document.getElementById(\"%s\"); elt.style.backgroundColor=\"white\";elt.style.fontWeight=\"\";" + //$NON-NLS-1$
121 105
			"} catch (e) { };"; //$NON-NLS-1$
122 106

  
123 107
	public String functions = 
124
			""//"alert(\"loading functions\");"
125
					+"\nfunction getNodeText(node) {"
126
					+"\n	if (typeof node == 'string') return node;"
127
					+"\n	else if (typeof  node.innerText != 'undefined') return node.innerText;"
128
					+"\n	else if (typeof  node.InnerText != 'undefined') return node.InnerText;"
129
					+"\n	else if (typeof  node.textContent != 'undefined') return node.textContent;"
130
					+"\n	else return null;"
131
					+"\n}"
132
					+"\nfunction txmGetParent(node) {"
133
					+"\n	if (typeof  node.parentNode != 'undefined') return node.parentNode;"
134
					+"\n	else return null;"
135
					+"\n}"
136
					+"\nfunction txmGetChildren(node) {"
137
					+"\n	if (typeof node == 'string') return 'STRING HTML';"
138
					+"\n	else if (typeof  node.children != 'undefined') return node.children;"
139
					+"\n	else if (typeof  node.ChildNodes != 'undefined') return node.ChildNodes;"
140
					+"\n	else if (typeof  node.childNodes != 'undefined') return node.childNodes;"
141
					+"\n	else return null;"
142
					+"\n}"
143
					+"\nfunction txmGetSelection() {"
144
					+"\n	if (typeof window.getSelection != 'undefined') {return window.getSelection();}"
145
					+"\n	else if (typeof document.selection != 'undefined') { return document.selection;}"
146
					+"\n	else return 'NO SELECTION';"
147
					+"\n}"
148
					+"\nfunction txmGetRangeSize(selection) {"
149
					+"\n	if (typeof selection.rangeCount != 'undefined') {return selection.rangeCount;}"
150
					+"\n	else if (typeof selection.createRangeCollection != 'undefined') { return selection.createRangeCollection().length();} // IE5 has no multiple selection"
151
					+"\n}"
152
					+"\nfunction txmGetRange(selection, i) {"
153
					+"\n	if (typeof selection.getRangeAt != 'undefined') {return selection.getRangeAt(i);}"
154
					+"\n	else if (typeof selection.createRangeCollection != 'undefined') {return selection.createRangeCollection().item(i);}" // IE > IE5 
155
					+"\n	else if (typeof selection.createRange != 'undefined') { return selection.createRange();} // IE5 has no multiple selection"
156
					+"\n	else return 'NO RANGE';"
157
					+"\n}"
158
					+"\nfunction txmGetParentElementRange(range) {"
159
					+"\n	if (typeof range.parentElement != 'undefined') {return range.parentElement();}"
160
					+"\n	else if (typeof range.startContainer != 'undefined') { return range.startContainer.parentNode;}"
161
					+"\n	else return 'NO PARENT';"
162
					+"\n}"
163
					+"\nfunction txmGetFragment(range) {"
164
					+"\n	if (typeof range.cloneContents != 'undefined') { return range.cloneContents();}"
165
					+"\n	else if (typeof range.htmlText != 'undefined') {var node = document.createElement('sel'); node.innerHTML = range.htmlText; 		return node;"
166
					+"\n	} else return 'NO FRAG';"
167
					+"\n}"
168
					+"\nfunction txmGetTagName(node) {"
169
					+"\n	if (typeof node.tagName != 'undefined') {return node.tagName;}"
170
					+"\n	else if (typeof node.nodeName != 'undefined') { return node.nodeName;}"
171
					+"\n	else if (typeof node.name != 'undefined') { return node.name;}"
172
					+"\n	else return 'NO TAGNAME';"
173
					+"\n}"
174
					+"\nfunction findSpans(children, all) {"
175
					+"\n    for (var i = 0 ; i < children.length ; i++) {"
176
					+"\n    	var node = children.item(i);"
177
					+"\n		if (node.nodeType == 1) {"
178
					+"\n    	var id = node.getAttribute('id');"
179
					+"\n       		if (node.tagName == 'SPAN' && id != null && id.indexOf('w_') == 0 && getNodeText(node).length > 0) {"
180
					+"\n            	if (id != null) all.push(id);"
181
					+"\n        	} else {"
182
					+"\n        		findSpans(txmGetChildren(node), all)"
183
					+"\n        	}"
184
					+"\n		}"
185
					+"\n	}"
186
					+"\n}"
187
					+"\nfunction findIdsInString(str, all) {"
188
					+"\n    for (var i = 0 ; i < children.length ; i++) {"
189
					+"\n    	var node = children.item(i);"
190
					+"\n		if (node.nodeType == 1) {"
191
					+"\n    	var id = node.getAttribute('id');"
192
					+"\n       		if (node.tagName == 'SPAN' && id != null && id.indexOf('w_') == 0 && getNodeText(node).length > 0) {"
193
					+"\n            	if (id != null) all.push(id);"
194
					+"\n        	} else {"
195
					+"\n        		findSpans(txmGetChildren(node), all)"
196
					+"\n        	}"
197
					+"\n		}"
198
					+"\n	}"
199
					+"\n}"
200
					+"\nfunction get_type(thing){if(thing===null)return \"[object Null]\";  return Object.prototype.toString.call(thing);}\n"
201
					+"\nfunction getDetailedObject(inputObject) { var detailedObject = {}; var properties; \n   do {        properties = Object.getOwnPropertyNames( inputObject );        for (var o in properties) {detailedObject[properties[o]] = inputObject[properties[o]];}} while ( inputObject = Object.getPrototypeOf(inputObject) );return detailedObject;}\n"
202
					+"\nvar sheet = null;"
203
					+"\ntry{"
204
					+"\n	var style = document.createElement(\"style\");"
205
					+"\n	style.appendChild(document.createTextNode(\"\"));"//webkit hack
206
					+"\n	document.head.appendChild(style);"
207
					+"\n	sheet = style.sheet;"
208
					+"\n} catch(e) {sheet='error'}"
209
					+"\ntry{"
210
					+"\n" // define scrollIntoViewIfNeeded if absent
211
					+"\nif (!Element.prototype.scrollIntoViewIfNeeded) {"
212
					+"\n	Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) {"
213
					+"\n		centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded;"
214
					+"\n		var parent = this.parentNode,"
215
					+"\n		parentComputedStyle = window.getComputedStyle(parent, null),"
216
					+"\n		parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width')),"
217
					+"\n		parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue('border-left-width')),"
218
					+"\n		overTop = this.offsetTop - parent.offsetTop < parent.scrollTop,"
219
					+"\n		overBottom = (this.offsetTop - parent.offsetTop + this.clientHeight - parentBorderTopWidth) > (parent.scrollTop + parent.clientHeight),"
220
					+"\n		overLeft = this.offsetLeft - parent.offsetLeft < parent.scrollLeft,"
221
					+"\n		overRight = (this.offsetLeft - parent.offsetLeft + this.clientWidth - parentBorderLeftWidth) > (parent.scrollLeft + parent.clientWidth),"
222
					+"\n		alignWithTop = overTop && !overBottom;"
223
					+"\n		if ((overTop || overBottom) && centerIfNeeded) {"
224
					+"\n			parent.scrollTop = this.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + this.clientHeight / 2;"
225
					+"\n		}"
226
					+"\n		if ((overLeft || overRight) && centerIfNeeded) {"
227
					+"\n			parent.scrollLeft = this.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + this.clientWidth / 2;"
228
					+"\n		}"
229
					+"\n		if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {"
230
					+"\n			this.scrollIntoView(alignWithTop);"
231
					+"\n		}"
232
					+"\n	};"
233
					+"\n}"
234
					+"\n} catch(e) {Element.prototype.scrollIntoViewIfNeeded = Element.prototype.scrollIntoView}";
108
			""//"alert(\"loading functions\");" //$NON-NLS-1$
109
					+"\nfunction getNodeText(node) {" //$NON-NLS-1$
110
					+"\n	if (typeof node == 'string') return node;" //$NON-NLS-1$
111
					+"\n	else if (typeof  node.innerText != 'undefined') return node.innerText;" //$NON-NLS-1$
112
					+"\n	else if (typeof  node.InnerText != 'undefined') return node.InnerText;" //$NON-NLS-1$
113
					+"\n	else if (typeof  node.textContent != 'undefined') return node.textContent;" //$NON-NLS-1$
114
					+"\n	else return null;" //$NON-NLS-1$
115
					+"\n}" //$NON-NLS-1$
116
					+"\nfunction txmGetParent(node) {" //$NON-NLS-1$
117
					+"\n	if (typeof  node.parentNode != 'undefined') return node.parentNode;" //$NON-NLS-1$
118
					+"\n	else return null;" //$NON-NLS-1$
119
					+"\n}" //$NON-NLS-1$
120
					+"\nfunction txmGetChildren(node) {" //$NON-NLS-1$
121
					+"\n	if (typeof node == 'string') return 'STRING HTML';" //$NON-NLS-1$
122
					+"\n	else if (typeof  node.children != 'undefined') return node.children;" //$NON-NLS-1$
123
					+"\n	else if (typeof  node.ChildNodes != 'undefined') return node.ChildNodes;" //$NON-NLS-1$
124
					+"\n	else if (typeof  node.childNodes != 'undefined') return node.childNodes;" //$NON-NLS-1$
125
					+"\n	else return null;" //$NON-NLS-1$
126
					+"\n}" //$NON-NLS-1$
127
					+"\nfunction txmGetSelection() {" //$NON-NLS-1$
128
					+"\n	if (typeof window.getSelection != 'undefined') {return window.getSelection();}" //$NON-NLS-1$
129
					+"\n	else if (typeof document.selection != 'undefined') { return document.selection;}" //$NON-NLS-1$
130
					+"\n	else return 'NO SELECTION';" //$NON-NLS-1$
131
					+"\n}" //$NON-NLS-1$
132
					+"\nfunction txmGetRangeSize(selection) {" //$NON-NLS-1$
133
					+"\n	if (typeof selection.rangeCount != 'undefined') {return selection.rangeCount;}" //$NON-NLS-1$
134
					+"\n	else if (typeof selection.createRangeCollection != 'undefined') { return selection.createRangeCollection().length();} // IE5 has no multiple selection" //$NON-NLS-1$
135
					+"\n}" //$NON-NLS-1$
136
					+"\nfunction txmGetRange(selection, i) {" //$NON-NLS-1$
137
					+"\n	if (typeof selection.getRangeAt != 'undefined') {return selection.getRangeAt(i);}" //$NON-NLS-1$
138
					+"\n	else if (typeof selection.createRangeCollection != 'undefined') {return selection.createRangeCollection().item(i);}" // IE > IE5  //$NON-NLS-1$
139
					+"\n	else if (typeof selection.createRange != 'undefined') { return selection.createRange();} // IE5 has no multiple selection" //$NON-NLS-1$
140
					+"\n	else return 'NO RANGE';" //$NON-NLS-1$
141
					+"\n}" //$NON-NLS-1$
142
					+"\nfunction txmGetParentElementRange(range) {" //$NON-NLS-1$
143
					+"\n	if (typeof range.parentElement != 'undefined') {return range.parentElement();}" //$NON-NLS-1$
144
					+"\n	else if (typeof range.startContainer != 'undefined') { return range.startContainer.parentNode;}" //$NON-NLS-1$
145
					+"\n	else return 'NO PARENT';" //$NON-NLS-1$
146
					+"\n}" //$NON-NLS-1$
147
					+"\nfunction txmGetFragment(range) {" //$NON-NLS-1$
148
					+"\n	if (typeof range.cloneContents != 'undefined') { return range.cloneContents();}" //$NON-NLS-1$
149
					+"\n	else if (typeof range.htmlText != 'undefined') {var node = document.createElement('sel'); node.innerHTML = range.htmlText; 		return node;" //$NON-NLS-1$
150
					+"\n	} else return 'NO FRAG';" //$NON-NLS-1$
151
					+"\n}" //$NON-NLS-1$
152
					+"\nfunction txmGetTagName(node) {" //$NON-NLS-1$
153
					+"\n	if (typeof node.tagName != 'undefined') {return node.tagName;}" //$NON-NLS-1$
154
					+"\n	else if (typeof node.nodeName != 'undefined') { return node.nodeName;}" //$NON-NLS-1$
155
					+"\n	else if (typeof node.name != 'undefined') { return node.name;}" //$NON-NLS-1$
156
					+"\n	else return 'NO TAGNAME';" //$NON-NLS-1$
157
					+"\n}" //$NON-NLS-1$
158
					+"\nfunction findSpans(children, all) {" //$NON-NLS-1$
159
					+"\n    for (var i = 0 ; i < children.length ; i++) {" //$NON-NLS-1$
160
					+"\n    	var node = children.item(i);" //$NON-NLS-1$
161
					+"\n		if (node.nodeType == 1) {" //$NON-NLS-1$
162
					+"\n    	var id = node.getAttribute('id');" //$NON-NLS-1$
163
					+"\n       		if (node.tagName == 'SPAN' && id != null && id.indexOf('w_') == 0 && getNodeText(node).length > 0) {" //$NON-NLS-1$
164
					+"\n            	if (id != null) all.push(id);" //$NON-NLS-1$
165
					+"\n        	} else {" //$NON-NLS-1$
166
					+"\n        		findSpans(txmGetChildren(node), all)" //$NON-NLS-1$
167
					+"\n        	}" //$NON-NLS-1$
168
					+"\n		}" //$NON-NLS-1$
169
					+"\n	}" //$NON-NLS-1$
170
					+"\n}" //$NON-NLS-1$
171
					+"\nfunction findIdsInString(str, all) {" //$NON-NLS-1$
172
					+"\n    for (var i = 0 ; i < children.length ; i++) {" //$NON-NLS-1$
173
					+"\n    	var node = children.item(i);" //$NON-NLS-1$
174
					+"\n		if (node.nodeType == 1) {" //$NON-NLS-1$
175
					+"\n    	var id = node.getAttribute('id');" //$NON-NLS-1$
176
					+"\n       		if (node.tagName == 'SPAN' && id != null && id.indexOf('w_') == 0 && getNodeText(node).length > 0) {" //$NON-NLS-1$
177
					+"\n            	if (id != null) all.push(id);" //$NON-NLS-1$
178
					+"\n        	} else {" //$NON-NLS-1$
179
					+"\n        		findSpans(txmGetChildren(node), all)" //$NON-NLS-1$
180
					+"\n        	}" //$NON-NLS-1$
181
					+"\n		}" //$NON-NLS-1$
182
					+"\n	}" //$NON-NLS-1$
183
					+"\n}" //$NON-NLS-1$
184
					+"\nfunction get_type(thing){if(thing===null)return \"[object Null]\";  return Object.prototype.toString.call(thing);}\n" //$NON-NLS-1$
185
					+"\nfunction getDetailedObject(inputObject) { var detailedObject = {}; var properties; \n   do {        properties = Object.getOwnPropertyNames( inputObject );        for (var o in properties) {detailedObject[properties[o]] = inputObject[properties[o]];}} while ( inputObject = Object.getPrototypeOf(inputObject) );return detailedObject;}\n" //$NON-NLS-1$
186
					+"\nvar sheet = null;" //$NON-NLS-1$
187
					+"\ntry{" //$NON-NLS-1$
188
					+"\n	var style = document.createElement(\"style\");" //$NON-NLS-1$
189
					+"\n	style.appendChild(document.createTextNode(\"\"));"//webkit hack //$NON-NLS-1$
190
					+"\n	document.head.appendChild(style);" //$NON-NLS-1$
191
					+"\n	sheet = style.sheet;" //$NON-NLS-1$
192
					+"\n} catch(e) {sheet='error'}" //$NON-NLS-1$
193
					+"\ntry{" //$NON-NLS-1$
194
					+"\n" // define scrollIntoViewIfNeeded if absent //$NON-NLS-1$
195
					+"\nif (!Element.prototype.scrollIntoViewIfNeeded) {" //$NON-NLS-1$
196
					+"\n	Element.prototype.scrollIntoViewIfNeeded = function (centerIfNeeded) {" //$NON-NLS-1$
197
					+"\n		centerIfNeeded = arguments.length === 0 ? true : !!centerIfNeeded;" //$NON-NLS-1$
198
					+"\n		var parent = this.parentNode," //$NON-NLS-1$
199
					+"\n		parentComputedStyle = window.getComputedStyle(parent, null)," //$NON-NLS-1$
200
					+"\n		parentBorderTopWidth = parseInt(parentComputedStyle.getPropertyValue('border-top-width'))," //$NON-NLS-1$
201
					+"\n		parentBorderLeftWidth = parseInt(parentComputedStyle.getPropertyValue('border-left-width'))," //$NON-NLS-1$
202
					+"\n		overTop = this.offsetTop - parent.offsetTop < parent.scrollTop," //$NON-NLS-1$
203
					+"\n		overBottom = (this.offsetTop - parent.offsetTop + this.clientHeight - parentBorderTopWidth) > (parent.scrollTop + parent.clientHeight)," //$NON-NLS-1$
204
					+"\n		overLeft = this.offsetLeft - parent.offsetLeft < parent.scrollLeft," //$NON-NLS-1$
205
					+"\n		overRight = (this.offsetLeft - parent.offsetLeft + this.clientWidth - parentBorderLeftWidth) > (parent.scrollLeft + parent.clientWidth)," //$NON-NLS-1$
206
					+"\n		alignWithTop = overTop && !overBottom;" //$NON-NLS-1$
207
					+"\n		if ((overTop || overBottom) && centerIfNeeded) {" //$NON-NLS-1$
208
					+"\n			parent.scrollTop = this.offsetTop - parent.offsetTop - parent.clientHeight / 2 - parentBorderTopWidth + this.clientHeight / 2;" //$NON-NLS-1$
209
					+"\n		}" //$NON-NLS-1$
210
					+"\n		if ((overLeft || overRight) && centerIfNeeded) {" //$NON-NLS-1$
211
					+"\n			parent.scrollLeft = this.offsetLeft - parent.offsetLeft - parent.clientWidth / 2 - parentBorderLeftWidth + this.clientWidth / 2;" //$NON-NLS-1$
212
					+"\n		}" //$NON-NLS-1$
213
					+"\n		if ((overTop || overBottom || overLeft || overRight) && !centerIfNeeded) {" //$NON-NLS-1$
214
					+"\n			this.scrollIntoView(alignWithTop);" //$NON-NLS-1$
215
					+"\n		}" //$NON-NLS-1$
216
					+"\n	};" //$NON-NLS-1$
217
					+"\n}" //$NON-NLS-1$
218
					+"\n} catch(e) {Element.prototype.scrollIntoViewIfNeeded = Element.prototype.scrollIntoView}"; //$NON-NLS-1$
235 219
	protected boolean fastWordHighLight = SynopticEditionPreferences.getInstance().getBoolean(SynopticEditionPreferences.FAST_HIGHLIGHT);
236 220
	private ArrayList<ProgressListener> beforeHighlighListeners;
237 221
	public ArrayList<ProgressListener> getBeforeHighlighListeners() {
......
258 242
		File functionsFile = null;
259 243
		try {
260 244

  
261
			Bundle bundle = Platform.getBundle("org.txm.edition.rcp");
262
			URL fileURL = bundle.getEntry("res/js/functions.js");
245
			Bundle bundle = Platform.getBundle("org.txm.edition.rcp"); //$NON-NLS-1$
246
			URL fileURL = bundle.getEntry("res/js/functions.js"); //$NON-NLS-1$
263 247
			URL r = FileLocator.resolve(fileURL);
264 248
			Log.info("Load JS functions from: "+r);
265
			functions = IOUtils.getText(r, "UTF-8");
249
			functions = IOUtils.getText(r, "UTF-8"); //$NON-NLS-1$
266 250

  
267 251
		} catch (Exception e) {
268
			System.out.println("Error while reading "+functionsFile+": "+e.getLocalizedMessage());
252
			System.out.println(EditionUIMessages.bind(EditionUIMessages.error_while_reading, functionsFile, e.getLocalizedMessage()));
269 253
			Log.printStackTrace(e);
270 254
		}
271 255

  
......
281 265
			public void completed(ProgressEvent event) {
282 266
				
283 267
				//				System.out.println("EditionPanel "+currentEdition.getName()+" reload "+getCurrentPage().getName());
284
				Object rez = evaluate("return typeof sheet");
285
				if ("undefined".equals(rez)) execute(functions); // build the sheet if not present in the HTML DOM
268
				Object rez = evaluate("return typeof sheet"); //$NON-NLS-1$
269
				if ("undefined".equals(rez)) execute(functions); // build the sheet if not present in the HTML DOM //$NON-NLS-1$
286 270
				
287 271
				// do something before the highlight is done
288 272
				for (ProgressListener pl : beforeHighlighListeners) { pl.completed(event);}
......
295 279
					//						buffer.append(String.format(clearhighlightscript, wordid)+"\n");
296 280
					//					}
297 281
				} else {
298
					buffer.append("try { while(sheet.cssRules.length > 0) sheet.deleteRule(0); } catch (e) {};\n"); // empty style
282
					buffer.append("try { while(sheet.cssRules.length > 0) sheet.deleteRule(0); } catch (e) {};\n"); // empty style //$NON-NLS-1$
299 283
				}
300 284

  
301 285
				if (buffer.length() > 0) execute(buffer.toString());
......
303 287

  
304 288
				String firstWord = currentPage.getWordId();
305 289
				Page nextPage = currentEdition.getNextPage(currentPage);
306
				String lastWord = "w_999999999";
290
				String lastWord = "w_999999999"; //$NON-NLS-1$
307 291
				if (nextPage != null && currentPage != nextPage) lastWord = nextPage.getWordId();
308 292
				//System.out.println("firstWord="+firstWord+" lastWord="+lastWord);
309 293
				//int n = 0;
......
334 318
					String s = null;
335 319
					if (!fastWordHighLight) {
336 320
						//s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
337
						s = "try { document.getElementById(\"" + wordid + "\").style.backgroundColor=\"rgba("+composite.r+","+composite.g+","+composite.b+","+composite.a+")\";" //$NON-NLS-1$
321
						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$
338 322
								+ 
339 323
								//								"elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
340 324
								//								"elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
......
343 327
								"} catch (e) { };"; //$NON-NLS-1$
344 328
					} else {
345 329
						//TODO: replace this line with the next one for TXM 0.7.9
346
						s = String.format(highlightscriptRuleFast, wordid.replace(" ", "\\ "), composite.r, composite.g, composite.b, composite.a);
330
						s = String.format(highlightscriptRuleFast, wordid.replace(" ", "\\ "), composite.r, composite.g, composite.b, composite.a); //$NON-NLS-1$ //$NON-NLS-2$
347 331
						//						s = String.format(highlightscriptRuleFast, wordid, composite.r, composite.g, composite.b, composite.a);
348 332
					}
349 333

  
350
					buffer.append(s+"\n");
334
					buffer.append(s+"\n"); //$NON-NLS-1$
351 335
				}
352 336

  
353 337
				if (buffer.length() > 0) execute(buffer.toString());
......
389 373
					composite.b /= size;
390 374

  
391 375
					String s = String.format(colorscriptRuleFast, wordid, composite.r, composite.g, composite.b, composite.a);
392
					buffer.append(s+"\n");
376
					buffer.append(s+"\n"); //$NON-NLS-1$
393 377
				}
394 378

  
395 379
				if (buffer.length() > 0) execute(buffer.toString());
......
397 381

  
398 382
				for (String wordid : fontSizePerWordIDS.keySet()) {
399 383
					String s = String.format(sizescriptRuleFast, wordid, fontSizePerWordIDS.get(wordid));
400
					buffer.append(s+"\n");
384
					buffer.append(s+"\n"); //$NON-NLS-1$
401 385
				}
402 386

  
403 387
				for (String wordid : fontWeightPerWordIDS.keySet()) {
404 388
					String s = null;
405 389
					if (!fastWordHighLight) {
406 390
						//s = String.format(highlightscriptRule, wordid, composite.r, composite.g, composite.b, composite.a);
407
						s = "try { document.getElementById(\"" + wordid + "\").style.fontWeight=\""+fontWeightPerWordIDS.get(wordid)+"\";" //$NON-NLS-1$
391
						s = "try { document.getElementById(\"" + wordid + "\").style.fontWeight=\""+fontWeightPerWordIDS.get(wordid)+"\";" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
408 392
								+ 
409 393
								//								"elt.style.paddingLeft=\"3px\";" + //$NON-NLS-1$
410 394
								//								"elt.style.paddingRight=\"3px\";" + //$NON-NLS-1$
......
422 406
					} else {
423 407
						s = String.format(weightscriptRuleFast, wordid, fontWeightPerWordIDS.get(wordid));
424 408
					}
425
					buffer.append(s+"\n");
409
					buffer.append(s+"\n"); //$NON-NLS-1$
426 410
				}
427 411

  
428 412
				for (String wordid : fontFamillyPerWordIDS.keySet()) {
429 413
					String s = String.format(famillyscriptRuleFast, wordid, fontFamillyPerWordIDS.get(wordid));
430
					buffer.append(s+"\n");
414
					buffer.append(s+"\n"); //$NON-NLS-1$
431 415
				}
432 416

  
433 417
				if (buffer.length() > 0) execute(buffer.toString());
......
435 419

  
436 420
				if (focusedWordID != null) {
437 421
					//System.out.println("Focus on: "+focusedWordID);
438
					String s = "try { showElementIfNeeded(document.getElementById(\"" + focusedWordID + "\")); } catch (e) {document.getElementById(\"" + focusedWordID + "\").scrollIntoView();};"; //$NON-NLS-1$ //$NON-NLS-2$
439
					buffer.append(s+"\n");
422
					String s = "try { showElementIfNeeded(document.getElementById(\"" + focusedWordID + "\")); } catch (e) {document.getElementById(\"" + focusedWordID + "\").scrollIntoView();};"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
423
					buffer.append(s+"\n"); //$NON-NLS-1$
440 424
					focusedWordID = null; // focus one time
441 425
				}
442 426

  
......
444 428
				buffer = new StringBuilder();
445 429

  
446 430
				if (highlightedAreas != null) {
447
					for (int[] pos : highlightedAreas ) {
431
					for (int[] pos : highlightedAreas) {
448 432
						if (pos == null || pos.length != 4) continue;
449
						String s = "try {v.setFocusOn("+pos[0]+", "+pos[1]+", "+pos[2]+", "+pos[3]+");} catch (e) { };"; //$NON-NLS-1$
450
						buffer.append(s+"\n");
433
						String s = "try {v.setFocusOn("+pos[0]+", "+pos[1]+", "+pos[2]+", "+pos[3]+");} catch (e) { };"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
434
						buffer.append(s+"\n"); //$NON-NLS-1$
451 435
						break;// one word only for now
452 436
					}
453 437
				}
......
476 460
	 * Bypass BrowserViewer restriction on the getBrowser method
477 461
	 */
478 462
	public String getDOM() {
479
		return "";//execute("return document.innerHTML";
463
		return "";//execute("return document.innerHTML"; //$NON-NLS-1$
480 464
	}
481 465

  
482 466
	public ISelectionProvider getSelectionProvider() {
......
520 504
		for (String wordid : wordids) {
521 505
			removeHighlightWordsById(color, wordid);
522 506
			if (!fastWordHighLight) {
523
				buffer.append(String.format(clearhighlightscript, wordid)+"\n");
507
				buffer.append(String.format(clearhighlightscript, wordid)+"\n"); //$NON-NLS-1$
524 508
			}
525 509
		}
526 510

  
......
549 533
		Edition edition = text.getEdition(name);
550 534

  
551 535
		if (edition == null) {
552
			String s = EditionUIMessages.EditionPanel_0+text+EditionUIMessages.EditionPanel_5+name;
536
			String s = EditionUIMessages.bind(EditionUIMessages.warning_no_edition_found, text, name);
553 537
			System.out.println(s);
554 538
			StatusLine.setMessage(s);
555 539
			Log.severe(s);
......
577 561
		currentPage = currentEdition.getFirstPage();
578 562
		currentText = currentEdition.getText();
579 563
		if (currentPage == null) {
580
			System.out.println(EditionUIMessages.EditionPanel_1+currentEdition.getName()+EditionUIMessages.EditionPanel_2+currentText.getName());
564
			System.out.println(EditionUIMessages.bind(EditionUIMessages.warning_no_first_page, currentEdition.getName(), currentText.getName()));
581 565
		}
582 566

  
583 567
		this.setURL(currentPage.toURL());
......
656 640
			String editionName = currentEdition.getName();
657 641
			Edition tmp = firstText.getEdition(editionName);
658 642
			if (tmp == null) {
659
				System.out.println(EditionUIMessages.EditionPanel_6+editionName+EditionUIMessages.EditionPanel_7+firstText.getName());
643
				System.out.println(EditionUIMessages.bind(EditionUIMessages.warning_no_edition_with_name, editionName, firstText.getName()));
660 644
				return;
661 645
			}
662 646
			currentEdition = tmp;
......
682 666
			String editionName = currentEdition.getName();
683 667
			Edition tmp = lastText.getEdition(editionName);
684 668
			if (tmp == null) {
685
				System.out.println(EditionUIMessages.EditionPanel_6+editionName+EditionUIMessages.EditionPanel_7+lastText.getName());
669
				System.out.println(EditionUIMessages.bind(EditionUIMessages.warning_no_edition_with_name, editionName, lastText.getName()));
686 670
				return;
687 671
			}
688 672

  
......
715 699

  
716 700
			Edition tmp = previousText.getEdition(editionName);
717 701
			if (tmp == null) {
718
				System.out.println(EditionUIMessages.EditionPanel_6+editionName+EditionUIMessages.EditionPanel_7+previousText.getName());
702
				System.out.println(EditionUIMessages.bind(EditionUIMessages.warning_no_edition_with_name, editionName, previousText.getName()));
719 703
			}
720 704
			currentEdition = tmp;
721 705
			currentText = previousText;
......
746 730
			String editionName = currentEdition.getName();
747 731
			Edition tmp = nextText.getEdition(editionName);
748 732
			if (tmp == null) {
749
				System.out.println(EditionUIMessages.EditionPanel_6+editionName+EditionUIMessages.EditionPanel_7+nextText.getName());
733
				System.out.println(EditionUIMessages.bind(EditionUIMessages.warning_no_edition_with_name, editionName, nextText.getName()));
750 734
				return;
751 735
			}
752 736
			currentEdition = tmp;
......
769 753
		String editionName = currentEdition.getName();
770 754
		Edition tmp = text.getEdition(editionName);
771 755
		if (tmp == null) {
772
			System.out.println(EditionUIMessages.EditionPanel_6+editionName+EditionUIMessages.EditionPanel_7+text.getName());
756
			System.out.println(EditionUIMessages.bind(EditionUIMessages.warning_no_edition_with_name, editionName, text.getName()));
773 757
			return;
774 758
		}
775 759

  
......
841 825
	//		this.currentEdition = edition;
842 826
	//	}
843 827

  
844
	static String SCRIPT01 = "var html = \"\";"+
845
			"if (typeof window.getSelection != \"undefined\") {"+ // modern Web browsers
846
			"var sel = window.getSelection();"+
847
			"if (sel.rangeCount) {"+
848
			"var container = document.createElement(\"div\");"+
849
			"for (var i = 0, len = sel.rangeCount; i < len; ++i) {"+
850
			"container.appendChild(sel.getRangeAt(i).cloneContents());"+
851
			"}"+
852
			"html = container.innerHTML;"+
853
			"}"+
854
			"} else if (typeof document.selection != \"undefined\") {"+ // for IE < 11
855
			"if (document.selection.type == \"Text\") {"+
856
			"html = document.selection.createRange().htmlText;"+
857
			"}" +
858
			"}" +
859
			"return html";
828
	static String SCRIPT01 = "var html = \"\";"+ //$NON-NLS-1$
829
			"if (typeof window.getSelection != \"undefined\") {"+ // modern Web browsers //$NON-NLS-1$
830
			"var sel = window.getSelection();"+ //$NON-NLS-1$
831
			"if (sel.rangeCount) {"+ //$NON-NLS-1$
832
			"var container = document.createElement(\"div\");"+ //$NON-NLS-1$
833
			"for (var i = 0, len = sel.rangeCount; i < len; ++i) {"+ //$NON-NLS-1$
834
			"container.appendChild(sel.getRangeAt(i).cloneContents());"+ //$NON-NLS-1$
835
			"}"+ //$NON-NLS-1$
836
			"html = container.innerHTML;"+ //$NON-NLS-1$
837
			"}"+ //$NON-NLS-1$
838
			"} else if (typeof document.selection != \"undefined\") {"+ // for IE < 11 //$NON-NLS-1$
839
			"if (document.selection.type == \"Text\") {"+ //$NON-NLS-1$
840
			"html = document.selection.createRange().htmlText;"+ //$NON-NLS-1$
841
			"}" + //$NON-NLS-1$
842
			"}" + //$NON-NLS-1$
843
			"return html"; //$NON-NLS-1$
860 844

  
861 845
	public String getTextSelectionDOM() {
862 846
		return ((String) evaluate(SCRIPT01));
......
865 849
	public String[] getWordSelection() {
866 850

  
867 851
		//System.out.println("getWordSelection");
868
		String SCRIPT02_getspans = ""//functions
869
				+"var all = [];"
870
				+"\nvar sel = txmGetSelection();"
871
				+"\nif (sel.rangeCount == 0) {return all;}"
852
		String SCRIPT02_getspans = ""//functions //$NON-NLS-1$
853
				+"var all = [];" //$NON-NLS-1$
854
				+"\nvar sel = txmGetSelection();" //$NON-NLS-1$
855
				+"\nif (sel.rangeCount == 0) {return all;}" //$NON-NLS-1$
872 856
				//+"\nalert('sel='+sel);"
873
				+"\nvar range = txmGetRange(sel, 0);"
857
				+"\nvar range = txmGetRange(sel, 0);" //$NON-NLS-1$
874 858
				//+"\nalert('range='+range);"
875
				+"\nvar frag = txmGetFragment(range);"
859
				+"\nvar frag = txmGetFragment(range);" //$NON-NLS-1$
876 860
				//+"\nalert('frag='+frag);"
877
				+"\nvar children = txmGetChildren(frag);"
861
				+"\nvar children = txmGetChildren(frag);" //$NON-NLS-1$
878 862
				//+"\nalert('children='+children);"
879 863
				//+"\nalert('children.length='+children.length);"
880
				+"\nif ((children.length == 0) || (children.length == 1 && children.item(0).nodeType == 3)) {"
881
				+"\n	var parent = txmGetParentElementRange(range);"
864
				+"\nif ((children.length == 0) || (children.length == 1 && children.item(0).nodeType == 3)) {" //$NON-NLS-1$
865
				+"\n	var parent = txmGetParentElementRange(range);" //$NON-NLS-1$
882 866
				//+"\n	if (parent instanceof HTMLHtmlElement) {alert('HTMLHtmlElement parent='+parent);return findIdsInString(parent, all);}"
883
				+"\n	if (typeof parent.getAttribute == 'undefined') {return all}"
884
				+"\n	var id = parent.getAttribute('id');"
885
				+"\n	var id = parent.getAttribute('id');"
886
				+"\n	if (txmGetTagName(parent) == 'SPAN' && id != null && id.indexOf('w_') == 0) {"
887
				+"\n		all.push(id);"
888
				+"\n	} else {" // try with the parent's parent 
889
				+"\n		var parent = txmGetParent(parent);"
867
				+"\n	if (typeof parent.getAttribute == 'undefined') {return all}" //$NON-NLS-1$
868
				+"\n	var id = parent.getAttribute('id');" //$NON-NLS-1$
869
				+"\n	var id = parent.getAttribute('id');" //$NON-NLS-1$
870
				+"\n	if (txmGetTagName(parent) == 'SPAN' && id != null && id.indexOf('w_') == 0) {" //$NON-NLS-1$
871
				+"\n		all.push(id);" //$NON-NLS-1$
872
				+"\n	} else {" // try with the parent's parent  //$NON-NLS-1$
873
				+"\n		var parent = txmGetParent(parent);" //$NON-NLS-1$
890 874
				//+"\n		alert('text selection, parent='+txmGetTagName(parent))"
891
				+"\n	if (typeof parent.getAttribute == 'undefined') {return all}"
892
				+"\n		var id = parent.getAttribute('id');"
893
				+"\n		if (txmGetTagName(parent) == 'SPAN' && id != null && id.indexOf('w_') == 0) {"
894
				+"\n			all.push(id);"
895
				+"\n		}"
896
				+"\n	}"
897
				+"\n} else {"
898
				+"\n	findSpans(children, all);"
899
				+"\n}"
875
				+"\n	if (typeof parent.getAttribute == 'undefined') {return all}" //$NON-NLS-1$
876
				+"\n		var id = parent.getAttribute('id');" //$NON-NLS-1$
877
				+"\n		if (txmGetTagName(parent) == 'SPAN' && id != null && id.indexOf('w_') == 0) {" //$NON-NLS-1$
878
				+"\n			all.push(id);" //$NON-NLS-1$
879
				+"\n		}" //$NON-NLS-1$
880
				+"\n	}" //$NON-NLS-1$
881
				+"\n} else {" //$NON-NLS-1$
882
				+"\n	findSpans(children, all);" //$NON-NLS-1$
883
				+"\n}" //$NON-NLS-1$
900 884
				//+"alert('result='+all)"
901
				+"\nreturn all;";
885
				+"\nreturn all;"; //$NON-NLS-1$
902 886

  
903 887
		//		System.out.println(functions);
904 888
		//		System.out.println(SCRIPT02_getspans);
905 889

  
906 890
		Object ret = evaluate(SCRIPT02_getspans);
907 891
		if (ret instanceof Object[]) {
908
			Log.info("selection word ids="+Arrays.toString((Object[])ret));
892
			Log.info("selection word ids="+Arrays.toString((Object[])ret)); //$NON-NLS-1$
909 893
			Object[] array = (Object[])ret;
910 894
			String[] sel = new String[2];
911 895
			if (array.length == 0) {
......
919 903
				return sel;
920 904
			}
921 905
		} else { 
922
			System.out.println("SCRIPT RETURNED="+ret);
906
			System.out.println(EditionUIMessages.bind(EditionUIMessages.warning_script_returned, ret));
923 907
			return null;
924 908
		}
925 909
	}
926 910

  
927 911
	public String getTextSelection() {
928 912
		//System.out.println("DOM="+getTextSelectionDOM());
929
		String rez =  getTextSelectionDOM().replaceAll("<[^>]+>", "");
913
		String rez =  getTextSelectionDOM().replaceAll("<[^>]+>", ""); //$NON-NLS-1$ //$NON-NLS-2$
930 914
		//System.out.println("STR="+rez);
931 915
		return rez;
932 916
	}
......
985 969
				new MenuItem(menu, SWT.SEPARATOR);
986 970

  
987 971
				MenuItem copyItem = new MenuItem(menu, SWT.NONE);
988
				copyItem.setText("Copy text selection");
972
				copyItem.setText(EditionUIMessages.menu_copy_text_selection);
989 973
				copyItem.addSelectionListener(new SelectionListener() {
990 974

  
991 975
					@Override
......
1003 987
				copyItem.setEnabled(text != null && text.length() > 0);
1004 988

  
1005 989
				MenuItem reloadItem = new MenuItem(menu, SWT.NONE);
1006
				reloadItem.setText("Reload");
990
				reloadItem.setText(EditionUIMessages.menu_reload);
1007 991
				reloadItem.addSelectionListener(new SelectionListener() {
1008 992

  
1009 993
					@Override
......
1015 999
					public void widgetDefaultSelected(SelectionEvent e) { }
1016 1000
				});
1017 1001
				MenuItem backItem = new MenuItem(menu, SWT.NONE);
1018
				backItem.setText("Back");
1002
				backItem.setText(EditionUIMessages.menu_back);
1019 1003
				backItem.addSelectionListener(new SelectionListener() {
1020 1004

  
1021 1005
					@Override
......
1027 1011
					public void widgetDefaultSelected(SelectionEvent e) { }
1028 1012
				});
1029 1013
				MenuItem forwardItem = new MenuItem(menu, SWT.NONE);
1030
				forwardItem.setText("Forward");
1014
				forwardItem.setText(EditionUIMessages.menu_forward);
1031 1015
				forwardItem.addSelectionListener(new SelectionListener() {
1032 1016

  
1033 1017
					@Override
......
1043 1027
			@Override
1044 1028
			public void menuHidden(MenuEvent e) {
1045 1029
				// TODO Auto-generated method stub
1046

  
1047 1030
			}
1048 1031
		});
1049 1032
		//		// restore old listeners
......
1105 1088
			currentPage = next;
1106 1089
			this.setURL(currentPage.toURL());
1107 1090
		} else {
1108
			System.out.println("Page not found ("+name+").");
1091
			System.out.println(EditionUIMessages.bind(EditionUIMessages.warning_page_not_found, name));
1109 1092
		}
1110 1093
	}
1111 1094

  
......
1130 1113
		String id2 = ids[1];
1131 1114
		if (id2 == null) id2 = id1;
1132 1115
		String SCRIPT02_expand = ""
1133
				+ "var elt = document.getElementById(\""+id1+"\");\n"
1134
				+ "var elt2 = document.getElementById(\""+id2+"\");\n"
1116
				+ "var elt = document.getElementById(\""+id1+"\");\n" //$NON-NLS-1$ //$NON-NLS-2$
1117
				+ "var elt2 = document.getElementById(\""+id2+"\");\n" //$NON-NLS-1$ //$NON-NLS-2$
1135 1118
				//+ "alert(\"elt=\"+elt);\n"
1136
				+ "var sel = txmGetSelection();\n"
1119
				+ "var sel = txmGetSelection();\n" //$NON-NLS-1$
1137 1120
				//+ "alert(\"sel=\"+sel.extentNode);\n"
1138 1121
				//+ "alert(\"typeof sel=\"+Object.getOwnPropertyNames(sel));\n"
1139 1122
				//+ "alert(\"get_type sel=\"+get_type(sel));\n"
1140
				+ "var range = txmGetRange(sel, 0);\n"
1123
				+ "var range = txmGetRange(sel, 0);\n" //$NON-NLS-1$
1141 1124
				//+ "alert(\"range=\"+range);\n"
1142 1125
				//+ "alert(\"typeof range=\"+Object.getOwnPropertyNames(range));\n"
1143 1126
				//+ "alert(\"get_type range=\"+get_type(range));\n"
1144
				+"range.setStart(elt, 0);\n"
1145
				+"range.setEndAfter(elt2, 0);\n"
1146
				+"sel.removeAllRanges();\n"
1147
				+"sel.addRange(range);\n"
1148
				+ "\n"
1149
				+ "return null;";
1127
				+"range.setStart(elt, 0);\n" //$NON-NLS-1$
1128
				+"range.setEndAfter(elt2, 0);\n" //$NON-NLS-1$
1129
				+"sel.removeAllRanges();\n" //$NON-NLS-1$
1130
				+"sel.addRange(range);\n" //$NON-NLS-1$
1131
				+ "\n" //$NON-NLS-1$
1132
				+ "return null;"; //$NON-NLS-1$
1150 1133

  
1151 1134
		//System.out.println("Eval...\n"+SCRIPT02_expand);
1152 1135
		evaluate(SCRIPT02_expand);
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/RGBA.java (revision 1053)
7 7
		this.r =r;this.g=g; this.b =b;
8 8
	}
9 9
	public RGBA(String rgb) {
10
		String[] split = rgb.split(",");
10
		String[] split = rgb.split(","); //$NON-NLS-1$
11 11
		try{this.r =Integer.parseInt(split[0]);}catch(Exception e){}
12 12
		try{this.g =Integer.parseInt(split[1]);}catch(Exception e){}
13 13
		try{this.b =Integer.parseInt(split[2]);}catch(Exception e){}
14 14
	}
15 15
	public RGBA(String rgb, float a) {
16
		String[] split = rgb.split(",");
16
		String[] split = rgb.split(","); //$NON-NLS-1$
17 17
		try{this.r =Integer.parseInt(split[0]);}catch(Exception e){}
18 18
		try{this.g =Integer.parseInt(split[1]);}catch(Exception e){}
19 19
		try{this.b =Integer.parseInt(split[2]);}catch(Exception e){}
......
23 23
		this.r =r;this.g=g; this.b =b;this.a =a;
24 24
	}
25 25

  
26
	public String toString() {return "{"+r+", "+g+","+b+", "+a+"}";}
26
	public String toString() {return "{"+r+", "+g+","+b+", "+a+"}";} //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
27 27
}
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/SynopticEditionEditor.java (revision 1053)
139 139
							String s = panel.getTextSelection();
140 140
							if (s.length() > 0) return s;
141 141
						}
142
						return "";
142
						return EditionUIMessages.editor_empty;
143 143
					}
144 144
					@Override
145 145
					public int getStartLine() {	return 0;}
......
317 317

  
318 318
		editionsArea = getResultArea();
319 319

  
320
		controlsArea = getBottomToolbar().installGLComposite("controls", 15, false);
320
		controlsArea = getBottomToolbar().installGLComposite(EditionUIMessages.editor_controls, 15, false);
321 321
		controlsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false));
322 322
		//spacer
323 323
		new Label(controlsArea, SWT.NONE).setText("  "); //$NON-NLS-1$
......
369 369
		}
370 370

  
371 371
		// Navigation buttons
372
		GLComposite pageNavigationComposite = new GLComposite(controlsArea, SWT.NONE, "page buttons");
372
		GLComposite pageNavigationComposite = new GLComposite(controlsArea, SWT.NONE, EditionUIMessages.editor_page_navigation_buttons);
373 373
		pageNavigationComposite.getLayout().numColumns = 6;
374 374
		Button first = new Button(pageNavigationComposite, SWT.FLAT|SWT.PUSH);
375 375
		Button previous = new Button(pageNavigationComposite, SWT.FLAT|SWT.PUSH);
......
379 379
		Button last = new Button(pageNavigationComposite, SWT.FLAT|SWT.PUSH);
380 380
		pageNavigationComposite.setLayoutData(new GridData(GridData.CENTER, GridData.FILL, true, false));
381 381
		
382
		GLComposite textNavigationComposite = new GLComposite(controlsArea, SWT.NONE, "text buttons");
382
		GLComposite textNavigationComposite = new GLComposite(controlsArea, SWT.NONE, EditionUIMessages.editor_text_navigation_buttons);
383 383
		textNavigationComposite.getLayout().numColumns = 6;
384 384
		Button firstText = new Button(textNavigationComposite, SWT.FLAT);
385 385
		Button previousText = new Button(textNavigationComposite, SWT.FLAT);
386
		new Label(textNavigationComposite, SWT.NONE).setText(" ");
386
		new Label(textNavigationComposite, SWT.NONE).setText(EditionUIMessages.editor_empty);
387 387
		Button nextText = new Button(textNavigationComposite, SWT.FLAT|SWT.PUSH);
388 388
		Button lastText = new Button(textNavigationComposite, SWT.FLAT|SWT.PUSH);
389 389
		textNavigationComposite.setLayoutData(new GridData(GridData.CENTER, GridData.FILL, false, false));
......
671 671
		}
672 672
		updatePageLabel();
673 673
		
674
		notifyExtensions("onBackToText");
674
		notifyExtensions("onBackToText"); //$NON-NLS-1$
675 675
	}
676 676

  
677 677
	public void reloadPage() {
......
687 687
			sel = p.getTextSelection();
688 688
			if (sel != null) return sel;
689 689
		}
690
		return "";
690
		return EditionUIMessages.editor_empty;
691 691
	}
692 692

  
693 693
	@Override
......
808 808
				Parameterization p = new Parameterization(iparam, params.get(k));
809 809
				parameters.add(p);
810 810
			} catch (NotDefinedException e) {
811
				System.out.println("warning: unknowned parameter id="+k);
811
				System.out.println(EditionUIMessages.editor_warning_unknowned_param_id+k);
812 812
			}
813 813
		}
814 814

  
......
840 840
			params.put(arguments[i].toString(), arguments[i+1].toString());
841 841
		}
842 842

  
843
		String id = params.get("id");
843
		String id = params.get("id"); //$NON-NLS-1$
844 844
		if (id != null) {
845
			params.remove("id");
845
			params.remove("id"); //$NON-NLS-1$
846 846
			//System.out.println("CALLING CMD with id="+id+" and parameters="+params);
847 847
			//get the command from plugin.xml
848 848
			callTXMCommand(id, params);
849 849
		} else {
850
			System.out.println("Cannot call txmcommand without 'id' parameter: "+params);
850
			System.out.println(EditionUIMessages.editor_warning_no_id_parameter+params);
851 851
		}
852 852
		return arguments;
853 853
	}
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/editors/CommandLink.java (revision 1053)
2 2

  
3 3
import org.eclipse.swt.browser.Browser;
4 4
import org.eclipse.swt.browser.BrowserFunction;
5
import org.txm.edition.rcp.messages.EditionUIMessages;
5 6

  
6 7
public class CommandLink extends BrowserFunction {
7
		String data = "";
8
		Browser browser;
9
		SynopticEditionEditor synopticEditionEditor;
10
		CommandLink (SynopticEditionEditor synopticEditionEditor, Browser browser) {
11
			super (browser, "txmcommand");
12
			this.browser = browser;
13
			this.synopticEditionEditor = synopticEditionEditor;
14
		}
15
		public Object function (Object[] arguments) {
16
			return SynopticEditionEditor.callTXMCommand(arguments);
17
		}
18
	}
8
	
9
	String data = EditionUIMessages.CommandLink_empty;
10
	Browser browser;
11
	SynopticEditionEditor synopticEditionEditor;
12
	
13
	CommandLink (SynopticEditionEditor synopticEditionEditor, Browser browser) {
14
		super (browser, "txmcommand"); //$NON-NLS-1$
15
		this.browser = browser;
16
		this.synopticEditionEditor = synopticEditionEditor;
17
	}
18
	
19
	public Object function (Object[] arguments) {
20
		return SynopticEditionEditor.callTXMCommand(arguments);
21
	}
22
}
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/preferences/SynopticEditionPreferencePage.java (revision 1053)
5 5
import org.eclipse.ui.IWorkbench;
6 6
import org.eclipse.ui.IWorkbenchPreferencePage;
7 7
import org.eclipse.ui.preferences.ScopedPreferenceStore;
8
import org.txm.edition.rcp.messages.EditionUIMessages;
8 9
import org.txm.rcp.Application;
9 10

  
10 11
/**
......
26 27
		super();
27 28
		preferences = new ScopedPreferenceStore(org.eclipse.core.runtime.preferences.InstanceScope.INSTANCE, Application.PLUGIN_ID);
28 29
		setPreferenceStore(preferences);
29
		setTitle("Edition");
30
		setTitle(EditionUIMessages.preference_title);
30 31
	}
31 32
	
32 33
	@Override
......
34 35

  
35 36
	@Override
36 37
	protected void createFieldEditors() {
37
		fast_highlight = new BooleanFieldEditor(SynopticEditionPreferences.FAST_HIGHLIGHT, "Enable fast word highlight", getFieldEditorParent());
38
		fast_highlight = new BooleanFieldEditor(SynopticEditionPreferences.FAST_HIGHLIGHT, EditionUIMessages.preference_preference_fast_highlight, getFieldEditorParent());
38 39
		addField(fast_highlight);
39 40
	}
40 41
}
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/messages/EditionUIMessages.java (revision 1053)
18 18
	public static String BackToText_3;
19 19
	public static String BackToText_4;
20 20
	public static String BackToText_5;
21
	public static String EditionPanel_0;
22
	public static String EditionPanel_1;
23
	public static String EditionPanel_2;
24
	public static String EditionPanel_5;
25
	public static String EditionPanel_6;
26
	public static String EditionPanel_7;
27 21
	public static String EditionSelectorDialog_0;
28 22
	public static String EditionSelectorDialog_1;
23
	public static String editor_controls;
24

  
25
	public static String editor_empty;
26

  
27
	public static String editor_page_navigation_buttons;
28

  
29
	public static String editor_text_navigation_buttons;
30

  
31
	public static String editor_warning_no_id_parameter;
32

  
33
	public static String editor_warning_unknowned_param_id;
34

  
35
	public static String error_while_reading;
36

  
37
	public static String menu_back;
38

  
39
	public static String menu_copy_text_selection;
40

  
41
	public static String menu_forward;
42

  
43
	public static String menu_reload;
44

  
29 45
	public static String OpenEdition_0;
30 46
	public static String OpenEdition_1;
31 47
	public static String OpenEdition_10;
......
44 60
	public static String SynopticEditionEditor_7;
45 61
	public static String SynopticEditionEditor_8;
46 62
	public static String SynopticEditionEditor_9;
63

  
64
	public static String warning_no_edition_found;
65

  
66
	public static String warning_no_edition_with_name;
67

  
68
	public static String warning_no_first_page;
69

  
70
	public static String warning_page_not_found;
71

  
72
	public static String warning_script_returned;
47 73
	
74
	public static String preference_preference_fast_highlight;
75
	public static String preference_title;
76
	
77
	public static String CommandLink_empty;
78
	public static String EditionLink_error_no_arguments;
79
	
48 80
	static {
49 81
		// initialize resource bundle
50 82
		Utf8NLS.initializeMessages(BUNDLE_NAME, EditionUIMessages.class);
tmp/org.txm.edition.rcp/src/org/txm/edition/rcp/messages/messages.properties (revision 1053)
1 1

  
2
BackToText_0 = Opening with first edition (no default edition set): 
2
BackToText_0 = Opening with first edition (no default edition set): {0}
3 3
BackToText_3 = Error: could not retrieve line word ids. Aborting back to text.
4 4
BackToText_4 = No edition to open.
5
BackToText_5 = Opening default editions: 
5
BackToText_5 = Opening default editions: {0}
6 6

  
7
EditionPanel_0 = No edition found for text=
8
EditionPanel_1 = Fail to retrieve first page of edition 
9
EditionPanel_2 = \ and text 
10
EditionPanel_5 = \ edition=
11
EditionPanel_6 = No edition with name 
12
EditionPanel_7 = \ available for text 
7
warning_no_edition_found=No edition found for text={0} and edition={1}
8
warning_no_first_page=Fail to retrieve first page of edition={0} and text={1}
9
error_while_reading=Error while reading {0}: {1}
10
warning_script_returned=SCRIPT RETURNED={0}
11
menu_copy_text_selection=Copy text selection
12
menu_reload=Reload
13
menu_back=Back
14
menu_forward=Forward
15
warning_page_not_found=Page not found ({0}).
16
warning_no_edition_with_name=No edition with name={0} available for text={1}
13 17

  
14 18
EditionSelectorDialog_0 = Editions
15 19
EditionSelectorDialog_1 = Select one or more editions
20
editor_controls=controls
21
editor_empty=
22
editor_page_navigation_buttons=page buttons
23
editor_text_navigation_buttons=text buttons
24
editor_warning_no_id_parameter=Cannot call txmcommand without 'id' parameter: {0}
25
editor_warning_unknowned_param_id=warning: unknowned parameter id={0}
16 26

  
17 27
OpenEdition_0  = Opening with first edition (no default edition set): 
18 28
OpenEdition_1  = No edition to open.
19
OpenEdition_10 = Error while opening editor: 
20
OpenEdition_3  = Opening default editions: 
21
OpenEdition_4  = Error while opening edition: 
29
OpenEdition_10 = Error while opening editor: {0}
30
OpenEdition_3  = Opening default editions: {0}
31
OpenEdition_4  = Error while opening edition: {0}
22 32
OpenEdition_7  = \ in the corpus
23 33
OpenEdition_9  = Aborting: selection is not a corpus
24 34

  
......
32 42
SynopticEditionEditor_6  = Error while getting available editions: 
33 43
SynopticEditionEditor_7  = Next page
34 44
SynopticEditionEditor_8  = Last page of the text
35
SynopticEditionEditor_9  = Warning: could not find edition for name: 
45
SynopticEditionEditor_9  = Warning: could not find edition for name={0}
46

  
47
CommandLink_empty=
48
EditionLink_error_no_arguments=Error: txmedition(corpusid, editionid?, textid?, wordid?) called with no arguments
49

  
50
preference_preference_fast_highlight=Enable fast word highlight
51
preference_title=Edition

Formats disponibles : Unified diff