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 84058 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]
Patch
patch_99472_20071129.txt (text/plain), 3.61 KB, created by
Tomasz Zarna
on 2007-11-29 09:17:12 EST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2007-11-29 09:17:12 EST
Size:
3.61 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.team.cvs.ui >Index: src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java,v >retrieving revision 1.33 >diff -u -r1.33 WorkbenchUserAuthenticator.java >--- src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java 31 Jul 2007 20:29:50 -0000 1.33 >+++ src/org/eclipse/team/internal/ccvs/ui/WorkbenchUserAuthenticator.java 29 Nov 2007 14:11:38 -0000 >@@ -14,13 +14,16 @@ > import java.util.Map; > > import org.eclipse.core.runtime.OperationCanceledException; >-import org.eclipse.jface.dialogs.*; >+import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.window.Window; > import org.eclipse.osgi.util.NLS; >+import org.eclipse.swt.SWT; > import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.team.core.*; > import org.eclipse.team.internal.ccvs.core.*; >+import org.eclipse.ui.*; > > /** > * An authenticator that prompts the user for authentication info, >@@ -144,7 +147,7 @@ > } > } > >- UserValidationDialog dialog = new UserValidationDialog(null, domain, (username==null)?"":username, message, cachingCheckbox);//$NON-NLS-1$ >+ UserValidationDialog dialog = new UserValidationDialog(getDefaultParent(), domain, (username==null)?"":username, message, cachingCheckbox);//$NON-NLS-1$ > dialog.setUsernameMutable(userMutable); > dialog.open(); > result[0] = dialog.getUsername(); >@@ -153,6 +156,71 @@ > } > > /** >+ * 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; >+ } >+ >+ /** >+ * 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. >+ * >+ * @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
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