1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 20:05:35 +02:00

Bug 314977 - [terminal][local] Confusing error when trying to install Local Terminal on Windows from Helios

This commit is contained in:
Martin Oberhuber 2010-06-04 12:40:37 +00:00
parent 408bb2afce
commit bb489c3119
6 changed files with 35 additions and 11 deletions

View file

@ -17,5 +17,4 @@ Require-Bundle: org.eclipse.tm.terminal;bundle-version="[3.0.0,3.1.0)",
Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy Bundle-ActivationPolicy: lazy
Eclipse-LazyStart: true Eclipse-LazyStart: true
Eclipse-PlatformFilter: (!(osgi.os=win32))
Import-Package: org.eclipse.core.variables Import-Package: org.eclipse.core.variables

View file

@ -17,4 +17,4 @@ providerName=Eclipse.org - DSDP
terminalLaunch=Terminal terminalLaunch=Terminal
terminalLaunchDescription=Run a program in a terminal terminalLaunchDescription=Run a program in a terminal
localConnection=Local program localConnection=Local Program

View file

@ -8,13 +8,14 @@
* Contributors: * Contributors:
* Mirko Raner - [196337] initial implementation; some methods adapted from * Mirko Raner - [196337] initial implementation; some methods adapted from
* org.eclipse.tm.terminal.ssh/SshConnector * org.eclipse.tm.terminal.ssh/SshConnector
* Mirko Raner - [314977] Dynamically disable when no PTY is available
**************************************************************************************************/ **************************************************************************************************/
package org.eclipse.tm.internal.terminal.local; package org.eclipse.tm.internal.terminal.local;
import java.io.OutputStream; 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.cdt.utils.pty.PTY;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus; 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.core.model.IStreamsProxy;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.tm.internal.terminal.local.launch.LocalTerminalLaunchUtilities; import org.eclipse.tm.internal.terminal.local.launch.LocalTerminalLaunchUtilities;
@ -50,7 +52,7 @@ import org.eclipse.tm.internal.terminal.provisional.api.provider.TerminalConnect
* <code>vi</code> editor). * <code>vi</code> editor).
* *
* @author Mirko Raner * @author Mirko Raner
* @version $Revision: 1.4 $ * @version $Revision: 1.5 $
*/ */
public class LocalTerminalConnector extends TerminalConnectorImpl public class LocalTerminalConnector extends TerminalConnectorImpl
implements IDebugEventSetListener { implements IDebugEventSetListener {
@ -80,6 +82,25 @@ implements IDebugEventSetListener {
settings = new LocalTerminalSettings(); settings = new LocalTerminalSettings();
} }
/**
* Initializes the connector. This method checks whether a <code>pty</code> 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. * Loads the connector's settings from the specified store.
* *
@ -191,9 +212,8 @@ implements IDebugEventSetListener {
Shell shell = Display.getDefault().getActiveShell(); Shell shell = Display.getDefault().getActiveShell();
String title = LocalTerminalMessages.errorTitleCouldNotConnectToTerminal; String title = LocalTerminalMessages.errorTitleCouldNotConnectToTerminal;
Format text; String text = LocalTerminalMessages.errorLaunchConfigurationNoLongerExists;
text = new MessageFormat(LocalTerminalMessages.errorLaunchConfigurationNoLongerExists); String message = NLS.bind(text, configurationName);
String message = text.format(new Object[] {configurationName});
IStatus status = new Status(IStatus.ERROR, LocalTerminalActivator.PLUGIN_ID, message); IStatus status = new Status(IStatus.ERROR, LocalTerminalActivator.PLUGIN_ID, message);
ErrorDialog.openError(shell, title, null, status); ErrorDialog.openError(shell, title, null, status);
control.setState(TerminalState.CLOSED); control.setState(TerminalState.CLOSED);

View file

@ -18,7 +18,7 @@ import org.eclipse.osgi.util.NLS;
* messages used by the Local Terminal Connector. * messages used by the Local Terminal Connector.
* *
* @author Mirko Raner * @author Mirko Raner
* @version $Revision: 1.3 $ * @version $Revision: 1.4 $
*/ */
public class LocalTerminalMessages extends NLS { public class LocalTerminalMessages extends NLS {
@ -89,6 +89,9 @@ public class LocalTerminalMessages extends NLS {
/** The question title for confirming deletion of a launch configuration. */ /** The question title for confirming deletion of a launch configuration. */
public static String questionTitleDeleteLaunchConfiguration; public static String questionTitleDeleteLaunchConfiguration;
/** The error message for platforms that don't support <code>pty</code>s. */
public static String errorNoPTYSupport;
/** The error message for attempting to directly launch a Terminal launch configuration. */ /** The error message for attempting to directly launch a Terminal launch configuration. */
public static String errorDirectLaunch; public static String errorDirectLaunch;

View file

@ -31,6 +31,8 @@ invalidWorkingDirectory=The path {0} is not a directory and cannot be used as wo
for ''{1}'' for ''{1}''
questionDeleteLaunchConfiguration=Do you wish to delete the selected launch configuration? questionDeleteLaunchConfiguration=Do you wish to delete the selected launch configuration?
questionTitleDeleteLaunchConfiguration=Confirm Launch Configuration Deletion 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. \ 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 \ Please open the Terminal view and click the view's Settings button to select and launch a local \
Terminal. Terminal.

View file

@ -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 # All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0 # are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at # which accompanies this distribution, and is available at
@ -39,4 +39,4 @@ STATE_CONNECTING = CONNECTING...
STATE_CLOSED = CLOSED STATE_CLOSED = CLOSED
CANNOT_INITIALIZE = Cannot initialize {0}:\n{1} CANNOT_INITIALIZE = Cannot initialize {0}:\n{1}
CONNECTOR_NOT_AVAILABLE = Connector {0} not available! CONNECTOR_NOT_AVAILABLE = Connector {0} is not available!