package net.sourceforge.phpeclipse.wiki.editor;
-import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
-import net.sourceforge.phpeclipse.wiki.preferences.Util;
-import org.eclipse.core.resources.IFile;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
import org.eclipse.ui.texteditor.ITextEditor;
super.setActiveEditor(part);
ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
fContentAssist.setAction(getAction(editor, CONTENTASSIST_ACTION));
- // jsurfer
- setBrowserPreview(editor);
- }
-
- public void setBrowserPreview(ITextEditor editor) {
- IWorkbenchPage page = WikiEditorPlugin.getDefault().getActivePage();
- try {
- IViewPart part = page.findView(BrowserView.ID_BROWSER);
- if (part == null) {
- part = page.showView(BrowserView.ID_BROWSER);
- } else {
- // if (bringToTopPreview) {
- // page.bringToTop(part);
- // }
- }
- IEditorInput editorInput = null;
- if (editor != null) {
- editorInput = editor.getEditorInput();
- }
- if (editorInput instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput) editorInput).getFile();
- String srcBasePath = Util.getWikiTextsPath(file);
- String binBasePath = Util.getProjectsWikiOutputPath(file.getProject(), WikiEditorPlugin.HTML_OUTPUT_PATH);
- String htmlName = Util.getHTMLFileName(file, binBasePath, srcBasePath);
- if (htmlName!=null) {
- ((BrowserView) part).setUrl(htmlName);
- }
- }
- } catch (Exception e) {
- }
+
+ BrowserUtil.setBrowserPreview(editor);
}
public void contributeToMenu(IMenuManager menu) {