input
stringlengths
10
828
output
stringlengths
5
107
private void handle mouse move mouse event event if f text viewer null int lines to line numbers event y true position p get annotation position lines cursor cursor p null f hit detection cursor null if cursor f last cursor f canvas set cursor cursor f last cursor cursor
handles mouse moves
private boolean skip object annotation type return contains annotation type f allowed annotation types f configured annotation types
returns whether the given annotation type should be skipped by the drawing routine
private boolean contains object annotation type map allowed set configured boolean cached boolean allowed get annotation type if cached null return cached boolean value boolean covered is covered annotation type configured allowed put annotation type covered boolean true boolean false return covered
returns whether the given annotation type is mapped to code true code
private color find color object annotation type color color color f annotation types2 colors get annotation type if color null return color if f annotation access instanceof iannotation access extension iannotation access extension extension iannotation access extension f annotation access object super types extension get supertypes annotation type if super types null for int i 0 i super types length i color color f annotation types2 colors get super types i if color null return color return null
returns the color for the given annotation type
private color get stroke color object annotation type boolean temporary return get color annotation type temporary f is temporary annotation discolored 0 5 0 2
returns the stroke color for the given annotation type and characteristics
private color get fill color object annotation type boolean temporary return get color annotation type temporary f is temporary annotation discolored 0 9 0 75
returns the fill color for the given annotation type and characteristics
public font data best data font data fonts display display for int i 0 i fonts length i font data fd fonts i if fd null break font data fixed fonts display get font list fd get name false if is fixed font fixed fonts fd return fd font data scalable fonts display get font list fd get name true if scalable fonts length 0 return fd none of the provided datas are valid return the first one as it is at least the first choice if fonts length 0 return fonts 0 nothing specified return null
find the first valid font data in the provided list
public font descriptor get descriptor string symbolic name assert is not null symbolic name return font descriptor create from get font data symbolic name
returns the font descriptor for the font with the given symbolic
protected int get transparent pixel return 0
return the transparent pixel for the receiver
public void add hyperlink listener ihyperlink listener listener if listeners null listeners new listener list listeners add listener
adds the event listener to this hyperlink
public void remove hyperlink listener ihyperlink listener listener if listeners null return listeners remove listener
removes the event listener from this hyperlink
public boolean get selection return has focus
returns the selection state of the control
protected void handle enter event e redraw if listeners null return int size listeners size hyperlink event he new hyperlink event this get href get text e state mask object listener list listeners get listeners for int i 0 i size i ihyperlink listener listener ihyperlink listener listener list i listener link entered he
called when hyperlink is entered
protected void handle exit event e redraw if listeners null return int size listeners size hyperlink event he new hyperlink event this get href get text e state mask object listener list listeners get listeners for int i 0 i size i ihyperlink listener listener ihyperlink listener listener list i listener link exited he
called when hyperlink is exited
protected void handle activate event e get accessible set focus acc childid self if listeners null return int size listeners size set cursor forms resources get busy cursor hyperlink event he new hyperlink event this get href get text e state mask object listener list listeners get listeners for int i 0 i size i ihyperlink listener listener ihyperlink listener listener list i listener link activated he if is disposed set cursor forms resources get hand cursor
called when hyperlink has been activated
public void set href object href set data href href non nls 1
sets the object associated with this hyperlink
public object get href return get data href non nls 1
returns the object associated with this hyperlink
private font record get font record string symbolic name assert is not null symbolic name object result string to font record get symbolic name if result null return font record result result string to font data get symbolic name font record font record if result null font record default font record else font record create font symbolic name font data result if font record null font record default font record string to font record put symbolic name font record return font record
return the font record for the key
public string get text return get tool tip text
returns the textual representation of this hyperlink suitable for showing
protected void paint paint event e gc gc e gc rectangle client area get client area if client area width 0 client area height 0 return paint hyperlink gc if has focus rectangle carea get client area gc set foreground get foreground gc draw focus 0 0 carea width carea height
paints the control as a reaction to the provided paint event
public image get active image return active image
returns active image
public void set active image image active image this active image active image
sets the image to show when link is activated
public image get hover image return hover image
returns the hover image
public void set hover image image hover image this hover image hover image
sets the image to show when link is hover state on mouse over
public void set underlined boolean underlined this underlined underlined redraw
sets the underlined state
public point compute size int w hint int h hint boolean changed check widget int inner width w hint if inner width swt default inner width margin width 2 point text size compute text size inner width h hint int text width text size x 2 margin width int text height text size y 2 margin height return new point text width text height
overrides the parent by incorporating the margin
public void set text string text if text null this text text else this text non nls 1 redraw
sets the text of this hyperlink
protected void paint hyperlink gc gc rectangle carea get client area rectangle bounds new rectangle margin width margin height carea width margin width margin width carea height margin height margin height paint text gc bounds
paints the hyperlink text
protected void paint text gc gc rectangle bounds gc set font get font gc set foreground get foreground if get style swt wrap 0 form util paint wrap text gc text bounds underlined else point text size compute text size bounds width swt default int text width text size x int text height text size y gc draw text get text bounds x bounds y true if underlined int descent gc get font metrics get descent int line y bounds y text height descent 1 gc draw line bounds x line y bounds x text width line y
paints the hyperlink text in provided bounding rectangle
public void set form text form text form text this content form text super set content content content set menu get menu if text null load text text
sets the form text to be managed by this scrolled form text
public void set foreground color fg super set foreground fg if content null content set foreground fg
sets the foreground color of the scrolled form text
public void set background color bg super set background bg if content null content set background bg
sets the background color of the scrolled form text
public void set text string text this text text load text text reflow true
sets the text to be rendered in the scrolled form text
public void set contents input stream is load contents is
sets the contents to rendered in the scrolled form text
public form text get form text return content
returns the instance of the form text
public point compute size int w hint int h hint boolean changed rectangle trim compute trim 0 0 10 10 return new point trim width trim height
removes the default size of the composite allowing the control to
public boolean has page object key return pages contains key key
tests if the page under the provided key is currently in the book
public composite create page object key composite page create page pages put key page return page
creates a new page for the provided key
public composite get container return page book
returns the page book container
public void remove page object key remove page key true
removes the page under the provided key from the page book
public void remove page object key boolean show empty page control page control pages get key if page null pages remove key page dispose if show empty page show empty page
removes the page under the provided key from the page book
public void show page object key control page control pages get key if page null page book show page page if current page null current page page switching pages force layout if page instanceof composite composite page layout false current page page else show empty page reflow true
shows the page with the provided key and hides the page previously
public boolean set focus if current page null return current page set focus return super set focus
sets focus on the current page if shown
public control get current page return current page
returns the page currently showing
public void set foreground color fg super set foreground fg if get content null get content set foreground fg
sets the foreground of the control and its content
public void set background color bg super set background bg if get content null get content set background bg
sets the background of the control and its content
public void set font font font super set font font if get content null get content set font font
sets the font of the form
public void set content control content super set content content if content null content set foreground get foreground content set background get background content set font get font
overrides super to pass the proper colors and font
public boolean set focus boolean result form util set focus scrolling enabled this false if get content null result get content set focus else result super set focus form util set focus scrolling enabled this true return result
if content is set transfers focus to the content
public boolean is delayed reflow return delayed reflow
tests if the control uses delayed reflow
public void set delayed reflow boolean delayed reflow this delayed reflow delayed reflow
sets the delayed reflow feature
public int compute minimum width composite parent boolean changed control children parent get children if changed cache flush cache set controls children changed true initialize if needed parent changed if initial layout changed true initial layout false if grid null changed changed true grid new vector create grid parent if min column widths null min column widths new int num columns for int i 0 i num columns i min column widths i 0 return internal get minimum width parent changed
implements ilayout extension
public int compute maximum width composite parent boolean changed control children parent get children if changed cache flush cache set controls children changed true initialize if needed parent changed if initial layout changed true initial layout false if grid null changed changed true grid new vector create grid parent if max column widths null max column widths new int num columns for int i 0 i num columns i max column widths i 0 return internal get maximum width parent changed
implements ilayout extension
public font descriptor default font descriptor return font descriptor create from default font data
returns the font descriptor for the jface default font
public size cache get cache int idx return caches idx
returns the size cache for the given control
public void set controls control controls if the number of controls has changed discard the entire cache if controls length caches length rebuild cache controls return for int idx 0 idx controls length idx caches idx set control controls idx
sets the controls that are being cached here
private void rebuild cache control controls size cache new cache new size cache controls length for int idx 0 idx controls length idx try to reuse existing caches if possible if idx caches length new cache idx caches idx new cache idx set control controls idx else new cache idx new size cache controls idx caches new cache
creates a new size cache for the given set of controls discarding any
public point compute size int control index int width hint int height hint return caches control index compute size width hint height hint
computes the preferred size of the nth control
public void flush int control index caches control index flush
flushes the cache for the given control
public void flush for int idx 0 idx caches length idx caches idx flush
flushes the cache
public void set menu menu menu super set menu menu if content null content set menu menu
passes the menu to the body
public void set foreground color fg super set foreground fg content set foreground fg
sets the foreground color of the form
public void set background color bg super set background bg content set background bg
sets the background color of the form
public void set image image image content set image image reflow true
sets the image to be rendered to the left of the title
public image get background image return content get background image
returns the optional background image of this form
public void set background image image background image content set background image background image
sets the optional background image to be rendered behind the title
public void reflow boolean flush cache content get body layout content layout super reflow flush cache
recomputes the body layout and form scroll bars
public composite get body return content get body
returns the container that occupies the body of the form the form area
public form get form return content
returns the instance of the form owned by the scrolled form
protected void reflow composite c this while c null c set redraw false c c get parent if c instanceof scrolled form break c this while c null c layout true c c get parent if c instanceof scrolled form scrolled form c reflow true break c this while c null c set redraw true c c get parent if c instanceof scrolled form break
reflows this section and all the parents up the hierarchy
public void set description string description if description control instanceof label label description control set text description
sets the description text
public string get description if description control instanceof label return label description control get text return null
returns the current description text
public void set separator control control separator assert is true separator null separator get parent equals this this separator separator
sets the separator control of this section
public control get separator control return separator
returns the control that is used as a separator betweeen the title and
public void set background color bg super set background bg if description control null get expansion style description 0 description control set background bg
sets the background of the section
public void set foreground color fg super set foreground fg if description control null get expansion style description 0 description control set foreground fg
sets the foreground of the section
public control get description control return description control
returns the control used to render the description
public void set description control control description control assert is true get expansion style description 0 assert is true description control null description control get parent equals this this description control description control
sets the description control of this section
public void set control control new control if new control control control new control if control null independent dimensions true preferred width or larger is minimum height false width adjustment 0 height adjustment 0 else independent dimensions independent length and width control preferred width or larger is minimum height is preferred width maximum control compute hint offset control flush
sets the control whose size is being cached
public void set title bar gradient background color color put title bar color color gbg color
sets the color of the title bar gradient background when title bar style
public color get title bar border color if title colors null return null return color title colors get color border
returns the title bar border color when title bar style is used
public color get title bar gradient background if title colors null return null if get expansion style short title bar 0 return get background return color title colors get color gbg
returns the title bar gradient background color when title bar style is
public color get title bar background if title colors null return null return color title colors get color bg
returns the title bar background when title bar style is used
public point compute adjusted size int width hint int height hint int adjusted width hint width hint swt default swt default math max 0 width hint width adjustment int adjusted height hint height hint swt default swt default math max 0 height hint height adjustment point result compute size adjusted width hint adjusted height hint if the amounts we subtracted off the width hint and height hint didn t do the trick then manually adjust the result to ensure that a non default hint will return that result verbatim return result
compute the controls size and ensure that non default hints are returned verbatim
public button create button composite parent string text int style button button new button parent style swt flat orientation if text null button set text text adapt button true true return button
creates a button as a part of the form
public composite create composite composite parent return create composite parent swt null
creates the composite as a part of the form
public composite create composite composite parent int style composite composite new layout composite parent style orientation adapt composite return composite
creates the composite as part of the form using the provided style
public composite create composite separator composite parent final composite composite new composite parent orientation composite add listener swt paint new listener public void handle event event e if composite is disposed return rectangle bounds composite get bounds gc gc e gc gc set foreground colors get color form colors separator if colors get background null gc set background colors get background gc fill gradient rectangle 0 0 bounds width bounds height false if parent instanceof section section parent set separator control composite return composite
creats the composite that can server as a separator between various parts
public label create label composite parent string text return create label parent text swt none
creates a label as a part of the form
public label create label composite parent string text int style label label new label parent style orientation if text null label set text text adapt label false false return label
creates a label as a part of the form
public hyperlink create hyperlink composite parent string text int style hyperlink hyperlink new hyperlink parent style orientation if text null hyperlink set text text hyperlink add focus listener visibility handler hyperlink add key listener keyboard handler hyperlink group add hyperlink return hyperlink
creates a hyperlink as a part of the form
public image hyperlink create image hyperlink composite parent int style image hyperlink hyperlink new image hyperlink parent style orientation hyperlink add focus listener visibility handler hyperlink add key listener keyboard handler hyperlink group add hyperlink return hyperlink
creates an image hyperlink as a part of the form
public form text create form text composite parent boolean track focus form text engine new form text parent swt wrap orientation engine margin width 1 engine margin height 0 engine set hyperlink settings get hyperlink group adapt engine track focus true engine set menu parent get menu return engine
creates a rich text as a part of the form
public void adapt composite composite composite set background colors get background composite add mouse listener new mouse adapter public void mouse down mouse event e control e widget set focus composite set menu composite get parent get menu
adapts a composite to be used in a form associated with this toolkit
public label create separator composite parent int style label label new label parent swt separator style orientation label set background colors get background label set foreground colors get border color return label
creates a separator label as a part of the form
public table create table composite parent int style table table new table parent style border style orientation adapt table false false hook delete listener table return table
creates a table as a part of the form
public text create text composite parent string value return create text parent value swt single
creates a text as a part of the form
public text create text composite parent string value int style text text new text parent border style style orientation if value null text set text value text set foreground colors get foreground text add focus listener visibility handler return text
creates a text as a part of the form
public tree create tree composite parent int style tree tree new tree parent border style style orientation adapt tree false false hook delete listener tree return tree
creates a tree widget as a part of the form
public scrolled form create scrolled form composite parent scrolled form form new scrolled form parent swt v scroll swt h scroll orientation form set expand horizontal true form set expand vertical true form set background colors get background form set foreground colors get color form colors title colors initialize section tool bar colors form get form set separator color colors get color form colors tb border form set font jface resources get header font return form
creates a scrolled form widget in the provided parent