mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-15 04:55:22 +02:00
[149285] [ssh] multiple prompts and errors in case of incorrect username (Apply patch from Anna Dushistova)
This commit is contained in:
parent
a91925a579
commit
b309d5375c
1 changed files with 89 additions and 51 deletions
|
@ -19,6 +19,7 @@
|
||||||
* 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
|
||||||
|
* Anna Dushistova (MontaVista) - [149285] [ssh] multiple prompts and errors in case of incorrect username
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.shells.ui.actions;
|
package org.eclipse.rse.internal.shells.ui.actions;
|
||||||
|
@ -29,6 +30,7 @@ import org.eclipse.core.runtime.IAdaptable;
|
||||||
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.NullProgressMonitor;
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
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.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
@ -123,6 +125,9 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
catch (SystemMessageException e) {
|
catch (SystemMessageException e) {
|
||||||
SystemMessageDialog.displayMessage(e);
|
SystemMessageDialog.displayMessage(e);
|
||||||
}
|
}
|
||||||
|
catch (OperationCanceledException e) {
|
||||||
|
//do nothing--it's user's action
|
||||||
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
SystemBasePlugin.logError(
|
SystemBasePlugin.logError(
|
||||||
e.getLocalizedMessage()!=null ? e.getLocalizedMessage() : e.getClass().getName(),
|
e.getLocalizedMessage()!=null ? e.getLocalizedMessage() : e.getClass().getName(),
|
||||||
|
@ -135,6 +140,7 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
public class PromptForPassword implements Runnable
|
public class PromptForPassword implements Runnable
|
||||||
{
|
{
|
||||||
public SubSystem _ss;
|
public SubSystem _ss;
|
||||||
|
private boolean connectionCancelled=false;
|
||||||
public PromptForPassword(SubSystem ss)
|
public PromptForPassword(SubSystem ss)
|
||||||
{
|
{
|
||||||
_ss = ss;
|
_ss = ss;
|
||||||
|
@ -146,11 +152,22 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
{
|
{
|
||||||
_ss.promptForPassword();
|
_ss.promptForPassword();
|
||||||
}
|
}
|
||||||
|
catch (OperationCanceledException canceledEx) {
|
||||||
|
setConnectionCancelled(true);
|
||||||
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
/* ignore */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setConnectionCancelled(boolean connectionCancelled) {
|
||||||
|
this.connectionCancelled = connectionCancelled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isConnectionCancelled() {
|
||||||
|
return connectionCancelled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UpdateRegistry implements Runnable
|
public class UpdateRegistry implements Runnable
|
||||||
|
@ -321,7 +338,9 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SystemCommandAction
|
* Constructor for SystemCommandAction
|
||||||
* @param parent
|
*
|
||||||
|
* @param parent Shell of parent window. Can be null if you don't know it,
|
||||||
|
* but call setShell when you do.
|
||||||
*/
|
*/
|
||||||
public SystemCommandAction(Shell parent)
|
public SystemCommandAction(Shell parent)
|
||||||
{
|
{
|
||||||
|
@ -330,8 +349,11 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SystemCommandAction
|
* Constructor for SystemCommandAction
|
||||||
* @param parent
|
*
|
||||||
* @param isShell indication of whether this action launches a shell or runs a command
|
* @param parent Shell of parent window. Can be null if you don't know it,
|
||||||
|
* but call setShell when you do.
|
||||||
|
* @param isShell indication of whether this action launches a shell or runs
|
||||||
|
* a command
|
||||||
*/
|
*/
|
||||||
public SystemCommandAction(Shell parent, boolean isShell)
|
public SystemCommandAction(Shell parent, boolean isShell)
|
||||||
{
|
{
|
||||||
|
@ -340,8 +362,11 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SystemCommandAction
|
* Constructor for SystemCommandAction
|
||||||
* @param parent
|
*
|
||||||
* @param isShell indication of whether this action launches a shell or runs a command
|
* @param parent Shell of parent window. Can be null if you don't know it,
|
||||||
|
* but call setShell when you do.
|
||||||
|
* @param isShell indication of whether this action launches a shell or runs
|
||||||
|
* a command
|
||||||
* @param cmdSubSystem the command subsystem to use if launching a shell
|
* @param cmdSubSystem the command subsystem to use if launching a shell
|
||||||
*/
|
*/
|
||||||
public SystemCommandAction(Shell parent, boolean isShell, IRemoteCmdSubSystem cmdSubSystem)
|
public SystemCommandAction(Shell parent, boolean isShell, IRemoteCmdSubSystem cmdSubSystem)
|
||||||
|
@ -356,9 +381,12 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SystemCommandAction
|
* Constructor for SystemCommandAction
|
||||||
|
*
|
||||||
* @param title the title of the action
|
* @param title the title of the action
|
||||||
* @param parent
|
* @param parent Shell of parent window. Can be null if you don't know it,
|
||||||
* @param isShell indication of whether this action launches a shell or runs a command
|
* but call setShell when you do.
|
||||||
|
* @param isShell indication of whether this action launches a shell or runs
|
||||||
|
* a command
|
||||||
* @param cmdSubSystem the command subsystem to use if launching a shell
|
* @param cmdSubSystem the command subsystem to use if launching a shell
|
||||||
*/
|
*/
|
||||||
public SystemCommandAction(String title, Shell parent, boolean isShell, IRemoteCmdSubSystem cmdSubSystem)
|
public SystemCommandAction(String title, Shell parent, boolean isShell, IRemoteCmdSubSystem cmdSubSystem)
|
||||||
|
@ -369,10 +397,13 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SystemCommandAction
|
* Constructor for SystemCommandAction
|
||||||
|
*
|
||||||
* @param title the title of the action
|
* @param title the title of the action
|
||||||
* @param tooltip the tooltip for the action
|
* @param tooltip the tooltip for the action
|
||||||
* @param parent
|
* @param parent Shell of parent window. Can be null if you don't know it,
|
||||||
* @param isShell indication of whether this action launches a shell or runs a command
|
* but call setShell when you do.
|
||||||
|
* @param isShell indication of whether this action launches a shell or runs
|
||||||
|
* a command
|
||||||
* @param cmdSubSystem the command subsystem to use if launching a shell
|
* @param cmdSubSystem the command subsystem to use if launching a shell
|
||||||
*/
|
*/
|
||||||
public SystemCommandAction(String title, String tooltip, Shell parent, boolean isShell, IRemoteCmdSubSystem cmdSubSystem)
|
public SystemCommandAction(String title, String tooltip, Shell parent, boolean isShell, IRemoteCmdSubSystem cmdSubSystem)
|
||||||
|
@ -389,11 +420,14 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for SystemCommandAction
|
* Constructor for SystemCommandAction
|
||||||
|
*
|
||||||
* @param title the title of the action
|
* @param title the title of the action
|
||||||
* @param tooltip the tooltip for the action
|
* @param tooltip the tooltip for the action
|
||||||
* @param descriptor the image descriptor for the action
|
* @param descriptor the image descriptor for the action
|
||||||
* @param parent
|
* @param parent Shell of parent window. Can be null if you don't know it,
|
||||||
* @param isShell indication of whether this action launches a shell or runs a command
|
* but call setShell when you do.
|
||||||
|
* @param isShell indication of whether this action launches a shell or runs
|
||||||
|
* a command
|
||||||
* @param cmdSubSystem the command subsystem to use if launching a shell
|
* @param cmdSubSystem the command subsystem to use if launching a shell
|
||||||
*/
|
*/
|
||||||
public SystemCommandAction(String title, String tooltip, ImageDescriptor descriptor, Shell parent, boolean isShell, IRemoteCmdSubSystem cmdSubSystem)
|
public SystemCommandAction(String title, String tooltip, ImageDescriptor descriptor, Shell parent, boolean isShell, IRemoteCmdSubSystem cmdSubSystem)
|
||||||
|
@ -615,9 +649,13 @@ public class SystemCommandAction extends SystemBaseAction
|
||||||
{
|
{
|
||||||
|
|
||||||
Display dis = Display.getDefault();
|
Display dis = Display.getDefault();
|
||||||
dis.syncExec(new PromptForPassword(ss));
|
PromptForPassword passPrompt = new PromptForPassword(ss);
|
||||||
ss.getConnectorService().connect(monitor);
|
dis.syncExec(passPrompt);
|
||||||
dis.asyncExec(new UpdateRegistry(ss));
|
if(!passPrompt.isConnectionCancelled()){
|
||||||
|
ss.getConnectorService().connect(monitor);
|
||||||
|
dis.asyncExec(new UpdateRegistry(ss));
|
||||||
|
}else
|
||||||
|
throw new OperationCanceledException();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue