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
Fields Modifier and Type Field Description protected Map<AtLineInfo,String>
atInfoSet
protected org.eclipse.swt.graphics.Color
choosenLineColor
protected org.eclipse.swt.graphics.Color
color
protected org.eclipse.swt.graphics.Color
defaultBackgroundColor
protected org.eclipse.jface.text.IDocument
document
protected int
fontSize
protected boolean
isEnabled
protected org.eclipse.swt.graphics.Color
selectedTextColor
protected org.eclipse.swt.custom.StyledText
textWidget
-
Constructor Summary
Constructors Constructor Description 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.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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
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.void
deactivate(boolean redraw)
void
dispose()
boolean
isEnabled()
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 Detail
-
document
protected org.eclipse.jface.text.IDocument document
-
textWidget
protected org.eclipse.swt.custom.StyledText textWidget
-
atInfoSet
protected Map<AtLineInfo,String> 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 Detail
-
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 Detail
-
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
public void setProcessStrategy(IAtLineProcessStrategy strategy)
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
public boolean show(AtLineInfo info)
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
public boolean show(AtLineInfo info, String text)
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
public boolean unshow(AtLineInfo info)
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
public boolean add(AtLineInfo info, String text)
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
public void addAll(Map<? extends AtLineInfo,String> otherMap)
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
public boolean remove(AtLineInfo info)
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
-
-