本文整理汇总了Java中org.netbeans.modules.parsing.spi.ParserResultTask类的典型用法代码示例。如果您正苦于以下问题:Java ParserResultTask类的具体用法?Java ParserResultTask怎么用?Java ParserResultTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParserResultTask类属于org.netbeans.modules.parsing.spi包,在下文中一共展示了ParserResultTask类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createParserTask
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的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();
}
};
}
示例2: update
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的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();
}
}
}
示例3: addParserResultTask
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
public static void addParserResultTask (final ParserResultTask<?> task, final Source source) {
Parameters.notNull ("task", task);
Parameters.notNull ("source", source);
final SourceCache cache = SourceAccessor.getINSTANCE ().getCache (source);
TaskProcessor.addPhaseCompletionTasks (
Collections.<Pair<SchedulerTask,Class<? extends Scheduler>>>singleton(Pair.<SchedulerTask,Class<? extends Scheduler>>of(task,null)),
cache,
true);
}
示例4: create
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
/**
* Creates a new Highlighting task Scheduler for the given snapshot.
*
* @param snapshot
* @return
*/
@Override
public Collection<ParserResultTask> create(Snapshot snapshot) {
List<ParserResultTask> tasks = new ArrayList<>();
tasks.add(new ApexSyntaxErrorHighlightingTask());
tasks.add(SalesForceNavigationPanel.getPanel());
return Collections.unmodifiableList(tasks);
}
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:14,代码来源:ApexSyntaxErrorHighlightingTaskFactory.java
示例5: createParserTask
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
protected ParserResultTask createParserTask(FileObject file, FoldProcessor processor) {
FileData fd = getRegistrar(this).getFileData(file);
return new ParserTask(file, fd, fd.createProcessor(this, file));
}
示例6: testRunLoopSuspend2
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
public void testRunLoopSuspend2() throws Exception {
FileUtil.setMIMEType("foo", "text/foo"); //NOI18N
MockMimeLookup.setInstances(MimePath.parse("text/foo"), new TaskProcessorTest.FooParserFactory(), new PlainKit()); //NOI18N
final File wd = getWorkDir();
final File srcFolder = new File (wd,"src");
final FileObject srcRoot = FileUtil.createFolder(srcFolder);
final FileObject srcFile = srcRoot.createData("test.foo"); //NOI18N
final Source source = Source.create(srcFile);
final SourceCache cache = SourceAccessor.getINSTANCE().getCache(source);
final CountDownLatch taskCalled = new CountDownLatch(1);
final SchedulerTask task = new ParserResultTask() {
@Override
public void run(Parser.Result result, SchedulerEvent event) {
taskCalled.countDown();
}
@Override
public int getPriority() {
return 10;
}
@Override
public Class<? extends Scheduler> getSchedulerClass() {
return Scheduler.SELECTED_NODES_SENSITIVE_TASK_SCHEDULER;
}
@Override
public void cancel() {
}
};
runLoop(source, true);
try {
TaskProcessor.addPhaseCompletionTasks(
Arrays.asList(Pair.<SchedulerTask,Class<? extends Scheduler>>of(task,task.getSchedulerClass())),
cache,
false);
assertFalse(taskCalled.await(2000, TimeUnit.MILLISECONDS));
} finally {
runLoop(source, false);
}
assertTrue(taskCalled.await(5000, TimeUnit.MILLISECONDS));
}
示例7: removeParserResultTask
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
public static void removeParserResultTask (final ParserResultTask<?> task, final Source source) {
Parameters.notNull ("task", task);
Parameters.notNull ("source", source);
TaskProcessor.removePhaseCompletionTasks(Collections.singleton(task), source);
}
示例8: rescheduleTask
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
public static void rescheduleTask (final ParserResultTask<?> task, final Source source) {
Parameters.notNull ("task", task);
Parameters.notNull ("source", source);
TaskProcessor.rescheduleTasks (Collections.<SchedulerTask>singleton (task), source, null);
}
示例9: testParseDoesNotScheduleTasks
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
public void testParseDoesNotScheduleTasks () throws Exception {
final CountDownLatch l = new CountDownLatch(1);
MockServices.setServices (MockMimeLookup.class, TestEnvironmentFactory.class, MyScheduler.class);
MockMimeLookup.setInstances (
MimePath.get ("text/foo"), new FooParserFactory(),
new TaskFactory () {
public Collection<SchedulerTask> create (Snapshot snapshot) {
return Arrays.asList (new SchedulerTask[] {
new ParserResultTask() {
@Override
public void run(Result result, SchedulerEvent event) {
l.countDown();
}
@Override
public int getPriority() {
return 100;
}
@Override
public Class<? extends Scheduler> getSchedulerClass() {
return Scheduler.EDITOR_SENSITIVE_TASK_SCHEDULER;
}
@Override
public void cancel() {}
}
});
}
});
clearWorkDir ();
//Collection c = MimeLookup.getLookup("text/boo").lookupAll (ParserFactory.class);
FileObject workDir = FileUtil.toFileObject (getWorkDir ());
FileObject testFile = FileUtil.createData (workDir, "bla.foo");
FileUtil.setMIMEType ("foo", "text/foo");
OutputStream outputStream = testFile.getOutputStream ();
OutputStreamWriter writer = new OutputStreamWriter (outputStream);
writer.append ("Toto je testovaci file, na kterem se budou delat hnusne pokusy!!!");
writer.close ();
Source source = Source.create (testFile);
ParserManager.parse (Collections.singleton(source), new UserTask () {
@Override
public void run(ResultIterator resultIterator) throws Exception {
}
});
DataObject.find(testFile).getLookup().lookup(EditorCookie.class).openDocument();
assertFalse("Should not schedule the task", l.await(2, TimeUnit.SECONDS));
}
示例10: testDeadlock
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
public void testDeadlock() throws Exception {
FileUtil.setMIMEType("foo", "text/foo");
MockMimeLookup.setInstances(MimePath.parse("text/foo"), new FooParserFactory(), new PlainKit());
MockMimeLookup.setInstances(MimePath.parse("text/plain"), new FooParserFactory(), new PlainKit());
final File workingDir = getWorkDir();
final FileObject file = FileUtil.createData(new File(workingDir,"test.foo"));
final Source src = Source.create(file);
final DataObject dobj = DataObject.find(file);
final EditorCookie ec = dobj.getLookup().lookup(EditorCookie.class);
final StyledDocument doc = ec.openDocument();
final CountDownLatch start_a = new CountDownLatch(1);
final CountDownLatch start_b = new CountDownLatch(1);
final CountDownLatch end = new CountDownLatch(1);
final CountDownLatch taskEnded = new CountDownLatch(1);
final Collection<Pair<SchedulerTask,Class<? extends Scheduler>>> tasks = Collections.<Pair<SchedulerTask,Class<? extends Scheduler>>>singleton(
Pair.<SchedulerTask,Class<? extends Scheduler>>of(
new ParserResultTask<Parser.Result>() {
@Override
public void run(Result result, SchedulerEvent event) {
taskEnded.countDown();
}
@Override
public int getPriority() {
return 1000;
}
@Override
public Class<? extends Scheduler> getSchedulerClass() {
return null;
}
@Override
public void cancel() {
}
}, null));
TaskProcessor.addPhaseCompletionTasks(
tasks,
SourceAccessor.getINSTANCE().getCache(src),
true);
taskEnded.await();
final Thread t = new Thread () {
@Override
public void run() {
NbDocument.runAtomic(doc, new Runnable() {
@Override
public void run() {
start_a.countDown();
try {
start_b.await();
synchronized(TaskProcessor.INTERNAL_LOCK) {
end.await();
}
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
}
}
});
}
};
t.start();
synchronized(TaskProcessor.INTERNAL_LOCK) {
start_b.countDown();
start_a.await();
SourceAccessor.getINSTANCE().getCache(src).invalidate();
TaskProcessor.removePhaseCompletionTasks(Collections.<SchedulerTask>singleton(tasks.iterator().next().first()), src);
}
end.countDown();
}
示例11: Modification
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
private Modification() {
this.id = 0;
this.toExpect = new HashMap<Class<? extends ParserResultTask<? extends Parser.Result>>, Long>();
this.support = new PropertyChangeSupport(this);
}
示例12: expect
import org.netbeans.modules.parsing.spi.ParserResultTask; //导入依赖的package包/类
synchronized void expect(
final Class<? extends ParserResultTask<? extends Parser.Result>> task,
final long id) {
toExpect.put(task,id);
}