本文整理汇总了Java中org.netbeans.modules.parsing.spi.SchedulerTask类的典型用法代码示例。如果您正苦于以下问题:Java SchedulerTask类的具体用法?Java SchedulerTask怎么用?Java SchedulerTask使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SchedulerTask类属于org.netbeans.modules.parsing.spi包,在下文中一共展示了SchedulerTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createTasks
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
protected Collection<? extends SchedulerTask> createTasks(Language l, Snapshot snapshot) {
FileObject file = snapshot.getSource().getFileObject();
if (file != null) {
SchedulerTask t = GsfFoldManager.JavaElementFoldTask.getTask(file);
if (GsfFoldManager.LOG.isLoggable(Level.FINER)) {
GsfFoldManager.LOG.log(Level.FINER, "Scheduling task for file: {0} -> {1}, Thread: {2}", new Object[] { file, t, Thread.currentThread() });
}
return Collections.singleton(t);
} else {
if (GsfFoldManager.LOG.isLoggable(Level.FINE)) {
GsfFoldManager.LOG.log(Level.FINE, "FileObject is null: {0}", snapshot.getSource());
}
return null;
}
}
示例2: scheduleTasks
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
public void scheduleTasks (Class<? extends Scheduler> schedulerType) {
//S ystem.out.println("scheduleTasks " + schedulerType);
final List<SchedulerTask> remove = new ArrayList<SchedulerTask> ();
final List<Pair<SchedulerTask,Class<? extends Scheduler>>> add = new ArrayList<Pair<SchedulerTask,Class<? extends Scheduler>>> ();
Collection<SchedulerTask> tsks = createTasks();
synchronized (TaskProcessor.INTERNAL_LOCK) {
for (SchedulerTask task : tsks) {
if (schedulerType == null || task instanceof EmbeddingProvider) {
if (!pendingTasks.remove (task)) {
remove.add (task);
}
add.add (Pair.<SchedulerTask,Class<? extends Scheduler>>of(task,null));
} else if (task.getSchedulerClass () == schedulerType) {
if (!pendingTasks.remove (task)) {
remove.add (task);
}
add.add (Pair.<SchedulerTask,Class<? extends Scheduler>>of(task,schedulerType));
}
}
}
if (!add.isEmpty ()) {
LOG.fine("Change tasks for source " + source + " - add: " + add + ", remove " + remove);
TaskProcessor.updatePhaseCompletionTask(add, remove, source, this);
}
}
示例3: unscheduleTasks
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
public void unscheduleTasks (Class<? extends Scheduler> schedulerType) {
//S ystem.out.println("unscheduleTasks " + schedulerType);
final List<SchedulerTask> remove = new ArrayList<SchedulerTask> ();
synchronized (TaskProcessor.INTERNAL_LOCK) {
if (tasks != null) {
for (SchedulerTask task : tasks) {
if (schedulerType == null ||
task.getSchedulerClass () == schedulerType ||
task instanceof EmbeddingProvider
) {
remove.add (task);
}
}
}
}
if (!remove.isEmpty ()) {
TaskProcessor.removePhaseCompletionTasks(remove, source);
}
}
示例4: testCancel_cancel_in_task_run
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
public void testCancel_cancel_in_task_run() throws Exception {
TaskProcessor.addPhaseCompletionTasks(
Collections.singleton(Pair.<SchedulerTask,Class<? extends Scheduler>>of(
task,
task.getSchedulerClass())),
cache,
false);
assertTrue("TestTask started.", task.awaitStart(true)); //NOI18N
TaskProcessor.addPhaseCompletionTasks(
Collections.singleton(Pair.<SchedulerTask,Class<? extends Scheduler>>of(
cancelTask,
cancelTask.getSchedulerClass())),
cache,
false);
assertTrue("Task cancelled", task.isABCancelled()); //NOI18N
assertTrue("Task cancelled", task.isCSCancelled()); //NOI18N
task.signalProgress();
assertTrue("Test task finished", task.awaitDone(true)); //NOI18N
}
示例5: createTasks
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public Collection<? extends SchedulerTask> createTasks(Language l, Snapshot snapshot) {
// avoid issue #230209, hint provider is useless without FileObject.
FileObject fo = snapshot.getSource().getFileObject();
if (fo != null) {
return Collections.singleton(new GsfHintsProvider(fo));
} else {
return null;
}
}
示例6: createTasks
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public Collection<? extends SchedulerTask> createTasks(Language l, Snapshot snapshot) {
if (snapshot.getSource().getMimeType().equals(snapshot.getMimeType())) {
return Collections.singleton(new CaretListeningTask());
} else {
return null;
}
}
示例7: createTasks
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public Collection<? extends SchedulerTask> createTasks(Language l, Snapshot snapshot) {
OccurrencesFinder finder = l.getOccurrencesFinder();
if (finder != null) {
return Collections.singleton(new MarkOccurrencesHighlighter(l, snapshot));
} else {
return null;
}
}
示例8: create
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public final Collection<? extends SchedulerTask> create(Snapshot snapshot) {
String mimeType = snapshot.getMimeType();
Language l = LanguageRegistry.getInstance().getLanguageByMimeType(mimeType);
if (l == null) {
// not a CSL language
return null;
}
if (!topLevelLanguageOnly || isTopLevel(snapshot)) {
return createTasks(l, snapshot);
} else {
return null;
}
}
示例9: create
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public Collection<SchedulerTask> create(final Snapshot snapshot) {
if (Language.find(JAVASCRIPT_MIME) == null) {
return Collections.emptyList();
}
return Collections.<SchedulerTask>singleton(new ScriptEmbeddingProvider());
}
示例10: create
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public Collection<? extends SchedulerTask> create(Snapshot snapshot) {
FoldTask ft = FoldTask.getTask(snapshot.getSource().getFileObject());
if (ft == null) {
return Collections.emptyList();
} else {
return Collections.singleton(ft);
}
}
示例11: create
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public Collection<? extends SchedulerTask> create(Snapshot snapshot) {
if (snapshot.getMimePath().size() > 1) {
// I do not want the inner mimetype
return Collections.emptyList();
}
return Collections.singleton(new EmbeddedHintsCollector());
}
示例12: create
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
public @Override
Collection<? extends SchedulerTask> create(Snapshot snapshot) {
if (!YamlTokenId.YAML_MIME_TYPE.equals(snapshot.getMimeType())) {
return Collections.<SchedulerTask>emptyList();
}
return Collections.singleton(new RubyEmbeddingProvider());
}
示例13: create
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public final Collection<? extends SchedulerTask> create(Snapshot snapshot) {
FileObject f = snapshot.getSource().getFileObject();
FileData fdata = null;
FoldProcessor processor = null;
if (f != null) {
fdata = getRegistrar(this).getFileData(f);
processor = fdata.createProcessor(this, f);
}
return f == null || processor == null ?
Collections.<SchedulerTask>emptyList() :
Collections.singleton(createParserTask(f, processor)
);
}
示例14: create
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@Override
public Collection<? extends SchedulerTask> create(Snapshot snapshot) {
String mimeType = snapshot.getMimeType();
if (mimeType.equals("text/html")) { //NOI18N
return Collections.singletonList(new HtmlCaretAwareSourceTask());
} else {
return Collections.emptyList();
}
}
示例15: create
import org.netbeans.modules.parsing.spi.SchedulerTask; //导入依赖的package包/类
@NonNull
@Override
public Collection<? extends SchedulerTask> create (@NonNull final Snapshot snapshot) {
final Object delegate = params.get(ATTR_PROVIDER);
return (delegate instanceof EmbeddingProvider) ?
Collections.singleton((EmbeddingProvider)delegate) :
Collections.<EmbeddingProvider>emptySet();
}