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

E13403-05

oracle.ide.ceditor
Class CodeEditorGutter

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by oracle.javatools.editor.gutter.LineGutterPlugin
                  extended by oracle.ide.ceditor.CodeEditorGutter
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.swing.event.DocumentListener, TextBufferListener, Gutter, EditorPlugin

public class CodeEditorGutter
extends LineGutterPlugin

The CodeEditorGutter interface is an extension of the editor's Gutter interface to integrate with the JDev environment and provide Context information for other Addins.

The CodeEditorGutter does have a ContextMenu available. Use CodeEditorGutter.getGutterContextMenu() in order to attach/detach as a ContextMenuListener. When the context menu is going to popup up, your listeners will be called with the context of the gutter - the view will be set to the specific CodeEditorGutter instance.

Note the contents of the Context to determine what to show in the ContextMenu. If the context menu was popped up by right-clicking on the CodeEditorGutter, the (1-based) line number will be stored in the extra data member with an Integer wrapper, or null if the user right-clicked on a non-existent line. If the context menu was popped up by left-clicking on on a clickable mark that wants the drop down menu, the extra data member will be set with that GutterMark.

When you get the context of this CodeEditorGutter, either by calling getContext() or by what is provided through the gutter's ContextMenu, the view returned in getView() will be the gutter itself, while the owner of the gutter view will be the associated CodeEditor instance.

When creating a GutterMark please use the defined mark order constants defined in this class. This makes it easier to order the marks relative to each other.

See Also:
Serialized Form

Nested Class Summary
protected  class CodeEditorGutter.CEColumn
          Our CEColumn class so that we can trap mark click events.
 class CodeEditorGutter.GutterView
           
 
Nested classes/interfaces inherited from class oracle.javatools.editor.gutter.LineGutterPlugin
LineGutterPlugin.Column, LineGutterPlugin.MarkComparator
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected static java.awt.Polygon _triangle
           
static java.lang.String COLUMN_NAME_BREAKPOINT
          The column name for the debugger breakpoint and watchpoint column.
static java.lang.String COLUMN_NAME_IP
          The column name for the debugger instruction pointer column.
static java.lang.String COLUMN_NAME_LIGHTBULB
          The column name for the lightbulb column.
static java.lang.String COLUMN_NAME_WATCHPOINT
          The column name for the debugger breakpoint and watchpoint column.
static int MARK_OPTION_CLICK_DROPS_MENU
          Constant for a mark option indicating that the created GutterMark will drop down a ContextMenu menu if the user left-clicks on the icon.
static int MARK_ORDER_BOOKMARK
          The mark order for a bookmark mark.
static int MARK_ORDER_BREAKPOINT
          The mark order for a breakpoint mark.
static int MARK_ORDER_EXECUTION
          The mark order for an execution point (debugging) mark.
static int MARK_ORDER_IMPLEMENTS
          The mark order for an implements mark.
static int MARK_ORDER_LIGHTBULB
          The mark order for a light bulb mark.
static int MARK_ORDER_OVERRIDES
          The mark order for an overrides mark.
static int MARK_ORDER_PROFILER
          The mark order for a todo mark.
static int MARK_ORDER_TODO
          The mark order for a todo mark.
static int MARK_ORDER_WATCHPOINT_ZERO
          The mark order for a watchpoint mark.
 
Fields inherited from class oracle.javatools.editor.gutter.LineGutterPlugin
_mouseInGutter, _mouseInMark, _scratchList, _showLineNumberFlag, MARK_COMPARATOR, SHOW_LINE_NUMBERS_ALWAYS, SHOW_LINE_NUMBERS_DEFAULT, SHOW_LINE_NUMBERS_NEVER
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface oracle.javatools.buffer.TextBufferListener
EOL_TYPE_ATTRIBUTE, MODIFIED_ATTRIBUTE, READ_ONLY_ATTRIBUTE, RELOAD_END_ATTRIBUTE, RELOAD_START_ATTRIBUTE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Method Summary
protected  LineGutterPlugin.Column createGutterColumnImpl(java.lang.String columnName, GutterColumnListener listener)
          Creates the Column instance only.
 CodeEditor getCodeEditor()
          Fetch the code editor associated with this gutter.
 View getCodeEditorGutterView()
           
 Context getContext()
          Gets the current view context associated with this particular Code Editor and Gutter.
static ContextMenu getGutterContextMenu()
          Fetch the ContextMenu instance that will be used for the CodeEditorGutter.
static CodeEditorGutter getGutterFor(GutterColumn column)
          Utility routine to fetch the CodeEditorGutter instance from the given column.
static CodeEditorGutter getGutterFor(GutterMark mark)
          Utility routine to fetch the CodeEditorGutter instance from the given mark.
static int getLineForContext(Context context)
          Gets the gutter mark from a context associated with the code editor gutter context menu popping up.
static GutterMark getMarkForContext(Context context)
          Gets the line number from a context associated with the code editor gutter context menu popping up.
static boolean isMarkDroppingDown(Context context)
          Gets whether a context associated with the code editor gutter context menu popping up is really a gutter mark menu dropping down.
 void mouseClicked(java.awt.event.MouseEvent event)
          Invoked when the mouse has been clicked on a component.
 void mouseDragged(java.awt.event.MouseEvent event)
          Override mouseDragged() to disable click-dragging for right-mouse button.
 void mousePressed(java.awt.event.MouseEvent event)
          Invoked when a mouse button has been pressed on a component.
 void mouseReleased(java.awt.event.MouseEvent event)
          Invoked when a mouse button has been released on a component.
protected  java.awt.Rectangle paintRollover(java.awt.Graphics graphics, GutterMark mark, int iconX, int columnWidth, int rowY)
          Utility routine to paint the rollover effect for the given mark.
protected  void processMousePressed(java.awt.event.MouseEvent event, int line, GutterMark mark)
          Utility routine to handle firing a gutter click notification for the given mouse event.
protected  void showGutterContextMenu(java.awt.event.MouseEvent event, int line, GutterMark mark)
          Utility routine to show the context menu for the clicked line.
 void showMarkDropdownMenu(java.awt.event.MouseEvent event, GutterMark mark, int line)
          Utility routine to show the context menu for a specific mark.
 java.lang.String toString()
           
 
Methods inherited from class oracle.javatools.editor.gutter.LineGutterPlugin
addGutterClickListener, allocateScratchList, allowDragging, attributeUpdate, calculateRolloverBounds, changedUpdate, componentHidden, componentMoved, componentResized, componentShown, createGutterColumn, deinstall, deinstallDocument, discardAllMarks, freeScratchList, getClosestRowFromCoordinate, getEditor, getLeftPadding, getLineFromRow, getMarkAtLocation, getMarksOnLine, getPreferredSize, getRolloverRectFor, getRowCount, getRowFromCoordinate, getRowFromLine, getToolTipText, getToolTipText, getTopPadding, incrementNumber, insertUpdate, insertUpdate, install, installDocument, lookupGutterColumn, markWidth, mouseEntered, mouseExited, mouseMoved, numDigits, numDigits, paint, processMousePressed, propertyChange, recalculateColumnWidths, recalculateLineWidths, removeAllGutterColumns, removeGutterClickListener, removeGutterColumn, removeUpdate, removeUpdate, repaintLine, repaintLine, reservedColumnWidth, revalidate, setLocation, setNumber, setShowLineNumbers, setUI, updateAllMarkHighlights, updateColors, updateMetrics, updateMouseInMark, updateShowLineNumbers
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

COLUMN_NAME_LIGHTBULB

public static final java.lang.String COLUMN_NAME_LIGHTBULB
The column name for the lightbulb column.

See Also:
Constant Field Values

COLUMN_NAME_BREAKPOINT

public static final java.lang.String COLUMN_NAME_BREAKPOINT
The column name for the debugger breakpoint and watchpoint column.

See Also:
Constant Field Values

COLUMN_NAME_WATCHPOINT

public static final java.lang.String COLUMN_NAME_WATCHPOINT
The column name for the debugger breakpoint and watchpoint column.

See Also:
Constant Field Values

COLUMN_NAME_IP

public static final java.lang.String COLUMN_NAME_IP
The column name for the debugger instruction pointer column.

See Also:
Constant Field Values

MARK_ORDER_BREAKPOINT

public static final int MARK_ORDER_BREAKPOINT
The mark order for a breakpoint mark.

See Also:
Constant Field Values

MARK_ORDER_WATCHPOINT_ZERO

public static final int MARK_ORDER_WATCHPOINT_ZERO
The mark order for a watchpoint mark.

See Also:
Constant Field Values

MARK_ORDER_BOOKMARK

public static final int MARK_ORDER_BOOKMARK
The mark order for a bookmark mark.

See Also:
Constant Field Values

MARK_ORDER_PROFILER

public static final int MARK_ORDER_PROFILER
The mark order for a todo mark.

See Also:
Constant Field Values

MARK_ORDER_TODO

public static final int MARK_ORDER_TODO
The mark order for a todo mark.

See Also:
Constant Field Values

MARK_ORDER_IMPLEMENTS

public static final int MARK_ORDER_IMPLEMENTS
The mark order for an implements mark.

See Also:
Constant Field Values

MARK_ORDER_OVERRIDES

public static final int MARK_ORDER_OVERRIDES
The mark order for an overrides mark.

See Also:
Constant Field Values

MARK_ORDER_LIGHTBULB

public static final int MARK_ORDER_LIGHTBULB
The mark order for a light bulb mark.

See Also:
Constant Field Values

MARK_ORDER_EXECUTION

public static final int MARK_ORDER_EXECUTION
The mark order for an execution point (debugging) mark.

See Also:
Constant Field Values

MARK_OPTION_CLICK_DROPS_MENU

public static final int MARK_OPTION_CLICK_DROPS_MENU
Constant for a mark option indicating that the created GutterMark will drop down a ContextMenu menu if the user left-clicks on the icon. When the user hovers over the icon associated with this mark, a square and triangle drop-down will be rawn around it indicating that the mark drops a menu when clicked upon. The markClicked() notification will not be sent. Instead, the ContextMenu for this gutter will be popped up with the Context set to the GutterMark that was clicked on.

See Also:
Constant Field Values

_triangle

protected static java.awt.Polygon _triangle
Method Detail

getGutterContextMenu

public static ContextMenu getGutterContextMenu()
Fetch the ContextMenu instance that will be used for the CodeEditorGutter.

Returns:
the context menu instance

mousePressed

public void mousePressed(java.awt.event.MouseEvent event)
Description copied from class: LineGutterPlugin
Invoked when a mouse button has been pressed on a component.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class LineGutterPlugin

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent event)
Description copied from class: LineGutterPlugin
Invoked when a mouse button has been released on a component.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class LineGutterPlugin

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent event)
Description copied from class: LineGutterPlugin
Invoked when the mouse has been clicked on a component.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Overrides:
mouseClicked in class LineGutterPlugin

getGutterFor

public static CodeEditorGutter getGutterFor(GutterColumn column)
Utility routine to fetch the CodeEditorGutter instance from the given column.

Parameters:
column - the column to fetch the gutter of
Returns:
the CodeEditorGutter instance that created the mark
Throws:
java.lang.ClassCastException - if the mark was not created through the CodeEditorGutter API

getGutterFor

public static CodeEditorGutter getGutterFor(GutterMark mark)
Utility routine to fetch the CodeEditorGutter instance from the given mark.

Parameters:
mark - the mark to fetch the gutter of
Returns:
the CodeEditorGutter instance that created the mark
Throws:
java.lang.ClassCastException - if the mark was not created through the CodeEditorGutter API

getMarkForContext

public static GutterMark getMarkForContext(Context context)
Gets the line number from a context associated with the code editor gutter context menu popping up.

Parameters:
context - a context passed by a code editor gutter ContextMenu to its listeners.
Returns:
the line number of the line under the cursor when the context menu was popped up, or -1 if none.
See Also:
ContextMenu, ContextMenuListener.menuWillShow(ContextMenu)

isMarkDroppingDown

public static boolean isMarkDroppingDown(Context context)
Gets whether a context associated with the code editor gutter context menu popping up is really a gutter mark menu dropping down.

Parameters:
context - a context passed by a code editor gutter ContextMenu to its listeners.
Returns:
true if this context menu was activated by a left click on a gutter mark.
See Also:
ContextMenu, ContextMenuListener.menuWillShow(oracle.ide.controller.ContextMenu)

getLineForContext

public static int getLineForContext(Context context)
Gets the gutter mark from a context associated with the code editor gutter context menu popping up.

Parameters:
context - a context passed by a code editor gutter ContextMenu to its listeners.
Returns:
the gutter mark under the cursor when the context menu was popped up, or null if none.
See Also:
ContextMenu, ContextMenuListener.menuWillShow(oracle.ide.controller.ContextMenu)

getContext

public Context getContext()
Gets the current view context associated with this particular Code Editor and Gutter. The view will return this current CodeEditorGutter instance, while the owner of the CodeEditorGutter view will be the CodeEditor view.

Returns:
the current view context.

getCodeEditor

public CodeEditor getCodeEditor()
Fetch the code editor associated with this gutter. This is the same as this view's owner.

Returns:
the code editor

getCodeEditorGutterView

public View getCodeEditorGutterView()

createGutterColumnImpl

protected LineGutterPlugin.Column createGutterColumnImpl(java.lang.String columnName,
                                                         GutterColumnListener listener)
Creates the Column instance only. This allows subclasses to override this with their own column implementation.

Overrides:
createGutterColumnImpl in class LineGutterPlugin

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent event)
Override mouseDragged() to disable click-dragging for right-mouse button.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class LineGutterPlugin
Parameters:
event - the mouse event

processMousePressed

protected void processMousePressed(java.awt.event.MouseEvent event,
                                   int line,
                                   GutterMark mark)
Utility routine to handle firing a gutter click notification for the given mouse event.

Overrides:
processMousePressed in class LineGutterPlugin
Parameters:
event - the mouse event

showGutterContextMenu

protected void showGutterContextMenu(java.awt.event.MouseEvent event,
                                     int line,
                                     GutterMark mark)
Utility routine to show the context menu for the clicked line.


showMarkDropdownMenu

public void showMarkDropdownMenu(java.awt.event.MouseEvent event,
                                 GutterMark mark,
                                 int line)
Utility routine to show the context menu for a specific mark.


paintRollover

protected java.awt.Rectangle paintRollover(java.awt.Graphics graphics,
                                           GutterMark mark,
                                           int iconX,
                                           int columnWidth,
                                           int rowY)
Utility routine to paint the rollover effect for the given mark.

Overrides:
paintRollover in class LineGutterPlugin
Parameters:
graphics - the graphics instance
mark - the mark that should get the rollover effect
iconX - the x location where the icon was painted
rowY - the y location of the top of the row being painted
Returns:
the bounds of the painted rollover rectangle

toString

public java.lang.String toString()
Overrides:
toString in class LineGutterPlugin

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

E13403-05

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