本文整理匯總了Java中org.netbeans.modules.parsing.spi.EmbeddingProvider類的典型用法代碼示例。如果您正苦於以下問題:Java EmbeddingProvider類的具體用法?Java EmbeddingProvider怎麽用?Java EmbeddingProvider使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EmbeddingProvider類屬於org.netbeans.modules.parsing.spi包,在下文中一共展示了EmbeddingProvider類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: refresh
import org.netbeans.modules.parsing.spi.EmbeddingProvider; //導入依賴的package包/類
void refresh (EmbeddingProvider embeddingProvider, Class<? extends Scheduler> schedulerType) {
List<Embedding> _embeddings = TaskProcessor.callEmbeddingProvider(embeddingProvider, getSnapshot ());
List<Embedding> oldEmbeddings;
synchronized (TaskProcessor.INTERNAL_LOCK) {
oldEmbeddings = embeddingProviderToEmbedings.get (embeddingProvider);
updateEmbeddings (_embeddings, oldEmbeddings, true, schedulerType);
embeddingProviderToEmbedings.put (embeddingProvider, _embeddings);
upToDateEmbeddingProviders.add (embeddingProvider);
if (this.embeddings != null) {
final Embedding insertBefore = findNextEmbedding(providerOrder, embeddingProviderToEmbedings, embeddingProvider);
this.embeddings.removeAll(oldEmbeddings);
int index = insertBefore == null ? -1 : this.embeddings.indexOf(insertBefore);
this.embeddings.addAll(index == -1 ? this.embeddings.size() : index, _embeddings);
}
}
}
示例2: findNextEmbedding
import org.netbeans.modules.parsing.spi.EmbeddingProvider; //導入依賴的package包/類
private Embedding findNextEmbedding (
final List<EmbeddingProvider> order,
final Map<EmbeddingProvider,List<Embedding>> providers2embs,
final EmbeddingProvider provider) {
if (order != null) {
boolean accept = false;
for (EmbeddingProvider p : order) {
if (accept) {
final Collection<Embedding> c = providers2embs.get(p);
if (c != null && !c.isEmpty()) {
return c.iterator().next();
}
} else if (p.equals(provider)) {
accept = true;
}
}
}
return null;
}
示例3: scheduleTasks
import org.netbeans.modules.parsing.spi.EmbeddingProvider; //導入依賴的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);
}
}
示例4: unscheduleTasks
import org.netbeans.modules.parsing.spi.EmbeddingProvider; //導入依賴的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);
}
}
示例5: create
import org.netbeans.modules.parsing.spi.EmbeddingProvider; //導入依賴的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();
}
示例6: handleProcess
import org.netbeans.modules.parsing.spi.EmbeddingProvider; //導入依賴的package包/類
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
for (Element e : roundEnv.getElementsAnnotatedWith(EmbeddingProvider.Registration.class)) {
if (!e.getKind().isClass()) {
throw new LayerGenerationException("Annotated Element has to be a class.", e); //NOI18N
}
final EmbeddingProvider.Registration reg = e.getAnnotation(EmbeddingProvider.Registration.class);
String mimeType = reg.mimeType();
if (mimeType == null) {
throw new LayerGenerationException("Mime type has to be given.", e); //NOI18N
} else if (!mimeType.isEmpty()) {
mimeType = '/' + mimeType; //NOI18N
}
String targetMimeType = reg.targetMimeType();
if (targetMimeType == null || targetMimeType.isEmpty()) {
throw new LayerGenerationException("Target mime type has to be given.", e); //NOI18N
}
layer(e).
instanceFile("Editors" + mimeType, null, null). //NOI18N
stringvalue("instanceOf", TaskFactory.class.getName()). ///NOI18N
methodvalue("instanceCreate", EmbeddingProviderFactory.class.getName(), "create"). //NOI18N
stringvalue(EmbeddingProviderFactory.ATTR_TARGET_MIME_TYPE, targetMimeType).
instanceAttribute(EmbeddingProviderFactory.ATTR_PROVIDER, EmbeddingProvider.class).
write();
}
return true;
}
示例7: getSupportedAnnotationTypes
import org.netbeans.modules.parsing.spi.EmbeddingProvider; //導入依賴的package包/類
@Override
public Set<String> getSupportedAnnotationTypes() {
return Collections.singleton(EmbeddingProvider.Registration.class.getCanonicalName());
}