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


Java ModuleInfo.getCodeNameBase方法代码示例

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


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

示例1: createCustomDefClassLoaders

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
/**
 * Get a map from enabled module code name bases to class loaders containing
 * JARs from ant/nblib/*.jar.
 */
private static Map<String,ClassLoader> createCustomDefClassLoaders(ClassLoader main) throws IOException {
    Map<String,ClassLoader> m = new HashMap<String,ClassLoader>();
    ModuleInfo[] modules = miscListener.getEnabledModules();
    InstalledFileLocator ifl = InstalledFileLocator.getDefault();
    for (ModuleInfo module : modules) {
        String cnb = module.getCodeNameBase();
        String cnbDashes = cnb.replace('.', '-');
        File lib = ifl.locate("ant/nblib/" + cnbDashes + ".jar", cnb, false); // NOI18N
        if (lib == null) {
            if (main.getResource(cnb.replace('.', '/') + "/antlib.xml") != null) { // NOI18N
                // Run-in-classpath mode.
                m.put(cnb, main);
            }
            continue;
        }
        ClassLoader l = createAuxClassLoader(lib, main, module.getClassLoader());
        m.put(cnb, l);
    }
    return m;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:AntBridge.java

示例2: findProperty

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
final String findProperty(ModuleInfo m, String name, boolean localized) {
    final String fullName = m.getCodeNameBase() + '.' + name;
    final String nullValue = "\u0000"; // NOI18N
    if (modulePropertiesCached) {
        String val = moduleProperties.getProperty(fullName);
        if (nullValue.equals(val)) { 
            return null;
        }
        if (val != null) {
            return val;
        }
        LOG.log(Level.FINE, "not cached value: {0} for {1}", new Object[]{name, m});
    } 
    Object p = localized ? m.getLocalizedAttribute(name) : m.getAttribute(name);
    if (p == null) {
        moduleProperties.setProperty(fullName, nullValue);
        Stamps.getModulesJARs().scheduleSave(this, CACHE, false);
        return null;
    }
    String prop = p instanceof String ? (String)p : null;
    if (prop != null) {
        moduleProperties.setProperty(fullName, prop);
        Stamps.getModulesJARs().scheduleSave(this, CACHE, false);
    }
    return prop;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:NbInstaller.java

示例3: getUpdateItems

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
@Override
public Map<String, UpdateItem> getUpdateItems () throws IOException {
    Map<String, UpdateItem> res = new HashMap<String, UpdateItem> ();
    for (ModuleInfo info : defaultProvider().getModuleInfos (true).values ()) {
        Date time = null; // XXX: it's too expensive, should be extracted lazy - Utilities.readInstallTimeFromUpdateTracking (info);
        String installTime = null;
        if (time != null) {
            installTime = Utilities.formatDate(time);
        }
        UpdateItemImpl impl = new InstalledModuleItem (
                info.getCodeNameBase (),
                info.getSpecificationVersion () == null ? null : info.getSpecificationVersion ().toString (),
                info,
                null, // XXX author
                null, // installed cluster
                installTime

                );

        UpdateItem updateItem = Utilities.createUpdateItem (impl);
        res.put (info.getCodeName () + '_' + info.getSpecificationVersion (), updateItem);
    }
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:InstalledUpdateProvider.java

示例4: isPack

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
private boolean isPack( ModuleInfo mi ) {
    String moduleName = mi.getCodeNameBase();
    for( String pn : packNames ) {
        if( moduleName.startsWith(pn) )
            return true;
    }
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:InstallConfig.java

示例5: findCNBForClass

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
public static String findCNBForClass(@NonNull Class<?> cls) {
    String absolutePath;
    ModuleInfo owner = Modules.getDefault().ownerOf(cls);
    if (owner != null) {
        absolutePath = owner.getCodeNameBase();
    } else {
        absolutePath = cls.getName().replaceFirst("(^|\\.)[^.]+$", "");//NOI18N
    }
    return absolutePath.replace('.', '-');
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:AuxiliaryConfigBasedPreferencesProvider.java

示例6: isErgonomicsPack

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
private boolean isErgonomicsPack( ModuleInfo mi ) {
    String moduleName = mi.getCodeNameBase();
    return moduleName.startsWith(ergonomicsPackName) && mi.isEnabled();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:InstallConfig.java

示例7: getUpdateItems

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
@Override
public Map<String, UpdateItem> getUpdateItems() throws IOException {
    Map<String, UpdateItem> items = InstalledModuleProvider.getDefault().getUpdateItems();
    assertNotNull("Installed modules must found.", items);
    int size = items.size();
    assertTrue("Count of installed modules are more then once.", size > 1);
    String pilotName = items.keySet().iterator().next();
    assertNotNull(pilotName + "must found", items.get(pilotName));
    UpdateItem pilotItem = items.get(pilotName);
    assertNotNull("Impl of " + pilotItem + " available", Trampoline.SPI.impl(pilotItem));
    UpdateItemImpl pilotItemImpl = Trampoline.SPI.impl(pilotItem);
    assertTrue("Impl of " + pilotItem + "is ModuleItem", pilotItemImpl instanceof ModuleItem);
    ModuleItem pilotModuleItem = (ModuleItem) pilotItemImpl;
    SpecificationVersion pilotSV = new SpecificationVersion(pilotModuleItem.getSpecificationVersion());
    assertTrue("a dot is present in " + pilotSV, pilotSV.toString().indexOf('.') != -1);
    int dot = pilotSV.toString().indexOf('.');
    String postSpec = pilotSV.toString().substring(dot + 1);
    String preSpec = pilotSV.toString().substring(0, dot);
    Integer digit = 0;
    try {
        digit = Integer.parseInt(preSpec) + 1;
    } catch (NumberFormatException nfe) {
        fail(nfe.getLocalizedMessage());
    }
    SpecificationVersion higherSV = new SpecificationVersion(digit + "." + postSpec);
    assertTrue(higherSV + " is more then " + pilotSV, higherSV.compareTo(pilotSV) > 0);
    String higherDep = pilotModuleItem.getModuleInfo().getCodeNameBase() + " > " + higherSV;

    Set<String> deps = new HashSet<String>(items.size());
    for (String id : items.keySet()) {
        String dep = null;
        if (!pilotName.equals(id)) {
            UpdateItem item = items.get(id);
            assertNotNull("Impl of " + item + " available", Trampoline.SPI.impl(item));
            UpdateItemImpl itemImpl = Trampoline.SPI.impl(item);
            assertTrue("Impl of " + item + "is ModuleItem", itemImpl instanceof ModuleItem);
            ModuleItem moduleItem = (ModuleItem) itemImpl;
            Module m = Utilities.toModule(moduleItem.getModuleInfo());
            if (m != null && m.getProblems().isEmpty()) {
                dep = moduleItem.getModuleInfo().getCodeNameBase() + " > " + moduleItem.getSpecificationVersion();
            }
        } else {
            dep = higherDep;
        }
        if (dep != null) {
            deps.add(dep);
        }
    }
    Map<String, UpdateItem> res = InstalledModuleProvider.getDefault().getUpdateItems();
    ModuleInfo info = pilotModuleItem.getModuleInfo();
    UpdateItemImpl higherItemImpl = new InstalledModuleItem(
            info.getCodeNameBase(),
            higherSV.toString(),
            new HackedModuleInfo(info, higherSV),
            null, // XXX author
            null, // installed cluster
            null);
    UpdateItem higherModuleItem = Utilities.createUpdateItem(higherItemImpl);

    res.put("testFeatureDependsOnModules",
            UpdateItem.createFeature(
            "testFeatureDependsOnModules",
            "1.0",
            deps,
            null,
            null,
            null));
    res.put(pilotName, higherModuleItem);
    res.put("testDependsOnFeature", UpdateItem.createFeature(
            "testDependsOnFeature", "1.3",
            Collections.singleton("testFeatureDependsOnModules"),
            null, null, null));
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:75,代码来源:FeatureDependsOnFeatureTest.java

示例8: getUpdateItems

import org.openide.modules.ModuleInfo; //导入方法依赖的package包/类
public Map<String, UpdateItem> getUpdateItems () throws IOException {
    Map<String, UpdateItem> items = InstalledModuleProvider.getDefault().getUpdateItems ();
    assertNotNull ("Installed modules must found.", items);
    int size = items.size ();
    assertTrue ("Count of installed modules are more then once.", size > 1);
    String pilotName = items.keySet ().iterator ().next ();
    assertNotNull (pilotName + "must found", items.get (pilotName));
    UpdateItem pilotItem = items.get (pilotName);
    assertNotNull ("Impl of " + pilotItem + " available", Trampoline.SPI.impl (pilotItem));
    UpdateItemImpl pilotItemImpl = Trampoline.SPI.impl (pilotItem);
    assertTrue ("Impl of " + pilotItem + "is ModuleItem", pilotItemImpl instanceof ModuleItem);
    ModuleItem pilotModuleItem = (ModuleItem) pilotItemImpl;
    SpecificationVersion pilotSV = new SpecificationVersion (pilotModuleItem.getSpecificationVersion ());
    assertTrue ("a dot is present in " + pilotSV, pilotSV.toString ().indexOf ('.') != -1);
    int dot = pilotSV.toString ().indexOf ('.');
    String postSpec = pilotSV.toString ().substring (dot + 1);
    String preSpec = pilotSV.toString ().substring (0, dot);
    Integer digit = 0;
    try {
        digit = Integer.parseInt (preSpec) + 1;
    } catch (NumberFormatException nfe) {
        fail (nfe.getLocalizedMessage ());
    }
    SpecificationVersion higherSV = new SpecificationVersion (digit + "." + postSpec);
    assertTrue (higherSV + " is more then " + pilotSV, higherSV.compareTo (pilotSV) > 0);
    String higherDep = pilotModuleItem.getModuleInfo ().getCodeNameBase () + " > " + higherSV;

    Set<String> deps = new HashSet<String> (items.size ());
    for (String id : items.keySet ()) {
        String dep;
        if (! pilotName.equals (id)) {
            UpdateItem item = items.get (id);
            assertNotNull ("Impl of " + item + " available", Trampoline.SPI.impl (item));
            UpdateItemImpl itemImpl = Trampoline.SPI.impl (item);
            assertTrue ("Impl of " + item + "is ModuleItem", itemImpl instanceof ModuleItem);
            ModuleItem moduleItem = (ModuleItem) itemImpl;
            dep = moduleItem.getModuleInfo ().getCodeNameBase () + " > " + moduleItem.getSpecificationVersion ();
        } else {
            dep = higherDep;
        }
        deps.add (dep);
    }
    Map<String, UpdateItem> res = InstalledModuleProvider.getDefault().getUpdateItems ();
    ModuleInfo info = pilotModuleItem.getModuleInfo ();
    UpdateItemImpl higherItemImpl = new InstalledModuleItem (
            info.getCodeNameBase (),
            higherSV.toString (),
            new HackedModuleInfo (info, higherSV),
            null, // XXX author
            null, // installed cluster
            null);
    UpdateItem higherModuleItem = Utilities.createUpdateItem (higherItemImpl);
    
    res.put ("testFeatureVsStandaloneModules",
            UpdateItem.createFeature (
                "testFeatureVsStandaloneModules",
                "1.0",
                deps,
                null,
                null,
                null));
    res.put (pilotName, higherModuleItem);
    return res;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:65,代码来源:FeatureNotUpToDateTest.java


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