Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 84292 Details for
Bug 99472
[Dialogs] promptForPassword dialog not correctly parented?
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
a patch for org.eclipse.jsch.ui
patch.txt (text/plain), 4.29 KB, created by
Atsuhiko Yamanaka
on 2007-12-03 02:26:50 EST
(
hide
)
Description:
a patch for org.eclipse.jsch.ui
Filename:
MIME Type:
Creator:
Atsuhiko Yamanaka
Created:
2007-12-03 02:26:50 EST
Size:
4.29 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jsch.ui >Index: src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jsch.ui/src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java,v >retrieving revision 1.1 >diff -u -r1.1 WorkbenchUserAuthenticator.java >--- src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java 2 Nov 2007 07:15:46 -0000 1.1 >+++ src/org/eclipse/jsch/internal/ui/authenticator/WorkbenchUserAuthenticator.java 3 Dec 2007 07:19:19 -0000 >@@ -22,6 +22,8 @@ > import org.eclipse.jsch.internal.core.IUserAuthenticator; > import org.eclipse.jsch.internal.core.IUserInfo; > import org.eclipse.jsch.internal.ui.Messages; >+import org.eclipse.ui.*; >+import org.eclipse.swt.SWT; > > /** > * An authenticator that prompts the user for authentication info, >@@ -101,7 +103,7 @@ > final String username, final String message, final boolean userMutable, > final String[] result){ > String comment=location==null ? null : location.getComment(); >- UserValidationDialog dialog=new UserValidationDialog(null, comment, >+ UserValidationDialog dialog=new UserValidationDialog(getDefaultParent(), comment, > (username==null) ? "" : username, message, (location!=null && location.getPasswordStore()!=null));//$NON-NLS-1$ > dialog.setUsernameMutable(userMutable); > dialog.open(); >@@ -109,16 +111,87 @@ > result[1]=dialog.getPassword(); > return dialog.getAllowCaching(); > } >+ >+ /** >+ * Return the modal shell that is currently open. If there isn't one then >+ * return null. >+ * >+ * @param shell >+ * A shell to exclude from the search. May be <code>null</code>. >+ * >+ * @return Shell or <code>null</code>. >+ */ >+ private static Shell getModalShellExcluding(Shell shell){ >+ IWorkbench workbench=PlatformUI.getWorkbench(); >+ Shell[] shells=workbench.getDisplay().getShells(); >+ int modal=SWT.APPLICATION_MODAL|SWT.SYSTEM_MODAL|SWT.PRIMARY_MODAL; >+ for(int i=0; i<shells.length; i++){ >+ if(shells[i].equals(shell)){ >+ break; >+ } >+ // Do not worry about shells that will not block the user. >+ if(shells[i].isVisible()){ >+ int style=shells[i].getStyle(); >+ if((style&modal)!=0){ >+ return shells[i]; >+ } >+ } >+ } >+ return null; >+ } > > /** >- * Asks the user to enter values. >+ * Utility method to get the best parenting possible for a dialog. If there is >+ * a modal shell create it so as to avoid two modal dialogs. If not then >+ * return the shell of the active workbench window. If neither can be found >+ * return null. > * >- * @param location the location to obtain the password for >- * @param destination the location >- * @param name the name >- * @param instruction the instruction >- * @param prompt the titles for text fields >- * @param echo '*' should be used or not >+ * @return Shell or <code>null</code> >+ */ >+ private static Shell getDefaultParent(){ >+ Shell modal=getModalShellExcluding(null); >+ if(modal!=null){ >+ return modal; >+ } >+ >+ return getNonModalShell(); >+ } >+ >+ /** >+ * Get the active non modal shell. If there isn't one return null. >+ * >+ * @return Shell >+ */ >+ private static Shell getNonModalShell(){ >+ IWorkbenchWindow window=PlatformUI.getWorkbench() >+ .getActiveWorkbenchWindow(); >+ if(window==null){ >+ IWorkbenchWindow[] windows=PlatformUI.getWorkbench() >+ .getWorkbenchWindows(); >+ if(windows.length>0) >+ return windows[0].getShell(); >+ } >+ else >+ return window.getShell(); >+ >+ return null; >+ } >+ >+ /** >+ * Asks the user to enter values. >+ * >+ * @param location >+ * the location to obtain the password for >+ * @param destination >+ * the location >+ * @param name >+ * the name >+ * @param instruction >+ * the instruction >+ * @param prompt >+ * the titles for text fields >+ * @param echo >+ * '*' should be used or not > * @return the entered values, or null if user canceled. > */ > public String[] promptForKeyboradInteractive(
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 99472
:
84058
|
84059
| 84292