当前位置: 首页>>代码示例>>Java>>正文


Java HintsController.setErrors方法代码示例

本文整理汇总了Java中org.netbeans.spi.editor.hints.HintsController.setErrors方法的典型用法代码示例。如果您正苦于以下问题:Java HintsController.setErrors方法的具体用法?Java HintsController.setErrors怎么用?Java HintsController.setErrors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.spi.editor.hints.HintsController的用法示例。


在下文中一共展示了HintsController.setErrors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: refreshHints

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
static final void refreshHints(ResultIterator controller) {
    List<ErrorDescription>[] allHints = new ArrayList[3];
    collectHints(controller, allHints, controller.getSnapshot());
    FileObject f = controller.getSnapshot().getSource().getFileObject();
    if (f != null) {
        if (allHints[0] != null) {
            HintsController.setErrors(f, HintsTask.class.getName(), allHints[0]);
        }
        if (allHints[1] != null) {
            HintsController.setErrors(f, SuggestionsTask.class.getName(), allHints[1]);
        }
        if (allHints[2] != null) {
            HintsController.setErrors(f, GsfHintsFactory.LAYER_NAME, allHints[2]);
        }
    } else {
        LOG.warning("Source " + controller.getSnapshot().getSource() + " returns null from getFileObject()"); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:GsfHintsManager.java

示例2: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
public void run(CompilationInfo info) {
    cancel.set(false);

    FileObject file = info.getFileObject();
    int[] selection = SelectionAwareJavaSourceTaskFactory.getLastSelection(file);

    if (selection == null) {
        //nothing to do....
        HintsController.setErrors(info.getFileObject(), IntroduceHint.class.getName(), Collections.<ErrorDescription>emptyList());
    } else {
        HintsController.setErrors(info.getFileObject(), IntroduceHint.class.getName(), computeError(info, selection[0], selection[1], null, new EnumMap<IntroduceKind, String>(IntroduceKind.class), cancel));

        Document doc = info.getSnapshot().getSource().getDocument(false);

        if (doc != null) {
            PositionRefresherHelperImpl.setVersion(doc, selection[0], selection[1]);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:IntroduceHint.java

示例3: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void run(ProtobufEditorParserResult result, SchedulerEvent event) {
    Assert.notNull(result);

    Document document = result.getSnapshot().getSource().getDocument(false);
    List<ErrorDescription> errorDescriptions = new LinkedList<>();

    for (ParsingError error : result.errors()) {
        errorDescriptions.add(
                ErrorDescriptionFactory.createErrorDescription(
                        Severity.ERROR,
                        error.message(),
                        document,
                        error.line()));
    }

    HintsController.setErrors(document, LAYER_ID, errorDescriptions);
}
 
开发者ID:mwillema,项目名称:protobuf-netbeans-plugin,代码行数:19,代码来源:ParsingErrorHighlightingTask.java

示例4: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
/**
 * Called when parser is finished.
 *
 * @param result The result of parsing
 * @param event
 */
@Override
public void run(ApexParserResult apexResult, SchedulerEvent event) {
    try {
        List<? extends ParseException> syntaxErrors = apexResult.getApexParser().getSyntaxErrors();
        StyledDocument document = (StyledDocument) apexResult.getSnapshot().getSource().getDocument(false);
        List<ErrorDescription> errors = new ArrayList<>();
        for (ParseException syntaxError : syntaxErrors) {
            ErrorDescription errorDescription = createError(document, syntaxError);
            errors.add(errorDescription);
        }
        SalesforceDataNode currentNode = (SalesforceDataNode)ProjectUtils.getCurrentNode();
        List<ErrorDescription> serverErrors = ServerErrors.getInstance().getErrors(apexResult.getSnapshot().getSource().getFileObject());
        if (currentNode != null) {
            currentNode.setHasLocalErrors(!errors.isEmpty());
            currentNode.setHasServerErrors(!serverErrors.isEmpty());
        }
        HintsController.setErrors(document, APEX_ERROR_LAYER, errors);
        HintsController.setErrors(document, DEPLOY_ERROR_LAYER, serverErrors);
    } catch (BadLocationException | org.netbeans.modules.parsing.spi.ParseException error) {
        Exceptions.printStackTrace(error);
    }
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:29,代码来源:ApexSyntaxErrorHighlightingTask.java

示例5: onFailure

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void onFailure(GradleConnectionException gradleConnectionException) {
    LOG.log(Level.INFO, outputStream.toString());
    LOG.log(Level.INFO, errorOutputStream.toString());
    Throwable realException = getRealException(gradleConnectionException);
    boolean createdErrors = createErrors(realException);
    if (createdErrors) {
        for (DocumentErrorsWrapper documentError : documents.values()) {
            ServerErrors.getInstance().addErrors(documentError.documentFileObject, documentError.getErrors());
            StyledDocument document = documentError.getDocument();
            List<ErrorDescription> errors = documentError.getErrors();
            if (document != null && errors != null) {
                HintsController.setErrors(document, DEPLOY_ERROR_LAYER, errors);
            }
            documentError.updateIcon();
        }
    } else {
        SalesforceErrorsTopComponent.addNofitfy(salesforceProject,getDisplayableErrorMessage(realException));
        MessagesUtil.showError(getDisplayableErrorMessage(realException));
    }
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:22,代码来源:GradleDeployResultHandler.java

示例6: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void run(ParserResult result, SchedulerEvent event) {
    List<? extends Error> listDiagnostics = result.getDiagnostics();
    Document document = result.getSnapshot().getSource().getDocument(false);
    List<ErrorDescription> errors = new ArrayList<>();
    listDiagnostics.stream().forEach((error) -> {
        try {
            ErrorDescription errorDescription = ErrorDescriptionFactory
                    .createErrorDescription(
                            Severity.ERROR,
                            "",
                            document,
                            document.createPosition(error.getStartPosition()),
                            document.createPosition(error.getEndPosition()));
            errors.add(errorDescription);
        } catch (BadLocationException ex) {
            ExceptionManager.logException(ex);
        }
    });
    HintsController.setErrors(document, "idontknow", errors);
}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:22,代码来源:RoutesSyntaxErrorHighlightingTask.java

示例7: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void run(ParserResult result, SchedulerEvent event) {
    Document document = result.getSnapshot().getSource().getDocument(false);
    ScalaTemplateValidator scalaTemplateValidator = new ScalaTemplateValidator();
    List<? extends Error> listDiagnostics = scalaTemplateValidator.validateFile(document);
    List<ErrorDescription> errors = new ArrayList<>();
    listDiagnostics.stream().forEach((error) -> {
        try {
            ErrorDescription errorDescription = ErrorDescriptionFactory
                    .createErrorDescription(
                            Severity.ERROR,
                            error.getDisplayName(),
                            document,
                            document.createPosition(error.getStartPosition()),
                            document.createPosition(error.getEndPosition()));
            errors.add(errorDescription);
        } catch (BadLocationException ex) {
            ExceptionManager.logException(ex);
        }
    });
    HintsController.setErrors(document, "idontknow", errors);
}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:23,代码来源:ScalaTemplateSyntaxErrorHighlightingTask.java

示例8: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void run(ECParserResult result, SchedulerEvent event) {
    List<SyntaxError> syntaxErrors = result.getErrors();
    Document document = result.getSnapshot().getSource().getDocument(false);
    List<ErrorDescription> errors = new ArrayList<>();
    for (SyntaxError syntaxError : syntaxErrors) {
        String message = syntaxError.getMessage();
        int line = syntaxError.getLine();
        if (line <= 0) {
            continue;
        }
        ErrorDescription errorDescription = ErrorDescriptionFactory.createErrorDescription(
                Severity.ERROR,
                message,
                document,
                line);
        errors.add(errorDescription);
    }
    HintsController.setErrors(document, "editorconfig", errors); // NOI18N
}
 
开发者ID:junichi11,项目名称:netbeans-editorconfig-editor,代码行数:21,代码来源:SyntaxErrorsTask.java

示例9: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void run(ECParserResult result, SchedulerEvent event) {
  List<SyntaxError> syntaxErrors = result.getErrors();
  Document document = result.getSnapshot().getSource().getDocument(false);
  List<ErrorDescription> errors = new ArrayList<>();
  for (SyntaxError syntaxError : syntaxErrors) {
    String message = syntaxError.getMessage();
    int line = syntaxError.getLine();
    if (line <= 0) {
      continue;
    }
    ErrorDescription errorDescription = ErrorDescriptionFactory.createErrorDescription(
            Severity.ERROR,
            message,
            document,
            line);
    errors.add(errorDescription);
  }
  HintsController.setErrors(document, EDITORCONFIG, errors); // NOI18N
}
 
开发者ID:welovecoding,项目名称:editorconfig-netbeans,代码行数:21,代码来源:SyntaxErrorsTask.java

示例10: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
    public void run(Result result, SchedulerEvent event) {
        try {
            Document document = result.getSnapshot().getSource().getDocument(true);
            List<ErrorDescription> errors = new ArrayList<>();
            EditorParserResult parserResult = (EditorParserResult) result;
            List<SyntaxError> syntaxErrors = parserResult.getSyntaxErrors();
            int cnt = 0;
            for (SyntaxError syntaxError : syntaxErrors) {
                ErrorDescription errorDescription = ErrorDescriptionFactory.createErrorDescription(
                        Severity.ERROR,
                        syntaxError.message,
                        document,
                        document.createPosition(syntaxError.start),
                        document.createPosition(syntaxError.stop));
                errors.add(errorDescription);
                cnt++;
//                Logger.Log("hintError[" + (cnt) + "]: " + errorDescription.getDescription());
            }
//            Logger.Log("getErrors: " + offset + ":" + cnt + " - " + parserResult.getParser().getGrammarFileName());
            HintsController.setErrors(document, "editor", errors);
        } catch (BadLocationException | ParseException ex) {
//            ex.printStackTrace();
        }
    }
 
开发者ID:daimor,项目名称:NBStudio,代码行数:26,代码来源:SyntaxErrorsHighlightingTask.java

示例11: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void run(final Result result, SchedulerEvent event) {
    final DeclarativeHintsParser.Result res = ParserImpl.getResult(result);
    final List<ErrorDescription> errors;

    if (res != null) {
        errors = computeErrors(res, result.getSnapshot().getText(), result.getSnapshot().getSource().getFileObject());
    } else {
        errors = Collections.emptyList();
    }

    HintsController.setErrors(result.getSnapshot().getSource().getFileObject(),
                              HintsTask.class.getName(),
                              errors);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:HintsTask.java

示例12: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void run(FxmlParserResult result, SchedulerEvent event) {
    Collection<ErrorMark> marks = result.getProblems();
    
    document = result.getSnapshot().getSource().getDocument(false);
    if (document == null) {
        // no op
        return;
    }
    List<ErrorDescription> descs = new ArrayList<ErrorDescription>();
    for (ErrorMark m : marks) {
        try {
            descs.add(ErrorDescriptionFactory.createErrorDescription(
                    m.isError() ? Severity.ERROR : Severity.WARNING,
                    m.getMessage(),
                    document, 
                    NbDocument.createPosition(document, 
                        m.getOffset(), Position.Bias.Forward),
                    NbDocument.createPosition(document, 
                        m.getOffset() + m.getLen(), Position.Bias.Forward))
                );
        } catch (BadLocationException ex) {
            // ignore
        }
    }
    HintsController.setErrors(document, "fxml-parsing", descs);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ErrorHintProvider.java

示例13: setAnnotations

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
public static void setAnnotations(Snapshot snap, List<ErrorDescription> descs) {
    if (snap.getMimePath().size() == 1) {
        Document doc = snap.getSource().getDocument(false);
        if (doc == null) {
            // the document may have disappeared before errors were computed.
            return;
        }
        HintsController.setErrors(doc, "java-hints", descs);
        return;
    }
    
    synchronized (hints) {
        hints.put(snap, descs);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:EmbeddedHintsCollector.java

示例14: run

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
@Override
public void run(Parser.Result result, SchedulerEvent event) {
    cancelled = false;
    final Snapshot mySnapshot = result.getSnapshot();
    if (mySnapshot.getMimePath().size() > 1) {
        // I do not want the inner mimetype
        return;
    }
    if (mySnapshot.getMimeType().equals("text/x-java")) {
        // ignore toplevel java
        return;
    }
    try {
        synchronized (hints) {
            for (Snapshot snap : hints.keySet()) {
                if (snap.getSource().equals(mySnapshot.getSource())) {
                    collectResult(snap);
                }
            }
        }
        if (cancelled) {
            return;
        }
        if (allHints != null) {
            HintsController.setErrors(result.getSnapshot().getSource().getDocument(false), "java-hints", allHints);
        }
    } finally {
        synchronized (hints) {
            hints.clear();
            allHints = null;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:EmbeddedHintsCollector.java

示例15: hideSurroundWithHint

import org.netbeans.spi.editor.hints.HintsController; //导入方法依赖的package包/类
private void hideSurroundWithHint() {
    if (surrounsWithFixes != null)
        surrounsWithFixes = null;
    if (errorDescription != null) {
        errorDescription = null;
        HintsController.setErrors(doc, SURROUND_WITH, Collections.<ErrorDescription>emptySet());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:AbbrevDetection.java


注:本文中的org.netbeans.spi.editor.hints.HintsController.setErrors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。