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


Java FileObject.hasExt方法代码示例

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


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

示例1: readNonDefaultConfigs

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void readNonDefaultConfigs(String subDir, boolean createIfNotExists) {
    FileObject configsFO = projectDir.getFileObject(subDir); // NOI18N
    if (configsFO != null) {
        for (FileObject kid : configsFO.getChildren()) {
            if (!kid.hasExt(PROPERTIES_FILE_EXT)) { // NOI18N
                continue;
            }
            Map<String,String> c = getConfig(kid.getName());
            if (c == null && !createIfNotExists) {
                continue;
            }
            EditableProperties cep = null;
            try {
                cep = JFXProjectUtils.readFromFile( kid );
            } catch (IOException ex) {
                // can be ignored
            }
            addToConfig(kid.getName(), cep);
            appParams.extractEntries(cep, kid.getName());
            appManifestEntries.extractEntries(cep, kid.getName());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:JFXProjectConfigurations.java

示例2: findTestSources

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@CheckForNull TestSources findTestSources(@NonNull Lookup context, boolean allowFolders) {
    TYPE: for (String testType : project.supportedTestTypes()) {
        FileObject testSrcDir = project.getTestSourceDirectory(testType);
        if (testSrcDir != null) {
            FileObject[] files = ActionUtils.findSelectedFiles(context, testSrcDir, null, true);
            if (files != null) {
                for (FileObject file : files) {
                    if (!(file.hasExt("java") || allowFolders && file.isFolder())) {
                        break TYPE;
                    }
                }
                return new TestSources(files, testType, testSrcDir, null);
            }
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ModuleActions.java

示例3: run

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public void run() throws IOException {
    FileObject target = FileUtil.createData(getProject().getProjectDirectory(), path);
    if (tokens == null) {
        copyByteAfterByte(content, target);
    } else {
        copyAndSubstituteTokens(content, target, tokens);
    }
    // #129446: form editor doesn't work sanely unless you do this:
    if (target.hasExt("form")) { // NOI18N
        FileObject java = FileUtil.findBrother(target, "java"); // NOI18N
        if (java != null) {
            java.setAttribute("justCreatedByNewWizard", true); // NOI18N
        }
    } else if (target.hasExt("java") && FileUtil.findBrother(target, "form") != null) { // NOI18N
        target.setAttribute("justCreatedByNewWizard", true); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:CreatedModifiedFiles.java

示例4: containsSelectedJavaSources

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
 * Check to see if a (node-like) selection contains one or more Java sources (or folders) inside the root.
 */
static boolean containsSelectedJavaSources(FileObject root, Lookup context) {
    Set<FileObject> selection = new HashSet<FileObject>();
    for (DataObject dob : context.lookupAll(DataObject.class)) {
        selection.add(dob.getPrimaryFile());
    }
    if (selection.isEmpty()) {
        return false;
    }
    for (FileObject f : selection) {
        if (f.isData() && !f.hasExt("java")) { // NOI18N
            return false;
        }
        if (f != root && !FileUtil.isParentOf(root, f)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:JavaActions.java

示例5: calculateConfigs

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@NonNull
private Map<String,Configuration> calculateConfigs() {
    final Map<String,Configuration> cfgs = new HashMap<>();
    if (configDir != null) {
        for (FileObject kid : configDir.getChildren()) {
            if (!kid.hasExt("properties")) {    //NOI18N
                continue;
            }
            try {
                try (InputStream is = kid.getInputStream()) {
                    final Properties props = new Properties();
                    props.load(is);
                    final String name = kid.getName();
                    final String label = props.getProperty("$label"); // NOI18N
                    cfgs.put(name, new Configuration(name, label != null ? label : name));
                }
            } catch (IOException x) {
                LOGGER.log(Level.INFO, null, x);
            }
        }
    }
    configs = cfgs;
    LOGGER.log(Level.FINEST, "Calculated configurations: {0}", cfgs);
    return cfgs;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ProjectConfigurations.java

示例6: findPrimaryFile

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
    if (!fo.isFolder()) {
        // here is the common code for the worse behaviour
        if (fo.hasExt("prima")) {
            return FileUtil.findBrother(fo, "seconda") != null ? fo : null;
        }
        
        if (fo.hasExt("seconda")) {
            return FileUtil.findBrother(fo, "prima");
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:DataObjectSaveAsTest.java

示例7: findPrimaryFile

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
    Integer i = queried.get(fo);
    queried.put(fo, i == null ? 1 : i + 1);
    FileObject ret;
    
    if (fo.hasExt("java") || fo.hasExt("form")) {
        ret = org.openide.filesystems.FileUtil.findBrother(fo, "java");
    } else {
        ret = null;
    }
    
    LOG.fine("findPrimaryFile for " + fo + " yeilded " + ret);
    return ret;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:PropertiesProviderTest.java

示例8: findPrimaryFile

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
    if (fo.hasExt("java") || fo.hasExt("form")) {
        return org.openide.filesystems.FileUtil.findBrother(fo, "java");
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CreateFromTemplateHandlerTest.java

示例9: findPrimaryFile

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
    if (fo.hasExt(JAVA_EXTENSION)) {
        return fo;
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:FightWithWrongOrderInPathsTest.java

示例10: findPrimaryFile

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
    if (fo.hasExt("prima")) {
        return fo;
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:ScriptingCreateFromTemplateTest.java

示例11: isSeparator

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private boolean isSeparator(FileObject fo) {
    return (fo != null) && (fo.hasExt("instance") && ("javax.swing.JSeparator".equals(fo.getAttribute("instanceClass"))));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:DataObjectRegistrationHinter.java

示例12: isFileObjectSupported

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public boolean isFileObjectSupported(FileObject file) {
    return file.hasExt("java"); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:JavaProjectProfilingSupportProvider.java

示例13: findPrimaryFile

import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
    if (fo.hasExt("txt") || fo.equals(instanceFile)) {
        return fo;
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:CanYouQueryFromRenameTest.java


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