# HG changeset patch # User Frank Benoit # Date 1225029187 -3600 # Node ID 33d9146198b2fd864330f743d7fc18a54d537ed2 # Parent d36bf485a75364f2c2da383233ba0e7c43e49aeb minor edits in jface text example diff -r d36bf485a753 -r 33d9146198b2 jface.text/Simple.d --- 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 @@ -