Index: src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java (working copy) @@ -13,5 +13,14 @@ import com.openshift.express.client.IUser; public interface IPasswordPrompter { - public String getPasswordFor(IUser user); + + /** + * Returns an array of values entered by the user. The first value in the + * returning array is the input password, the second value is the Boolean stating + * whether the password should be saved in the secured storage or not. + * + * @param user + * @return array with password value (as String) and 'save password' (as Boolean) + */ + public Object[] getPasswordFor(IUser user); } Index: src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java (working copy) @@ -22,8 +22,11 @@ public class UserDelegator implements IUser { private IUser delegate; - public UserDelegator(IUser user) { + private boolean rememberPassword; + + public UserDelegator(IUser user, boolean rememberPassword) { this.delegate = user; + this.rememberPassword = rememberPassword; } public String getRhlogin() { @@ -32,11 +35,21 @@ public String getPassword() { return delegate.getPassword(); } + + public boolean isRememberPassword() { + return rememberPassword; + } + protected void checkForPassword() { if( delegate.getPassword() == null || "".equals(delegate.getPassword())) { try { - String newPw = UserModel.promptForPassword(this); - delegate = UserModel.getDefault().createUser(delegate.getRhlogin(), newPw); + Object[] passwordAndSaveValues = UserModel.promptForPassword(this); + if(passwordAndSaveValues != null) { + final String password = (String) passwordAndSaveValues[0]; + delegate = UserModel.getDefault().createUser(delegate.getRhlogin(), password); + final Boolean save = (Boolean) passwordAndSaveValues[1]; + this.rememberPassword = save; + } } catch( Exception e ) { // TODO log handle everything } Index: src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java (working copy) @@ -15,6 +15,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.Map.Entry; import java.util.Set; import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue; @@ -31,8 +32,8 @@ import com.openshift.express.client.configuration.OpenShiftConfiguration; public class UserModel { - private static final String USER_ID = OpenShiftUIActivator.PLUGIN_ID + " " + - OpenShiftUIActivator.getDefault().getBundle().getVersion(); + private static final String USER_ID = OpenShiftUIActivator.PLUGIN_ID + " " + + OpenShiftUIActivator.getDefault().getBundle().getVersion(); private static UserModel model; public static UserModel getDefault() { @@ -42,16 +43,34 @@ } private static IPasswordPrompter prompter; + public static void setPasswordPrompt(IPasswordPrompter prompt) { - prompter =prompt; + prompter = prompt; + } + + public static IPasswordPrompter getPasswordPrompt() { + return prompter; } - public static String promptForPassword(IUser user) { + + /** + * Returns an array of values entered by the user. The first value in the + * returning array is the input password, the second value is the Boolean + * stating whether the password should be saved in the secured storage or + * not. + * + * @param user + * @return array with password value (as String) and 'save password' (as + * Boolean), or null if the password prompter could not be + * initialized + */ + + public static Object[] promptForPassword(IUser user) { return prompter == null ? null : prompter.getPasswordFor(user); } - + /** The most recent user connected on OpenShift. */ - private IUser recentUser = null; - private HashMap allUsers = new HashMap(); + private UserDelegator recentUser = null; + private HashMap allUsers = new HashMap(); private ArrayList listeners = new ArrayList(); public UserModel() { @@ -76,15 +95,14 @@ * @throws IOException */ public IUser createUser(String username, String password) throws OpenShiftException, IOException { - IUser u = new User(username, password, USER_ID); - return u; + return new User(username, password, USER_ID); } private static final int ADDED = 0; private static final int REMOVED = 1; private static final int CHANGED = 2; - public void addUser(IUser user) { + public void addUser(UserDelegator user) { allUsers.put(user.getRhlogin(), user); this.recentUser = user; fireModelChange(user, ADDED); @@ -118,21 +136,21 @@ } } - public IUser getRecentUser() { + public UserDelegator getRecentUser() { return recentUser; } - public void setRecentUser(IUser user) { + public void setRecentUser(UserDelegator user) { this.recentUser = user; } - public IUser findUser(String username) { + public UserDelegator findUser(String username) { return allUsers.get(username); } - public IUser[] getUsers() { - Collection c = allUsers.values(); - IUser[] rets = (IUser[]) c.toArray(new IUser[c.size()]); + public UserDelegator[] getUsers() { + Collection c = allUsers.values(); + UserDelegator[] rets = (UserDelegator[]) c.toArray(new UserDelegator[c.size()]); return rets; } @@ -140,14 +158,14 @@ * Load the user list from preferences and secure storage */ public void load() { - StringsPreferenceValue pref = new StringsPreferenceValue('|', RHLOGIN_LIST_PREFS_KEY, - OpenShiftUIActivator.PLUGIN_ID); + StringsPreferenceValue pref = new StringsPreferenceValue('|', + RHLOGIN_LIST_PREFS_KEY, OpenShiftUIActivator.PLUGIN_ID); String[] users = pref.get(); for (int i = 0; i < users.length; i++) { try { String password = getPasswordFromSecureStorage(users[i]); - IUser u = createUser(users[i], password); - addUser(new UserDelegator(u)); + UserDelegator u = new UserDelegator(createUser(users[i], password), password != null); + addUser(u); } catch (OpenShiftException ose) { // TODO } catch (IOException ioe) { @@ -164,15 +182,16 @@ // somewhere else Set set = allUsers.keySet(); String[] userList = (String[]) set.toArray(new String[set.size()]); - StringsPreferenceValue pref = new StringsPreferenceValue('|', RHLOGIN_LIST_PREFS_KEY, - OpenShiftUIActivator.PLUGIN_ID); + StringsPreferenceValue pref = new StringsPreferenceValue('|', + RHLOGIN_LIST_PREFS_KEY, OpenShiftUIActivator.PLUGIN_ID); pref.store(userList); - Iterator i = allUsers.values().iterator(); - IUser tmp; - while (i.hasNext()) { - tmp = i.next(); - setPasswordInSecureStorage(tmp.getRhlogin(), tmp.getPassword()); + for (Entry entry : allUsers.entrySet()) { + UserDelegator user = entry.getValue(); + if (user.isRememberPassword()) { + setPasswordInSecureStorage(user.getRhlogin(), + user.getPassword()); + } } } @@ -185,7 +204,8 @@ * @return */ public String getDefaultUsername() { - StringPreferenceValue pref = new StringPreferenceValue(RECENT_RHLOGIN_PREFS_KEY, OpenShiftUIActivator.PLUGIN_ID); + StringPreferenceValue pref = new StringPreferenceValue( + RECENT_RHLOGIN_PREFS_KEY, OpenShiftUIActivator.PLUGIN_ID); String rhLogin = null; rhLogin = pref.get(); if (rhLogin == null || rhLogin.length() == 0) { @@ -205,8 +225,8 @@ */ public boolean setDefaultUsername(String rhLogin) { String prev = getDefaultUsername(); - StringPreferenceValue preference = new StringPreferenceValue(RECENT_RHLOGIN_PREFS_KEY, - OpenShiftUIActivator.PLUGIN_ID); + StringPreferenceValue preference = new StringPreferenceValue( + RECENT_RHLOGIN_PREFS_KEY, OpenShiftUIActivator.PLUGIN_ID); if (rhLogin != null && !rhLogin.equals(prev)) { preference.store(rhLogin); return true; @@ -227,7 +247,9 @@ try { return store.getPassword(); } catch (SecurePasswordStoreException e) { - Logger.error("Failed to retrieve OpenShift user's password from Secured Store", e); + Logger.error( + "Failed to retrieve OpenShift user's password from Secured Store", + e); } } return null; @@ -251,10 +273,12 @@ /* * Return a secure store or null if platform is not found */ - private SecurePasswordStore getSecureStore(final String platform, final String username) { + private SecurePasswordStore getSecureStore(final String platform, + final String username) { if (platform == null) return null; - final OpenShiftPasswordStorageKey key = new OpenShiftPasswordStorageKey(platform, username); + final OpenShiftPasswordStorageKey key = new OpenShiftPasswordStorageKey( + platform, username); SecurePasswordStore store = new SecurePasswordStore(key); return store; } @@ -263,7 +287,9 @@ try { return new OpenShiftConfiguration().getLibraServer(); } catch (Exception e) { - Logger.error("Failed to load OpenShift configuration from client library", e); + Logger.error( + "Failed to load OpenShift configuration from client library", + e); } return null; } Index: src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java (working copy) @@ -23,10 +23,10 @@ import org.jboss.ide.eclipse.as.ui.editor.DeploymentTypeUIUtil.NewServerWizardBehaviourCallback; import org.jboss.tools.common.ui.WizardUtils; import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import org.jboss.tools.openshift.express.internal.core.console.UserModel; import com.openshift.express.client.IApplication; -import com.openshift.express.client.IUser; public class ExpressWizardFragment extends WizardFragment implements ICompletable { private ExpressDetailsComposite composite; @@ -69,7 +69,7 @@ public void performFinish(IProgressMonitor monitor) throws CoreException { super.performFinish(monitor); - IUser user = composite.getUser(); + UserDelegator user = composite.getUser(); UserModel.getDefault().addUser(user); IApplication app = composite.getApplication(); Index: src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java (working copy) @@ -60,6 +60,7 @@ import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyComboCommand; import org.jboss.ide.eclipse.as.ui.editor.ServerWorkingCopyPropertyCommand; import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import org.jboss.tools.openshift.express.internal.core.console.UserModel; import org.jboss.tools.openshift.express.internal.ui.wizard.ConnectToOpenShiftWizardModel; import org.jboss.tools.openshift.express.internal.ui.wizard.CredentialsWizardPageModel; @@ -67,7 +68,6 @@ import org.jboss.tools.openshift.express.internal.ui.wizard.OpenShiftExpressApplicationWizard; import com.openshift.express.client.IApplication; -import com.openshift.express.client.IUser; import com.openshift.express.client.OpenShiftException; public class ExpressDetailsComposite { @@ -97,7 +97,7 @@ protected boolean showVerify, showImportLink; private String user, pass, app, remote, deployProject, deployFolder; private IApplication fapplication; - private IUser fuser; + private UserDelegator fuser; private List appList; private String[] appListNames; private String error; @@ -143,7 +143,7 @@ private void initModelNewServerWizard() { // We're in a new server wizard. - IUser tmpUser = (IUser) callback.getAttribute(ExpressServerUtils.TASK_WIZARD_ATTR_USER); + UserDelegator tmpUser = (UserDelegator) callback.getAttribute(ExpressServerUtils.TASK_WIZARD_ATTR_USER); IApplication app = (IApplication) callback.getAttribute(ExpressServerUtils.TASK_WIZARD_ATTR_SELECTED_APP); if( tmpUser != null && app != null ) { @@ -561,7 +561,7 @@ }; } - private void updateModelForNewUser(IUser user) throws OpenShiftException { + private void updateModelForNewUser(UserDelegator user) throws OpenShiftException { // Updating the model, some long-running projectsPerApp.clear(); @@ -608,7 +608,7 @@ return app; } - public IUser getUser() { + public UserDelegator getUser() { return fuser; } Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java (working copy) @@ -10,22 +10,21 @@ ******************************************************************************/ package org.jboss.tools.openshift.express.internal.ui.wizard; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import org.jboss.tools.openshift.express.internal.core.console.UserModel; -import com.openshift.express.client.IUser; - /** * @author André Dietisheim */ public class ConnectToOpenShiftWizardModel implements IUserAwareModel { @Override - public IUser getUser() { + public UserDelegator getUser() { return UserModel.getDefault().getRecentUser(); } @Override - public IUser setUser(IUser user) { + public UserDelegator setUser(UserDelegator user) { UserModel.getDefault().addUser(user); return user; } Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java (working copy) @@ -3,7 +3,7 @@ */ package org.jboss.tools.openshift.express.internal.ui.wizard; -import com.openshift.express.client.IUser; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; /** * @author Xavier Coulon @@ -18,7 +18,7 @@ super(false, "New OpenShift Express Application"); } - public NewOpenShiftExpressApplicationWizard(IUser user) { + public NewOpenShiftExpressApplicationWizard(UserDelegator user) { super(user, null, null, false, "New OpenShift Express Application"); } } Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java (working copy) @@ -38,6 +38,7 @@ import org.jboss.tools.common.ui.DelegatingProgressMonitor; import org.jboss.tools.common.ui.JobUtils; import org.jboss.tools.common.ui.WizardUtils; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import org.jboss.tools.openshift.express.internal.ui.ImportFailedException; import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator; import org.jboss.tools.openshift.express.internal.ui.WontOverwriteException; @@ -54,7 +55,7 @@ */ public abstract class OpenShiftExpressApplicationWizard extends Wizard implements IImportWizard, INewWizard { - private IUser initialUser; + private UserDelegator initialUser; private OpenShiftExpressApplicationWizardModel wizardModel; @@ -62,7 +63,7 @@ this(null, null, null, useExistingApplication, wizardTitle); } - public OpenShiftExpressApplicationWizard(IUser user, IProject project, IApplication application, boolean useExistingApplication, String wizardTitle) { + public OpenShiftExpressApplicationWizard(UserDelegator user, IProject project, IApplication application, boolean useExistingApplication, String wizardTitle) { setWizardModel(new OpenShiftExpressApplicationWizardModel(user, project, application, useExistingApplication)); setWindowTitle(wizardTitle); setNeedsProgressMonitor(true); @@ -123,11 +124,11 @@ public void init(IWorkbench workbench, IStructuredSelection selection) { Object o = selection.getFirstElement(); if (o instanceof IUser) { - setUser((IUser) o); + setUser((UserDelegator) o); } } - protected void setUser(IUser user) { + protected void setUser(UserDelegator user) { getWizardModel().setUser(user); } @@ -147,7 +148,7 @@ return initialUser == null ? pages[0] : pages[1]; } - public void setInitialUser(IUser user) { + public void setInitialUser(UserDelegator user) { this.initialUser = user; } Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java (working copy) @@ -1,11 +1,11 @@ package org.jboss.tools.openshift.express.internal.ui.wizard; -import com.openshift.express.client.IUser; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; public interface IUserAwareModel { - public IUser getUser(); + public UserDelegator getUser(); - public IUser setUser(IUser user); + public UserDelegator setUser(UserDelegator user); } \ No newline at end of file Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java (working copy) @@ -21,6 +21,7 @@ import org.jboss.tools.common.ui.databinding.ObservableUIPojo; import org.jboss.tools.openshift.egit.core.EGitUtils; import org.jboss.tools.openshift.express.internal.core.behaviour.ExpressServerUtils; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import org.jboss.tools.openshift.express.internal.core.console.UserModel; import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages; import org.jboss.tools.openshift.express.internal.ui.wizard.appimport.ConfigureGitSharedProject; @@ -42,11 +43,7 @@ private static final int APP_CREATION_TIMEOUT = 120; private static final String KEY_SELECTED_EMBEDDABLE_CARTRIDGES = "selectedEmbeddableCartridges"; - public OpenShiftExpressApplicationWizardModel(IUser user) { - this(user, null, null, false); - } - - public OpenShiftExpressApplicationWizardModel(IUser user, IProject project, IApplication application, boolean useExistingApplication) { + public OpenShiftExpressApplicationWizardModel(UserDelegator user, IProject project, IApplication application, boolean useExistingApplication) { // default value(s) setUser(user); setProject(project); @@ -417,18 +414,18 @@ } @Override - public IUser getUser() { - return (IUser) getProperty(USER); + public UserDelegator getUser() { + return (UserDelegator) getProperty(USER); } @Override - public IUser setUser(IUser user) { - return (IUser) setProperty(USER, user); + public UserDelegator setUser(UserDelegator user) { + return (UserDelegator) setProperty(USER, user); } @Override public void addUserToModel() { - IUser user = getUser(); + UserDelegator user = getUser(); Assert.isNotNull(user); UserModel.getDefault().addUser(user); } Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java (working copy) @@ -4,9 +4,9 @@ package org.jboss.tools.openshift.express.internal.ui.wizard; import org.eclipse.core.resources.IProject; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import com.openshift.express.client.IApplication; -import com.openshift.express.client.IUser; /** * @author Xavier Coulon @@ -27,7 +27,7 @@ * @param project * @param application */ - public ImportOpenShiftExpressApplicationWizard(IUser user, IProject project, IApplication application) { + public ImportOpenShiftExpressApplicationWizard(UserDelegator user, IProject project, IApplication application) { super(user, project, application, true, "Import OpenShift Express Application"); } } Index: src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java (working copy) @@ -15,6 +15,7 @@ import org.eclipse.osgi.util.NLS; import org.jboss.tools.common.ui.databinding.ObservableUIPojo; import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import org.jboss.tools.openshift.express.internal.core.console.UserModel; import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator; import org.jboss.tools.openshift.express.internal.ui.utils.Logger; @@ -43,7 +44,7 @@ private String rhLogin; private String password; - private boolean rememberPassword; + private boolean rememberPassword = false; private IStatus credentialsStatus; private StringPreferenceValue rhLoginPreferenceValue; private final String libraServer; @@ -114,7 +115,7 @@ private void storePassword(IUser user) { try { - if (store != null) { + if (store != null ) { OpenShiftPasswordStorageKey key = new OpenShiftPasswordStorageKey(libraServer, user.getRhlogin()); store.update(key, password); } @@ -136,6 +137,7 @@ protected String getConfiguredUserName() { String configuredUsername = null; try { + // retrieved from the local 'express.conf' configuration file configuredUsername = new OpenShiftConfiguration().getRhlogin(); } catch (Exception e) { Logger.error("Cound not retrieve rhlogin from express configuration"); @@ -210,9 +212,9 @@ private IStatus getValidityStatus(String rhLogin, String password) { IStatus status = Status.OK_STATUS; - IUser user = null; + UserDelegator user = null; try { - user = UserModel.getDefault().createUser(getRhLogin(), getPassword()); + user = new UserDelegator(UserModel.getDefault().createUser(getRhLogin(), getPassword()), rememberPassword); if (user.isValid()) { storeUser(user); } else { @@ -229,7 +231,7 @@ return status; } - private void storeUser(IUser user) { + private void storeUser(UserDelegator user) { wizardModel.setUser(user); if (rememberPassword) { storePassword(user); Index: src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java (working copy) @@ -16,13 +16,13 @@ import org.eclipse.jface.viewers.TreePath; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Display; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator; import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages; import org.jboss.tools.openshift.express.internal.ui.wizard.ImportOpenShiftExpressApplicationWizard; import org.jboss.tools.openshift.express.internal.ui.wizard.OpenShiftExpressApplicationWizard; import com.openshift.express.client.IApplication; -import com.openshift.express.client.IUser; /** * @author Xavier Coulon @@ -40,7 +40,7 @@ if (selection instanceof ITreeSelection && treeSelection.getFirstElement() instanceof IApplication) { final IApplication application = (IApplication) treeSelection.getFirstElement(); - final IUser user = getUser(treeSelection.getPaths()); + final UserDelegator user = getUser(treeSelection.getPaths()); final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(application.getName()); OpenShiftExpressApplicationWizard wizard = new ImportOpenShiftExpressApplicationWizard(user, project, application); WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard); @@ -50,13 +50,13 @@ } } - private IUser getUser(TreePath[] paths) { - IUser user = null; + private UserDelegator getUser(TreePath[] paths) { + UserDelegator user = null; if( paths != null && paths.length == 1 ) { Object selection = paths[0].getParentPath().getLastSegment(); - if( selection instanceof IUser ) - user = (IUser) selection; + if( selection instanceof UserDelegator ) + user = (UserDelegator) selection; } return user; } Index: src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java (working copy) @@ -3,13 +3,12 @@ import org.eclipse.jface.viewers.ITreeSelection; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.swt.widgets.Shell; +import org.jboss.tools.openshift.express.internal.core.console.UserDelegator; import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator; import org.jboss.tools.openshift.express.internal.ui.messages.OpenShiftExpressUIMessages; import org.jboss.tools.openshift.express.internal.ui.wizard.NewOpenShiftExpressApplicationWizard; import org.jboss.tools.openshift.express.internal.ui.wizard.OpenShiftExpressApplicationWizard; -import com.openshift.express.client.IUser; - public class CreateApplicationAction extends AbstractAction { /** @@ -28,8 +27,8 @@ public void run() { if (selection != null && selection instanceof ITreeSelection ) { Object sel = ((ITreeSelection)selection).getFirstElement(); - if( sel instanceof IUser) { - IUser user = (IUser) sel; + if( sel instanceof UserDelegator) { + UserDelegator user = (UserDelegator) sel; OpenShiftExpressApplicationWizard wizard = new NewOpenShiftExpressApplicationWizard(user); new WizardDialog(new Shell(), wizard).open(); } Index: src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java =================================================================== --- src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java (revision 39283) +++ src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java (working copy) @@ -126,9 +126,8 @@ return ImageDescriptor.createFromURL(imageFileUrl); } - public String getPasswordFor(final IUser user) { - final String[] val =new String[1]; - val[0] = null; + public Object[] getPasswordFor(final IUser user) { + final Object[] val = new Object[2]; Display.getDefault().syncExec(new Runnable() { public void run() { Shell shell = Display.getDefault().getActiveShell(); @@ -137,9 +136,10 @@ d.setDescription("Provide enter the password for your express server"); if( d.open() == Window.OK) { val[0] = d.getPass(); + val[1] = d.getSave(); } } }); - return val[0]; + return val; } }