Mercurial > projects > dwt2
diff org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet258.d @ 112:9f4c18c268b2
Update to compile and execute with dmd 2.052.
author | kntroh |
---|---|
date | Wed, 16 Mar 2011 21:53:53 +0900 |
parents | 4e5843b771cc |
children |
line wrap: on
line diff
--- a/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet258.d Sat Nov 13 14:15:51 2010 +0100 +++ b/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet258.d Wed Mar 16 21:53:53 2011 +0900 @@ -35,7 +35,11 @@ import org.eclipse.swt.widgets.ToolBar; import org.eclipse.swt.widgets.ToolItem; -import tango.io.Stdout; +version(Tango){ + import tango.io.Stdout; +} else { // Phobos + import std.stdio; +} void main() { auto display = new Display(); @@ -52,7 +56,11 @@ item.addSelectionListener(new class SelectionAdapter { public void widgetSelected(SelectionEvent e) { text.setText(""); - Stdout("Search cancelled").newline; + version(Tango){ + Stdout("Search cancelled").newline; + } else { // Phobos + writeln("Search cancelled"); + } } }); } @@ -60,10 +68,18 @@ text.setText("Search text"); text.addSelectionListener(new class SelectionAdapter { public void widgetDefaultSelected(SelectionEvent e) { - if (e.detail == SWT.CANCEL) { - Stdout("Search cancelled").newline; - } else { - Stdout("Searching for: ")(text.getText())("...").newline; + version(Tango){ + if (e.detail == SWT.CANCEL) { + Stdout("Search cancelled").newline; + } else { + Stdout("Searching for: ")(text.getText())("...").newline; + } + } else { // Phobos + if (e.detail == SWT.CANCEL) { + writeln("Search cancelled"); + } else { + writeln("Searching for: " ~ text.getText() ~ "..."); + } } } });