Skip to content

Commit

Permalink
Moved the "Account already exits"-message dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
KlasJoensson committed Aug 22, 2012
1 parent 9a4d6aa commit 1b543aa
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 15 deletions.
Expand Up @@ -324,21 +324,21 @@ public boolean createAccount() {

return false;
}
Collection<Account> accounts = sandbox.getLoggedInUser().getAccounts().values();
Iterator<Account> itr = accounts.iterator();
Account account;
while (itr.hasNext()) {
account = itr.next();
if ( account.getAccountType().equals( accountType ) ) {
MessageDialog.openInformation( PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getShell(),
"Account type already used",
"There is already an account of " +
"that type." );
return false;
}
}
// Collection<Account> accounts = sandbox.getLoggedInUser().getAccounts().values();
// Iterator<Account> itr = accounts.iterator();
// Account account;
// while (itr.hasNext()) {
// account = itr.next();
// if ( account.getAccountType().equals( accountType ) ) {
// MessageDialog.openInformation( PlatformUI.getWorkbench()
// .getActiveWorkbenchWindow()
// .getShell(),
// "Account type already used",
// "There is already an account of " +
// "that type." );
// return false;
// }
// }

int i = 0;
HashMap<String, String> properties = new HashMap<String, String>();
Expand Down
Expand Up @@ -10,11 +10,14 @@
******************************************************************************/
package net.bioclipse.usermanager;

import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;

import net.bioclipse.usermanager.business.IUserManager;
import net.bioclipse.usermanager.dialogs.CreateUserDialog;

import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.window.Window;
Expand Down Expand Up @@ -102,6 +105,22 @@ public boolean performFinish() {
usermanager.logIn(loginPage.getUsername(), loginPage.getPassword());
}

Collection<Account> accounts = sandbox.getLoggedInUser().getAccounts().values();
Iterator<Account> itr = accounts.iterator();
Account account;
while (itr.hasNext()) {
account = itr.next();
if ( account.getAccountType().equals( addAccountPage.getAccountType() ) ) {
MessageDialog.openInformation( PlatformUI.getWorkbench()
.getActiveWorkbenchWindow()
.getShell(),
"Account type already used",
"There is already an account of " +
"that type." );
return false;
}
}

if (addAccountPage.createAccount()) {
if (usermanager != null)
usermanager.switchUserContainer( sandbox );
Expand Down

0 comments on commit 1b543aa

Please sign in to comment.