org.eclipse.e4.core.contexts,
org.eclipse.nebula.widgets.nattable.core,
org.eclipse.nebula.widgets.nattable.extension.glazedlists,
- ca.odell.glazedlists
+ ca.odell.glazedlists,
+ org.eclipse.nebula.widgets.nattable.extension.e4;bundle-version="1.1.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Import-Package: javax.annotation;version="1.0.0";resolution:=optional,
import java.util.Collection;
+import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.nebula.widgets.nattable.layer.ILayerListener;
+import org.eclipse.nebula.widgets.nattable.data.IRowDataProvider;
+import org.eclipse.nebula.widgets.nattable.extension.e4.selection.E4SelectionListener;
import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell;
import org.eclipse.nebula.widgets.nattable.layer.event.ILayerEvent;
+import org.eclipse.nebula.widgets.nattable.selection.SelectionLayer;
import org.eclipse.nebula.widgets.nattable.selection.event.CellSelectionEvent;
+import org.eclipse.nebula.widgets.nattable.selection.event.RowSelectionEvent;
+
+import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
/**
* @author pplitzner
* @date 09.07.2018
*
*/
-final class CellSelectionListener implements ILayerListener {
+final class CellSelectionListener extends E4SelectionListener<Object> {
private CharacterMatrixPart part;
- public CellSelectionListener(CharacterMatrixPart part) {
- super();
+ public CellSelectionListener(
+ ESelectionService service,
+ SelectionLayer selectionLayer,
+ IRowDataProvider<Object> rowDataProvider,
+ CharacterMatrixPart part) {
+ super(service, selectionLayer, rowDataProvider);
this.part = part;
}
if(event instanceof CellSelectionEvent){
CellSelectionEvent cellSelectionEvent = (CellSelectionEvent)event;
int columnPosition = cellSelectionEvent.getColumnPosition();
- if(columnPosition>CharacterMatrix.LEADING_COLUMN_COUNT){
+ if(columnPosition>=CharacterMatrix.LEADING_COLUMN_COUNT){
Collection<ILayerCell> selectedCells = cellSelectionEvent.getSelectionLayer().getSelectedCells();
- StructuredSelection selection = new StructuredSelection();
if(selectedCells.size()==1){
ILayerCell cell = selectedCells.iterator().next();
Object dataValue = cell.getDataValue();
if(dataValue!=null){
- selection = new StructuredSelection(dataValue);
+ part.getSelectionService().setSelection(new StructuredSelection(dataValue));
}
}
- part.getSelectionService().setSelection(selection);
}
}
+ else if(event instanceof RowSelectionEvent){
+ RowSelectionEvent rowSelectionEvent = (RowSelectionEvent) event;
+ int[] fullySelectedRowPositions = rowSelectionEvent.getSelectionLayer().getFullySelectedRowPositions();
+ if(fullySelectedRowPositions.length==1){
+ Object rowObject = part.getMatrix().getBodyDataProvider().getRowObject(fullySelectedRowPositions[0]);
+ if(rowObject instanceof RowWrapperDTO){
+ part.getSelectionService().setSelection(new StructuredSelection(((RowWrapperDTO) rowObject).getDescription()));
+ }
+ }
+ }
+ else{
+ super.handleLayerEvent(event);
+ }
}
}
import java.util.stream.Collectors;
import javax.inject.Inject;
+import javax.inject.Named;
import org.apache.commons.collections4.map.LinkedMap;
import org.eclipse.core.runtime.ICoreRunnable;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.services.EMenuService;
+import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
import org.eclipse.nebula.widgets.nattable.export.command.ExportCommandHandler;
+import org.eclipse.nebula.widgets.nattable.extension.e4.selection.E4SelectionListener;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedListTreeData;
// exporting work
topMostLayer.registerCommandHandler(new ExportCommandHandler(topMostLayer));
- //propagate single cell selection
- natTable.addLayerListener(new CellSelectionListener(part));
+ //selection listener
+ E4SelectionListener selectionListener = new CellSelectionListener(part.getSelectionService(),
+ bodyLayer.getSelectionLayer(), bodyDataProvider, part);
+ bodyLayer.getSelectionLayer().addLayerListener(selectionListener);
+ selectionListener.setFullySelectedRowsOnly(false);
//register handler for view configuration menu
natTable.registerCommandHandler(toolbar.getDisplayPersistenceDialogCommandHandler());
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.editor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
+import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
+import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
*
*/
public class CharacterMatrixPart implements IE4SavablePart, IConversationEnabled, IDirtyMarkable,
-ICdmEntitySessionEnabled{
+ICdmEntitySessionEnabled, IPartContentHasSupplementalData, IPartContentHasDetails{
private static final List<String> WS_PROPERTY_PATH = Arrays.asList(new String[] {
"descriptions", //$NON-NLS-1$