Revision 6fd99a64
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java | ||
---|---|---|
18 | 18 |
import java.util.Set; |
19 | 19 |
import java.util.UUID; |
20 | 20 |
|
21 |
import org.eclipse.core.runtime.ICoreRunnable; |
|
21 | 22 |
import org.eclipse.core.runtime.jobs.Job; |
22 | 23 |
import org.eclipse.jface.viewers.IStructuredSelection; |
23 | 24 |
|
... | ... | |
169 | 170 |
|
170 | 171 |
IIdentifiableEntityServiceConfigurator configurator = bulkEditorQuery.getSearchConfigurator(); |
171 | 172 |
|
172 |
// int pageSize = configurator.getPageSize()!=null?configurator.getPageSize():getPageSize(); |
|
173 |
// long count = countEntities(configurator); |
|
174 |
// int totalWork = count>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)count; |
|
175 |
// String jobLabel = String.format(Messages.AbstractBulkEditorInput_LOADING, getName(), bulkEditorQuery.getSearchString()); |
|
176 |
// searchJob = Job.create(jobLabel, (ICoreRunnable) monitor -> { |
|
177 |
// monitor.beginTask(jobLabel, totalWork); |
|
178 |
// int pageNumber = 0; |
|
173 |
int pageSize = configurator.getPageSize()!=null?configurator.getPageSize():getPageSize(); |
|
174 |
configurator.setPageSize(pageSize); |
|
175 |
long count = countEntities(configurator); |
|
176 |
int totalWork = count>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)count; |
|
177 |
String jobLabel = String.format(Messages.AbstractBulkEditorInput_LOADING, getName(), bulkEditorQuery.getSearchString()); |
|
178 |
searchJob = Job.create(jobLabel, (ICoreRunnable) monitor -> { |
|
179 |
monitor.beginTask(jobLabel, totalWork); |
|
180 |
int pageNumber = 0; |
|
179 | 181 |
List<T> entities; |
180 |
// do {
|
|
181 |
// if (monitor.isCanceled()) {
|
|
182 |
// break;
|
|
183 |
// }
|
|
184 |
// configurator.setPageNumber(pageNumber);
|
|
182 |
do { |
|
183 |
if (monitor.isCanceled()) { |
|
184 |
break; |
|
185 |
} |
|
186 |
configurator.setPageNumber(pageNumber); |
|
185 | 187 |
entities = listEntities(configurator); |
186 | 188 |
model.addAll(entities); |
187 |
// //select if entity is loaded
|
|
188 |
// if(selection!=null && model.containsAll(selection.toList())){
|
|
189 |
// EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection);
|
|
190 |
// }
|
|
191 |
// pageNumber++;
|
|
192 |
// monitor.worked(pageSize);
|
|
193 |
// long workedLong = pageSize*pageNumber;
|
|
194 |
// int loadedCount = workedLong>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)workedLong;
|
|
195 |
// monitor.setTaskName(String.format(Messages.AbstractBulkEditorInput_LOADED, loadedCount, totalWork, getName()));
|
|
196 |
// } while (!entities.isEmpty());
|
|
197 |
// monitor.done();
|
|
189 |
//select if entity is loaded |
|
190 |
if(selection!=null && model.containsAll(selection.toList())){ |
|
191 |
EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection); |
|
192 |
} |
|
193 |
pageNumber++; |
|
194 |
monitor.worked(pageSize); |
|
195 |
long workedLong = pageSize*pageNumber; |
|
196 |
int loadedCount = workedLong>Integer.MAX_VALUE?Integer.MAX_VALUE:(int)workedLong; |
|
197 |
monitor.setTaskName(String.format(Messages.AbstractBulkEditorInput_LOADED, loadedCount, totalWork, getName())); |
|
198 |
} while (!entities.isEmpty()); |
|
199 |
monitor.done(); |
|
198 | 200 |
EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection); |
199 |
// });
|
|
200 |
// searchJob.schedule();
|
|
201 |
}); |
|
202 |
searchJob.schedule(); |
|
201 | 203 |
} |
202 | 204 |
} |
203 | 205 |
|
Also available in: Unified diff
ref #7505 re-enable parallel loading for bulk editor