[jbosstools-commits] JBoss Tools SVN: r39321 - in trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal: core/console and 5 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Mar 6 17:45:02 EST 2012
Author: xcoulon
Date: 2012-03-06 17:45:00 -0500 (Tue, 06 Mar 2012)
New Revision: 39321
Added:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java
Removed:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPage.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
Log:
Fixed - JBIDE-11135
Non saved credentials are remembered even after Eclipse restart
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -24,7 +24,6 @@
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.egit.core.op.AddToIndexOperation;
import org.eclipse.egit.core.op.PushOperationResult;
-import org.eclipse.egit.ui.Activator;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.osgi.util.NLS;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/IPasswordPrompter.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -10,8 +10,22 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.core.console;
+import java.util.Map;
+
import com.openshift.express.client.IUser;
public interface IPasswordPrompter {
- public String getPasswordFor(IUser user);
+
+ public enum PromptResult {
+ PASSWORD_VALUE, SAVE_PASSWORD_VALUE;
+ }
+ /**
+ * Returns a map of the values entered by the user. The value indexed with {@link IPasswordPrompter.PromptResult.PASSWORD_VALUE} in the
+ * returning array is the input password, the value indexed with indexed with {@link IPasswordPrompter.PromptResult.SAVE_PASSWORD_VALUE} is the Boolean stating
+ * whether the password should be saved in the secured storage or not.
+ *
+ * @param user
+ * @return map with password value (as String) and 'save password' (as Boolean)
+ */
+ public Map<PromptResult, Object> getPasswordFor(IUser user);
}
Copied: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java (from rev 39191, trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java)
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java (rev 0)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegate.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.openshift.express.internal.core.console;
+
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.tools.openshift.express.internal.core.console.IPasswordPrompter.PromptResult;
+import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
+
+import com.openshift.express.client.IApplication;
+import com.openshift.express.client.ICartridge;
+import com.openshift.express.client.IDomain;
+import com.openshift.express.client.IEmbeddableCartridge;
+import com.openshift.express.client.ISSHPublicKey;
+import com.openshift.express.client.IUser;
+import com.openshift.express.client.OpenShiftException;
+
+public class UserDelegate implements IUser {
+ private IUser delegate;
+ private boolean rememberPassword;
+
+ public UserDelegate(IUser user, boolean rememberPassword) {
+ this.delegate = user;
+ this.rememberPassword = rememberPassword;
+ }
+
+ public String getRhlogin() {
+ return delegate.getRhlogin();
+ }
+ public String getPassword() {
+ return delegate.getPassword();
+ }
+
+ public boolean isRememberPassword() {
+ return rememberPassword;
+ }
+
+ protected void checkForPassword() {
+ if( delegate.getPassword() == null || "".equals(delegate.getPassword())) {
+ try {
+ Map<PromptResult, Object> passwordAndSaveValues = UserModel.promptForPassword(this);
+ if(passwordAndSaveValues != null) {
+ final String password = (String) passwordAndSaveValues.get(PromptResult.PASSWORD_VALUE);
+ delegate = UserModel.getDefault().createUser(delegate.getRhlogin(), password);
+ final Boolean save = (Boolean) passwordAndSaveValues.get(PromptResult.SAVE_PASSWORD_VALUE);
+ this.rememberPassword = save;
+ }
+ } catch( Exception e ) {
+ Logger.error("Failed to retrieve User's password", e);
+ }
+ }
+ }
+
+ public IApplication createApplication(String arg0, ICartridge arg1)
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.createApplication(arg0, arg1);
+ }
+
+ public IDomain createDomain(String arg0, ISSHPublicKey arg1)
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.createDomain(arg0, arg1);
+ }
+ public IApplication getApplicationByName(String arg0)
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.getApplicationByName(arg0);
+ }
+ public List<IApplication> getApplications() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getApplications();
+ }
+ public List<IApplication> getApplicationsByCartridge(ICartridge arg0)
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.getApplicationsByCartridge(arg0);
+ }
+ public String getAuthIV() {
+ checkForPassword();
+ return delegate.getAuthIV();
+ }
+ public String getAuthKey() {
+ checkForPassword();
+ return delegate.getAuthKey();
+ }
+ public ICartridge getCartridgeByName(String arg0) throws OpenShiftException {
+ checkForPassword();
+ return delegate.getCartridgeByName(arg0);
+ }
+ public List<ICartridge> getCartridges() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getCartridges();
+ }
+ public IDomain getDomain() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getDomain();
+ }
+ public List<IEmbeddableCartridge> getEmbeddableCartridges()
+ throws OpenShiftException {
+ checkForPassword();
+ return delegate.getEmbeddableCartridges();
+ }
+ public ISSHPublicKey getSshKey() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getSshKey();
+ }
+ public String getUUID() throws OpenShiftException {
+ checkForPassword();
+ return delegate.getUUID();
+ }
+ public boolean hasApplication(String arg0) throws OpenShiftException {
+ checkForPassword();
+ return delegate.hasApplication(arg0);
+ }
+ public boolean hasApplication(ICartridge arg0) throws OpenShiftException {
+ checkForPassword();
+ return delegate.hasApplication(arg0);
+ }
+ public boolean hasDomain() throws OpenShiftException {
+ checkForPassword();
+ return delegate.hasDomain();
+ }
+ public boolean isValid() throws OpenShiftException {
+ checkForPassword();
+ return delegate.isValid();
+ }
+ public void refresh() throws OpenShiftException {
+ checkForPassword();
+ delegate.refresh();
+ }
+}
Deleted: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserDelegator.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.openshift.express.internal.core.console;
-
-import java.util.List;
-
-import com.openshift.express.client.IApplication;
-import com.openshift.express.client.ICartridge;
-import com.openshift.express.client.IDomain;
-import com.openshift.express.client.IEmbeddableCartridge;
-import com.openshift.express.client.ISSHPublicKey;
-import com.openshift.express.client.IUser;
-import com.openshift.express.client.OpenShiftException;
-
-public class UserDelegator implements IUser {
- private IUser delegate;
- public UserDelegator(IUser user) {
- this.delegate = user;
- }
-
- public String getRhlogin() {
- return delegate.getRhlogin();
- }
- public String getPassword() {
- return delegate.getPassword();
- }
- protected void checkForPassword() {
- if( delegate.getPassword() == null || "".equals(delegate.getPassword())) {
- try {
- String newPw = UserModel.promptForPassword(this);
- delegate = UserModel.getDefault().createUser(delegate.getRhlogin(), newPw);
- } catch( Exception e ) {
- // TODO log handle everything
- }
- }
- }
-
- public IApplication createApplication(String arg0, ICartridge arg1)
- throws OpenShiftException {
- checkForPassword();
- return delegate.createApplication(arg0, arg1);
- }
-
- public IDomain createDomain(String arg0, ISSHPublicKey arg1)
- throws OpenShiftException {
- checkForPassword();
- return delegate.createDomain(arg0, arg1);
- }
- public IApplication getApplicationByName(String arg0)
- throws OpenShiftException {
- checkForPassword();
- return delegate.getApplicationByName(arg0);
- }
- public List<IApplication> getApplications() throws OpenShiftException {
- checkForPassword();
- return delegate.getApplications();
- }
- public List<IApplication> getApplicationsByCartridge(ICartridge arg0)
- throws OpenShiftException {
- checkForPassword();
- return delegate.getApplicationsByCartridge(arg0);
- }
- public String getAuthIV() {
- checkForPassword();
- return delegate.getAuthIV();
- }
- public String getAuthKey() {
- checkForPassword();
- return delegate.getAuthKey();
- }
- public ICartridge getCartridgeByName(String arg0) throws OpenShiftException {
- checkForPassword();
- return delegate.getCartridgeByName(arg0);
- }
- public List<ICartridge> getCartridges() throws OpenShiftException {
- checkForPassword();
- return delegate.getCartridges();
- }
- public IDomain getDomain() throws OpenShiftException {
- checkForPassword();
- return delegate.getDomain();
- }
- public List<IEmbeddableCartridge> getEmbeddableCartridges()
- throws OpenShiftException {
- checkForPassword();
- return delegate.getEmbeddableCartridges();
- }
- public ISSHPublicKey getSshKey() throws OpenShiftException {
- checkForPassword();
- return delegate.getSshKey();
- }
- public String getUUID() throws OpenShiftException {
- checkForPassword();
- return delegate.getUUID();
- }
- public boolean hasApplication(String arg0) throws OpenShiftException {
- checkForPassword();
- return delegate.hasApplication(arg0);
- }
- public boolean hasApplication(ICartridge arg0) throws OpenShiftException {
- checkForPassword();
- return delegate.hasApplication(arg0);
- }
- public boolean hasDomain() throws OpenShiftException {
- checkForPassword();
- return delegate.hasDomain();
- }
- public boolean isValid() throws OpenShiftException {
- checkForPassword();
- return delegate.isValid();
- }
- public void refresh() throws OpenShiftException {
- checkForPassword();
- delegate.refresh();
- }
-}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/core/console/UserModel.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -15,10 +15,13 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue;
import org.jboss.tools.common.ui.preferencevalue.StringsPreferenceValue;
+import org.jboss.tools.openshift.express.internal.core.console.IPasswordPrompter.PromptResult;
import org.jboss.tools.openshift.express.internal.ui.OpenShiftUIActivator;
import org.jboss.tools.openshift.express.internal.ui.utils.Logger;
import org.jboss.tools.openshift.express.internal.ui.utils.OpenShiftPasswordStorageKey;
@@ -45,13 +48,29 @@
public static void setPasswordPrompt(IPasswordPrompter prompt) {
prompter =prompt;
}
- public static String promptForPassword(IUser user) {
+
+ public static IPasswordPrompter getPasswordPrompt() {
+ return prompter;
+ }
+
+ /**
+ * Returns a map of the values entered by the user. The value indexed with {@link IPasswordPrompter.PromptResult.PASSWORD_VALUE} in the
+ * returning array is the input password, the value indexed with indexed with {@link IPasswordPrompter.PromptResult.SAVE_PASSWORD_VALUE} is the Boolean stating
+ * whether the password should be saved in the secured storage or not.
+ *
+ * @param user
+ * @return map with password value (as String) and 'save password' (as
+ * Boolean), or null if the password prompter could not be
+ * initialized
+ */
+
+ public static Map<PromptResult, Object> promptForPassword(IUser user) {
return prompter == null ? null : prompter.getPasswordFor(user);
}
-
+
/** The most recent user connected on OpenShift. */
- private IUser recentUser = null;
- private HashMap<String, IUser> allUsers = new HashMap<String, IUser>();
+ private UserDelegate recentUser = null;
+ private HashMap<String, UserDelegate> allUsers = new HashMap<String, UserDelegate>();
private ArrayList<IUserModelListener> listeners = new ArrayList<IUserModelListener>();
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(UserDelegate user) {
allUsers.put(user.getRhlogin(), user);
this.recentUser = user;
fireModelChange(user, ADDED);
@@ -118,21 +136,21 @@
}
}
- public IUser getRecentUser() {
+ public UserDelegate getRecentUser() {
return recentUser;
}
- public void setRecentUser(IUser user) {
+ public void setRecentUser(UserDelegate user) {
this.recentUser = user;
}
- public IUser findUser(String username) {
+ public UserDelegate findUser(String username) {
return allUsers.get(username);
}
- public IUser[] getUsers() {
- Collection<IUser> c = allUsers.values();
- IUser[] rets = (IUser[]) c.toArray(new IUser[c.size()]);
+ public UserDelegate[] getUsers() {
+ Collection<UserDelegate> c = allUsers.values();
+ UserDelegate[] rets = (UserDelegate[]) c.toArray(new UserDelegate[c.size()]);
return rets;
}
@@ -146,8 +164,8 @@
for (int i = 0; i < users.length; i++) {
try {
String password = getPasswordFromSecureStorage(users[i]);
- IUser u = createUser(users[i], password);
- addUser(new UserDelegator(u));
+ UserDelegate u = new UserDelegate(createUser(users[i], password), password != null);
+ addUser(u);
} catch (OpenShiftException ose) {
// TODO
} catch (IOException ioe) {
@@ -168,11 +186,12 @@
OpenShiftUIActivator.PLUGIN_ID);
pref.store(userList);
- Iterator<IUser> i = allUsers.values().iterator();
- IUser tmp;
- while (i.hasNext()) {
- tmp = i.next();
- setPasswordInSecureStorage(tmp.getRhlogin(), tmp.getPassword());
+ for (Entry<String, UserDelegate> entry : allUsers.entrySet()) {
+ UserDelegate user = entry.getValue();
+ if (user.isRememberPassword()) {
+ setPasswordInSecureStorage(user.getRhlogin(),
+ user.getPassword());
+ }
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/OpenShiftUIActivator.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -1,6 +1,8 @@
package org.jboss.tools.openshift.express.internal.ui;
import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
@@ -126,9 +128,8 @@
return ImageDescriptor.createFromURL(imageFileUrl);
}
- public String getPasswordFor(final IUser user) {
- final String[] val =new String[1];
- val[0] = null;
+ public Map<PromptResult, Object> getPasswordFor(final IUser user) {
+ final Map<PromptResult, Object> val = new HashMap<PromptResult, Object>();
Display.getDefault().syncExec(new Runnable() {
public void run() {
Shell shell = Display.getDefault().getActiveShell();
@@ -136,10 +137,11 @@
d.setCanModifyUser(false);
d.setDescription("Provide enter the password for your express server");
if( d.open() == Window.OK) {
- val[0] = d.getPass();
+ val.put(PromptResult.PASSWORD_VALUE, d.getPass());
+ val.put(PromptResult.SAVE_PASSWORD_VALUE, d.getSave());
}
}
});
- return val[0];
+ return val;
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/CreateApplicationAction.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -13,13 +13,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.UserDelegate;
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;
-
/**
* @author Xavier Coulon
*/
@@ -41,8 +40,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 UserDelegate) {
+ UserDelegate user = (UserDelegate) sel;
OpenShiftExpressApplicationWizard wizard = new NewOpenShiftExpressApplicationWizard(user);
new WizardDialog(new Shell(), wizard).open();
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/action/ImportApplicationAction.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
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 UserDelegate 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 UserDelegate getUser(TreePath[] paths) {
+ UserDelegate user = null;
if( paths != null
&& paths.length == 1 ) {
Object selection = paths[0].getParentPath().getLastSegment();
- if( selection instanceof IUser )
- user = (IUser) selection;
+ if( selection instanceof UserDelegate )
+ user = (UserDelegate) selection;
}
return user;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressDetailsComposite.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
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 UserDelegate fuser;
private List<IApplication> 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);
+ UserDelegate tmpUser = (UserDelegate) 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(UserDelegate user) throws OpenShiftException {
// Updating the model, some long-running
projectsPerApp.clear();
@@ -608,7 +608,7 @@
return app;
}
- public IUser getUser() {
+ public UserDelegate getUser() {
return fuser;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/behaviour/ExpressWizardFragment.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
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();
+ UserDelegate user = composite.getUser();
UserModel.getDefault().addUser(user);
IApplication app = composite.getApplication();
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleRemoveAction.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -1,7 +1,5 @@
package org.jboss.tools.openshift.express.internal.ui.console;
-import java.security.Policy;
-
import org.eclipse.jface.action.Action;
public class ConsoleRemoveAction extends Action {
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/console/ConsoleTypePropertyTester.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -3,9 +3,11 @@
*/
package org.jboss.tools.openshift.express.internal.ui.console;
+import static org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils.CONSOLE_TYPE_KEY;
+import static org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils.CONSOLE_TYPE_VALUE;
+
import org.eclipse.core.expressions.PropertyTester;
import org.eclipse.ui.console.MessageConsole;
-import static org.jboss.tools.openshift.express.internal.ui.console.ConsoleUtils.*;
/**
* Property tester used to verify that the given instance of
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ConnectToOpenShiftWizardModel.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -10,22 +10,21 @@
******************************************************************************/
package org.jboss.tools.openshift.express.internal.ui.wizard;
+import org.jboss.tools.openshift.express.internal.core.console.UserDelegate;
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 UserDelegate getUser() {
return UserModel.getDefault().getRecentUser();
}
@Override
- public IUser setUser(IUser user) {
+ public UserDelegate setUser(UserDelegate user) {
UserModel.getDefault().addUser(user);
return user;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/CredentialsWizardPageModel.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
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;
+ UserDelegate user = null;
try {
- user = UserModel.getDefault().createUser(getRhLogin(), getPassword());
+ user = new UserDelegate(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(UserDelegate user) {
wizardModel.setUser(user);
if (rememberPassword) {
storePassword(user);
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPage.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPage.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EditDomainWizardPage.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -28,7 +28,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.common.ui.databinding.DataBindingUtils;
import org.jboss.tools.common.ui.databinding.ParametrizableWizardPageSupport;
import org.jboss.tools.common.ui.databinding.ValueBindingBuilder;
import org.jboss.tools.openshift.express.internal.ui.utils.StringUtils;
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/IUserAwareModel.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
public interface IUserAwareModel {
- public IUser getUser();
+ public UserDelegate getUser();
- public IUser setUser(IUser user);
+ public UserDelegate setUser(UserDelegate user);
}
\ No newline at end of file
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ImportOpenShiftExpressApplicationWizard.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
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(UserDelegate user, IProject project, IApplication application) {
super(user, project, application, true, "Import OpenShift Express Application");
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/NewOpenShiftExpressApplicationWizard.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
/**
* @author Xavier Coulon
@@ -18,7 +18,7 @@
super(false, "New OpenShift Express Application");
}
- public NewOpenShiftExpressApplicationWizard(IUser user) {
+ public NewOpenShiftExpressApplicationWizard(UserDelegate user) {
super(user, null, null, false, "New OpenShift Express Application");
}
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizard.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
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,15 +55,14 @@
*/
public abstract class OpenShiftExpressApplicationWizard extends Wizard implements IImportWizard, INewWizard {
- private IUser initialUser;
+ private UserDelegate initialUser;
private OpenShiftExpressApplicationWizardModel wizardModel;
public OpenShiftExpressApplicationWizard(boolean useExistingApplication, String wizardTitle) {
this(null, null, null, useExistingApplication, wizardTitle);
}
-
- public OpenShiftExpressApplicationWizard(IUser user, IProject project, IApplication application, boolean useExistingApplication, String wizardTitle) {
+ public OpenShiftExpressApplicationWizard(UserDelegate user, IProject project, IApplication application, boolean useExistingApplication, String wizardTitle) {
setWizardModel(new OpenShiftExpressApplicationWizardModel(user, project, application, useExistingApplication));
setWindowTitle(wizardTitle);
setNeedsProgressMonitor(true);
@@ -123,11 +123,11 @@
public void init(IWorkbench workbench, IStructuredSelection selection) {
Object o = selection.getFirstElement();
if (o instanceof IUser) {
- setUser((IUser) o);
+ setUser((UserDelegate) o);
}
}
- protected void setUser(IUser user) {
+ protected void setUser(UserDelegate user) {
getWizardModel().setUser(user);
}
@@ -147,7 +147,7 @@
return initialUser == null ? pages[0] : pages[1];
}
- public void setInitialUser(IUser user) {
+ public void setInitialUser(UserDelegate user) {
this.initialUser = user;
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-03-06 22:44:20 UTC (rev 39320)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/OpenShiftExpressApplicationWizardModel.java 2012-03-06 22:45:00 UTC (rev 39321)
@@ -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.UserDelegate;
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,11 @@
private static final int APP_CREATION_TIMEOUT = 120;
private static final String KEY_SELECTED_EMBEDDABLE_CARTRIDGES = "selectedEmbeddableCartridges";
- public OpenShiftExpressApplicationWizardModel(IUser user) {
+ public OpenShiftExpressApplicationWizardModel(UserDelegate user) {
this(user, null, null, false);
}
- public OpenShiftExpressApplicationWizardModel(IUser user, IProject project, IApplication application, boolean useExistingApplication) {
+ public OpenShiftExpressApplicationWizardModel(UserDelegate user, IProject project, IApplication application, boolean useExistingApplication) {
// default value(s)
setUser(user);
setProject(project);
@@ -417,18 +418,18 @@
}
@Override
- public IUser getUser() {
- return (IUser) getProperty(USER);
+ public UserDelegate getUser() {
+ return (UserDelegate) getProperty(USER);
}
@Override
- public IUser setUser(IUser user) {
- return (IUser) setProperty(USER, user);
+ public UserDelegate setUser(UserDelegate user) {
+ return (UserDelegate) setProperty(USER, user);
}
@Override
public void addUserToModel() {
- IUser user = getUser();
+ UserDelegate user = getUser();
Assert.isNotNull(user);
UserModel.getDefault().addUser(user);
}
More information about the jbosstools-commits
mailing list