2 * Copyright (c) 2004 Christopher Lenz and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * Christopher Lenz - initial API and implementation
11 * $Id: BrowserPreview.java,v 1.1 2004-09-02 18:26:31 jsurfer Exp $
14 package net.sourceforge.phpeclipse.ui.views.preview;
16 import net.sourceforge.phpeclipse.ui.internal.WebUIMessages;
18 import org.eclipse.ui.IEditorPart;
19 import org.eclipse.ui.IWorkbenchPage;
20 import org.eclipse.ui.IWorkbenchPart;
21 import org.eclipse.ui.part.IPage;
22 import org.eclipse.ui.part.IPageBookViewPage;
23 import org.eclipse.ui.part.MessagePage;
24 import org.eclipse.ui.part.PageBook;
25 import org.eclipse.ui.part.PageBookView;
30 public class BrowserPreview extends PageBookView {
33 * @see PageBookView#createDefaultPage(org.eclipse.ui.part.PageBook)
35 protected IPage createDefaultPage(PageBook book) {
36 MessagePage page = new MessagePage();
37 page.createControl(book);
38 page.setMessage(WebUIMessages.getString(
39 "BrowserPreview.notAvailable")); //$NON-NLS-1$);
44 * @see PageBookView#doCreatePage(org.eclipse.ui.IWorkbenchPart)
46 protected PageRec doCreatePage(IWorkbenchPart part) {
47 // Try to get an outline page.
48 Object adapter = part.getAdapter(IBrowserPreviewPage.class);
49 if (adapter instanceof IBrowserPreviewPage) {
50 IBrowserPreviewPage page = (IBrowserPreviewPage) adapter;
51 if (page instanceof IPageBookViewPage) {
52 initPage((IPageBookViewPage) page);
54 page.createControl(getPageBook());
55 return new PageRec(part, page);
57 // There is no preview
62 * @see PageBookView#doDestroyPage(IWorkbenchPart, PageBookView.PageRec)
64 protected void doDestroyPage(IWorkbenchPart part, PageRec pageRecord) {
65 IBrowserPreviewPage page = (IBrowserPreviewPage) pageRecord.page;
71 * @see PageBookView#getBootstrapPart()
73 protected IWorkbenchPart getBootstrapPart() {
74 IWorkbenchPage page = getSite().getPage();
76 return page.getActiveEditor();
82 * @see PageBookView#isImportant(IWorkbenchPart)
84 protected boolean isImportant(IWorkbenchPart part) {
85 return (part instanceof IEditorPart);