Project

General

Profile

Revision 012d4a65

ID012d4a658b2e22de8f8b67be103da50b235aeb99
Parent 696940b9
Child a433aeeb

Added by Patrick Plitzner about 2 years ago

Revert "ref #6321 Wait for canceled search to finish before starting new search"

This reverts commit 36ee2736a960471161a354379845f770027286c4.

View differences:

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/AbstractBulkEditorInput.java
19 19
import java.util.UUID;
20 20

  
21 21
import org.eclipse.core.runtime.ICoreRunnable;
22
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
23 22
import org.eclipse.core.runtime.jobs.Job;
24
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
25 23
import org.eclipse.jface.viewers.IStructuredSelection;
26 24

  
27 25
import ca.odell.glazedlists.BasicEventList;
......
76 74

  
77 75
    private Job searchJob;
78 76

  
79
    private volatile boolean hasSearchFinished;
80

  
81 77
	public AbstractBulkEditorInput() {
82 78
	    super(true);
83 79
	    this.conversation = CdmStore.createConversation();
......
161 157
	    //cancel previous search job
162 158
	    if(searchJob!=null && searchJob.getState()!=Job.NONE){
163 159
	        searchJob.cancel();
164
	        while(!hasSearchFinished){
165
	            //wait for search to finish
166
	            try {
167
	                Thread.sleep(100);
168
	            } catch (InterruptedException e) {
169
	                e.printStackTrace();
170
	            }
171
	        }
172 160
	        searchJob = null;
173 161
	    }
174 162
	    model.clear();
......
207 195
                    if (monitor.isCanceled()) {
208 196
                        break;
209 197
                    }
210

  
211 198
                    configurator.setPageNumber(pageNumber);
212 199
                    entities = listEntities(configurator);
213 200
                    model.addAll(entities);
......
224 211
	            monitor.done();
225 212
	            EventUtility.postAsyncEvent(WorkbenchEventConstants.BULK_EDITOR_SEARCH_FINISHED, selection);
226 213
	        });
227
	        searchJob.addJobChangeListener(new JobChangeAdapter(){
228
	            @Override
229
	            public void done(IJobChangeEvent event) {
230
	                hasSearchFinished = true;
231
	            }
232
	        });
233
	        hasSearchFinished = false;
234 214
	        searchJob.schedule();
235 215
		}
236 216
	}

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)