From 2c2dbb710b7d9cd86ffd20d20e4b437301e37d52 Mon Sep 17 00:00:00 2001 From: Uwe Stieber Date: Mon, 16 Feb 2015 11:38:20 +0100 Subject: [PATCH] Terminal: Clean out ISettings API --- .../terminal/local/LocalTerminalSettings.java | 4 +- .../terminal/view/LayeredSettingsStore.java | 10 +- .../terminal/view/PreferenceSettingStore.java | 4 +- .../view/SettingStorePrefixDecorator.java | 8 +- .../internal/terminal/view/SettingsStore.java | 8 +- .../internal/terminal/view/TerminalView.java | 14 +- .../terminal/view/TerminalViewConnection.java | 28 +- .../view/TerminalViewConnectionManager.java | 8 +- .../terminal/remote/RemoteSettings.java | 8 +- .../terminal/serial/SerialSettings.java | 26 +- .../tm/internal/terminal/ssh/SshSettings.java | 22 +- .../terminal/telnet/TelnetSettings.java | 12 +- .../interfaces/ITelnetSettingConstants.java | 17 ++ .../terminal/speedtest/SpeedTestSettings.java | 12 +- .../terminal/provisional/api/ISettings.java | 240 +++++++++--------- .../terminal/provisional/api/Settings.java | 131 +++++----- 16 files changed, 284 insertions(+), 268 deletions(-) create mode 100644 terminal/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/terminal/telnet/interfaces/ITelnetSettingConstants.java diff --git a/terminal/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettings.java b/terminal/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettings.java index 3f8fe43929f..ee96afc1385 100644 --- a/terminal/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettings.java +++ b/terminal/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettings.java @@ -46,7 +46,7 @@ public class LocalTerminalSettings implements ILocalTerminalSettings { Field field = declaredField[index]; Class type = field.getType(); - Object value = store.getProperty(field.getName()); + Object value = store.get(field.getName()); if (type.equals(boolean.class)) { value = Boolean.valueOf((String)value); @@ -81,7 +81,7 @@ public class LocalTerminalSettings implements ILocalTerminalSettings { try { field.setAccessible(true); - store.setProperty(field.getName(), String.valueOf(field.get(this))); + store.set(field.getName(), String.valueOf(field.get(this))); } catch (IllegalAccessException illegalAccess) { diff --git a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/LayeredSettingsStore.java b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/LayeredSettingsStore.java index e0939453bb6..be7ebbfbd5c 100644 --- a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/LayeredSettingsStore.java +++ b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/LayeredSettingsStore.java @@ -28,7 +28,7 @@ public class LayeredSettingsStore extends Settings { /** * @param stores the stores used to search the values. - * {@link #setProperty(String, Object)} will put the value in the + * {@link #set(String, Object)} will put the value in the * first store in the list. */ public LayeredSettingsStore(ISettings[] stores) { @@ -43,17 +43,17 @@ public class LayeredSettingsStore extends Settings { this(new ISettings[]{s1,s2}); } - public Object getProperty(String key) { + public Object get(String key) { for (int i = 0; i < fStores.length; i++) { - Object value=fStores[i].getProperty(key); + Object value=fStores[i].get(key); if (value!=null) return value; } return null; } - public boolean setProperty(String key, Object value) { - return fStores[0].setProperty(key,value); + public boolean set(String key, Object value) { + return fStores[0].set(key,value); } } diff --git a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/PreferenceSettingStore.java b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/PreferenceSettingStore.java index c10a4831a07..4b25960bc3c 100644 --- a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/PreferenceSettingStore.java +++ b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/PreferenceSettingStore.java @@ -36,11 +36,11 @@ public class PreferenceSettingStore extends org.eclipse.tm.internal.terminal.pro fPrefix=prefix; } - public Object getProperty(String key) { + public Object get(String key) { return fPreferences.getString(makeKey(key)); } - public boolean setProperty(String key, Object value) { + public boolean set(String key, Object value) { if (value instanceof String) { fPreferences.setValue(makeKey(key), (String)value); } diff --git a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingStorePrefixDecorator.java b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingStorePrefixDecorator.java index 807336ee23f..51731bffc53 100644 --- a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingStorePrefixDecorator.java +++ b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingStorePrefixDecorator.java @@ -20,11 +20,11 @@ public class SettingStorePrefixDecorator extends org.eclipse.tm.internal.termina fStore=store; } - public Object getProperty(String key) { - return fStore.getProperty(fPrefix+key); + public Object get(String key) { + return fStore.get(fPrefix+key); } - public boolean setProperty(String key, Object value) { - return super.setProperty(fPrefix+key,value); + public boolean set(String key, Object value) { + return super.set(fPrefix+key,value); } } diff --git a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingsStore.java b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingsStore.java index 5959ebb90dc..b2cc5fd4a08 100644 --- a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingsStore.java +++ b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingsStore.java @@ -49,17 +49,17 @@ class SettingsStore extends org.eclipse.tm.internal.terminal.provisional.api.Set } if(m!=null) { // cache the value in the map - setProperty(key,m.getString(path[path.length-1])); + set(key,m.getString(path[path.length-1])); } } } } } - public boolean setProperty(String key, Object value) { + public boolean set(String key, Object value) { if(!key.matches("^[\\w.]+$")) //$NON-NLS-1$ throw new IllegalArgumentException("Key '"+key+"' is not alpha numeric or '.'!"); //$NON-NLS-1$ //$NON-NLS-2$ - return super.setProperty(key, value); + return super.set(key, value); } /** @@ -68,7 +68,7 @@ class SettingsStore extends org.eclipse.tm.internal.terminal.provisional.api.Set * @param memento Memento to save state into. */ public void saveState(IMemento memento) { - Map map = getProperties(); + Map map = getAll(); String[] keyNames=(String[]) map.keySet().toArray(new String[map.size()]); Arrays.sort(keyNames); StringBuffer buffer=new StringBuffer(); diff --git a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java index 7af36b752bb..d27e50a26a8 100644 --- a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java +++ b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java @@ -487,7 +487,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi */ private ITerminalConnector loadSettings(ISettings store, ITerminalConnector[] connectors) { ITerminalConnector connector=null; - String connectionType=store.getStringProperty(STORE_CONNECTION_TYPE); + String connectionType=store.getString(STORE_CONNECTION_TYPE); for (int i = 0; i < connectors.length; i++) { connectors[i].load(getStore(store,connectors[i])); if(connectors[i].getId().equals(connectionType)) @@ -521,7 +521,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi if(connector!=null) { connector.save(getStore(store, connector)); // the last saved connector becomes the default - store.setProperty(STORE_CONNECTION_TYPE,connector.getId()); + store.set(STORE_CONNECTION_TYPE,connector.getId()); } } @@ -531,7 +531,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi } public void saveState(IMemento memento) { super.saveState(memento); - fStore.setProperty(STORE_TITLE,getPartName()); + fStore.set(STORE_TITLE,getPartName()); fMultiConnectionManager.saveState(new SettingStorePrefixDecorator(fStore,"connectionManager")); //$NON-NLS-1$ fStore.saveState(memento); } @@ -683,10 +683,10 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi */ private void legacyLoadState() { // TODO legacy: load the old title.... - String summary=fStore.getStringProperty(STORE_SETTING_SUMMARY); + String summary=fStore.getString(STORE_SETTING_SUMMARY); if(summary!=null) { getActiveConnection().setSummary(summary); - fStore.setProperty(STORE_SETTING_SUMMARY,null); + fStore.set(STORE_SETTING_SUMMARY,null); } } /** @@ -697,10 +697,10 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi */ private void legacySetTitle() { // restore the title of this view - String title=fStore.getStringProperty(STORE_TITLE); + String title=fStore.getString(STORE_TITLE); if(title!=null && title.length()>0) { setViewTitle(title); - fStore.setProperty(STORE_TITLE, null); + fStore.set(STORE_TITLE, null); } } diff --git a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnection.java b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnection.java index a6d27366e06..e4b1117f042 100644 --- a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnection.java +++ b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnection.java @@ -93,13 +93,13 @@ class TerminalViewConnection implements ITerminalViewConnection { return new SettingStorePrefixDecorator(store,connector.getId()+"."); //$NON-NLS-1$ } public void loadState(ISettings store) { - fPartName=store.getStringProperty(STORE_PART_NAME); - fSummary=store.getStringProperty(STORE_SUMMARY); - fHistory=store.getStringProperty(STORE_COMMAND_INPUT_FIELD_HISTORY); - fEncoding=store.getStringProperty(STORE_ENCODING); + fPartName=store.getString(STORE_PART_NAME); + fSummary=store.getString(STORE_SUMMARY); + fHistory=store.getString(STORE_COMMAND_INPUT_FIELD_HISTORY); + fEncoding=store.getString(STORE_ENCODING); // load the state of the connection types ITerminalConnector[] connectors=fCtlTerminal.getConnectors(); - String connectionType=store.getStringProperty(STORE_CONNECTION_TYPE); + String connectionType=store.getString(STORE_CONNECTION_TYPE); for (int i = 0; i < connectors.length; i++) { connectors[i].load(getStore(store,connectors[i])); // if this is active connection type @@ -107,26 +107,26 @@ class TerminalViewConnection implements ITerminalViewConnection { fCtlTerminal.setConnector(connectors[i]); } - if("true".equals(store.getStringProperty(STORE_HAS_COMMAND_INPUT_FIELD))) //$NON-NLS-1$ + if("true".equals(store.getString(STORE_HAS_COMMAND_INPUT_FIELD))) //$NON-NLS-1$ setCommandInputField(true); } public void saveState(ISettings store) { - store.setProperty(STORE_PART_NAME, fPartName); - store.setProperty(STORE_SUMMARY,fSummary); - store.setProperty(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory); - store.setProperty(STORE_ENCODING, fEncoding); + store.set(STORE_PART_NAME, fPartName); + store.set(STORE_SUMMARY,fSummary); + store.set(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory); + store.set(STORE_ENCODING, fEncoding); if(fCommandInputField!=null) - store.setProperty(STORE_COMMAND_INPUT_FIELD_HISTORY, fCommandInputField.getHistory()); + store.set(STORE_COMMAND_INPUT_FIELD_HISTORY, fCommandInputField.getHistory()); else - store.setProperty(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory); - store.setProperty(STORE_HAS_COMMAND_INPUT_FIELD,hasCommandInputField()?"true":"false"); //$NON-NLS-1$//$NON-NLS-2$ + store.set(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory); + store.set(STORE_HAS_COMMAND_INPUT_FIELD,hasCommandInputField()?"true":"false"); //$NON-NLS-1$//$NON-NLS-2$ ITerminalConnector[] connectors=fCtlTerminal.getConnectors(); for (int i = 0; i < connectors.length; i++) { connectors[i].save(getStore(store,connectors[i])); } if(fCtlTerminal.getTerminalConnector()!=null) { - store.setProperty(STORE_CONNECTION_TYPE,fCtlTerminal.getTerminalConnector().getId()); + store.set(STORE_CONNECTION_TYPE,fCtlTerminal.getTerminalConnector().getId()); } } public boolean hasCommandInputField() { diff --git a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnectionManager.java b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnectionManager.java index 39e812d880e..dad081de5f4 100644 --- a/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnectionManager.java +++ b/terminal/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnectionManager.java @@ -109,7 +109,7 @@ public class TerminalViewConnectionManager implements ITerminalViewConnectionMan } public void saveState(ISettings store) { - store.setProperty(STORE_SIZE,""+fConnections.size()); //$NON-NLS-1$ + store.set(STORE_SIZE,""+fConnections.size()); //$NON-NLS-1$ // save all connections int n=0; for (Iterator iterator = fConnections.iterator(); iterator.hasNext();) { @@ -119,7 +119,7 @@ public class TerminalViewConnectionManager implements ITerminalViewConnectionMan n++; // remember the active connection by its prefix if(connection.equals(fActiveConnection)) - store.setProperty(STORE_ACTIVE_CONNECTION,prefix); + store.set(STORE_ACTIVE_CONNECTION,prefix); connection.saveState(new SettingStorePrefixDecorator(store,prefix)); } } @@ -127,13 +127,13 @@ public class TerminalViewConnectionManager implements ITerminalViewConnectionMan public void loadState(ISettings store,ITerminalViewConnectionFactory factory) { int size=0; try { - size=Integer.parseInt(store.getStringProperty(STORE_SIZE)); + size=Integer.parseInt(store.getString(STORE_SIZE)); } catch(Exception e) { // ignore } if(size>0) { // a slot for the connections - String active=store.getStringProperty(STORE_ACTIVE_CONNECTION); + String active=store.getString(STORE_ACTIVE_CONNECTION); int n=0; for (int i=0;i - * Note: The method will have no effect if the given properties are the - * same as the already set properties. + * Note: The method will have no effect if the given settings are the + * same as the already set settings. * - * @param properties The map of properties to set. Must not be null. + * @param settings The map of settings to set. Must not be null. */ - public void setProperties(Map properties); + public void set(Map settings); /** - * Adds all properties from the given map. If a property already exist - * in the properties container, than the value of the property is overwritten. + * Adds all settings from the given map. If a setting already exist + * in the settings, than the value of the setting is overwritten. * - * @param properties The map of properties to add. Must not be null. + * @param settings The map of settings to add. Must not be null. */ - public void addProperties(Map properties); + public void addAll(Map settings); /** - * Stores the property under the given property key using the given property value. - * If the current property value is equal to the given property value, no store - * operation will be executed. If the property value is not null and - * is different from the current property value, the new value will be written to - * the property store and a property change event is fired. If the property value - * is null, the property key and the currently stored value are removed - * from the property store. + * Stores the setting under the given key using the given value. If the current + * value is equal to the given value, no store operation will be executed. If the + * value is not null and is different from the current value, the new + * value will be written to the settings. If the value is null, the + * key and the currently stored value are removed from the settings. * + * @param key The key. Must not be null! + * @param value The value. * - * @param key The property key. Must not be null! - * @param value The property value. - * @return true if the property value had been applied to the property store, false otherwise. + * @return true if the value had been applied to the settings, false otherwise. */ - public boolean setProperty(String key, Object value); + public boolean set(String key, Object value); /** - * Stores the property under the given property key using the given long - * property value. The given long value is transformed to an Long - * object and stored to the properties store via setProperty(java.lang.String, java.lang.Object). + * Stores the setting under the given key using the given long value. The given + * long value is transformed to an Long object and stored to the + * settings store via set(java.lang.String, java.lang.Object). * - * @param key The property key. Must not be null! - * @param value The property value. - * @return true if the property value had been applied to the property store, false otherwise. + * @param key The key. Must not be null! + * @param value The value. * - * @see setProperty(java.lang.String, java.lang.Object) + * @return true if the value had been applied to the settings, false otherwise. + * + * @see set(java.lang.String, java.lang.Object) */ - public boolean setProperty(String key, long value); + public boolean set(String key, long value); /** - * Stores the property under the given property key using the given integer - * property value. The given integer value is transformed to an Integer - * object and stored to the properties store via setProperty(java.lang.String, java.lang.Object). + * Stores the setting under the given key using the given integer value. The given + * integer value is transformed to an Integer object and stored to the + * settings via set(java.lang.String, java.lang.Object). * - * @param key The property key. Must not be null! - * @param value The property value. - * @return true if the property value had been applied to the property store, false otherwise. + * @param key The key. Must not be null! + * @param value The value. * - * @see setProperty(java.lang.String, java.lang.Object) + * @return true if the value had been applied to the settings, false otherwise. + * + * @see set(java.lang.String, java.lang.Object) */ - public boolean setProperty(String key, int value); + public boolean set(String key, int value); /** - * Stores the property under the given property key using the given boolean - * property value. The given boolean value is transformed to an Boolean - * object and stored to the properties store via setProperty(java.lang.String, java.lang.Object). + * Stores the setting under the given key using the given boolean value. The given + * boolean value is transformed to an Boolean object and stored to the + * settings via set(java.lang.String, java.lang.Object). * - * @param key The property key. Must not be null! - * @param value The property value. - * @return true if the property value had been applied to the property store, false otherwise. + * @param key The key. Must not be null! + * @param value The value. * - * @see setProperty(java.lang.String, java.lang.Object) + * @return true if the value had been applied to the settings, false otherwise. + * + * @see set(java.lang.String, java.lang.Object) */ - public boolean setProperty(String key, boolean value); + public boolean set(String key, boolean value); /** - * Stores the property under the given property key using the given float - * property value. The given float value is transformed to an Float - * object and stored to the properties store via setProperty(java.lang.String, java.lang.Object). + * Stores the setting under the given key using the given float value. The given + * float value is transformed to an Float object and stored to the + * settings via set(java.lang.String, java.lang.Object). * - * @param key The property key. Must not be null! - * @param value The property value. - * @return true if the property value had been applied to the property store, false otherwise. + * @param key The key. Must not be null! + * @param value The value. * - * @see setProperty(java.lang.String, java.lang.Object) + * @return true if the value had been applied to the settings, false otherwise. + * + * @see set(java.lang.String, java.lang.Object) */ - public boolean setProperty(String key, float value); + public boolean set(String key, float value); /** - * Stores the property under the given property key using the given double - * property value. The given double value is transformed to an Double - * object and stored to the properties store via setProperty(java.lang.String, java.lang.Object). + * Stores the setting under the given key using the given double value. The given + * double value is transformed to an Double object and stored to the + * settings via set(java.lang.String, java.lang.Object). * - * @param key The property key. Must not be null! - * @param value The property value. - * @return true if the property value had been applied to the property store, false otherwise. + * @param key The key. Must not be null! + * @param value The value. * - * @see setProperty(java.lang.String, java.lang.Object) + * @return true if the value had been applied to the settings, false otherwise. + * + * @see set(java.lang.String, java.lang.Object) */ - public boolean setProperty(String key, double value); + public boolean set(String key, double value); /** - * Return all properties. The result map is read-only. + * Return all settings. The result map is read-only. * - * @return A map containing all properties. + * @return A map containing all settings. */ - public Map getProperties(); + public Map getAll(); /** - * Queries the property value stored under the given property key. If the property - * does not exist, null is returned. + * Queries the value stored under the given key. If the setting does not exist, + * null is returned. * - * @param key The property key. Must not be null! - * @return The stored property value or null. + * @param key The key. Must not be null! + * @return The stored value or null. */ - public Object getProperty(String key); + public Object get(String key); /** - * Queries the property value stored under the given property key. If the property - * exist and is of type java.lang.String, the property value casted to - * java.lang.String is returned. In all other cases, null - * is returned. + * Queries the value stored under the given key. If the setting exist and is of type + * java.lang.String, the value casted to java.lang.String + * is returned. In all other cases, null is returned. * - * @param key The property key. Must not be null! - * @return The stored property value casted java.lang.String or null. + * @param key The key. Must not be null! + * @return The stored value casted java.lang.String or null. */ - public String getStringProperty(String key); + public String getString(String key); /** - * Queries the property value stored under the given property key. If the property - * exist and is of type java.lang.String, the property value casted to - * java.lang.String is returned. In all other cases, the given default - * value is returned. + * Queries the value stored under the given key. If the setting exist and is of type + * java.lang.String, the value casted to java.lang.String + * is returned. In all other cases, the given default value is returned. * - * @param key The property key. Must not be null! + * @param key The key. Must not be null! * @param defaultValue The default value or null. * - * @return The stored property value casted java.lang.String or null. + * @return The stored value casted java.lang.String or the default value. */ - public String getStringProperty(String key, String defaultValue); + public String getString(String key, String defaultValue); /** - * Queries the property value stored under the given property key. If the property - * exist and is of type java.lang.Long, the property value converted - * to an long value is returned. In all other cases, -1 is returned. + * Queries the value stored under the given key. If the setting exist and is of type + * java.lang.Long, the value converted to an long value is returned. In + * all other cases, -1 is returned. * - * @param key The property key. Must not be null! - * @return The stored property value converted to a long value or -1. + * @param key The key. Must not be null! + * @return The stored value converted to a long value or -1. */ - public long getLongProperty(String key); + public long getLong(String key); /** - * Queries the property value stored under the given property key. If the property - * exist and is of type java.lang.Integer, the property value converted - * to an integer value is returned. In all other cases, -1 is returned. + * Queries the value stored under the given key. If the setting exist and is of type + * java.lang.Integer, the value converted to an integer value is returned. + * In all other cases, -1 is returned. * - * @param key The property key. Must not be null! - * @return The stored property value converted to an integer value or -1. + * @param key The key. Must not be null! + * @return The stored value converted to an integer value or -1. */ - public int getIntProperty(String key); + public int getInt(String key); /** - * Queries the property value stored under the given property key. If the property - * exist and is of type java.lang.Boolean, the property value converted - * to an boolean value is returned. In all other cases, false is returned. + * Queries the value stored under the given key. If the setting exist and is of type + * java.lang.Boolean, the value converted to an boolean value is returned. + * In all other cases, false is returned. * - * @param key The property key. Must not be null! - * @return The stored property value converted to an boolean value or false. + * @param key The key. Must not be null! + * @return The stored value converted to an boolean value or false. */ - public boolean getBooleanProperty(String key); + public boolean getBoolean(String key); /** - * Queries the property value stored under the given property key. If the property - * exist and is of type java.lang.Float, the property value converted - * to an float value is returned. In all other cases, Float.NaN is returned. + * Queries the value stored under the given key. If the setting exist and is of type + * java.lang.Float, the value converted to an float value is returned. + * In all other cases, Float.NaN is returned. * - * @param key The property key. Must not be null! - * @return The stored property value converted to a float value or Float.NaN. + * @param key The key. Must not be null! + * @return The stored value converted to a float value or Float.NaN. */ - public float getFloatProperty(String key); + public float getFloat(String key); /** - * Queries the property value stored under the given property key. If the property - * exist and is of type java.lang.Double, the property value converted - * to an double value is returned. In all other cases, Double.NaN is returned. + * Queries the value stored under the given key. If the setting exist and is of type + * java.lang.Double, the value converted to an double value is returned. + * In all other cases, Double.NaN is returned. * - * @param key The property key. Must not be null! - * @return The stored property value converted to a double value or Double.NaN. + * @param key The key. Must not be null! + * @return The stored value converted to a double value or Double.NaN. */ - public double getDoubleProperty(String key); + public double getDouble(String key); /** - * Remove all properties from the properties store. The method does not fire any - * properties changed event. + * Remove all settings. */ - public void clearProperties(); + public void clear(); /** - * Returns whether this properties container is empty or not. + * Returns whether the settings are empty or not. * - * @return True if the properties container is empty, false if not. + * @return True if the settings are empty, false if not. */ public boolean isEmpty(); /** - * Returns whether this properties container contains the given key. + * Returns whether the settings contains the given key. * * @param key The key. Must not be null. - * @return True if the properties container contains the key, false if not. + * @return True if the settings contains the key, false if not. */ public boolean containsKey(String key); } diff --git a/terminal/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Settings.java b/terminal/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Settings.java index 746c3fb1b27..ee3fe04ab94 100644 --- a/terminal/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Settings.java +++ b/terminal/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Settings.java @@ -59,7 +59,7 @@ public class Settings extends PlatformObject implements ISettings { public String toString() { final StringBuilder buffer = new StringBuilder(); - // print the first level of the properties map only + // print the first level of the settings map only buffer.append("settings={"); //$NON-NLS-1$ for (String key : settings.keySet()) { buffer.append(key); @@ -84,27 +84,27 @@ public class Settings extends PlatformObject implements ISettings { } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getProperties() + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#getAll() */ @Override - public Map getProperties() { + public Map getAll() { return Collections.unmodifiableMap(new HashMap(settings)); } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getProperty(java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#get(java.lang.String) */ @Override - public Object getProperty(String key) { + public Object get(String key) { return settings.get(key); } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getBooleanProperty(java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#getBoolean(java.lang.String) */ @Override - public final boolean getBooleanProperty(String key) { - Object value = getProperty(key); + public final boolean getBoolean(String key) { + Object value = get(key); if (value instanceof Boolean) { return ((Boolean)value).booleanValue(); } @@ -117,11 +117,11 @@ public class Settings extends PlatformObject implements ISettings { } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getLongProperty(java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#getLong(java.lang.String) */ @Override - public final long getLongProperty(String key) { - Object value = getProperty(key); + public final long getLong(String key) { + Object value = get(key); try { if (value instanceof Long) { return ((Long)value).longValue(); @@ -140,11 +140,11 @@ public class Settings extends PlatformObject implements ISettings { } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getIntProperty(java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#getInt(java.lang.String) */ @Override - public final int getIntProperty(String key) { - Object value = getProperty(key); + public final int getInt(String key) { + Object value = get(key); try { if (value instanceof Integer) { return ((Integer)value).intValue(); @@ -163,30 +163,29 @@ public class Settings extends PlatformObject implements ISettings { } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getStringProperty(java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#getString(java.lang.String) */ @Override - public final String getStringProperty(String key) { - Object value = getProperty(key); - return value instanceof String ? (String)value : - (value != null ? value.toString() : null); + public final String getString(String key) { + Object value = get(key); + return value instanceof String ? (String)value : null; } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getStringProperty(java.lang.String, java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#getString(java.lang.String, java.lang.String) */ @Override - public String getStringProperty(String key, String defaultValue) { - String value = getStringProperty(key); + public String getString(String key, String defaultValue) { + String value = getString(key); return value != null ? value : defaultValue; } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getFloatProperty(java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#getFloat(java.lang.String) */ @Override - public final float getFloatProperty(String key) { - Object value = getProperty(key); + public final float getFloat(String key) { + Object value = get(key); try { if (value instanceof Float) { return ((Float)value).floatValue(); @@ -205,11 +204,11 @@ public class Settings extends PlatformObject implements ISettings { } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getDoubleProperty(java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#getDouble(java.lang.String) */ @Override - public final double getDoubleProperty(String key) { - Object value = getProperty(key); + public final double getDouble(String key) { + Object value = get(key); try { if (value instanceof Double) { return ((Double)value).doubleValue(); @@ -228,97 +227,97 @@ public class Settings extends PlatformObject implements ISettings { } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperties(java.util.Map) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#set(java.util.Map) */ @Override - public final void setProperties(Map properties) { - Assert.isNotNull(properties); + public final void set(Map settings) { + Assert.isNotNull(settings); - // Change the properties only if they have changed really - if (this.settings.equals(properties)) { + // Change the settings only if they have changed really + if (this.settings.equals(settings)) { return; } - // Clear out all old properties + // Clear out all old settings this.settings.clear(); - // Apply everything from the given properties - this.settings.putAll(properties); + // Apply everything from the given settings + this.settings.putAll(settings); } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#addProperties(java.util.Map) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#addAll(java.util.Map) */ @Override - public final void addProperties(Map properties) { - // Apply everything from the given properties - this.settings.putAll(properties); + public final void addAll(Map settings) { + // Apply everything from the given settings + this.settings.putAll(settings); } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, boolean) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#set(java.lang.String, boolean) */ @Override - public final boolean setProperty(String key, boolean value) { - boolean oldValue = getBooleanProperty(key); + public final boolean set(String key, boolean value) { + boolean oldValue = getBoolean(key); if (oldValue != value) { - return setProperty(key, Boolean.valueOf(value)); + return set(key, Boolean.valueOf(value)); } return false; } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, long) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#set(java.lang.String, long) */ @Override - public final boolean setProperty(String key, long value) { - long oldValue = getLongProperty(key); + public final boolean set(String key, long value) { + long oldValue = getLong(key); if (oldValue != value) { - return setProperty(key, Long.valueOf(value)); + return set(key, Long.valueOf(value)); } return false; } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, int) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#set(java.lang.String, int) */ @Override - public final boolean setProperty(String key, int value) { - int oldValue = getIntProperty(key); + public final boolean set(String key, int value) { + int oldValue = getInt(key); if (oldValue != value) { - return setProperty(key, Integer.valueOf(value)); + return set(key, Integer.valueOf(value)); } return false; } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, float) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#set(java.lang.String, float) */ @Override - public final boolean setProperty(String key, float value) { - float oldValue = getFloatProperty(key); + public final boolean set(String key, float value) { + float oldValue = getFloat(key); if (oldValue != value) { - return setProperty(key, Float.valueOf(value)); + return set(key, Float.valueOf(value)); } return false; } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, double) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#set(java.lang.String, double) */ @Override - public final boolean setProperty(String key, double value) { - double oldValue = getDoubleProperty(key); + public final boolean set(String key, double value) { + double oldValue = getDouble(key); if (oldValue != value) { - return setProperty(key, Double.valueOf(value)); + return set(key, Double.valueOf(value)); } return false; } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, java.lang.Object) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#set(java.lang.String, java.lang.Object) */ @Override - public boolean setProperty(String key, Object value) { + public boolean set(String key, Object value) { Assert.isNotNull(key); Object oldValue = settings.get(key); @@ -334,15 +333,15 @@ public class Settings extends PlatformObject implements ISettings { } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#clearProperties() + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#clear() */ @Override - public final void clearProperties() { + public final void clear() { settings.clear(); } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#isEmpty() + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#isEmpty() */ @Override public boolean isEmpty() { @@ -350,7 +349,7 @@ public class Settings extends PlatformObject implements ISettings { } /* (non-Javadoc) - * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#containsKey(java.lang.String) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettings#containsKey(java.lang.String) */ @Override public boolean containsKey(String key) {