org.openide.filesystems.FileUtil.getFileDisplayName()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中org.openide.filesystems.FileUtil.getFileDisplayName()方法的一些代码示例,展示了FileUtil.getFileDisplayName()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.getFileDisplayName()方法的具体详情如下:
包路径:org.openide.filesystems.FileUtil
类名称:FileUtil
方法名:getFileDisplayName

FileUtil.getFileDisplayName介绍

[英]Get an appropriate display name for a file object. If the file corresponds to a path on disk, this will be the disk path. Otherwise the name will mention the filesystem name or archive name in case the file comes from archive and relative path. Relative path will be mentioned just in case that passed FileObject isn't root FileObject#isRoot.
[中]获取文件对象的适当显示名称。如果文件对应于磁盘上的路径,则这将是磁盘路径。否则,如果文件来自存档和相对路径,则名称将提及文件系统名称或存档名称。仅当传递的FileObject不是根FileObject#isRoot时,才会提到相对路径。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-filesystems

@Override
public String toString() {
  StringBuilder b = new StringBuilder();
  b.append(getClass().getName().replaceFirst(".+\\.", ""));
  b.append('[');
  FileObject src = (FileObject) getSource();
  if (src != file) {
    b.append("src=");
    b.append(FileUtil.getFileDisplayName(src));
    b.append(',');
  }
  b.append("file=");
  b.append(FileUtil.getFileDisplayName(file));
  b.append(",time=");
  b.append(new Date(time));
  b.append(",expected=");
  b.append(expected);
  insertIntoToString(b);
  b.append(']');
  return b.toString();
}
void insertIntoToString(StringBuilder b) {}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base

@Override
public String toString() {
  return String.format(
    "%s[folder: %s]",   //NOI18N
    getClass().getSimpleName(),
    FileUtil.getFileDisplayName(root));
}

代码示例来源:origin: dcaoyuan/nbscala

@Override
public String getShortDescription() {
  String prjDirDispName = FileUtil.getFileDisplayName(project.getProjectDirectory());
  return NbBundle.getMessage(J2SELogicalViewProvider.class, "HINT_project_root_node", prjDirDispName);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd

@Override
public String getShortDescription() {
  FileObject gdir = group.getRootFolder();
  String dir = FileUtil.getFileDisplayName(gdir);
  return NbBundle.getMessage(PhysicalView.class,
      isProjectDir ? "HINT_project" : "HINT_group", // NOI18N
      dir);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project

@Override                                                                                                            
public String getShortDescription() {                                                                                
  String prjDirDispName = FileUtil.getFileDisplayName(project.getProjectDirectory());                              
  return MessageFormat.format(shortDesc, prjDirDispName);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base

public Rewriter(FileObject fo, PositionConverter converter, Map<Integer, String> userInfo, Source src) throws IOException {
  this.src = src;
  this.converter = converter;
  this.userInfo = userInfo;
  if (fo != null) {
    prp = PositionRefProvider.get(fo);
  }
  if (prp == null)
    throw new IOException("Could not find CloneableEditorSupport for " + FileUtil.getFileDisplayName (fo)); //NOI18N
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-hints-declarative-test

public DeclarativeHintsTestBase(FileObject hintFile, FileObject testFile, TestCase test) {
  super(FileUtil.getFileDisplayName(testFile) + "/" + test.getName());
  this.hintFile = hintFile;
  this.testFile = testFile;
  this.test = test;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-project

public String getDisplayName() {
  FileObject fo = URLMapper.findFileObject(location);
  if (fo != null) {
    return FileUtil.getFileDisplayName(fo);
  } else {
    return location.toExternalForm();
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-apisupport-project

public @Override String toString() {
  FileObject layer = getLayerFile();
  if (layer != null) {
    return FileUtil.getFileDisplayName(layer);
  } else {
    return FileUtil.getFileDisplayName(project.getProjectDirectory());
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders

/** Text to use as tooltip for component.
*
* @return text to show to the user
*/
protected String messageToolTip () {
  // update tooltip
  return FileUtil.getFileDisplayName(obj.getPrimaryFile());
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-project-jsf

private void updateCreatedFolder() {
  
  FileObject root = ((SourceGroup)locationComboBox.getSelectedItem()).getRootFolder();
    
  String folderName = folderTextField.getText().trim();
  String documentName = documentNameTextField.getText().trim();
  
  String createdFileName = FileUtil.getFileDisplayName( root ) + 
    ( folderName.startsWith("/") || folderName.startsWith( File.separator ) ? "" : "/" ) + // NOI18N
    folderName + 
    ( folderName.endsWith("/") || folderName.endsWith( File.separator ) || folderName.length() == 0 ? "" : "/" ) + // NOI18N
    documentName + expectedExtension;
    
  fileTextField.setText( createdFileName.replace( '/', File.separatorChar ) ); // NOI18N    
    
  fireChange();
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-project-ui

private void remove( FileObject fo ) {
  final String path = FileUtil.getRelativePath( root, fo );
  if (path != null) {
    names2nodes.remove( path );
  } else if (root.isValid() && fo.isValid()) {
    assert false : String.format(
      "Removing wrong folder: %s from %s",    //NOI18N
      FileUtil.getFileDisplayName(fo),
      FileUtil.getFileDisplayName(root));
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javafx2-project

public String getCurrentPackagePath() {
  if(currentPackageName != null && currentSourceGroup != null) {
    String packageNameDecorated = (currentPackageName.startsWith("/") || currentPackageName.startsWith(File.separator) ? "" : "/") + // NOI18N
        currentPackageName
        + (currentPackageName.endsWith("/") || currentPackageName.endsWith(File.separator) || currentPackageName.length() == 0 ? "" : "/"); // NOI18N
    if(currentSourceGroup.isReal()) {
       return FileUtil.getFileDisplayName(currentSourceGroup.getRootFolder()) + packageNameDecorated;
    }
    return FileUtil.getFileDisplayName(currentSourceGroup.getRootFolder()) + "/<" + currentSourceGroup.getDisplayName() + ">" + packageNameDecorated; // NOI18N
  }
  return null;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-javaee-project

private void refreshLocation() {
  FileObject fileObject = getSelectedLocation();
  if (fileObject != null) {
    createdFileText.setText(FileUtil.getFileDisplayName(fileObject) + File.separator + FILE_DD);
  }
  firePropertyChange("", null, null);
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-java-source-base

public ClassLoaderRef(final ClassLoader cl, final FileObject root) {
  super(cl, BaseUtilities.activeReferenceQueue());
  this.timeStamp = getTimeStamp(root);
  this.rootPath = FileUtil.getFileDisplayName(root);
  LOG.log(Level.FINER, "ClassLoader for root {0} created.", new Object[]{rootPath});  //NOI18N
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

@NbBundle.Messages({
  "# {0} - project directory",
  "ClientSideProjectNode.description=HTML5 application in {0}"
})
@Override
public String getShortDescription() {
  return Bundle.ClientSideProjectNode_description(FileUtil.getFileDisplayName(project.getProjectDirectory()));
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

@Override
public String getDisplayName() {
  FileObject fo = getOriginal().getLookup().lookup(FileObject.class);
  return fo != null ? FileUtil.getFileDisplayName(fo) : super.getDisplayName();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-core

/** Message to display when an object has been opened.
* @return the message or null if nothing should be displayed
*/
protected String messageOpened () {
  DataObject obj = getServlet();
  if (obj == null)
    return "";
  return NbBundle.getMessage (ServletEditor.class, "CTL_ObjectOpened", // NOI18N
    obj.getPrimaryFile().getNameExt(),
    FileUtil.getFileDisplayName(obj.getPrimaryFile())
  );
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-clientproject

private void init() {
  jProjectFolderTextField.setText(FileUtil.getFileDisplayName(project.getProjectDirectory()));
  jSiteRootFolderTextField.setText(beautifyPath(getSiteRootPath()));
  jTestFolderTextField.setText(beautifyPath(uiProperties.getTestFolder()));
  jEncodingComboBox.setModel(ProjectCustomizer.encodingModel(uiProperties.getEncoding()));
  jEncodingComboBox.setRenderer(ProjectCustomizer.encodingRenderer());
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-core

/** Message to display when an object is being opened.
* @return the message or null if nothing should be displayed
*/
protected String messageOpening () {
  DataObject obj = getServlet();
  if (obj == null)
    return "";
  return NbBundle.getMessage (ServletEditor.class , "CTL_ObjectOpen", // NOI18N
    obj.getPrimaryFile().getNameExt(),
    FileUtil.getFileDisplayName(obj.getPrimaryFile())
  );
}

相关文章