Package com._1c.g5.v8.dt.common.ui.text
Class AtPainter
java.lang.Object
com._1c.g5.v8.dt.common.ui.text.AtPainter
- All Implemented Interfaces:
EventListener
,org.eclipse.jface.text.IPainter
,org.eclipse.swt.events.PaintListener
,org.eclipse.swt.internal.SWTEventListener
public class AtPainter
extends Object
implements org.eclipse.jface.text.IPainter, org.eclipse.swt.events.PaintListener
A painter draws additional text on line near original.
Painter can change additional texts
- Color
- Background Color
- Selection Background Color
User can set strategy, that processes text before showing it as additional text.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<AtLineInfo,
String> protected org.eclipse.swt.graphics.Color
protected org.eclipse.swt.graphics.Color
protected org.eclipse.swt.graphics.Color
protected org.eclipse.jface.text.IDocument
protected int
protected boolean
protected org.eclipse.swt.graphics.Color
protected org.eclipse.swt.custom.StyledText
Fields inherited from interface org.eclipse.jface.text.IPainter
CONFIGURATION, INTERNAL, KEY_STROKE, MOUSE_BUTTON, SELECTION, TEXT_CHANGE
-
Constructor Summary
ConstructorsConstructorDescriptionAtPainter
(org.eclipse.jface.text.source.ISourceViewer viewer, org.eclipse.swt.graphics.Color aditionalTextColor, org.eclipse.swt.graphics.Color choosenLineColor, org.eclipse.swt.graphics.Color selectedTextColor, IAtLineProcessStrategy lineProcessStrategy) Deprecated.AtPainter
(org.eclipse.jface.text.source.ISourceViewer viewer, org.eclipse.swt.graphics.Color aditionalTextColor, org.eclipse.swt.graphics.Color choosenLineColor, org.eclipse.swt.graphics.Color selectedTextColor, org.eclipse.swt.graphics.Color defaultBackgroundColor, IAtLineProcessStrategy lineProcessStrategy) Constructor -
Method Summary
Modifier and TypeMethodDescriptionboolean
add
(AtLineInfo info, String text) Adds element toAtLineInfo
Collection.void
addAll
(Map<? extends AtLineInfo, String> otherMap) Adds all elements fromotherSet
toAtLineInfo
Collection.void
clear()
Clears currentAtLineInfo
Collection, i.e. deletes all additional text.void
deactivate
(boolean redraw) void
dispose()
boolean
Return paiter enabled statevoid
paint
(int reason) void
paintControl
(org.eclipse.swt.events.PaintEvent e) void
redraw()
RedrawsAtPainter
's textWidgetboolean
remove
(AtLineInfo info) Removes element fromAtLineInfo
Collection.void
setAtColor
(org.eclipse.swt.graphics.Color color) Changes additional text color.void
setChoosenLineColor
(org.eclipse.swt.graphics.Color color) Changes chosen line color.void
setDefaultBackgroundColor
(org.eclipse.swt.graphics.Color color) Sets default background color.void
setEnabled
(boolean enabled, boolean redrawIfChanged) Sets paiter enabled statevoid
setPositionManager
(org.eclipse.jface.text.IPaintPositionManager manager) void
setProcessStrategy
(IAtLineProcessStrategy strategy) Changes line process strategy.void
setSelectedTextBackgroundColor
(org.eclipse.swt.graphics.Color color) Changes additional text selection background color.boolean
show
(AtLineInfo info) Shows additional text atAtLineInfo
's lineNumber.boolean
show
(AtLineInfo info, String text) Shows additional text atAtLineInfo
's lineNumber.boolean
unshow
(AtLineInfo info) Removes additional text atAtLineInfo
's lineNumber.
-
Field Details
-
document
protected org.eclipse.jface.text.IDocument document -
textWidget
protected org.eclipse.swt.custom.StyledText textWidget -
atInfoSet
-
color
protected org.eclipse.swt.graphics.Color color -
choosenLineColor
protected org.eclipse.swt.graphics.Color choosenLineColor -
selectedTextColor
protected org.eclipse.swt.graphics.Color selectedTextColor -
defaultBackgroundColor
protected org.eclipse.swt.graphics.Color defaultBackgroundColor -
fontSize
protected int fontSize -
isEnabled
protected boolean isEnabled
-
-
Constructor Details
-
AtPainter
@Deprecated public AtPainter(org.eclipse.jface.text.source.ISourceViewer viewer, org.eclipse.swt.graphics.Color aditionalTextColor, org.eclipse.swt.graphics.Color choosenLineColor, org.eclipse.swt.graphics.Color selectedTextColor, IAtLineProcessStrategy lineProcessStrategy) Deprecated.Constructor- Parameters:
viewer
- - ISourceViewer of Editor, can't benull
.aditionalTextColor
- - Color of additional text, can't benull
.choosenLineColor
- - Color of caret line, can't benull
.selectedTextColor
- - Color of selected additional text background, can't benull
.lineProcessStrategy
- - strategy for processing lines, can't benull
.- Throws:
IllegalArgumentException
- if any of arguments arenull
-
AtPainter
public AtPainter(org.eclipse.jface.text.source.ISourceViewer viewer, org.eclipse.swt.graphics.Color aditionalTextColor, org.eclipse.swt.graphics.Color choosenLineColor, org.eclipse.swt.graphics.Color selectedTextColor, org.eclipse.swt.graphics.Color defaultBackgroundColor, IAtLineProcessStrategy lineProcessStrategy) Constructor- Parameters:
viewer
- - ISourceViewer of Editor, can't benull
.aditionalTextColor
- - Color of additional text, can't benull
.choosenLineColor
- - Color of caret line, can't benull
.selectedTextColor
- - Color of selected additional text background, can't benull
.defaultBackgroundColor
- - Color of text background, can't benull
.lineProcessStrategy
- - strategy for processing lines, can't benull
.- Throws:
IllegalArgumentException
- if any of arguments arenull
-
-
Method Details
-
dispose
public void dispose()- Specified by:
dispose
in interfaceorg.eclipse.jface.text.IPainter
-
paint
public void paint(int reason) - Specified by:
paint
in interfaceorg.eclipse.jface.text.IPainter
-
deactivate
public void deactivate(boolean redraw) - Specified by:
deactivate
in interfaceorg.eclipse.jface.text.IPainter
-
setPositionManager
public void setPositionManager(org.eclipse.jface.text.IPaintPositionManager manager) - Specified by:
setPositionManager
in interfaceorg.eclipse.jface.text.IPainter
-
paintControl
public void paintControl(org.eclipse.swt.events.PaintEvent e) - Specified by:
paintControl
in interfaceorg.eclipse.swt.events.PaintListener
-
setProcessStrategy
Changes line process strategy.- Parameters:
strategy
- - strategy to use. Can't benull
.- Throws:
IllegalArgumentException
- ifstrategy
isnull
-
setAtColor
public void setAtColor(org.eclipse.swt.graphics.Color color) Changes additional text color.- Parameters:
color
- - color of additional text, can't benull
.- Throws:
IllegalArgumentException
- ifcolor
isnull
-
setSelectedTextBackgroundColor
public void setSelectedTextBackgroundColor(org.eclipse.swt.graphics.Color color) Changes additional text selection background color. Use your eclipse text selection background color for best look.- Parameters:
color
- - color of selected additional text background. Can't benull
.- Throws:
IllegalArgumentException
- ifcolor
isnull
-
setChoosenLineColor
public void setChoosenLineColor(org.eclipse.swt.graphics.Color color) Changes chosen line color.- Parameters:
color
- - color of chosen line. Can't benull
.- Throws:
IllegalArgumentException
- ifcolor
isnull
-
setDefaultBackgroundColor
public void setDefaultBackgroundColor(org.eclipse.swt.graphics.Color color) Sets default background color.- Parameters:
color
- - color to set. Can't benull
.
-
clear
public void clear()Clears currentAtLineInfo
Collection, i.e. deletes all additional text.
Doesn't redraw textWidget -
show
Shows additional text atAtLineInfo
's lineNumber.- Parameters:
info
- - element to show. Can't benull
- Returns:
- true if element was added to show collection.
- Throws:
NullPointerException
- ifinfo
isnull
-
show
Shows additional text atAtLineInfo
's lineNumber.- Parameters:
info
- - element to show. Can't benull
text
- - text to show on the line, can benull
- Returns:
- true if element was added to show collection.
- Throws:
NullPointerException
- ifinfo
isnull
-
unshow
Removes additional text atAtLineInfo
's lineNumber.- Parameters:
info
- - element to remove. Can't benull
.- Returns:
- true if element was in collection.
- Throws:
IllegalArgumentException
- ifinfo
isnull
-
add
Adds element to
AtLineInfo
Collection.Additional text will appear after next textWidget's
redraw
- Parameters:
info
- - LineInfo to add. Can't benull
- Returns:
- true if element was added to show collection.
- Throws:
IllegalArgumentException
- ifinfo
isnull
-
addAll
Adds all elements from
otherSet
toAtLineInfo
Collection.Additional text will appear after next textWidget's
redraw
- Parameters:
otherMap
- - map containing elements to be added. Can't benull
.- Throws:
IllegalArgumentException
- ifotherSet
isnull
-
remove
Removes element from
AtLineInfo
Collection.Additional text will disappear after next textWidget's
redraw
- Parameters:
info
- - element to remove. Can't benull
.- Returns:
- true if element was in collection.
- Throws:
IllegalArgumentException
- ifinfo
isnull
-
redraw
public void redraw()RedrawsAtPainter
's textWidget -
isEnabled
public boolean isEnabled()Return paiter enabled state- Returns:
- paiter enabled state
-
setEnabled
public void setEnabled(boolean enabled, boolean redrawIfChanged) Sets paiter enabled state- Parameters:
enabled
- - enabled stateredrawIfChanged
- - true, if you need to callredraw()
if value changed
-
AtPainter(ISourceViewer, Color, Color, Color, Color, IAtLineProcessStrategy)
instead.