Source:
private void initMoveUpDownButtons(final Button moveUpButton, final Button moveDownButton, final AbstractTableViewer viewer) { moveUpButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final List<?> containments = (List<?>) eObject.eGet(structuralFeature, true); final EditingDomain editingDomain = getEditingDomain(eObject); final List<?> moveUpList = IStructuredSelection.class.cast(tableViewer.getSelection()) .toList(); for (final Object moveUpObject : moveUpList) { final int currentIndex = containments.indexOf(moveUpObject); if (currentIndex <= 0) { return; } editingDomain.getCommandStack() .execute( new MoveCommand(editingDomain, eObject, structuralFeature, currentIndex, currentIndex - 1)); } } }); moveDownButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final List<?> containments = (List<?>) eObject.eGet(structuralFeature, true); final EditingDomain editingDomain = getEditingDomain(eObject); final List<?> moveDownList = IStructuredSelection.class.cast(tableViewer.getSelection()) .toList(); Collections.reverse(moveDownList); final int maxIndex = containments.size() - 1; for (final Object moveDownObject : moveDownList) { final int currentIndex = containments.indexOf(moveDownObject); if (currentIndex < 0 || currentIndex == maxIndex) { return; } editingDomain.getCommandStack() .execute( new MoveCommand(editingDomain, eObject, structuralFeature, currentIndex, currentIndex + 1)); } } }); }

Target:
private void initMoveUpDownButtons(final Button moveUpButton, final Button moveDownButton, final AbstractTableViewer viewer) { moveUpButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final List<?> containments = (List<?>) eObject.eGet(structuralFeature, true); final EditingDomain editingDomain = getEditingDomain(eObject); @SuppressWarnings({ "rawtypes", "unchecked" }) final List<?> moveUpList = new ArrayList( IStructuredSelection.class.cast(tableViewer.getSelection()).toList()); sortSelectionBasedOnIndex(moveUpList, containments); for (final Object moveUpObject : moveUpList) { final int currentIndex = containments.indexOf(moveUpObject); if (currentIndex <= 0) { return; } editingDomain.getCommandStack() .execute( new MoveCommand(editingDomain, eObject, structuralFeature, currentIndex, currentIndex - 1)); } } }); moveDownButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { final List<?> containments = (List<?>) eObject.eGet(structuralFeature, true); final EditingDomain editingDomain = getEditingDomain(eObject); @SuppressWarnings({ "rawtypes", "unchecked" }) final List<?> moveDownList = new ArrayList( IStructuredSelection.class.cast(tableViewer.getSelection()).toList()); sortSelectionBasedOnIndex(moveDownList, containments); Collections.reverse(moveDownList); final int maxIndex = containments.size() - 1; for (final Object moveDownObject : moveDownList) { final int currentIndex = containments.indexOf(moveDownObject); if (currentIndex < 0 || currentIndex == maxIndex) { return; } editingDomain.getCommandStack() .execute( new MoveCommand(editingDomain, eObject, structuralFeature, currentIndex, currentIndex + 1)); } } }); }