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

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

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

FileUtil.getConfigRoot介绍

[英]Returns the root of the NetBeans default (system, configuration) filesystem.
[中]返回NetBeans默认(系统、配置)文件系统的根。

代码示例

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

/** Returns <code>true</code> if the filesystem is default.
 * @return true if this is {@link Repository#getDefaultFileSystem}
*/
public final boolean isDefault() {
  FileSystem fs = null;
  try {
    fs = FileUtil.getConfigRoot().getFileSystem();
  } catch (FileStateInvalidException ex) {
    Exceptions.printStackTrace(ex);
  }
  return this == fs;
}

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

public void run() {
    LOG.fine("refreshAll - started");  //NOI18N
    refreshFor(File.listRoots());
    try {
      getConfigRoot().getFileSystem().refresh(true);
    } catch (FileStateInvalidException ex) {
      Exceptions.printStackTrace(ex);
    } finally {
      LOG.fine("refreshAll - finished");  //NOI18N
      synchronized (REFRESH_RP) {
        refreshTask = null;
      }
    }
  }
});

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

FileObject resolversFolder = FileUtil.getConfigFile(MIME_RESOLVERS_PATH);
if (resolversFolder == null) {
  resolversFolder = FileUtil.createFolder(FileUtil.getConfigRoot(), MIME_RESOLVERS_PATH);

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

private OverFiles(String path, List<FOItem> items, AbstractLookup lkp, AbstractLookup.Content cnt) {
  super(computeDelegates(path, items, lkp));
  this.path = path;
  this.lkp = lkp;
  this.content = cnt;
  this.content.setPairs(order(items));
  FileSystem fs = null;
  try {
    fs = FileUtil.getConfigRoot().getFileSystem();
  } catch (FileStateInvalidException ex) {
    Exceptions.printStackTrace(ex);
  }
  this.weakL = FileUtil.weakFileChangeListener(this, fs);
  fs.addFileChangeListener(weakL);
}

代码示例来源:origin: eu.agrosense.client/import

static FileObject getImportFolder() throws IOException {
    FileObject folder = FileUtil.getConfigRoot().getFileObject(IMPORT_FOLDER);
    if (folder == null) {
      folder = FileUtil.getConfigRoot().createFolder(IMPORT_FOLDER);
    }
    return folder;
  }
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-j2ee-api-ejbmodule

private static Node getImageDelegate() {
    FileObject imageFo = FileUtil.getConfigRoot();
    if (imageFo != null) {
      try {
        DataObject imageDo = DataObject.find(imageFo);
        return imageDo.getNodeDelegate();
      } catch (DataObjectNotFoundException donfe) {
        Logger.getLogger("global").log(Level.INFO, null, donfe);
      }
    }
    return null;
  }
}

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

@Override
public boolean isPlatform() {
  FileObject fo = getFileObject();
  if (fo != null) {
    try {
      return FileUtil.getConfigRoot().getFileSystem().equals(fo.getFileSystem());
    } catch (FileStateInvalidException ex) {
      Exceptions.printStackTrace(ex);
    }
  }
  return false;
}

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

private FileObject getFolder() {
  try {
    return fo.getFileSystem().getRoot();
  }
  catch (FileStateInvalidException ex) {
    // ok
  }
  return FileUtil.getConfigRoot();
}

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

private static synchronized boolean thaSupportEnabled() {
  if (hasTHAModule == null) {
    hasTHAModule = Boolean.FALSE;
    FileObject fsRoot = FileUtil.getConfigRoot();
    // Not to introduce an additional dependency on dlight modules
    // just use absolute path
    FileObject thaConfig = fsRoot.getFileObject("DLight/Configurations/THA"); // NOI18N
    hasTHAModule = thaConfig != null && thaConfig.isFolder();
  }
  return hasTHAModule;
}

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

private static DataFolder findSessionFolder(String name) {
  try {
    FileObject fo = FileUtil.getConfigFile(name);
    if (fo == null) {
      // resource not found, try to create new folder
      fo = FileUtil.createFolder(FileUtil.getConfigRoot(), name);
    }
    return DataFolder.findFolder(fo);
  } catch (IOException ex) {
    throw (IllegalStateException) new IllegalStateException("Folder not found and cannot be created: " + name).initCause(ex); // NOI18N
  }
}

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

private static ImageIcon getFolderIcon() {

  if ( ICON_FOLDER == null ) {
    DataFolder dataFolder = DataFolder.findFolder( FileUtil.getConfigRoot() );
    ICON_FOLDER = new ImageIcon( dataFolder.getNodeDelegate().getIcon( BeanInfo.ICON_COLOR_16x16 ) );            
  }
  return ICON_FOLDER;   
}

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

private static ImageIcon getFolderIcon() {
  if (ICON_FOLDER == null) {
    DataFolder dataFolder = DataFolder.findFolder(FileUtil.getConfigRoot());
    ICON_FOLDER = new ImageIcon(dataFolder.getNodeDelegate().getIcon(BeanInfo.ICON_COLOR_16x16));
  }
  return ICON_FOLDER;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-editor-settings-lib

public StorageImpl(StorageDescription<K, V> sd, Callable<Void> callback) {
  this.storageDescription = sd;
  this.dataChangedCallback = callback;
  this.baseFolder = FileUtil.getConfigFile("Editors"); //NOI18N
  try {
    this.tracker = new FilesystemTracker(FileUtil.getConfigRoot().getFileSystem());
  } catch (FileStateInvalidException ex) {
    // something is terribly wrong, because we can't access SystemFileSystem
    throw new IllegalStateException(ex);
  }
  Filters.registerCallback(this);
}

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

private ConfFilesNode(Project prj, Children children) {
  super(children, createLookup(prj, children));
  this.project = prj;
  setName("configurationFiles"); // NOI18N
  iconDelegate = DataFolder.findFolder (FileUtil.getConfigRoot()).getNodeDelegate();
}

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

public PlatformCategoryNode (PlatformCategoriesDescriptor desc) {
  super (new PlatformsChildren (desc.getPlatform()));
  this.desc = desc;            
  this.iconDelegate = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate();
}

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

/** Creates a new instance of LibraryConverter */
public LibraryConverter() {
  try {
    FileObject rep = FileUtil.createFolder(FileUtil.getConfigRoot(), "org-netbeans-api-project-libraries/Libraries");  //NOI18N
    rep.addFileChangeListener(this);
    FileObject fo[] = rep.getChildren();
    for (int i=0; i < fo.length; i++) {
      convertLibrary(fo[i]);
    }
  } catch (IOException e) {
  }
}

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

public PlatformCategoryNode (PlatformCategoriesDescriptor desc) {
  super (new PlatformsChildren (desc.getPlatform()));
  this.desc = desc;            
  this.iconDelegate = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate();
}

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

/**
 * Returns default folder icon as {@link java.awt.Image}. Never returns
 * <code>null</code>.
 *
 * @param opened wheter closed or opened icon should be returned.
 */
private static Image getTreeFolderIcon(boolean opened) {
  final Node n = DataFolder.findFolder(FileUtil.getConfigRoot()).getNodeDelegate();
  final Image base = opened ? n.getOpenedIcon(BeanInfo.ICON_COLOR_16x16) : n.getIcon(BeanInfo.ICON_COLOR_16x16);
  assert base != null;
  return base;
}

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

public FolderFilterNode(BasicNodes nodeType, Node folderNode, List<File> ignoreList) {
  super(folderNode, folderNode.isLeaf() ? Children.LEAF :
      new FolderFilterChildren(folderNode, ignoreList));
  this.nodeType = nodeType;
  iconDelegate = DataFolder.findFolder (FileUtil.getConfigRoot()).getNodeDelegate();
  delegate = folderNode;
}

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

@org.netbeans.api.annotations.common.SuppressWarnings("SIC_INNER_SHOULD_BE_STATIC_NEEDS_THIS") // since CategoryChildren is nonstatic
CategoryNode(LibraryTypeProvider provider, LibraryStorageArea area) {
  super(new CategoryChildren(provider, area), Lookups.fixed(provider, area));
  this.provider = provider;       
  this.iconDelegate = DataFolder.findFolder (FileUtil.getConfigRoot()).getNodeDelegate();
}

相关文章