Revision 7cf1f544
Added by Niels Hoffmann over 12 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/AbstractFormSection.java | ||
---|---|---|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.ui.forms; |
5 | 5 |
|
6 |
import java.util.ConcurrentModificationException; |
|
6 | 7 |
import java.util.HashSet; |
7 | 8 |
import java.util.List; |
8 | 9 |
import java.util.Set; |
... | ... | |
24 | 25 |
import org.eclipse.swt.widgets.Display; |
25 | 26 |
import org.eclipse.swt.widgets.TypedListener; |
26 | 27 |
import org.eclipse.swt.widgets.Widget; |
28 |
import org.eclipse.ui.editors.text.EditorsUI; |
|
27 | 29 |
import org.eclipse.ui.forms.widgets.Section; |
28 | 30 |
import org.eclipse.ui.forms.widgets.TableWrapLayout; |
29 | 31 |
import org.eclipse.ui.forms.widgets.ToggleHyperlink; |
... | ... | |
31 | 33 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
32 | 34 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
33 | 35 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
36 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
34 | 37 |
|
35 | 38 |
/** |
36 | 39 |
* <p>Abstract AbstractFormSection class.</p> |
... | ... | |
56 | 59 |
|
57 | 60 |
private ConversationHolder conversation; |
58 | 61 |
|
62 |
private boolean handlingPropertyChange; |
|
63 |
|
|
59 | 64 |
/** |
60 | 65 |
* <p>Constructor for AbstractFormSection.</p> |
61 | 66 |
* |
... | ... | |
163 | 168 |
/** {@inheritDoc} */ |
164 | 169 |
public void firePropertyChangeEvent(CdmPropertyChangeEvent event) { |
165 | 170 |
Assert.isNotNull(propertyChangeListeners, "No property change listeners."); |
166 |
for(Object listener : propertyChangeListeners){ |
|
167 |
((IPropertyChangeListener) listener).propertyChange(event); |
|
171 |
try{ |
|
172 |
for(Object listener : propertyChangeListeners){ |
|
173 |
((IPropertyChangeListener) listener).propertyChange(event); |
|
174 |
} |
|
175 |
}catch(ConcurrentModificationException e){ |
|
176 |
StoreUtil.warn(getClass(), "ConcurrentModificationException while handling PropertyChangeEvents." + |
|
177 |
" It seems like this is not critical"); |
|
168 | 178 |
} |
169 | 179 |
} |
170 | 180 |
|
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java | ||
---|---|---|
68 | 68 |
addExpansionListener(this); |
69 | 69 |
} |
70 | 70 |
|
71 |
private Control createToolbar() {
|
|
71 |
protected Control createToolbar() {
|
|
72 | 72 |
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); |
73 | 73 |
|
74 | 74 |
Action addAction = new Action("add", Action.AS_PUSH_BUTTON){ |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CurrentDeterminationDetailSection.java | ||
---|---|---|
13 | 13 |
import java.util.Arrays; |
14 | 14 |
import java.util.Collection; |
15 | 15 |
|
16 |
import org.eclipse.jface.action.Action; |
|
17 |
import org.eclipse.jface.action.ToolBarManager; |
|
18 |
import org.eclipse.jface.resource.ImageDescriptor; |
|
19 |
import org.eclipse.swt.SWT; |
|
20 |
import org.eclipse.swt.graphics.ImageData; |
|
21 |
import org.eclipse.swt.widgets.Control; |
|
22 |
|
|
16 | 23 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
17 | 24 |
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade; |
18 | 25 |
import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent; |
26 |
import eu.etaxonomy.taxeditor.model.ImageResources; |
|
19 | 27 |
import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory; |
20 | 28 |
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement; |
21 | 29 |
|
... | ... | |
38 | 46 |
int style) { |
39 | 47 |
super(formFactory, conversation, parentElement, "Current Determination", style); |
40 | 48 |
} |
49 |
|
|
50 |
@Override |
|
51 |
protected Control createToolbar() { |
|
52 |
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); |
|
53 |
|
|
54 |
Action addAction = new Action("add", Action.AS_PUSH_BUTTON){ |
|
55 |
/* (non-Javadoc) |
|
56 |
* @see org.eclipse.jface.action.Action#run() |
|
57 |
*/ |
|
58 |
@Override |
|
59 |
public void run() { |
|
60 |
DeterminationEvent element = createNewElement(); |
|
61 |
|
|
62 |
// set as preferred determination |
|
63 |
getEntity().setPreferredDetermination(element); |
|
64 |
|
|
65 |
if(element != null){ |
|
66 |
if(! getSection().isExpanded()) |
|
67 |
getSection().setExpanded(true); |
|
68 |
internalUpdateSection(true); |
|
69 |
} |
|
70 |
} |
|
71 |
}; |
|
72 |
addAction.setImageDescriptor(new ImageDescriptor() { |
|
73 |
|
|
74 |
@Override |
|
75 |
public ImageData getImageData() { |
|
76 |
return ImageResources.getImage(ImageResources.ADD_ICON).getImageData(); |
|
77 |
} |
|
78 |
}); |
|
79 |
addAction.setToolTipText(getTooltipString()); |
|
80 |
|
|
81 |
toolBarManager.add(addAction); |
|
82 |
|
|
83 |
return toolBarManager.createControl(this); |
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public void refresh() { |
|
88 |
internalUpdateSection(false); |
|
89 |
} |
|
41 | 90 |
|
42 | 91 |
/* (non-Javadoc) |
43 | 92 |
* @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object) |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java | ||
---|---|---|
66 | 66 |
*/ |
67 | 67 |
@Override |
68 | 68 |
public void handleEvent(Object eventSource) { |
69 |
|
|
69 |
if(eventSource == section_currentDetermination){ |
|
70 |
section_determinationHistory.refresh(); |
|
71 |
} |
|
70 | 72 |
} |
71 | 73 |
|
72 | 74 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationHistoryDetailSection.java | ||
---|---|---|
45 | 45 |
public Collection<DeterminationEvent> getCollection(DerivedUnitFacade entity) { |
46 | 46 |
return entity != null ? entity.getOtherDeterminations() : null; |
47 | 47 |
} |
48 |
|
|
49 |
@Override |
|
50 |
public void refresh() { |
|
51 |
internalUpdateSection(false); |
|
52 |
} |
|
48 | 53 |
|
49 | 54 |
} |
Also available in: Unified diff
Resolves #2376