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


Java Scheduler类代码示例

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


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

示例1: createParserTask

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

示例2: attachScheduler

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
@Override
public void attachScheduler(SchedulerControl s, boolean attach) {
    final Source now = getSourceControl().getSource();
    final Scheduler sched;
    SchedL l;
    synchronized (scheduledSources) {
        sched = s.getScheduler();
        l = scheduledSources.get(sched);
        if (attach && l == null) {
            l = new SchedL(s);
            scheduledSources.put(sched, l);
        }
    }
    if (l != null) {
        l.attachSource(sched, now, attach);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:EventSupport.java

示例3: findStandardScheduler

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
@Override
public Class<? extends Scheduler> findStandardScheduler(String schedulerName) {
    switch (schedulerName) {
        case "CURSOR_SENSITIVE_TASK_SCHEDULER": // NOI18N
            return CursorSensitiveScheduler.class;
        
        case "EDITOR_SENSITIVE_TASK_SCHEDULER": // NOI18N
            return CurrentDocumentScheduler.class;
            
        case "SELECTED_NODES_SENSITIVE_TASK_SCHEDULER": // NOI18N
            return SelectedNodesScheduler.class;
            
        default:
            return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DataObjectEnvFactory.java

示例4: createSchedulerEvents

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

示例5: refresh

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:SourceCache.java

示例6: scheduleTasks

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:SourceCache.java

示例7: unscheduleTasks

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:SourceCache.java

示例8: testCancel_cancel_in_task_run

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的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
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CancelSupportTest.java

示例9: testScheduleEventsNonNull_218756

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
public void testScheduleEventsNonNull_218756() throws Exception {
    final Modification mod = Modification.getDefault();
    mod.expect(Task1.class, 0);
    mod.expect(Task2.class, 0);
    for (Scheduler scheduler : Utilities.getEnvFactory().getSchedulers(Lookup.getDefault())) {
        if (scheduler instanceof BaseScheduler) {
            ((BaseScheduler) scheduler).schedule (source);
        }
    }
    assertTrue(mod.await());        
    mod.expect(Task1.class, 1);
    mod.expect(Task2.class, 1);
    mod.doChange();
    assertTrue(mod.await());
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:SchedulerEventTest.java

示例10: getTask

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
public org.netbeans.modules.csl.navigation.ElementScanningTask getTask() {
    
    return new ElementScanningTask() {
        public @Override int getPriority() {
            return 20000;
        }
        public @Override Class<? extends Scheduler> getSchedulerClass() {
            return CSLNavigatorScheduler.class;
        }
        @Override public void run(final ParserResult result, final SchedulerEvent event) {
            runWithCancelService(new Runnable() {
                @Override
                public void run() {
                    resume();
                    StructureItem root = computeStructureRoot(result.getSnapshot().getSource());
                    FileObject file = result.getSnapshot().getSource().getFileObject();

                    if (root != null && file != null) {
                        Document doc = result.getSnapshot().getSource().getDocument(false);
                        BaseDocument bd = doc instanceof BaseDocument ? (BaseDocument)doc : null;
                        refresh(root, file, bd);
                    }
                }
            });
        }
    };
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ClassMemberPanelUI.java

示例11: reschedule

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
public static void reschedule() {
    for (Scheduler s : Lookup.getDefault().lookupAll(Scheduler.class)) {
        if (s instanceof GsfFoldScheduler) {
            GsfFoldScheduler gsfScheduler = (GsfFoldScheduler) s;
            gsfScheduler.schedule(new SchedulerEvent(gsfScheduler) {});
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:GsfFoldScheduler.java

示例12: attachSource

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
public void attachSource(
        @NonNull final Scheduler sched,
        @NonNull final Source s,
        final boolean attach) {
    assert Thread.holdsLock(sched);
    if (source != null) {
        assert attach || source == s : String.format(
            "attach: %b, source:%s(%d), s:%s(%d)",  //NOI18N
            attach,
            source,
            System.identityHashCode(source),
            s,
            System.identityHashCode(s));
        if (weakListener != null) {
            assert eventSource != null;
            final DataObject dobj = eventSource.get();
            if (dobj != null) {
                dobj.removePropertyChangeListener(weakListener);
            }
        }
        weakListener = null;
        eventSource = null;
        source = null;
    }
    if (attach) {
        final FileObject fo = s.getFileObject();
        if (fo != null) {
            try {
                final DataObject dobj = DataObject.find(fo);
                eventSource = new WeakReference<>(dobj);
                weakListener = WeakListeners.propertyChange(this, dobj);
                dobj.addPropertyChangeListener(weakListener);
            } catch (DataObjectNotFoundException ex) {
                //No DataObject for file - ignore
            }
        }
        this.source = s;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:40,代码来源:EventSupport.java

示例13: getScheduler

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
public static <T extends Scheduler> T getScheduler(Class<T> clazz) {
    for (Scheduler scheduler : Utilities.getEnvFactory().getSchedulers(Lookup.getDefault())) {
        if (clazz.isInstance(scheduler)) {
            return (T)scheduler;
        }
    }
    throw new IllegalStateException("Scheduler not found");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SchedulerTestAccess.java

示例14: setSchedulerEvent

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
@Override
public void setSchedulerEvent(
        final @NonNull Source source,
        final @NonNull Scheduler scheduler,
        final @NonNull SchedulerEvent event) {
    Parameters.notNull("source", source);           //NOI18N
    Parameters.notNull("scheduler", scheduler);     //NOI18N
    Parameters.notNull("event", event);             //NOI18N
    synchronized (TaskProcessor.INTERNAL_LOCK) {
        if (source.schedulerEvents == null) {
            source.schedulerEvents = new HashMap<Class<? extends Scheduler>, SchedulerEvent>();
        }
        source.schedulerEvents.put(scheduler.getClass(), event);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:Source.java

示例15: getSchedulerEvent

import org.netbeans.modules.parsing.spi.Scheduler; //导入依赖的package包/类
@Override
public SchedulerEvent getSchedulerEvent (Source source, Class<? extends Scheduler> schedulerType) {
    if (schedulerType == null) {
        return null;
    }
    if (source.schedulerEvents == null)
        return null;
    return source.schedulerEvents.get (schedulerType);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:Source.java


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