diff options
author | Kurt Zenker <kz@openoffice.org> | 2005-03-01 11:09:29 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2005-03-01 11:09:29 +0000 |
commit | 594b5ff689c3222c1519eb3c6e500ca7f0c08579 (patch) | |
tree | 192e52efe3fa66738f78b874888b63e4a130fd85 /odk/examples/DevelopersGuide/OfficeDev/DisableCommands | |
parent | 6b847345520241c90d8c141a94bb803e547360ad (diff) |
INTEGRATION: CWS sdkbugfix01 (1.5.6); FILE MERGED
2005/02/15 17:24:14 jsc 1.5.6.1: #i42061# wait for return (CarridgeReturn and LineFeed)
Diffstat (limited to 'odk/examples/DevelopersGuide/OfficeDev/DisableCommands')
-rw-r--r-- | odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java index 9eb89a52f7ac..1680adcd206b 100644 --- a/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java +++ b/odk/examples/DevelopersGuide/OfficeDev/DisableCommands/DisableCommandsTest.java @@ -2,9 +2,9 @@ * * $RCSfile: DisableCommandsTest.java,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: rt $ $Date: 2005-01-31 16:42:29 $ + * last change: $Author: kz $ $Date: 2005-03-01 12:09:29 $ * * The Contents of this file are made available subject to the terms of * the BSD license. @@ -115,11 +115,12 @@ public class DisableCommandsTest extends java.lang.Object { xDoc.getText().setString("You can now check the disabled commands. The " +"following commands are disabled:\n\n" +" Open...\n Exit\n Select All\n " - +"About StarOffice|OpenOffice\n\nPress a key " - +"in the shell where you have started the " - +"example to enable the commands!\n\nCheck the" - +" commands again and press a key to finish " - +"the example and close the document."); + +"About StarOffice|OpenOffice\n\nPress " + + "\"return\" in the shell where you have " + + "started the example to enable the " + + "commands!\n\nCheck the commands again and " + + "press once more \"return\" to finish the " + + "example and close the document."); // ensure that the document content is optimal visible com.sun.star.frame.XModel xModel = @@ -155,7 +156,7 @@ public class DisableCommandsTest extends java.lang.Object { // disabled System.out.println("\nYou can now check the disabled commands.\n" +"Please press 'return' to enable the commands!"); - while ( System.in.read() != 13 ); + waitForUserInput(); // Remove disable commands to make Office usable again enableCommands(); @@ -165,7 +166,7 @@ public class DisableCommandsTest extends java.lang.Object { System.out.println("Check again the now enabled commands.\n" +"Please press 'return' to finish the example and " +"close the document!"); - while ( System.in.read() != 13 ); + waitForUserInput(); // close test document com.sun.star.util.XCloseable xCloseable = (com.sun.star.util.XCloseable) @@ -188,6 +189,16 @@ public class DisableCommandsTest extends java.lang.Object { } /** + * Wait for user input -> until the user press 'return' + */ + private static void waitForUserInput() throws java.io.IOException { + char c = 'X'; + do{ + c = (char) System.in.read(); + }while ((c != 13) && (c != 10)); + } + + /** * Test the commands that we enabled/disabled */ private static void testCommands( boolean bDisabledCmds ) |