Mercurial > projects > dwt-samples
changeset 173:33d9146198b2
minor edits in jface text example
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 26 Oct 2008 14:53:07 +0100 |
parents | d36bf485a753 |
children | c58389a70da3 |
files | jface.text/Simple.d |
diffstat | 1 files changed, 14 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/jface.text/Simple.d Sun Oct 26 14:07:19 2008 +0100 +++ b/jface.text/Simple.d Sun Oct 26 14:53:07 2008 +0100 @@ -1,11 +1,6 @@ module test; -import dwt.DWT; -import dwt.layout.FillLayout; -import dwt.widgets.Composite; -import dwt.widgets.Control; -import dwt.widgets.Display; -import dwt.widgets.Shell; +import dwt.std; import dwtx.jface.text.Document; import dwtx.jface.text.source.CompositeRuler; import dwtx.jface.text.source.LineNumberRulerColumn; @@ -15,15 +10,21 @@ version(JIVE) import jive.stacktrace; -class SourceViewerTest : ApplicationWindow +const char[] startText = `void main() { - this() - { + ApplicationWindow w = new SourceViewerTest(); + w.setBlockOnOpen( true ); + w.open(); + Display.getCurrent.dispose(); +} +`; + +class SourceViewerTest : ApplicationWindow { + this() { super( null ); } - protected Control createContents( Composite parent ) - { + protected Control createContents( Composite parent ) { getShell.setText( "SourceViewerTest" ); getShell.setSize( 350, 400 ); Display disp = getShell.getDisplay(); @@ -37,14 +38,7 @@ lineCol.setForeground( disp.getSystemColor( DWT.COLOR_BLUE ) ); ruler.addDecorator( 0, lineCol ); - Document doc = new Document( `void main() -{ - ApplicationWindow w = new SourceViewerTest(); - w.setBlockOnOpen( true ); - w.open(); - Display.getCurrent.dispose(); -} -` ); + Document doc = new Document( startText ); SourceViewer sv = new SourceViewer( container, ruler, DWT.BORDER | DWT.H_SCROLL | DWT.V_SCROLL ); sv.setDocument( doc ); @@ -53,8 +47,7 @@ } } -void main() -{ +void main() { ApplicationWindow w = new SourceViewerTest(); w.setBlockOnOpen( true ); w.open(); @@ -67,4 +60,3 @@ -