diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java
index 34f1b8c08d1..239791de74e 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java
@@ -46,6 +46,22 @@ public interface ISystemPreferencesConstants {
public static final String HISTORY_FOLDER = ROOT + "history.folder"; //$NON-NLS-1$
public static final String HISTORY_QUALIFIED_FOLDER = ROOT + "history.qualified.folder"; //$NON-NLS-1$
public static final String REMEMBER_STATE = ROOT + "rememberState"; //$NON-NLS-1$
+
+ /**
+ * The SHOW_EMPTY_LISTS preference. Value is "SHOW_EMPTY_LISTS".
+ * The default value is true.
+ * This may be used in the product's plug-in initialization.
+ * Example:
+ *
+ * org.eclipse.rse.ui/SHOW_EMPTY_LISTS=false
+ *
+ * To use this preference in code do the following:
+ *
+ * Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
+ * boolean showLists = store.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS);
+ *
+ */
+ public static final String SHOW_EMPTY_LISTS = "SHOW_EMPTY_LISTS"; //$NON-NLS-1$
/*
* ui preference default values
*/
@@ -59,4 +75,5 @@ public interface ISystemPreferencesConstants {
public static final boolean DEFAULT_ALERT_NON_SSL = true;
public static final String DEFAULT_HISTORY_FOLDER = ""; //$NON-NLS-1$
public static final boolean DEFAULT_REMEMBER_STATE = true; // changed in R2. Phil
+ public static final boolean DEFAULT_SHOW_EMPTY_LISTS = true;
}
\ No newline at end of file
diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
index 22616763b32..298b4baa897 100644
--- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
+++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java
@@ -98,6 +98,7 @@ public class SystemPreferencesManager {
store.setDefault(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT, showNewConnectionPrompt);
store.setDefault(Mnemonics.POLICY_PREFERENCE, Mnemonics.POLICY_DEFAULT);
store.setDefault(Mnemonics.APPEND_MNEMONICS_PATTERN_PREFERENCE, Mnemonics.APPEND_MNEMONICS_PATTERN_DEFAULT);
+ store.setDefault(ISystemPreferencesConstants.SHOW_EMPTY_LISTS, ISystemPreferencesConstants.DEFAULT_SHOW_EMPTY_LISTS);
savePreferences();
}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTest.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTest.java
new file mode 100644
index 00000000000..56464c16564
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTest.java
@@ -0,0 +1,45 @@
+/********************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * David Dykstal (IBM) - initial API and implementation.
+ ********************************************************************************/
+
+package org.eclipse.rse.tests.ui.preferences;
+
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.rse.tests.core.RSECoreTestCase;
+import org.eclipse.rse.ui.ISystemPreferencesConstants;
+import org.eclipse.rse.ui.RSEUIPlugin;
+import org.eclipse.rse.ui.SystemPreferencesManager;
+
+/**
+ * Tests for {@link SystemPreferencesManager}.
+ * Test various aspects of mnemonic generation and assignment.
+ */
+public class PreferencesTest extends RSECoreTestCase {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.core.RSECoreTestCase#setUp()
+ */
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.core.RSECoreTestCase#tearDown()
+ */
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testShowLists() {
+ Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
+ boolean showLists = store.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS);
+ assertTrue(showLists);
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTestSuite.java b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTestSuite.java
new file mode 100644
index 00000000000..69cdbfab207
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTestSuite.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation, and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * David Dykstal (IBM) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.rse.tests.ui.preferences;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder;
+
+public class PreferencesTestSuite extends DelegatingTestSuiteHolder {
+ /**
+ * Standard Java application main method. Allows to launch the test
+ * suite from outside as part of nightly runs, headless runs or other.
+ *
Note: Use only junit.textui.TestRunner
here as
+ * it is explicitly supposed to output the test output to the shell the
+ * test suite has been launched from.
+ *
+ * @param args The standard Java application command line parameters passed in. + */ + public static void main(String[] args) { + junit.textui.TestRunner.run(suite()); + } + + /** + * Combine all test into a suite and returns the test suite instance. + *
+ * Note: This method must be always called suite
! Otherwise
+ * the JUnit plug-in test launcher will fail to detect this class!
+ *
+ * @return The test suite instance. + */ + public static Test suite() { + TestSuite suite = new TestSuite("RSE Preferences Test Suite"); //$NON-NLS-1$ + suite.addTestSuite(PreferencesTest.class); + return suite; + } + + /* (non-Javadoc) + * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite() + */ + public TestSuite getTestSuite() { + return (TestSuite)PreferencesTestSuite.suite(); + } + +}