1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
6
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
7
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.bulkeditor.e4;
|
11
|
|
12
|
import java.io.Serializable;
|
13
|
import java.util.HashMap;
|
14
|
import java.util.List;
|
15
|
import java.util.Map;
|
16
|
|
17
|
import javax.annotation.PostConstruct;
|
18
|
import javax.annotation.PreDestroy;
|
19
|
import javax.inject.Inject;
|
20
|
|
21
|
import org.eclipse.core.runtime.IProgressMonitor;
|
22
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
23
|
import org.eclipse.e4.core.services.events.IEventBroker;
|
24
|
import org.eclipse.e4.ui.di.Focus;
|
25
|
import org.eclipse.e4.ui.di.Persist;
|
26
|
import org.eclipse.e4.ui.model.application.ui.MDirtyable;
|
27
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
28
|
import org.eclipse.e4.ui.services.EMenuService;
|
29
|
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
30
|
import org.eclipse.jface.dialogs.MessageDialog;
|
31
|
import org.eclipse.jface.layout.GridDataFactory;
|
32
|
import org.eclipse.jface.viewers.ISelection;
|
33
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
34
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
35
|
import org.eclipse.jface.viewers.TableViewer;
|
36
|
import org.eclipse.nebula.widgets.nattable.NatTable;
|
37
|
import org.eclipse.nebula.widgets.nattable.config.AbstractUiBindingConfiguration;
|
38
|
import org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration;
|
39
|
import org.eclipse.nebula.widgets.nattable.data.IRowIdAccessor;
|
40
|
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
|
41
|
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
|
42
|
import org.eclipse.nebula.widgets.nattable.grid.GridRegion;
|
43
|
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider;
|
44
|
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider;
|
45
|
import org.eclipse.nebula.widgets.nattable.grid.data.DefaultRowHeaderDataProvider;
|
46
|
import org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer;
|
47
|
import org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer;
|
48
|
import org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer;
|
49
|
import org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer;
|
50
|
import org.eclipse.nebula.widgets.nattable.layer.DataLayer;
|
51
|
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack;
|
52
|
import org.eclipse.nebula.widgets.nattable.selection.RowSelectionModel;
|
53
|
import org.eclipse.nebula.widgets.nattable.ui.binding.UiBindingRegistry;
|
54
|
import org.eclipse.nebula.widgets.nattable.ui.matcher.MouseEventMatcher;
|
55
|
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuAction;
|
56
|
import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
|
57
|
import org.eclipse.swt.SWT;
|
58
|
import org.eclipse.swt.layout.GridData;
|
59
|
import org.eclipse.swt.layout.GridLayout;
|
60
|
import org.eclipse.swt.widgets.Composite;
|
61
|
import org.eclipse.swt.widgets.Menu;
|
62
|
|
63
|
import ca.odell.glazedlists.BasicEventList;
|
64
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
65
|
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
|
66
|
import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
|
67
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
68
|
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
|
69
|
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
|
70
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
71
|
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
|
72
|
import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorQuery;
|
73
|
import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
|
74
|
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
|
75
|
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
|
76
|
import eu.etaxonomy.taxeditor.l10n.Messages;
|
77
|
import eu.etaxonomy.taxeditor.model.AbstractUtility;
|
78
|
import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
|
79
|
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
|
80
|
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
|
81
|
import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
|
82
|
import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
|
83
|
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
|
84
|
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
85
|
import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
|
86
|
|
87
|
/**
|
88
|
*
|
89
|
* @author pplitzner
|
90
|
* @since Sep 8, 2017
|
91
|
*
|
92
|
*/
|
93
|
public class BulkEditorE4 implements IPartContentHasDetails, IConversationEnabled, IPostOperationEnabled,
|
94
|
IDirtyMarkable, IDerivedUnitFacadePart, IPartContentHasFactualData,
|
95
|
IPartContentHasSupplementalData, IPartContentHasMedia, IE4SavablePart, ITaxonEditor {
|
96
|
|
97
|
public static final String TYPE_PROPERTY = "Type";
|
98
|
|
99
|
@Inject
|
100
|
private MDirtyable dirty;
|
101
|
|
102
|
private AbstractBulkEditorInput<?> input;
|
103
|
|
104
|
private Composite topComposite;
|
105
|
|
106
|
private TableViewer viewer;
|
107
|
|
108
|
private NatTable natTable;
|
109
|
|
110
|
private ConversationHolder conversation;
|
111
|
|
112
|
@Inject
|
113
|
private ESelectionService selService;
|
114
|
|
115
|
@Inject
|
116
|
private IEventBroker eventBroker;
|
117
|
|
118
|
private ISelectionChangedListener selectionChangedListener;
|
119
|
|
120
|
@Inject
|
121
|
private MPart thisPart;
|
122
|
|
123
|
private BulkEditorQuery lastQuery = null;
|
124
|
|
125
|
private BasicEventList<CdmBase> list;
|
126
|
|
127
|
private Composite bottomComposite;
|
128
|
|
129
|
@Inject
|
130
|
private EMenuService menuService;
|
131
|
|
132
|
@Inject
|
133
|
public BulkEditorE4() {
|
134
|
}
|
135
|
|
136
|
@SuppressWarnings("unused")
|
137
|
public void init(AbstractBulkEditorInput<?> input){
|
138
|
this.input = input;
|
139
|
this.conversation = input.getConversation();
|
140
|
|
141
|
new BulkEditorSearchE4(this, topComposite, SWT.NONE);
|
142
|
//layout needed because the search bar is added after @PostConstuct method
|
143
|
topComposite.getParent().layout();
|
144
|
|
145
|
thisPart.setLabel(input.getEditorName());
|
146
|
|
147
|
// //create columns
|
148
|
// Table table = viewer.getTable();
|
149
|
// String[] titles = {input.getName(), "Type"};
|
150
|
// int[] bounds = {500, 100};
|
151
|
//
|
152
|
// ColumnViewerEditorActivationStrategy activationSupport = new ColumnViewerEditorActivationStrategy(viewer) {
|
153
|
// @Override
|
154
|
// protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
|
155
|
// // Enable editor only with mouse double click
|
156
|
// if (event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION) {
|
157
|
// EventObject source = event.sourceEvent;
|
158
|
// if (source instanceof MouseEvent && ((MouseEvent)source).button == 3) {
|
159
|
// return false;
|
160
|
// }
|
161
|
//
|
162
|
// return true;
|
163
|
// }
|
164
|
//
|
165
|
// return false;
|
166
|
// }
|
167
|
// };
|
168
|
// TableViewerFocusCellManager focusCellManager = new TableViewerFocusCellManager(viewer, new BulkEditorFocusCellOwnerDrawHighLighter(viewer));
|
169
|
//
|
170
|
// TableViewerEditor.create(viewer, focusCellManager, activationSupport, ColumnViewerEditor.TABBING_HORIZONTAL |
|
171
|
// ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR |
|
172
|
// ColumnViewerEditor.TABBING_VERTICAL |
|
173
|
// ColumnViewerEditor.KEYBOARD_ACTIVATION );
|
174
|
//
|
175
|
// CellEditor[] editors = new CellEditor[titles.length];
|
176
|
// for (int i = 0; i < titles.length; i++) {
|
177
|
// TableViewerColumn column = new TableViewerColumn(viewer, SWT.NONE);
|
178
|
// editors[i] = new TextCellEditor(table);
|
179
|
//
|
180
|
// column.getColumn().setText(titles[i]);
|
181
|
// column.getColumn().setWidth(bounds[i]);
|
182
|
// column.getColumn().setResizable(true);
|
183
|
// column.getColumn().setMoveable(true);
|
184
|
//
|
185
|
// }
|
186
|
//
|
187
|
// table.setHeaderVisible(true);
|
188
|
// table.setLinesVisible(true);
|
189
|
//
|
190
|
// viewer.setCellEditors(editors);
|
191
|
// viewer.setColumnProperties(titles);
|
192
|
//
|
193
|
// //content and label provider (NOTE: has to be set AFTER creating cell editors
|
194
|
// viewer.setContentProvider(new ArrayContentProvider());
|
195
|
// BulkEditorLabelProvider labelProvider = new BulkEditorLabelProvider(this);
|
196
|
// viewer.setLabelProvider(labelProvider);
|
197
|
//
|
198
|
//
|
199
|
// //allow text selection
|
200
|
// viewer.setCellModifier(new ICellModifier() {
|
201
|
// @Override
|
202
|
// public void modify(Object element, String property, Object value) {
|
203
|
// }
|
204
|
// @Override
|
205
|
// public Object getValue(Object element, String property) {
|
206
|
// ITableLabelProvider tableLabelProvider = null;
|
207
|
// if(viewer.getLabelProvider() instanceof ITableLabelProvider){
|
208
|
// tableLabelProvider = (ITableLabelProvider) viewer.getLabelProvider();
|
209
|
// }
|
210
|
// Object[] columnProperties = viewer.getColumnProperties();
|
211
|
// for (int i=0;i<columnProperties.length;i++) {
|
212
|
// if(columnProperties[i].equals(property) && tableLabelProvider!=null){
|
213
|
// return tableLabelProvider.getColumnText(element, i);
|
214
|
// }
|
215
|
// }
|
216
|
// return "";
|
217
|
// }
|
218
|
// @Override
|
219
|
// public boolean canModify(Object element, String property) {
|
220
|
// return true;
|
221
|
// }
|
222
|
// });
|
223
|
|
224
|
|
225
|
|
226
|
if(input.getEntityUuid()!=null){
|
227
|
performSearch(new BulkEditorQuery(input.getEntityUuid().toString(), null));
|
228
|
}
|
229
|
|
230
|
//++++NatTable++++
|
231
|
list = new BasicEventList<>();
|
232
|
Map<String, String> propertyToLabels = new HashMap<>();
|
233
|
propertyToLabels.put(getEditorInput().getName(), getEditorInput().getName());
|
234
|
propertyToLabels.put(TYPE_PROPERTY, TYPE_PROPERTY);
|
235
|
String[] propertyNames = new String[] { getEditorInput().getName(), TYPE_PROPERTY };
|
236
|
ListDataProvider bodyDataProvider = new ListDataProvider<CdmBase>(list,
|
237
|
new BulkEditorPropertyAccessor(getEditorInput()));
|
238
|
|
239
|
|
240
|
DefaultColumnHeaderDataProvider colHeaderDataProvider = new DefaultColumnHeaderDataProvider(
|
241
|
propertyNames, propertyToLabels);
|
242
|
DefaultRowHeaderDataProvider rowHeaderDataProvider = new DefaultRowHeaderDataProvider(
|
243
|
bodyDataProvider);
|
244
|
|
245
|
DataLayer dataLayer = new DataLayer(bodyDataProvider);
|
246
|
GlazedListsEventLayer<CdmBase> eventLayer = new GlazedListsEventLayer<>(dataLayer, list);
|
247
|
DefaultBodyLayerStack bodyLayer = new DefaultBodyLayerStack(eventLayer);
|
248
|
|
249
|
ColumnHeaderLayer columnHeaderLayer = new ColumnHeaderLayer(
|
250
|
new DataLayer(colHeaderDataProvider),
|
251
|
bodyLayer, bodyLayer.getSelectionLayer());
|
252
|
|
253
|
RowHeaderLayer rowHeaderLayer = new RowHeaderLayer(new DataLayer(rowHeaderDataProvider, 50, 20),
|
254
|
bodyLayer, bodyLayer.getSelectionLayer());
|
255
|
|
256
|
DefaultCornerDataProvider cornerDataProvider = new DefaultCornerDataProvider(
|
257
|
colHeaderDataProvider, rowHeaderDataProvider);
|
258
|
CornerLayer cornerLayer = new CornerLayer(new DataLayer(
|
259
|
cornerDataProvider), rowHeaderLayer, columnHeaderLayer);
|
260
|
|
261
|
GridLayer gridLayer = new GridLayer(bodyLayer, columnHeaderLayer,
|
262
|
rowHeaderLayer, cornerLayer);
|
263
|
|
264
|
dataLayer.setColumnPercentageSizing(true);
|
265
|
natTable = new NatTable(bottomComposite, gridLayer, false);
|
266
|
|
267
|
//create context menu
|
268
|
menuService.registerContextMenu(natTable, "eu.etaxonomy.taxeditor.bulkeditor.popupmenu.bulkeditor"); //$NON-NLS-1$
|
269
|
// get the menu registered by EMenuService
|
270
|
final Menu e4Menu = natTable.getMenu();
|
271
|
|
272
|
// remove the menu reference from NatTable instance
|
273
|
natTable.setMenu(null);
|
274
|
|
275
|
//add default configuration because autoconfigure is set to false in constructor
|
276
|
natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
|
277
|
natTable.addConfiguration(
|
278
|
new AbstractUiBindingConfiguration() {
|
279
|
|
280
|
@Override
|
281
|
public void configureUiBindings(
|
282
|
UiBindingRegistry uiBindingRegistry) {
|
283
|
// add NatTable menu items
|
284
|
// and register the DisposeListener
|
285
|
new PopupMenuBuilder(natTable, e4Menu)
|
286
|
.build();
|
287
|
|
288
|
// register the UI binding
|
289
|
uiBindingRegistry.registerMouseDownBinding(
|
290
|
new MouseEventMatcher(
|
291
|
SWT.NONE,
|
292
|
GridRegion.BODY,
|
293
|
MouseEventMatcher.RIGHT_BUTTON),
|
294
|
new PopupMenuAction(e4Menu));
|
295
|
}
|
296
|
});
|
297
|
|
298
|
natTable.configure();
|
299
|
GridDataFactory.fillDefaults().grab(true, true).applyTo(natTable);
|
300
|
|
301
|
//full row selection
|
302
|
bodyLayer.getSelectionLayer().setSelectionModel(new RowSelectionModel<CdmBase>(bodyLayer.getSelectionLayer(), bodyDataProvider, new IRowIdAccessor<CdmBase>() {
|
303
|
|
304
|
@Override
|
305
|
public Serializable getRowId(CdmBase rowObject) {
|
306
|
return list.indexOf(rowObject);
|
307
|
}
|
308
|
|
309
|
}));
|
310
|
}
|
311
|
|
312
|
/** {@inheritDoc} */
|
313
|
@PostConstruct
|
314
|
public void createPartControl(Composite parent) {
|
315
|
parent.setLayout(new GridLayout());
|
316
|
|
317
|
topComposite = new Composite(parent, SWT.NONE);
|
318
|
topComposite.setLayout(new GridLayout());
|
319
|
|
320
|
GridData gridData = new GridData(SWT.FILL, SWT.TOP, true, false);
|
321
|
topComposite.setLayoutData(gridData);
|
322
|
|
323
|
bottomComposite = new Composite(parent, SWT.NONE);
|
324
|
bottomComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
325
|
bottomComposite.setLayout(new GridLayout());
|
326
|
|
327
|
// viewer = new TableViewer(bottomComposite, SWT.MULTI | SWT.FULL_SELECTION);
|
328
|
|
329
|
// createColumns(viewer);
|
330
|
|
331
|
//propagate selection
|
332
|
selectionChangedListener = (event -> selService.setSelection(AbstractUtility.getElementsFromSelectionChangedEvent(event)));
|
333
|
// viewer.addSelectionChangedListener(selectionChangedListener);
|
334
|
|
335
|
//create context menu
|
336
|
// menuService.registerContextMenu(viewer.getControl(), "eu.etaxonomy.taxeditor.bulkeditor.popupmenu.bulkeditor"); //$NON-NLS-1$
|
337
|
}
|
338
|
|
339
|
@Override
|
340
|
@Persist
|
341
|
public void save(IProgressMonitor monitor) {
|
342
|
save(monitor, true);
|
343
|
}
|
344
|
|
345
|
@Focus
|
346
|
public void setFocus() {
|
347
|
//make sure to bind again if maybe in another view the conversation was unbound
|
348
|
eventBroker.post(WorkbenchEventConstants.CURRENT_ACTIVE_EDITOR, this);
|
349
|
}
|
350
|
|
351
|
@PreDestroy
|
352
|
public void dispose() {
|
353
|
if(conversation!=null){
|
354
|
conversation.unregisterForDataStoreChanges(this);
|
355
|
conversation.close();
|
356
|
}
|
357
|
if(input!=null){
|
358
|
input.dispose();
|
359
|
}
|
360
|
}
|
361
|
|
362
|
public void save(IProgressMonitor monitor, boolean resetMerge) {
|
363
|
if (!input.getCdmEntitySession().isActive()){
|
364
|
input.getCdmEntitySession().bind();
|
365
|
}
|
366
|
input.saveModel(resetMerge);
|
367
|
|
368
|
List<CdmBase> saveCandidates = getEditorInput().getSaveCandidates();
|
369
|
ISelection selection = getViewer().getSelection();
|
370
|
|
371
|
dirty.setDirty(false);
|
372
|
getEditorInput().resetSaveCandidates();
|
373
|
getEditorInput().dispose();
|
374
|
getEditorInput().bind();
|
375
|
conversation.commit(true);
|
376
|
|
377
|
if (lastQuery != null){
|
378
|
performSearch(lastQuery);
|
379
|
getViewer().setSelection(selection, true);
|
380
|
}
|
381
|
// viewer.refresh();
|
382
|
|
383
|
|
384
|
}
|
385
|
|
386
|
/** {@inheritDoc} */
|
387
|
public void performSearch(BulkEditorQuery query) {
|
388
|
if (query != null) {
|
389
|
|
390
|
// TODO check if dirty, prompt save
|
391
|
if (isDirty()) {
|
392
|
String[] labels = {Messages.BulkEditorE4_SAVE_AND_SEARCH, Messages.BulkEditorE4_DONT_SAVE,Messages.BulkEditorE4_CANCEL};
|
393
|
MessageDialog dialog =new MessageDialog(topComposite.getShell(), Messages.BulkEditorE4_SAVE_CHANGES_TITLE, null, Messages.BulkEditorE4_SAVE_CHANGES_MESSAGE, MessageDialog.QUESTION,labels, 0);
|
394
|
int result = dialog.open();
|
395
|
if (result == 0) {
|
396
|
save(new NullProgressMonitor());
|
397
|
} else if (result == 2){
|
398
|
return;
|
399
|
}
|
400
|
}
|
401
|
dirty.setDirty(false);
|
402
|
// getEditorInput().dispose();
|
403
|
// getEditorInput().bind();
|
404
|
getEditorInput().performSearch(query);
|
405
|
lastQuery = query;
|
406
|
List model = getEditorInput().getModel();
|
407
|
// viewer.setInput(model);
|
408
|
list.clear();
|
409
|
list.addAll(model);
|
410
|
|
411
|
refresh();
|
412
|
}
|
413
|
}
|
414
|
|
415
|
public void refresh() {
|
416
|
refresh(true);
|
417
|
}
|
418
|
|
419
|
public void refresh(boolean resetInput) {
|
420
|
if(resetInput){
|
421
|
// viewer.setInput(getEditorInput().getModel());
|
422
|
}
|
423
|
// viewer.refresh();
|
424
|
}
|
425
|
|
426
|
public TableViewer getViewer() {
|
427
|
return viewer;
|
428
|
}
|
429
|
|
430
|
public void setDirty(){
|
431
|
dirty.setDirty(true);
|
432
|
}
|
433
|
|
434
|
public boolean isDirty() {
|
435
|
return dirty.isDirty();
|
436
|
}
|
437
|
|
438
|
public AbstractBulkEditorInput getEditorInput() {
|
439
|
return input;
|
440
|
}
|
441
|
|
442
|
/**
|
443
|
* {@inheritDoc}
|
444
|
*/
|
445
|
@Override
|
446
|
public void update(CdmDataChangeMap arg0) {
|
447
|
}
|
448
|
|
449
|
/**
|
450
|
* {@inheritDoc}
|
451
|
*/
|
452
|
@Override
|
453
|
public boolean canAttachMedia() {
|
454
|
return true;
|
455
|
}
|
456
|
|
457
|
/**
|
458
|
* {@inheritDoc}
|
459
|
*/
|
460
|
@Override
|
461
|
public void changed(Object element) {
|
462
|
if(element instanceof DerivedUnitFacade){
|
463
|
DerivedUnit derivedUnit = ((DerivedUnitFacade) element).innerDerivedUnit();
|
464
|
if(derivedUnit!=null){
|
465
|
getEditorInput().addSaveCandidate(derivedUnit);
|
466
|
}
|
467
|
FieldUnit fieldUnit = ((DerivedUnitFacade) element).innerFieldUnit();
|
468
|
if(fieldUnit!=null){
|
469
|
getEditorInput().addSaveCandidate(fieldUnit);
|
470
|
}
|
471
|
}
|
472
|
else if (element instanceof CdmBase) {
|
473
|
getEditorInput().addSaveCandidate((CdmBase)element);
|
474
|
}
|
475
|
dirty.setDirty(true);
|
476
|
}
|
477
|
|
478
|
/**
|
479
|
* {@inheritDoc}
|
480
|
*/
|
481
|
@Override
|
482
|
public void forceDirty() {
|
483
|
dirty.setDirty(true);
|
484
|
}
|
485
|
|
486
|
/**
|
487
|
* {@inheritDoc}
|
488
|
*/
|
489
|
@Override
|
490
|
public boolean postOperation(CdmBase objectAffectedByOperation) {
|
491
|
return false;
|
492
|
}
|
493
|
|
494
|
/**
|
495
|
* {@inheritDoc}
|
496
|
*/
|
497
|
@Override
|
498
|
public boolean onComplete() {
|
499
|
return false;
|
500
|
}
|
501
|
|
502
|
/**
|
503
|
* {@inheritDoc}
|
504
|
*/
|
505
|
@Override
|
506
|
public ConversationHolder getConversationHolder() {
|
507
|
return conversation;
|
508
|
}
|
509
|
|
510
|
/**
|
511
|
* @return
|
512
|
*/
|
513
|
public BulkEditorQuery getLastQuery() {
|
514
|
return lastQuery;
|
515
|
}
|
516
|
|
517
|
/**
|
518
|
* @param object
|
519
|
*/
|
520
|
public void setLastQuery(BulkEditorQuery lastQuery) {
|
521
|
this.lastQuery = lastQuery;
|
522
|
|
523
|
}
|
524
|
|
525
|
/**
|
526
|
* {@inheritDoc}
|
527
|
*/
|
528
|
@Override
|
529
|
public Taxon getTaxon() {
|
530
|
ISelection selection = viewer.getSelection();
|
531
|
if(selection instanceof IStructuredSelection
|
532
|
&& ((IStructuredSelection) selection).size()==1) {
|
533
|
Object object = ((IStructuredSelection) selection).iterator().next();
|
534
|
if(object instanceof Taxon){
|
535
|
return (Taxon) object;
|
536
|
}
|
537
|
}
|
538
|
return null;
|
539
|
}
|
540
|
|
541
|
}
|