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


Java CompilationInfo.putCachedValue方法代码示例

本文整理汇总了Java中org.netbeans.api.java.source.CompilationInfo.putCachedValue方法的典型用法代码示例。如果您正苦于以下问题:Java CompilationInfo.putCachedValue方法的具体用法?Java CompilationInfo.putCachedValue怎么用?Java CompilationInfo.putCachedValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.netbeans.api.java.source.CompilationInfo的用法示例。


在下文中一共展示了CompilationInfo.putCachedValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createShared

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
static UseFQN createShared(CompilationInfo info, 
        FileObject file, 
        String fqn, 
        ElementHandle<Element> toImport, 
        String sortText, TreePath replacePath, boolean isValid) {
    
    String k = UseFQN.class.getName() + "#" + fqn; // NOI18N
    Object o = info.getCachedValue(k);
    UseFQN inst;
    if (o instanceof UseFQN) {
        inst = (UseFQN)o;
        inst.addTreePath(TreePathHandle.create(replacePath, info));
    } else {
        inst = new UseFQN(info, file, fqn, toImport, sortText, replacePath, isValid, true);
        info.putCachedValue(k, inst, CompilationInfo.CacheClearPolicy.ON_TASK_END);
    }
    return inst;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ImportClass.java

示例2: run

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
@Override
public void run(Result result, SchedulerEvent event) {
    cancel.set(false);

    CompilationInfo info = CompilationInfo.get(result);
    if (info == null) {
        return;
    }

    Document doc = info.getSnapshot().getSource().getDocument(false);
    if (doc == null) {
        return;
    }

    if (!BreadcrumbsController.areBreadCrumsEnabled(doc)) return ;
    
    int caretPosition = event instanceof CursorMovedSchedulerEvent
            ? ((CursorMovedSchedulerEvent) event).getCaretOffset()
            : CaretAwareJavaSourceTaskFactory.getLastPosition(result.getSnapshot().getSource().getFileObject()); //XXX

    if (cancel.get()) {
        return;
    }

    BreadcrumbsElement[] rootAndSelection = rootAndSelection(info, caretPosition, cancel);
    
    if (cancel.get() || rootAndSelection == null) {
        return ;
    }

    BreadcrumbsController.setBreadcrumbs(doc, rootAndSelection[1]);
    
    info.putCachedValue(BreadCrumbsScanningTask.class, rootAndSelection[0], CacheClearPolicy.ON_CHANGE);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:BreadCrumbsScanningTask.java

示例3: getValueCache

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
private static Map<Object, ElementValue> getValueCache(CompilationInfo info) {
    Map<Object, ElementValue> cache = (Map)info.getCachedValue(CONST_EVAL_KEY);
    if (cache == null) {
        cache = new HashMap<Object, ElementValue>(7);
        info.putCachedValue(CONST_EVAL_KEY, cache, CompilationInfo.CacheClearPolicy.ON_TASK_END);
    }
    return cache;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ArithmeticUtilities.java

示例4: ensureNameMapLoaded

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
private Map<String, Integer> ensureNameMapLoaded(CompilationInfo info) {
    Map<String, Integer> mapNameToGroup = (Map<String, Integer>)info.getCachedValue(KEY);
    if (mapNameToGroup != null) {
        return mapNameToGroup;
    }
    mapNameToGroup = new HashMap<String, Integer>();
    Preferences prefs = getPreferences(null);
    String value = prefs.get(GROUP_KEY, DEFAULT_GROUPS);
    if (value == null) {
        info.putCachedValue(KEY, mapNameToGroup, CompilationInfo.CacheClearPolicy.ON_TASK_END);
        return mapNameToGroup;
    }
    String[] groups = value.split(Pattern.quote(GROUP_SEPARATOR));
    int idx = 0;
    for (String g : groups) {
        String[] names = g.split(SEPARATORS_REGEX);
        for (String n : names) {
            if (n.isEmpty()) {
                continue;
            }
            mapNameToGroup.put(n.toLowerCase(), idx);
        }
        idx++;
    }
    info.putCachedValue(KEY, mapNameToGroup, CompilationInfo.CacheClearPolicy.ON_TASK_END);
    return mapNameToGroup;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:SuspiciousNamesCombination.java

示例5: record

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
private static void record(CompilationInfo info, VariableElement el, State... states) {
    Map<Element, Set<State>> cache = (Map<Element, Set<State>>)info.getCachedValue(SEEN_KEY);

    if (cache == null) {
        info.putCachedValue(SEEN_KEY, cache = new HashMap<>(), CompilationInfo.CacheClearPolicy.ON_CHANGE);
    }

    Set<State> state = cache.get(el);

    if (state == null) {
        cache.put(el, state = EnumSet.noneOf(State.class));
    }
    
    state.addAll(Arrays.asList(states));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:Unbalanced.java

示例6: computeExpressionsState

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
private static Map<Tree, State> computeExpressionsState(CompilationInfo info, HintContext ctx) {
    Map<Tree, State> result = (Map<Tree, State>) info.getCachedValue(KEY_EXPRESSION_STATE);
    
    if (result != null) {
        return result;
    }
    
    VisitorImpl v = new VisitorImpl(ctx, info, null);
    
    v.scan(info.getCompilationUnit(), null);

    result = v.expressionState;
    info.putCachedValue(KEY_EXPRESSION_STATE, result, CompilationInfo.CacheClearPolicy.ON_TASK_END);
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:NPECheck.java

示例7: assignmentsForUse

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
public static FlowResult assignmentsForUse(CompilationInfo info, Cancel cancel) {
    FlowResult result = (FlowResult) info.getCachedValue(KEY_FLOW);
    
    if (result == null) {
        result = assignmentsForUse(info, new TreePath(info.getCompilationUnit()), cancel);
        
        if (result != null && !cancel.isCanceled()) {
            info.putCachedValue(KEY_FLOW, result, CacheClearPolicy.ON_TASK_END);
        }
    }
    
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:Flow.java

示例8: getAllMembers

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
protected static synchronized Iterable<? extends Element> getAllMembers(CompilationInfo info, TypeElement clazz) {
    Map<TypeElement, Iterable<? extends Element>> map = (Map<TypeElement, Iterable<? extends Element>>) info.getCachedValue(KEY_MEMBERS_CACHE);

    if (map == null) {
        info.putCachedValue(KEY_MEMBERS_CACHE, map = new HashMap<TypeElement, Iterable<? extends Element>>(), CacheClearPolicy.ON_SIGNATURE_CHANGE);
    }

    Iterable<? extends Element> members = map.get(clazz);

    if (members == null) {
        map.put(clazz, members = info.getElements().getAllMembers(clazz));
    }

    return members;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:HideField.java

示例9: process

import org.netbeans.api.java.source.CompilationInfo; //导入方法依赖的package包/类
public static Collection<TreePath> process(CompilationInfo info, AtomicBoolean cancel) {
    Collection<TreePath> result = (Collection<TreePath>) info.getCachedValue(KEY_CACHE);
    
    if (result != null) return result;
    
    DetectorVisitor v = new DetectorVisitor(info, cancel);
    
    CompilationUnitTree cu = info.getCompilationUnit();
    
    v.scan(cu, null);
    
    if (cancel.get())
        return null;
    
    List<TreePath> allUnusedImports = new ArrayList<TreePath>();

    for (TreePath tree : v.getUnusedImports().values()) {
        if (cancel.get()) {
            return null;
        }

        allUnusedImports.add(tree);
    }
    
    allUnusedImports = Collections.unmodifiableList(allUnusedImports);
    
    info.putCachedValue(KEY_CACHE, allUnusedImports, CacheClearPolicy.ON_CHANGE);
    
    return allUnusedImports;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:UnusedImports.java


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