Project

General

Profile

« Previous | Next » 

Revision 0c8d552e

Added by Niels Hoffmann about 13 years ago

View differences:

eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java
37 37
import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
38 38
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
39 39
import eu.etaxonomy.taxeditor.navigation.internal.TaxeditorNavigationPlugin;
40
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
40 41
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
41 42
import eu.etaxonomy.taxeditor.preference.Resources;
42 43

  
......
50 51
 */
51 52
public class SearchBar extends WorkbenchWindowControlContribution{
52 53
	private Text text_search;
53
	private String srv;
54
	private String secondaryId;
54 55

  
55 56
	private final String defaultText = "Use \"*\" for wildcard searching";
56 57

  
......
200 201
	 * @param searchResult
201 202
	 */
202 203
	private void openSearchResultsView(ITaxonServiceConfigurator configurator) {
203
		// This variable is needed to address new instances of the view.
204
		srv += "1";
204
		boolean openResultInSeparateWindows = PreferencesUtil.getPreferenceStore().getBoolean((IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS));
205
		if(openResultInSeparateWindows){
206
			//increment change secondary id so it is unique 
207
			secondaryId += "1";
208
		}
205 209

  
206 210
		try {
207 211
			IViewPart resultsView = TaxeditorNavigationPlugin.getDefault()
208 212
					.getWorkbench().getActiveWorkbenchWindow()
209
					.getActivePage().showView(SearchResultView.ID, srv,
213
					.getActivePage().showView(SearchResultView.ID, secondaryId,
210 214
							IWorkbenchPage.VIEW_ACTIVATE);
211 215
			((SearchResultView) resultsView).performSearch(configurator);
212 216
		} catch (PartInitException e) {
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
10 10

  
11 11
package eu.etaxonomy.taxeditor.preference;
12 12

  
13
import eu.etaxonomy.cdm.model.common.IDefinedTerm;
13 14
import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
14 15

  
15 16
/**
......
112 113
	 * Whether the occurrence bulk editor should show {@link FieldObservation} objects
113 114
	 */
114 115
	public static final String BULK_EDITOR_OCCURRENCE_SHOW_FIELD_OBSERVATIONS = "eu.etaxonomy.taxeditor.bulkeditor.occurrence.showFieldObservations";
116

  
117
	public static final String SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS = "eu.etaxonomy.taxeditor.navigation.search.openResultInSeparateWindows";
115 118
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java
57 57
		addField(new BooleanFieldEditor(IPreferenceKeys.BULK_EDITOR_OCCURRENCE_SHOW_FIELD_OBSERVATIONS,
58 58
				"Show FieldObservations in Bulk Editor.",
59 59
				getFieldEditorParent()));
60
		addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS,
61
				"Open search results in separate windows", 
62
				getFieldEditorParent()));
60 63
	}
61 64

  
62 65
	/*
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizard.java
19 19
import eu.etaxonomy.cdm.model.common.User;
20 20
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
21 21
import eu.etaxonomy.taxeditor.store.CdmStore;
22
import eu.etaxonomy.taxeditor.store.StoreUtil;
22 23
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
23 24

  
24 25
/**
......
59 60
	public boolean performFinish() {
60 61
		ConversationHolder internalConversation = CdmStore.getLoginManager().getConversationHolder();
61 62
		internalConversation.bind();
62
		if(CdmStore.getLoginManager().isAdmin()){
63
			CdmStore.getService(IUserService.class).changePasswordForUser(user.getUsername(), passwordPage.getNewPassword());
64
		}else{
65
			CdmStore.getService(IUserService.class).changePassword(passwordPage.getOldPassword(), passwordPage.getNewPassword());
63
		try{
64
			if(CdmStore.getLoginManager().isAdmin()){
65
				CdmStore.getService(IUserService.class).changePasswordForUser(user.getUsername(), passwordPage.getNewPassword());
66
			}else{
67
				CdmStore.getService(IUserService.class).changePassword(passwordPage.getOldPassword(), passwordPage.getNewPassword());
68
			}
69
			internalConversation.commit();
70
			return true;
71
		}catch(Exception e){
72
			StoreUtil.errorDialog("Error while changing password", getClass(), "There was a problem changing the password.", e);
73
			return false;
74
		}finally{
75
			conversation.bind();
66 76
		}
67
		internalConversation.commit();
68
		conversation.bind();
69
		return true;
70 77
	}
71 78

  
72 79
	/* (non-Javadoc)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/password/PasswordWizardPage.java
69 69
		control.setLayout(CdmFormFactory.LAYOUT(2, false));
70 70
		WizardPageRootElement rootElement = new WizardPageRootElement(formFactory, control, getConversationHolder());
71 71
		
72
		text_oldPassword = formFactory.createTextWithLabelElement(rootElement, "Old Password", null, SWT.PASSWORD);
73
		
72
		if(!CdmStore.getLoginManager().isAdmin()){
73
			text_oldPassword = formFactory.createTextWithLabelElement(rootElement, "Old Password", null, SWT.PASSWORD);
74
		}
74 75
		text_password =  formFactory.createTextWithLabelElement(rootElement, "New Password", null, SWT.PASSWORD);
75 76
		text_passwordRepeat =  formFactory.createTextWithLabelElement(rootElement, "Repeat Password", null, SWT.PASSWORD);
76 77
		

Also available in: Unified diff