public class CodeEditorGutter extends LineGutterPlugin
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.
Modifier and Type | Class and Description |
---|---|
protected class |
CodeEditorGutter.CEColumn
Our
CEColumn class so that we can trap mark click
events. |
class |
CodeEditorGutter.GutterView
Deprecated.
Use CodeEditorGutterView
|
LineGutterPlugin.Column, LineGutterPlugin.MarkComparator
javax.swing.JComponent.AccessibleJComponent
Modifier and Type | Field and Description |
---|---|
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.
|
_mouseInGutter, _mouseInMark, _scratchList, _showLineNumberFlag, MARK_COMPARATOR, SHOW_LINE_NUMBERS_ALWAYS, SHOW_LINE_NUMBERS_DEFAULT, SHOW_LINE_NUMBERS_NEVER
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
EDIT_BEGIN_ATTRIBUTE, EDIT_END_ATTRIBUTE, EOL_TYPE_ATTRIBUTE, MODIFIED_ATTRIBUTE, READ_ONLY_ATTRIBUTE, RELOAD_END_ATTRIBUTE, RELOAD_START_ATTRIBUTE
Modifier and Type | Method and Description |
---|---|
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 |
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.
|
void |
showMarkDropdownMenu(ContextMenu contextMenu,
java.awt.event.MouseEvent event,
GutterMark mark,
int line)
Utility routine to show a context menu for a specific mark.
|
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() |
addGutterClickListener, allocateScratchList, allowDragging, attributeUpdate, calculateRolloverBounds, changedUpdate, componentHidden, componentMoved, componentResized, componentShown, createGutterColumn, deinstall, deinstallDocument, discardAllMarks, freeScratchList, getClosestRowFromCoordinate, getEditor, getLeftPadding, getLineFromRow, getMarkAtLocation, getMarksOnLine, getMinimumWidth, getPreferredSize, getRolloverRectFor, getRowCount, getRowFromCoordinate, getRowFromLine, getToolTipText, getToolTipText, getTopPadding, hover, incrementNumber, insertUpdate, insertUpdate, install, installDocument, lookupGutterColumn, markWidth, mouseClicked, mouseEntered, mouseExited, mouseMoved, numDigits, numDigits, paint, processMousePressed, propertyChange, recalculateColumnWidths, recalculateLineWidths, removeAllGutterColumns, removeGutterClickListener, removeGutterColumn, removeUpdate, removeUpdate, repaintLine, repaintLine, reservedColumnWidth, revalidate, setLocation, setMinimumWidth, setNumber, setShowLineNumbers, setUI, updateAllMarkHighlights, updateColors, updateMetrics, updateMouseInMark, updateShowLineNumbers
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, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, 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
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, transferFocusDownCycle, validate, validateTree
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, 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, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String COLUMN_NAME_LIGHTBULB
public static final java.lang.String COLUMN_NAME_BREAKPOINT
public static final java.lang.String COLUMN_NAME_WATCHPOINT
public static final java.lang.String COLUMN_NAME_IP
public static final int MARK_ORDER_BREAKPOINT
public static final int MARK_ORDER_WATCHPOINT_ZERO
public static final int MARK_ORDER_BOOKMARK
public static final int MARK_ORDER_PROFILER
public static final int MARK_ORDER_TODO
public static final int MARK_ORDER_IMPLEMENTS
public static final int MARK_ORDER_OVERRIDES
public static final int MARK_ORDER_LIGHTBULB
public static final int MARK_ORDER_EXECUTION
public static final int MARK_OPTION_CLICK_DROPS_MENU
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 be sent as usual, and clients can create and populate a
ContextMenu
and show it via a call to
showMarkDropdownMenu(ContextMenu contextMenu, MouseEvent event, GutterMark mark, int line)
,
or use the standard gutter menu by calling
showMarkDropdownMenu(MouseEvent event, GutterMark mark, int line)
protected static java.awt.Polygon _triangle
public static ContextMenu getGutterContextMenu()
ContextMenu
instance that will be used for
the CodeEditorGutter
.public void mousePressed(java.awt.event.MouseEvent event)
LineGutterPlugin
mousePressed
in interface java.awt.event.MouseListener
mousePressed
in class LineGutterPlugin
public void mouseReleased(java.awt.event.MouseEvent event)
LineGutterPlugin
mouseReleased
in interface java.awt.event.MouseListener
mouseReleased
in class LineGutterPlugin
public static CodeEditorGutter getGutterFor(GutterColumn column)
CodeEditorGutter
instance
from the given column.column
- the column to fetch the gutter ofCodeEditorGutter
instance that created
the markjava.lang.ClassCastException
- if the mark was not created through
the CodeEditorGutter APIpublic static CodeEditorGutter getGutterFor(GutterMark mark)
CodeEditorGutter
instance
from the given mark.mark
- the mark to fetch the gutter ofCodeEditorGutter
instance that created
the markjava.lang.ClassCastException
- if the mark was not created through
the CodeEditorGutter APIpublic static GutterMark getMarkForContext(Context context)
context
- a context passed by a code editor gutter ContextMenu
to its listeners.ContextMenu
,
ContextMenuListener.menuWillShow(ContextMenu)
public static boolean isMarkDroppingDown(Context context)
context
- a context passed by a code editor gutter ContextMenu
to its listeners.ContextMenu
,
ContextMenuListener.menuWillShow(oracle.ide.controller.ContextMenu)
public static int getLineForContext(Context context)
context
- a context passed by a code editor gutter ContextMenu
to its listeners.ContextMenu
,
ContextMenuListener.menuWillShow(oracle.ide.controller.ContextMenu)
public Context getContext()
public CodeEditor getCodeEditor()
public View getCodeEditorGutterView()
protected LineGutterPlugin.Column createGutterColumnImpl(java.lang.String columnName, GutterColumnListener listener)
createGutterColumnImpl
in class LineGutterPlugin
public void mouseDragged(java.awt.event.MouseEvent event)
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseDragged
in class LineGutterPlugin
event
- the mouse eventprotected void processMousePressed(java.awt.event.MouseEvent event, int line, GutterMark mark)
processMousePressed
in class LineGutterPlugin
event
- the mouse eventpublic void showMarkDropdownMenu(java.awt.event.MouseEvent event, GutterMark mark, int line)
public void showMarkDropdownMenu(ContextMenu contextMenu, java.awt.event.MouseEvent event, GutterMark mark, int line)
protected java.awt.Rectangle paintRollover(java.awt.Graphics graphics, GutterMark mark, int iconX, int columnWidth, int rowY)
paintRollover
in class LineGutterPlugin
graphics
- the graphics instancemark
- the mark that should get the rollover effecticonX
- the x location where the icon was paintedrowY
- the y location of the top of the row being paintedpublic java.lang.String toString()
toString
in class LineGutterPlugin