Obsolete see: 18 steps to avoid Eclipse Security password paranoic
It's necessary to remember of the security storage's password for first use of cvs plugin of eclipse if you use linux.This issue because the security storage plugin don't save password.
If you want save password of security storage you can modify source of plugin "equinox.security.ui" like below:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Eclipse Workspace Patch 1.0 | |
#P org.eclipse.equinox.security.ui | |
Index: src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java | |
=================================================================== | |
RCS file: /cvsroot/rt/org.eclipse.equinox/security/bundles/org.eclipse.equinox.security.ui/src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java,v | |
retrieving revision 1.7 | |
diff -u -r1.7 DefaultPasswordProvider.java | |
--- src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java 26 Sep 2008 15:20:59 -0000 1.7 | |
+++ src/org/eclipse/equinox/internal/security/ui/storage/DefaultPasswordProvider.java 22 Nov 2010 22:15:50 -0000 | |
@@ -10,10 +10,13 @@ | |
*******************************************************************************/ | |
package org.eclipse.equinox.internal.security.ui.storage; | |
+import java.io.IOException; | |
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.ISecurePreferences; | |
+import org.eclipse.equinox.security.storage.StorageException; | |
import org.eclipse.equinox.security.storage.provider.IPreferencesContainer; | |
import org.eclipse.equinox.security.storage.provider.PasswordProvider; | |
import org.eclipse.jface.dialogs.MessageDialog; | |
@@ -41,17 +44,45 @@ | |
location = null; | |
} | |
- final StorageLoginDialog loginDialog = new StorageLoginDialog(newPassword, passwordChange, location); | |
+ ISecurePreferences node = container.getPreferences().node(IStorageConst.PROVIDER_NODE); | |
+ String password = null; | |
+ try { | |
+ password = node.get("password", null); | |
+ } catch (StorageException e1) { | |
+ } | |
final PBEKeySpec[] result = new PBEKeySpec[1]; | |
+ | |
+ if (password != null) { | |
+ result[0] = new PBEKeySpec(password.toCharArray()); | |
+ return result[0]; | |
+ } | |
+ | |
+ final StorageLoginDialog loginDialog = new StorageLoginDialog(newPassword, passwordChange, location); | |
+ | |
PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() { | |
public void run() { | |
- if (loginDialog.open() == Window.OK) | |
+ if (loginDialog.open() == Window.OK) { | |
result[0] = loginDialog.getGeneratedPassword(); | |
- else | |
+ } else { | |
result[0] = null; | |
+ } | |
+ | |
} | |
+ | |
}); | |
+ | |
+ if (result[0] != null) { | |
+ try { | |
+ node.put("password", new String(result[0].getPassword()), false); | |
+ node.flush(); | |
+ } catch (StorageException e) { | |
+ return null; | |
+ } catch (IOException e) { | |
+ return null; | |
+ } | |
+ | |
+ } | |
return result[0]; | |
} | |
A special thanks to ErMandrake for his technical and moral support.
3 commenti:
great job! every time we will use CVS we thanks you!
you're the No1 ;-)
Good grief !!! You mean that I, as a humble developer that just needs to get the job done, have to modify the whole crap like that ?@!?!(^%(&^%
Good Lord, have pity on us, o mighty Eclipse
Posta un commento