Révision 3822

TXM/trunk/bundles/org.txm.backtomedia.rcp/src/vlcplayerrcp/messages.properties (revision 3822)
1 1

  
2
BackToMediaPosition=BackToMedia position
2 3
BackToMediaPreferencePage_1 = Open the player with the repeat option enable
3 4
BackToMediaPreferencePage_2 = Media span build strategy
4 5
BackToMediaPreferencePage_3 = Span to play
......
6 7
BackToMediaPreferencePage_5 = Structure
7 8
BackToMediaPreferencePage_6 = Start property
8 9
BackToMediaPreferencePage_7 = End property
10
Canceled=Canceled.
11
MediaPreferences=Media preferences
12
MediaPreferencesUpdatedWithP0=Media preferences updated with {0}
9 13

  
10 14
BackToMedia_0               = No StructuredSelection. Aborting.
11 15
BackToMedia_1               = Current editor is not a ConcordancesEditor. Aborting.
......
23 27
BackToMedia_7               = TEXT ID: 
24 28

  
25 29
cancel = Cancel
30
CouldNotOpenMediaFileP0=Could not open media file: {0}
31
EmbeddedPlayer=Embedded player
32
EnterFilePathOrURL=Enter file path or URL
33
ErrorCorpusWithIDP0NotFound=Corpus with ID={0} not found.
34
ErrorCouldNotOpenTheMediaPlayer=Error: could not open the MediaPlayer.
35
ErrorNoWordPropertyP0FoundInCorpusP1=No word property {0} found in corpus {1}.
26 36

  
27 37
error_native_libs = ERROR: failed to find VLC native libraries
28 38
error_open_media  = Error: could not open VLC player.
39
FailToFindWordsWithIdsP0InTextWithIdP1=Fail to find words with ids={0} in text with id={1}.
40
FailToFindWordWithIdP0InTextWithIdP1=Fail to find word with id={0} in text with id={1}
41
FailToOpenMediaForParametersCorpusP0TextP1WordP2P3=Fail open media for parameters corpus={0} text={1} word={2}: {3}
42
ImpossibleToFindVLC=** Impossible to find VLC (please check that you have at least VLC version 3.0).
43
ImpossibleToUseYourVLCP0=** Impossible to use your VLC [{0}] (please check that you have at least VLC version 3.0).
44
LeftLength=Left length
45
loginToP0=
46
MediaDirectoryNotFoundP0=Media directory not found: {0}
47
MediaFileNotFoundP0=Media file not found: {0}
48
MediaFileRegisterInTheIndexNotFoundP0=Media file register in the index not found: {0}
49
Minus10S=-10s
29 50

  
30 51
opening = Opening: 
31 52

  
32 53
opening_media = Opening media... 
54
OpeningMediaFile=Opening media file...
55
Opennnn=Open...
33 56

  
34 57
pause = PAUSE
58
Pause=Pause
59
Play=Play
60
PlayingMedia=Playing media...
61
Plus10S=+10s
35 62

  
36 63
play = PLAY
37 64

  
......
42 69
repeat = Repeat
43 70

  
44 71
resume = RESUME
72
Rate10=Rate (1.0)
73
Rate1f=Rate (%.1f)
74
RightLength=Right length
45 75

  
46 76
select_file       = Selecting file...
47 77
select_file_title = Select a audio/video file
48 78
select_object     = Selected object: 
49 79

  
50 80
stop = STOP
81
Stop=Stop
51 82

  
52 83
time_range = Time range
53 84

  
54 85
volume = Vol
86
VolumeP0=Volume ({0}%)
87
WarningFoundMoreThanOneWordForIdP0InP1=Warning: found more than one word for id={0} in {1}
88
WarningFoundMoreThanOrNoWordForIdP0P1InP2=Warning: found more than or no word for id={0},{1} in {2}
89
WarningFoundNoWordForIdP0InP1=Warning: found no word for id={0} in {1}
90
YouMustAuthenticateToAccessTheMediaFile=You must authenticate to access the media file
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/vlcplayerrcp/MessagesMP.java (revision 3822)
7 7
	
8 8
	private static final String BUNDLE_NAME = "vlcplayerrcp.messages"; //$NON-NLS-1$
9 9
	
10
	public static String Canceled;
11
	public static String MediaPreferences;
12
	public static String MediaPreferencesUpdatedWithP0;
13
	
10 14
	public static String BackToMedia_0;
11 15
	
12 16
	public static String BackToMedia_1;
......
35 39
	
36 40
	public static String BackToMedia_7;
37 41
	
42
	public static String BackToMediaPosition;
43

  
38 44
	public static String BackToMediaPreferencePage_1;
39 45
	
40 46
	public static String BackToMediaPreferencePage_2;
......
50 56
	public static String BackToMediaPreferencePage_7;
51 57
	
52 58
	public static String cancel;
59

  
60
	public static String CouldNotOpenMediaFileP0;
61

  
62
	public static String EmbeddedPlayer;
63

  
64
	public static String EnterFilePathOrURL;
65

  
66
	public static String ErrorCorpusWithIDP0NotFound;
67

  
68
	public static String ErrorCouldNotOpenTheMediaPlayer;
69

  
70
	public static String ErrorNoWordPropertyP0FoundInCorpusP1;
53 71
	
54 72
	public static String error_native_libs;
55 73
	
56 74
	public static String error_open_media;
75

  
76
	public static String FailToFindWordsWithIdsP0InTextWithIdP1;
77

  
78
	public static String FailToFindWordWithIdP0InTextWithIdP1;
79

  
80
	public static String FailToOpenMediaForParametersCorpusP0TextP1WordP2P3;
81

  
82
	public static String ImpossibleToFindVLC;
83

  
84
	public static String ImpossibleToUseYourVLCP0;
85

  
86
	public static String LeftLength;
87

  
88
	public static String loginToP0;
57 89
	
90
	public static String MediaDirectoryNotFoundP0;
91

  
92
	public static String MediaFileNotFoundP0;
93

  
94
	public static String MediaFileRegisterInTheIndexNotFoundP0;
95

  
96
	public static String Minus10S;
97

  
58 98
	public static String opening;
59 99
	
60 100
	public static String opening_media;
101

  
102
	public static String OpeningMediaFile;
103

  
104
	public static String Opennnn;
61 105
	
62 106
	public static String pause;
63 107
	
64 108
	public static String play;
65 109
	
110
	public static String Pause;
111

  
112
	public static String Play;
113

  
114
	public static String PlayingMedia;
115

  
116
	public static String Plus10S;
117

  
66 118
	public static String playing;
67 119
	
68 120
	public static String rate;
......
70 122
	public static String repeat;
71 123
	
72 124
	public static String resume;
125

  
126
	public static String Rate10;
127

  
128
	public static String Rate1f;
129

  
130
	public static String RightLength;
73 131
	
74 132
	public static String select_file;
75 133
	
......
78 136
	public static String select_object;
79 137
	
80 138
	public static String stop;
139

  
140
	public static String Stop;
81 141
	
82 142
	public static String time_range;
83 143
	
84 144
	public static String volume;
145

  
146
	public static String VolumeP0;
85 147
	
86 148
	
149
	public static String WarningFoundMoreThanOneWordForIdP0InP1;
150

  
151
	public static String WarningFoundMoreThanOrNoWordForIdP0P1InP2;
152

  
153
	public static String WarningFoundNoWordForIdP0InP1;
154

  
155
	public static String YouMustAuthenticateToAccessTheMediaFile;
156

  
157

  
87 158
	static {
88 159
		Utf8NLS.initializeMessages(BUNDLE_NAME, MessagesMP.class);
89 160
	}
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/OpenMediaPlayer.java (revision 3822)
69 69
		if (o instanceof IStructuredSelection) {
70 70
			selection = (IStructuredSelection) o;
71 71
			Object s = selection.getFirstElement();
72
			if (s instanceof File && !((File)s).isDirectory() && !((File)s).getName().endsWith(".groovy")) {
72
			if (s instanceof File && !((File)s).isDirectory() && !((File)s).getName().endsWith(".groovy")) { //$NON-NLS-1$
73 73
				
74 74
				File f = (File) s;
75 75
				
......
84 84
		}
85 85
		
86 86
		Shell sh = HandlerUtil.getActiveShell(event);
87
		SimpleFileDialog fd = new SimpleFileDialog(sh, "Opening media file...", "Enter file path or URL", BackToMediaPreferences.getInstance().getString(ID), null);
87
		SimpleFileDialog fd = new SimpleFileDialog(sh, MessagesMP.OpeningMediaFile, MessagesMP.EnterFilePathOrURL, BackToMediaPreferences.getInstance().getString(ID), null);
88 88
		// FileDialog fd = new FileDialog(new Shell(), SWT.SAVE);
89 89
		// fd.setText(MessagesMP.select_file);
90 90
		
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/MediaPreferences.java (revision 3822)
13 13
import org.txm.objects.CorpusCommandPreferences;
14 14
import org.txm.searchengine.cqp.corpus.MainCorpus;
15 15

  
16
import vlcplayerrcp.MessagesMP;
17

  
16 18
public class MediaPreferences extends AbstractHandler {
17 19
	
18 20
	@Override
......
51 53
				return false;
52 54
			}
53 55
			
54
			System.out.println("Media preferences updated with " + dialog.getProperties());
56
			System.out.println(MessagesMP.MediaPreferencesUpdatedWithP0 + dialog.getProperties());
55 57
			return true;
56 58
		}
57 59
		else {
58
			System.out.println("Canceled.");
60
			System.out.println(MessagesMP.Canceled);
59 61
			return false;
60 62
		}
61 63
	}
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/MediaPreferencesDialog.java (revision 3822)
22 22
import org.txm.objects.CorpusCommandPreferences;
23 23
import org.txm.searchengine.cqp.corpus.MainCorpus;
24 24

  
25
import vlcplayerrcp.MessagesMP;
26

  
25 27
public class MediaPreferencesDialog extends Dialog {
26 28
	
27 29
	public static String[] properties = { BackToMediaPreferences.REPEAT, 
......
73 75
			gd.minimumWidth = 200;
74 76
			t.setLayoutData(gd);
75 77
			t.setText(commandPreferences.get(p, alternative));
76
			if (p.contains("directory")) {
78
			if (p.contains("directory")) { //$NON-NLS-1$
77 79
				t.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1));
78 80
				Button b = new Button(c, SWT.PUSH);
79
				b.setText("...");
81
				b.setText("..."); //$NON-NLS-1$
80 82
				b.addSelectionListener(new SelectionListener() {
81 83
					
82 84
					@Override
......
103 105
	@Override
104 106
	protected void configureShell(Shell newShell) {
105 107
		super.configureShell(newShell);
106
		newShell.setText("Media preferences");
108
		newShell.setText(MessagesMP.MediaPreferences);
107 109
	}
108 110
	
109 111
	// @Override
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java (revision 3822)
108 108
		
109 109
		IWorkbenchPart page = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage().getActivePart();
110 110
		
111
		if (event.getParameter("corpus") != null && event.getParameter("text") != null && (event.getParameter("word") != null || event.getParameter("time") != null)) {
111
		if (event.getParameter("corpus") != null && event.getParameter("text") != null && (event.getParameter("word") != null || event.getParameter("time") != null)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
112 112
			
113 113
			String corpus_parameter = event.getParameter("corpus"); //$NON-NLS-1$
114 114
			String text_parameter = event.getParameter("text"); //$NON-NLS-1$
......
121 121
			try {
122 122
				CQPCorpus cqpCorpus = CorpusManager.getCorpusManager().getCorpus(corpus_parameter);
123 123
				if (cqpCorpus == null) {
124
					Log.warning(NLS.bind("Corpus with ID={0} not found.", corpus_parameter));
124
					Log.warning(NLS.bind(MessagesMP.ErrorCorpusWithIDP0NotFound, corpus_parameter));
125 125
					return null;
126 126
				}
127 127
				
......
139 139
				}
140 140
			}
141 141
			catch (Exception e) {
142
				Log.warning(TXMCoreMessages.bind("Fail open media for parameters corpus={0} text={1} word={2}: {3}", corpus_parameter, text_parameter, word_parameter, e));
142
				Log.warning(TXMCoreMessages.bind(MessagesMP.FailToOpenMediaForParametersCorpusP0TextP1WordP2P3, corpus_parameter, text_parameter, word_parameter, e));
143 143
				Log.printStackTrace(e);
144 144
			}
145 145
			return null;
......
184 184
			String[] ids = panel.getWordSelection();
185 185
			// System.out.println("Words: "+Arrays.toString(ids));
186 186
			if (ids == null || ids[0] == null) {
187
				return backToMedia(cqpCorpus, text.getName(), "0.0", null, editor, HandlerUtil.getActiveWorkbenchWindow(event).getShell());
187
				return backToMedia(cqpCorpus, text.getName(), "0.0", null, editor, HandlerUtil.getActiveWorkbenchWindow(event).getShell()); //$NON-NLS-1$
188 188
			}
189 189
			else if (ids[1] == null) { // only one word is selected -> using sync_mode preferences
190 190
				try {
......
197 197
			}
198 198
			else { // play the current word selection
199 199
				try {
200
					CQLQuery query = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", ids[0] + "|" + ids[ids.length - 1], text.getName()));
201
					QueryResult rez = cqpCorpus.query(query, "TMP", false);
200
					CQLQuery query = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", ids[0] + "|" + ids[ids.length - 1], text.getName())); //$NON-NLS-1$ //$NON-NLS-2$
201
					QueryResult rez = cqpCorpus.query(query, "TMP", false); //$NON-NLS-1$
202 202
					if (rez.getNMatch() == 2) {
203 203
						Match m = rez.getMatch(0);
204 204
						Match n = rez.getMatch(1);
......
212 212
						
213 213
						Property timeProperty = cqpCorpus.getProperty(pTimeName);
214 214
						if (timeProperty == null) {
215
							Log.warning(NLS.bind("No word property {0} found in corpus {1}.", pTimeName, cqpCorpus));
215
							Log.warning(NLS.bind(MessagesMP.ErrorNoWordPropertyP0FoundInCorpusP1, pTimeName, cqpCorpus));
216 216
							return null;
217 217
						}
218 218
						String start = m.getValueForProperty(timeProperty);
......
220 220
						return backToMedia(cqpCorpus, text.getName(), start, end, editor, HandlerUtil.getActiveWorkbenchWindow(event).getShell());
221 221
					}
222 222
					else {
223
						Log.warning(NLS.bind("Fail to find words with ids={0} in text with id={1}.", ids[0] + "|" + ids[ids.length - 1], text.getName()));
223
						Log.warning(NLS.bind(MessagesMP.FailToFindWordsWithIdsP0InTextWithIdP1, ids[0] + "|" + ids[ids.length - 1], text.getName())); //$NON-NLS-2$ //$NON-NLS-1$
224 224
						return null;
225 225
					}
226 226
				}
......
258 258
		Match n = null;
259 259
		
260 260
		if (wordids[1] == null) {
261
			CQLQuery query = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", wordids[0], textid));
262
			QueryResult rez = corpus.query(query, "TMP", false);
261
			CQLQuery query = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", wordids[0], textid)); //$NON-NLS-1$
262
			QueryResult rez = corpus.query(query, "TMP", false); //$NON-NLS-1$
263 263
			
264 264
			if (rez.getNMatch() == 0) {
265
				Log.warning(NLS.bind("Warning: found no word for id={0} in {1}", wordids[0], textid));
265
				Log.warning(NLS.bind(MessagesMP.WarningFoundNoWordForIdP0InP1, wordids[0], textid));
266 266
				return null;
267 267
			} else if (rez.getNMatch() > 1) {
268
				Log.warning(NLS.bind("Warning: found more than one word for id={0} in {1}", wordids[0], textid));
268
				Log.warning(NLS.bind(MessagesMP.WarningFoundMoreThanOneWordForIdP0InP1, wordids[0], textid));
269 269
			}
270 270
			
271 271
			m = rez.getMatch(0);
272 272
			n = rez.getMatch(0);
273 273
		}
274 274
		else if (wordids[0] != null && wordids[1] != null) {
275
			CQLQuery query = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", wordids[0] + "|" + wordids[1], textid));
276
			QueryResult rez = corpus.query(query, "TMP", false);
275
			CQLQuery query = new CQLQuery(NLS.bind("[id=\"{0}\" & _.text_id=\"{1}\"]", wordids[0] + "|" + wordids[1], textid)); //$NON-NLS-1$ //$NON-NLS-2$
276
			QueryResult rez = corpus.query(query, "TMP", false); //$NON-NLS-1$
277 277
			
278 278
			if (rez.getNMatch() != 2) {
279
				Log.warning(NLS.bind("Warning: found more than or no word for id={0} in {1}", wordids[0] + ", " + wordids[1], textid));
279
				Log.warning(NLS.bind(MessagesMP.WarningFoundMoreThanOrNoWordForIdP0P1InP2, wordids[0] + ", " + wordids[1], textid)); //$NON-NLS-2$ //$NON-NLS-1$
280 280
				return null;
281 281
			}
282 282
			
......
285 285
		}
286 286
		
287 287
		if (m == null || n == null) {
288
			Log.warning(NLS.bind("Fail to find word with id={0} in text with id={1}", Arrays.toString(wordids), textid));
288
			Log.warning(NLS.bind(MessagesMP.FailToFindWordWithIdP0InTextWithIdP1, Arrays.toString(wordids), textid));
289 289
			return null;
290 290
		}
291 291
		else {
......
416 416
		CorpusCommandPreferences commandPreferences = corpus.getProject().getCommandPreferences("backtomedia"); //$NON-NLS-1$
417 417
		
418 418
		String media_directory = commandPreferences.get(BackToMediaPreferences.MEDIA_PATH_PREFIX, alternative);
419
		boolean media_auth = "true".equals(commandPreferences.get(BackToMediaPreferences.MEDIA_AUTH, alternative));
419
		boolean media_auth = "true".equals(commandPreferences.get(BackToMediaPreferences.MEDIA_AUTH, alternative)); //$NON-NLS-1$
420 420
		String secured_media_login = commandPreferences.get(BackToMediaPreferences.MEDIA_AUTH_LOGIN, alternative);
421 421
		String media_format = commandPreferences.get(BackToMediaPreferences.MEDIA_EXTENSION, alternative);
422 422
		String media_index = commandPreferences.get(BackToMediaPreferences.MEDIA_INDEX_NODE, alternative);
......
430 430
				IEclipsePreferences node = corpus.getProject().getPreferencesScope().getNode(media_index);
431 431
				String path2 = node.get(textid, null);
432 432
				File audioFile = new File(path2);
433
				if (path2.startsWith("http:/")) {
433
				if (path2.startsWith("http:/")) { //$NON-NLS-1$
434 434
					try {
435 435
						InputStream conn = audioFile.toURI().toURL().openStream();
436 436
						conn.close();
437 437
						path = path2;
438 438
					}
439 439
					catch (Exception e) {
440
						Log.info("Could not open media file: " + path2);
440
						Log.info(MessagesMP.CouldNotOpenMediaFileP0 + path2);
441 441
					}
442 442
				}
443 443
				else if (!audioFile.exists()) {
444
					Log.info("Media file register in the index not found: " + audioFile);
444
					Log.info(MessagesMP.MediaFileRegisterInTheIndexNotFoundP0 + audioFile);
445 445
					return null;
446 446
				}
447 447
			}
......
456 456
						
457 457
						UsernamePasswordDialog dialog = new UsernamePasswordDialog(shell, new boolean[] { true, true }, url.getHost());
458 458
						dialog.setUsername(secured_media_login);
459
						dialog.setTitle("You must authenticate to access the media file");
459
						dialog.setTitle(MessagesMP.YouMustAuthenticateToAccessTheMediaFile);
460 460
						dialog.setDetails(NLS.bind(TXMUIMessages.loginToP0, new URL(media_directory).getHost()));
461 461
						if (dialog.open() == Window.OK) {
462 462
							System.setProperty(BackToMediaPreferences.MEDIA_AUTH_LOGIN, dialog.getUser());
......
471 471
				}
472 472
				
473 473
				File audioFile = new File(path_prefix, textid + "." + media_format); //$NON-NLS-1$
474
				if (path_prefix.startsWith("http")) {
474
				if (path_prefix.startsWith("http")) { //$NON-NLS-1$
475 475
					URL url = null;
476 476
					try {
477
						url = new URL(path_prefix + textid + "." + media_format);
477
						url = new URL(path_prefix + textid + "." + media_format); //$NON-NLS-1$
478 478
						if (!(media_auth)) {
479
							System.out.println("URL=" + url);
480 479
							InputStream conn = url.openStream();
481 480
							conn.close();
482 481
						}
483 482
						path = url.toString();
484 483
					}
485 484
					catch (Exception e) {
486
						Log.info("Could not open media file: " + url);
485
						Log.info(MessagesMP.CouldNotOpenMediaFileP0 + url);
487 486
					}
488 487
				}
489 488
				else { // local file
490 489
					if (!new File(path_prefix).exists()) {
491
						Log.info("Media directory not found: " + path_prefix);
490
						Log.info(MessagesMP.MediaDirectoryNotFoundP0 + path_prefix);
492 491
						return null;
493 492
					}
494 493
					else if (!audioFile.exists()) {
495
						Log.info("Media file not found: " + audioFile);
494
						Log.info(MessagesMP.MediaFileNotFoundP0 + audioFile);
496 495
						return null;
497 496
					}
498 497
					path = audioFile.toURI().toString();
......
548 547
				
549 548
				// editor.getPlayer().setRepeat(true);
550 549
				if (mediaPlayerEditor == null) {
551
					Log.warning("Error: could not open the MediaPlayer.");
550
					Log.warning(MessagesMP.ErrorCouldNotOpenTheMediaPlayer);
552 551
					return null;
553 552
				}
554 553
				
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/SimpleFileDialog.java (revision 3822)
36 36
		setErrorMessage(null);
37 37
		selectButton = new Button(p, SWT.PUSH);
38 38
		selectButton.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, true));
39
		selectButton.setText("...");
39
		selectButton.setText("..."); //$NON-NLS-1$
40 40
		selectButton.addSelectionListener(new SelectionListener() {
41 41
			
42 42
			@Override
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/preferences/BackToMediaPreferencePage.java (revision 3822)
114 114
		loopProperty = new BooleanFieldEditor(BackToMediaPreferences.REPEAT, MessagesMP.BackToMediaPreferencePage_1, getFieldEditorParent());
115 115
		addField(loopProperty);
116 116
		
117
		String[][] values = { { "OVER", "-1" }, { "ABOVE", "" + EModelService.ABOVE }, { "BELOW", "" + EModelService.BELOW }, { "LEFT_OF", "" + EModelService.LEFT_OF }, { "RIGHT_OF", "" + EModelService.RIGHT_OF } };
118
		backtotext_position = new ComboFieldEditor(BackToMediaPreferences.BACKTOMEDIA_POSITION, "BackToMedia position", values, getFieldEditorParent());
117
		String[][] values = { { "OVER", "-1" }, { "ABOVE", "" + EModelService.ABOVE }, { "BELOW", "" + EModelService.BELOW }, { "LEFT_OF", "" + EModelService.LEFT_OF }, { "RIGHT_OF", "" + EModelService.RIGHT_OF } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$
118
		backtotext_position = new ComboFieldEditor(BackToMediaPreferences.BACKTOMEDIA_POSITION, MessagesMP.BackToMediaPosition, values, getFieldEditorParent());
119 119
		addField(backtotext_position);
120 120
		
121 121
		String[][] choices = { { BackToMediaPreferences.WORDMODE, BackToMediaPreferences.WORDMODE },
......
139 139
		defaultWordTimeProperty = new StringFieldEditor(BackToMediaPreferences.WORD_PROPERTY, MessagesMP.BackToMediaPreferencePage_4, spanGroup);
140 140
		addField(defaultWordTimeProperty);
141 141
		
142
		wordLeftContextSizeProperty = new IntegerFieldEditor(BackToMediaPreferences.WORD_CONTEXT_LEFT_DISTANCE, "Left length", spanGroup);
142
		wordLeftContextSizeProperty = new IntegerFieldEditor(BackToMediaPreferences.WORD_CONTEXT_LEFT_DISTANCE, MessagesMP.LeftLength, spanGroup);
143 143
		addField(wordLeftContextSizeProperty);
144 144
		
145
		wordRightContextSizeProperty = new IntegerFieldEditor(BackToMediaPreferences.WORD_CONTEXT_RIGHT_DISTANCE, "Right length", spanGroup);
145
		wordRightContextSizeProperty = new IntegerFieldEditor(BackToMediaPreferences.WORD_CONTEXT_RIGHT_DISTANCE, MessagesMP.RightLength, spanGroup);
146 146
		addField(wordRightContextSizeProperty);
147 147
		
148 148
		defaultStructure = new StringFieldEditor(BackToMediaPreferences.STRUCTURE, MessagesMP.BackToMediaPreferencePage_5, spanGroup);
......
156 156
		
157 157
		updateEnables(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.SYNCMODE));
158 158
		
159
		String[][] players = {{ "HTML", "HTML" },  { "JFX", "JFX" }, { "VLC", "VLC" } };
160
		playerProperty = new ComboFieldEditor(BackToMediaPreferences.PLAYER, "Embedded player", players, getFieldEditorParent());
159
		String[][] players = {{ "HTML", "HTML" },  { "JFX", "JFX" }, { "VLC", "VLC" } }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
160
		playerProperty = new ComboFieldEditor(BackToMediaPreferences.PLAYER, MessagesMP.EmbeddedPlayer, players, getFieldEditorParent());
161 161
		addField(playerProperty);
162 162
	}
163 163
	
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/preferences/BackToMediaPreferences.java (revision 3822)
10 10
	// auto populate the preference node qualifier from the current bundle id
11 11
	// public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(BackToMediaPreferences.class).getSymbolicName();
12 12
	
13
	public static final String PREFERENCES_PREFIX = "backtomedia_";
13
	public static final String PREFERENCES_PREFIX = "backtomedia_"; //$NON-NLS-1$
14 14
	
15 15
	public static final String REPEAT = "backtomedia_loop"; //$NON-NLS-1$
16 16
	
......
29 29
	public static final String WORD_CONTEXT_RIGHT_DISTANCE = "backtomedia_word_context_right_distance"; //$NON-NLS-1$
30 30
	
31 31
	// the sync modes
32
	public static final String WORDMODE = "Word";
32
	public static final String WORDMODE = "Word"; //$NON-NLS-1$
33 33
	
34
	public static final String STRUCTUREMODE = "Structure";
34
	public static final String STRUCTUREMODE = "Structure"; //$NON-NLS-1$
35 35
	
36
	public static final String MILESTONEMODE = "Milestone";
36
	public static final String MILESTONEMODE = "Milestone"; //$NON-NLS-1$
37 37
	
38
	public static final String MEDIA_PATH_PREFIX = "media_path_prefix";
38
	public static final String MEDIA_PATH_PREFIX = "media_path_prefix"; //$NON-NLS-1$
39 39
	
40
	public static final String MEDIA_EXTENSION = "media_extension";
40
	public static final String MEDIA_EXTENSION = "media_extension"; //$NON-NLS-1$
41 41
	
42
	public static final String MEDIA_AUTH = "media_auth";
42
	public static final String MEDIA_AUTH = "media_auth"; //$NON-NLS-1$
43 43
	
44
	public static final String MEDIA_AUTH_LOGIN = "media_auth_login";
44
	public static final String MEDIA_AUTH_LOGIN = "media_auth_login"; //$NON-NLS-1$
45 45
	
46
	public static final String MEDIA_AUTH_PASSWORD = "media_auth_password";
46
	public static final String MEDIA_AUTH_PASSWORD = "media_auth_password"; //$NON-NLS-1$
47 47
	
48 48
	/**
49 49
	 * preferences node to media file access paths
50 50
	 */
51
	public static final String MEDIA_INDEX_NODE = "media_index_node";
51
	public static final String MEDIA_INDEX_NODE = "media_index_node"; //$NON-NLS-1$
52 52
	
53 53
	/**
54 54
	 * one of the EModelService position constant to use when opening editor: ABOVE = 0 BELOW = 1 LEFT_OF = 2 RIGHT_OF = 3
55 55
	 */
56 56
	public static final String BACKTOMEDIA_POSITION = "backtomedia_position"; //$NON-NLS-1$
57 57
	
58
	public static final String PLAYER = "player";
58
	public static final String PLAYER = "player"; //$NON-NLS-1$
59 59
	
60 60
	public BackToMediaPreferences() {
61 61
		// TODO Auto-generated constructor stub
......
66 66
		super.initializeDefaultPreferences();
67 67
		
68 68
		Preferences preferences = DefaultScope.INSTANCE.getNode(getPreferencesNodeQualifier());
69
		preferences.put(PLAYER, "HTML");
69
		preferences.put(PLAYER, "HTML"); //$NON-NLS-1$
70 70
		preferences.putBoolean(REPEAT, true);
71 71
		preferences.put(SYNCMODE, MILESTONEMODE);
72
		preferences.put(STRUCTURE, "u");
73
		preferences.put(STRUCTURE_START_PROPERTY, "start");
74
		preferences.put(STRUCTURE_END_PROPERTY, "end");
75
		preferences.put(WORD_PROPERTY, "time");
72
		preferences.put(STRUCTURE, "u"); //$NON-NLS-1$
73
		preferences.put(STRUCTURE_START_PROPERTY, "start"); //$NON-NLS-1$
74
		preferences.put(STRUCTURE_END_PROPERTY, "end"); //$NON-NLS-1$
75
		preferences.put(WORD_PROPERTY, "time"); //$NON-NLS-1$
76 76
		preferences.putInt(WORD_CONTEXT_LEFT_DISTANCE, 10); // conc + 2
77 77
		preferences.putInt(WORD_CONTEXT_RIGHT_DISTANCE, 15); // conc + 2
78 78
		preferences.putInt(BACKTOMEDIA_POSITION, EModelService.ABOVE);
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/HTMLPlayer.java (revision 3822)
30 30
import org.txm.rcp.editors.TXMBrowserEditor;
31 31
import org.txm.rcp.swt.GLComposite;
32 32

  
33
import vlcplayerrcp.MessagesMP;
34

  
33 35
public class HTMLPlayer extends Composite implements IPlayer {
34 36
	
35 37
	Browser browser;
......
84 86
		// use flex  to center the video
85 87
		// use ondataload fix the video size depending on its ratio and the viewport height
86 88
		// diable the fullscreen button, use a CSS special rule for webkit
87
		String html = "<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n" + 
88
				"<style>video::-webkit-media-controls-fullscreen-button {display: none;</style></head>\n" + 
89
				"<body><div style=\"display:flex;align-items: center;justify-content: center;\">\n" + 
90
				"<video id=\"video\" controls controlsList=\"nofullscreen nodownload\" onloadeddata=\"v = document.getElementById('video');r = v.videoWidth/v.videoHeight; v.style.width=(95*r)+'vh';\"></video></div></body></html>";
89
		String html = "<!DOCTYPE html><html><head><meta http-equiv=\"content-type\" content=\"text/html; charset=UTF-8\">\n" +  //$NON-NLS-1$
90
				"<style>video::-webkit-media-controls-fullscreen-button {display: none;</style></head>\n" +  //$NON-NLS-1$
91
				"<body><div style=\"display:flex;align-items: center;justify-content: center;\">\n" +  //$NON-NLS-1$
92
				"<video id=\"video\" controls controlsList=\"nofullscreen nodownload\" onloadeddata=\"v = document.getElementById('video');r = v.videoWidth/v.videoHeight; v.style.width=(95*r)+'vh';\"></video></div></body></html>"; //$NON-NLS-1$
91 93
		
92 94
		browser.setText(html); // <source> is set later
93 95
		
......
132 134
		
133 135
		Menu menu = new Menu(browser);
134 136
		MenuItem playStopItem = new MenuItem(menu, SWT.PUSH);
135
		playStopItem.setText("Play");
137
		playStopItem.setText(MessagesMP.Play);
136 138
		playStopItem.addSelectionListener(new SelectionListener() {
137 139
			
138 140
			@Override
......
144 146
			public void widgetDefaultSelected(SelectionEvent e) { }
145 147
		});
146 148
		MenuItem pauseItem = new MenuItem(menu, SWT.PUSH);
147
		pauseItem.setText("Pause");
149
		pauseItem.setText(MessagesMP.Pause);
148 150
		pauseItem.addSelectionListener(new SelectionListener() {
149 151
			
150 152
			@Override
......
157 159
		});
158 160
		
159 161
		MenuItem minus10Item = new MenuItem(menu, SWT.PUSH);
160
		minus10Item.setText("-10s");
162
		minus10Item.setText(MessagesMP.Minus10S);
161 163
		minus10Item.addSelectionListener(new SelectionListener() {
162 164
			
163 165
			@Override
......
170 172
		});
171 173
		
172 174
		MenuItem plus10Item = new MenuItem(menu, SWT.PUSH);
173
		plus10Item.setText("+10s");
175
		plus10Item.setText(MessagesMP.Plus10S);
174 176
		plus10Item.addSelectionListener(new SelectionListener() {
175 177
			
176 178
			@Override
......
184 186
		
185 187
		browser.setMenu(menu);
186 188
		
187
		GLComposite controls = new GLComposite(this, SWT.NONE, "controls");
189
		GLComposite controls = new GLComposite(this, SWT.NONE, "controls"); //$NON-NLS-1$
188 190
		controls.getLayout().numColumns = 20;
189 191
		controls.getLayout().horizontalSpacing = 2;
190 192
		
191 193
		if (!lightweight) {
192 194
			Button openButton = new Button(controls, SWT.PUSH);
193
			openButton.setText("Open...");
195
			openButton.setText(MessagesMP.Opennnn);
194 196
			openButton.addSelectionListener(new SelectionListener() {
195 197
				
196 198
				@Override
197 199
				public void widgetSelected(SelectionEvent event) {
198 200
					
199
					SimpleFileDialog fd = new SimpleFileDialog(HTMLPlayer.this.getDisplay().getActiveShell(), "Opening media file...", "Enter file path or URL", BackToMediaPreferences.getInstance().getString(OpenMediaPlayer.ID), null);
201
					SimpleFileDialog fd = new SimpleFileDialog(HTMLPlayer.this.getDisplay().getActiveShell(), MessagesMP.OpeningMediaFile, MessagesMP.EnterFilePathOrURL, BackToMediaPreferences.getInstance().getString(OpenMediaPlayer.ID), null);
200 202
					if (fd.open() == SimpleFileDialog.OK) {
201 203
						String mrl = fd.getValue();
202 204
						
......
219 221
			});
220 222
			
221 223
			stopButton = new Button(controls, SWT.PUSH);
222
			stopButton.setText("Stop");
224
			stopButton.setText(MessagesMP.Stop);
223 225
			stopButton.addSelectionListener(new SelectionListener() {
224 226
				
225 227
				@Override
......
233 235
			
234 236

  
235 237
			Button minus10Button = new Button(controls, SWT.PUSH);
236
			minus10Button.setText("-10s");
238
			minus10Button.setText(MessagesMP.Minus10S);
237 239
			minus10Button.addSelectionListener(new SelectionListener() {
238 240
				
239 241
				@Override
......
246 248
			});
247 249
			
248 250
			Button plus10Button = new Button(controls, SWT.PUSH);
249
			plus10Button.setText("+10s");
251
			plus10Button.setText(MessagesMP.Plus10S);
250 252
			plus10Button.addSelectionListener(new SelectionListener() {
251 253
				
252 254
				@Override
......
328 330
			//			volumneSpinner.setLayoutData(gdata);
329 331
			
330 332
			rateLabel = new Label(controls, SWT.NONE);
331
			rateLabel.setText("Rate (1.0)");
333
			rateLabel.setText(MessagesMP.Rate10);
332 334
			
333 335
			Scale rateSpinner = new Scale(controls, SWT.NONE);
334 336
			rateSpinner.setMinimum(10);
......
376 378
			
377 379
	protected float getTime() {
378 380
		
379
		Object time = browser.evaluate("return document.getElementById('video').currentTime;");
381
		Object time = browser.evaluate("return document.getElementById('video').currentTime;"); //$NON-NLS-1$
380 382
		if (time != null) {
381 383
			return Float.valueOf(time.toString());
382 384
		} else {
......
423 425
	public boolean play(String mrl, String startTime, String endTime) {
424 426
		
425 427
		int start=0, end=0;
426
		if (startTime.matches("[0-9]+.[0-9]+")) {
428
		if (startTime.matches("[0-9]+.[0-9]+")) { //$NON-NLS-1$
427 429
			start = (int) (Float.parseFloat(startTime));
428 430
		}
429
		else if (startTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
430
			if (startTime.indexOf(":") == 1) {
431
				startTime = "0" + startTime;
431
		else if (startTime.matches("[0-9]+:[0-9]+:[0-9]+")) { //$NON-NLS-1$
432
			if (startTime.indexOf(":") == 1) { //$NON-NLS-1$
433
				startTime = "0" + startTime; //$NON-NLS-1$
432 434
			}
433 435
			LocalTime time1 = LocalTime.parse(startTime, hhmmssFormatter);
434 436
			start =  ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
435 437
		}
436 438
		
437 439
		if (endTime != null) {
438
			if (endTime.matches("[0-9]+.[0-9]+")) {
440
			if (endTime.matches("[0-9]+.[0-9]+")) { //$NON-NLS-1$
439 441
				end = (int) ( Float.parseFloat(endTime));
440 442
			}
441
			else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
442
				if (endTime.indexOf(":") == 1) endTime = "0" + endTime;
443
			else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) { //$NON-NLS-1$
444
				if (endTime.indexOf(":") == 1) endTime = "0" + endTime; //$NON-NLS-1$ //$NON-NLS-2$
443 445
				LocalTime time1 = LocalTime.parse(endTime, hhmmssFormatter);
444 446
				end =  ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
445 447
			}
......
455 457
		//		browser.evaluate("document.getElementById('video');");
456 458
		//		
457 459
		if (login != null && mdp != null) {
458
			mrl2 = mrl2.replace("{0}", login).replace("{1}", mdp);
460
			mrl2 = mrl2.replace("{0}", login).replace("{1}", mdp); //$NON-NLS-1$ //$NON-NLS-2$
459 461
		} 
460 462
		//System.out.println("MEDIA URL: "+mrl2);
461
		String script = "";
463
		String script = ""; //$NON-NLS-1$
462 464
		
463 465
		if (HTMLPlayer.this.mrl == null || !HTMLPlayer.this.mrl.equals(mrl2)) {
464
			script += "document.getElementById('video').setAttribute('src', '"+mrl2+"');\n"; 
466
			script += "document.getElementById('video').setAttribute('src', '"+mrl2+"');\n";  //$NON-NLS-1$ //$NON-NLS-2$
465 467
			
466
			script += "document.getElementById('video').play();\n" +
467
					"document.getElementById('video').onloadedmetadata = function() {document.getElementById('video').currentTime = "+start+";};\n";
468
			script += "document.getElementById('video').play();\n" + //$NON-NLS-1$
469
					"document.getElementById('video').onloadedmetadata = function() {document.getElementById('video').currentTime = "+start+";};\n"; //$NON-NLS-1$ //$NON-NLS-2$
468 470
		} else {
469
			script += "document.getElementById('video').play();\n" +
470
					"document.getElementById('video').currentTime="+start+";\n";
471
			script += "document.getElementById('video').play();\n" + //$NON-NLS-1$
472
					"document.getElementById('video').currentTime="+start+";\n"; //$NON-NLS-1$ //$NON-NLS-2$
471 473
		}
472 474
		
473 475
		//System.out.println("EVAL: "+script);
......
490 492
		if (browser.isDisposed()) return;
491 493
		
492 494
		mrl = null;
493
		browser.evaluate("document.getElementById('video').pause();");
494
		browser.evaluate("document.getElementById('video').removeAttribute('src');");
495
		browser.evaluate("document.getElementById('video').pause();"); //$NON-NLS-1$
496
		browser.evaluate("document.getElementById('video').removeAttribute('src');"); //$NON-NLS-1$
495 497
		
496 498
	}
497 499
	
......
519 521
	@Override
520 522
	public void setRepeat(boolean b) {
521 523
		
522
		browser.evaluate("document.getElementById('video').loop="+b+";");
524
		browser.evaluate("document.getElementById('video').loop="+b+";"); //$NON-NLS-1$ //$NON-NLS-2$
523 525
		
524 526
	}
525 527
	//
......
533 535
	@Override
534 536
	public void seek(float time) {
535 537
		
536
		browser.evaluate("document.getElementById('video').currentTime="+time+";");
538
		browser.evaluate("document.getElementById('video').currentTime="+time+";"); //$NON-NLS-1$ //$NON-NLS-2$
537 539
		
538 540
	}
539 541
	
......
551 553
	@Override
552 554
	public void pause() {
553 555
		
554
		browser.evaluate("document.getElementById('video').pause();");
556
		browser.evaluate("document.getElementById('video').pause();"); //$NON-NLS-1$
555 557
		
556 558
	}
557 559
	
558 560
	@Override
559 561
	public void replay() {
560 562
		
561
		browser.evaluate("document.getElementById('video').currentTime=0;");
563
		browser.evaluate("document.getElementById('video').currentTime=0;"); //$NON-NLS-1$
562 564
		
563 565
	}
564 566
	
565 567
	@Override
566 568
	public void resume() {
567 569
		
568
		browser.evaluate("document.getElementById('video').play();");
570
		browser.evaluate("document.getElementById('video').play();"); //$NON-NLS-1$
569 571
		
570 572
	}
571 573
	
572 574
	@Override
573 575
	public void setVolume(double volume) {
574 576
		
575
		browser.evaluate("document.getElementById('video').volume="+volume/100.0d+";");
576
		if (volumeLabel != null && !volumeLabel.isDisposed()) volumeLabel.setText("Volume ("+(int)volume+"%)");
577
		browser.evaluate("document.getElementById('video').volume="+volume/100.0d+";"); //$NON-NLS-1$ //$NON-NLS-2$
578
		if (volumeLabel != null && !volumeLabel.isDisposed()) volumeLabel.setText(MessagesMP.VolumeP0+(int)volume+"%)"); //$NON-NLS-2$
577 579
	}
578 580
	
579 581
	@Override
580 582
	public void setRate(float rate) {
581 583
		
582
		browser.evaluate("document.getElementById('video').playbackRate="+rate+";");
583
		if (rateLabel != null && !rateLabel.isDisposed()) rateLabel.setText(String.format("Rate (%.1f)", rate));
584
		browser.evaluate("document.getElementById('video').playbackRate="+rate+";"); //$NON-NLS-1$ //$NON-NLS-2$
585
		if (rateLabel != null && !rateLabel.isDisposed()) rateLabel.setText(String.format(MessagesMP.Rate1f, rate));
584 586
		
585 587
	}
586 588
	
587 589
	@Override
588 590
	public boolean isPlaying() {
589
		Object o = browser.evaluate("return !document.getElementById('video').playing;");
591
		Object o = browser.evaluate("return !document.getElementById('video').playing;"); //$NON-NLS-1$
590 592
		if (o == null) return false;
591 593
		if (o instanceof Boolean) {
592 594
			return (Boolean)o;
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/VLCPlayer.java (revision 3822)
46 46
			
47 47
			@Override
48 48
			protected void onFound(String path, NativeDiscoveryStrategy strategy) {
49
				Log.finer("VLC NativeDiscovery: onFound " + path + " " + strategy);
49
				Log.finer("VLC NativeDiscovery: onFound " + path + " " + strategy); //$NON-NLS-1$ //$NON-NLS-2$
50 50
			}
51 51
			
52 52
			@Override
53 53
			protected void onNotFound() {
54
				Log.finer("VLC NativeDiscovery: Not found.");
54
				Log.finer("VLC NativeDiscovery: Not found."); //$NON-NLS-1$
55 55
			}
56 56
		};
57 57
		
58 58
		boolean found = discovery.discover();
59
		Log.finer("VLC NativeDiscovery: the discovery was succesfull ? " + found);
59
		Log.finer("VLC NativeDiscovery: the discovery was succesfull ? " + found); //$NON-NLS-1$
60 60
		if (found) {
61 61
			libvlc_instance_t instance = libvlc_new(0, new StringArray(new String[0]));
62
			Log.finer("VLC NativeDiscovery: VLC instance is " + instance);
62
			Log.finer("VLC NativeDiscovery: VLC instance is " + instance); //$NON-NLS-1$
63 63
			if (instance != null) {
64 64
				libvlc_release(instance);
65 65
			}
66 66
			else {
67
				Log.warning(NLS.bind("** Impossible to use your VLC [{0}] (please check that you have at least VLC version 3.0).", instance));
67
				Log.warning(NLS.bind(MessagesMP.ImpossibleToUseYourVLCP0, instance));
68 68
			}
69
			Log.finer("VLC NativeDiscovery: VLC version is " + new LibVlcVersion().getVersion());
69
			Log.finer("VLC NativeDiscovery: VLC version is " + new LibVlcVersion().getVersion()); //$NON-NLS-1$
70 70
		}
71 71
		else {
72
			Log.warning("** Impossible to find VLC (please check that you have at least VLC version 3.0).");
72
			Log.warning(MessagesMP.ImpossibleToFindVLC);
73 73
		}
74 74
	}
75 75
	
......
311 311
			public void widgetSelected(SelectionEvent e) {
312 312
				float rate = rateField.getSelection() / 100.0f;
313 313
				vlcPlayer.controls().setRate(rate);
314
				rateValueLabel.setText("" + rateField.getSelection() + "%");
314
				rateValueLabel.setText("" + rateField.getSelection() + "%"); //$NON-NLS-1$ //$NON-NLS-2$
315 315
			}
316 316
			
317 317
			@Override
......
338 338
			public void widgetSelected(SelectionEvent e) {
339 339
				vlcPlayer.audio().setVolume(volumeField.getSelection());
340 340
				volume = volumeField.getSelection();
341
				volumeValueLabel.setText("" + volume + "%");
341
				volumeValueLabel.setText("" + volume + "%"); //$NON-NLS-1$ //$NON-NLS-2$
342 342
			}
343 343
			
344 344
			@Override
......
346 346
		});
347 347
		
348 348
		volumeValueLabel = new Label(this, SWT.NONE);
349
		volumeValueLabel.setText("100%");
349
		volumeValueLabel.setText("100%"); //$NON-NLS-1$
350 350
		
351 351
		vlcPlayer.events().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
352 352
			
353 353
			@Override
354 354
			public void opening(MediaPlayer mediaPlayer) {
355 355
				if (videoComposite.isDisposed()) return;
356
				Log.finer("Opening media...");
356
				Log.finer("Opening media..."); //$NON-NLS-1$
357 357
			}
358 358
			
359 359
			@Override
360 360
			public void finished(MediaPlayer mediaPlayer) {
361 361
				if (videoComposite.isDisposed()) return;
362
				Log.finer("Finished playing media...");
362
				Log.finer("Finished playing media..."); //$NON-NLS-1$
363 363
				mediaPlayer.submit(new Runnable() {
364 364
					
365 365
					@Override
......
538 538
	@Override
539 539
	public boolean play(String mrl, String startTime, String endTime) {
540 540
		
541
		if (startTime.matches("[0-9]+.[0-9]+")) {
541
		if (startTime.matches("[0-9]+.[0-9]+")) { //$NON-NLS-1$
542 542
			start = (int) (1000 * Float.parseFloat(startTime));
543 543
		}
544
		else if (startTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
545
			if (startTime.indexOf(":") == 1) {
546
				startTime = "0" + startTime;
544
		else if (startTime.matches("[0-9]+:[0-9]+:[0-9]+")) { //$NON-NLS-1$
545
			if (startTime.indexOf(":") == 1) { //$NON-NLS-1$
546
				startTime = "0" + startTime; //$NON-NLS-1$
547 547
			}
548 548
			LocalTime time1 = LocalTime.parse(startTime, hhmmssFormatter);
549 549
			start = 1000 * ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
550 550
		}
551 551
		
552
		if (endTime.matches("[0-9]+.[0-9]+")) {
552
		if (endTime.matches("[0-9]+.[0-9]+")) { //$NON-NLS-1$
553 553
			end = (int) (1000 * Float.parseFloat(endTime));
554 554
		}
555
		else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) {
556
			if (endTime.indexOf(":") == 1) endTime = "0" + endTime;
555
		else if (endTime.matches("[0-9]+:[0-9]+:[0-9]+")) { //$NON-NLS-1$
556
			if (endTime.indexOf(":") == 1) endTime = "0" + endTime; //$NON-NLS-1$ //$NON-NLS-2$
557 557
			LocalTime time1 = LocalTime.parse(endTime, hhmmssFormatter);
558 558
			end = 1000 * ((time1.getHour() * 60 * 60) + (time1.getMinute() * 60) + time1.getSecond());
559 559
		}
......
562 562
		
563 563
		Log.finer(MessagesMP.bind(MessagesMP.playing, new Object[] { mrl, startTime, endTime }));
564 564
		
565
		String[] options = { " :live-caching=200" }; // reduce video stream cache duration to 200ms
565
		String[] options = { " :live-caching=200" }; // reduce video stream cache duration to 200ms //$NON-NLS-1$
566 566
		
567
		Log.finer("Preparing media...");
567
		Log.finer("Preparing media..."); //$NON-NLS-1$
568 568
		
569 569
		// inserting login+mdp
570 570
		String tmp = null;
571
		if (authenticatedURLMode && mrl.contains("{0}") && mrl.contains("{1}")
571
		if (authenticatedURLMode && mrl.contains("{0}") && mrl.contains("{1}") //$NON-NLS-1$ //$NON-NLS-2$
572 572
				&& System.getProperty(BackToMediaPreferences.MEDIA_AUTH_LOGIN) != null && System.getProperty(BackToMediaPreferences.MEDIA_AUTH_PASSWORD) != null) {
573 573
			tmp = NLS.bind(mrl, System.getProperty(BackToMediaPreferences.MEDIA_AUTH_LOGIN), System.getProperty(BackToMediaPreferences.MEDIA_AUTH_PASSWORD));
574 574
		}
......
576 576
		// use the patched URL if authenticatedURL is true
577 577
		if (authenticatedURLMode && tmp != null) {
578 578
			if (!vlcPlayer.media().prepare(tmp, options)) {
579
				Log.finer("** Impossible to prepare media.");
579
				Log.finer("** Impossible to prepare media."); //$NON-NLS-1$
580 580
				return false;
581 581
			}
582 582
		}
583 583
		else {
584 584
			if (!vlcPlayer.media().prepare(mrl, options)) {
585
				Log.finer("** Impossible to prepare media.");
585
				Log.finer("** Impossible to prepare media."); //$NON-NLS-1$
586 586
				return false;
587 587
			}
588 588
		}
589 589
		
590
		Log.finer("Is media valid ?");
590
		Log.finer("Is media valid ?"); //$NON-NLS-1$
591 591
		if (!vlcPlayer.media().isValid()) {
592
			Log.finer("** Invalid media.");
592
			Log.finer("** Invalid media."); //$NON-NLS-1$
593 593
			return false;
594 594
		}
595 595
		
596
		Log.info("Playing media...");
596
		Log.info(MessagesMP.PlayingMedia);
597 597
		vlcPlayer.controls().play();
598 598
		vlcPlayer.audio().setVolume(volume);
599 599
		vlcPlayer.controls().setTime(start);
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/player/MediaPlayerEditor.java (revision 3822)
21 21
	
22 22
	@Override
23 23
	public void createPartControl(Composite parent) {
24
		if ("VLC".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) {
24
		if ("VLC".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) { //$NON-NLS-1$
25 25
			player = new VLCPlayer(parent, SWT.BORDER);
26 26
		} else { //if ("HTML".equals(BackToMediaPreferences.getInstance().getString(BackToMediaPreferences.PLAYER))) {
27 27
			HTMLPlayer hplayer = new HTMLPlayer(parent, SWT.BORDER, this.getEditorInput().getLightWeightInterface());
TXM/trunk/bundles/org.txm.backtomedia.rcp/src/uk/co/caprica/vlcj/player/embedded/videosurface/swt/CompositeVideoSurface.java (revision 3822)
67 67
		Field _idField;
68 68
		try {
69 69
			if (RuntimeUtil.isMac()) {
70
				_viewField = Control.class.getDeclaredField("view");
70
				_viewField = Control.class.getDeclaredField("view"); //$NON-NLS-1$
71 71
				Object view = _viewField.get(c);
72
				Class<?> idClass = Class.forName("org.eclipse.swt.internal.cocoa.id");
73
				_idField = idClass.getDeclaredField("id");
72
				Class<?> idClass = Class.forName("org.eclipse.swt.internal.cocoa.id"); //$NON-NLS-1$
73
				_idField = idClass.getDeclaredField("id"); //$NON-NLS-1$
74 74
				handle = _idField.getLong(view);
75 75
				
76 76
			}
77 77
			else if (RuntimeUtil.isNix()) {
78
				_idField = Composite.class.getDeclaredField("embeddedHandle");
78
				_idField = Composite.class.getDeclaredField("embeddedHandle"); //$NON-NLS-1$
79 79
				handle = _idField.getLong(c);
80 80
			}
81 81
			else {
82
				_idField = Control.class.getDeclaredField("handle");
82
				_idField = Control.class.getDeclaredField("handle"); //$NON-NLS-1$
83 83
				handle = _idField.getLong(c);
84 84
			}
85 85
		}

Formats disponibles : Unified diff