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.editor.quickfix;
 

Author(s):
Knut Wannheden - Initial contribution and API
Heiko Behrens
Jan Koehnlein
	private static final Logger LOG = Logger.getLogger(AbstractDeclarativeQuickfixProvider.class);
	protected Predicate<MethodgetFixMethodPredicate(final String issueCode) {
		return new Predicate<Method>() {
			public boolean apply(Method input) {
				Fix annotation = input.getAnnotation(Fix.class);
				boolean result = annotation != null && issueCode.equals(annotation.value())
						&& input.getParameterTypes().length == 2 && . == input.getReturnType()
				return result;
			}
		};
	}
	protected List<IssueResolutiongetResolutions(Issue issueList<MethodfixMethods) {
		for (Method fixMethod : fixMethods) {
			try {
				fixMethod.setAccessible(true);
				fixMethod.invoke(thisissueissueResolutionAcceptor);
catch (Exception e) {
				.error("Error executing fix method"e);
			}
		}
		return issueResolutionAcceptor.getIssueResolutions();
	}
			String issueCode) {
		List<Methodmethods = Lists.newArrayList(clazz.getMethods());
		return Iterables.filter(methodsgetFixMethodPredicate(issueCode));
	}
	protected List<MethodgetFixMethods(final Issue issue) {
		return Lists.newArrayList(collectMethods(getClass(), issue.getCode()));
	}
	public boolean hasResolutionFor(final String issueCode) {
		if (issueCode == null)
			return false;
		// TODO : cache this if it's a performance hit
		Iterable<Methodmethods = collectMethods(getClass(), issueCode);
		return methods.iterator().hasNext();
	}
	public List<IssueResolutiongetResolutions(final Issue issue) {
		List<MethodfixMethods = getFixMethods(issue);
		return getResolutions(issuefixMethods);
	}
	}

for testing without guice
	public void setIssueResolutionAcceptorProvider(Provider<IssueResolutionAcceptorissueResolutionAcceptorProvider) {
		this. = issueResolutionAcceptorProvider;
	}
New to GrepCode? Check out our FAQ X