本文整理汇总了Java中org.openide.filesystems.FileObject.getNameExt方法的典型用法代码示例。如果您正苦于以下问题:Java FileObject.getNameExt方法的具体用法?Java FileObject.getNameExt怎么用?Java FileObject.getNameExt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.FileObject
的用法示例。
在下文中一共展示了FileObject.getNameExt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readMimeTypes
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private Collection<String> readMimeTypes() {
List<String> mimeTypes = new ArrayList<String>();
FileObject[] children = FileUtil.getConfigFile("Loaders").getChildren(); //NOI18N
for (int i = 0; i < children.length; i++) {
FileObject child = children[i];
String mime1 = child.getNameExt();
FileObject[] subchildren = child.getChildren();
for (int j = 0; j < subchildren.length; j++) {
FileObject subchild = subchildren[j];
FileObject factoriesFO = subchild.getFileObject("Factories"); //NOI18N
if (factoriesFO != null && factoriesFO.getChildren().length > 0) {
// add only MIME types where some loader exists
mimeTypes.add(mime1 + "/" + subchild.getNameExt()); //NOI18N
}
}
}
mimeTypes.remove("content/unknown"); //NOI18N
return mimeTypes;
}
示例2: copyClassPathExtensionJar
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Copies given JAR file into <tt>release/modules/ext</tt> folder under <tt>projectDir</tt>.
* <tt>release/modules/ext</tt> will be created if necessary.
*
* @param projectDir Project folder
* @param jar JAR file to be copied
* @return If JAR copied successfully, returns string array <tt>{<runtime-relative path>, <binary origin path>}</tt>,
* otherwise <tt>null</tt>.
* @throws IOException When <tt>release/modules/ext</tt> folder cannot be created.
*/
public static String[] copyClassPathExtensionJar(File projectDir, File jar) throws IOException {
String[] ret = null;
File releaseDir = new File(projectDir, CPEXT_BINARY_PATH); //NOI18N
if (! releaseDir.isDirectory() && !releaseDir.mkdirs()) {
throw new IOException("cannot create release directory '" + releaseDir + "'."); // NOI18N
}
FileObject relDirFo = FileUtil.toFileObject(releaseDir);
FileObject orig = FileUtil.toFileObject(FileUtil.normalizeFile(jar));
if (orig != null) {
FileObject existing = relDirFo.getFileObject(orig.getName(), orig.getExt());
if (existing != null)
existing.delete();
FileUtil.copyFile(orig, relDirFo, orig.getName());
ret = new String[2];
ret[0] = CPEXT_RUNTIME_RELATIVE_PATH + orig.getNameExt(); // NOI18N
ret[1] = CPEXT_BINARY_PATH + orig.getNameExt(); // NOI18N
}
return ret;
}
示例3: getText
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public String getText( TabData tab ) {
if( !settings.isShowFolderName() )
return null;
if( tab.getComponent() instanceof TopComponent ) {
TopComponent tc = ( TopComponent ) tab.getComponent();
DataObject dob = tc.getLookup().lookup( DataObject.class );
if( null != dob ) {
FileObject fo = dob.getPrimaryFile();
if( fo.isData() ) {
FileObject folder = fo.getParent();
if( null != folder ) {
String folderName = folder.getNameExt() + pathSeparator;
String defaultText = tab.getText();
return merge( folderName, defaultText );
}
}
}
}
return null;
}
示例4: initialize
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public boolean initialize(Lookup context, AtomicBoolean cancel) {
FileObject file = context.lookup(FileObject.class);
if (file == null || file.isFolder()) {
return false;
}
DataObject currentFileDo = null;
try {
currentFileDo = DataObject.find(file);
} catch (DataObjectNotFoundException ex) {
} // Not important, only for Icon.
icon = currentFileDo != null ? new ImageIcon(currentFileDo.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16)) : null;
detail = file.getNameExt();
scope = Scope.create(null, null, Arrays.asList(file));
return true;
}
示例5: accept
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@NonNull
Collection<? extends URI> accept(@NonNull final FileObject fo) {
if (fo.canRead() && fo.isData()) {
final String nameExt = fo.getNameExt();
if (DOCS_FILE_PATTERN.matcher(nameExt).matches() && JAVAFX_FILE_PATTERN.matcher(nameExt).matches()) {
final FileObject root = FileUtil.getArchiveRoot(fo);
if (root != null) {
final List<URI> roots = new ArrayList<>(DOCS_PATHS.size());
for (String path : DOCS_PATHS) {
final FileObject docRoot = root.getFileObject(path);
if (docRoot != null) {
roots.add(docRoot.toURI());
}
}
return Collections.unmodifiableCollection(roots);
}
}
}
return Collections.emptySet();
}
示例6: checkOtherGroup
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private boolean checkOtherGroup(File rootFile, Set<File> resourceRoots, boolean test) {
FileObject root = FileUtil.toFileObject(rootFile);
if (root != null && !root.isFolder()) {
root = null;
}
Map<File, OtherGroup> map = test ? otherTestGroups : otherMainGroups;
OtherGroup grp = map.get(rootFile);
boolean isResourceNow = resourceRoots.contains(rootFile);
boolean wasResourceBefore = grp != null && grp.getResource() != null;
if ((root == null && grp != null) || (root != null && grp != null && wasResourceBefore && !isResourceNow)) {
map.remove(rootFile);
return true;
}
if (root == null) {
return false;
}
boolean changed = false;
if (grp == null || !grp.getRootFolder().isValid() || !grp.getRootFolder().equals(root) ||
isResourceNow != wasResourceBefore) {
grp = new OtherGroup(project(), root, "Resource" + (test ? "Test":"Main") + root.getNameExt(), root.getName(), test); //NOI18N
map.put(rootFile, grp);
changed = true;
}
return changed;
}
示例7: addFiles
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private void addFiles(
FileObject mimeFolder,
String profileId,
boolean fullScan,
String [] filePaths,
Map<String, List<Object []>> files,
boolean moduleFiles
) {
if (profileId == null) {
FileObject [] profileHomes = mimeFolder.getChildren();
for(FileObject f : profileHomes) {
if (!f.isFolder()) {
continue;
}
String id = f.getNameExt();
addFiles(f, filePaths, fullScan, files, id, f, moduleFiles); //NOI18N
}
} else {
FileObject profileHome = mimeFolder.getFileObject(profileId);
if (profileHome != null && profileHome.isFolder()) {
addFiles(profileHome, filePaths, fullScan, files, profileId, profileHome, moduleFiles);
}
}
}
示例8: WhereUsedBinaryElement
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private WhereUsedBinaryElement(FileObject fo, boolean inTest, boolean inPlatform) {
final String name = fo.getNameExt(); //NOI18N
this.htmlText = "<b>" + name + "</b>"; //NOI18N
this.elementText = name;
this.fromTest = inTest;
this.fromPlatform = inPlatform;
this.fo = fo;
}
示例9: begin
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
final void begin (FileObject fo, Font font, Color fgColor, Color bgColor, Color hfgColor, Color hbgColor, MimePath mimePath, String charset) {
styles = new Styles ();
buffer = new StringBuffer();
fileName = FileUtil.getFileDisplayName(fo);
shortFileName = fo.getNameExt();
boolHolder = new boolean [1];
this.defaultForegroundColor = fgColor;
this.defaultBackgroundColor = bgColor;
this.defaultFont = font;
this.headerForegroundColor = hfgColor;
this.headerBackgroundColor = hbgColor;
this.syntaxColoring = ColoringMap.get(mimePath.getPath()).getMap();
this.charset = charset;
}
示例10: isValidType
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
private static boolean isValidType(FileObject typeFile) {
if (!typeFile.isFolder()) {
return false;
}
String typeName = typeFile.getNameExt();
return MimePath.validate(typeName, null);
}
示例11: addArchiveToCopy
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* returns archive name or temporarily null cause there is no zip support
* for file protocol
*/
private static String addArchiveToCopy(CreatedModifiedFiles fileSupport, NewLibraryDescriptor.DataModel data, URL originalURL, String pathPrefix) {
String retval = null;
URL archivURL = FileUtil.getArchiveFile(originalURL);
if (archivURL != null && FileUtil.isArchiveFile(archivURL)) {
FileObject archiv = URLMapper.findFileObject(archivURL);
if (archiv == null) {
// #129617: broken library entry, just skip it.
return null;
}
retval = archiv.getNameExt();
fileSupport.add(fileSupport.createFile(pathPrefix + retval, archiv));
} else {
if ("file".equals(originalURL.getProtocol())) {//NOI18N
FileObject folderToZip;
folderToZip = URLMapper.findFileObject(originalURL);
if (folderToZip != null) {
retval = data.getLibraryName() + "-" + folderToZip.getName() + ".zip"; // NOI18N
pathPrefix += retval;
fileSupport.add(new ZipAndCopyOperation(data.getProject(),
folderToZip, pathPrefix));
}
}
}
return retval;
}
示例12: match
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
public boolean match(FileObject fo) {
String nameAndExt = fo.getNameExt();
if (ignoreCase) {
nameAndExt = nameAndExt.toLowerCase();
}
if (substring) {
return nameAndExt.contains(name);
} else {
return nameAndExt.equals(name);
}
}
示例13: createFileItem
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override
public CssCompletionItem createFileItem(FileObject file, int anchor) {
String name = file.getNameExt();
Color color = file.isFolder() ? Color.BLUE : null;
ImageIcon icon = FileReferenceCompletion.getIcon(file);
return CssCompletionItem.createFileCompletionItem(new CssElement(file, name), name, anchor, color, icon, addQuotes, addSemicolon);
}
示例14: toString
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
/**
* Returns a string representation of this object.
*
* @return a string representation of the object
*/
@Override
public String toString () {
String fileName = null;
try {
FileObject fo = URLMapper.findFileObject(new URL(url));
if (fo != null) {
fileName = fo.getNameExt();
}
} catch (MalformedURLException ex) {}
if (fileName == null) {
fileName = url;
}
return "LineBreakpoint " + fileName + " : " + lineNumber;
}
示例15: createKeys
import org.openide.filesystems.FileObject; //导入方法依赖的package包/类
@Override protected boolean createKeys(List<FileObject> keys) {
FileObject d = project.getProjectDirectory();
keys.add(d.getFileObject("pom.xml")); // NOI18N
keys.add(d.getFileObject(M2Configuration.FILENAME));
for (FileObject kid : d.getChildren()) {
String n = kid.getNameExt();
if (n.startsWith(M2Configuration.FILENAME_PREFIX) && n.endsWith(M2Configuration.FILENAME_SUFFIX)) {
keys.add(kid);
}
}
keys.add(d.getFileObject(M2AuxilaryConfigImpl.CONFIG_FILE_NAME));
keys.add(FileUtil.toFileObject(MavenCli.DEFAULT_USER_SETTINGS_FILE));
keys.removeAll(Collections.singleton(null));
return true;
}