Mylyn WikiText

org.eclipse.mylyn.wikitext.ui.editor
Class WikiTextSourceEditor

java.lang.Object
  extended by TextEditor
      extended by org.eclipse.mylyn.wikitext.ui.editor.WikiTextSourceEditor

public class WikiTextSourceEditor
extends TextEditor

A WikiText source editor. Users must set the document provider.

Since:
1.3
Author:
David Green
See Also:
AbstractWikiTextDocumentProvider

Field Summary
static String CONTEXT
          The source editing context.
static int PROP_OUTLINE
          The property id for editor outline change events.
static int PROP_OUTLINE_LOCATION
          The property id for outline location change events.
 
Constructor Summary
WikiTextSourceEditor()
           
 
Method Summary
protected  AbstractWikiTextSourceEditorOutline createContentOutline()
          subclasses may override to provide a non-default content outline.
protected  MarkupSourceViewer createMarkupSourceViewer(Composite parent, IVerticalRuler ruler, int styles)
          Create a markup source viewer.
protected  ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles)
           
 Object getAdapter(Class adapter)
           
 MarkupLanguage getMarkupLanguage()
          The markup language.
 OutlineItem getOutlineModel()
          Get the outline model for the document being edited.
 ShowInContext getShowInContext()
           
 void init(IEditorSite site, IEditorInput input)
           
protected  void initializeEditor()
           
protected  boolean isLineNumberRulerVisible()
           
 void selectAndReveal(OutlineItem item)
          Select and reveal the given outline item, based on its offset and length.
 void setDocumentProvider(IDocumentProvider provider)
          Users must set the document provider.
 void setMarkupLanguage(MarkupLanguage markupLanguage)
          set the markup language.
protected  void setSourceViewerConfiguration(SourceViewerConfiguration configuration)
          Set the source viewer configuration.
 boolean show(ShowInContext context)
           
 void updatePartControl(IEditorInput input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT

public static final String CONTEXT
The source editing context. This context id is activated via the IContextService when the editor is initialized. This context is also used as the editor help context id.

See Also:
Constant Field Values

PROP_OUTLINE

public static final int PROP_OUTLINE
The property id for editor outline change events. Clients wishing to react to changes in the outline should listen for this event.

See Also:
Constant Field Values

PROP_OUTLINE_LOCATION

public static final int PROP_OUTLINE_LOCATION
The property id for outline location change events. Outline location events are fired when navigation within the source document causes the nearest computed outline item to change. Clients wishing to react to changes in the location of the caret with respect to the current outline should listen for this event.

See Also:
Constant Field Values
Constructor Detail

WikiTextSourceEditor

public WikiTextSourceEditor()
Method Detail

setDocumentProvider

public void setDocumentProvider(IDocumentProvider provider)
Users must set the document provider.

See Also:
AbstractWikiTextDocumentProvider, WikiTextDocumentProvider

setSourceViewerConfiguration

protected void setSourceViewerConfiguration(SourceViewerConfiguration configuration)
Set the source viewer configuration. This method should be called in the constructor of subclasses.

Throws:
ClassCastException - if the configuration does not subclass MarkupSourceViewerConfiguration

createSourceViewer

protected ISourceViewer createSourceViewer(Composite parent,
                                           IVerticalRuler ruler,
                                           int styles)

createMarkupSourceViewer

protected MarkupSourceViewer createMarkupSourceViewer(Composite parent,
                                                      IVerticalRuler ruler,
                                                      int styles)
Create a markup source viewer. Subclasses may override.

Parameters:
parent - the parent of the source viewer
ruler - the vertical ruler
styles - the styles to pass to the viewer
Returns:
a new markup source viewer
See Also:
createSourceViewer(Composite, IVerticalRuler, int)

getMarkupLanguage

public MarkupLanguage getMarkupLanguage()
The markup language. If unspecified, it's assumed to be Textile.

Returns:
the current markup language, or null if it's unspecified.

setMarkupLanguage

public void setMarkupLanguage(MarkupLanguage markupLanguage)
set the markup language. If unspecified, it's assumed to be Textile.


initializeEditor

protected void initializeEditor()

init

public void init(IEditorSite site,
                 IEditorInput input)
          throws PartInitException
Throws:
PartInitException

getAdapter

public Object getAdapter(Class adapter)

createContentOutline

protected AbstractWikiTextSourceEditorOutline createContentOutline()
subclasses may override to provide a non-default content outline.


updatePartControl

public void updatePartControl(IEditorInput input)

getOutlineModel

public final OutlineItem getOutlineModel()
Get the outline model for the document being edited. The returned outline model is guaranteed to be up to date with respect to the current document. Note that the model will change if the document changes, however all changes occur on the UI thread.


getShowInContext

public ShowInContext getShowInContext()

isLineNumberRulerVisible

protected boolean isLineNumberRulerVisible()

show

public boolean show(ShowInContext context)

selectAndReveal

public void selectAndReveal(OutlineItem item)
Select and reveal the given outline item, based on its offset and length.

Parameters:
item - the item, must not be null

Mylyn WikiText

Copyright © 2007, 2009 David Green and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html