Révision 2879
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/OpenBrowser.java (revision 2879) | ||
|---|---|---|
| 36 | 36 |
import org.eclipse.jface.viewers.ISelection; |
| 37 | 37 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 38 | 38 |
import org.eclipse.swt.SWT; |
| 39 |
import org.eclipse.swt.SWTError; |
|
| 39 | 40 |
import org.eclipse.swt.widgets.FileDialog; |
| 40 | 41 |
import org.eclipse.swt.widgets.Shell; |
| 42 |
import org.eclipse.ui.IEditorPart; |
|
| 41 | 43 |
import org.eclipse.ui.IWorkbenchPage; |
| 42 | 44 |
import org.eclipse.ui.IWorkbenchWindow; |
| 43 | 45 |
import org.eclipse.ui.PlatformUI; |
| ... | ... | |
| 147 | 149 |
static public TXMWebBrowserEditor openfile(String filepath) {
|
| 148 | 150 |
return openfile(filepath, new File(filepath).getName()); |
| 149 | 151 |
} |
| 150 |
|
|
| 152 |
|
|
| 151 | 153 |
static public void openExternalBrowser(String url) {
|
| 152 | 154 |
try {
|
| 153 | 155 |
PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(url)); |
| ... | ... | |
| 212 | 214 |
else |
| 213 | 215 |
editorInput = new WebBrowserEditorInput(new URL(filepath), |
| 214 | 216 |
BrowserViewer.BUTTON_BAR | BrowserViewer.LOCATION_BAR); |
| 215 |
|
|
| 217 |
|
|
| 216 | 218 |
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); |
| 217 | 219 |
//System.out.println("Window: "+window);
|
| 218 | 220 |
IWorkbenchPage page = window.getActivePage(); |
| 219 | 221 |
|
| 220 |
TXMWebBrowserEditor editor = (TXMWebBrowserEditor) page.openEditor(editorInput, |
|
| 221 |
TXMWebBrowserEditor.WEB_BROWSER_EDITOR_ID, true); |
|
| 222 |
editor.setTitle(editorname); |
|
| 223 |
|
|
| 224 |
return editor; |
|
| 222 |
try {
|
|
| 223 |
IEditorPart e = page.openEditor(editorInput, TXMWebBrowserEditor.WEB_BROWSER_EDITOR_ID, true); |
|
| 224 |
if (e instanceof TXMWebBrowserEditor) {
|
|
| 225 |
TXMWebBrowserEditor editor = (TXMWebBrowserEditor) e; |
|
| 226 |
editor.setTitle(editorname); |
|
| 227 |
return editor; |
|
| 228 |
} |
|
| 229 |
} catch (SWTError e) {
|
|
| 230 |
Log.severe("TXM could not open the internal browser: "+e);
|
|
| 231 |
Log.printStackTrace(e); |
|
| 232 |
} |
|
| 225 | 233 |
} catch (Exception e) {
|
| 226 | 234 |
Log.severe(TXMUIMessages.bind(TXMUIMessages.errorWhileOpeningBibliographicRecordP0WithURLEqualsP1, e.toString(), filepath)); |
| 227 | 235 |
System.out.println(TXMUIMessages.bind(TXMUIMessages.errorWhileOpeningBibliographicRecordP0WithURLEqualsP1, e.toString(), filepath)); |
Formats disponibles : Unified diff