Project

General

Profile

« Previous | Next » 

Revision 8ce2c6bd

Added by Katja Luther over 5 years ago

ref #3989: add preferred vocs to named area selection dialog

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SearchPreferences.java
34 34

  
35 35

  
36 36

  
37

  
38

  
37 39
    }
38 40

  
39 41
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NamedAreaSelectionDialog.java
32 32
import eu.etaxonomy.taxeditor.model.ImageResources;
33 33
import eu.etaxonomy.taxeditor.model.MessagingUtils;
34 34
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
35
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
35 36
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
36 37
import eu.etaxonomy.taxeditor.store.CdmStore;
37 38

  
......
95 96
	        String title, boolean multi, NamedArea namedArea, Object preferenceId, UUID... preselectedVocabularyUuids) {
96 97
		super(shell, //conversation,
97 98
		        title, multi, NamedAreaSelectionDialog.class.getCanonicalName(), namedArea);
98
//		this.preferenceID = preferenceId;
99

  
99 100
		preselectedVocabularies = new ArrayList<TermVocabulary>();
101
		if (preselectedVocabularyUuids == null || preselectedVocabularyUuids.length == 0){
102
		    preselectedVocabularyUuids = createVocabularyUuidList();
103
		}
100 104
		for(int i=0;i<preselectedVocabularyUuids.length;i++){
101 105
			TermVocabulary preselectedVocabulary = CdmStore.getService(IVocabularyService.class).find(preselectedVocabularyUuids[i]);
102 106
			preselectedVocabularies.add(preselectedVocabulary);
103 107
		}
104 108

  
105 109

  
106
		selectedVocabularies = createSelectedVocabularies();;
107
//		search;//re-init to consider pre-selected vocabularies
110
		selectedVocabularies = createSelectedVocabularies();
111

  
108 112
	}
109 113

  
110 114
    protected List<TermVocabulary> createSelectedVocabularies() {
......
118 122
        return tempSelectedVocabularies;
119 123
    }
120 124

  
121
	/** {@inheritDoc} */
122
//	@Override
123
//	protected void fillViewMenu(IMenuManager menuManager) {
124
//
125
////		super.fillViewMenu(menuManager);
126
//
127
//		for(TermVocabulary<NamedArea> vocabulary : getAvailableVocabularies()){
128
//			IncludeNamedAreaVocabulary action = new IncludeNamedAreaVocabulary(vocabulary);
129
//			menuManager.add(action);
130
//			if(preselectedVocabularies.contains(vocabulary)) {
131
//			    action.setChecked(true);
132
//			}
133
//			else{
134
//				action.setChecked(!PreferencesUtil.getPreferenceStore().getBoolean(getPrefKey(vocabulary)));
135
//			}
136
//		}
137
//	}
125
    private static UUID[] createVocabularyUuidList() {
126
        String preselectedVocString = PreferencesUtil.getPreferenceStore().getString(IPreferenceKeys.DISTRIBUTION_VOCABULARIES);
127
        String[] preselectedVocArray = preselectedVocString.split(";");
128
        UUID[] uuidList = new UUID[preselectedVocArray.length];
129
        int i = 0;
130
        for (String uuidString: preselectedVocArray){
131
            uuidList[i]= UUID.fromString(uuidString);
132
            i++;
133
        }
134
        return uuidList;
135
    }
136

  
138 137

  
139 138
	private String getPrefKey(TermVocabulary vocabulary){
140 139
		return "hide_"+NamedAreaSelectionDialog.class.getCanonicalName()+vocabulary.getUuid()+preferenceID;
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java
163 163
		    }
164 164
		    else if(parentElement instanceof CommonNameDetailElement ){
165 165
                return (T) CommonNameNamedAreaSelectionDialog.select(shell, //conversation,
166
                        (NamedArea) currentSelection, DerivedUnit.class.getCanonicalName());
166
                        (NamedArea) currentSelection, parentElement.getClass().getCanonicalName());
167 167
            }
168 168
		    else{
169 169
		        return (T) NamedAreaSelectionDialog.select(shell, //conversation,

Also available in: Unified diff