List of usage examples for org.eclipse.jdt.internal.core.search IRestrictedAccessConstructorRequestor IRestrictedAccessConstructorRequestor
IRestrictedAccessConstructorRequestor
From source file:org.springsource.ide.eclipse.commons.frameworks.core.async.FluxConstructorSearch.java
License:Open Source License
public Flux<JavaConstructorHint> search() { validate();/*from w w w . ja v a 2 s .c o m*/ if (scope == null) { return Flux.empty(); } final FluxSearchRequestor requestor = new FluxSearchRequestor(); Job job = new Job("Search for " + pattern) { @Override protected IStatus run(IProgressMonitor monitor) { long start = System.currentTimeMillis(); debug("Starting search for '" + pattern + "'"); try { engine.searchAllConstructorDeclarations(null, pattern.toCharArray(), patternRule, scope, new IRestrictedAccessConstructorRequestor() { @Override public void acceptConstructor(int modifiers, char[] simpleTypeName, int parameterCount, char[] signature, char[][] parameterTypes, char[][] parameterNames, int typeModifiers, char[] packageName, int extraFlags, String path, AccessRestriction access) { requestor.acceptSearchMatch(JavaConstructorHint.asHint(modifiers, simpleTypeName, parameterCount, signature, parameterTypes, parameterNames, typeModifiers, packageName, extraFlags, path, access)); } }, IJavaSearchConstants.FORCE_IMMEDIATE_SEARCH, monitor); requestor.done(); } catch (Exception e) { debug("Canceled search for: " + pattern); debug(" exception: " + ExceptionUtil.getMessage(e)); long duration = System.currentTimeMillis() - start; debug(" duration: " + duration + " ms"); requestor.cancel(); } return Status.OK_STATUS; } }; job.setSystem(useSystemJob); job.setPriority(jobPriority); job.schedule(); return requestor.asFlux(); }