public String getDisplayName() { String n = fo.getName(); try { n = fo.getFileSystem().getStatus().annotateName(n, Collections.singleton(fo)); } catch (FileStateInvalidException ex) { LOG.log(Level.WARNING, ex.getMessage(), ex); } return n; }
protected final String annotateName(final String name) { String annotatedName = name; if (files != null && files.iterator().hasNext()) { try { FileObject fo = files.iterator().next(); annotatedName = fo.getFileSystem().getStatus().annotateName(name, files); } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } } return annotatedName; }
private static List<Category> loadCategories () { FileObject[] categoryFOs = FileUtil.getConfigFile(SEARCH_PROVIDERS_FOLDER).getChildren(); // respect ordering defined in layers List<FileObject> sortedCats = FileUtil.getOrder(Arrays.asList(categoryFOs), false); List<ProviderModel.Category> categories = new ArrayList<ProviderModel.Category>(sortedCats.size()); for (FileObject curFO : sortedCats) { String displayName = null; try { displayName = curFO.getFileSystem().getStatus().annotateName( curFO.getNameExt(), Collections.singleton(curFO)); } catch (FileStateInvalidException ex) { Logger.getLogger(ProviderModel.class.getName()).log(Level.WARNING, "Obtaining display name for " + curFO + " failed.", ex); } String commandPrefix = null; Object cpAttr = curFO.getAttribute(COMMAND_PREFIX); if (cpAttr instanceof String) { commandPrefix = (String)cpAttr; } categories.add(new Category(curFO, displayName, commandPrefix)); } return categories; }
String name = null; try { name = fileObject.getFileSystem ().getStatus ().annotateName (fileObject.getName (), Collections.singleton (fileObject)); } catch (FileStateInvalidException ex) { name = fileObject.getName ();
try { final Status status = fo.getFileSystem().getStatus(); String n = status.annotateName(name, Collections.singleton(fo)); if (!n.equals(name)) { localizedName = n;
String n = fo2.getName(); try { n = fo2.getFileSystem().getStatus().annotateName(n, dobjs[i].files()); } catch (FileStateInvalidException e) {
String n = fo2.getName(); try { n = fo2.getFileSystem().getStatus().annotateName(n, dobjs[i].files()); } catch (FileStateInvalidException e) {
/** Get the display name for the node. * A filesystem may {@link org.openide.filesystems.FileSystem#getStatus specially alter} this. * @return the desired name */ public String getDisplayName () { String name = (String) getDataObject().getPrimaryFile(). getAttribute(InstanceDataObject.EA_NAME); if (name == null) { try { String def = "\b"; // NOI18N FileSystem.Status fsStatus = getDataObject().getPrimaryFile(). getFileSystem().getStatus(); name = fsStatus.annotateName(def, getDataObject().files()); if (name.indexOf(def) < 0) { return name; } else { name = getNameForBean(); if (name != null) { name = fsStatus.annotateName (name, getDataObject().files()); } else { name = super.getDisplayName(); } } } catch (FileStateInvalidException e) { // no fs, do nothing } } return name; }
/** * Tries to use {@link org.openide.filesystems.FileSystem.Status#annotateName} on a file. * The key difference is that in the case of a layer entry, this will be synchronous, * whereas normally the display name and icon are calculated asynchronously and a change fired. * @param fo a file * @return its (possibly annotated) name according to {@link FileObject#getNameExt} */ public static String getAnnotatedName(FileObject fo) { String name = fo.getNameExt(); try { FileSystem.Status status = fo.getFileSystem().getStatus(); if (status instanceof SynchronousStatus) { return ((SynchronousStatus) status).annotateNameSynch(name, Collections.singleton(fo)); } else { return status.annotateName(name, Collections.singleton(fo)); } } catch (FileStateInvalidException ex) { return name; } }
private static List<String> loadCategories () { //Repository.getDefault ().findResource ("Spellcheckers"); List<String> result = new ArrayList<String> (); FileObject root = FileUtil.getConfigFile ("Spellcheckers"); if (root != null) { FileObject[] children = root.getChildren (); for (FileObject fileObject : children) { String name = null; try { name = fileObject.getFileSystem ().getStatus ().annotateName (fileObject.getName (), Collections.singleton (fileObject)); } catch (FileStateInvalidException ex) { name = fileObject.getName (); } Boolean b = (Boolean) fileObject.getAttribute ("Hidden"); if (b != null && b) { result.add ("-" + name); // hidden } else { result.add ("+" + name); } } } Collections.sort (result, CategoryComparator); return result; }
/** Get the display name for the node. * A filesystem may {@link org.openide.filesystems.FileSystem#getStatus specially alter} this. * Subclassers overriding this method should consider the recommendations * in {@link DataObject#createNodeDelegate}. * @return the desired name */ public String getDisplayName () { String s = super.getDisplayName (); try { s = obj.getPrimaryFile ().getFileSystem ().getStatus ().annotateName (s, new LazyFilesSet()); } catch (FileStateInvalidException e) { // no fs, do nothing } return s; }
@Override public String getDisplayName() { if (isTopLevelNode) { String s = NbBundle.getMessage(SiteDocsNode.class, "LBL_Site_Pages"); DataObject dob = getOriginal().getLookup().lookup(DataObject.class); FileObject file = dob.getPrimaryFile(); try { s = file.getFileSystem().getStatus().annotateName(s, Collections.singleton(file)); } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } return s; } return getOriginal().getDisplayName(); }
protected final String annotateName(final String name) { String annotatedName = name; if (files != null && !files.isEmpty()) { Iterator<FileObject> it = files.iterator(); try { FileObject fo = it.next(); if (fo.isValid()) { annotatedName = fo.getFileSystem().getStatus().annotateName(name, files); } } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } } return annotatedName; }
public String getDisplayName () { if (format == null) { format = new MessageFormat (NbBundle.getBundle (DataShadow.class).getString ("FMT_shadowName")); } String n = format.format (createArguments ()); try { obj.getPrimaryFile().getFileSystem().getStatus().annotateName(n, obj.files()); } catch (FileStateInvalidException fsie) { // ignore } return n; }
@Override public String getDisplayName () { String s = super.getDisplayName (); try { s = file.getFileSystem ().getStatus ().annotateName (s, Collections.singleton(file)); } catch (FileStateInvalidException e) { ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e); } return s; }