diff --git a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettings.java b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettings.java index 3d0d834cefb..cc21437a7b0 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettings.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalSettings.java @@ -45,8 +45,8 @@ public class LocalTerminalSettings implements ILocalTerminalSettings { for (int index = 0; index < numberOfFields; index++) { Field field = declaredField[index]; - Class type = field.getType(); - Object value = store.get(field.getName()); + Class type = field.getType(); + Object value = store.getProperty(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.put(field.getName(), String.valueOf(field.get(this))); + store.setProperty(field.getName(), String.valueOf(field.get(this))); } catch (IllegalAccessException illegalAccess) { diff --git a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchDelegate.java b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchDelegate.java index bbcca6d2762..23ad9ede7b6 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchDelegate.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchDelegate.java @@ -15,6 +15,7 @@ import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; + import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.spawner.ProcessFactory; import org.eclipse.core.runtime.CoreException; @@ -79,6 +80,7 @@ public class LocalTerminalLaunchDelegate extends LaunchConfigurationDelegate { * @param launch the {@link ILaunch} object * @exception CoreException if launching fails */ + @SuppressWarnings("deprecation") public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor progressMonitor) throws CoreException { @@ -179,7 +181,7 @@ public class LocalTerminalLaunchDelegate extends LaunchConfigurationDelegate { // Use program name as "process type" attribute: // - Map processAttributes = new HashMap(); + Map processAttributes = new HashMap(); String programName = location.lastSegment(); String extension = location.getFileExtension(); if (extension != null) { diff --git a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchUtilities.java b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchUtilities.java index 26105e58220..c13bf5124ed 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchUtilities.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalLaunchUtilities.java @@ -18,6 +18,7 @@ import java.text.MessageFormat; import java.util.Collections; import java.util.HashMap; import java.util.Map; + import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; @@ -65,7 +66,7 @@ public class LocalTerminalLaunchUtilities { private final static String STRING = null; private final static String TERM = "TERM"; //$NON-NLS-1$ private final static String ANSI = "ansi"; //$NON-NLS-1$ - private final static Map TERM_ANSI = Collections.singletonMap(TERM, ANSI); + private final static Map TERM_ANSI = Collections.singletonMap(TERM, ANSI); // These constants were copied from IExternalToolConstants to avoid references to internal API: // @@ -241,7 +242,7 @@ public class LocalTerminalLaunchUtilities { name = terminalLaunchName.format(new Object[] {name}); name = manager.generateLaunchConfigurationName(name); workingCopy = LocalTerminalUtilities.TERMINAL_LAUNCH_TYPE.newInstance(null, name); - workingCopy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new HashMap(TERM_ANSI)); + workingCopy.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, new HashMap(TERM_ANSI)); workingCopy.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true); workingCopy.setAttribute(ATTR_LOCATION, defaultShell); workingCopy.setAttribute(ATTR_WORKING_DIRECTORY, userHome); diff --git a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalStillRunningListener.java b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalStillRunningListener.java index 497d9160811..e9224561e66 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalStillRunningListener.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/launch/LocalTerminalStillRunningListener.java @@ -81,7 +81,7 @@ public class LocalTerminalStillRunningListener implements IWorkbenchListener { return true; } - List notTerminated = new ArrayList(); + List notTerminated = new ArrayList(); ILaunch launches[] = LocalTerminalUtilities.LAUNCH_MANAGER.getLaunches(); ILaunchConfigurationType configurationType; ILaunchConfiguration configuration; @@ -109,7 +109,7 @@ public class LocalTerminalStillRunningListener implements IWorkbenchListener { if (!notTerminated.isEmpty()) { IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); - ILaunch[] launch = (ILaunch[])notTerminated.toArray(new ILaunch[notTerminated.size()]); + ILaunch[] launch = notTerminated.toArray(new ILaunch[notTerminated.size()]); return LocalTerminalStillRunningDialog.openDialog(window.getShell(), launch); } return true; diff --git a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcess.java b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcess.java index f0f2e11c5f9..2320222d47c 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcess.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcess.java @@ -14,6 +14,7 @@ package org.eclipse.tm.internal.terminal.local.process; import java.util.HashMap; import java.util.Map; + import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.spawner.Spawner; import org.eclipse.debug.core.ILaunch; @@ -69,6 +70,7 @@ import org.eclipse.debug.core.model.RuntimeProcess; * @author Mirko Raner * @version $Revision: 1.2 $ */ +@SuppressWarnings("restriction") public final class LocalTerminalProcess extends RuntimeProcess { /** @@ -88,7 +90,7 @@ public final class LocalTerminalProcess extends RuntimeProcess { * @param name the process name * @param attributes additional attributes of the process */ - protected LocalTerminalProcess(ILaunch launch, Process process, String name, Map attributes) { + protected LocalTerminalProcess(ILaunch launch, Process process, String name, Map attributes) { super(launch, process, name, setProcessType(attributes)); enableStreamsProxy = true; @@ -172,7 +174,7 @@ public final class LocalTerminalProcess extends RuntimeProcess { //------------------------------------- PRIVATE SECTION --------------------------------------// - private static Map setProcessType(Map attributes) { + private static Map setProcessType(Map attributes) { // The process type used to be set by the LocalTerminalProcessFactory. However, if some // client code managed to instantiate a LocalTerminalProcess directly (instead of going @@ -182,7 +184,7 @@ public final class LocalTerminalProcess extends RuntimeProcess { // if (attributes == null) { - attributes = new HashMap(1); + attributes = new HashMap(1); } attributes.put(IProcess.ATTR_PROCESS_TYPE, PROCESS_TYPE); return attributes; diff --git a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcessFactory.java b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcessFactory.java index 7faff8dfa83..63c24c63d1f 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcessFactory.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcessFactory.java @@ -12,6 +12,7 @@ package org.eclipse.tm.internal.terminal.local.process; import java.util.Map; + import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.IProcessFactory; import org.eclipse.debug.core.model.IProcess; @@ -33,7 +34,7 @@ public class LocalTerminalProcessFactory implements IProcessFactory { /** * @see IProcessFactory#newProcess(ILaunch, Process, String, Map) */ - public IProcess newProcess(ILaunch launch, Process process, String label, Map attributes) { + public IProcess newProcess(ILaunch launch, Process process, String label, Map attributes) { return new LocalTerminalProcess(launch, process, label, attributes); } diff --git a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcessRegistry.java b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcessRegistry.java index 8383ba600b0..a29750a51dc 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcessRegistry.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/process/LocalTerminalProcessRegistry.java @@ -13,6 +13,7 @@ package org.eclipse.tm.internal.terminal.local.process; import java.util.IdentityHashMap; import java.util.Map; + import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchesListener2; import org.eclipse.tm.internal.terminal.local.LocalTerminalUtilities; @@ -31,7 +32,7 @@ public class LocalTerminalProcessRegistry implements ILaunchesListener2 { private final static LocalTerminalProcessRegistry INSTANCE = new LocalTerminalProcessRegistry(); - private Map processes; + private Map processes; private LocalTerminalProcessRegistry() { @@ -40,7 +41,7 @@ public class LocalTerminalProcessRegistry implements ILaunchesListener2 { // hash code value if the object changes internally. To be safe in those cases, an // IdentityHashMap is used: // - processes = new IdentityHashMap(); + processes = new IdentityHashMap(); } /** @@ -53,7 +54,7 @@ public class LocalTerminalProcessRegistry implements ILaunchesListener2 { */ public static LocalTerminalProcess getFromLaunch(ILaunch launch) { - return (LocalTerminalProcess)INSTANCE.processes.get(launch); + return INSTANCE.processes.get(launch); } /** diff --git a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/LayeredSettingsStore.java b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/LayeredSettingsStore.java similarity index 73% rename from plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/LayeredSettingsStore.java rename to deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/LayeredSettingsStore.java index 8559224eec5..48feb91b44f 100644 --- a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/LayeredSettingsStore.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/LayeredSettingsStore.java @@ -8,7 +8,10 @@ * Contributors: * Michael Scharf (Wind River) - initial API and implementation *******************************************************************************/ -package org.eclipse.tm.internal.terminal.provisional.api; +package org.eclipse.tm.internal.terminal.view; + +import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; +import org.eclipse.tm.internal.terminal.provisional.api.SettingsStore; /** * Uses an array of {@link ISettingsStore} to find a value. @@ -19,13 +22,13 @@ package org.eclipse.tm.internal.terminal.provisional.api; * the Target Management team. *

*/ -public class LayeredSettingsStore implements ISettingsStore { +public class LayeredSettingsStore extends SettingsStore { private final ISettingsStore[] fStores; /** * @param stores the stores used to search the values. - * {@link #put(String, String)} will put the value in the + * {@link #setProperty(String, Object)} will put the value in the * first store in the list. */ public LayeredSettingsStore(ISettingsStore[] stores) { @@ -39,24 +42,18 @@ public class LayeredSettingsStore implements ISettingsStore { public LayeredSettingsStore(ISettingsStore s1, ISettingsStore s2) { this(new ISettingsStore[]{s1,s2}); } - public String get(String key) { + + public Object getProperty(String key) { for (int i = 0; i < fStores.length; i++) { - String value=fStores[i].get(key); - if(value!=null) + Object value=fStores[i].getProperty(key); + if (value!=null) return value; } return null; } - public String get(String key, String defaultValue) { - String value=get(key); - if ((value == null) || (value.equals(""))) //$NON-NLS-1$ - return defaultValue; - return value; - } - - public void put(String key, String value) { - fStores[0].put(key,value); + public boolean setProperty(String key, Object value) { + return fStores[0].setProperty(key,value); } } diff --git a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/PreferenceSettingStore.java b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/PreferenceSettingStore.java similarity index 78% rename from plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/PreferenceSettingStore.java rename to deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/PreferenceSettingStore.java index ff0e6f8585a..38a01b7eaf4 100644 --- a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/PreferenceSettingStore.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/PreferenceSettingStore.java @@ -8,7 +8,7 @@ * Contributors: * Michael Scharf (Wind River) - initial API and implementation *******************************************************************************/ -package org.eclipse.tm.internal.terminal.provisional.api; +package org.eclipse.tm.internal.terminal.view; import org.eclipse.core.runtime.Preferences; @@ -21,7 +21,7 @@ import org.eclipse.core.runtime.Preferences; * the Target Management team. *

*/ -public class PreferenceSettingStore implements ISettingsStore { +public class PreferenceSettingStore extends org.eclipse.tm.internal.terminal.provisional.api.SettingsStore { private final String fPrefix; private final Preferences fPreferences; @@ -35,19 +35,16 @@ public class PreferenceSettingStore implements ISettingsStore { fPreferences=preferences; fPrefix=prefix; } - public String get(String key) { + + public Object getProperty(String key) { return fPreferences.getString(makeKey(key)); } - public String get(String key, String defaultValue) { - String value=get(key); - if ((value == null) || (value.equals(""))) //$NON-NLS-1$ - return defaultValue; - return value; - } - - public void put(String key, String value) { - fPreferences.setValue(makeKey(key), value); + public boolean setProperty(String key, Object value) { + if (value instanceof String) { + fPreferences.setValue(makeKey(key), (String)value); + } + return true; } /** * @param key diff --git a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingStorePrefixDecorator.java b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingStorePrefixDecorator.java index 0d7ccfad4b7..ff948fb2de2 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingStorePrefixDecorator.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingStorePrefixDecorator.java @@ -12,7 +12,7 @@ package org.eclipse.tm.internal.terminal.view; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; -public class SettingStorePrefixDecorator implements ISettingsStore { +public class SettingStorePrefixDecorator extends org.eclipse.tm.internal.terminal.provisional.api.SettingsStore { private final String fPrefix; private final ISettingsStore fStore; SettingStorePrefixDecorator(ISettingsStore store,String prefix) { @@ -20,16 +20,11 @@ public class SettingStorePrefixDecorator implements ISettingsStore { fStore=store; } - public String get(String key) { - return fStore.get(fPrefix+key); + public Object getProperty(String key) { + return fStore.getProperty(fPrefix+key); } - public String get(String key, String defaultValue) { - return fStore.get(fPrefix+key,defaultValue); + public boolean setProperty(String key, Object value) { + return super.setProperty(fPrefix+key,value); } - - public void put(String key, String value) { - fStore.put(fPrefix+key,value); - } - } diff --git a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingsStore.java b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingsStore.java index f74f4a24b79..800dcf683a8 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingsStore.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/SettingsStore.java @@ -11,7 +11,6 @@ package org.eclipse.tm.internal.terminal.view; import java.util.Arrays; -import java.util.HashMap; import java.util.Map; import org.eclipse.jface.dialogs.IDialogSettings; @@ -27,10 +26,10 @@ import org.eclipse.ui.IMemento; * * @author Michael Scharf */ -class SettingsStore implements ISettingsStore { +class SettingsStore extends org.eclipse.tm.internal.terminal.provisional.api.SettingsStore { private static final String KEYS = "_keys_"; //$NON-NLS-1$ - final private Map fMap=new HashMap(); + public SettingsStore(IMemento memento) { if(memento==null) return; @@ -50,40 +49,27 @@ class SettingsStore implements ISettingsStore { } if(m!=null) { // cache the value in the map - fMap.put(key,m.getString(path[path.length-1])); + setProperty(key,m.getString(path[path.length-1])); } } } } } - public String get(String key) { - return get(key,null); - } - public String get(String key, String defaultValue) { - String value = (String) fMap.get(key); - if ((value == null) || (value.equals(""))) //$NON-NLS-1$ - return defaultValue; - - return value; - } - - public void put(String key, String value) { + public boolean setProperty(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$ - // null values remove the key from the map - if ((value == null) || (value.equals(""))) //$NON-NLS-1$ - fMap.remove(key); - else - fMap.put(key, value); + return super.setProperty(key, value); } + /** * Save the state into memento. * * @param memento Memento to save state into. */ public void saveState(IMemento memento) { - String[] keyNames=(String[]) fMap.keySet().toArray(new String[fMap.size()]); + Map map = getProperties(); + String[] keyNames=(String[]) map.keySet().toArray(new String[map.size()]); Arrays.sort(keyNames); StringBuffer buffer=new StringBuffer(); for (int i = 0; i < keyNames.length; i++) { @@ -99,7 +85,7 @@ class SettingsStore implements ISettingsStore { m=child; } // use the last element in path as key of the child memento - m.putString(path[path.length-1], (String) fMap.get(key)); + m.putString(path[path.length-1], (String) map.get(key)); // construct the string for the keys if(i>0) buffer.append(","); //$NON-NLS-1$ diff --git a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java index 247d7fcad1f..a517b46ca94 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java +++ b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalView.java @@ -71,9 +71,7 @@ import org.eclipse.tm.internal.terminal.control.actions.TerminalActionSelectAll; import org.eclipse.tm.internal.terminal.preferences.ITerminalConstants; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalConnector; -import org.eclipse.tm.internal.terminal.provisional.api.LayeredSettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.Logger; -import org.eclipse.tm.internal.terminal.provisional.api.PreferenceSettingStore; import org.eclipse.tm.internal.terminal.provisional.api.TerminalConnectorExtension; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; import org.eclipse.tm.internal.terminal.view.ITerminalViewConnectionManager.ITerminalViewConnectionFactory; @@ -489,7 +487,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi */ private ITerminalConnector loadSettings(ISettingsStore store, ITerminalConnector[] connectors) { ITerminalConnector connector=null; - String connectionType=store.get(STORE_CONNECTION_TYPE); + String connectionType=store.getStringProperty(STORE_CONNECTION_TYPE); for (int i = 0; i < connectors.length; i++) { connectors[i].load(getStore(store,connectors[i])); if(connectors[i].getId().equals(connectionType)) @@ -523,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.put(STORE_CONNECTION_TYPE,connector.getId()); + store.setProperty(STORE_CONNECTION_TYPE,connector.getId()); } } @@ -533,7 +531,7 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi } public void saveState(IMemento memento) { super.saveState(memento); - fStore.put(STORE_TITLE,getPartName()); + fStore.setProperty(STORE_TITLE,getPartName()); fMultiConnectionManager.saveState(new SettingStorePrefixDecorator(fStore,"connectionManager")); //$NON-NLS-1$ fStore.saveState(memento); } @@ -685,10 +683,10 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi */ private void legacyLoadState() { // TODO legacy: load the old title.... - String summary=fStore.get(STORE_SETTING_SUMMARY); + String summary=fStore.getStringProperty(STORE_SETTING_SUMMARY); if(summary!=null) { getActiveConnection().setSummary(summary); - fStore.put(STORE_SETTING_SUMMARY,null); + fStore.setProperty(STORE_SETTING_SUMMARY,null); } } /** @@ -699,10 +697,10 @@ public class TerminalView extends ViewPart implements ITerminalView, ITerminalVi */ private void legacySetTitle() { // restore the title of this view - String title=fStore.get(STORE_TITLE); + String title=fStore.getStringProperty(STORE_TITLE); if(title!=null && title.length()>0) { setViewTitle(title); - fStore.put(STORE_TITLE, null); + fStore.setProperty(STORE_TITLE, null); } } diff --git a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnection.java b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnection.java index aa90041f355..1603b5bff90 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnection.java +++ b/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(ISettingsStore store) { - fPartName=store.get(STORE_PART_NAME); - fSummary=store.get(STORE_SUMMARY); - fHistory=store.get(STORE_COMMAND_INPUT_FIELD_HISTORY); - fEncoding=store.get(STORE_ENCODING); + fPartName=store.getStringProperty(STORE_PART_NAME); + fSummary=store.getStringProperty(STORE_SUMMARY); + fHistory=store.getStringProperty(STORE_COMMAND_INPUT_FIELD_HISTORY); + fEncoding=store.getStringProperty(STORE_ENCODING); // load the state of the connection types ITerminalConnector[] connectors=fCtlTerminal.getConnectors(); - String connectionType=store.get(STORE_CONNECTION_TYPE); + String connectionType=store.getStringProperty(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.get(STORE_HAS_COMMAND_INPUT_FIELD))) //$NON-NLS-1$ + if("true".equals(store.getStringProperty(STORE_HAS_COMMAND_INPUT_FIELD))) //$NON-NLS-1$ setCommandInputField(true); } public void saveState(ISettingsStore store) { - store.put(STORE_PART_NAME, fPartName); - store.put(STORE_SUMMARY,fSummary); - store.put(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory); - store.put(STORE_ENCODING, fEncoding); + store.setProperty(STORE_PART_NAME, fPartName); + store.setProperty(STORE_SUMMARY,fSummary); + store.setProperty(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory); + store.setProperty(STORE_ENCODING, fEncoding); if(fCommandInputField!=null) - store.put(STORE_COMMAND_INPUT_FIELD_HISTORY, fCommandInputField.getHistory()); + store.setProperty(STORE_COMMAND_INPUT_FIELD_HISTORY, fCommandInputField.getHistory()); else - store.put(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory); - store.put(STORE_HAS_COMMAND_INPUT_FIELD,hasCommandInputField()?"true":"false"); //$NON-NLS-1$//$NON-NLS-2$ + store.setProperty(STORE_COMMAND_INPUT_FIELD_HISTORY, fHistory); + store.setProperty(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.put(STORE_CONNECTION_TYPE,fCtlTerminal.getTerminalConnector().getId()); + store.setProperty(STORE_CONNECTION_TYPE,fCtlTerminal.getTerminalConnector().getId()); } } public boolean hasCommandInputField() { diff --git a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnectionManager.java b/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnectionManager.java index 88af3056b68..84a0f7f3c79 100644 --- a/deprecated/plugins/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/TerminalViewConnectionManager.java +++ b/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(ISettingsStore store) { - store.put(STORE_SIZE,""+fConnections.size()); //$NON-NLS-1$ + store.setProperty(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.put(STORE_ACTIVE_CONNECTION,prefix); + store.setProperty(STORE_ACTIVE_CONNECTION,prefix); connection.saveState(new SettingStorePrefixDecorator(store,prefix)); } } @@ -127,13 +127,13 @@ public class TerminalViewConnectionManager implements ITerminalViewConnectionMan public void loadState(ISettingsStore store,ITerminalViewConnectionFactory factory) { int size=0; try { - size=Integer.parseInt(store.get(STORE_SIZE)); + size=Integer.parseInt(store.getStringProperty(STORE_SIZE)); } catch(Exception e) { // ignore } if(size>0) { // a slot for the connections - String active=store.get(STORE_ACTIVE_CONNECTION); + String active=store.getStringProperty(STORE_ACTIVE_CONNECTION); int n=0; for (int i=0;i - + diff --git a/plugins/org.eclipse.tm.terminal.remote/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tm.terminal.remote/.settings/org.eclipse.jdt.core.prefs index a4b6f7df50e..c2dc3aa2f47 100644 --- a/plugins/org.eclipse.tm.terminal.remote/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.tm.terminal.remote/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -71,4 +71,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.tm.terminal.remote/META-INF/MANIFEST.MF b/plugins/org.eclipse.tm.terminal.remote/META-INF/MANIFEST.MF index 3afcf44025b..03f058c1d27 100644 --- a/plugins/org.eclipse.tm.terminal.remote/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.tm.terminal.remote/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.resources, org.eclipse.swt, org.eclipse.jface -Bundle-RequiredExecutionEnvironment: JavaSE-1.7 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.eclipse.tm.internal.terminal.remote;x-internal:=true, org.eclipse.tm.terminal.remote Bundle-Activator: org.eclipse.tm.internal.terminal.remote.Activator diff --git a/plugins/org.eclipse.tm.terminal.remote/src/org/eclipse/tm/internal/terminal/remote/RemoteSettings.java b/plugins/org.eclipse.tm.terminal.remote/src/org/eclipse/tm/internal/terminal/remote/RemoteSettings.java index e71e9f65eb9..fd9a31341f4 100644 --- a/plugins/org.eclipse.tm.terminal.remote/src/org/eclipse/tm/internal/terminal/remote/RemoteSettings.java +++ b/plugins/org.eclipse.tm.terminal.remote/src/org/eclipse/tm/internal/terminal/remote/RemoteSettings.java @@ -39,16 +39,16 @@ public class RemoteSettings implements IRemoteSettings { * Load information into the RemoteSettings object. */ public void load(ISettingsStore store) { - fRemoteServices = store.get(REMOTE_SERVICES); - fConnectionName = store.get(CONNECTION_NAME); + fRemoteServices = store.getStringProperty(REMOTE_SERVICES); + fConnectionName = store.getStringProperty(CONNECTION_NAME); } /** * Extract information from the RemoteSettings object. */ public void save(ISettingsStore store) { - store.put(REMOTE_SERVICES, fRemoteServices); - store.put(CONNECTION_NAME, fConnectionName); + store.getStringProperty(REMOTE_SERVICES, fRemoteServices); + store.getStringProperty(CONNECTION_NAME, fConnectionName); } public void setConnectionName(String name) { diff --git a/plugins/org.eclipse.tm.terminal.serial/.classpath b/plugins/org.eclipse.tm.terminal.serial/.classpath index b978e78e121..ad32c83a788 100644 --- a/plugins/org.eclipse.tm.terminal.serial/.classpath +++ b/plugins/org.eclipse.tm.terminal.serial/.classpath @@ -1,11 +1,7 @@ - - - - - - + + diff --git a/plugins/org.eclipse.tm.terminal.serial/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tm.terminal.serial/.settings/org.eclipse.jdt.core.prefs index f1f183d2609..c2dc3aa2f47 100644 --- a/plugins/org.eclipse.tm.terminal.serial/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.tm.terminal.serial/.settings/org.eclipse.jdt.core.prefs @@ -1,21 +1,21 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning @@ -71,4 +71,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.tm.terminal.serial/META-INF/MANIFEST.MF b/plugins/org.eclipse.tm.terminal.serial/META-INF/MANIFEST.MF index 5e8cf83952b..b27bc126daa 100644 --- a/plugins/org.eclipse.tm.terminal.serial/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.tm.terminal.serial/META-INF/MANIFEST.MF @@ -12,7 +12,7 @@ Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true Eclipse-BuddyPolicy: ext Bundle-Vendor: %providerName -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ClassPath: . Bundle-Activator: org.eclipse.tm.internal.terminal.serial.Activator Export-Package: org.eclipse.tm.internal.terminal.serial;x-internal:=true diff --git a/plugins/org.eclipse.tm.terminal.serial/src/org/eclipse/tm/internal/terminal/serial/SerialSettings.java b/plugins/org.eclipse.tm.terminal.serial/src/org/eclipse/tm/internal/terminal/serial/SerialSettings.java index 7980b7afe5d..7e25a055714 100644 --- a/plugins/org.eclipse.tm.terminal.serial/src/org/eclipse/tm/internal/terminal/serial/SerialSettings.java +++ b/plugins/org.eclipse.tm.terminal.serial/src/org/eclipse/tm/internal/terminal/serial/SerialSettings.java @@ -154,22 +154,22 @@ public class SerialSettings implements ISerialSettings { } public void load(ISettingsStore store) { - fSerialPort = store.get("SerialPort", fProperties.getDefaultSerialPort());//$NON-NLS-1$ - fBaudRate = store.get("BaudRate", fProperties.getDefaultBaudRate());//$NON-NLS-1$ - fDataBits = store.get("DataBits", fProperties.getDefaultDataBits());//$NON-NLS-1$ - fStopBits = store.get("StopBits", fProperties.getDefaultStopBits());//$NON-NLS-1$ - fParity = store.get("Parity", fProperties.getDefaultParity());//$NON-NLS-1$ - fFlowControl = store.get("FlowControl", fProperties.getDefaultFlowControl());//$NON-NLS-1$ - fTimeout = store.get("Timeout",fProperties.getDefaultTimeout()); //$NON-NLS-1$ + fSerialPort = store.getStringProperty("SerialPort", fProperties.getDefaultSerialPort());//$NON-NLS-1$ + fBaudRate = store.getStringProperty("BaudRate", fProperties.getDefaultBaudRate());//$NON-NLS-1$ + fDataBits = store.getStringProperty("DataBits", fProperties.getDefaultDataBits());//$NON-NLS-1$ + fStopBits = store.getStringProperty("StopBits", fProperties.getDefaultStopBits());//$NON-NLS-1$ + fParity = store.getStringProperty("Parity", fProperties.getDefaultParity());//$NON-NLS-1$ + fFlowControl = store.getStringProperty("FlowControl", fProperties.getDefaultFlowControl());//$NON-NLS-1$ + fTimeout = store.getStringProperty("Timeout",fProperties.getDefaultTimeout()); //$NON-NLS-1$ } public void save(ISettingsStore store) { - store.put("SerialPort", fSerialPort); //$NON-NLS-1$ - store.put("BaudRate", fBaudRate); //$NON-NLS-1$ - store.put("DataBits", fDataBits); //$NON-NLS-1$ - store.put("StopBits", fStopBits); //$NON-NLS-1$ - store.put("Parity", fParity); //$NON-NLS-1$ - store.put("FlowControl", fFlowControl); //$NON-NLS-1$ + store.setProperty("SerialPort", fSerialPort); //$NON-NLS-1$ + store.setProperty("BaudRate", fBaudRate); //$NON-NLS-1$ + store.setProperty("DataBits", fDataBits); //$NON-NLS-1$ + store.setProperty("StopBits", fStopBits); //$NON-NLS-1$ + store.setProperty("Parity", fParity); //$NON-NLS-1$ + store.setProperty("FlowControl", fFlowControl); //$NON-NLS-1$ } public SerialProperties getProperties() { diff --git a/plugins/org.eclipse.tm.terminal.ssh/.classpath b/plugins/org.eclipse.tm.terminal.ssh/.classpath index ce73933404a..ad32c83a788 100644 --- a/plugins/org.eclipse.tm.terminal.ssh/.classpath +++ b/plugins/org.eclipse.tm.terminal.ssh/.classpath @@ -1,7 +1,7 @@ - - + + diff --git a/plugins/org.eclipse.tm.terminal.ssh/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tm.terminal.ssh/.settings/org.eclipse.jdt.core.prefs index f1f183d2609..c2dc3aa2f47 100644 --- a/plugins/org.eclipse.tm.terminal.ssh/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.tm.terminal.ssh/.settings/org.eclipse.jdt.core.prefs @@ -1,21 +1,21 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning @@ -71,4 +71,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.tm.terminal.ssh/META-INF/MANIFEST.MF b/plugins/org.eclipse.tm.terminal.ssh/META-INF/MANIFEST.MF index cb4228c2770..4f15d9c50aa 100644 --- a/plugins/org.eclipse.tm.terminal.ssh/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.tm.terminal.ssh/META-INF/MANIFEST.MF @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.tm.terminal;bundle-version="3.3.0", com.jcraft.jsch;bundle-version="[0.1.31,1.0.0)", org.eclipse.jsch.core;bundle-version="[1.0.0,2.0.0)" -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.eclipse.tm.internal.terminal.ssh;x-internal:=true Bundle-Activator: org.eclipse.tm.internal.terminal.ssh.Activator Bundle-ActivationPolicy: lazy diff --git a/plugins/org.eclipse.tm.terminal.ssh/src/org/eclipse/tm/internal/terminal/ssh/SshSettings.java b/plugins/org.eclipse.tm.terminal.ssh/src/org/eclipse/tm/internal/terminal/ssh/SshSettings.java index 8a1e21ad7bb..fc87c272fdc 100644 --- a/plugins/org.eclipse.tm.terminal.ssh/src/org/eclipse/tm/internal/terminal/ssh/SshSettings.java +++ b/plugins/org.eclipse.tm.terminal.ssh/src/org/eclipse/tm/internal/terminal/ssh/SshSettings.java @@ -40,27 +40,27 @@ public class SshSettings implements ISshSettings { } public void load(ISettingsStore store) { - fHost = store.get("Host");//$NON-NLS-1$ - fUser = store.get("User");//$NON-NLS-1$ + fHost = store.getStringProperty("Host");//$NON-NLS-1$ + fUser = store.getStringProperty("User");//$NON-NLS-1$ // ISettingsStore providers have to make sure that // the password is not saved in some as plain text // on disk. [bug 313991] - fPassword = store.get("Password");//$NON-NLS-1$ - fPort = store.get("Port");//$NON-NLS-1$ - fTimeout = store.get("Timeout");//$NON-NLS-1$ - fKeepalive = store.get("Keepalive");//$NON-NLS-1$ + fPassword = store.getStringProperty("Password");//$NON-NLS-1$ + fPort = store.getStringProperty("Port");//$NON-NLS-1$ + fTimeout = store.getStringProperty("Timeout");//$NON-NLS-1$ + fKeepalive = store.getStringProperty("Keepalive");//$NON-NLS-1$ } public void save(ISettingsStore store) { - store.put("Host", fHost);//$NON-NLS-1$ - store.put("User", fUser);//$NON-NLS-1$ - store.put("Port", fPort);//$NON-NLS-1$ + store.setProperty("Host", fHost);//$NON-NLS-1$ + store.setProperty("User", fUser);//$NON-NLS-1$ + store.setProperty("Port", fPort);//$NON-NLS-1$ // We do *not* store the password in the settings because // this can cause the password to be stored as plain text // in some settings file - store.put("Timeout", fTimeout);//$NON-NLS-1$ - store.put("Keepalive", fKeepalive);//$NON-NLS-1$ + store.setProperty("Timeout", fTimeout);//$NON-NLS-1$ + store.setProperty("Keepalive", fKeepalive);//$NON-NLS-1$ } diff --git a/plugins/org.eclipse.tm.terminal.telnet/.classpath b/plugins/org.eclipse.tm.terminal.telnet/.classpath index 37d5094e3a9..25d360efcad 100644 --- a/plugins/org.eclipse.tm.terminal.telnet/.classpath +++ b/plugins/org.eclipse.tm.terminal.telnet/.classpath @@ -1,6 +1,6 @@ - + diff --git a/plugins/org.eclipse.tm.terminal.telnet/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tm.terminal.telnet/.settings/org.eclipse.jdt.core.prefs index f1f183d2609..c2dc3aa2f47 100644 --- a/plugins/org.eclipse.tm.terminal.telnet/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.tm.terminal.telnet/.settings/org.eclipse.jdt.core.prefs @@ -1,21 +1,21 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=warning org.eclipse.jdt.core.compiler.problem.deprecation=warning org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning @@ -71,4 +71,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.tm.terminal.telnet/META-INF/MANIFEST.MF b/plugins/org.eclipse.tm.terminal.telnet/META-INF/MANIFEST.MF index 111fa979b3d..ea631367c33 100644 --- a/plugins/org.eclipse.tm.terminal.telnet/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.tm.terminal.telnet/META-INF/MANIFEST.MF @@ -8,5 +8,5 @@ Bundle-Localization: plugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.tm.terminal;bundle-version="3.3.0" -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.eclipse.tm.internal.terminal.telnet;x-internal:=true diff --git a/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/internal/terminal/telnet/TelnetSettings.java b/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/internal/terminal/telnet/TelnetSettings.java index 0518b25d6cc..f37179e4513 100644 --- a/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/internal/terminal/telnet/TelnetSettings.java +++ b/plugins/org.eclipse.tm.terminal.telnet/src/org/eclipse/tm/internal/terminal/telnet/TelnetSettings.java @@ -52,15 +52,15 @@ public class TelnetSettings implements ITelnetSettings { } public void load(ISettingsStore store) { - fHost = store.get("Host", fProperties.getDefaultHost());//$NON-NLS-1$ - fNetworkPort = store.get("NetworkPort", fProperties.getDefaultNetworkPort());//$NON-NLS-1$ - fTimeout = store.get("Timeout","10");//$NON-NLS-1$ //$NON-NLS-2$ + fHost = store.getStringProperty("Host", fProperties.getDefaultHost());//$NON-NLS-1$ + fNetworkPort = store.getStringProperty("NetworkPort", fProperties.getDefaultNetworkPort());//$NON-NLS-1$ + fTimeout = store.getStringProperty("Timeout","10");//$NON-NLS-1$ //$NON-NLS-2$ } public void save(ISettingsStore store) { - store.put("Host", fHost);//$NON-NLS-1$ - store.put("NetworkPort", fNetworkPort);//$NON-NLS-1$ - store.put("Timeout", fTimeout);//$NON-NLS-1$ + store.setProperty("Host", fHost);//$NON-NLS-1$ + store.setProperty("NetworkPort", fNetworkPort);//$NON-NLS-1$ + store.setProperty("Timeout", fTimeout);//$NON-NLS-1$ } public TelnetProperties getProperties() { diff --git a/plugins/org.eclipse.tm.terminal.test/.classpath b/plugins/org.eclipse.tm.terminal.test/.classpath index 64c5e31b7a2..ad32c83a788 100644 --- a/plugins/org.eclipse.tm.terminal.test/.classpath +++ b/plugins/org.eclipse.tm.terminal.test/.classpath @@ -1,6 +1,6 @@ - + diff --git a/plugins/org.eclipse.tm.terminal.test/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tm.terminal.test/.settings/org.eclipse.jdt.core.prefs index 40c9c1aa311..fcd7b940075 100644 --- a/plugins/org.eclipse.tm.terminal.test/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.tm.terminal.test/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -79,4 +79,4 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.tm.terminal.test/META-INF/MANIFEST.MF b/plugins/org.eclipse.tm.terminal.test/META-INF/MANIFEST.MF index 7164d348c6a..eabe482ba35 100644 --- a/plugins/org.eclipse.tm.terminal.test/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.tm.terminal.test/META-INF/MANIFEST.MF @@ -9,7 +9,7 @@ Require-Bundle: org.junit, org.eclipse.tm.terminal;bundle-version="3.3.0", org.eclipse.core.runtime, org.eclipse.ui -Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.eclipse.tm.internal.terminal.connector;x-internal:=true, org.eclipse.tm.internal.terminal.emulator;x-internal:=true, org.eclipse.tm.internal.terminal.model;x-internal:=true, diff --git a/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java b/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java index b9c4d3c6a74..1cd90528560 100644 --- a/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java +++ b/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorFactoryTest.java @@ -24,24 +24,11 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.tm.internal.terminal.provisional.api.SettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl; public class TerminalConnectorFactoryTest extends TestCase { - public class SettingsMock implements ISettingsStore { - - public String get(String key) { - return null; - } - - public String get(String key, String defaultValue) { - return null; - } - - public void put(String key, String value) { - } - - } public static class TerminalControlMock implements ITerminalControl { public void setEncoding(String encoding) { @@ -245,7 +232,7 @@ public class TerminalConnectorFactoryTest extends TestCase { public void testLoad() { ConnectorMock mock=new ConnectorMock(); TerminalConnector c = makeTerminalConnector(mock); - ISettingsStore s=new SettingsMock(); + ISettingsStore s=new SettingsStore(); c.load(s); // the load is called after the connect... assertNull(mock.fLoadStore); @@ -256,7 +243,7 @@ public class TerminalConnectorFactoryTest extends TestCase { public void testSave() { ConnectorMock mock=new ConnectorMock(); TerminalConnector c = makeTerminalConnector(mock); - ISettingsStore s=new SettingsMock(); + ISettingsStore s=new SettingsStore(); c.save(s); assertNull(mock.fSaveStore); c.connect(new TerminalControlMock()); diff --git a/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java b/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java index 10863867a20..26c68f34ef7 100644 --- a/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java +++ b/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/connector/TerminalConnectorTest.java @@ -15,6 +15,7 @@ package org.eclipse.tm.internal.terminal.connector; import java.io.OutputStream; +import java.util.Map; import junit.framework.TestCase; @@ -24,24 +25,11 @@ import org.eclipse.tm.internal.terminal.connector.TerminalConnector.Factory; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.ITerminalControl; +import org.eclipse.tm.internal.terminal.provisional.api.SettingsStore; import org.eclipse.tm.internal.terminal.provisional.api.TerminalState; import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnectorImpl; public class TerminalConnectorTest extends TestCase { - public class SettingsMock implements ISettingsStore { - - public String get(String key) { - return null; - } - - public String get(String key, String defaultValue) { - return null; - } - - public void put(String key, String value) { - } - - } public static class TerminalControlMock implements ITerminalControl { public void setEncoding(String encoding) { @@ -224,7 +212,7 @@ public class TerminalConnectorTest extends TestCase { public void testLoad() { ConnectorMock mock=new ConnectorMock(); TerminalConnector c=new TerminalConnector(new SimpleFactory(mock),"xID","xName", false); - ISettingsStore s=new SettingsMock(); + ISettingsStore s=new SettingsStore(); c.load(s); // the load is called after the connect... assertNull(mock.fLoadStore); @@ -235,7 +223,7 @@ public class TerminalConnectorTest extends TestCase { public void testSave() { ConnectorMock mock=new ConnectorMock(); TerminalConnector c=new TerminalConnector(new SimpleFactory(mock),"xID","xName", false); - ISettingsStore s=new SettingsMock(); + ISettingsStore s=new SettingsStore(); c.save(s); assertNull(mock.fSaveStore); c.connect(new TerminalControlMock()); diff --git a/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestSettings.java b/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestSettings.java index 84f94226ce0..a8afd136ee7 100644 --- a/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestSettings.java +++ b/plugins/org.eclipse.tm.terminal.test/src/org/eclipse/tm/internal/terminal/speedtest/SpeedTestSettings.java @@ -37,14 +37,14 @@ public class SpeedTestSettings { fInputFile = testFile; } public void load(ISettingsStore store) { - fInputFile=store.get("inputFile"); - fBufferSize=store.get("bufferSize"); - fThrottle=store.get("throttle"); + fInputFile=store.getStringProperty("inputFile"); + fBufferSize=store.getStringProperty("bufferSize"); + fThrottle=store.getStringProperty("throttle"); } public void save(ISettingsStore store) { - store.put("inputFile", fInputFile); - store.put("bufferSize", fBufferSize); - store.put("throttle", fThrottle); + store.setProperty("inputFile", fInputFile); + store.setProperty("bufferSize", fBufferSize); + store.setProperty("throttle", fThrottle); } public String getThrottleString() { return fThrottle; diff --git a/plugins/org.eclipse.tm.terminal/.classpath b/plugins/org.eclipse.tm.terminal/.classpath index 37d5094e3a9..25d360efcad 100644 --- a/plugins/org.eclipse.tm.terminal/.classpath +++ b/plugins/org.eclipse.tm.terminal/.classpath @@ -1,6 +1,6 @@ - + diff --git a/plugins/org.eclipse.tm.terminal/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tm.terminal/.settings/org.eclipse.jdt.core.prefs index d86e9d88ef7..6a5966a2f19 100644 --- a/plugins/org.eclipse.tm.terminal/.settings/org.eclipse.jdt.core.prefs +++ b/plugins/org.eclipse.tm.terminal/.settings/org.eclipse.jdt.core.prefs @@ -7,13 +7,12 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.4 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.autoboxing=warning @@ -24,42 +23,29 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled org.eclipse.jdt.core.compiler.problem.discouragedReference=warning org.eclipse.jdt.core.compiler.problem.emptyStatement=warning -org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled org.eclipse.jdt.core.compiler.problem.fieldHiding=warning org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=error org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning @@ -75,9 +61,9 @@ org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=warning +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=warning +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled @@ -85,30 +71,30 @@ org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled org.eclipse.jdt.core.compiler.problem.unusedImport=warning org.eclipse.jdt.core.compiler.problem.unusedLabel=warning org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=warning org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.4 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/plugins/org.eclipse.tm.terminal/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tm.terminal/.settings/org.eclipse.jdt.ui.prefs new file mode 100644 index 00000000000..88bb9570e83 --- /dev/null +++ b/plugins/org.eclipse.tm.terminal/.settings/org.eclipse.jdt.ui.prefs @@ -0,0 +1,56 @@ +eclipse.preferences.version=1 +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Target Explorer Java STD +formatter_settings_version=12 +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_methods=false +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_missing_override_annotations_interface_methods=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.correct_indentation=false +sp_cleanup.format_source_code=false +sp_cleanup.format_source_code_changes_only=false +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_type_abstract_if_missing_method=false +sp_cleanup.make_variable_declarations_final=false +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=true +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=true +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=true +sp_cleanup.remove_unused_imports=true +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/plugins/org.eclipse.tm.terminal/META-INF/MANIFEST.MF b/plugins/org.eclipse.tm.terminal/META-INF/MANIFEST.MF index b7973c8d0c4..5a60876bd84 100644 --- a/plugins/org.eclipse.tm.terminal/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.tm.terminal/META-INF/MANIFEST.MF @@ -10,7 +10,7 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui Bundle-ActivationPolicy: lazy Eclipse-LazyStart: true -Bundle-RequiredExecutionEnvironment: J2SE-1.4 +Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ClassPath: . Export-Package: org.eclipse.tm.internal.terminal.connector;x-friends:="org.eclipse.tm.terminal.test", org.eclipse.tm.internal.terminal.control;x-friends:="org.eclipse.tm.terminal.view", diff --git a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/AbstractSettingsPage.java b/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/AbstractSettingsPage.java index 40353718f18..b64c6c0d694 100644 --- a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/AbstractSettingsPage.java +++ b/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/AbstractSettingsPage.java @@ -37,6 +37,7 @@ public abstract class AbstractSettingsPage implements ISettingsPage, IMessagePro /* (non-Javadoc) * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage#addListener(org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage.Listener) */ + @Override public void addListener(Listener listener) { Assert.isNotNull(listener); listeners.add(listener); @@ -45,6 +46,7 @@ public abstract class AbstractSettingsPage implements ISettingsPage, IMessagePro /* (non-Javadoc) * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage#removeListener(org.eclipse.tm.internal.terminal.provisional.api.ISettingsPage.Listener) */ + @Override public void removeListener(Listener listener) { Assert.isNotNull(listener); listeners.remove(listener); @@ -67,6 +69,7 @@ public abstract class AbstractSettingsPage implements ISettingsPage, IMessagePro /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IMessageProvider#getMessage() */ + @Override public final String getMessage() { return message; } @@ -74,6 +77,7 @@ public abstract class AbstractSettingsPage implements ISettingsPage, IMessagePro /* (non-Javadoc) * @see org.eclipse.jface.dialogs.IMessageProvider#getMessageType() */ + @Override public final int getMessageType() { return messageType; } diff --git a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/ISettingsStore.java b/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/ISettingsStore.java index 8822af3df71..d7fef966dbd 100644 --- a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/ISettingsStore.java +++ b/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/ISettingsStore.java @@ -8,13 +8,20 @@ * Contributors: * Michael Scharf (Wind River) - initial API and implementation * Martin Oberhuber (Wind River) - fixed copyright headers and beautified + * Uwe Stieber (Wind River) - Extend API to allow storage of non-string settings *******************************************************************************/ package org.eclipse.tm.internal.terminal.provisional.api; +import java.util.Map; + +import org.eclipse.core.runtime.IAdaptable; + /** - * A simple interface to a store to persist the state of a connection. - * - * @author Michael Scharf + * The settings store contains the state of a connection. The content of the + * settings store is not the persisted state of the connection. Storing data + * in the settings store does not make any assumption about possibly persisting + * the connection state. Connection persistence has to be implemented by the UI + * container embedding the Terminal control. *

* EXPERIMENTAL. This class or interface has been added as * part of a work in progress. There is no guarantee that this API will @@ -22,24 +29,216 @@ package org.eclipse.tm.internal.terminal.provisional.api; * consulting with the Target Management team. *

*/ -public interface ISettingsStore { +public interface ISettingsStore extends IAdaptable { + /** - * @param key alpha numeric key, may contain dots (.) - * @return value + * Set the properties from the given map. Calling this method + * will overwrite all previous set properties. + *

+ * Note: The method will have no effect if the given properties are the + * same as the already set properties. + * + * @param properties The map of properties to set. Must not be null. */ - String get(String key); + public void setProperties(Map properties); /** - * @param key alpha numeric key, may contain dots (.) - * @param defaultValue - * @return the value or the default + * Adds all properties from the given map. If a property already exist + * in the properties container, than the value of the property is overwritten. + * + * @param properties The map of properties to add. Must not be null. */ - String get(String key, String defaultValue); + public void addProperties(Map properties); /** - * Save a string value - * @param key alpha numeric key, may contain dots (.) - * @param value + * 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. + * + * + * @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. */ - void put(String key, String value); + public boolean setProperty(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). + * + * @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. + * + * @see setProperty(java.lang.String, java.lang.Object) + */ + public boolean setProperty(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). + * + * @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. + * + * @see setProperty(java.lang.String, java.lang.Object) + */ + public boolean setProperty(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). + * + * @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. + * + * @see setProperty(java.lang.String, java.lang.Object) + */ + public boolean setProperty(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). + * + * @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. + * + * @see setProperty(java.lang.String, java.lang.Object) + */ + public boolean setProperty(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). + * + * @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. + * + * @see setProperty(java.lang.String, java.lang.Object) + */ + public boolean setProperty(String key, double value); + + /** + * Return all properties. The result map is read-only. + * + * @return A map containing all properties. + */ + public Map getProperties(); + + /** + * Queries the property value stored under the given property key. If the property + * does not exist, null is returned. + * + * @param key The property key. Must not be null! + * @return The stored property value or null. + */ + public Object getProperty(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. + * + * @param key The property key. Must not be null! + * @return The stored property value casted java.lang.String or null. + */ + public String getStringProperty(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. + * + * @param key The property key. Must not be null! + * @param defaultValue The default value or null. + * + * @return The stored property value casted java.lang.String or null. + */ + public String getStringProperty(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. + * + * @param key The property key. Must not be null! + * @return The stored property value converted to a long value or -1. + */ + public long getLongProperty(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. + * + * @param key The property key. Must not be null! + * @return The stored property value converted to an integer value or -1. + */ + public int getIntProperty(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. + * + * @param key The property key. Must not be null! + * @return The stored property value converted to an boolean value or false. + */ + public boolean getBooleanProperty(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. + * + * @param key The property key. Must not be null! + * @return The stored property value converted to a float value or Float.NaN. + */ + public float getFloatProperty(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. + * + * @param key The property key. Must not be null! + * @return The stored property value converted to a double value or Double.NaN. + */ + public double getDoubleProperty(String key); + + /** + * Remove all properties from the properties store. The method does not fire any + * properties changed event. + */ + public void clearProperties(); + + /** + * Returns whether this properties container is empty or not. + * + * @return True if the properties container is empty, false if not. + */ + public boolean isEmpty(); + + /** + * Returns whether this properties container contains the given key. + * + * @param key The key. Must not be null. + * @return True if the properties container contains the key, false if not. + */ + public boolean containsKey(String key); } diff --git a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java b/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java index fa6fee91f87..e703482bb90 100644 --- a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java +++ b/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/Logger.java @@ -13,11 +13,12 @@ *******************************************************************************/ package org.eclipse.tm.internal.terminal.provisional.api; -import java.io.File; import java.io.FileOutputStream; import java.io.PrintStream; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; import org.eclipse.tm.internal.terminal.control.impl.TerminalPlugin; @@ -50,24 +51,14 @@ public final class Logger { private static PrintStream logStream; static { - String logFile = null; - //TODO I think this should go into the workspace metadata instead. - File logDirWindows = new File("C:\\eclipselogs"); //$NON-NLS-1$ - File logDirUNIX = new File("/tmp/eclipselogs"); //$NON-NLS-1$ - - if (logDirWindows.isDirectory()) { - logFile = logDirWindows + "\\tmterminal.log"; //$NON-NLS-1$ - } else if (logDirUNIX.isDirectory()) { - logFile = logDirUNIX + "/tmterminal.log"; //$NON-NLS-1$ - } - - if (logFile != null) { + IPath logFile = Platform.getStateLocation(TerminalPlugin.getDefault().getBundle()); + if (logFile != null && logFile.toFile().isDirectory()) { + logFile = logFile.append("tmterminal.log"); //$NON-NLS-1$ try { - logStream = new PrintStream(new FileOutputStream(logFile, true)); + logStream = new PrintStream(new FileOutputStream(logFile.toFile(), true)); } catch (Exception ex) { logStream = System.err; - logStream - .println("Exception when opening log file -- logging to stderr!"); //$NON-NLS-1$ + logStream.println("Exception when opening log file -- logging to stderr!"); //$NON-NLS-1$ ex.printStackTrace(logStream); } } diff --git a/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/SettingsStore.java b/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/SettingsStore.java new file mode 100644 index 00000000000..002e2d8fd38 --- /dev/null +++ b/plugins/org.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/provisional/api/SettingsStore.java @@ -0,0 +1,360 @@ +/******************************************************************************* + * Copyright (c) 2015 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.tm.internal.terminal.provisional.api; + +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.PlatformObject; + +/** + * Terminal connection settings store implementation. + */ +public class SettingsStore extends PlatformObject implements ISettingsStore { + /** + * A map of settings. The keys are always strings, the value might be any object. + */ + private Map settings = new HashMap(); + + /** + * Constructor. + */ + public SettingsStore() { + super(); + } + + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + boolean equals = super.equals(obj); + if (!equals && obj instanceof SettingsStore) { + return settings.equals(((SettingsStore)obj).settings); + } + return equals; + } + + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + return settings.hashCode(); + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + final StringBuilder buffer = new StringBuilder(); + + // print the first level of the properties map only + buffer.append("settings={"); //$NON-NLS-1$ + for (String key : settings.keySet()) { + buffer.append(key); + buffer.append("="); //$NON-NLS-1$ + + Object value = settings.get(key); + if (value instanceof Map || value instanceof ISettingsStore) { + buffer.append("{...}"); //$NON-NLS-1$ + } else { + buffer.append(value); + } + + buffer.append(", "); //$NON-NLS-1$ + } + if (buffer.toString().endsWith(", ")) { //$NON-NLS-1$ + buffer.deleteCharAt(buffer.length() - 1); + buffer.deleteCharAt(buffer.length() - 1); + } + buffer.append("}"); //$NON-NLS-1$ + + return buffer.toString(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getProperties() + */ + @Override + public Map getProperties() { + return Collections.unmodifiableMap(new HashMap(settings)); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getProperty(java.lang.String) + */ + @Override + public Object getProperty(String key) { + return settings.get(key); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getBooleanProperty(java.lang.String) + */ + @Override + public final boolean getBooleanProperty(String key) { + Object value = getProperty(key); + if (value instanceof Boolean) { + return ((Boolean)value).booleanValue(); + } + if (value instanceof String) { + String val = ((String)value).trim(); + return "TRUE".equalsIgnoreCase(val) || "1".equals(val) || "Y".equalsIgnoreCase(val) || //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "JA".equalsIgnoreCase(val) || "YES".equalsIgnoreCase(val); //$NON-NLS-1$ //$NON-NLS-2$ + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getLongProperty(java.lang.String) + */ + @Override + public final long getLongProperty(String key) { + Object value = getProperty(key); + try { + if (value instanceof Long) { + return ((Long)value).longValue(); + } + if (value instanceof Number) { + return ((Number)value).longValue(); + } + if (value != null) { + return Long.decode(value.toString()).longValue(); + } + } catch (Exception e) { + /* ignored on purpose */ + } + + return -1; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getIntProperty(java.lang.String) + */ + @Override + public final int getIntProperty(String key) { + Object value = getProperty(key); + try { + if (value instanceof Integer) { + return ((Integer)value).intValue(); + } + if (value instanceof Number) { + return ((Number)value).intValue(); + } + if (value != null) { + return Integer.decode(value.toString()).intValue(); + } + } catch (Exception e) { + /* ignored on purpose */ + } + + return -1; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getStringProperty(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); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getStringProperty(java.lang.String, java.lang.String) + */ + @Override + public String getStringProperty(String key, String defaultValue) { + String value = getStringProperty(key); + return value != null ? value : defaultValue; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getFloatProperty(java.lang.String) + */ + @Override + public final float getFloatProperty(String key) { + Object value = getProperty(key); + try { + if (value instanceof Float) { + return ((Float)value).floatValue(); + } + if (value instanceof Number) { + return ((Number)value).floatValue(); + } + if (value != null) { + return Float.parseFloat(value.toString()); + } + } catch (Exception e) { + /* ignored on purpose */ + } + + return Float.NaN; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#getDoubleProperty(java.lang.String) + */ + @Override + public final double getDoubleProperty(String key) { + Object value = getProperty(key); + try { + if (value instanceof Double) { + return ((Double)value).doubleValue(); + } + if (value instanceof Number) { + return ((Number)value).doubleValue(); + } + if (value != null) { + return Double.parseDouble(value.toString()); + } + } catch (Exception e) { + /* ignored on purpose */ + } + + return Double.NaN; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperties(java.util.Map) + */ + @Override + public final void setProperties(Map properties) { + Assert.isNotNull(properties); + + // Change the properties only if they have changed really + if (this.settings.equals(properties)) { + return; + } + + // Clear out all old properties + this.settings.clear(); + // Apply everything from the given properties + this.settings.putAll(properties); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#addProperties(java.util.Map) + */ + @Override + public final void addProperties(Map properties) { + // Apply everything from the given properties + this.settings.putAll(properties); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, boolean) + */ + @Override + public final boolean setProperty(String key, boolean value) { + boolean oldValue = getBooleanProperty(key); + if (oldValue != value) { + return setProperty(key, Boolean.valueOf(value)); + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, long) + */ + @Override + public final boolean setProperty(String key, long value) { + long oldValue = getLongProperty(key); + if (oldValue != value) { + return setProperty(key, Long.valueOf(value)); + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, int) + */ + @Override + public final boolean setProperty(String key, int value) { + int oldValue = getIntProperty(key); + if (oldValue != value) { + return setProperty(key, Integer.valueOf(value)); + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, float) + */ + @Override + public final boolean setProperty(String key, float value) { + float oldValue = getFloatProperty(key); + if (oldValue != value) { + return setProperty(key, Float.valueOf(value)); + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, double) + */ + @Override + public final boolean setProperty(String key, double value) { + double oldValue = getDoubleProperty(key); + if (oldValue != value) { + return setProperty(key, Double.valueOf(value)); + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#setProperty(java.lang.String, java.lang.Object) + */ + @Override + public boolean setProperty(String key, Object value) { + Assert.isNotNull(key); + + Object oldValue = settings.get(key); + if ((oldValue == null && value != null) || (oldValue != null && !oldValue.equals(value))) { + if (value != null) { + settings.put(key, value); + } else { + settings.remove(key); + } + return true; + } + return false; + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#clearProperties() + */ + @Override + public final void clearProperties() { + settings.clear(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#isEmpty() + */ + @Override + public boolean isEmpty() { + return settings.isEmpty(); + } + + /* (non-Javadoc) + * @see org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore#containsKey(java.lang.String) + */ + @Override + public boolean containsKey(String key) { + Assert.isNotNull(key); + return settings.containsKey(key); + } +}