public void moveAllocations(List<Integer> indexes, Allocation target, boolean before) { int startIndex = target.getIndex(); if (before) { startIndex--; } for (int i = startIndex; i < startIndex + indexes.size(); i++) { allocations.get(indexes.get(i - startIndex)).setIndex(i); } for (int i = startIndex + indexes.size(); i < allocations.size(); i++) { allocations.get(i).setIndex(allocations.get(i).getIndex() + indexes.size()); } Collections.sort(allocations); getMonitor().fireEntityChanged(this, Properties.allocations); }