diff options
author | Max Weninger | 2013-08-28 12:49:43 +0000 |
---|---|---|
committer | Uwe Stieber | 2013-08-28 12:49:43 +0000 |
commit | 033178d784e4d977824a536c64df162b4a446998 (patch) | |
tree | 016165942bd8d174250f265e8fad35ad03a34864 | |
parent | b2d57045e3b627fa2a8d20fe794992ea3ba481bd (diff) | |
download | org.eclipse.tcf-033178d784e4d977824a536c64df162b4a446998.tar.gz org.eclipse.tcf-033178d784e4d977824a536c64df162b4a446998.tar.xz org.eclipse.tcf-033178d784e4d977824a536c64df162b4a446998.zip |
Target Explorer: Unify code of process and local terminal connector implementations
Signed-off-by: Max Weninger <max.weninger@windriver.com>
5 files changed, 7 insertions, 742 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF index 298d17244..fcefc9de8 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/META-INF/MANIFEST.MF @@ -17,12 +17,12 @@ Require-Bundle: org.eclipse.cdt.core;bundle-version="5.4.1", org.eclipse.tcf.te.ui.controls;bundle-version="1.2.0", org.eclipse.core.expressions;bundle-version="3.4.400", org.eclipse.tcf.te.ui;bundle-version="1.2.0", - org.eclipse.ui.forms;bundle-version="3.5.200" + org.eclipse.ui.forms;bundle-version="3.5.200", + org.eclipse.tcf.te.ui.terminals.process;bundle-version="1.2.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin -Export-Package: org.eclipse.tcf.te.ui.terminals.local, - org.eclipse.tcf.te.ui.terminals.local.activator;x-internal:=true, +Export-Package: org.eclipse.tcf.te.ui.terminals.local.activator;x-internal:=true, org.eclipse.tcf.te.ui.terminals.local.controls, org.eclipse.tcf.te.ui.terminals.local.launcher, org.eclipse.tcf.te.ui.terminals.local.nls;x-internal:=true, diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml index a4ea63f36..9ffa55a2d 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/plugin.xml @@ -3,9 +3,10 @@ <plugin> <!-- Terminal connector contributions --> +<!-- uses process connector --> <extension point="org.eclipse.tm.terminal.terminalConnectors"> <connector - class="org.eclipse.tcf.te.ui.terminals.local.LocalConnector" + class="org.eclipse.tcf.te.ui.terminals.process.ProcessConnector" id="org.eclipse.tcf.te.ui.terminals.local.LocalConnector" name="%TerminalConnector.local"/> </extension> diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/LocalConnector.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/LocalConnector.java deleted file mode 100644 index ed2314ba6..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/LocalConnector.java +++ /dev/null @@ -1,463 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 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.tcf.te.ui.terminals.local; - -import java.io.BufferedInputStream; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.StreamTokenizer; -import java.io.StringReader; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.eclipse.cdt.utils.pty.PTY; -import org.eclipse.cdt.utils.spawner.ProcessFactory; -import org.eclipse.core.runtime.Assert; -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.osgi.service.environment.Constants; -import org.eclipse.osgi.util.NLS; -import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorConstants; -import org.eclipse.tcf.te.ui.terminals.local.activator.UIPlugin; -import org.eclipse.tcf.te.ui.terminals.local.nls.Messages; -import org.eclipse.tcf.te.ui.terminals.streams.AbstractStreamsConnector; -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.TerminalState; - -/** - * Process connector implementation. - */ -@SuppressWarnings("restriction") -public class LocalConnector extends AbstractStreamsConnector { - // Reference to the process settings - private final LocalSettings settings; - - // Reference to the PTY instance. - private PTY pty; - // Reference to the launched process instance. - private Process process; - - // The terminal width and height. Initially unknown. - private int width = -1; - private int height = -1; - - /** - * Constructor. - */ - public LocalConnector() { - this(new LocalSettings()); - } - - /** - * Constructor. - * - * @param settings The process settings. Must not be <code>null</code> - */ - public LocalConnector(LocalSettings settings) { - super(); - - Assert.isNotNull(settings); - this.settings = settings; - } - - /** - * Returns the process object or <code>null</code> if the - * connector is connector. - * - * @return The process object or <code>null</code>. - */ - public Process getProcess() { - return process; - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#connect(org.eclipse.tcf.internal.terminal.provisional.api.ITerminalControl) - */ - @Override - public void connect(ITerminalControl control) { - Assert.isNotNull(control); - super.connect(control); - - pty = null; - width = -1; - height = -1; - - try { - // Try to determine process and PTY instance from the process settings - process = settings.getProcess(); - pty = settings.getPTY(); - - // No process -> create PTY on supported platforms and execute - // process image. - if (process == null) { - if (PTY.isSupported()) { - try { - pty = new PTY(false); - } catch (IOException e) { - // PTY not supported on windows - } - } - - // Build up the command - StringBuilder command = new StringBuilder(settings.getImage()); - String arguments = settings.getArguments(); - if (arguments != null && !"".equals(arguments.trim())) { //$NON-NLS-1$ - // Append to the command now - command.append(" "); //$NON-NLS-1$ - command.append(arguments.trim()); - } - - File workingDir =null; - if (settings.getWorkingDir()!=null){ - workingDir = new File(settings.getWorkingDir()); - } - - String[] envp = null; - if (settings.getEnvironment()!=null){ - envp = settings.getEnvironment(); - } - - if (pty != null) { - // A PTY is available -> can use the ProcessFactory. - - // Tokenize the command (ProcessFactory takes an array) - StreamTokenizer st = new StreamTokenizer(new StringReader(command.toString())); - st.resetSyntax(); - st.whitespaceChars(0, 32); - st.whitespaceChars(0xa0, 0xa0); - st.wordChars(33, 255); - st.quoteChar('"'); - st.quoteChar('\''); - - List<String> argv = new ArrayList<String>(); - int ttype = st.nextToken(); - while (ttype != StreamTokenizer.TT_EOF) { - argv.add(st.sval); - ttype = st.nextToken(); - } - - // Execute the process - process = ProcessFactory.getFactory().exec(argv.toArray(new String[argv.size()]), getProcessEnvironment(envp), workingDir, pty); - } else { - // No PTY -> just execute via the standard Java Runtime implementation. - process = Runtime.getRuntime().exec(command.toString(), envp, workingDir); - } - } - - String lineSeparator = settings.getLineSeparator(); - if (lineSeparator == null) { - lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$ - if ("\r".equals(lineSeparator)) { //$NON-NLS-1$ - lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_CR; - } - else if ("\n".equals(lineSeparator)) { //$NON-NLS-1$ - lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_LF; - } - else { - lineSeparator = ILineSeparatorConstants.LINE_SEPARATOR_CRLF; - } - } - - // Setup the listeners - setStdoutListeners(settings.getStdOutListeners()); - setStderrListeners(settings.getStdErrListeners()); - - // connect the streams - connectStreams(control, process.getOutputStream(), process.getInputStream(), (pty == null ? process.getErrorStream() : null), settings.isLocalEcho(), lineSeparator); - - // Set the terminal control state to CONNECTED - control.setState(TerminalState.CONNECTED); - - } catch (IOException e) { - IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(), - NLS.bind(Messages.ProcessConnector_error_creatingProcess, e.getLocalizedMessage()), e); - UIPlugin.getDefault().getLog().log(status); - } - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#isLocalEcho() - */ - @Override - public boolean isLocalEcho() { - return settings.isLocalEcho(); - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#doDisconnect() - */ - @Override - public void doDisconnect() { - // Dispose the process - if (process != null) { process.destroy(); process = null; } - - // Dispose the streams - super.doDisconnect(); - - // Set the terminal control state to CLOSED. - fControl.setState(TerminalState.CLOSED); - } - - // ***** Process Connector settings handling ***** - - - /* (non-Javadoc) - * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#getSettingsSummary() - */ - @Override - public String getSettingsSummary() { - return settings.getImage() != null ? settings.getImage() : ""; //$NON-NLS-1$ - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#load(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore) - */ - @Override - public void load(ISettingsStore store) { - settings.load(store); - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#save(org.eclipse.tcf.internal.terminal.provisional.api.ISettingsStore) - */ - @Override - public void save(ISettingsStore store) { - settings.save(store); - } - - /* (non-Javadoc) - * @see org.eclipse.tcf.internal.terminal.provisional.api.provider.TerminalConnectorImpl#setTerminalSize(int, int) - */ - @Override - public void setTerminalSize(int newWidth, int newHeight) { - if (width != newWidth || height != newHeight) { - width = newWidth; - height = newHeight; - if (pty != null) { - pty.setTerminalSize(newWidth, newHeight); - } - } - } - - // ***** Process Environment Handling ***** - - // Reference to the monitor to lock if determining the native environment - private final static Object ENV_GET_MONITOR = new Object(); - - // Reference to the native environment once retrieved - private static Map<String, String> nativeEnvironment = null; - // Reference to the native environment with the case of the variable names preserved - private static Map<String, String> nativeEnvironmentCasePreserved = null; - - /** - * Returns the specific environment to set for the process to be launched. - * - * @return The process environment. - */ - private static String[] getProcessEnvironment(String[] envp) { - Map<String, String> env = getNativeEnvironment(); - - env.put("TERM", "ansi"); //$NON-NLS-1$ //$NON-NLS-2$ - - Iterator<Map.Entry<String, String>> iter = env.entrySet().iterator(); - List<String> strings = new ArrayList<String>(env.size()); - StringBuffer buffer = null; - while (iter.hasNext()) { - Map.Entry<String, String>entry = iter.next(); - buffer = new StringBuffer(entry.getKey()); - buffer.append('=').append(entry.getValue()); - strings.add(buffer.toString()); - } - - // if "local" environment is provided - append - if (envp!=null){ - // add provided - for (int i=0; i<envp.length; i++){ - String envpPart = envp[i]; - // dont override TERM - String[] parts=envpPart.split("=");//$NON-NLS-1$ - if (!parts[0].trim().equals("TERM")){//$NON-NLS-1$ - strings.add(envpPart); - } - } - } - - return strings.toArray(new String[strings.size()]); - } - - /** - * Determine the native environment, but returns all environment variable - * names in upper case. - * - * @return The native environment with upper case variable names, or an empty map. - */ - private static Map<String, String> getNativeEnvironment() { - synchronized (ENV_GET_MONITOR) { - if (nativeEnvironment == null) { - Map<String, String> casePreserved = getNativeEnvironmentCasePreserved(); - if (Platform.getOS().equals(org.eclipse.osgi.service.environment.Constants.OS_WIN32)) { - nativeEnvironment = new HashMap<String, String>(); - Iterator<Map.Entry<String, String>> entries = casePreserved.entrySet().iterator(); - while (entries.hasNext()) { - Map.Entry<String, String> entry = entries.next(); - nativeEnvironment.put(entry.getKey().toUpperCase(), entry.getValue()); - } - } else { - nativeEnvironment = new HashMap<String, String>(casePreserved); - } - } - return new HashMap<String, String>(nativeEnvironment); - } - } - - /** - * Determine the native environment. - * - * @return The native environment, or an empty map. - */ - private static Map<String, String> getNativeEnvironmentCasePreserved() { - synchronized (ENV_GET_MONITOR) { - if (nativeEnvironmentCasePreserved == null) { - nativeEnvironmentCasePreserved= new HashMap<String, String>(); - cacheNativeEnvironment(nativeEnvironmentCasePreserved); - } - return new HashMap<String, String>(nativeEnvironmentCasePreserved); - } - } - - /** - * Query the native environment and store it to the specified cache. - * - * @param cache The environment cache. Must not be <code>null</code>. - */ - private static void cacheNativeEnvironment(Map<String, String> cache) { - Assert.isNotNull(cache); - - try { - String nativeCommand = null; - boolean isWin9xME = false; // see bug 50567 - String fileName = null; - if (Platform.getOS().equals(Constants.OS_WIN32)) { - String osName = System.getProperty("os.name"); //$NON-NLS-1$ - isWin9xME = osName != null && (osName.startsWith("Windows 9") || osName.startsWith("Windows ME")); //$NON-NLS-1$ //$NON-NLS-2$ - if (isWin9xME) { - // Win 95, 98, and ME - // SET might not return therefore we pipe into a file - IPath stateLocation = UIPlugin.getDefault().getStateLocation(); - fileName = stateLocation.toOSString() + File.separator + "env.txt"; //$NON-NLS-1$ - nativeCommand = "command.com /C set > " + fileName; //$NON-NLS-1$ - } else { - // Win NT, 2K, XP - nativeCommand = "cmd.exe /C set"; //$NON-NLS-1$ - } - } else if (!Platform.getOS().equals(Constants.OS_UNKNOWN)) { - nativeCommand = "env"; //$NON-NLS-1$ - } - if (nativeCommand == null) { return; } - Process process = Runtime.getRuntime().exec(nativeCommand); - if (isWin9xME) { - // read piped data on Win 95, 98, and ME - Properties p = new Properties(); - File file = new File(fileName); - InputStream stream = null; - try { - stream = new BufferedInputStream(new FileInputStream(file)); - p.load(stream); - } finally { - if (stream != null) stream.close(); - } - if (!file.delete()) { - file.deleteOnExit(); // if delete() fails try again on VM close - } - for (Enumeration<Object> enumeration = p.keys(); enumeration.hasMoreElements();) { - // Win32's environment variables are case insensitive. Put everything - // to upper case so that (for example) the "PATH" variable will match - // "pAtH" correctly on Windows. - String key = (String)enumeration.nextElement(); - cache.put(key, (String)p.get(key)); - } - } else { - // read process directly on other platforms - // we need to parse out matching '{' and '}' for function declarations in .bash environments - // pattern is [function name]=() { and we must find the '}' on its own line with no trailing ';' - InputStream stream = process.getInputStream(); - InputStreamReader isreader = new InputStreamReader(stream); - BufferedReader reader = new BufferedReader(isreader); - try { - String line = reader.readLine(); - String key = null; - String value = null; - while (line != null) { - int func = line.indexOf("=()"); //$NON-NLS-1$ - if (func > 0) { - key = line.substring(0, func); - // scan until we find the closing '}' with no following chars - value = line.substring(func + 1); - while (line != null && !line.equals("}")) { //$NON-NLS-1$ - line = reader.readLine(); - if (line != null) { - value += line; - } - } - line = reader.readLine(); - } else { - int separator = line.indexOf('='); - if (separator > 0) { - key = line.substring(0, separator); - value = line.substring(separator + 1); - StringBuilder bufValue = new StringBuilder(value); - line = reader.readLine(); - if (line != null) { - // this line has a '=' read ahead to check next line for '=', might be broken on more - // than one line - separator = line.indexOf('='); - while (separator < 0) { - bufValue.append(line.trim()); - line = reader.readLine(); - if (line == null) { - // if next line read is the end of the file quit the loop - break; - } - separator = line.indexOf('='); - } - } - value = bufValue.toString(); - } - } - if (key != null) { - cache.put(key, value); - key = null; - value = null; - } else { - line = reader.readLine(); - } - } - } finally { - reader.close(); - } - } - } catch (IOException e) { - // Native environment-fetching code failed. - // This can easily happen and is not useful to log. - } - } -} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/LocalSettings.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/LocalSettings.java deleted file mode 100644 index b7a2c8ac8..000000000 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/LocalSettings.java +++ /dev/null @@ -1,273 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011, 2012 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.tcf.te.ui.terminals.local; - -import org.eclipse.cdt.utils.pty.PTY; -import org.eclipse.core.runtime.Assert; -import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer; -import org.eclipse.tcf.te.ui.terminals.streams.OutputStreamMonitor; -import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; - -/** - * Process connector settings implementation. - */ -@SuppressWarnings("restriction") -public class LocalSettings { - // Reference to the process image - private String image; - // Reference to the process arguments (space separated string) - private String arguments; - // Reference to the process object - private Process process; - // Reference to the pseudo terminal object - private PTY pty; - // Flag to control the local echo (defaults to true if - // the PTY is not supported on the current host platform) - private boolean localEcho = !PTY.isSupported(); - // The line separator setting - private String lineSeparator = null; - // The list of stdout output listeners - private OutputStreamMonitor.Listener[] stdoutListeners = null; - // The list of stderr output listeners - private OutputStreamMonitor.Listener[] stderrListeners = null; - // working directory for process - private String workingDir; - // environment - private String[] environment; - - /** - * Sets the process image. - * - * @param image The process image or <code>null</code>. - */ - public void setImage(String image) { - this.image = image; - } - - /** - * Returns the process image. - * - * @return The process image or <code>null</code>. - */ - public String getImage() { - return image; - } - - /** - * Sets the process arguments. - * <p> - * The arguments are space separated. The caller is responsible for - * correct quoting. - * - * @param arguments The process arguments or <code>null</code>. - */ - public void setArguments(String arguments) { - this.arguments = arguments; - } - - /** - * Returns the process arguments. - * - * @return The process arguments as space separated list or <code>null</code>. - */ - public String getArguments() { - return arguments; - } - - /** - * Sets the process object. - * - * @param image The process object or <code>null</code>. - */ - public void setProcess(Process process) { - this.process = process; - } - - /** - * Returns the process object. - * - * @return The process object or <code>null</code>. - */ - public Process getProcess() { - return process; - } - - /** - * Sets the pseudo terminal object. - * - * @param pty The pseudo terminal or <code>null</code>. - */ - public void setPTY(PTY pty) { - this.pty = pty; - // If the PTY is set to "null", the local echo will be set to "true" - if (pty == null) setLocalEcho(true); - } - - /** - * Returns the pseudo terminal object. - * - * @return The pseudo terminal or <code>null</code>. - */ - public PTY getPTY() { - return pty; - } - - /** - * Sets if the process requires a local echo from the - * terminal widget. - * - * @param value Specify <code>true</code> to enable the local echo, <code>false</code> otherwise. - */ - public void setLocalEcho(boolean value) { - this.localEcho = value; - } - - /** - * Returns <code>true</code> if the process requires a local echo - * from the terminal widget. - * - * @return <code>True</code> if local echo is enabled, <code>false</code> otherwise. - */ - public boolean isLocalEcho() { - return localEcho; - } - - /** - * Sets the process line separator. - * - * @param separator The process line separator <code>null</code>. - */ - public void setLineSeparator(String separator) { - this.lineSeparator = separator; - } - - /** - * Returns the process line separator. - * - * @return The process line separator or <code>null</code>. - */ - public String getLineSeparator() { - return lineSeparator; - } - - /** - * Sets the list of stdout listeners. - * - * @param listeners The list of stdout listeners or <code>null</code>. - */ - public void setStdOutListeners(OutputStreamMonitor.Listener[] listeners) { - this.stdoutListeners = listeners; - } - - /** - * Returns the list of stdout listeners. - * - * @return The list of stdout listeners or <code>null</code>. - */ - public OutputStreamMonitor.Listener[] getStdOutListeners() { - return stdoutListeners; - } - - /** - * Sets the list of stderr listeners. - * - * @param listeners The list of stderr listeners or <code>null</code>. - */ - public void setStdErrListeners(OutputStreamMonitor.Listener[] listeners) { - this.stderrListeners = listeners; - } - - /** - * Returns the list of stderr listeners. - * - * @return The list of stderr listeners or <code>null</code>. - */ - public OutputStreamMonitor.Listener[] getStdErrListeners() { - return stderrListeners; - } - - /** - * Returns the working dir - * - * @return - */ - public String getWorkingDir() { - return this.workingDir; - } - - /** - * Sets the working dir of the process - * - * @param workingDir the absolute path of the working dir - */ - public void setWorkingDir(String workingDir) { - this.workingDir = workingDir; - } - - /** - * Get theprocess environment - * - * @return - */ - public String[] getEnvironment() { - return environment; - } - - /** - * Sets the process environment - * - * @param environment - will be added to the "parent" environment of the process - */ - public void setEnvironment(String[] environment) { - this.environment = environment; - } - - /** - * Loads the process settings from the given settings store. - * - * @param store The settings store. Must not be <code>null</code>. - */ - public void load(ISettingsStore store) { - Assert.isNotNull(store); - image = store.get("Path", null);//$NON-NLS-1$ - arguments = store.get("Arguments", null); //$NON-NLS-1$ - localEcho = Boolean.parseBoolean(store.get("LocalEcho", Boolean.FALSE.toString())); //$NON-NLS-1$ - lineSeparator = store.get("LineSeparator", null); //$NON-NLS-1$ - workingDir = store.get("WorkingDir", null); //$NON-NLS-1$ - if (store instanceof IPropertiesContainer) { - process = (Process)((IPropertiesContainer)store).getProperty("Process"); //$NON-NLS-1$ - pty = (PTY)((IPropertiesContainer)store).getProperty("PTY"); //$NON-NLS-1$ - stdoutListeners = (OutputStreamMonitor.Listener[])((IPropertiesContainer)store).getProperty("StdOutListeners"); //$NON-NLS-1$ - stderrListeners = (OutputStreamMonitor.Listener[])((IPropertiesContainer)store).getProperty("StdErrListeners"); //$NON-NLS-1$ - environment = (String[])((IPropertiesContainer)store).getProperty("Environment"); //$NON-NLS-1$ - } - } - - /** - * Saves the process settings to the given settings store. - * - * @param store The settings store. Must not be <code>null</code>. - */ - public void save(ISettingsStore store) { - Assert.isNotNull(store); - store.put("Path", image);//$NON-NLS-1$ - store.put("Arguments", arguments); //$NON-NLS-1$ - store.put("LocalEcho", Boolean.toString(localEcho)); //$NON-NLS-1$ - store.put("LineSeparator", lineSeparator); //$NON-NLS-1$ - store.put("WorkingDir", workingDir); //$NON-NLS-1$ - if (store instanceof IPropertiesContainer) { - ((IPropertiesContainer)store).setProperty("Process", process); //$NON-NLS-1$ - ((IPropertiesContainer)store).setProperty("PTY", pty); //$NON-NLS-1$ - ((IPropertiesContainer)store).setProperty("StdOutListeners", stdoutListeners); //$NON-NLS-1$ - ((IPropertiesContainer)store).setProperty("StdErrListeners", stderrListeners); //$NON-NLS-1$ - ((IPropertiesContainer)store).setProperty("Environment", environment); //$NON-NLS-1$ - } - } -} diff --git a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java index bcff0b31c..429488605 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.ui.terminals.local/src/org/eclipse/tcf/te/ui/terminals/local/types/LocalConnectorType.java @@ -18,7 +18,7 @@ import org.eclipse.tcf.te.runtime.services.interfaces.constants.ILineSeparatorCo import org.eclipse.tcf.te.runtime.services.interfaces.constants.ITerminalsConnectorConstants; import org.eclipse.tcf.te.runtime.utils.Host; import org.eclipse.tcf.te.ui.terminals.internal.SettingsStore; -import org.eclipse.tcf.te.ui.terminals.local.LocalSettings; +import org.eclipse.tcf.te.ui.terminals.process.ProcessSettings; import org.eclipse.tcf.te.ui.terminals.streams.OutputStreamMonitor; import org.eclipse.tcf.te.ui.terminals.types.AbstractConnectorType; import org.eclipse.tm.internal.terminal.provisional.api.ISettingsStore; @@ -102,7 +102,7 @@ public class LocalConnectorType extends AbstractConnectorType { ISettingsStore store = new SettingsStore(); // Construct the process settings - LocalSettings processSettings = new LocalSettings(); + ProcessSettings processSettings = new ProcessSettings(); processSettings.setImage(image); processSettings.setArguments(arguments); processSettings.setProcess(process); |