From c4b877864c457611616600392315cf4c79b81474 Mon Sep 17 00:00:00 2001 From: "n.hoffmann" Date: Wed, 8 Jul 2009 12:34:09 +0000 Subject: [PATCH] --- .../navigation/search/SearchBar.java | 212 +++++++++++++----- .../navigation/search/SearchResultView.java | 13 ++ .../taxeditor/dialogs/LoginDialog.java | 17 +- .../taxeditor/preference/PreferencesUtil.java | 57 ++++- .../etaxonomy/taxeditor/store/CdmStore.java | 16 ++ .../taxeditor/user/view/UserManagerView.java | 11 +- .../taxeditor/user/wizard/UserWizardPage.java | 53 ++++- 7 files changed, 306 insertions(+), 73 deletions(-) diff --git a/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java b/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java index aba36dd27..3a02dc2ac 100644 --- a/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java +++ b/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java @@ -14,25 +14,27 @@ import org.apache.log4j.Logger; import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusListener; -import org.eclipse.swt.events.KeyAdapter; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.layout.RowLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Menu; +import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; import org.eclipse.ui.IViewPart; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.PartInitException; import org.eclipse.ui.menus.WorkbenchWindowControlContribution; -import eu.etaxonomy.taxeditor.model.ImageResources; +import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator; import eu.etaxonomy.taxeditor.model.Resources; import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; +import eu.etaxonomy.taxeditor.preference.PreferencesUtil; /** * @author n.hoffmann @@ -42,31 +44,36 @@ import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin; public class SearchBar extends WorkbenchWindowControlContribution{ private static final Logger logger = Logger.getLogger(SearchBar.class); private Text text_search; - private Button button_search; private String srv; private String defaultText = "Use \"*\" for wildcard searching"; - private Button button_configure; + + final private ConfigurationSelectionListener configurationListener = new ConfigurationSelectionListener(); @Override protected Control createControl(Composite parent) { //parent.setLayout(new FillLayout()); Composite composite = new Composite(parent, SWT.NONE); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 3; - gridLayout.marginWidth = 0; - gridLayout.marginHeight = 0; - gridLayout.verticalSpacing = 0; - gridLayout.horizontalSpacing = 0; - composite.setLayout(gridLayout); + + final RowLayout layout = new RowLayout(); + layout.wrap = false; + layout.pack = true; + layout.justify = true; + layout.type = SWT.HORIZONTAL; + layout.marginLeft = 0; + layout.marginTop = 0; + layout.marginRight = 0; + layout.marginBottom = 0; + layout.spacing = 0; + composite.setLayout(layout); + // FIXME we have this here for debugging purposes, remove color once the layout of the search bar is correct composite.setBackground(Resources.getColor(Resources.SEARCH_VIEW_FOREGROUND)); - text_search = new Text(composite, SWT.SEARCH); - GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); - - text_search.setLayoutData(gridData); + // TODO for some reason the text_search composite has a margin when either SWT.BORDER or SWT.SEARCH + // is applied. I am not sure how to get rid of this. + text_search = new Text(composite, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION); text_search.setForeground(Resources.getColor(Resources.SEARCH_VIEW_FOREGROUND)); text_search.setText(defaultText); @@ -84,53 +91,148 @@ public class SearchBar extends WorkbenchWindowControlContribution{ } } }); - text_search.addKeyListener(new KeyAdapter() { - public void keyReleased(KeyEvent e) { - int key = e.keyCode; - if (key == SWT.CR) { - openSearchResultsView(text_search); - } else { - setSearchButtonEnabled(); - } - } - }); + - button_configure = new Button(composite, SWT.DROP_DOWN); - button_configure.setImage(ImageResources.getImage(ImageResources.MOVE_ICON)); + final ToolBar toolBar = new ToolBar(composite, SWT.NULL); - button_search = new Button(composite, SWT.PUSH); - button_search.setText("Search"); - button_search.setEnabled(false); - button_search.addMouseListener(new MouseAdapter() { - - // Populate search results resultsTable after clicking button - public void mouseUp(MouseEvent e) { - openSearchResultsView(text_search); - } - }); - return composite; - } + ToolItem toolItem = new ToolItem(toolBar, SWT.DROP_DOWN); + toolItem.setText("Search"); + + DropdownSelectionListener dropdownListener = new DropdownSelectionListener(toolItem); + + dropdownListener.add(SearchOption.TAXON); + dropdownListener.add(SearchOption.SYNONYM); + dropdownListener.add(SearchOption.NAME); + dropdownListener.add(SearchOption.COMMON_NAME); + + toolItem.addSelectionListener(dropdownListener); - protected void setSearchButtonEnabled() { - if (text_search.getText().length() == 0) { - button_search.setEnabled(false); - } else { - button_search.setEnabled(true); - } + + return composite; } - - private void openSearchResultsView(Text searchText) { - if(searchText.getText().length() > 0){ + + private void openSearchResultsView() { + if(text_search.getText().trim().length() > 0){ + + ITaxonServiceConfigurator configurator = configurationListener.getConfigurator(); + configurator.setSearchString(text_search.getText().trim()); + srv += "1"; logger.info("Opening search results window " + srv); try { IViewPart resultsView = TaxeditorNavigationPlugin.getDefault().getWorkbench() .getActiveWorkbenchWindow().getActivePage().showView(SearchResultView.ID, srv, IWorkbenchPage.VIEW_ACTIVATE); - ((SearchResultView) resultsView).performSearch(searchText.getText()); + ((SearchResultView) resultsView).performSearch(configurator); } catch (PartInitException e) { logger.error("Error opening search result.", e); } } } + + class DropdownSelectionListener extends SelectionAdapter { + + private Menu menu; + + public DropdownSelectionListener(ToolItem dropdown) { + menu = new Menu(dropdown.getParent().getShell()); + } + + public void add(SearchOption option) { + MenuItem menuItem = new MenuItem(menu, SWT.CHECK); + menuItem.setData(option); + menuItem.setText(option.getLabel()); + menuItem.setSelection(option.getPreference()); + menuItem.addSelectionListener(configurationListener); + } + + public void widgetSelected(SelectionEvent event) { + if (event.detail == SWT.ARROW) { + ToolItem item = (ToolItem) event.widget; + Rectangle rect = item.getBounds(); + Point pt = item.getParent().toDisplay(new Point(rect.x, rect.y)); + menu.setLocation(pt.x, pt.y + rect.height); + menu.setVisible(true); + } else { + openSearchResultsView(); + } + } + } + + class ConfigurationSelectionListener extends SelectionAdapter{ + + ITaxonServiceConfigurator configurator; + + /* (non-Javadoc) + * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent) + */ + public void widgetSelected(SelectionEvent e) { + logger.warn("configuration menu clicked"); + SearchOption option = (SearchOption) e.widget.getData(); + + if(option == SearchOption.TAXON){ + getConfigurator().setDoTaxa(configurator.isDoTaxa() ? false : true); + } + + if(option == SearchOption.SYNONYM){ + getConfigurator().setDoSynonyms(configurator.isDoSynonyms() ? false : true); + } + + if(option == SearchOption.NAME){ + getConfigurator().setDoNamesWithoutTaxa(configurator.isDoNamesWithoutTaxa() ? false : true); + } + + if(option == SearchOption.COMMON_NAME){ + getConfigurator().setDoTaxaByCommonNames(configurator.isDoTaxaByCommonNames() ? false : true); + } + saveConfigurator(); + } + + public ITaxonServiceConfigurator getConfigurator(){ + if(configurator == null){ + configurator = PreferencesUtil.getSearchConfigurator(); + } + return configurator; + } + + private void saveConfigurator(){ + PreferencesUtil.setSearchConfigurator(configurator); + this.configurator = PreferencesUtil.getSearchConfigurator(); + } + } + + enum SearchOption { + TAXON("Taxa"), + SYNONYM("Synonyms"), + NAME("Names (without taxa)"), + COMMON_NAME("Common Names"); + + private String label; + + private SearchOption(String label){ + this.label = label; + } + + public String getLabel(){ + return label; + } + + public boolean getPreference(){ + switch(this){ + case TAXON: + return PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_TAXA); + case SYNONYM: + return PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_SYNONYMS); + case NAME: + return PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_NAMES); + case COMMON_NAME: + return PreferencesUtil.getPreferenceStore().getBoolean(PreferencesUtil.TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES); + } + + return true; + } + + + + } } diff --git a/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java b/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java index ecf653ade..019c66524 100644 --- a/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java +++ b/taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java @@ -28,6 +28,7 @@ import org.eclipse.ui.part.ViewPart; import eu.etaxonomy.cdm.api.conversation.ConversationHolder; import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; +import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator; import eu.etaxonomy.cdm.model.common.IdentifiableEntity; import eu.etaxonomy.cdm.model.taxon.TaxonNode; import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; @@ -52,6 +53,8 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ private String queryString; private ConversationHolder conversation; + + private ITaxonServiceConfigurator configurator; /* (non-Javadoc) @@ -82,12 +85,22 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{ control.setMenu(menu); } + @Deprecated protected void performSearch(String queryString) { List searchResult = CdmStore.searchTaxaByName(queryString); resultViewer.setInput(searchResult); setPartName("Search: '" + queryString + "'"); } + + protected void performSearch(ITaxonServiceConfigurator configurator) { + List searchResult = CdmStore.findNames(configurator); + + resultViewer.setInput(searchResult); + setPartName("Search: '" + configurator.getSearchString() + "'"); + + this.configurator = configurator; + } /* (non-Javadoc) * @see org.eclipse.ui.part.WorkbenchPart#setFocus() diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/dialogs/LoginDialog.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/dialogs/LoginDialog.java index 01bbf5ed6..73f0abce5 100644 --- a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/dialogs/LoginDialog.java +++ b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/dialogs/LoginDialog.java @@ -42,11 +42,14 @@ public class LoginDialog extends Dialog { private static Text text_password; private static Text text_username; + private String title; + /** * @param parentShell */ public LoginDialog(Shell parentShell) { super(parentShell); + title = "Login"; } @@ -76,14 +79,24 @@ public class LoginDialog extends Dialog { passwordLabel.setText("Password"); // Textfield for the password - text_password = new Text(composite, SWT.BORDER); - text_password.setEchoChar('*'); + text_password = new Text(composite, SWT.PASSWORD | SWT.BORDER); text_password.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); return composite; } + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + */ + protected void configureShell(Shell shell) { + super.configureShell(shell); + if (title != null) { + shell.setText(title); + } + } /* (non-Javadoc) * @see org.eclipse.jface.dialogs.Dialog#okPressed() diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java index ca58fd53a..fe1ba4b8b 100644 --- a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java +++ b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java @@ -10,13 +10,14 @@ package eu.etaxonomy.taxeditor.preference; import java.util.ArrayList; -import java.util.HashSet; import java.util.List; import java.util.Set; import org.apache.log4j.Logger; import org.eclipse.jface.preference.IPreferenceStore; +import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator; +import eu.etaxonomy.cdm.api.service.config.impl.TaxonServiceConfiguratorImpl; import eu.etaxonomy.cdm.model.common.DefinedTermBase; import eu.etaxonomy.cdm.model.common.TermBase; import eu.etaxonomy.cdm.model.description.Feature; @@ -30,6 +31,7 @@ import eu.etaxonomy.cdm.model.name.Rank; import eu.etaxonomy.cdm.model.name.SpecimenTypeDesignationStatus; import eu.etaxonomy.cdm.model.name.ZoologicalName; import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; +import eu.etaxonomy.cdm.persistence.query.MatchMode; import eu.etaxonomy.taxeditor.model.Resources; import eu.etaxonomy.taxeditor.store.VocabularyStore; import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; @@ -44,6 +46,11 @@ public class PreferencesUtil { private static final Logger logger = Logger .getLogger(PreferencesUtil.class); + public static final String TAXON_SERVICE_CONFIGURATOR_TAXA = "TAXON_SERVICE_CONFIGURATOR_TAXA"; + public static final String TAXON_SERVICE_CONFIGURATOR_SYNONYMS = "TAXON_SERVICE_CONFIGURATOR_SYNONYMS"; + public static final String TAXON_SERVICE_CONFIGURATOR_NAMES = "TAXON_SERVICE_CONFIGURATOR_NAMES"; + public static final String TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES = "TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES"; + /** * * @return @@ -216,4 +223,52 @@ public class PreferencesUtil { . concat(".") . concat(term.getUuid().toString()); } + + /** + * Retrieves search preferences from the preference store + * + * @return an ITaxonServiceConfigurator to pass to search methods + */ + public static ITaxonServiceConfigurator getSearchConfigurator() { + ITaxonServiceConfigurator configurator = TaxonServiceConfiguratorImpl.NewInstance(); + // check for existence of at least one preference variable + if(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_TAXA)){ + // preferences exist + configurator.setDoTaxa(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_TAXA)); + configurator.setDoSynonyms(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_SYNONYMS)); + configurator.setDoNamesWithoutTaxa(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_NAMES)); + configurator.setDoTaxaByCommonNames(getPreferenceStore().getBoolean(TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES)); + }else{ + // create new preferences setting everything to true + configurator.setDoTaxa(true); + configurator.setDoSynonyms(true); + configurator.setDoNamesWithoutTaxa(true); + configurator.setDoTaxaByCommonNames(true); + setSearchConfigurator(configurator); + } + + // DEFAULT VALUES + // match mode default only + configurator.setMatchMode(MatchMode.BEGINNING); + // i don't know what happens to sec at the moment + configurator.setSec(null); + // we set page number and size here as this should always be unlimited + configurator.setPageNumber(0); + // TODO currently limit results to 1000 + configurator.setPageSize(1000); + + return configurator; + } + + /** + * Store search preferences + * + * @param configurator + */ + public static void setSearchConfigurator(ITaxonServiceConfigurator configurator){ + getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_TAXA, configurator.isDoTaxa()); + getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_SYNONYMS, configurator.isDoSynonyms()); + getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_NAMES, configurator.isDoNamesWithoutTaxa()); + getPreferenceStore().setValue(TAXON_SERVICE_CONFIGURATOR_COMMON_NAMES, configurator.isDoTaxaByCommonNames()); + } } diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java index 1b24924c2..69bc6504c 100644 --- a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java +++ b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java @@ -255,6 +255,7 @@ public class CdmStore{ return resultSet; } + @Deprecated private List findTaxaByName(String queryString, boolean restrictToTaxonObjs) { ITaxonServiceConfigurator configurator = new TaxonServiceConfiguratorImpl(); @@ -279,6 +280,21 @@ public class CdmStore{ return result; } + + + private List findTaxaByName(ITaxonServiceConfigurator configurator){ + + List result = getTaxonService().findTaxaAndNames(configurator).getRecords(); + + return result; + } + + public static List findNames(ITaxonServiceConfigurator configurator){ + return getDefault().findTaxaByName(configurator); + } + + + public static List searchTaxaByName(String queryString){ return getDefault().findTaxaByName(queryString, false); } diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/view/UserManagerView.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/view/UserManagerView.java index 5ca9a1f98..880e88512 100644 --- a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/view/UserManagerView.java +++ b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/view/UserManagerView.java @@ -63,19 +63,14 @@ public class UserManagerView extends ViewPart implements IConversationEnabled, I fillLayout.type = SWT.VERTICAL; parent.setLayout(fillLayout); - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - composite.setLayout(layout); + listViewer = new ListViewer(parent, SWT.MULTI | SWT.H_SCROLL + | SWT.V_SCROLL | SWT.FULL_SELECTION); - - listViewer = new ListViewer(composite); - Control control = listViewer.getControl(); - control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - // register context menu MenuManager menuMgr = new MenuManager(); menuMgr.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS)); getSite().registerContextMenu(menuMgr, listViewer); + Control control = listViewer.getControl(); Menu menu = menuMgr.createContextMenu(control); control.setMenu(menu); diff --git a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/wizard/UserWizardPage.java b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/wizard/UserWizardPage.java index f432f4658..1e2b48de5 100644 --- a/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/wizard/UserWizardPage.java +++ b/taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/user/wizard/UserWizardPage.java @@ -11,6 +11,7 @@ package eu.etaxonomy.taxeditor.user.wizard; import org.apache.log4j.Logger; +import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; @@ -34,6 +35,10 @@ import eu.etaxonomy.taxeditor.store.CdmStore; * @version 1.0 */ public class UserWizardPage extends WizardPage implements ModifyListener{ + + public static final String NAME = "USER_WIZARD_PAGE"; + + private Composite composite; private Text text_username; private Text text_oldPassword; @@ -46,11 +51,14 @@ public class UserWizardPage extends WizardPage implements ModifyListener{ private Text text_personLastName; private Text text_userEmail; + private IInputValidator uniqueUserNameValidator; + private IInputValidator passwordRepetitionEqualityValidator; + /** * @param pageName */ protected UserWizardPage(User user) { - super("USER_WIZARD_PAGE"); + super(NAME); this.user = user; @@ -62,8 +70,10 @@ public class UserWizardPage extends WizardPage implements ModifyListener{ }else{ setTitle("Edit existing user"); setDescription("Edit information for the selected user."); - - } + } + + uniqueUserNameValidator = new UniqueUserNameValidator(); + passwordRepetitionEqualityValidator = new PasswordRepetitionEqualityValidator(); } private static final Logger logger = Logger.getLogger(UserWizardPage.class); @@ -101,14 +111,15 @@ public class UserWizardPage extends WizardPage implements ModifyListener{ setControl(composite); + setPageComplete(false); + init(); } private void createPasswordFieldsEdit(Composite parent){ CLabel label_oldPassword = new CLabel(parent, SWT.NULL); label_oldPassword.setText("Old Password"); - text_oldPassword = new Text(parent, SWT.BORDER); - text_oldPassword.setEchoChar('*'); + text_oldPassword = new Text(parent, SWT.PASSWORD | SWT.BORDER); text_oldPassword.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); text_oldPassword.addModifyListener(this); @@ -119,8 +130,7 @@ public class UserWizardPage extends WizardPage implements ModifyListener{ CLabel label_password = new CLabel(parent, SWT.NULL); label_password.setText("Password"); - text_password = new Text(parent, SWT.BORDER); - text_password.setEchoChar('*'); + text_password = new Text(parent, SWT.PASSWORD | SWT.BORDER); text_password.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); text_password.addModifyListener(this); @@ -193,4 +203,33 @@ public class UserWizardPage extends WizardPage implements ModifyListener{ public User getUser() { return user; } + + private class UniqueUserNameValidator implements IInputValidator{ + + private static final String MESSAGE = "Username already exists"; + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String) + */ + public String isValid(String newText) { + // query for username + if( CdmStore.getUserService().loadUserByUsername(newText) != null){ + return MESSAGE; + } + + return null; + } + } + + private class PasswordRepetitionEqualityValidator implements IInputValidator{ + + /* (non-Javadoc) + * @see org.eclipse.jface.dialogs.IInputValidator#isValid(java.lang.String) + */ + public String isValid(String newText) { + // TODO Auto-generated method stub + return null; + } + + } } -- 2.34.1