本文整理汇总了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());
}
}
}
示例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;
}
示例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
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例9: findPrimaryFile
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
if (fo.hasExt(JAVA_EXTENSION)) {
return fo;
} else {
return null;
}
}
示例10: findPrimaryFile
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
if (fo.hasExt("prima")) {
return fo;
}
return null;
}
示例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"))));
}
示例12: isFileObjectSupported
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public boolean isFileObjectSupported(FileObject file) {
return file.hasExt("java"); // NOI18N
}
示例13: findPrimaryFile
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
protected FileObject findPrimaryFile(FileObject fo) {
if (fo.hasExt("txt") || fo.equals(instanceFile)) {
return fo;
}
return null;
}