From: toshihiro Date: Mon, 30 Jul 2007 01:13:07 +0000 (+0000) Subject: Last revision caused warning if Browser View was not present when opening editor. X-Git-Url: http://secure.phpeclipse.com Last revision caused warning if Browser View was not present when opening editor. !MESSAGE WARNING: Prevented recursive attempt to activate part net.sourceforge.phpeclipse.webbrowser.views while still in the middle of activating part net.sourceforge.phpeclipse.PHPUnitEditor --- diff --git a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java index c471f50..154ddff 100644 --- a/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java +++ b/net.sourceforge.phpeclipse.ui/src/net/sourceforge/phpeclipse/ui/editor/ShowExternalPreviewAction.java @@ -7,11 +7,14 @@ import net.sourceforge.phpeclipse.webbrowser.views.BrowserView; 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; @@ -68,20 +71,26 @@ public class ShowExternalPreviewAction extends 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); } }