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


Java SchedulerEvent类代码示例

本文整理汇总了Java中org.netbeans.modules.parsing.spi.SchedulerEvent的典型用法代码示例。如果您正苦于以下问题:Java SchedulerEvent类的具体用法?Java SchedulerEvent怎么用?Java SchedulerEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的package包/类
@Override
public void run(@NonNull Result result, SchedulerEvent event) {
    Parameters.notNull("result", result);   //NOI18N
    final CompilationInfo info = CompilationInfo.get(result);
    if (info == null) {
        throw new IllegalArgumentException(String.format("Result %s [%s] does not provide CompilationInfo",    //NOI18N
                result.toString(),
                result.getClass().getName()));
    }
    try {
        JavaSourceAccessor.getINSTANCE().setJavaSource(info, javaSource);
        this.task.run(info);
    } catch (Exception ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:JavaSourceAccessor.java

示例2: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的package包/类
public @Override void run(ParserResult result, SchedulerEvent event) {
    final Document doc = getDocument();
    if (doc == null) {
        LOG.log(Level.INFO, "SemanticHighlighter: Cannot get document!");
        return ;
    }
    SpiSupportAccessor.getInstance().setCancelSupport(cancel);
    try {
        ParserManager.parse(Collections.singleton(result.getSnapshot().getSource()), new UserTask() {
            public @Override void run(ResultIterator resultIterator) throws ParseException {
                refreshErrors(resultIterator);
            }

        });
    } catch (ParseException e) {
        LOG.log(Level.WARNING, null, e);
    } finally {
        SpiSupportAccessor.getInstance().removeCancelSupport(cancel);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:GsfHintsProvider.java

示例3: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的package包/类
@Override
public void run(Result result, SchedulerEvent event) {
    resume();

    if (isCancelled()) {
        return;
    }

    YamlParserResult ypr = (YamlParserResult) result;
    if (ypr == null || ypr.getRootNodes().isEmpty()) {
        this.semanticHighlights = Collections.emptyMap();
        return;
    }

    List<Node> rootNodes = ypr.getRootNodes();

    Map<OffsetRange, Set<ColoringAttributes>> highlights =
            new HashMap<OffsetRange, Set<ColoringAttributes>>(100);

    IdentityHashMap<Object, Boolean> seen = new IdentityHashMap<Object, Boolean>(100);
    for (Node root : rootNodes) {
        addHighlights(ypr, root, highlights, seen, 0);
    }

    this.semanticHighlights = highlights;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:YamlSemanticAnalyzer.java

示例4: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的package包/类
@Override
public void run(Result result, SchedulerEvent event) {
    resume();
    
    try {
        CssParserResult parserResultWrapper = (CssParserResult)result;
        EditorFeatureContext context = new EditorFeatureContext(parserResultWrapper, caretDocumentPosition);
        Set<OffsetRange> occurrences = CssModuleSupport.getMarkOccurrences(context, featureCancel);

        if(featureCancel.isCancelled()) {
            return ;
        }

        Map<OffsetRange, ColoringAttributes> occurrencesMapLocal = new HashMap<>();
        for(OffsetRange range : occurrences) {
            occurrencesMapLocal.put(range, ColoringAttributes.MARK_OCCURRENCES);
        }

        occurrencesMap = occurrencesMapLocal;
    } finally {
        featureCancel = null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:CssOccurrencesFinder.java

示例5: createParserTask

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的package包/类
@Override
protected ParserResultTask createParserTask(FileObject file, FoldProcessor processor) {
    final ParserResultTask wrapped = super.createParserTask(file, processor);
    return new JavaParserResultTask(JavaSource.Phase.RESOLVED, TaskIndexingMode.ALLOWED_DURING_SCAN) {
        
        @Override
        public void run(Parser.Result result, SchedulerEvent event) {
            wrapped.run(result, event);
        }
        
        @Override
        public int getPriority() {
            return wrapped.getPriority();
        }
        
        @Override
        public Class<? extends Scheduler> getSchedulerClass() {
            return wrapped.getSchedulerClass();
        }
        
        @Override
        public void cancel() {
            wrapped.cancel();
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:ResourceStringFoldProvider.java

示例6: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的package包/类
@Override
public void run(Result result, SchedulerEvent event) {
    cancelled = false; //resume
    final Map<OffsetRange, Set<ColoringAttributes>> highlights = new HashMap<>();
    HtmlParserResult htmlResult = (HtmlParserResult) result;

    String sourceMimetype = Utils.getWebPageMimeType(htmlResult.getSyntaxAnalyzerResult());
    //process extensions
    for (HtmlExtension ext : HtmlExtensions.getRegisteredExtensions(sourceMimetype)) {
        if (cancelled) {
            return;
        }
        highlights.putAll(ext.getHighlights(htmlResult, event));
    }

    semanticHighlights = highlights;

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:HtmlSemanticAnalyzer.java

示例7: createSchedulerEvents

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的package包/类
@Override
public Map<Class<? extends Scheduler>,SchedulerEvent> createSchedulerEvents(
        @NonNull final Source source,
        @NonNull final Iterable<? extends Scheduler> schedulers,
        @NonNull final SourceModificationEvent sourceModificationEvent) {
    Parameters.notNull("source", source);   //NOI18N
    Parameters.notNull("schedulers", schedulers);   //NOI18N
    Parameters.notNull("sourceModificationEvent", sourceModificationEvent); //NOI18N
    final Map<Class<? extends Scheduler>,SchedulerEvent> result = new HashMap<Class<? extends Scheduler>, SchedulerEvent>();
    for (Scheduler scheduler : schedulers) {
        final SchedulerEvent schedulerEvent = SchedulerAccessor.get ().createSchedulerEvent (scheduler, sourceModificationEvent);
        if (schedulerEvent != null) {
            result.put (scheduler.getClass (), schedulerEvent);
        }
    }
    synchronized (TaskProcessor.INTERNAL_LOCK) {
        source.schedulerEvents = result;
    }
    return Collections.unmodifiableMap(result);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:Source.java

示例8: update

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的package包/类
synchronized void update(
    final Class<? extends ParserResultTask<? extends Parser.Result>> task,
    final SchedulerEvent event) {
    LOG.log(
       Level.FINE,
       "UPDATE: {0} {1}",   //NOI18N
       new Object[]{
           task.getSimpleName(),
           event
       });
    if (event instanceof BaseScheduler.Event) {
        final Long expectedId = toExpect.get(task);
        if (expectedId != null && expectedId == ((BaseScheduler.Event)event).getId()) {
            toExpect.remove(task);
            notify();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SchedulerEventTest.java

示例9: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的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

示例10: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的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

示例11: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的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

示例12: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的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

示例13: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的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

示例14: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的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

示例15: run

import org.netbeans.modules.parsing.spi.SchedulerEvent; //导入依赖的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


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