Revision 6cf49987
Added by Patrick Plitzner almost 6 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/BulkEditorE4.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import org.eclipse.core.runtime.IProgressMonitor; |
23 | 23 |
import org.eclipse.core.runtime.NullProgressMonitor; |
24 |
import org.eclipse.e4.core.di.annotations.Optional; |
|
24 | 25 |
import org.eclipse.e4.core.services.events.IEventBroker; |
25 | 26 |
import org.eclipse.e4.ui.di.Focus; |
26 | 27 |
import org.eclipse.e4.ui.di.Persist; |
28 |
import org.eclipse.e4.ui.di.UIEventTopic; |
|
27 | 29 |
import org.eclipse.e4.ui.model.application.ui.MDirtyable; |
28 | 30 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
29 | 31 |
import org.eclipse.e4.ui.services.EMenuService; |
... | ... | |
59 | 61 |
import org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack; |
60 | 62 |
import org.eclipse.nebula.widgets.nattable.selection.RowSelectionModel; |
61 | 63 |
import org.eclipse.nebula.widgets.nattable.selection.RowSelectionProvider; |
62 |
import org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand; |
|
63 | 64 |
import org.eclipse.nebula.widgets.nattable.sort.SortHeaderLayer; |
64 | 65 |
import org.eclipse.nebula.widgets.nattable.sort.config.SingleClickSortConfiguration; |
65 | 66 |
import org.eclipse.nebula.widgets.nattable.style.DisplayMode; |
... | ... | |
367 | 368 |
conversation.commit(true); |
368 | 369 |
|
369 | 370 |
if (lastQuery != null){ |
370 |
performSearch(lastQuery); |
|
371 |
setSelection(selection); |
|
371 |
performSearch(lastQuery, selection); |
|
372 | 372 |
} |
373 | 373 |
} |
374 | 374 |
|
375 |
/** {@inheritDoc} */ |
|
376 |
public void performSearch(BulkEditorQuery query) { |
|
375 |
public void performSearch(BulkEditorQuery query) { |
|
376 |
performSearch(query, null); |
|
377 |
} |
|
378 |
|
|
379 |
/** {@inheritDoc} |
|
380 |
* @param selection */ |
|
381 |
public void performSearch(BulkEditorQuery query, IStructuredSelection selection) { |
|
377 | 382 |
if (query != null) { |
378 | 383 |
// TODO check if dirty, prompt save |
379 | 384 |
if (isDirty()) { |
... | ... | |
387 | 392 |
} |
388 | 393 |
} |
389 | 394 |
dirty.setDirty(false); |
390 |
input.performSearch(query); |
|
395 |
input.performSearch(query, selection);
|
|
391 | 396 |
lastQuery = query; |
392 | 397 |
} |
393 | 398 |
} |
394 | 399 |
|
400 |
@Optional |
|
401 |
@Inject |
|
402 |
private void setSelectionAfterSearch(@UIEventTopic(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED)IStructuredSelection selection){ |
|
403 |
if(selection!=null){ |
|
404 |
setSelection(selection); |
|
405 |
} |
|
406 |
} |
|
395 | 407 |
|
396 | 408 |
public void refresh(){ |
397 | 409 |
natTable.doCommand(new VisualRefreshCommand()); |
... | ... | |
413 | 425 |
Object[] objects = selection.toArray(); |
414 | 426 |
for (Object object : objects) { |
415 | 427 |
if(object instanceof CdmBase){ |
416 |
natTable.doCommand(new SelectRowsCommand(bodyLayer, 0, bodyDataProvider.indexOfRowObject((CdmBase) object), false, false));
|
|
428 |
bodyLayer.getSelectionLayer().selectRow(0, bodyDataProvider.indexOfRowObject((CdmBase) object), false, false);
|
|
417 | 429 |
} |
418 | 430 |
} |
419 | 431 |
} |
... | ... | |
475 | 487 |
input.replaceInModel((CdmBase) element); |
476 | 488 |
} |
477 | 489 |
dirty.setDirty(true); |
478 |
setSelection(getSelection());
|
|
490 |
setSelection(new StructuredSelection(element));
|
|
479 | 491 |
} |
480 | 492 |
|
481 | 493 |
@Override |
Also available in: Unified diff
ref #7439 Re-select after search has finished