mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-11 10:15:39 +02:00
[149285] [ssh] multiple prompts and errors in case of incorrect username (Apply patch from Anna Dushistova)
This commit is contained in:
parent
b309d5375c
commit
e63686dc77
2 changed files with 44 additions and 33 deletions
|
@ -1,25 +1,26 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name
|
* Martin Oberhuber (Wind River) - Fix 154874 - handle files with space or $ in the name
|
||||||
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
* Martin Oberhuber (Wind River) - [186128] Move IProgressMonitor last in all API
|
||||||
* Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
|
* Martin Oberhuber (Wind River) - [174945] Remove obsolete icons from rse.shells.ui
|
||||||
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
|
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
|
||||||
* Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect()
|
* Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect()
|
||||||
* Kevin Doyle (IBM) - [187083] Launch Shell action available on folders inside virtual files
|
* Kevin Doyle (IBM) - [187083] Launch Shell action available on folders inside virtual files
|
||||||
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
|
||||||
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
|
||||||
* Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandAction
|
* Yu-Fen Kuo (MontaVista) - Adapted from SystemCommandAction
|
||||||
|
* Martin Oberhuber (Wind River) - [149285] [ssh] multiple prompts and errors in case of incorrect username
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.terminals.ui.actions;
|
package org.eclipse.rse.internal.terminals.ui.actions;
|
||||||
|
@ -28,6 +29,7 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
import org.eclipse.rse.core.filters.ISystemFilterReference;
|
||||||
|
@ -44,6 +46,7 @@ import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFile;
|
||||||
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem;
|
||||||
import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
|
import org.eclipse.rse.subsystems.terminals.core.ITerminalServiceSubSystem;
|
||||||
import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
|
import org.eclipse.rse.subsystems.terminals.core.elements.TerminalElement;
|
||||||
|
import org.eclipse.rse.ui.SystemBasePlugin;
|
||||||
import org.eclipse.rse.ui.actions.SystemBaseAction;
|
import org.eclipse.rse.ui.actions.SystemBaseAction;
|
||||||
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
import org.eclipse.rse.ui.view.ISystemViewElementAdapter;
|
||||||
import org.eclipse.swt.custom.CTabItem;
|
import org.eclipse.swt.custom.CTabItem;
|
||||||
|
@ -52,7 +55,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
/**
|
/**
|
||||||
* action to launch a terminal from either the terminal subsystem or selected
|
* action to launch a terminal from either the terminal subsystem or selected
|
||||||
* directory
|
* directory
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class LaunchTerminalAction extends SystemBaseAction {
|
public class LaunchTerminalAction extends SystemBaseAction {
|
||||||
|
|
||||||
|
@ -66,7 +69,7 @@ public class LaunchTerminalAction extends SystemBaseAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for LaunchTerminalAction
|
* Constructor for LaunchTerminalAction
|
||||||
*
|
*
|
||||||
* @param parent
|
* @param parent
|
||||||
* @param subSystem
|
* @param subSystem
|
||||||
* the terminal subsystem to use if launching a terminal
|
* the terminal subsystem to use if launching a terminal
|
||||||
|
@ -80,7 +83,7 @@ public class LaunchTerminalAction extends SystemBaseAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for LaunchTerminalAction
|
* Constructor for LaunchTerminalAction
|
||||||
*
|
*
|
||||||
* @param title
|
* @param title
|
||||||
* title of the action
|
* title of the action
|
||||||
* @param tooltip
|
* @param tooltip
|
||||||
|
@ -99,7 +102,7 @@ public class LaunchTerminalAction extends SystemBaseAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for LaunchTerminalAction
|
* Constructor for LaunchTerminalAction
|
||||||
*
|
*
|
||||||
* @param title
|
* @param title
|
||||||
* title of the action
|
* title of the action
|
||||||
* @param tooltip
|
* @param tooltip
|
||||||
|
@ -127,7 +130,7 @@ public class LaunchTerminalAction extends SystemBaseAction {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* settor for the terminal subsystem
|
* settor for the terminal subsystem
|
||||||
*
|
*
|
||||||
* @param subSystem
|
* @param subSystem
|
||||||
* terminal subsystem
|
* terminal subsystem
|
||||||
*/
|
*/
|
||||||
|
@ -137,7 +140,7 @@ public class LaunchTerminalAction extends SystemBaseAction {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.rse.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
|
* @see org.eclipse.rse.ui.actions.SystemBaseAction#updateSelection(org.eclipse.jface.viewers.IStructuredSelection)
|
||||||
*/
|
*/
|
||||||
public boolean updateSelection(IStructuredSelection selection) {
|
public boolean updateSelection(IStructuredSelection selection) {
|
||||||
|
@ -212,7 +215,7 @@ public class LaunchTerminalAction extends SystemBaseAction {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
*
|
*
|
||||||
* @see org.eclipse.rse.ui.actions.SystemBaseAction#run()
|
* @see org.eclipse.rse.ui.actions.SystemBaseAction#run()
|
||||||
*/
|
*/
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -237,9 +240,11 @@ public class LaunchTerminalAction extends SystemBaseAction {
|
||||||
if (!terminalSubSystem.isConnected()) {
|
if (!terminalSubSystem.isConnected()) {
|
||||||
try {
|
try {
|
||||||
terminalSubSystem.connect(new NullProgressMonitor(), false);
|
terminalSubSystem.connect(new NullProgressMonitor(), false);
|
||||||
|
} catch (OperationCanceledException e) {
|
||||||
|
// user canceled, return silently
|
||||||
|
return;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Activator.logError(e.getLocalizedMessage(), e);
|
SystemBasePlugin.logError(e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (terminalSubSystem.isConnected()) {
|
if (terminalSubSystem.isConnected()) {
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
/********************************************************************************
|
/********************************************************************************
|
||||||
* Copyright (c) 2002, 2007 IBM Corporation and others. All rights reserved.
|
* Copyright (c) 2002, 2008 IBM Corporation and others. All rights reserved.
|
||||||
* This program and the accompanying materials are made available under the terms
|
* 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
|
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
|
||||||
* available at http://www.eclipse.org/legal/epl-v10.html
|
* available at http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Initial Contributors:
|
* Initial Contributors:
|
||||||
* The following IBM employees contributed to the Remote System Explorer
|
* The following IBM employees contributed to the Remote System Explorer
|
||||||
* component that contains this file: David McKnight, Kushal Munir,
|
* component that contains this file: David McKnight, Kushal Munir,
|
||||||
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
* Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson,
|
||||||
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
* Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley.
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
|
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
|
||||||
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
|
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
|
||||||
* Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect()
|
* Martin Oberhuber (Wind River) - [187218] Fix error reporting for connect()
|
||||||
|
* Martin Oberhuber (Wind River) - [149285][ssh] multiple prompts and errors in case of incorrect username
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.ui.actions;
|
package org.eclipse.rse.internal.ui.actions;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.OperationCanceledException;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.rse.core.subsystems.ISubSystem;
|
import org.eclipse.rse.core.subsystems.ISubSystem;
|
||||||
|
@ -46,15 +48,19 @@ public class SystemConnectAction extends SystemBaseAction
|
||||||
_subsystem = subsystem;
|
_subsystem = subsystem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public IStatus run(IProgressMonitor monitor)
|
public IStatus run(IProgressMonitor monitor)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (_subsystem.getHost().getSystemType().isWindows())
|
if (_subsystem.getHost().getSystemType().isWindows())
|
||||||
_subsystem.connect(monitor, false);
|
_subsystem.connect(monitor, false);
|
||||||
else
|
else
|
||||||
_subsystem.connect(monitor, true);
|
_subsystem.connect(monitor, true);
|
||||||
}
|
}
|
||||||
|
catch (OperationCanceledException e) {
|
||||||
|
// user cancelled
|
||||||
|
return Status.CANCEL_STATUS;
|
||||||
|
}
|
||||||
catch (SystemMessageException e) {
|
catch (SystemMessageException e) {
|
||||||
SystemMessageDialog.displayMessage(e);
|
SystemMessageDialog.displayMessage(e);
|
||||||
}
|
}
|
||||||
|
@ -70,13 +76,13 @@ public class SystemConnectAction extends SystemBaseAction
|
||||||
return Status.OK_STATUS;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
* @param shell Shell of parent window, used as the parent for the dialog.
|
* @param shell Shell of parent window, used as the parent for the dialog.
|
||||||
* Can be null, but be sure to call setParent before the action is used (ie, run).
|
* Can be null, but be sure to call setParent before the action is used (ie, run).
|
||||||
*/
|
*/
|
||||||
public SystemConnectAction(Shell shell)
|
public SystemConnectAction(Shell shell)
|
||||||
{
|
{
|
||||||
super(SystemResources.ACTION_CONNECT_LABEL,SystemResources.ACTION_CONNECT_TOOLTIP, shell);
|
super(SystemResources.ACTION_CONNECT_LABEL,SystemResources.ACTION_CONNECT_TOOLTIP, shell);
|
||||||
allowOnMultipleSelection(false);
|
allowOnMultipleSelection(false);
|
||||||
|
@ -88,15 +94,15 @@ public class SystemConnectAction extends SystemBaseAction
|
||||||
* selection. We check the selected object is one of our subsystems, and we are not
|
* selection. We check the selected object is one of our subsystems, and we are not
|
||||||
* already connected.
|
* already connected.
|
||||||
*/
|
*/
|
||||||
public boolean checkObjectType(Object obj)
|
public boolean checkObjectType(Object obj)
|
||||||
{
|
{
|
||||||
if ( !(obj instanceof ISubSystem) ||
|
if ( !(obj instanceof ISubSystem) ||
|
||||||
((ISubSystem)obj).getConnectorService().isConnected() )
|
((ISubSystem)obj).getConnectorService().isConnected() )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when this action is selection from the popup menu.
|
* Called when this action is selection from the popup menu.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue