private void openInBrowser(final IFile file) {
if (file == null) {
return;
}
final IWorkbench wbench = PlatformUI.getWorkbench();
final IWorkbenchBrowserSupport browserSupport = wbench.getBrowserSupport();
try {
file.refreshLocal(IResource.DEPTH_ZERO, null);
} catch (final CoreException e1) {
}
if (file.exists() && file.isAccessible()) {
try {
final int style = IWorkbenchBrowserSupport.NAVIGATION_BAR
| IWorkbenchBrowserSupport.AS_EDITOR;
final String name = file.getName();
final String browserId = getName() + "_" + name;
IWebBrowser browser;
browser = browserSupport.createBrowser(style, browserId, name, null);
try {
browser.openURL(file.getRawLocationURI().toURL());
} catch (final MalformedURLException e) {
// should not happen
ErlLogger.error(e);