org.eclipse.cdt.internal.ui.editor
Class CEditor

java.lang.Object
  extended by org.eclipse.core.commands.common.EventManager
      extended by org.eclipse.ui.part.WorkbenchPart
          extended by org.eclipse.ui.part.EditorPart
              extended by org.eclipse.ui.texteditor.AbstractTextEditor
                  extended by org.eclipse.ui.texteditor.StatusTextEditor
                      extended by org.eclipse.ui.texteditor.AbstractDecoratedTextEditor
                          extended by org.eclipse.ui.editors.text.TextEditor
                              extended by org.eclipse.cdt.internal.ui.editor.CEditor
All Implemented Interfaces:
ICReconcilingListener, org.eclipse.core.runtime.IAdaptable, org.eclipse.core.runtime.IExecutableExtension, org.eclipse.jface.viewers.ISelectionChangedListener, org.eclipse.ui.IEditorPart, org.eclipse.ui.INavigationLocationProvider, org.eclipse.ui.IReusableEditor, org.eclipse.ui.ISaveablePart, org.eclipse.ui.IWorkbenchPart, org.eclipse.ui.IWorkbenchPart2, org.eclipse.ui.part.IWorkbenchPartOrientation, org.eclipse.ui.texteditor.ITextEditor, org.eclipse.ui.texteditor.ITextEditorExtension, org.eclipse.ui.texteditor.ITextEditorExtension2, org.eclipse.ui.texteditor.ITextEditorExtension3, org.eclipse.ui.texteditor.ITextEditorExtension4
Direct Known Subclasses:
ExternalSearchEditor

public class CEditor
extends org.eclipse.ui.editors.text.TextEditor
implements org.eclipse.jface.viewers.ISelectionChangedListener, ICReconcilingListener

C/C++ source editor.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
org.eclipse.ui.texteditor.ITextEditorExtension3.InsertMode
 
Field Summary
static java.lang.String INACTIVE_CODE_COLOR
          Preference key for inactive code painter color
static java.lang.String INACTIVE_CODE_ENABLE
          Preference key for inactive code painter enablement
static java.lang.String MATCHING_BRACKETS
          Preference key for matching brackets
static java.lang.String MATCHING_BRACKETS_COLOR
          Preference key for matching brackets color
static java.lang.String SPACES_FOR_TABS
          Preference key for inserting spaces rather than tabs
static java.lang.String SUB_WORD_NAVIGATION
          Preference key for sub-word navigation, aka smart caret positioning
 
Fields inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
DEFAULT_EDITOR_CONTEXT_MENU_ID, DEFAULT_RULER_CONTEXT_MENU_ID, PREFERENCE_COLOR_BACKGROUND, PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_FIND_SCOPE, PREFERENCE_COLOR_FOREGROUND, PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_SELECTION_BACKGROUND, PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT, PREFERENCE_COLOR_SELECTION_FOREGROUND, PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT, PREFERENCE_FONT, PREFERENCE_HYPERLINK_KEY_MODIFIER, PREFERENCE_HYPERLINK_KEY_MODIFIER_MASK, PREFERENCE_HYPERLINKS_ENABLED, PREFERENCE_NAVIGATION_SMART_HOME_END, PREFERENCE_USE_CUSTOM_CARETS, PREFERENCE_WIDE_CARET
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Fields inherited from interface org.eclipse.ui.IEditorPart
PROP_DIRTY, PROP_INPUT
 
Fields inherited from interface org.eclipse.ui.IWorkbenchPart
PROP_TITLE
 
Fields inherited from interface org.eclipse.ui.texteditor.ITextEditorExtension3
INSERT, SMART_INSERT
 
Constructor Summary
CEditor()
          Default constructor.
 
Method Summary
 void aboutToBeReconciled()
          Called before reconciling is started.
 void addReconcileListener(ICReconcilingListener listener)
          Adds the given listener.
 void createPartControl(org.eclipse.swt.widgets.Composite parent)
           
 void dispose()
           
 void editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu)
           
 void fillActionBars(org.eclipse.ui.IActionBars actionBars)
          Called whenever the editor is activated and allows for registering action handlers.
 java.lang.Object getAdapter(java.lang.Class required)
           
 org.eclipse.cdt.core.model.ICElement getInputCElement()
          Returns the C element wrapped by this editors input.
 int getOrientation()
           
 CContentOutlinePage getOutlinePage()
          Gets the outline page of the c-editor.
 org.eclipse.jface.text.source.ISourceViewer getViewer()
           
 void gotoMatchingBracket()
          Jumps to the matching bracket.
 boolean isSaveAsAllowed()
           
 void reconciled(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit ast, boolean force, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          Called after reconciling has been finished.
 void removeReconcileListener(ICReconcilingListener listener)
          Removes the given listener.
 void resetProjection()
          Resets the foldings structure according to the folding preferences.
 void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
          React to changed selection in the outline view.
static void setOutlinePageInput(CContentOutlinePage page, org.eclipse.ui.IEditorInput input)
          Sets an input for the outline page.
 void setSelection(org.eclipse.cdt.core.model.ICElement element)
          Sets selection for C element.
 void setSelection(org.eclipse.cdt.core.model.ISourceRange element, boolean moveCursor)
          Sets the current editor selection to the source range.
 void setSelection(org.eclipse.cdt.core.model.ISourceReference element, boolean moveCursor)
          Sets selection for source reference.
 void updatedTitleImage(org.eclipse.swt.graphics.Image image)
          Update the title image.
 
Methods inherited from class org.eclipse.ui.texteditor.AbstractDecoratedTextEditor
getDocumentProvider, gotoAnnotation, gotoMarker, isChangeInformationShowing, showChangeInformation, showRevisionInformation
 
Methods inherited from class org.eclipse.ui.texteditor.StatusTextEditor
doRevertToSaved, updatePartControl
 
Methods inherited from class org.eclipse.ui.texteditor.AbstractTextEditor
addRulerContextMenuListener, close, createEmptyNavigationLocation, createNavigationLocation, doSave, doSaveAs, getAction, getHighlightRange, getInsertMode, getSelectionProvider, init, isDirty, isEditable, isEditorInputModifiable, isEditorInputReadOnly, markAsContentDependentAction, markAsPropertyDependentAction, markAsSelectionDependentAction, markAsStateDependentAction, removeActionActivationCode, removeRulerContextMenuListener, resetHighlightRange, selectAndReveal, setAction, setActionActivationCode, setFocus, setHighlightRange, setInput, setInsertMode, setStatusField, showHighlightRangeOnly, showsHighlightRangeOnly, validateEditorInputState
 
Methods inherited from class org.eclipse.ui.part.EditorPart
getEditorInput, getEditorSite, getTitleToolTip, isSaveOnCloseNeeded, setInitializationData
 
Methods inherited from class org.eclipse.ui.part.WorkbenchPart
addPropertyListener, getContentDescription, getPartName, getSite, getTitle, getTitleImage, removePropertyListener, showBusy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSite
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.ui.ISaveablePart
isSaveOnCloseNeeded
 
Methods inherited from interface org.eclipse.ui.IEditorPart
getEditorInput, getEditorSite
 
Methods inherited from interface org.eclipse.ui.IWorkbenchPart
addPropertyListener, getSite, getTitle, getTitleImage, getTitleToolTip, removePropertyListener
 
Methods inherited from interface org.eclipse.ui.ISaveablePart
isSaveOnCloseNeeded
 

Field Detail

SUB_WORD_NAVIGATION

public static final java.lang.String SUB_WORD_NAVIGATION
Preference key for sub-word navigation, aka smart caret positioning

See Also:
Constant Field Values

MATCHING_BRACKETS

public static final java.lang.String MATCHING_BRACKETS
Preference key for matching brackets

See Also:
Constant Field Values

MATCHING_BRACKETS_COLOR

public static final java.lang.String MATCHING_BRACKETS_COLOR
Preference key for matching brackets color

See Also:
Constant Field Values

INACTIVE_CODE_ENABLE

public static final java.lang.String INACTIVE_CODE_ENABLE
Preference key for inactive code painter enablement

See Also:
Constant Field Values

INACTIVE_CODE_COLOR

public static final java.lang.String INACTIVE_CODE_COLOR
Preference key for inactive code painter color

See Also:
Constant Field Values

SPACES_FOR_TABS

public static final java.lang.String SPACES_FOR_TABS
Preference key for inserting spaces rather than tabs

See Also:
Constant Field Values
Constructor Detail

CEditor

public CEditor()
Default constructor.

Method Detail

updatedTitleImage

public void updatedTitleImage(org.eclipse.swt.graphics.Image image)
Update the title image.

Parameters:
image - Title image.

getInputCElement

public org.eclipse.cdt.core.model.ICElement getInputCElement()
Returns the C element wrapped by this editors input.

Returns:
the C element wrapped by this editors input.
Since:
3.0

isSaveAsAllowed

public boolean isSaveAsAllowed()
Specified by:
isSaveAsAllowed in interface org.eclipse.ui.ISaveablePart
Overrides:
isSaveAsAllowed in class org.eclipse.ui.editors.text.TextEditor
See Also:
ISaveablePart.isSaveAsAllowed()

getOutlinePage

public CContentOutlinePage getOutlinePage()
Gets the outline page of the c-editor.

Returns:
Outline page.

getAdapter

public java.lang.Object getAdapter(java.lang.Class required)
Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
Overrides:
getAdapter in class org.eclipse.ui.editors.text.TextEditor
See Also:
IAdaptable.getAdapter(java.lang.Class)

selectionChanged

public void selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent event)
React to changed selection in the outline view.

Specified by:
selectionChanged in interface org.eclipse.jface.viewers.ISelectionChangedListener
See Also:
ISelectionChangedListener.selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)

setSelection

public void setSelection(org.eclipse.cdt.core.model.ICElement element)
Sets selection for C element.

Parameters:
element - Element to select.

setSelection

public void setSelection(org.eclipse.cdt.core.model.ISourceReference element,
                         boolean moveCursor)
Sets selection for source reference.

Parameters:
element - Source reference to set.
moveCursor - Should cursor be moved.

setSelection

public void setSelection(org.eclipse.cdt.core.model.ISourceRange element,
                         boolean moveCursor)
Sets the current editor selection to the source range. Optionally sets the current editor position.

Parameters:
element - the source range to be shown in the editor, can be null.
moveCursor - if true the editor is scrolled to show the range.

dispose

public void dispose()
Specified by:
dispose in interface org.eclipse.ui.IWorkbenchPart
Overrides:
dispose in class org.eclipse.ui.editors.text.TextEditor
See Also:
IWorkbenchPart.dispose()

editorContextMenuAboutToShow

public void editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager menu)
Overrides:
editorContextMenuAboutToShow in class org.eclipse.ui.editors.text.TextEditor
See Also:
AbstractTextEditor.editorContextMenuAboutToShow(org.eclipse.jface.action.IMenuManager)

setOutlinePageInput

public static void setOutlinePageInput(CContentOutlinePage page,
                                       org.eclipse.ui.IEditorInput input)
Sets an input for the outline page.

Parameters:
page - Page to set the input.
input - Input to set.

getOrientation

public int getOrientation()
Specified by:
getOrientation in interface org.eclipse.ui.part.IWorkbenchPartOrientation
Overrides:
getOrientation in class org.eclipse.ui.part.WorkbenchPart

createPartControl

public void createPartControl(org.eclipse.swt.widgets.Composite parent)
Specified by:
createPartControl in interface org.eclipse.ui.IWorkbenchPart
Overrides:
createPartControl in class org.eclipse.ui.texteditor.AbstractDecoratedTextEditor

gotoMatchingBracket

public void gotoMatchingBracket()
Jumps to the matching bracket.


getViewer

public final org.eclipse.jface.text.source.ISourceViewer getViewer()

aboutToBeReconciled

public void aboutToBeReconciled()
Description copied from interface: ICReconcilingListener
Called before reconciling is started.

Specified by:
aboutToBeReconciled in interface ICReconcilingListener

reconciled

public void reconciled(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit ast,
                       boolean force,
                       org.eclipse.core.runtime.IProgressMonitor progressMonitor)
Description copied from interface: ICReconcilingListener
Called after reconciling has been finished.

Specified by:
reconciled in interface ICReconcilingListener
Parameters:
ast - the translation unit AST or null if the working copy was consistent or reconcilation has been cancelled
force - flag indicating whether the reconciler was invoked forcefully
progressMonitor - the progress monitor

addReconcileListener

public final void addReconcileListener(ICReconcilingListener listener)
Adds the given listener. Has no effect if an identical listener was not already registered.

Parameters:
listener - The reconcile listener to be added
Since:
4.0

removeReconcileListener

public final void removeReconcileListener(ICReconcilingListener listener)
Removes the given listener. Has no effect if an identical listener was not already registered.

Parameters:
listener - the reconcile listener to be removed
Since:
4.0

fillActionBars

public void fillActionBars(org.eclipse.ui.IActionBars actionBars)
Called whenever the editor is activated and allows for registering action handlers.


resetProjection

public void resetProjection()
Resets the foldings structure according to the folding preferences.

Since:
4.0