import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
import org.eclipse.ui.texteditor.ITextEditor;
import org.eclipse.ui.texteditor.TextEditorAction;
if (autoPreview) {
IWorkbenchPage page = WebUI.getActivePage();
try {
- IViewPart part = page.findView(BrowserView.ID_BROWSER);
- if (part == null) {
- part = page.showView(BrowserView.ID_BROWSER);
- } else {
+ // IViewPart part = page.findView(BrowserView.ID_BROWSER);
+ // if (part == null) {
+ // part = page.showView(BrowserView.ID_BROWSER);
+ // }
+ IViewPart part = page.showView(BrowserView.ID_BROWSER, null,
+ IWorkbenchPage.VIEW_CREATE);
+ if (part != null) {
if (bringToTopPreview) {
page.bringToTop(part);
}
- }
- if (part != null) {
// ((BrowserView) part).refresh();
String localhostURL = getLocalhostURL(null, previewFile);
((BrowserView) part).refresh(localhostURL);
}
- } catch (Exception e) {
+ } catch (PartInitException e) {
+ // ad hoc
+ WebUI.getDefault().getLog().log(
+ new Status(IStatus.ERROR,
+ "net.sourceforge.phpeclipse.ui", IStatus.OK,
+ "Failed to show Browser View", e));
// PHPeclipsePlugin.log(e);
}
}