Revision 4afd70fc
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/FilterDialog.java | ||
---|---|---|
13 | 13 |
import java.util.List; |
14 | 14 |
|
15 | 15 |
import org.eclipse.jface.dialogs.Dialog; |
16 |
import org.eclipse.jface.dialogs.IDialogConstants; |
|
16 | 17 |
import org.eclipse.swt.SWT; |
17 | 18 |
import org.eclipse.swt.events.SelectionEvent; |
18 | 19 |
import org.eclipse.swt.events.SelectionListener; |
... | ... | |
40 | 41 |
|
41 | 42 |
List<TermVocabulary> selectedVocabularies = new ArrayList<TermVocabulary>(); |
42 | 43 |
List<TermVocabulary> tempSelectedVocabularies = new ArrayList<TermVocabulary>(); |
44 |
boolean performOk = true; |
|
43 | 45 |
|
44 | 46 |
Object preferenceId; |
45 | 47 |
|
... | ... | |
54 | 56 |
this.tempSelectedVocabularies = new ArrayList(); |
55 | 57 |
this.tempSelectedVocabularies.addAll(selectedVocabularies); |
56 | 58 |
|
59 |
|
|
57 | 60 |
} |
58 | 61 |
|
59 | 62 |
@Override |
... | ... | |
77 | 80 |
if (btnCheckButton.getSelection()){ |
78 | 81 |
if (!tempSelectedVocabularies.contains(btnCheckButton.getData())){ |
79 | 82 |
tempSelectedVocabularies.add((TermVocabulary)btnCheckButton.getData()); |
83 |
if (!tempSelectedVocabularies.isEmpty()) { |
|
84 |
getButton(IDialogConstants.OK_ID).setEnabled(true); |
|
85 |
} |
|
80 | 86 |
} |
81 | 87 |
}else{ |
82 | 88 |
if (tempSelectedVocabularies.contains(btnCheckButton.getData())){ |
83 | 89 |
tempSelectedVocabularies.remove(btnCheckButton.getData()); |
90 |
if (tempSelectedVocabularies.isEmpty()) { |
|
91 |
getButton(IDialogConstants.OK_ID).setEnabled(false); |
|
92 |
} |
|
84 | 93 |
} |
85 | 94 |
} |
86 | 95 |
|
... | ... | |
105 | 114 |
|
106 | 115 |
@Override |
107 | 116 |
protected void okPressed(){ |
117 |
|
|
108 | 118 |
for (TermVocabulary voc: vocabularies){ |
109 | 119 |
if (tempSelectedVocabularies.contains(voc)){ |
110 | 120 |
PreferencesUtil.getPreferenceStore().setValue(getPrefKey(voc), false); |
... | ... | |
117 | 127 |
super.okPressed(); |
118 | 128 |
} |
119 | 129 |
|
120 |
@Override |
|
121 |
protected void cancelPressed(){ |
|
122 |
// selectedVocabularies = oldSelectedVocabularies; |
|
123 |
super.cancelPressed(); |
|
124 |
} |
|
125 |
|
|
126 | 130 |
private String getPrefKey(TermVocabulary vocabulary){ |
127 | 131 |
return "hide_"+NamedAreaSelectionDialog.class.getCanonicalName()+vocabulary.getUuid()+preferenceId; |
128 | 132 |
} |
Also available in: Unified diff
ref #7119: with empty selection the filter dialog could not be closed