Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Besedin2008-09-26 15:20:59 +0000
committerOleg Besedin2008-09-26 15:20:59 +0000
commit4eeba6c605109ad42773a1caa40e9dfa126f694b (patch)
tree6c21c2fdd9a66f8dfd983172864996d404ea7c93
parent3c42f6cbd8e58663beab110c5e8fbccbaefdaa91 (diff)
downloadrt.equinox.bundles-4eeba6c605109ad42773a1caa40e9dfa126f694b.tar.gz
rt.equinox.bundles-4eeba6c605109ad42773a1caa40e9dfa126f694b.tar.xz
rt.equinox.bundles-4eeba6c605109ad42773a1caa40e9dfa126f694b.zip
Bug 248139 secure store - Provide API to supress master password recovery dialog/ IProviderHints.PROMPT_USER ineffective
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java19
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageUtils.java15
-rw-r--r--bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java6
3 files changed, 20 insertions, 20 deletions
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java
index 7173247af..dad48d875 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java
@@ -14,7 +14,8 @@ import java.net.URL;
import javax.crypto.spec.PBEKeySpec;
import org.eclipse.equinox.internal.security.storage.friends.InternalExchangeUtils;
import org.eclipse.equinox.internal.security.ui.nls.SecUIMessages;
-import org.eclipse.equinox.security.storage.provider.*;
+import org.eclipse.equinox.security.storage.provider.IPreferencesContainer;
+import org.eclipse.equinox.security.storage.provider.PasswordProvider;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.window.Window;
import org.eclipse.ui.PlatformUI;
@@ -26,7 +27,7 @@ import org.eclipse.ui.PlatformUI;
public class DefaultPasswordProvider extends PasswordProvider {
public PBEKeySpec getPassword(IPreferencesContainer container, int passwordType) {
- if (!useUI(container))
+ if (!StorageUtils.showUI(container))
return null;
boolean newPassword = ((passwordType & CREATE_NEW_PASSWORD) != 0);
@@ -55,7 +56,7 @@ public class DefaultPasswordProvider extends PasswordProvider {
}
public boolean retryOnError(Exception e, IPreferencesContainer container) {
- if (!useUI(container))
+ if (!StorageUtils.showUI(container))
return false;
final Boolean[] result = new Boolean[1];
@@ -67,16 +68,4 @@ public class DefaultPasswordProvider extends PasswordProvider {
});
return result[0].booleanValue();
}
-
- private boolean useUI(IPreferencesContainer container) {
- if (!StorageUtils.showUI())
- return false;
- if (container.hasOption(IProviderHints.PROMPT_USER)) {
- Object promptHint = container.getOption(IProviderHints.PROMPT_USER);
- if (promptHint instanceof Boolean)
- return ((Boolean) promptHint).booleanValue();
- }
- return true;
- }
-
}
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageUtils.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageUtils.java
index 303036b18..4be2ad0b5 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageUtils.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/StorageUtils.java
@@ -11,6 +11,8 @@
package org.eclipse.equinox.internal.security.ui.storage;
import org.eclipse.equinox.internal.security.storage.friends.InternalExchangeUtils;
+import org.eclipse.equinox.security.storage.provider.IPreferencesContainer;
+import org.eclipse.equinox.security.storage.provider.IProviderHints;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
@@ -32,8 +34,17 @@ public class StorageUtils {
/**
* Determines if it is a good idea to show UI prompts
*/
- static public boolean showUI() {
- return runningUI() && !InternalExchangeUtils.isJUnitApp();
+ static public boolean showUI(IPreferencesContainer container) {
+ if (!runningUI() || InternalExchangeUtils.isJUnitApp())
+ return false;
+ if (container == null)
+ return true;
+ if (container.hasOption(IProviderHints.PROMPT_USER)) {
+ Object promptHint = container.getOption(IProviderHints.PROMPT_USER);
+ if (promptHint instanceof Boolean)
+ return ((Boolean) promptHint).booleanValue();
+ }
+ return true;
}
static public boolean runningUI() {
diff --git a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java
index 948406ec2..b1d259826 100644
--- a/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java
+++ b/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/UICallbackProvider.java
@@ -55,7 +55,7 @@ public class UICallbackProvider implements IUICallbacks {
}
public void setupPasswordRecovery(final int size, final String moduleID, final IPreferencesContainer container) {
- if (!StorageUtils.showUI())
+ if (!StorageUtils.showUI(container))
return;
UIJob reciverySetupJob = new UIJob(SecUIMessages.pswJobName) {
@@ -76,7 +76,7 @@ public class UICallbackProvider implements IUICallbacks {
}
public void execute(final IStorageTask callback) throws StorageException {
- if (!StorageUtils.showUI()) {
+ if (!StorageUtils.showUI(null)) {
callback.execute();
return;
}
@@ -126,7 +126,7 @@ public class UICallbackProvider implements IUICallbacks {
}
public Boolean ask(final String msg) {
- if (!StorageUtils.showUI())
+ if (!StorageUtils.showUI(null)) // container-independent operation
return null;
final Boolean[] result = new Boolean[1];

Back to the top