1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 17:35: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 135d26373e
commit c6f49fccf6
7 changed files with 37 additions and 13 deletions

View file

@ -8,9 +8,9 @@ feature@org.eclipse.tm.terminal.telnet=v201005032000,:pserver:anonymous:none@dev
feature@org.eclipse.tm.terminal.test=v200905272300,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.test-feature
feature@org.eclipse.tm.terminal.view=v201006030830,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view-feature
plugin@org.eclipse.tm.terminal=v201006030830,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal
plugin@org.eclipse.tm.terminal.local=v201006030730,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local
plugin@org.eclipse.tm.terminal.local=v201006041240,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.local
plugin@org.eclipse.tm.terminal.serial=v200905272300,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.serial
plugin@org.eclipse.tm.terminal.ssh=v201005271030,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.ssh
plugin@org.eclipse.tm.terminal.telnet=v200909160005,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.telnet
plugin@org.eclipse.tm.terminal.test=v201005220050,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.test
plugin@org.eclipse.tm.terminal.view=v201006030830,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view
plugin@org.eclipse.tm.terminal.view=v201006041240,:pserver:anonymous:none@dev.eclipse.org:/cvsroot/dsdp,,org.eclipse.tm.core/terminal/org.eclipse.tm.terminal.view

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-ActivationPolicy: lazy
Eclipse-LazyStart: true
Eclipse-PlatformFilter: (!(osgi.os=win32))
Import-Package: org.eclipse.core.variables

View file

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

View file

@ -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
* <code>vi</code> 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 <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.
*
@ -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);

View file

@ -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 <code>pty</code>s. */
public static String errorNoPTYSupport;
/** The error message for attempting to directly launch a Terminal launch configuration. */
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}''
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.

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
# 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!