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>atInfoSetprotected org.eclipse.swt.graphics.ColorchoosenLineColorprotected org.eclipse.swt.graphics.Colorcolorprotected org.eclipse.swt.graphics.ColordefaultBackgroundColorprotected org.eclipse.jface.text.IDocumentdocumentprotected intfontSizeprotected booleanisEnabledprotected org.eclipse.swt.graphics.ColorselectedTextColorprotected org.eclipse.swt.custom.StyledTexttextWidget
-
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 booleanadd(AtLineInfo info, String text)Adds element toAtLineInfoCollection.voidaddAll(Map<? extends AtLineInfo,String> otherMap)Adds all elements fromotherSettoAtLineInfoCollection.voidclear()Clears currentAtLineInfoCollection, i.e.voiddeactivate(boolean redraw)voiddispose()booleanisEnabled()Return paiter enabled statevoidpaint(int reason)voidpaintControl(org.eclipse.swt.events.PaintEvent e)voidredraw()RedrawsAtPainter's textWidgetbooleanremove(AtLineInfo info)Removes element fromAtLineInfoCollection.voidsetAtColor(org.eclipse.swt.graphics.Color color)Changes additional text color.voidsetChoosenLineColor(org.eclipse.swt.graphics.Color color)Changes chosen line color.voidsetDefaultBackgroundColor(org.eclipse.swt.graphics.Color color)Sets default background color.voidsetEnabled(boolean enabled, boolean redrawIfChanged)Sets paiter enabled statevoidsetPositionManager(org.eclipse.jface.text.IPaintPositionManager manager)voidsetProcessStrategy(IAtLineProcessStrategy strategy)Changes line process strategy.voidsetSelectedTextBackgroundColor(org.eclipse.swt.graphics.Color color)Changes additional text selection background color.booleanshow(AtLineInfo info)Shows additional text atAtLineInfo's lineNumber.booleanshow(AtLineInfo info, String text)Shows additional text atAtLineInfo's lineNumber.booleanunshow(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:
disposein interfaceorg.eclipse.jface.text.IPainter
-
paint
public void paint(int reason)
- Specified by:
paintin interfaceorg.eclipse.jface.text.IPainter
-
deactivate
public void deactivate(boolean redraw)
- Specified by:
deactivatein interfaceorg.eclipse.jface.text.IPainter
-
setPositionManager
public void setPositionManager(org.eclipse.jface.text.IPaintPositionManager manager)
- Specified by:
setPositionManagerin interfaceorg.eclipse.jface.text.IPainter
-
paintControl
public void paintControl(org.eclipse.swt.events.PaintEvent e)
- Specified by:
paintControlin 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- ifstrategyisnull
-
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- ifcolorisnull
-
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- ifcolorisnull
-
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- ifcolorisnull
-
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 currentAtLineInfoCollection, 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- ifinfoisnull
-
show
public boolean show(AtLineInfo info, String text)
Shows additional text atAtLineInfo's lineNumber.- Parameters:
info- - element to show. Can't benulltext- - text to show on the line, can benull- Returns:
- true if element was added to show collection.
- Throws:
NullPointerException- ifinfoisnull
-
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- ifinfoisnull
-
add
public boolean add(AtLineInfo info, String text)
Adds element to
AtLineInfoCollection.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- ifinfoisnull
-
addAll
public void addAll(Map<? extends AtLineInfo,String> otherMap)
Adds all elements from
otherSettoAtLineInfoCollection.Additional text will appear after next textWidget's
redraw- Parameters:
otherMap- - map containing elements to be added. Can't benull.- Throws:
IllegalArgumentException- ifotherSetisnull
-
remove
public boolean remove(AtLineInfo info)
Removes element from
AtLineInfoCollection.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- ifinfoisnull
-
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
-
-