mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
[173267] adding SHOW_EMPTY_LISTS preference
This commit is contained in:
parent
03dfcfecd9
commit
4d8d06636e
4 changed files with 116 additions and 0 deletions
|
@ -46,6 +46,22 @@ public interface ISystemPreferencesConstants {
|
||||||
public static final String HISTORY_FOLDER = ROOT + "history.folder"; //$NON-NLS-1$
|
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 HISTORY_QUALIFIED_FOLDER = ROOT + "history.qualified.folder"; //$NON-NLS-1$
|
||||||
public static final String REMEMBER_STATE = ROOT + "rememberState"; //$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
|
* ui preference default values
|
||||||
*/
|
*/
|
||||||
|
@ -59,4 +75,5 @@ public interface ISystemPreferencesConstants {
|
||||||
public static final boolean DEFAULT_ALERT_NON_SSL = true;
|
public static final boolean DEFAULT_ALERT_NON_SSL = true;
|
||||||
public static final String DEFAULT_HISTORY_FOLDER = ""; //$NON-NLS-1$
|
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_REMEMBER_STATE = true; // changed in R2. Phil
|
||||||
|
public static final boolean DEFAULT_SHOW_EMPTY_LISTS = true;
|
||||||
}
|
}
|
|
@ -98,6 +98,7 @@ public class SystemPreferencesManager {
|
||||||
store.setDefault(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT, showNewConnectionPrompt);
|
store.setDefault(ISystemPreferencesConstants.SHOWNEWCONNECTIONPROMPT, showNewConnectionPrompt);
|
||||||
store.setDefault(Mnemonics.POLICY_PREFERENCE, Mnemonics.POLICY_DEFAULT);
|
store.setDefault(Mnemonics.POLICY_PREFERENCE, Mnemonics.POLICY_DEFAULT);
|
||||||
store.setDefault(Mnemonics.APPEND_MNEMONICS_PATTERN_PREFERENCE, Mnemonics.APPEND_MNEMONICS_PATTERN_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();
|
savePreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue