diff --git a/org.eclipse.tm.terminal.local/META-INF/MANIFEST.MF b/org.eclipse.tm.terminal.local/META-INF/MANIFEST.MF
index b192be99f47..8682cfaeb28 100644
--- a/org.eclipse.tm.terminal.local/META-INF/MANIFEST.MF
+++ b/org.eclipse.tm.terminal.local/META-INF/MANIFEST.MF
@@ -17,5 +17,4 @@ Require-Bundle: org.eclipse.tm.terminal;bundle-version="[3.0.0,3.1.0)",
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true
-Eclipse-PlatformFilter: (!(osgi.os=win32))
Import-Package: org.eclipse.core.variables
diff --git a/org.eclipse.tm.terminal.local/plugin.properties b/org.eclipse.tm.terminal.local/plugin.properties
index 9fd177c567a..44ea6949c36 100644
--- a/org.eclipse.tm.terminal.local/plugin.properties
+++ b/org.eclipse.tm.terminal.local/plugin.properties
@@ -17,4 +17,4 @@ providerName=Eclipse.org - DSDP
terminalLaunch=Terminal
terminalLaunchDescription=Run a program in a terminal
-localConnection=Local program
+localConnection=Local Program
diff --git a/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java b/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java
index 301ad7f85a8..ad6b6c70b58 100644
--- a/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java
+++ b/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalConnector.java
@@ -8,13 +8,14 @@
* Contributors:
* Mirko Raner - [196337] initial implementation; some methods adapted from
* org.eclipse.tm.terminal.ssh/SshConnector
+ * Mirko Raner - [314977] Dynamically disable when no PTY is available
**************************************************************************************************/
package org.eclipse.tm.internal.terminal.local;
import java.io.OutputStream;
-import java.text.Format;
-import java.text.MessageFormat;
+
+import org.eclipse.cdt.utils.Platform;
import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -31,6 +32,7 @@ import org.eclipse.debug.core.model.IStreamMonitor;
import org.eclipse.debug.core.model.IStreamsProxy;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.tm.internal.terminal.local.launch.LocalTerminalLaunchUtilities;
@@ -50,7 +52,7 @@ import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnect
* vi
editor).
*
* @author Mirko Raner
- * @version $Revision: 1.4 $
+ * @version $Revision: 1.5 $
*/
public class LocalTerminalConnector extends TerminalConnectorImpl
implements IDebugEventSetListener {
@@ -80,6 +82,25 @@ implements IDebugEventSetListener {
settings = new LocalTerminalSettings();
}
+ /**
+ * Initializes the connector. This method checks whether a pty
driver is available
+ * and will fail if that is not the case.
+ *
+ * @throws Exception if the connector could not be initialized
+ */
+ public void initialize() throws Exception {
+
+ super.initialize();
+ if (!PTY.isSupported()) {
+
+ final String OS = Platform.getOS();
+ final String ARCH = Platform.getOSArch();
+ String message = NLS.bind(LocalTerminalMessages.errorNoPTYSupport, OS, ARCH);
+ IStatus status = new Status(IStatus.WARNING, LocalTerminalActivator.PLUGIN_ID, message);
+ throw new CoreException(status);
+ }
+ }
+
/**
* Loads the connector's settings from the specified store.
*
@@ -191,9 +212,8 @@ implements IDebugEventSetListener {
Shell shell = Display.getDefault().getActiveShell();
String title = LocalTerminalMessages.errorTitleCouldNotConnectToTerminal;
- Format text;
- text = new MessageFormat(LocalTerminalMessages.errorLaunchConfigurationNoLongerExists);
- String message = text.format(new Object[] {configurationName});
+ String text = LocalTerminalMessages.errorLaunchConfigurationNoLongerExists;
+ String message = NLS.bind(text, configurationName);
IStatus status = new Status(IStatus.ERROR, LocalTerminalActivator.PLUGIN_ID, message);
ErrorDialog.openError(shell, title, null, status);
control.setState(TerminalState.CLOSED);
diff --git a/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.java b/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.java
index d31fd6475cb..9f1689f4114 100644
--- a/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.java
+++ b/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.java
@@ -18,7 +18,7 @@ import org.eclipse.osgi.util.NLS;
* messages used by the Local Terminal Connector.
*
* @author Mirko Raner
- * @version $Revision: 1.3 $
+ * @version $Revision: 1.4 $
*/
public class LocalTerminalMessages extends NLS {
@@ -89,6 +89,9 @@ public class LocalTerminalMessages extends NLS {
/** The question title for confirming deletion of a launch configuration. */
public static String questionTitleDeleteLaunchConfiguration;
+ /** The error message for platforms that don't support pty
s. */
+ public static String errorNoPTYSupport;
+
/** The error message for attempting to directly launch a Terminal launch configuration. */
public static String errorDirectLaunch;
diff --git a/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.properties b/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.properties
index 6a8d5a985e5..f3238b967ad 100644
--- a/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.properties
+++ b/org.eclipse.tm.terminal.local/src/org/eclipse/tm/internal/terminal/local/LocalTerminalMessages.properties
@@ -31,6 +31,8 @@ invalidWorkingDirectory=The path {0} is not a directory and cannot be used as wo
for ''{1}''
questionDeleteLaunchConfiguration=Do you wish to delete the selected launch configuration?
questionTitleDeleteLaunchConfiguration=Confirm Launch Configuration Deletion
+errorNoPTYSupport=CDT PTY support is not available on your host ({0}.{1}).\n\n\
+The Local Terminal connector has been disabled.
errorDirectLaunch=Terminal launch configurations can only be launched from the Terminal view. \
Please open the Terminal view and click the view's Settings button to select and launch a local \
Terminal.
diff --git a/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.properties b/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.properties
index e7a350c1688..3b7ad376daa 100644
--- a/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.properties
+++ b/org.eclipse.tm.terminal.view/src/org/eclipse/tm/internal/terminal/view/ViewMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2003, 2009 Wind River Systems, Inc. and others.
+# Copyright (c) 2003, 2010 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
@@ -39,4 +39,4 @@ STATE_CONNECTING = CONNECTING...
STATE_CLOSED = CLOSED
CANNOT_INITIALIZE = Cannot initialize {0}:\n{1}
-CONNECTOR_NOT_AVAILABLE = Connector {0} not available!
+CONNECTOR_NOT_AVAILABLE = Connector {0} is not available!