Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Dykstal2007-05-29 19:12:23 +0000
committerDavid Dykstal2007-05-29 19:12:23 +0000
commit4d8d06636e937ead1965cb7f9cf0bddb827b021d (patch)
treed493bf80abda88827edcc6f971c29f06d3dfde91
parent03dfcfecd9189131493182c60781eaa1cbf030e2 (diff)
downloadorg.eclipse.tm-4d8d06636e937ead1965cb7f9cf0bddb827b021d.tar.gz
org.eclipse.tm-4d8d06636e937ead1965cb7f9cf0bddb827b021d.tar.xz
org.eclipse.tm-4d8d06636e937ead1965cb7f9cf0bddb827b021d.zip
[173267] adding SHOW_EMPTY_LISTS preference
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/ISystemPreferencesConstants.java17
-rw-r--r--rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/SystemPreferencesManager.java1
-rw-r--r--rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTest.java45
-rw-r--r--rse/tests/org.eclipse.rse.tests/src/org/eclipse/rse/tests/ui/preferences/PreferencesTestSuite.java53
4 files changed, 116 insertions, 0 deletions
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 34f1b8c08..239791de7 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:
+ * <code>
+ * org.eclipse.rse.ui/SHOW_EMPTY_LISTS=false
+ * </code>
+ * To use this preference in code do the following:
+ * <code>
+ * Preferences store = RSEUIPlugin.getDefault().getPluginPreferences();
+ * boolean showLists = store.getBoolean(ISystemPreferencesConstants.SHOW_EMPTY_LISTS);
+ * </code>
+ */
+ 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 22616763b..298b4baa8 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 000000000..56464c165
--- /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 000000000..69cdbfab2
--- /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.
+ * <p><b>Note:</b> Use only <code>junit.textui.TestRunner</code> here as
+ * it is explicitly supposed to output the test output to the shell the
+ * test suite has been launched from.
+ * <p>
+ * @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.
+ * <p>
+ * <b>Note: This method must be always called <i><code>suite</code></i> ! Otherwise
+ * the JUnit plug-in test launcher will fail to detect this class!</b>
+ * <p>
+ * @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();
+ }
+
+}

Back to the top