Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

oracle.ide.ceditor
Class CodeNavigationPoint

java.lang.Object
  extended by oracle.ide.navigation.DefaultNavigationPoint
      extended by oracle.ide.ceditor.CodeNavigationPoint
All Implemented Interfaces:
Displayable, oracle.ide.navigation.EditorNavigationPoint, oracle.ide.navigation.NavigationPoint, ContextHolder, Copyable
Direct Known Subclasses:
LineNavigationPoint, OffsetNavigationPoint

public class CodeNavigationPoint
extends oracle.ide.navigation.DefaultNavigationPoint

CodeNavigationPoint is a NavigationPoint implementation intended for registration with the NavigationManager as an EditorNavigationPoint for the CodeEditor class. It is also useful for subclassing by standard NavigationPoint implementations which act upon a FindableEditor.


Field Summary
protected  int change
          Change index into TextBufferTracker at time of setting Context
protected  boolean explicit
          Flag indicating that the newly opened Editor should be opened as explicit.
protected  java.lang.Class preferredType
          Preferred Editor type when opening a new Editor.
protected  int selLength
          Length of selection hilight beginning at #start
protected  int start
          Starting offset to be navigated to.
protected  TextBufferTracker tracker
          TextBufferTracker monitoring changes to #start and #selLength values
 
Fields inherited from class oracle.ide.navigation.DefaultNavigationPoint
done, nodeURL, prjURL, viewClass, viewID, wspURL
 
Fields inherited from interface oracle.ide.navigation.NavigationPoint
CANCEL, OK
 
Constructor Summary
  CodeNavigationPoint()
          Default constructor.
protected CodeNavigationPoint(Context context, int start, int length)
          Constructor.
 
Method Summary
 java.lang.Object copyTo(java.lang.Object target)
          Copies the internal state of this object to the specified target.
protected  void copyToImpl(CodeNavigationPoint point)
          Copy the pertinent state information.
protected  Editor findOrCreateEditor(boolean activate)
          Find the existing Editor opened on our Context, else attempt to open a new Editor instance.
 java.lang.Class getPreferredEditorType()
          Get the preferred Editor type to use when asking the EditorManager to open our Context in an Editor.
protected static void gotoOffset(oracle.ide.ceditor.find.FindableEditor editor, int offset, int range)
          Reposition the cursor to the given offset, hilighting as necessary.
 void refresh()
          Fetch and remember the current caret position of the focused editor pane of the FindableEditor.
protected  int renavigate()
          Reset focus to existing open Editor, else open new Editor instance if no longer available, and set the cursor at the last location remembered from our #refresh method.
 void setContext(Context context)
           
 void setExplicit(boolean explicit)
          Set the explicit flag.
 void setPreferredEditorType(java.lang.Class cls)
          Set the preferred Editor type to use when asking the EditorManager to open the Context in an Editor.
 
Methods inherited from class oracle.ide.navigation.DefaultNavigationPoint
addNavigationPointListener, contextRemoved, copyToImpl, findEditorInfo, fireDescriptionChanged, fireExpired, getContext, getIcon, getLongLabel, getShortLabel, getToolTipText, navigate, navigateImpl, nodeRenamed, projectRenamed, removeNavigationPointListener, toString, workspaceRenamed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

start

protected int start
Starting offset to be navigated to.


selLength

protected int selLength
Length of selection hilight beginning at #start


change

protected int change
Change index into TextBufferTracker at time of setting Context


tracker

protected TextBufferTracker tracker
TextBufferTracker monitoring changes to #start and #selLength values


preferredType

protected java.lang.Class preferredType
Preferred Editor type when opening a new Editor. CodeEditor by default


explicit

protected boolean explicit
Flag indicating that the newly opened Editor should be opened as explicit. false by default.

Constructor Detail

CodeNavigationPoint

public CodeNavigationPoint()
Default constructor.


CodeNavigationPoint

protected CodeNavigationPoint(Context context,
                              int start,
                              int length)
Constructor.

Parameters:
context - the Context describing the Editor in which to navigate.
start - the offset to navigate to, negative value indicates that opening the Editor is enough with no further navigation needed.
length - number of characters to hilight beginning at start.
Method Detail

setContext

public void setContext(Context context)
Specified by:
setContext in interface oracle.ide.navigation.EditorNavigationPoint
Overrides:
setContext in class oracle.ide.navigation.DefaultNavigationPoint

copyTo

public java.lang.Object copyTo(java.lang.Object target)
Copies the internal state of this object to the specified target. If target is null, then this method should create a new instance of this class and proceed to copy the internal state to the newly created object.

Specified by:
copyTo in interface Copyable
Overrides:
copyTo in class oracle.ide.navigation.DefaultNavigationPoint
Parameters:
target - the Object to receive the state, or null.
Returns:
an instance with an identical state.
See Also:
Copyable

copyToImpl

protected final void copyToImpl(CodeNavigationPoint point)
Copy the pertinent state information.

Parameters:
point - the NavigationPoint whose state is to be altered.

refresh

public void refresh()
Fetch and remember the current caret position of the focused editor pane of the FindableEditor.

Specified by:
refresh in interface oracle.ide.navigation.NavigationPoint
Overrides:
refresh in class oracle.ide.navigation.DefaultNavigationPoint

setExplicit

public void setExplicit(boolean explicit)
Set the explicit flag.

Parameters:
explicit - true if the Editor should be opened as explicit.
See Also:
explicit

renavigate

protected int renavigate()
                  throws java.lang.Exception
Reset focus to existing open Editor, else open new Editor instance if no longer available, and set the cursor at the last location remembered from our #refresh method.

Overrides:
renavigate in class oracle.ide.navigation.DefaultNavigationPoint
Returns:
NavigationPoint#OK on success, else NavigationPoint.CANCEL.
Throws:
java.lang.Exception - on failure.

getPreferredEditorType

public java.lang.Class getPreferredEditorType()
Get the preferred Editor type to use when asking the EditorManager to open our Context in an Editor.

Returns:
The preferred Editor type, else null to use the default Editor.
See Also:
EditorManager#openEditorInFrame( Context )

setPreferredEditorType

public void setPreferredEditorType(java.lang.Class cls)
Set the preferred Editor type to use when asking the EditorManager to open the Context in an Editor.

Parameters:
cls - the preferred Editor type, else null to use the default Editor.
See Also:
EditorManager#openEditorInFrame( Context )

findOrCreateEditor

protected Editor findOrCreateEditor(boolean activate)
Find the existing Editor opened on our Context, else attempt to open a new Editor instance.

Parameters:
activate - true if a the Editor should also be activated.
Returns:
The existing, or new Editor, opened on our Context.

gotoOffset

protected static void gotoOffset(oracle.ide.ceditor.find.FindableEditor editor,
                                 int offset,
                                 int range)
Reposition the cursor to the given offset, hilighting as necessary.

Parameters:
editor - the FindableEditor in which the cursor is to be relocated.
offset - the offset to relocate to.
range - the length from offset which should be hilighted.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-04

Copyright © 1997, 2010, Oracle. All rights reserved.