Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html /
 
 package org.eclipse.xtext.ui.search;
 
import  org.eclipse.core.runtime.IProgressMonitor;
import  org.eclipse.core.runtime.IStatus;
import  org.eclipse.core.runtime.Status;
import  org.eclipse.core.runtime.jobs.Job;
public class IteratorJob extends Job {
	private static final int TIME_THRESHOLD = 250;
		this. = dialog;
		setSystem(true);
	}
	public void init(Iterable<IEObjectDescriptionmatchResult) {
		this. = matchResult.iterator();
		 = Lists.newArrayList();
	}
	protected IStatus run(IProgressMonitor monitor) {
		long startTime = System.currentTimeMillis();
		while (.hasNext()) {
			if (next.getQualifiedName() != null && next.getEObjectURI() != null && next.getEClass() != null) {
				.add(next);
				long endTime = System.currentTimeMillis();
				if (.size() == .getHeightInChars() || endTime - startTime > ) {
					if (monitor.isCanceled()) {
						return Status.CANCEL_STATUS;
					}
					startTime = endTime;
				}
			}
		}
		return Status.OK_STATUS;
	}
		Collections.sort(resultnew Comparator<IEObjectDescription>() {
				if (diff == 0) {
					String className1 = o1.getEClass().getName();
					String className2 = o2.getEClass().getName();
					if(className1 == null)
						diff = className2 == null ? 0 : -1;
					else
						diff = className2 == null ? 1 : className1.compareToIgnoreCase(className2);
					if (diff == 0) {
					}
				}
				return diff;
			}
		});
		return result;
	}
New to GrepCode? Check out our FAQ X