Revision 2367

tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/BackToMedia.java (revision 2367)
368 368
				// editor.getPlayer().setRepeat(true);
369 369
				if (vlcEditor == null) { return null; }
370 370
				
371
				if (!vlcEditor.isMediaLoaded()) {
372
					if (media_auth) {
373
						System.clearProperty(BackToMediaPreferences.MEDIA_AUTH_PASSWORD);
374
					}
375
					vlcEditor.getSite().getPage().closeEditor(vlcEditor, false);
376
				}
377
				
371 378
				// move the editor in the window
372 379
				int position = BackToMediaPreferences.getInstance().getInt(BackToMediaPreferences.BACKTOMEDIA_POSITION);
373 380
				if (editor != null) {
tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/commands/function/OpenVLCPlayer.java (revision 2367)
93 93
	public static void openEditor(String mrl,  int time) {
94 94
		IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
95 95
		VLCPlayerEditorInput editorInput = new VLCPlayerEditorInput();
96
		StatusLine.setMessage(MessagesMP.opening_media+mrl);
96
		StatusLine.setMessage(MessagesMP.opening_media);
97 97
		try {
98 98
			VLCPlayerEditor player = (VLCPlayerEditor) page
99 99
					.openEditor(editorInput,VLCPlayerEditor.ID);
100
			if (player != null)
100
			if (player != null) {
101 101
				player.getPlayer().play(mrl, time);
102
			if (mrl != null) {
103
				player.setPartName(new File(mrl).getName());
102
				StatusLine.setMessage("");
103
				if (mrl != null) {
104
					player.setPartName(new File(mrl).getName());
105
				}
106
			} else {
107
				System.out.println(MessagesMP.error_open_media);
104 108
			}
105
			else 
106
				System.out.println(MessagesMP.error_open_media);
107 109
		} catch (PartInitException e) {
108 110
			e.printStackTrace();
109 111
		}
......
112 114
	public static VLCPlayerEditor openEditor(String mrl, int time, int endtime) {
113 115
		IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
114 116
		VLCPlayerEditorInput editorInput = new VLCPlayerEditorInput();
115
		StatusLine.setMessage(MessagesMP.opening_media+mrl);
117
		StatusLine.setMessage(MessagesMP.opening_media);
116 118
		try {
117
			VLCPlayerEditor player = (VLCPlayerEditor) page
118
					.openEditor(editorInput,VLCPlayerEditor.ID);
119
			VLCPlayerEditor player = (VLCPlayerEditor) page.openEditor(editorInput,VLCPlayerEditor.ID);
119 120
			
120
			boolean isAudio = mrl.matches(".+\\.(mp3|ogg|wav|wpa)"); //$NON-NLS-1$
121
			//boolean isAudio = mrl.matches(".+\\.(mp3|ogg|wav|wpa)"); //$NON-NLS-1$
121 122
			if (player != null) {
122 123
				player.getPlayer().play(mrl, time, endtime);
124
				StatusLine.setMessage("");
123 125
			} else {
124 126
				System.out.println(MessagesMP.error_open_media);
125 127
				return null;
......
136 138
			String sEndTime) {
137 139
		IWorkbenchPage page = TXMWindows.getActiveWindow().getActivePage();
138 140
		VLCPlayerEditorInput editorInput = new VLCPlayerEditorInput();
139
		StatusLine.setMessage(MessagesMP.opening_media+path);
141
		StatusLine.setMessage(MessagesMP.opening_media);
140 142
		try {
141
			VLCPlayerEditor player = (VLCPlayerEditor) page
142
					.openEditor(editorInput,VLCPlayerEditor.ID);
143
			VLCPlayerEditor player = (VLCPlayerEditor) page.openEditor(editorInput,VLCPlayerEditor.ID);
143 144
			
144 145
			//boolean isAudio = mrl.matches(".+\\.(mp3|ogg|wav|wpa)");
145 146
			if (player != null) {
146 147
				player.getPlayer().play(path, sStartTime, sEndTime);
148
				StatusLine.setMessage("");
147 149
			} else {
148 150
				System.out.println(MessagesMP.error_open_media);
149 151
				return null;
tmp/org.txm.backtomedia.rcp/src/org/txm/backtomedia/editors/vlcplayer/VLCPlayerEditor.java (revision 2367)
80 80
	public boolean isDirty() {
81 81
		return false;
82 82
	}
83

  
84
	/**
85
	 * for more test use "player.getEmbeddedMediaPlayer()"
86
	 * @return false if the media could not be loaded (file not found, access error...)
87
	 */
88
	public boolean isMediaLoaded() {
89
		return player.getEmbeddedMediaPlayer().isMediaParsed() 
90
				&& player.getEmbeddedMediaPlayer().isPlayable();
91
	}
83 92
}
tmp/org.txm.backtomedia.rcp/plugin.xml (revision 2367)
44 44
         <command
45 45
               commandId="org.txm.backtomedia.commands.function.MediaPreferences"
46 46
               style="push">
47
            <visibleWhen
48
                  checkEnabled="false">
49
               <reference
50
                     definitionId="OneMainCorpusSelected">
51
               </reference>
52
            </visibleWhen>
47 53
         </command>
48 54
      </menuContribution>
49 55
   </extension>

Also available in: Unified diff