本文整理汇总了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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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();
}
};
}
示例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;
}
示例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);
}
示例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();
}
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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
}
示例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
}
示例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();
}
}