com.ibm.lab.soln.interopedit.editors
Class ActiveXHTMLEditor

java.lang.Object
  |
  +--org.eclipse.ui.part.WorkbenchPart
        |
        +--org.eclipse.ui.part.EditorPart
              |
              +--org.eclipse.ui.part.MultiPageEditorPart
                    |
                    +--com.ibm.lab.soln.interopedit.editors.ActiveXHTMLEditor
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.ui.IEditorPart, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.ui.IWorkbenchPart

public class ActiveXHTMLEditor
extends org.eclipse.ui.part.MultiPageEditorPart

In this exercise we take some existing function and incoporate it into an Eclipse-aware plug-in building on the Eclipse platform frameworks. Using the Microsoft Web Browser control, we integrate that Web Browser editing capeability into an Eclipse multi-page editor using editor input from Eclipse resources and connecting custom actions to the workbench toolbar and menus. The user does not use the browser in a way to navigate to a specific document, rather the navigation occurs inside Eclipse when the user opens an *.htm file in their workspace. When the user saves the document, all changes to the *htm file are saved in the workspace. There is no need to refresh the workspace manually.


Field Summary
static java.lang.String EDITOR_LABEL
           
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Constructor Summary
ActiveXHTMLEditor()
          Constructor for ActiveXHTMLEditor.
 
Method Summary
protected  void createPages()
          This is the method which create a text editor page and a page that hosts the IE ActiveX control.
 void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
          This method gets the text editor page and saves the contents.
 void doSaveAs()
          This implements a save as on the text editor input
 ActiveXWebBrowser getBrowser()
          A getter method to the editor page hosting the ActiveX (browser) control.
 void gotoMarker(org.eclipse.core.resources.IMarker marker)
           
 void init(org.eclipse.ui.IEditorSite site, org.eclipse.ui.IEditorInput input)
          The ActiveXHTMLEditor implementation of this method checks that the input is an instance of IFileEditorInput.
 boolean isDirty()
           
 boolean isSaveAsAllowed()
           
protected  void pageChange(int newPageIndex)
          This method syncronizes the contents of the text editor input and the the contents of the IE ActiveX control.
 
Methods inherited from class org.eclipse.ui.part.MultiPageEditorPart
addPage, addPage, createPartControl, createSite, dispose, getActiveEditor, getActivePage, getContainer, getControl, getEditor, getPageCount, getPageImage, getPageText, handlePropertyChange, removePage, setActivePage, setControl, setFocus, setPageImage, setPageText
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setInput
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, firePropertyChange, getAdapter, getConfigurationElement, getDefaultImage, getSite, getTitle, getTitleImage, removePropertyListener, setInitializationData, setSite, setTitle, setTitleImage, setTitleToolTip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, removePropertyListener
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Field Detail

EDITOR_LABEL

public static final java.lang.String EDITOR_LABEL
Constructor Detail

ActiveXHTMLEditor

public ActiveXHTMLEditor()
Constructor for ActiveXHTMLEditor.
Method Detail

createPages

protected void createPages()
This is the method which create a text editor page and a page that hosts the IE ActiveX control.
Overrides:
createPages in class org.eclipse.ui.part.MultiPageEditorPart
See Also:
MultiPageEditorPart.createPages()

doSave

public void doSave(org.eclipse.core.runtime.IProgressMonitor monitor)
This method gets the text editor page and saves the contents.
Overrides:
doSave in class org.eclipse.ui.part.EditorPart
See Also:
IEditorPart.doSave(IProgressMonitor)

doSaveAs

public void doSaveAs()
This implements a save as on the text editor input
Overrides:
doSaveAs in class org.eclipse.ui.part.EditorPart
See Also:
IEditorPart.doSaveAs()

getBrowser

public ActiveXWebBrowser getBrowser()
A getter method to the editor page hosting the ActiveX (browser) control.

gotoMarker

public void gotoMarker(org.eclipse.core.resources.IMarker marker)
Overrides:
gotoMarker in class org.eclipse.ui.part.EditorPart
See Also:
IEditorPart.gotoMarker(IMarker)

init

public void init(org.eclipse.ui.IEditorSite site,
                 org.eclipse.ui.IEditorInput input)
          throws org.eclipse.ui.PartInitException
The ActiveXHTMLEditor implementation of this method checks that the input is an instance of IFileEditorInput.
Overrides:
init in class org.eclipse.ui.part.MultiPageEditorPart
See Also:
IEditorPart.init(IEditorSite, IEditorInput)

isDirty

public boolean isDirty()
Overrides:
isDirty in class org.eclipse.ui.part.MultiPageEditorPart

isSaveAsAllowed

public boolean isSaveAsAllowed()
Overrides:
isSaveAsAllowed in class org.eclipse.ui.part.EditorPart
See Also:
IEditorPart.isSaveAsAllowed()

pageChange

protected void pageChange(int newPageIndex)
This method syncronizes the contents of the text editor input and the the contents of the IE ActiveX control.
Overrides:
pageChange in class org.eclipse.ui.part.MultiPageEditorPart
See Also:
MultiPageEditorPart.pageChange(int)