mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 09:55:29 +02:00
Terminal: Make terminal settings store more flexible to allow to store
non-string objects too
This commit is contained in:
parent
13be2bd4d0
commit
9c55da9030
44 changed files with 824 additions and 277 deletions
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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<String, String> processAttributes = new HashMap<String, String>();
|
||||
String programName = location.lastSegment();
|
||||
String extension = location.getFileExtension();
|
||||
if (extension != null) {
|
||||
|
|
|
@ -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<String, String> 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<String, String>(TERM_ANSI));
|
||||
workingCopy.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
|
||||
workingCopy.setAttribute(ATTR_LOCATION, defaultShell);
|
||||
workingCopy.setAttribute(ATTR_WORKING_DIRECTORY, userHome);
|
||||
|
|
|
@ -81,7 +81,7 @@ public class LocalTerminalStillRunningListener implements IWorkbenchListener {
|
|||
|
||||
return true;
|
||||
}
|
||||
List notTerminated = new ArrayList();
|
||||
List<ILaunch> notTerminated = new ArrayList<ILaunch>();
|
||||
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;
|
||||
|
|
|
@ -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<String, String> 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<String, String> setProcessType(Map<String, String> 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<String, String>(1);
|
||||
}
|
||||
attributes.put(IProcess.ATTR_PROCESS_TYPE, PROCESS_TYPE);
|
||||
return attributes;
|
||||
|
|
|
@ -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<String, String> attributes) {
|
||||
|
||||
return new LocalTerminalProcess(launch, process, label, attributes);
|
||||
}
|
||||
|
|
|
@ -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<ILaunch, LocalTerminalProcess> 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<ILaunch, LocalTerminalProcess>();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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 <a href="http://www.eclipse.org/tm/">Target Management</a> team.
|
||||
* </p>
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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 <a href="http://www.eclipse.org/tm/">Target Management</a> team.
|
||||
* </p>
|
||||
*/
|
||||
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
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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$
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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<size;i++) {
|
||||
// the name under which we stored the connection
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4">
|
||||
<accessrules>
|
||||
<accessrule kind="accessible" pattern="gnu/io/**"/>
|
||||
</accessrules>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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$
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
* <p>
|
||||
* <strong>EXPERIMENTAL</strong>. 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 <a href="http://www.eclipse.org/tm/">Target Management</a> team.
|
||||
* </p>
|
||||
*/
|
||||
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.
|
||||
* <p>
|
||||
* <b>Note:</b> 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 <code>null</code>.
|
||||
*/
|
||||
String get(String key);
|
||||
public void setProperties(Map<String, Object> 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 <code>null</code>.
|
||||
*/
|
||||
String get(String key, String defaultValue);
|
||||
public void addProperties(Map<String, ?> 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 <code>null</code> 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 <code>null</code>, the property key and the currently stored value are removed
|
||||
* from the property store.
|
||||
*
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @param value The property value.
|
||||
* @return <code>true</code> if the property value had been applied to the property store, <code>false</code> 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 <code>Long</code>
|
||||
* object and stored to the properties store via <code>setProperty(java.lang.String, java.lang.Object)</code>.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @param value The property value.
|
||||
* @return <code>true</code> if the property value had been applied to the property store, <code>false</code> otherwise.
|
||||
*
|
||||
* @see <code>setProperty(java.lang.String, java.lang.Object)</code>
|
||||
*/
|
||||
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 <code>Integer</code>
|
||||
* object and stored to the properties store via <code>setProperty(java.lang.String, java.lang.Object)</code>.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @param value The property value.
|
||||
* @return <code>true</code> if the property value had been applied to the property store, <code>false</code> otherwise.
|
||||
*
|
||||
* @see <code>setProperty(java.lang.String, java.lang.Object)</code>
|
||||
*/
|
||||
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 <code>Boolean</code>
|
||||
* object and stored to the properties store via <code>setProperty(java.lang.String, java.lang.Object)</code>.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @param value The property value.
|
||||
* @return <code>true</code> if the property value had been applied to the property store, <code>false</code> otherwise.
|
||||
*
|
||||
* @see <code>setProperty(java.lang.String, java.lang.Object)</code>
|
||||
*/
|
||||
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 <code>Float</code>
|
||||
* object and stored to the properties store via <code>setProperty(java.lang.String, java.lang.Object)</code>.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @param value The property value.
|
||||
* @return <code>true</code> if the property value had been applied to the property store, <code>false</code> otherwise.
|
||||
*
|
||||
* @see <code>setProperty(java.lang.String, java.lang.Object)</code>
|
||||
*/
|
||||
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 <code>Double</code>
|
||||
* object and stored to the properties store via <code>setProperty(java.lang.String, java.lang.Object)</code>.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @param value The property value.
|
||||
* @return <code>true</code> if the property value had been applied to the property store, <code>false</code> otherwise.
|
||||
*
|
||||
* @see <code>setProperty(java.lang.String, java.lang.Object)</code>
|
||||
*/
|
||||
public boolean setProperty(String key, double value);
|
||||
|
||||
/**
|
||||
* Return all properties. The result map is read-only.
|
||||
*
|
||||
* @return A map containing all properties.
|
||||
*/
|
||||
public Map<String, Object> getProperties();
|
||||
|
||||
/**
|
||||
* Queries the property value stored under the given property key. If the property
|
||||
* does not exist, <code>null</code> is returned.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @return The stored property value or <code>null</code>.
|
||||
*/
|
||||
public Object getProperty(String key);
|
||||
|
||||
/**
|
||||
* Queries the property value stored under the given property key. If the property
|
||||
* exist and is of type <code>java.lang.String</code>, the property value casted to
|
||||
* <code>java.lang.String</code> is returned. In all other cases, <code>null</code>
|
||||
* is returned.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @return The stored property value casted <code>java.lang.String</code> or <code>null</code>.
|
||||
*/
|
||||
public String getStringProperty(String key);
|
||||
|
||||
/**
|
||||
* Queries the property value stored under the given property key. If the property
|
||||
* exist and is of type <code>java.lang.String</code>, the property value casted to
|
||||
* <code>java.lang.String</code> is returned. In all other cases, the given default
|
||||
* value is returned.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @param defaultValue The default value or <code>null</code>.
|
||||
*
|
||||
* @return The stored property value casted <code>java.lang.String</code> or <code>null</code>.
|
||||
*/
|
||||
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 <code>java.lang.Long</code>, the property value converted
|
||||
* to an long value is returned. In all other cases, <code>-1</code> is returned.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @return The stored property value converted to a long value or <code>-1</code>.
|
||||
*/
|
||||
public long getLongProperty(String key);
|
||||
|
||||
/**
|
||||
* Queries the property value stored under the given property key. If the property
|
||||
* exist and is of type <code>java.lang.Integer</code>, the property value converted
|
||||
* to an integer value is returned. In all other cases, <code>-1</code> is returned.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @return The stored property value converted to an integer value or <code>-1</code>.
|
||||
*/
|
||||
public int getIntProperty(String key);
|
||||
|
||||
/**
|
||||
* Queries the property value stored under the given property key. If the property
|
||||
* exist and is of type <code>java.lang.Boolean</code>, the property value converted
|
||||
* to an boolean value is returned. In all other cases, <code>false</code> is returned.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @return The stored property value converted to an boolean value or <code>false</code>.
|
||||
*/
|
||||
public boolean getBooleanProperty(String key);
|
||||
|
||||
/**
|
||||
* Queries the property value stored under the given property key. If the property
|
||||
* exist and is of type <code>java.lang.Float</code>, the property value converted
|
||||
* to an float value is returned. In all other cases, <code>Float.NaN</code> is returned.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @return The stored property value converted to a float value or <code>Float.NaN</code>.
|
||||
*/
|
||||
public float getFloatProperty(String key);
|
||||
|
||||
/**
|
||||
* Queries the property value stored under the given property key. If the property
|
||||
* exist and is of type <code>java.lang.Double</code>, the property value converted
|
||||
* to an double value is returned. In all other cases, <code>Double.NaN</code> is returned.
|
||||
*
|
||||
* @param key The property key. Must not be <code>null</code>!
|
||||
* @return The stored property value converted to a double value or <code>Double.NaN</code>.
|
||||
*/
|
||||
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 <code>True</code> if the properties container is empty, <code>false</code> if not.
|
||||
*/
|
||||
public boolean isEmpty();
|
||||
|
||||
/**
|
||||
* Returns whether this properties container contains the given key.
|
||||
*
|
||||
* @param key The key. Must not be <code>null</code>.
|
||||
* @return <code>True</code> if the properties container contains the key, <code>false</code> if not.
|
||||
*/
|
||||
public boolean containsKey(String key);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<String, Object> settings = new HashMap<String, Object>();
|
||||
|
||||
/**
|
||||
* 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<String, Object> getProperties() {
|
||||
return Collections.unmodifiableMap(new HashMap<String, Object>(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<String, Object> 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<String, ?> 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);
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue