Package xplanetconfigurator.util

Examples of xplanetconfigurator.util.XPlanetRessourceFinder


                        System.out.println();
                        System.out.println("Please report bugs and comments to tom@jfellow.net.");
                        System.out.println("For more help on XPlanet refer to http://xplanet.sourceforge.net/");
                        System.exit(0);
                    } else if (arg.toLowerCase().startsWith("-nogui") || arg.toLowerCase().startsWith("-n")) {
                        XPlanetRessourceFinder f = new XPlanetRessourceFinder();
                        String dirOnDisc = f.getRessourceDirectory("downloader");
                        String fileOnDisc = dirOnDisc + File.separator + MainFrame.FILE_NAME_DOWNLOADER_CONFIG;
                        DownloadTimer timer = new DownloadTimer(fileOnDisc);
                        timer.run();
                    } else {
                        System.err.println("Found no valid parameter");
View Full Code Here


        String[] splittees = remoteFile.split("/");
        int length = splittees.length;
        String filename = splittees[length - 1];
        this.logger.finer("Found the file name: " + filename + " in the URL: " + sUrl);
        String localDirectoryRelativ = downloadFile.getLocalDirectoryRelativ();
        XPlanetRessourceFinder rf = new XPlanetRessourceFinder();
        String downloaderRootDir = rf.getRootDirectoryForDownloads();
        String localDirectoryAbsolute = downloaderRootDir + File.separator + localDirectoryRelativ;
        File dir = new File(localDirectoryAbsolute);
        if (!dir.exists()) {
            this.logger.warning("Making a directory '" + localDirectoryAbsolute + "' to download because it does not exist...");
            LoggingBoard.logDownloaderMessage("Making a directory '" + localDirectoryAbsolute + "' to download because it does not exist...");
View Full Code Here

            String url = m.group(2);
            // URLs allways have forward slashes
            splittees = url.split("/");
            int length = splittees.length;
            String filename = splittees[length - 1];
            XPlanetRessourceFinder rf = new XPlanetRessourceFinder();
            String downloaderRootDir = rf.getRootDirectoryForDownloads();
            String path = downloaderRootDir + File.separator + localDir + File.separator + filename;
            File localFile = new File(path);
            if (localFile.exists()) {
                downloadFile.setLocalStatus("<html><font color='green'>Found</font></html>");
                return true;
View Full Code Here

        this.removeConfig();
    }//GEN-LAST:event_jButtonRemoveActionPerformed

    private void jTextFieldParameterSearchDirCaretUpdate(javax.swing.event.CaretEvent evt) {//GEN-FIRST:event_jTextFieldParameterSearchDirCaretUpdate
        if (this.jTextFieldParameterSearchDir.hasFocus()) {
            XPlanetRessourceFinder finder = new XPlanetRessourceFinder();
            String searchDir = this.jTextFieldParameterSearchDir.getText();
            if (searchDir.contains("\\")) {
                JOptionPane.showMessageDialog(this, "'\\' not allowed.", "XPlanet - Error", JOptionPane.ERROR_MESSAGE);
                return;
            }
            finder.setXPlanetSearchDir(searchDir);
            this.sendParameter(this.jTextFieldParameterSearchDir, "-searchdir", "(?i)(-searchdir\\b)(\\s*)([^-]*)");
        }

}//GEN-LAST:event_jTextFieldParameterSearchDirCaretUpdate
View Full Code Here

        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fc.getSelectedFile();
            String dir = file.getAbsolutePath();
            dir = dir.replaceAll("\\\\", "/");
            this.jTextFieldParameterSearchDir.setText(dir);
            XPlanetRessourceFinder rf = new XPlanetRessourceFinder();
            rf.setXPlanetSearchDir(dir);
        }
}//GEN-LAST:event_jButtonChooseSearchDirActionPerformed
View Full Code Here

            // Never read the -searchdir from file.
            // regExpr = "(?i)(-searchdir\\b)(\\s*)([^-]*)";
            // this.receiveParameter(parameters, regExpr, this.jTextFieldParameterSearchDir);

            // XPlanetRessourceFinder is allways used to get -searchdir
            XPlanetRessourceFinder finder = new XPlanetRessourceFinder();
            String searchdir = finder.getXPlanetSearchDir();
            this.jTextFieldParameterSearchDir.setText(searchdir);

            Pattern p = Pattern.compile("(?i)(-config\\b)(\\s*)([^-]*)");
            Matcher matcher = p.matcher(parameters);
            matcher.find();
View Full Code Here

        // Store the selected item
        String selectedItem = (String) this.jComboBoxConfigNames.getSelectedItem();
        this.blockSelection = true;
        this.jComboBoxConfigNames.removeAllItems();

        XPlanetRessourceFinder rf = new XPlanetRessourceFinder();
        String confDir = rf.getRessourceDirectory("config");
        File dir = new File(confDir);
        if (dir.exists()) {
            File[] files = dir.listFiles();
            int length = files.length;
            for (int i = 0; i < length; i++) {
View Full Code Here

    private void removeConfig() {
        String name = (String) this.jComboBoxConfigNames.getSelectedItem();
        this.jComboBoxConfigNames.removeAllItems();
        // Delete the config file
        XPlanetRessourceFinder rf = new XPlanetRessourceFinder();
        String pathXPlanet = rf.getRootDirectoryForDownloads();
        // Delete command file
        // At the moment windows is supported only
        String fileExtension = "cmd";
        File commandFile = new File(pathXPlanet + File.separator + name + "." + fileExtension);
        boolean deleted = commandFile.delete();
        if (!deleted) {
            this.logger.fine("Failed to delete file: " + commandFile);
        } else {
            this.logger.fine("Deleted config file: " + commandFile);
        }
        // Delete config file
        String configDir = rf.getRessourceDirectory("config");
        File f = new File(configDir + File.separator + name);
        boolean b = f.delete();
        if (!b) {
            this.logger.fine("Failed to delete file: " + f);
        } else {
View Full Code Here

TOP

Related Classes of xplanetconfigurator.util.XPlanetRessourceFinder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.