File tree Expand file tree Collapse file tree 4 files changed +6
-50
lines changed
bundles/org.eclipse.swt/Eclipse SWT
cocoa/org/eclipse/swt/widgets
gtk/org/eclipse/swt/widgets
win32/org/eclipse/swt/widgets
tests/org.eclipse.swt.tests/JUnit Tests/org/eclipse/swt/tests/junit Expand file tree Collapse file tree 4 files changed +6
-50
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ enum APPEARANCE {
117117 /* System property to be set for SWT application to use the system's theme */
118118 static final String USE_SYSTEM_THEME = "org.eclipse.swt.display.useSystemTheme" ;
119119 /* System property to control beep sounds */
120- static final String BEEP_ENABLED = " swt.beep" ;
120+ public static final boolean BEEP_ENABLED = ! "off" . equalsIgnoreCase ( System . getProperty ( " swt.beep")) ;
121121
122122 /* Windows and Events */
123123 Event [] eventQueue ;
@@ -673,7 +673,7 @@ public void execute(Runnable runnable) {
673673 */
674674public void beep () {
675675 checkDevice ();
676- if (! "off" . equalsIgnoreCase ( System . getProperty ( BEEP_ENABLED )) ) {
676+ if (BEEP_ENABLED ) {
677677 OS .NSBeep ();
678678 }
679679}
Original file line number Diff line number Diff line change @@ -510,7 +510,7 @@ public void stop() {
510510 /* Package name */
511511 static final String PACKAGE_PREFIX = "org.eclipse.swt.widgets." ; //$NON-NLS-1$
512512 /* System property to control beep sounds */
513- static final String BEEP_ENABLED = " swt.beep" ;
513+ public static final boolean BEEP_ENABLED = ! "off" . equalsIgnoreCase ( System . getProperty ( " swt.beep")) ;
514514 /* This code is intentionally commented.
515515 * ".class" can not be used on CLDC.
516516 */
@@ -990,7 +990,7 @@ public void execute(Runnable runnable) {
990990 */
991991public void beep () {
992992 if (!isValidThread ()) error (SWT .ERROR_THREAD_INVALID_ACCESS );
993- if (! "off" . equalsIgnoreCase ( System . getProperty ( BEEP_ENABLED )) ) {
993+ if (BEEP_ENABLED ) {
994994 GDK .gdk_display_beep (GDK .gdk_display_get_default ());
995995 }
996996}
Original file line number Diff line number Diff line change @@ -225,7 +225,7 @@ public class Display extends Device implements Executor {
225225 static final String USE_WS_BORDER_TEXT_KEY = "org.eclipse.swt.internal.win32.Text.use_WS_BORDER" ; //$NON-NLS-1$
226226 boolean useWsBorderText = false ;
227227 /* System property to control beep sounds */
228- static final String BEEP_ENABLED = " swt.beep" ;
228+ public static final boolean BEEP_ENABLED = ! "off" . equalsIgnoreCase ( System . getProperty ( " swt.beep")) ;
229229 /**
230230 * Changes the color of Table header's column delimiters.
231231 * Only affects custom-drawn header, that is when background/foreground header color is set.
@@ -854,7 +854,7 @@ public void execute(Runnable runnable) {
854854 */
855855public void beep () {
856856 checkDevice ();
857- if (! "off" . equalsIgnoreCase ( System . getProperty ( BEEP_ENABLED )) ) {
857+ if (BEEP_ENABLED ) {
858858 OS .MessageBeep (OS .MB_OK );
859859 }
860860}
Original file line number Diff line number Diff line change @@ -231,50 +231,6 @@ public void test_beep() {
231231 }
232232}
233233
234- @ Test
235- public void test_beep_disabled () {
236- String originalValue = System .getProperty ("swt.beep" );
237- try {
238- System .setProperty ("swt.beep" , "off" );
239- Display display = new Display ();
240- try {
241- // Should not beep when property is "off"
242- display .beep ();
243- } finally {
244- display .dispose ();
245- }
246- } finally {
247- // Restore original value
248- if (originalValue != null ) {
249- System .setProperty ("swt.beep" , originalValue );
250- } else {
251- System .clearProperty ("swt.beep" );
252- }
253- }
254- }
255-
256- @ Test
257- public void test_beep_enabled () {
258- String originalValue = System .getProperty ("swt.beep" );
259- try {
260- System .setProperty ("swt.beep" , "on" );
261- Display display = new Display ();
262- try {
263- // Should beep when property is "on"
264- display .beep ();
265- } finally {
266- display .dispose ();
267- }
268- } finally {
269- // Restore original value
270- if (originalValue != null ) {
271- System .setProperty ("swt.beep" , originalValue );
272- } else {
273- System .clearProperty ("swt.beep" );
274- }
275- }
276- }
277-
278234@ Test
279235public void test_close () {
280236 Display display = new Display ();
You can’t perform that action at this time.
0 commit comments