diff options
author | Alexander Kurtakov | 2018-11-22 09:52:12 +0000 |
---|---|---|
committer | Alexander Kurtakov | 2018-11-22 11:41:30 +0000 |
commit | fd3fbdf86e19293997e6acd28c930fd089f64a9d (patch) | |
tree | 5bbf407dca39007c8c5ed5367eb454b6762a2cc1 | |
parent | 08b77e0b7654a06df0dc8b190a18ce69545ac311 (diff) | |
download | eclipse.platform.team-fd3fbdf86e19293997e6acd28c930fd089f64a9d.tar.gz eclipse.platform.team-fd3fbdf86e19293997e6acd28c930fd089f64a9d.tar.xz eclipse.platform.team-fd3fbdf86e19293997e6acd28c930fd089f64a9d.zip |
Bug 541429 - empty windows accompanying cvs+extssh dialogs
Consult PlaformUI for active shell if there is one use it, otherwise
create new shell like it is now.
Change-Id: Ib83b2c6f8c93dae4c25b8574481226ea21db31e1
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r-- | bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java index bbbedc72b..789ef71e9 100644 --- a/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java +++ b/bundles/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2018 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -19,6 +19,7 @@ package org.eclipse.jsch.internal.ui.authenticator; import org.eclipse.core.runtime.OperationCanceledException; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.jface.dialogs.MessageDialog; +import org.eclipse.jface.window.IShellProvider; import org.eclipse.jsch.core.IJSchLocation; import org.eclipse.jsch.internal.core.IUserAuthenticator; import org.eclipse.jsch.internal.core.IUserInfo; @@ -26,6 +27,8 @@ import org.eclipse.jsch.internal.ui.Messages; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.PlatformUI; /** * An authenticator that prompts the user for authentication info, @@ -198,7 +201,18 @@ public int prompt(IJSchLocation location, final int promptType, } display.syncExec(() -> { - final MessageDialog dialog=new MessageDialog(new Shell(display), title, + Shell shell = null; + IWorkbench workbench = PlatformUI.getWorkbench(); + if (workbench != null) { + IShellProvider shellProvider = workbench.getModalDialogShellProvider(); + if (shellProvider != null) { + shell = shellProvider.getShell(); + } + } + if (shell == null) { + shell = new Shell(display); + } + final MessageDialog dialog = new MessageDialog(shell, title, null, message, promptType, buttons, 1); retval[0]=dialog.open(); }); |