Revision 04bb4f0f
Added by Katja Luther over 6 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.bulkeditor.e4; |
11 | 11 |
|
12 |
import java.util.EventObject; |
|
12 | 13 |
import java.util.List; |
13 | 14 |
|
14 | 15 |
import javax.annotation.PostConstruct; |
... | ... | |
25 | 26 |
import org.eclipse.jface.dialogs.MessageDialog; |
26 | 27 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
27 | 28 |
import org.eclipse.jface.viewers.CellEditor; |
29 |
import org.eclipse.jface.viewers.ColumnViewerEditor; |
|
30 |
import org.eclipse.jface.viewers.ColumnViewerEditorActivationEvent; |
|
31 |
import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy; |
|
32 |
import org.eclipse.jface.viewers.FocusCellOwnerDrawHighlighter; |
|
28 | 33 |
import org.eclipse.jface.viewers.ICellModifier; |
29 | 34 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
30 | 35 |
import org.eclipse.jface.viewers.ITableLabelProvider; |
31 | 36 |
import org.eclipse.jface.viewers.TableViewer; |
32 | 37 |
import org.eclipse.jface.viewers.TableViewerColumn; |
38 |
import org.eclipse.jface.viewers.TableViewerEditor; |
|
39 |
import org.eclipse.jface.viewers.TableViewerFocusCellManager; |
|
33 | 40 |
import org.eclipse.jface.viewers.TextCellEditor; |
34 | 41 |
import org.eclipse.swt.SWT; |
42 |
import org.eclipse.swt.events.MouseEvent; |
|
35 | 43 |
import org.eclipse.swt.layout.FillLayout; |
36 | 44 |
import org.eclipse.swt.layout.GridData; |
37 | 45 |
import org.eclipse.swt.layout.GridLayout; |
... | ... | |
106 | 114 |
String[] titles = {input.getName(), "Type"}; |
107 | 115 |
int[] bounds = {500, 100}; |
108 | 116 |
|
117 |
ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(viewer) { |
|
118 |
@Override |
|
119 |
protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) { |
|
120 |
// Enable editor only with mouse double click |
|
121 |
if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION) { |
|
122 |
EventObject source = event.sourceEvent; |
|
123 |
if (source instanceof MouseEvent && ((MouseEvent)source).button == 3) { |
|
124 |
return false; |
|
125 |
} |
|
126 |
|
|
127 |
return true; |
|
128 |
} |
|
129 |
|
|
130 |
return false; |
|
131 |
} |
|
132 |
}; |
|
133 |
TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer, new FocusCellOwnerDrawHighlighter(viewer)); |
|
134 |
|
|
135 |
TableViewerEditor.create(viewer, focusCellManager, activationSupport, ColumnViewerEditor.TABBING_HORIZONTAL | |
|
136 |
ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR | |
|
137 |
ColumnViewerEditor.TABBING_VERTICAL | |
|
138 |
ColumnViewerEditor.KEYBOARD_ACTIVATION); |
|
139 |
|
|
109 | 140 |
CellEditor[] editors = new CellEditor[titles.length]; |
110 | 141 |
for (int i = 0; i < titles.length; i++) { |
111 | 142 |
TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE); |
... | ... | |
116 | 147 |
column.getColumn().setResizable(true); |
117 | 148 |
column.getColumn().setMoveable(true); |
118 | 149 |
} |
150 |
|
|
119 | 151 |
table.setHeaderVisible(true); |
120 | 152 |
table.setLinesVisible(true); |
121 | 153 |
|
... | ... | |
153 | 185 |
} |
154 | 186 |
}); |
155 | 187 |
|
188 |
|
|
189 |
|
|
156 | 190 |
if(input.getEntityUuid()!=null){ |
157 | 191 |
performSearch(new BulkEditorQuery(input.getEntityUuid().toString(), null)); |
158 | 192 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/ConvertTeam2PersonHandlerE4.java | ||
---|---|---|
53 | 53 |
|
54 | 54 |
Person person = null; |
55 | 55 |
UpdateResult result = null; |
56 |
Team team = (Team) selection; |
|
56 | 57 |
|
57 | 58 |
try { |
58 | 59 |
result = CdmStore.getService(IAgentService.class).convertTeam2Person(selection.getUuid()); |
... | ... | |
63 | 64 |
} |
64 | 65 |
if (result != null && result.isOk()){ |
65 | 66 |
person = (Person)result.getCdmEntity(); |
67 |
boolean test = editor.getEditorInput().getModel().remove(team); |
|
68 |
editor.getEditorInput().getModel().add(person); |
|
66 | 69 |
} |
67 | 70 |
if (person != null){ |
68 | 71 |
editor.refresh(); |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/MergeGroupHandlerE4.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.bulkeditor.e4.handler; |
10 | 10 |
|
11 |
import java.util.List;
|
|
11 |
import java.util.Set;
|
|
12 | 12 |
|
13 | 13 |
import javax.inject.Named; |
14 | 14 |
|
... | ... | |
63 | 63 |
} |
64 | 64 |
|
65 | 65 |
// Check whether there are any group annotations |
66 |
List<CdmBase> mergeCandidates = input.getMergeCandidates();
|
|
66 |
Set<CdmBase> mergeCandidates = input.getMergeCandidates();
|
|
67 | 67 |
if (mergeCandidates.size() == 0) { |
68 | 68 |
MessageDialog.openWarning(shell, |
69 | 69 |
"No merge candidates", "No objects have been chosen for merging."); |
... | ... | |
112 | 112 |
|
113 | 113 |
} |
114 | 114 |
} |
115 |
|
|
115 | 116 |
editor.setDirty(); |
116 | 117 |
editor.refresh(); |
117 | 118 |
} |
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java | ||
---|---|---|
12 | 12 |
import java.util.Collections; |
13 | 13 |
import java.util.Comparator; |
14 | 14 |
import java.util.HashMap; |
15 |
import java.util.HashSet; |
|
15 | 16 |
import java.util.List; |
16 | 17 |
import java.util.Map; |
17 | 18 |
import java.util.Map.Entry; |
19 |
import java.util.Set; |
|
18 | 20 |
import java.util.UUID; |
19 | 21 |
|
20 | 22 |
import eu.etaxonomy.cdm.api.conversation.ConversationHolder; |
... | ... | |
55 | 57 |
private List<T> saveCandidates = new ArrayList<>(); |
56 | 58 |
|
57 | 59 |
|
58 |
private List<T> mergeCandidates = new ArrayList<>();
|
|
60 |
private Set<T> mergeCandidates = new HashSet<>();
|
|
59 | 61 |
private T mergeTarget = null; |
60 | 62 |
|
61 | 63 |
private IEntityCreator<T> entityCreator; |
... | ... | |
92 | 94 |
mergeTarget = t; |
93 | 95 |
} |
94 | 96 |
|
95 |
public List<T> getMergeCandidates() {
|
|
97 |
public Set<T> getMergeCandidates() {
|
|
96 | 98 |
return mergeCandidates; |
97 | 99 |
} |
98 | 100 |
|
Also available in: Unified diff
fix #6392: fix remaining bulk editor migration issues