use of com.avaloq.tools.ddk.check.runtime.quickfix.CoreIssueResolution in project dsl-devkit by dsldevkit.
the class DefaultCheckQuickfixProvider method getResolutions.
/**
* Invokes quickfix methods and creates IssueResolution objects. Both "native" quickfix providers and Check
* quickfix providers are considered.
* <p>
* {@inheritDoc}
*/
@Override
protected List<IssueResolution> getResolutions(final Issue issue, final List<Method> fixMethods) {
final ICoreIssueResolutionAcceptor coreIssueResolutionAcceptor = coreIssueResolutionAcceptorProvider.get();
final IssueResolutionAcceptor defaultIssueResolutionAcceptor = issueResolutionAcceptorProvider.get();
for (Method fixMethod : fixMethods) {
try {
fixMethod.setAccessible(true);
if (Lists.newArrayList(getClass().getMethods()).contains(fixMethod)) {
if (fixMethod.getAnnotation(CoreFix.class) != null) {
fixMethod.invoke(this, issue, coreIssueResolutionAcceptor);
} else {
// Legacy code: executes native quickfixes
fixMethod.invoke(this, issue, defaultIssueResolutionAcceptor);
}
} else {
// the fix method
for (final ICoreQuickfixProvider p : getProviders()) {
if (Iterables.contains(methodsForProvider(p, issue.getCode()), fixMethod)) {
fixMethod.invoke(p, issue, coreIssueResolutionAcceptor);
}
}
}
// CHECKSTYLE:OFF
} catch (Exception e) {
// CHECKSTYLE:ON
// $NON-NLS-1$
LOGGER.error("Error executing fix method", e);
}
}
final Iterable<IssueResolution> allResolutions = Iterables.concat(Lists.transform(coreIssueResolutionAcceptor.getIssueResolutions(), new Function<CoreIssueResolution, IssueResolution>() {
@Override
public IssueResolution apply(final CoreIssueResolution from) {
return new IssueResolutionWrapper(from);
}
}), defaultIssueResolutionAcceptor.getIssueResolutions());
return Lists.newArrayList(allResolutions);
}
use of com.avaloq.tools.ddk.check.runtime.quickfix.CoreIssueResolution in project dsl-devkit by dsldevkit.
the class CoreIssueResolutionAcceptor method accept.
public void accept(final Issue issue, final String label, final String description, final String image, final ICoreSemanticModification semanticModification) {
CoreSemanticModificationWrapper modificationWrapper = new CoreSemanticModificationWrapper(issue.getUriToProblem(), semanticModification);
issueResolutions.add(new CoreIssueResolution(label, description, image, modificationContextFactory.createModificationContext(issue), modificationWrapper));
}
Aggregations