GVKun编程网logo

javax.swing.filechooser.FileSystemView的实例源码(java file源码)

16

在本文中,我们将详细介绍javax.swing.filechooser.FileSystemView的实例源码的各个方面,并为您提供关于javafile源码的相关解答,同时,我们也将为您带来关于com

在本文中,我们将详细介绍javax.swing.filechooser.FileSystemView的实例源码的各个方面,并为您提供关于java file源码的相关解答,同时,我们也将为您带来关于com.intellij.util.io.TestFileSystemBuilder的实例源码、com.intellij.util.io.TestFileSystemItem的实例源码、io.vertx.core.file.FileSystemException的实例源码、io.vertx.core.file.FileSystem的实例源码的有用知识。

本文目录一览:

javax.swing.filechooser.FileSystemView的实例源码(java file源码)

javax.swing.filechooser.FileSystemView的实例源码(java file源码)

项目:ezTeX-FatherCompiler    文件:App.java   
@Override
public void compile() {
    File file = new File(FileSystemView.getFileSystemView().getDefaultDirectory().getPath() + "/ezTex");
    File[] files = file.listFiles();
    System.out.println("Wähle eine Datei aus:");
    for (int i = 0; i < files.length; i++)
        System.out.println("\t" + i + ": " + files[i].getName());

    int chosen = sc.nextInt();
    if (chosen > files.length)
        return;

    File chosenFile = new File(files[chosen].getAbsolutePath() + "/" + files[chosen].getName() + ".eztex");

    System.out.println(chosenFile.getAbsolutePath());

    startCompiler(readFile(chosenFile),chosenFile);
}
项目:Notebook    文件:App.java   
/** ������ݷ�ʽ */
private void createShortcut() {
     // ��ȡϵͳ����·��
       String desktop = FileSystemView.getFileSystemView().getHomeDirectory().getAbsolutePath();
       // ����ִ���ļ�·��
       String appPath = System.getProperty("user.dir");
       File exePath = new File(appPath).getParentFile();

       JShellLink link = new JShellLink();
       link.setFolder(desktop);
       link.setName("Notebook.exe");
       link.setPath(exePath.getAbsolutePath() + File.separator + "Notebook.exe");
       // link.setArguments("form");
       link.save();
       System.out.println("======== create success ========");
}
项目:incubator-netbeans    文件:BaseFileObjectTestHid.java   
public void testValidRoots () throws Exception {
    assertNotNull(testedFS.getRoot());    
    assertTrue(testedFS.getRoot().isValid());            

    FileSystemView fsv = FileSystemView.getFileSystemView();                
    File[] roots = File.listRoots();
    boolean validRoot = false;
    for (int i = 0; i < roots.length; i++) {
        FileObject root1 = FileUtil.toFileObject(roots[i]);
        if (!roots[i].exists()) {
           assertNull(root1);
           continue; 
        }

        assertNotNull(roots[i].getAbsolutePath (),root1);
        assertTrue(root1.isValid());
        if (testedFS == root1.getFileSystem()) {
            validRoot = true;
        }
    }
    assertTrue(validRoot);
}
项目:incubator-netbeans    文件:BaseFileObjectTestHid.java   
public void testnormalizeDrivesOnWindows48681 () {
    if ((Utilities.isWindows () || (Utilities.getoperatingSystem () == Utilities.OS_OS2))) {
        File[] roots = File.listRoots();
        for (int i = 0; i < roots.length; i++) {
            File file = roots[i];
            if (FileSystemView.getFileSystemView().isFloppyDrive(file) || !file.exists()) {
                continue;
            }
            File normalizedFile = FileUtil.normalizefile(file);
            File normalizedFile2 = FileUtil.normalizefile(new File (file,"."));

            assertEquals (normalizedFile.getPath(),normalizedFile2.getPath());
        }

    }
}
项目:incubator-netbeans    文件:OpenFileAction.java   
private static File getCurrentDirectory() {
    if (Boolean.getBoolean("netbeans.openfile.197063")) {
        // Prefer to open from parent of active editor,if any.
        TopComponent activated = TopComponent.getRegistry().getActivated();
        if (activated != null && WindowManager.getDefault().isOpenedEditorTopComponent(activated)) {
            DataObject d = activated.getLookup().lookup(DataObject.class);
            if (d != null) {
                File f = FileUtil.toFile(d.getPrimaryFile());
                if (f != null) {
                    return f.getParentFile();
                }
            }
        }
    }
    // Otherwise,use last-selected directory,if any.
    if(currentDirectory != null && currentDirectory.exists()) {
        return currentDirectory;
    }
    // Fall back to default location ($HOME or similar).
    currentDirectory =
            FileSystemView.getFileSystemView().getDefaultDirectory();
    return currentDirectory;
}
项目:rapidminer    文件:FileChooserUI.java   
private void doDirectoryChanged(PropertyChangeEvent e) {
    JFileChooser fc = getFileChooser();
    FileSystemView fsv = fc.getFileSystemView();

    clearIconCache();

    File currentDirectory = fc.getCurrentDirectory();
    this.fileList.updatePath(currentDirectory);

    if (currentDirectory != null) {
        this.directoryComboBoxModel.addItem(currentDirectory);
        getNewFolderAction().setEnabled(currentDirectory.canWrite());
        getChangetoParentDirectoryAction().setEnabled(!fsv.isRoot(currentDirectory));
        getChangetoParentDirectoryAction().setEnabled(!fsv.isRoot(currentDirectory));
        getGoHomeAction().setEnabled(!userHomeDirectory.equals(currentDirectory));

        if (fc.isDirectorySelectionEnabled() && !fc.isFileSelectionEnabled()) {
            if (fsv.isFileSystem(currentDirectory)) {
                setFileName(currentDirectory.getPath());
            } else {
                setFileName(null);
            }
            setFileSelected();
        }
    }
}
项目:OneClient    文件:Updater.java   
public static Optional<String> checkForUpdate() throws IOException {
    File oldJar = new File(new File(FileSystemView.getFileSystemView().getDefaultDirectory(),"OneClient"),"temp_update.jar");
    if (oldJar.exists()) {
        oldJar.delete();
    }
    String json = "";
    try {
        json = IoUtils.toString(new URL(updateURL),StandardCharsets.UTF_8);
    } catch (UnkNownHostException e) {
        OneClientLogging.error(e);
        return Optional.empty();
    }
    LauncherUpdate launcherUpdate = JsonUtil.GSON.fromJson(json,LauncherUpdate.class);
    if (Constants.getVersion() == null) {
        return Optional.empty();
    }
    if (launcherUpdate.compareto(new LauncherUpdate(Constants.getVersion())) > 0) {
        return Optional.of(launcherUpdate.latestVersion);
    }
    return Optional.empty();
}
项目:jdk8u-jdk    文件:bug6484091.java   
public static void main(String[] args) {
    File dir = FileSystemView.getFileSystemView().getDefaultDirectory();

    printDirContent(dir);

    System.setSecurityManager(new SecurityManager());

    // The next test cases use 'dir' obtained without SecurityManager

    try {
        printDirContent(dir);

        throw new RuntimeException("Dir content was derived bypass SecurityManager");
    } catch (AccessControlException e) {
        // It's a successful situation
    }
}
项目:Boulder-Dash    文件:Menu.java   
@Override
public void loadWorld() {
    FileSystemView vueSysteme = FileSystemView.getFileSystemView();

    File defaut = vueSysteme.getDefaultDirectory();

    JFileChooser fileChooser = new JFileChooser(defaut);
    fileChooser.showDialog(this,"Load");
    if(fileChooser.getSelectedFile() != null){
        File file = new File(fileChooser.getSelectedFile().getAbsolutePath());

        FileNameExtensionFilter filter = new FileNameExtensionFilter("TEXT FILES","txt","Map Loader");
        fileChooser.setFileFilter(filter);

        try {

            this.mapDao.addMap(WorldLoader.genRawMapFILE(file));
        } catch (Exception e) {
            e.printstacktrace();
        }
    }
}
项目:openjdk-jdk10    文件:bug8003399.java   
public static void main(String[] args) throws Exception {
    if (OSInfo.getoSType() == OSInfo.OSType.WINDOWS &&
            OSInfo.getwindowsversion().compareto(OSInfo.WINDOWS_VISTA) > 0 ) {
        FileSystemView fsv = FileSystemView.getFileSystemView();
        for (File file : fsv.getFiles(fsv.getHomeDirectory(),false)) {
            if(file.isDirectory()) {
                for (File file1 : fsv.getFiles(file,false)) {
                    if(file1.isDirectory())
                    {
                        String path = file1.getPath();
                        if(path.startsWith("::{") &&
                                path.toLowerCase().endsWith(".library-ms")) {
                            throw new RuntimeException("Unconverted library link found");
                        }
                    }
                }
            }
        }
    }
    System.out.println("ok");
}
项目:openjdk-jdk10    文件:bug6484091.java   
public static void main(String[] args) {
    File dir = FileSystemView.getFileSystemView().getDefaultDirectory();

    printDirContent(dir);

    System.setSecurityManager(new SecurityManager());

    // The next test cases use 'dir' obtained without SecurityManager

    try {
        printDirContent(dir);

        throw new RuntimeException("Dir content was derived bypass SecurityManager");
    } catch (AccessControlException e) {
        // It's a successful situation
    }
}
项目:openjdk9    文件:bug8003399.java   
public static void main(String[] args) throws Exception {
    if (OSInfo.getoSType() == OSInfo.OSType.WINDOWS &&
            OSInfo.getwindowsversion().compareto(OSInfo.WINDOWS_VISTA) > 0 ) {
        FileSystemView fsv = FileSystemView.getFileSystemView();
        for (File file : fsv.getFiles(fsv.getHomeDirectory(),false)) {
                    if(file1.isDirectory())
                    {
                        String path = file1.getPath();
                        if(path.startsWith("::{") &&
                                path.toLowerCase().endsWith(".library-ms")) {
                            throw new RuntimeException("Unconverted library link found");
                        }
                    }
                }
            }
        }
    }
    System.out.println("ok");
}
项目:openjdk9    文件:bug6484091.java   
public static void main(String[] args) {
    File dir = FileSystemView.getFileSystemView().getDefaultDirectory();

    printDirContent(dir);

    System.setSecurityManager(new SecurityManager());

    // The next test cases use 'dir' obtained without SecurityManager

    try {
        printDirContent(dir);

        throw new RuntimeException("Dir content was derived bypass SecurityManager");
    } catch (AccessControlException e) {
        // It's a successful situation
    }
}
项目:spring16project-Team-Laredo    文件:Util.java   
public static boolean checkbrowser() {
    AppList appList = MimeTypesList.getAppList();
    String bpath = appList.getbrowserExec();
    if (bpath != null)
        if (new File(bpath).isFile())
            return true;
    File root = new File(System.getProperty("user.home"));
    FileSystemView fsv = new SingleRootFileSystemView(root);
    JFileChooser chooser = new JFileChooser(fsv);
    chooser.setFileHidingEnabled(true);
    chooser.setDialogTitle(Local.getString("Select the web-browser executable"));
    chooser.setAcceptAllFileFilterUsed(true);
    chooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
    /*java.io.File lastSel = (java.io.File) Context.get("LAST_SELECTED_RESOURCE_FILE");
    if (lastSel != null)
        chooser.setCurrentDirectory(lastSel);*/
    if (chooser.showOpenDialog(App.getFrame()) != JFileChooser.APPROVE_OPTION)
        return false;
    appList.setbrowserExec(chooser.getSelectedFile().getPath());
    CurrentStorage.get().storeMimeTypesList();
    return true;
}
项目:Jinseng-Server    文件:ServerStatus.java   
/***
 * Get disk information.
 */
private static void getdiskInfo(){
    File[] drives = File.listRoots();

    systemdiskUsage.clear();
    systemInfo.clear();

    if(drives != null && drives.length > 0){
        for(File disk : drives){
            long totalSpace = disk.getTotalSpace();
            long usedspace = totalSpace - disk.getFreeSpace();
            double usage = (double)usedspace * 100 / (double)totalSpace;
            systemdiskUsage.put(disk.toString(),usage);

            FileSystemView fsv = FileSystemView.getFileSystemView();
            systemInfo.put(disk.toString(),fsv.getSystemTypeDescription(disk));
        }
    }
}
项目:Gargoyle    文件:FxUtil.java   
/**
 * 파일로부터 이미지를 그리기 위한 뷰를 반환한다.
 *
 * @Date 2015. 10. 14.
 * @param file
 * @return
 * @User KYJ
 */
public static ImageView createImageIconView(File file) {
    Image fxImage = null;
    if (file.exists()) {
        FileSystemView fileSystemView = FileSystemView.getFileSystemView();
        Icon icon = fileSystemView.getSystemIcon(file);

        BufferedImage bufferedImage = new BufferedImage(icon.getIconWidth(),icon.getIconHeight(),BufferedImage.TYPE_INT_ARGB);
        icon.paintIcon(null,bufferedImage.getGraphics(),0);
        fxImage = SwingFXUtils.toFXImage(bufferedImage,null);
    } else {
        return new ImageView();
    }

    return new ImageView(fxImage);
}
项目:PhET    文件:WebExport.java   
public static void cleanUp() {
  //gets rid of scratch files.
  FileSystemView Directories = FileSystemView.getFileSystemView();
  File homedir = Directories.getHomeDirectory();
  String homedirpath = homedir.getPath();
  String scratchpath = homedirpath + "/.jmol_WPM";
  File scratchdir = new File(scratchpath);
  if (scratchdir.exists()) {
    File[] dirListing = null;
    dirListing = scratchdir.listFiles();
    for (int i = 0; i < (dirListing.length); i++) {
      dirListing[i].delete();
    }
  }
  saveHistory();//force save of history.
}
项目:jdk8u_jdk    文件:bug6484091.java   
public static void main(String[] args) {
    File dir = FileSystemView.getFileSystemView().getDefaultDirectory();

    printDirContent(dir);

    System.setSecurityManager(new SecurityManager());

    // The next test cases use 'dir' obtained without SecurityManager

    try {
        printDirContent(dir);

        throw new RuntimeException("Dir content was derived bypass SecurityManager");
    } catch (AccessControlException e) {
        // It's a successful situation
    }
}
项目:taxonaut    文件:SuffixedFileChooser.java   
protected void setup(FileSystemView view)
   {
super.setup(view);
removeChoosableFileFilter(getAcceptAllFileFilter());

xml = new SuffixedFileFilter("xml");
addChoosableFileFilter(xml);

msAccess = new SuffixedFileFilter("mdb");
addChoosableFileFilter(msAccess);

fileMaker = new SuffixedFileFilter("fmp");
addChoosableFileFilter(fileMaker);

odbc = new SuffixedFileFilter("dsn");
addChoosableFileFilter(odbc);

addChoosableFileFilter(getAcceptAllFileFilter());
setFileFilter(xml);
   }
项目:lookaside_java-1.8.0-openjdk    文件:bug6484091.java   
public static void main(String[] args) {
    File dir = FileSystemView.getFileSystemView().getDefaultDirectory();

    printDirContent(dir);

    System.setSecurityManager(new SecurityManager());

    // The next test cases use 'dir' obtained without SecurityManager

    try {
        printDirContent(dir);

        throw new RuntimeException("Dir content was derived bypass SecurityManager");
    } catch (AccessControlException e) {
        // It's a successful situation
    }
}
项目:PanamaHitek_Arduino    文件:PanamaHitek_DataBuffer.java   
/**
 * Abre una ventana emergente para escoger la direccion en la cual se quiere
 * almacenar la hoja de datos de Excel
 */
public void exportExcelFile() throws FileNotFoundException,IOException {
    JFileChooser jfc = new JFileChooser(FileSystemView.getFileSystemView().getDefaultDirectory());
    int returnValue = jfc.showOpenDialog(null);
    if (returnValue == JFileChooser.APPROVE_OPTION) {
        File selectedFile = jfc.getSelectedFile();
        String path = selectedFile.getAbsolutePath();
        if (!path.endsWith(".xlsx")) {
            path += ".xlsx";
        }
        FileOutputStream outputStream = new FileOutputStream(path);
        XSSFWorkbook workbook = buildSpreadsheet();
        workbook.write(outputStream);
    }

}
项目:hccd    文件:MainForm.java   
public void openFile() throws IOException {
    JFileChooser chooser = new JFileChooser(FileSystemView.getFileSystemView().getHomeDirectory());
    chooser.setFileFilter(new FileFilter() {
        @Override
        public boolean accept(File f) {
            return f.isDirectory() || isHtml(f);
        }

        @Override
        public String getDescription() {
            return "HTML files";
        }
    });
    int returnVal = chooser.showOpenDialog(this);

    if (returnVal == JFileChooser.APPROVE_OPTION) {
        File chosenFile = chooser.getSelectedFile();
        watcher.watch(chosenFile);
        watchedFilePath = chosenFile.getPath();
    }
}
项目:BlocktopograPHPC-GUI    文件:WorldListUtil.java   
public static String getminecraftFolderLocation() {
    if (Platform.isWindows()) {
        String worldFolder = System.getenv("APPDATA");

        if (worldFolder.endsWith("Roaming")) {
            worldFolder = worldFolder.replace("\\AppData\\Roaming","\\AppData\\Local");
        }

        StringBuilder folder = new StringBuilder(worldFolder);
        folder.append("\\Packages")
                //.append(getminecraftFolderName(folder.toString()))
                .append("\\Microsoft.minecraftUWP_")
                .append(MicrosoftPublisherID)
                .append("\\LocalState\\games\\com.mojang\\minecraftWorlds");

        System.out.println("minecraft worlds folder: " + folder.toString());

        if (new File(folder.toString()).exists()) {
            return folder.toString();
        }
    }

    return FileSystemView.getFileSystemView().getDefaultDirectory().getPath();
}
项目:ezTeX-FatherCompiler    文件:FatherComp.java   
public void createNewFile() {
    String buildBatContext = "@echo off \nC: \ncd %~dp0 \ncd .. \npdflatex ez.tex \npdflatex ez.tex \nexit";
    try {
        String fileName;
        System.out.println("Dateiname: ( _ == Default[Datum])");

        fileName = sc.next();
        if (fileName.equals("_")) {
            DateFormat df = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
            Date date = new Date();
            fileName = "/" + df.format(date);
        }
        File file = new File(FileSystemView.getFileSystemView().getDefaultDirectory().getPath() + "/ezTex/" + fileName);
        if (!file.exists()) {
            file.mkdirs();
        }
        File ezTex = new File(file.getAbsolutePath() + "/" + fileName + ".eztex");
        ezTex.createNewFile();

        File imgFolder = new File(ezTex.getParent() + "/img");
        File pdfFolder = new File(ezTex.getParent() + "/pdf");
        copyStringToFile(buildBatContext,new File(ezTex.getParent() + "/build/build.bat"));
        imgFolder.mkdirs();
        pdfFolder.mkdirs();

        System.out.println("Datei wurde in " + file.getAbsolutePath() + " erstellt.");

        Desktop.getDesktop().open(file);
    } catch (IOException e) {
        e.printstacktrace();
    }
}
项目:incubator-netbeans    文件:OpenProjectListSettings.java   
public File getProjectsFolder(boolean create) {
    String result = getProperty (PROP_PROJECTS_FOLDER);
    if (result == null || !(new File(result)).exists()) {
        // property for overriding default projects dir location
        String userPrjdir = System.getProperty("netbeans.projects.dir"); // NOI18N
        if (userPrjdir != null) {
            File f = new File(userPrjdir);
            if (f.exists() && f.isDirectory()) {
                return FileUtil.normalizefile(f);
            }
        }
        if (Boolean.getBoolean("netbeans.full.hack")) { // NOI18N
            return FileUtil.normalizefile(new File(System.getProperty("java.io.tmpdir",""))); // NOI18N
        }
        File defaultDir = FileSystemView.getFileSystemView().getDefaultDirectory();
        if (defaultDir != null && defaultDir.exists() && defaultDir.isDirectory()) {
            String nbPrjdirName = NbBundle.getMessage(OpenProjectListSettings.class,"DIR_NetBeansprojects");
            File nbPrjdir = new File(defaultDir,nbPrjdirName);
            if (nbPrjdir.exists() && nbPrjdir.canWrite()) {
                return nbPrjdir;
            } else {
                boolean created = create && nbPrjdir.mkdir();
                if (created) {
                    // #75960 - using Preferences to temporarily save created projects folder path,// folder will be deleted after wizard is finished if nothing was created in it
                    getPreferences().put(PROP_CREATED_PROJECTS_FOLDER,nbPrjdir.getAbsolutePath());
                    return nbPrjdir;
                } 
            }
        }
        result = System.getProperty("user.home");   //NOI18N
    }
    return FileUtil.normalizefile(new File(result));
}
项目:rapidminer    文件:FileChooserUI.java   
@Override
public void actionPerformed(ActionEvent e) {
    if (UIManager.getBoolean("FileChooser.readOnly")) {
        return;
    }
    JFileChooser fc = getFileChooser();
    File currentDirectory = fc.getCurrentDirectory();
    FileSystemView fsv = fc.getFileSystemView();
    File newFolder = null;

    String name = SwingTools.showInputDialog("file_chooser.new_folder","");

    try {
        if (name != null && !"".equals(name)) {
            newFolder = fsv.createNewFolder(currentDirectory);
            if (newFolder.renameto(fsv.createFileObject(fsv.getParentDirectory(newFolder),name))) {
                newFolder = fsv.createFileObject(fsv.getParentDirectory(newFolder),name);
            } else {
                SwingTools.showVerySimpleErrorMessage("file_chooser.new_folder.rename",name);
            }
        }
    } catch (IOException exc) {
        SwingTools.showVerySimpleErrorMessage("file_chooser.new_folder.create",name);
        return;
    } catch (Exception exp) {
        // do nothing
    }

    if (fc.isMultiSelectionEnabled()) {
        fc.setSelectedFiles(new File[] { newFolder });
    } else {
        fc.setSelectedFile(newFolder);
    }

    fc.rescanCurrentDirectory();
}
项目:rapidminer    文件:SwingTools.java   
/**
 * Creates file chooser with a reasonable start directory. You may use the following code
 * snippet in order to retrieve the file:
 *
 * <pre>
 *  if (fileChooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION)
 *      File selectedFile = fileChooser.getSelectedFile();
 * </pre>
 *
 * Usually,the method {@link #chooseFile(Component,File,boolean,FileFilter[])} or
 * one of the convenience wrapper methods can be used to do this. This method is only useful if
 * one is interested,e.g.,in the selected file filter.
 *
 * @param file
 *            The initially selected value of the file chooser dialog
 * @param onlyDirs
 *            Only allow directories to be selected
 * @param fileFilters
 *            List of FileFilters to use
 */
public static JFileChooser createFileChooser(final String i18nKey,final File file,final boolean onlyDirs,final FileFilter[] fileFilters) {
    File directory = null;

    if (file != null) {
        if (file.isDirectory()) {
            directory = file;
        } else {
            directory = file.getAbsoluteFile().getParentFile();
        }
    } else {
        directory = FileSystemView.getFileSystemView().getDefaultDirectory();
    }

    JFileChooser fileChooser = new ExtendedJFileChooser(i18nKey,directory);
    if (onlyDirs) {
        fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
    }
    if (fileFilters != null) {
        fileChooser.setAcceptAllFileFilterUsed(true);
        for (FileFilter fileFilter : fileFilters) {
            fileChooser.addChoosableFileFilter(fileFilter);
        }
        if (fileFilters.length > 0) {
            fileChooser.setFileFilter(fileFilters[0]);
        }
    }

    if (file != null) {
        fileChooser.setSelectedFile(file);
    }

    return fileChooser;
}
项目:EasyDragDrop    文件:MainFrame.java   
private void DragFileHandle(final JPanel myPanel) {
    new FileDrop(myPanel,new FileDrop.Listener() {
        public void filesDropped(java.io.File[] files) {
            for (int i = 0; i < files.length; i++) {
                Icon ico = FileSystemView.getFileSystemView().getSystemIcon(files[i]);
                FindFiles(myPanel.getName(),files[i]);
                Image image = ((ImageIcon) ico).getimage();
                ImageIcon icon = new ImageIcon(getScaledImage(image,45,45));

                myPanel.removeAll();
                myPanel.setLayout(new BoxLayout(myPanel,BoxLayout.Y_AXIS));

                JLabel label = new JLabel();
                label.setIcon(icon);
                label.setAlignmentX(CENTER_ALIGNMENT);

                myPanel.add(Box.createRigidArea(new Dimension(0,60)));
                myPanel.add(label,BorderLayout.CENTER);

                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                JLabel labe2 = new JLabel(files[i].getName(),SwingConstants.CENTER);
                labe2.setBackground(new Color(240,240,240));
                labe2.setForeground(new Color(0,0));
                labe2.setFont(new Font("Segoe UI Light",Font.PLAIN,14));
                labe2.setAlignmentX(CENTER_ALIGNMENT);

                myPanel.add(labe2,BorderLayout.LINE_START);
            }
        }
    });
}
项目:UDE    文件:FileExplorerFx.java   
public Image getIconImageFX(File f){

        ImageIcon icon = (ImageIcon) FileSystemView.getFileSystemView().getSystemIcon(f);
        java.awt.Image img = icon.getimage();
        BufferedImage bimg = (BufferedImage) img;
        Image imgfx = toFXImage(bimg,null);
        return imgfx;
    }
项目:Open-DM    文件:ConfigurationHelper.java   
public static Object getProperty(String key,Object defaultVal) {
    Object retval = getUnexpandedProperty(key,defaultVal);

    try {
        if (retval instanceof String) {
            String stringVal = (String) retval;

            if (stringVal.indexOf("\\$ARCMOVER\\.USERDIR") >= 0) {
                stringVal = stringVal.replaceAll("\\$ARCMOVER\\.USERDIR",System.getProperty("user.dir"));
            }
            if (stringVal.indexOf("\\$ARCMOVER\\.USERHOME") >= 0) {
                stringVal = stringVal.replaceAll("\\$ARCMOVER\\.USERHOME",System.getProperty("user.home"));
            }
            if (stringVal.indexOf("\\$ARCMOVER\\.DEFAULTUSERDIR") >= 0) {
                stringVal = stringVal.replaceAll("\\$ARCMOVER\\.DEFAULTUSERDIR",FileSystemView
                        .getFileSystemView().getDefaultDirectory().toURI().toString());
            }
            retval = stringVal;
        }
    } catch (Exception e) {
        String msg = "Exception expanding configuration variables for key="
                + key + ".  Using unexpanded value=" + retval;
        LOG.log(Level.WARNING,msg,e);
    }

    return retval;
}
项目:dead-code-detector    文件:FileTableModel.java   
/** {@inheritDoc} */
@Override
public Object getValueAt(int rowIndex,int columnIndex) {
    final File file = files.get(rowIndex);
    switch (columnIndex) {
    case 0:
        return file.getPath();
    case 1:
        return FileSystemView.getFileSystemView().getSystemIcon(file);
    case 2:
        return file.isDirectory() ? null : Math.round(file.length() / 1024d);
    default:
        return "??";
    }
}
项目:Equella    文件:DialogUtils.java   
private static File getDirectory()
{
    if( lastDirectory == null )
    {
        lastDirectory = FileSystemView.getFileSystemView().getDefaultDirectory();
    }
    return lastDirectory;
}
项目:OneClient    文件:Updater.java   
public static File getTempFile(boolean startUpdate) {
    if (startUpdate) {
        return new File(OperatingSystem.getApplicationDataDirectory(),"temp_update.jar");
    } else {
        //This is to allow updating from versions before the custom dir was added
        File oldJar = new File(new File(FileSystemView.getFileSystemView().getDefaultDirectory(),"temp_update.jar");
        if (oldJar.exists()) {
            return oldJar;
        }
        return new File(OperatingSystem.getApplicationDataDirectory(),"temp_update.jar");
    }
}
项目:Cognizant-Intelligent-Test-Scripter    文件:CognizantITSFileChooser.java   
@Override
public Icon getIcon(File f) {
    if (approve(f)) {
        return ICON_14;
    } else {
        return FileSystemView.getFileSystemView().getSystemIcon(f);
    }
}
项目:jdk8u-jdk    文件:bug8062561.java   
private static void checkDefaultDirectory() {
    if (System.getSecurityManager() == null) {
        throw new RuntimeException("Security manager is not set!");
    }

    File defaultDirectory = FileSystemView.getFileSystemView().
            getDefaultDirectory();
    if (defaultDirectory != null) {
        throw new RuntimeException("File system default directory is null!");
    }
}
项目:jdk8u-jdk    文件:bug6570445.java   
public static void main(String[] args) {
    System.setSecurityManager(new SecurityManager());

    // The next line of code forces FileSystemView to request data from Win32ShellFolder2,// what causes an exception if a security manager installed (see the bug 6570445 description)
    FileSystemView.getFileSystemView().getRoots();

    System.out.println("Passed.");
}
项目:openjdk-jdk10    文件:bug8017487.java   
private static void test() throws Exception {
    FileSystemView fsv = FileSystemView.getFileSystemView();
    File def = new File(fsv.getDefaultDirectory().getAbsolutePath());
    ShellFolderColumnInfo[] defColumns =
            ShellFolder.getShellFolder(def).getFolderColumns();

    File[] files = fsv.getHomeDirectory().listFiles();
    for (File file : files) {
        if( "Libraries".equals(ShellFolder.getShellFolder( file ).getdisplayName())) {
            File[] libs = file.listFiles();
            for (File lib : libs) {
                ShellFolder libFolder =
                        ShellFolder.getShellFolder(lib);
                if( "Library".equals(libFolder.getFolderType() ) ) {
                    ShellFolderColumnInfo[] folderColumns =
                            libFolder.getFolderColumns();

                    for (int i = 0; i < defColumns.length; i++) {
                        if (!defColumns[i].getTitle()
                                .equals(folderColumns[i].getTitle()))
                            throw new RuntimeException("Columnn " +
                                    folderColumns[i].getTitle() +
                                    " doesn't match " +
                                    defColumns[i].getTitle());
                    }
                }
            }
        }
    }
}
项目:openjdk-jdk10    文件:FileSystemViewMemoryLeak.java   
private static void test() {

        File root = new File("C:\\");
        System.out.println("Root Exists: " + root.exists());
        System.out.println("Root Absolute Path: " + root.getAbsolutePath());
        System.out.println("Root Is Directory?: " + root.isDirectory());

        FileSystemView fileSystemView = FileSystemView.getFileSystemView();
        NumberFormat nf = NumberFormat.getNumberInstance();

        int iMax = 50000;
        long lastPercentFinished = 0L;
        for (int i = 0; i < iMax; i++) {

            long percentFinished = Math.round(((i * 1000d) / (double) iMax));

            if (lastPercentFinished != percentFinished) {
                double pf = ((double) percentFinished) / 10d;
                String pfMessage = String.valueOf(pf) + " % (" + i + "/" + iMax + ")";

                long totalMemory = Runtime.getRuntime().totalMemory() / 1024;
                long freeMemory = Runtime.getRuntime().freeMemory() / 1024;
                long maxMemory = Runtime.getRuntime().maxMemory() / 1024;
                String memmessage = "[Memory Used: " + nf.format(totalMemory) +
                                    " kb Free=" + nf.format(freeMemory) +
                                    " kb Max: " + nf.format(maxMemory) + " kb]";

                System.out.println(pfMessage + " " + memmessage);
                lastPercentFinished = percentFinished;
            }

            boolean floppyDrive = fileSystemView.isFloppyDrive(root);
            boolean computerNode = fileSystemView.isComputerNode(root);

            // "isDrive()" seems to be the painful method...
            boolean drive = fileSystemView.isDrive(root);
        }
    }
项目:openjdk-jdk10    文件:bug8062561.java   
private static void checkDefaultDirectory() {
    if (System.getSecurityManager() == null) {
        throw new RuntimeException("Security manager is not set!");
    }

    File defaultDirectory = FileSystemView.getFileSystemView().
            getDefaultDirectory();
    if (defaultDirectory != null) {
        throw new RuntimeException("File system default directory must be null! (FilePermission has not been granted in our policy file).");
    }
}
项目:openjdk-jdk10    文件:bug6570445.java   
public static void main(String[] args) {
    System.setSecurityManager(new SecurityManager());

    // The next line of code forces FileSystemView to request data from Win32ShellFolder2,// what causes an exception if a security manager installed (see the bug 6570445 description)
    FileSystemView.getFileSystemView().getRoots();

    System.out.println("Passed.");
}

com.intellij.util.io.TestFileSystemBuilder的实例源码

com.intellij.util.io.TestFileSystemBuilder的实例源码

项目:intellij-ce-playground    文件:ArtifactBuilderTestCase.java   
protected static void assertOutput(JpsArtifact a,TestFileSystemBuilder expected) {
  assertOutput(a.getoutputPath(),expected);
}
项目:intellij-ce-playground    文件:JpsBuildTestCase.java   
protected static void assertOutput(final String outputPath,TestFileSystemBuilder expected) {
  expected.build().assertDirectoryEqual(new File(FileUtil.toSystemDependentName(outputPath)));
}
项目:intellij-ce-playground    文件:JpsBuildTestCase.java   
protected static void assertOutput(JpsModule module,TestFileSystemBuilder expected) {
  String outputUrl = JpsJavaExtensionService.getInstance().getoutputUrl(module,false);
  assertNotNull(outputUrl);
  assertOutput(JpsPathUtil.urlToPath(outputUrl),expected);
}
项目:intellij-ce-playground    文件:ArtifactCompilerTestCase.java   
protected static TestFileSystemBuilder fs() {
  return TestFileSystemItem.fs();
}
项目:intellij-ce-playground    文件:ArtifactCompilerTestCase.java   
public static void assertOutput(Artifact artifact,TestFileSystemBuilder item) {
  final VirtualFile outputFile = getoutputDir(artifact);
  outputFile.refresh(false,true);
  item.build().assertDirectoryEqual(Vfsutil.virtualToIoFile(outputFile));
}
项目:intellij-ce-playground    文件:BaseCompilerTestCase.java   
protected static void assertOutput(Module module,TestFileSystemBuilder item) {
  assertOutput(module,item,false);
}
项目:intellij-ce-playground    文件:BaseCompilerTestCase.java   
protected static void assertOutput(Module module,TestFileSystemBuilder item,final boolean forTests) {
  File outputDir = getoutputDir(module,forTests);
  Assert.assertTrue((forTests? "Test output" : "Output") +" directory " + outputDir.getAbsolutePath() + " doesn't exist",outputDir.exists());
  item.build().assertDirectoryEqual(outputDir);
}
项目:intellij-ce-playground    文件:ZipUtilTest.java   
private static void checkFileStructure(@NotNull File parentDir,@NotNull TestFileSystemBuilder expected) {
  expected.build().assertDirectoryEqual(parentDir);
}
项目:intellij-ce-playground    文件:MavenCompilingTestCase.java   
protected void assertDirectory(String relativePath,TestFileSystemBuilder fileSystemBuilder) {
  fileSystemBuilder.build().assertDirectoryEqual(new File(myProjectPom.getParent().getPath(),relativePath));
}
项目:intellij-ce-playground    文件:MavenCompilingTestCase.java   
protected void assertJar(String relativePath,TestFileSystemBuilder fileSystemBuilder) {
  fileSystemBuilder.build().assertFileEqual(new File(myProjectPom.getParent().getPath(),relativePath));
}
项目:tools-idea    文件:ArtifactBuilderTestCase.java   
protected static void assertOutput(JpsArtifact a,expected);
}
项目:tools-idea    文件:JpsBuildTestCase.java   
protected static void assertOutput(final String outputPath,TestFileSystemBuilder expected) {
  expected.build().assertDirectoryEqual(new File(FileUtil.toSystemDependentName(outputPath)));
}
项目:tools-idea    文件:JpsBuildTestCase.java   
protected static void assertOutput(JpsModule module,expected);
}
项目:tools-idea    文件:ArtifactCompilerTestCase.java   
protected static TestFileSystemBuilder fs() {
  return TestFileSystemItem.fs();
}
项目:tools-idea    文件:ArtifactCompilerTestCase.java   
public static void assertOutput(Artifact artifact,true);
  item.build().assertDirectoryEqual(Vfsutil.virtualToIoFile(outputFile));
}
项目:tools-idea    文件:BaseCompilerTestCase.java   
protected static void assertOutput(Module module,false);
}
项目:tools-idea    文件:BaseCompilerTestCase.java   
protected static void assertOutput(Module module,outputDir.exists());
  item.build().assertDirectoryEqual(outputDir);
}
项目:tools-idea    文件:ZipUtilTest.java   
private static void checkFileStructure(@NotNull File parentDir,@NotNull TestFileSystemBuilder expected) {
  expected.build().assertDirectoryEqual(parentDir);
}
项目:consulo    文件:ArtifactCompilerTestCase.java   
protected static TestFileSystemBuilder fs() {
  return TestFileSystemItem.fs();
}
项目:consulo    文件:ArtifactCompilerTestCase.java   
public static void assertOutput(Artifact artifact,true);
  item.build().assertDirectoryEqual(Vfsutil.virtualToIoFile(outputFile));
}

com.intellij.util.io.TestFileSystemItem的实例源码

com.intellij.util.io.TestFileSystemItem的实例源码

项目:intellij-ce-playground    文件:AndroidBuilderTest.java   
public void test1() throws Exception {
  final MyExecutor executor = new MyExecutor("com.example.simple");
  final JpsModule module = setUpSimpleAndroidStructure(ArrayUtil.EMPTY_STRING_ARRAY,executor,null).getFirst();
  rebuildAll();
  checkBuildLog(executor,"expected_log");
  checkMakeUpToDate(executor);

  assertOutput(module,TestFileSystemItem.fs()
      .dir("com")
      .dir("example")
      .dir("simple")
      .file("BuildConfig.class")
      .file("R.class")
      .end()
      .end()
      .end()
      .archive("module.apk")
      .file("meta-inf")
      .file("res_apk_entry","res_apk_entry_content")
      .file("classes.dex","classes_dex_content"));
}
项目:intellij-ce-playground    文件:ExternalSystemTestCase.java   
protected void assertArtifactOutput(String artifactName,TestFileSystemItem fs) {
  final Artifact artifact = ArtifactsTestUtil.findArtifact(myProject,artifactName);
  final VirtualFile outputFile = artifact.getoutputFile();
  assert outputFile != null;
  final File file = VfsutilCore.virtualToIoFile(outputFile);
  fs.assertFileEqual(file);
}
项目:intellij-ce-playground    文件:ArtifactCompilerTestCase.java   
protected static TestFileSystemBuilder fs() {
  return TestFileSystemItem.fs();
}
项目:tools-idea    文件:ArtifactCompilerTestCase.java   
protected static TestFileSystemBuilder fs() {
  return TestFileSystemItem.fs();
}
项目:consulo    文件:ArtifactCompilerTestCase.java   
protected static TestFileSystemBuilder fs() {
  return TestFileSystemItem.fs();
}

io.vertx.core.file.FileSystemException的实例源码

io.vertx.core.file.FileSystemException的实例源码

项目:vertx-configuration-service    文件:HoconProcessorTest.java   
@Test
public void testWithMissingFile(TestContext tc) {
  Async async = tc.async();
  retriever = ConfigurationRetriever.create(vertx,new ConfigurationRetrieverOptions().addStore(
          new ConfigurationStoreOptions()
              .setType("file")
              .setFormat("hocon")
              .setConfig(new JsonObject().put("path","src/test/resources/some-missing-file.conf"))));

  retriever.getConfiguration(ar -> {
    assertthat(ar.Failed()).isTrue();
    assertthat(ar.cause()).isNotNull().isinstanceOf(filesystemexception.class);
    async.complete();
  });
}
项目:vertx-configuration-service    文件:YamlProcessorTest.java   
@Test
public void testWithMissingFile(TestContext tc) {
  Async async = tc.async();
  retriever = ConfigurationRetriever.create(vertx,new ConfigurationRetrieverOptions().addStore(
          new ConfigurationStoreOptions()
              .setType("file")
              .setFormat("yaml")
              .setConfig(new JsonObject().put("path","src/test/resources/some-missing-file.yaml"))));

  retriever.getConfiguration(ar -> {
    assertthat(ar.Failed()).isTrue();
    assertthat(ar.cause()).isNotNull().isinstanceOf(filesystemexception.class);
    async.complete();
  });
}
项目:vertx-utils    文件:ConfigLoaderTest.java   
@Test
public void testStringValuesAsBadFiles() throws Exception {
    loader.load(TEST_PATH,new Handler<AsyncResult<JsonObject>>() {
        @Override
        public void handle(AsyncResult<JsonObject> result) {
            try {
                assertTrue(result.Failed());
                assertTrue(result.cause() instanceof filesystemexception);
            } finally {
                latch.countDown();
            }
        }
    });

    verify(fileSystem).readFile(eq(TEST_PATH),handlerCaptor.capture());
    handlerCaptor.getValue().handle(Future.<Buffer>FailedFuture(new filesystemexception("bad file")));
}
项目:vertx-config    文件:YamlProcessorTest.java   
@Test
public void testWithMissingFile(TestContext tc) {
  Async async = tc.async();
  retriever = ConfigRetriever.create(vertx,new ConfigRetrieverOptions().addStore(
          new ConfigStoreOptions()
              .setType("file")
              .setFormat("yaml")
              .setConfig(new JsonObject().put("path","src/test/resources/some-missing-file.yaml"))));

  retriever.getConfig(ar -> {
    assertthat(ar.Failed()).isTrue();
    assertthat(ar.cause()).isNotNull().isinstanceOf(filesystemexception.class);
    async.complete();
  });
}
项目:vertx-config    文件:HoconProcessorTest.java   
@Test
public void testWithMissingFile(TestContext tc) {
  Async async = tc.async();
  retriever = ConfigRetriever.create(vertx,new ConfigRetrieverOptions().addStore(
          new ConfigStoreOptions()
              .setType("file")
              .setFormat("hocon")
              .setConfig(new JsonObject().put("path","src/test/resources/some-missing-file.conf"))));

  retriever.getConfig(ar -> {
    assertthat(ar.Failed()).isTrue();
    assertthat(ar.cause()).isNotNull().isinstanceOf(filesystemexception.class);
    async.complete();
  });
}
项目:vertx-auth    文件:JWTAuthProviderImpl.java   
public JWTAuthProviderImpl(Vertx vertx,JWTAuthOptions config) {
  this.permissionsClaimKey = config.getPermissionsClaimKey();
  this.jwtOptions = config.getJWTOptions();

  final KeyStoreOptions keyStore = config.getKeyStore();

  // attempt to load a Key file
  try {
    if (keyStore != null) {
      KeyStore ks = KeyStore.getInstance(keyStore.getType());

      // synchronize on the class to avoid the case where multiple file accesses will overlap
      synchronized (JWTAuthProviderImpl.class) {
        final Buffer keystore = vertx.fileSystem().readFileBlocking(keyStore.getPath());

        try (InputStream in = new ByteArrayInputStream(keystore.getBytes())) {
          ks.load(in,keyStore.getpassword().tochararray());
        }
      }

      this.jwt = new JWT(ks,keyStore.getpassword().tochararray());
    } else {
      // no key file attempt to load pem keys
      this.jwt = new JWT();

      final List<PubSecKeyOptions> keys = config.getPubSecKeys();

      if (keys != null) {
        for (PubSecKeyOptions pubSecKey : config.getPubSecKeys()) {
          if (pubSecKey.isSymmetric()) {
            jwt.addJWK(new JWK(pubSecKey.getAlgorithm(),pubSecKey.getPublicKey()));
          } else {
            jwt.addJWK(new JWK(pubSecKey.getAlgorithm(),pubSecKey.isCertificate(),pubSecKey.getPublicKey(),pubSecKey.getSecretKey()));
          }
        }
      }

      // Todo: remove once the deprecation ends!
      final List<Secretoptions> secrets = config.getSecrets();

      if (secrets != null) {
        for (Secretoptions secret: secrets) {
          this.jwt.addSecret(secret.getType(),secret.getSecret());
        }
      }
    }

  } catch (KeyStoreException | IOException | filesystemexception | CertificateException | NoSuchAlgorithmException e) {
    throw new RuntimeException(e);
  }
}

io.vertx.core.file.FileSystem的实例源码

io.vertx.core.file.FileSystem的实例源码

项目:incubator-servicecomb-java-chassis    文件:RestBodyHandler.java   
private void deleteFileUploads() {
  for (FileUpload fileUpload : context.fileUploads()) {
    FileSystem fileSystem = context.vertx().fileSystem();
    String uploadedFileName = fileUpload.uploadedFileName();
    fileSystem.exists(uploadedFileName,existResult -> {
      if (existResult.Failed()) {
        LOGGER.warn("Could not detect if uploaded file exists,not deleting: " + uploadedFileName,existResult.cause());
      } else if (existResult.result()) {
        fileSystem.delete(uploadedFileName,deleteResult -> {
          if (deleteResult.Failed()) {
            LOGGER.warn("Delete of uploaded file Failed: " + uploadedFileName,deleteResult.cause());
          }
        });
      }
    });
  }
}
项目:vertx-fastdfs-client    文件:FdfsstorageImpl.java   
public static Future<LocalFile> readFile(FileSystem fs,String filefullPathName) {
    LocalFile localFile = new LocalFile();

    return Future.<FileProps>future(future -> {
        fs.props(filefullPathName,future);
    }).compose(props -> {
        localFile.setSize(props.size());

        return Future.<AsyncFile>future(future -> {
            fs.open(filefullPathName,new Openoptions().setRead(true).setWrite(false).setCreate(false),future);
        });
    }).compose(fileStream -> {

        localFile.setFile(fileStream);

        return Future.succeededFuture(localFile);
    });
}
项目:chlorophytum-semantics    文件:DictionaryCache.java   
public void initCache() {

        if(!initialized.getAndSet(true)) {
            logger.info("init cache");

            FileSystem fileSystem = vertx.fileSystem();

            String target = TARGET_DIR + TARGET_FILE;

            fileSystem.exists(target,result -> {
                if (!result.result()) {
                    logger.info("downloading wordnet dictionary...");
                    downloadService.download(target).compose(e -> {
                        compressionService.uncompress(target);
                        loadDictionary();
                    },Future.future());
                } else {
                    logger.info("wordnet dictionary found.");
                    loadDictionary();
                }
            });;
        }

    }
项目:swaggy-jenkins    文件:MainApiVerticle.java   
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("swagger.json",readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx),swagger,vertx.eventBus(),new OperationIdServiceIdResolver());

            deployVerticles(startFuture);

            vertx.createHttpServer() 
                .requestHandler(swaggerRouter::accept) 
                .listen(8080);
            startFuture.complete();
        } else {
            startFuture.fail(readFile.cause());
        }
    });                     
}
项目:chili-core    文件:PatchHandlerTest.java   
@BeforeClass
public static void startUp() {
    system = new SystemContext();

    PatchContext context = new PatchContext(system) {
        @Override
        public String directory() {
            return testDirectory();
        }

        @Override
        public FileSystem fileSystem() {
            return new FileSystemMock(vertx);
        }
    };

    handler = new PatchHandler(context);
}
项目:vertx-pairtree    文件:FsPairtreeObject.java   
/**
 * Creates a file system backed Pairtree object.
 *
 * @param aFileSystem A file system
 * @param aPairtree The object's Pairtree
 * @param aID The object's ID
 */
public FsPairtreeObject(final FileSystem aFileSystem,final FsPairtree aPairtree,final String aID) {
    super(Constants.BUNDLE_NAME);

    Objects.requireNonNull(aFileSystem);
    Objects.requireNonNull(aPairtree);
    Objects.requireNonNull(aID);

    myPairtreePath = aPairtree.toString();
    myPrefix = aPairtree.getPrefix();
    myFileSystem = aFileSystem;

    if (myPrefix == null) {
        myID = aID;
    } else {
        myID = PairtreeUtils.removePrefix(myPrefix,aID);
    }
}
项目:vertx-swagger    文件:BasicAuthTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",true,vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });
}
项目:vertx-swagger    文件:ChainingAuthTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });
}
项目:vertx-swagger    文件:ApiKeyAuthTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });
}
项目:vertx-swagger    文件:ErrorHandlingTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });
}
项目:vertx-swagger    文件:HeaderParameterExtractorTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });

}
项目:vertx-swagger    文件:BodyParameterExtractorTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });

}
项目:vertx-swagger    文件:PathParameterExtractorTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });

}
项目:vertx-swagger    文件:QueryParameterExtractorTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });

}
项目:vertx-swagger    文件:FormParameterExtractorTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive("file-uploads",deletedDir -> {
                if (deletedDir.succeeded()) {
                    vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                        if (vertxDir.succeeded()) {
                            after.complete();
                        } else {
                            context.fail(vertxDir.cause());
                        }
                    });
                } else {
                    context.fail(deletedDir.cause());
                }
            });
        }
    });

}
项目:vertx-swagger    文件:buildrouterTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    httpServer.close(completionHandler -> {
        if (completionHandler.succeeded()) {
            FileSystem vertxFileSystem = vertx.fileSystem();
            vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
                if (vertxDir.succeeded()) {
                    after.complete();
                } else {
                    context.fail(vertxDir.cause());
                }
            });
        }
    });

}
项目:vertx-swagger    文件:MainApiVerticle.java   
@Override
public void start(Future<Void> startFuture) throws Exception {
    Json.mapper.registerModule(new JavaTimeModule());
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile("swagger.json",readFile -> {
        if (readFile.succeeded()) {
            Swagger swagger = new SwaggerParser().parse(readFile.result().toString(Charset.forName("utf-8")));
            SwaggerManager.getInstance().setSwagger(swagger);
            Router swaggerRouter = SwaggerRouter.swaggerRouter(Router.router(vertx),new OperationIdServiceIdResolver());

            deployVerticles(startFuture);

            vertx.createHttpServer() 
                .requestHandler(swaggerRouter::accept) 
                .listen(config().getInteger("http.port",8080));
            startFuture.complete();
        } else {
            startFuture.fail(readFile.cause());
        }
    });                     
}
项目:hono    文件:FileBasedRegistrationServiceTest.java   
/**
 * Sets up the fixture.
 */
@Before
public void setUp() {
   fileSystem = mock(FileSystem.class);
   Context ctx = mock(Context.class);
   eventBus = mock(EventBus.class);
   vertx = mock(Vertx.class);
   when(vertx.eventBus()).thenReturn(eventBus);
   when(vertx.fileSystem()).thenReturn(fileSystem);

   props = new FileBasedRegistrationConfigProperties();
   props.setFilename(FILE_NAME);
   registrationService = new FileBasedRegistrationService();
   registrationService.setConfig(props);
   registrationService.init(vertx,ctx);
}
项目:df    文件:StreamingClient.java   
public void handshake(HttpClient hc,FileSystem fs) {

        HttpClientRequest request = hc.put(AgentConstant.SERVER_PORT,AgentConstant.SERVER_ADDR,"",resp -> {
            System.out.println("Response: Hand Shake Status Code - " + resp.statusCode());
            System.out.println("Response: Hand Shake Status Message - " + resp.statusMessage());
            if (resp.statusCode() == AgentConstant.RES_SUCCESS) {
                System.out.println("Response: Hand Shake Status - SUCCESSFUL!");

                //check if it is file/folder processing
                if(Files.isDirectory(Paths.get(AgentConstant.FILE_NAME))) {
                    streamFilesDir(hc,fs);
                } else streamFile(hc,fs);
            }
            else System.out.println("Response: Hand Shake Status - Failed!");
        });
        request.headers().add("DF_PROTOCOL","REGISTER");
        request.headers().add("DF_MODE",AgentConstant.TRANS_MODE);
        request.headers().add("DF_TYPE","Meta");
        request.headers().add("DF_TOPIC",AgentConstant.Meta_TOPIC);
        request.headers().add("DF_FILENAME",AgentConstant.FILE_NAME);
        request.headers().add("DF_FILTER",AgentConstant.FILTER_TYPE);
        request.headers().add("DF_DATA_TRANS",AgentConstant.DATA_TRANS);

        request.end(setMetaData(AgentConstant.FILE_NAME));
    }
项目:vertx-shell    文件:FsHelper.java   
void ls(Vertx vertx,String currentFile,String pathArg,Handler<AsyncResult<Map<String,FileProps>>> filesHandler) {
  Path base = currentFile != null ? new File(currentFile).toPath() : rootDir;
  String path = base.resolve(pathArg).toAbsolutePath().normalize().toString();
  vertx.executeBlocking(fut -> {
    FileSystem fs = vertx.fileSystem();
    if (fs.propsBlocking(path).isDirectory()) {
      LinkedHashMap<String,FileProps> result = new LinkedHashMap<>();
      for (String file : fs.readDirBlocking(path)) {
        result.put(file,fs.propsBlocking(file));
      }
      fut.complete(result);
    } else {
      throw new RuntimeException(path + ": No such file or directory");
    }
  },filesHandler);
}
项目:vertx-unit    文件:ReportingTest.java   
@org.junit.Test
public void testReportToFile() {
  FileSystem fs = vertx.fileSystem();
  String file = "target";
  assertTrue(fs.existsBlocking(file));
  assertTrue(fs.propsBlocking(file).isDirectory());
  suite.run(vertx,new TestOptions().addReporter(new ReportOptions().setTo("file:" + file)));
  String path = file + File.separator + "my_suite.txt";
  assertTrue(fs.existsBlocking(path));
  int count = 1000;
  while (true) {
    FileProps props = fs.propsBlocking(path);
    if (props.isRegularFile() && props.size() > 0) {
      break;
    } else {
      if (count-- > 0) {
        try {
          Thread.sleep(1);
        } catch (InterruptedException ignore) {
        }
      } else {
        fail();
      }
    }
  }
}
项目:vertx-web    文件:WebClientExamples.java   
public void sendStream(WebClient client,FileSystem fs) {
  fs.open("content.txt",new Openoptions(),fileRes -> {
    if (fileRes.succeeded()) {
      ReadStream<Buffer> fileStream = fileRes.result();

      String fileLen = "1024";

      // Send the file to the server using POST
      client
        .post(8080,"myserver.mycompany.com","/some-uri")
        .putHeader("content-length",fileLen)
        .sendStream(fileStream,ar -> {
          if (ar.succeeded()) {
            // Ok
          }
        });
    }
  });
}
项目:vertx-web    文件:BodyHandlerImpl.java   
private void deleteFileUploads() {
  if (cleanup.compareAndSet(false,true)) {
    for (FileUpload fileUpload : context.fileUploads()) {
      FileSystem fileSystem = context.vertx().fileSystem();
      String uploadedFileName = fileUpload.uploadedFileName();
      fileSystem.exists(uploadedFileName,existResult -> {
        if (existResult.Failed()) {
          log.warn("Could not detect if uploaded file exists,existResult.cause());
        } else if (existResult.result()) {
          fileSystem.delete(uploadedFileName,deleteResult -> {
            if (deleteResult.Failed()) {
              log.warn("Delete of uploaded file Failed: " + uploadedFileName,deleteResult.cause());
            }
          });
        }
      });
    }
  }
}
项目:incubator-servicecomb-java-chassis    文件:RestBodyHandler.java   
private void makeUploadDir(FileSystem fileSystem) {
  // *** cse begin ***
  if (uploadsDir == null) {
    return;
  }
  // *** cse end ***

  if (!fileSystem.existsBlocking(uploadsDir)) {
    fileSystem.mkdirsBlocking(uploadsDir);
  }
}
项目:vertx-sfdc-platformevents    文件:RestConsumer.java   
/**
 * @return a Mustache template compiled
 */
private Mustache getMustache() {
    if (this.mustache == null) {
        final FileSystem fs = this.getVertx().fileSystem();
        final Buffer templateBuffer = fs.readFileBlocking(this.getTemplateName());
        final MustacheFactory mf = new DefaultMustacheFactory();
        final ByteArrayInputStream bi = new ByteArrayInputStream(templateBuffer.getBytes());
        this.mustache = mf.compile(new InputStreamReader(bi),"Transform");
    }
    return this.mustache;
}
项目:vertx-sfdc-platformevents    文件:JsonExperiments.java   
private Mustache getTemplate() {
    final Vertx vertx = Vertx.vertx();
    final FileSystem fs = vertx.fileSystem();
    final Buffer b = fs.readFileBlocking("sample.mustache");
    final MustacheFactory mf = new DefaultMustacheFactory();
    final ByteArrayInputStream bi = new ByteArrayInputStream(b.getBytes());
    final Mustache mustache = mf.compile(new InputStreamReader(bi),"Test");
    return mustache;
}
项目:vertx-swagger    文件:FormParameterExtractorTest.java   
@test()
public void testOkFormDataSimpleFile(TestContext context) {
    Async async = context.async();
    HttpClientRequest req = httpClient.post(TEST_PORT,TEST_HOST,"/formdata/simple/file");
    req.handler(response -> {
        response.bodyHandler(body -> {
            context.assertEquals(response.statusCode(),200);
            context.assertEquals("{\"test\":\"This is a test file.\"}",body.toString());
            async.complete();
        });
    });
    // Construct multipart data
    req.putHeader(HttpHeaders.CONTENT_TYPE,"multipart/form-data; boundary=MyBoundary");
    Buffer buffer = Buffer.factory.buffer();
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.readFile(TEST_FILENAME,readFile -> {
        if (readFile.succeeded()) {
            buffer.appendString("\r\n");
            buffer.appendString("--MyBoundary\r\n");
            buffer.appendString("Content-disposition: form-data; name=\"formDatarequired\"; filename=\"" + TEST_FILENAME + "\"\r\n");
            buffer.appendString("Content-Type: text/plain\r\n");
            buffer.appendString("\r\n");
            buffer.appendString(readFile.result().toString(Charset.forName("utf-8")));
            buffer.appendString("\r\n");
            buffer.appendString("--MyBoundary--");
            req.end(buffer);
        } else {
            context.fail(readFile.cause());
        }
    });
}
项目:vertx-swagger    文件:RxPetStoreTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
        if (vertxDir.succeeded()) {
            after.complete();
        } else {
            context.fail(vertxDir.cause());
        }
    });
}
项目:vertx-swagger    文件:JsonRxPetStoreTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
        if (vertxDir.succeeded()) {
            after.complete();
        } else {
            context.fail(vertxDir.cause());
        }
    });
}
项目:vertx-swagger    文件:PetStoreTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
        if (vertxDir.succeeded()) {
            after.complete();
        } else {
            context.fail(vertxDir.cause());
        }
    });
}
项目:vertx-swagger    文件:JsonPetStoreTest.java   
@AfterClass
public static void afterClass(TestContext context) {
    Async after = context.async();
    FileSystem vertxFileSystem = vertx.fileSystem();
    vertxFileSystem.deleteRecursive(".vertx",vertxDir -> {
        if (vertxDir.succeeded()) {
            after.complete();
        } else {
            context.fail(vertxDir.cause());
        }
    });
}
项目:hono    文件:FileBasedCredentialsServiceTest.java   
/**
 * Sets up fixture.
 */
@Before
public void setUp() {
    fileSystem = mock(FileSystem.class);
    Context ctx = mock(Context.class);
    eventBus = mock(EventBus.class);
    vertx = mock(Vertx.class);
    when(vertx.eventBus()).thenReturn(eventBus);
    when(vertx.fileSystem()).thenReturn(fileSystem);

    props = new FileBasedCredentialsConfigProperties();
    svc = new FileBasedCredentialsService();
    svc.setConfig(props);
    svc.init(vertx,ctx);
}
项目:vertxui    文件:figWheelyServer.java   
private void getContent(FileSystem fileSystem,String path,StringBuilder result) {
    fileSystem.readDirBlocking(path).forEach(file -> {
        File jfile = new File(file);
        if (jfile.isDirectory()) {
            getContent(fileSystem,jfile.getAbsolutePath(),result);
        } else {
            result.append(jfile.getAbsolutePath());
            result.append(jfile.lastModified());
        }
    });
}
项目:vertxui    文件:figWheelyServer.java   
private static void addFromStaticHandler(FileSystem fileSystem,String sourcePath,String url,String rootroot) {
    fileSystem.readDir(sourcePath,files -> {
        if (files.result() == null) {
            return;
        }
        for (String item : files.result()) {
            File file = new File(item);
            if (file.isFile()) {
                watchables.add(new Watchable(url + file.getName(),item));
            } else {
                addFromStaticHandler(fileSystem,item,url + file.getName() + "/",rootroot);
            }
        }
    });
}
项目:georocket    文件:FileStore.java   
@Override
public void getone(String path,Handler<AsyncResult<ChunkReadStream>> handler) {
  String absolutePath = Paths.get(root,path).toString();

  // check if chunk exists
  FileSystem fs = vertx.fileSystem();
  ObservableFuture<Boolean> observable = RxHelper.observableFuture();
  fs.exists(absolutePath,observable.toHandler());
  observable
    .flatMap(exists -> {
      if (!exists) {
        return Observable.error(new FileNotFoundException("Could not find chunk: " + path));
      }
      return Observable.just(exists);
    })
    .flatMap(exists -> {
      // get chunk's size
      ObservableFuture<FileProps> propsObservable = RxHelper.observableFuture();
      fs.props(absolutePath,propsObservable.toHandler());
      return propsObservable;
    })
    .map(props -> props.size())
    .flatMap(size -> {
      // open chunk
      ObservableFuture<AsyncFile> openObservable = RxHelper.observableFuture();
      Openoptions openoptions = new Openoptions().setCreate(false).setWrite(false);
      fs.open(absolutePath,openoptions,openObservable.toHandler());
      return openObservable.map(f -> new FileChunkReadStream(size,f));
    })
    .subscribe(readStream -> {
      // send chunk to peer
      handler.handle(Future.succeededFuture(readStream));
    },err -> {
      handler.handle(Future.FailedFuture(err));
    });
}
项目:georocket    文件:FileStore.java   
@Override
protected void doDeleteChunks(Queue<String> paths,Handler<AsyncResult<Void>> handler) {
  if (paths.isEmpty()) {
    handler.handle(Future.succeededFuture());
    return;
  }

  String path = paths.poll();
  FileSystem fs = vertx.fileSystem();
  String absolutePath = Paths.get(root,path).toString();

  fs.exists(absolutePath,existAr -> {
    if (existAr.Failed()) {
      handler.handle(Future.FailedFuture(existAr.cause()));
    } else {
      if (existAr.result()) {
        fs.delete(absolutePath,deleteAr -> {
          if (deleteAr.Failed()) {
            handler.handle(Future.FailedFuture(deleteAr.cause()));
          } else {
            doDeleteChunks(paths,handler);
          }
        });
      } else {
        doDeleteChunks(paths,handler);
      }
    }
  });

}
项目:vertx-jspare    文件:EnvironmentLoader.java   
public void bindInterfaces(Vertx vertx){
  Environment.registry(Bind.bind(Vertx.class),vertx);
  Environment.registry(Bind.bind(Context.class),vertx.getorCreateContext());
  Environment.registry(Bind.bind(EventBus.class),vertx.eventBus());
  Environment.registry(Bind.bind(FileSystem.class),vertx.fileSystem());
  Environment.registry(Bind.bind(SharedData.class),vertx.sharedData());
}

关于javax.swing.filechooser.FileSystemView的实例源码java file源码的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于com.intellij.util.io.TestFileSystemBuilder的实例源码、com.intellij.util.io.TestFileSystemItem的实例源码、io.vertx.core.file.FileSystemException的实例源码、io.vertx.core.file.FileSystem的实例源码等相关知识的信息别忘了在本站进行查找喔。

本文标签: