@Override public void createLinkingIssueResolutions(Issue issue, IssueResolutionAcceptor acceptor) { super.createLinkingIssueResolutions(issue, acceptor); Matcher m = REF_PATTERN.matcher(issue.getMessage()); if (m.find()) { final String key = m.group(1); acceptor.accept( issue, "Import " + key + " from Puppet Forge", "Import the missing " + key + " module from the Puppet Forge repository", null, new ISemanticModification() { @Override public void apply(EObject element, IModificationContext context) throws Exception { IWizardDescriptor descriptor = workbench .getImportWizardRegistry() .findWizard("com.puppetlabs.geppetto.ui.ImportPuppetModuleFromForgeWizard"); IWorkbenchWizard wizard = descriptor.createWizard(); WizardDialog wd = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard); ((NewWithKeyword) wizard).startWithKeyword(key); wd.setTitle(wizard.getWindowTitle()); wd.open(); } }); acceptor.accept( issue, "Import " + key + " from local disk", "Import the missing " + key + " module from a local source folder", null, new ISemanticModification() { @Override public void apply(EObject element, IModificationContext context) throws Exception { IWizardDescriptor descriptor = workbench .getImportWizardRegistry() .findWizard("com.puppetlabs.geppetto.ui.ImportPuppetModuleFromSourceWizard"); IWorkbenchWizard wizard = descriptor.createWizard(); WizardDialog wd = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard); wd.setTitle(wizard.getWindowTitle()); wd.open(); } }); } }
private void printError(Issue issue) { DeltajFile file = getDeltajFileFromTmpLine(issue.getLineNumber()); String s = "" + (issue.isSyntaxError() ? "SYNTAX " : "") + "ERROR" + "\n" + (file != null ? "LINE:\t\t" + (issue.getLineNumber() - file.getStartLine()) + "\n" : "") + (file != null ? "FILE:\t\t" + file.getMember().getFullPath() + "\n" : "") + "DESCRIPTION:\t" + issue.getMessage() + "\n\n"; consoleMessageStream.print(s); this.errors++; }
public String apply(Object input) { if (input instanceof Issue) { Issue issue = (Issue) input; StringBuffer result = new StringBuffer(); if (showSeverity) { result.append(issue.getSeverity().name()); result.append(" "); } result.append('"'); result.append(issue.getMessage()); result.append('"'); result.append(" at \""); result.append(getIssueLocationText(issue)); result.append("\""); return result.toString(); } else if (input == null) return "null"; return input.getClass() + ": " + input.toString(); }
@Fix(IssueCodes.INVALID_TYPE_ARGUMENTS_ON_TYPE_LITERAL) public void fixTypeArguments(final Issue issue, IssueResolutionAcceptor acceptor) { String message = issue.getMessage(); String fixup = "Remove invalid type arguments"; if (message.contains("argument.")) { fixup = "Remove invalid type argument"; } acceptor.accept( issue, fixup, fixup, null, new IModification() { @Override public void apply(IModificationContext context) throws Exception { IXtextDocument document = context.getXtextDocument(); document.replace(issue.getOffset(), issue.getLength(), ""); } }); }