コード例 #1
1
  public void bootOptionsReceived(BootEvent bootEvent) {
    log.info(" boot options received " + bootEvent.getNewSessionOptions());

    // reload setting, to ensure correct bootstraps
    ConfigureFactory.getInstance().reloadSettings();

    // If the options are not equal to the string 'null' then we have boot options
    if (!bootEvent.getNewSessionOptions().equals("null")) {
      // check if a session parameter is specified on the command line
      String[] args = new String[TN5250jConstants.NUM_PARMS];
      parseArgs(bootEvent.getNewSessionOptions(), args);

      if (isSpecified("-s", args)) {

        String sd = getParm("-s", args);
        if (sessions.containsKey(sd)) {
          parseArgs(sessions.getProperty(sd), args);
          final String[] args2 = args;
          final String sd2 = sd;
          SwingUtilities.invokeLater(() -> newSession(sd2, args2));
        }
      } else {

        if (args[0].startsWith("-")) {
          SwingUtilities.invokeLater(() -> startNewSession());
        } else {
          final String[] args2 = args;
          final String sd2 = args[0];
          SwingUtilities.invokeLater(() -> newSession(sd2, args2));
        }
      }
    } else {
      SwingUtilities.invokeLater(() -> startNewSession());
    }
  }
コード例 #2
0
ファイル: MiscUtilities.java プロジェクト: zukov/Jpicedt
  /** store the given RenderingHints to a Properties object */
  public static void formatRenderingHints(RenderingHints rh, Properties preferences) {

    if (rh.get(RenderingHints.KEY_ANTIALIASING).equals(RenderingHints.VALUE_ANTIALIAS_ON))
      preferences.put("rendering.antialiasing", "on");
    else if (rh.get(RenderingHints.KEY_ANTIALIASING).equals(RenderingHints.VALUE_ANTIALIAS_OFF))
      preferences.put("rendering.antialiasing", "off");

    if (rh.get(RenderingHints.KEY_TEXT_ANTIALIASING).equals(RenderingHints.VALUE_TEXT_ANTIALIAS_ON))
      preferences.put("rendering.text-antialiasing", "on");
    else if (rh.get(RenderingHints.KEY_TEXT_ANTIALIASING)
        .equals(RenderingHints.VALUE_TEXT_ANTIALIAS_OFF))
      preferences.put("rendering.text-antialiasing", "off");

    if (rh.get(RenderingHints.KEY_RENDERING).equals(RenderingHints.VALUE_RENDER_SPEED))
      preferences.put("rendering.render", "speed");
    else if (rh.get(RenderingHints.KEY_RENDERING).equals(RenderingHints.VALUE_RENDER_QUALITY))
      preferences.put("rendering.render", "quality");

    if (rh.get(RenderingHints.KEY_DITHERING).equals(RenderingHints.VALUE_DITHER_ENABLE))
      preferences.put("rendering.dither", "on");
    else if (rh.get(RenderingHints.KEY_DITHERING).equals(RenderingHints.VALUE_DITHER_DISABLE))
      preferences.put("rendering.dither", "off");

    if (rh.get(RenderingHints.KEY_FRACTIONALMETRICS)
        .equals(RenderingHints.VALUE_FRACTIONALMETRICS_ON))
      preferences.put("rendering.fractional-metrics", "on");
    else if (rh.get(RenderingHints.KEY_FRACTIONALMETRICS)
        .equals(RenderingHints.VALUE_FRACTIONALMETRICS_OFF))
      preferences.put("rendering.fractional-metrics", "off");
  }
コード例 #3
0
 private XmlUIElement getXmlUIElementFor(String typeArg) {
   if (typeToClassMappingProp == null) {
     setUpMappingsHM();
   }
   String clsName = (String) typeToClassMappingProp.get(typeArg);
   if ((clsName != null) && !(clsName.equals("*NOTFOUND*")) && !(clsName.equals("*EXCEPTION*"))) {
     try {
       Class cls = Class.forName(clsName);
       return (XmlUIElement) cls.newInstance();
     } catch (Throwable th) {
       typeToClassMappingProp.put(typeArg, "*EXCEPTION*");
       showErrorMessage(
           MessageFormat.format(
               ProvClientUtils.getString(
                   "{0} occurred when trying to get the XmlUIElement for type : {1}"),
               new Object[] {th.getClass().getName(), typeArg}));
       th.printStackTrace();
       return null;
     }
   } else if (clsName == null) {
     typeToClassMappingProp.put(typeArg, "*NOTFOUND*");
     showErrorMessage(
         MessageFormat.format(
             ProvClientUtils.getString(
                 "The type {0} does not have the corresponding XMLUIElement specified in the TypeToUIElementMapping.txt file"),
             new Object[] {typeArg}));
   }
   return null;
 }
コード例 #4
0
 public void actionPerformed(java.awt.event.ActionEvent arg0) {
   JPanel4.showCard("router"); // No Internationalisation
   Properties prop = (Properties) routerobject.elementAt(0);
   ((com.adventnet.nms.examples.routermap.RouterDetails) JPanel4.getCard("router"))
       .setValues((Properties) routerobject.elementAt(0)); // No Internationalisation
   JLabel1.setText(
       NmsClientUtil.GetString("Router details  :  ")
           + prop.getProperty("name")); // No Internationalisation
 }
コード例 #5
0
 public Properties getUserInputValues() {
   Properties prop = new Properties();
   for (int i = 0; i < uiList.size(); i++) {
     UserInput ui = (UserInput) uiList.get(i);
     XmlUIElement el = (XmlUIElement) uiElementsList.get(i);
     ui.setValue(el.getValue());
     prop.put("$UserInput$" + ui.getID(), el.getValue());
   }
   return prop;
 }
コード例 #6
0
ファイル: FlowQuad.java プロジェクト: schambersnh/school
  // -------------------------------- main -------------------------------
  public static void main(String[] args) {
    String fileName;
    if (args.length > 0) fileName = args[0];
    else fileName = Utils.getFileName("Choose a flow field metadata file");
    Properties metaData = new Properties();
    try {
      metaData.load(new FileInputStream(fileName));
    } catch (IOException fnf) {
      System.err.println("Can't find file: " + fileName);
      System.exit(-1);
    }
    // ----- get all the properties from the prpoerty file and
    //
    VectorField.xData = new File(metaData.getProperty("xfile"));
    VectorField.yData = new File(metaData.getProperty("yfile"));
    VectorField.width = Utils.toInt(metaData.getProperty("xsize"), 128);
    VectorField.height = Utils.toInt(metaData.getProperty("ysize"), 128);
    VectorField.displayScale = Utils.toInt(metaData.getProperty("displayScale"), 6);
    VectorField.vectorScale = Utils.toDouble(metaData.getProperty("vectorScale"), 10.75);

    VectorField.numParticles = Utils.toInt(metaData.getProperty("numParticles"), 200);
    VectorField.timerDelay = Utils.toInt(metaData.getProperty("delay"), 30);

    FlowQuad vectorField = new FlowQuad("Static Vector Field");
  }
コード例 #7
0
  public Properties getProperties() {
    Properties prop = new Properties();
    String name = saName.getText();
    String interval = saInt.getText();
    boolean opt = saYes.isSelected();

    prop.put("name", name);
    prop.put("suppressInt", interval);
    prop.put("suppressAll", opt + "");

    return prop;
  }
コード例 #8
0
ファイル: proses_Login.java プロジェクト: muhlik/overtimeapps
 public void koneksiDatabase() {
   try {
     String url = "jdbc:mysql://localhost:3306/payroll_db";
     Properties prop = new Properties();
     prop.put("user", "root");
     prop.put("password", "admin");
     konek = DriverManager.getConnection(url, prop);
     status_Proses(true, "Sukses!!!Berhasil Terhubung dengan Database...", 20);
   } catch (SQLException se) {
     status_Proses(false, "Gagal!!!Tidak terhubung \nKarena : " + se, 20);
   }
 }
コード例 #9
0
  private void setupHomeDir(String homeString) {
    if (homeString == null) {
      homeString = sysProps.getProperty("swingri.home");
    }

    if (homeString != null) {
      dataDir = new File(homeString);
    } else {
      userHome = new File(sysProps.getProperty("user.home"));
      String dataDirStr = props.getString("application.datadir", DEFAULT_HOME_DIR);
      dataDir = new File(userHome, dataDirStr);
    }

    if (!dataDir.isDirectory()) {
      String path = dataDir.getAbsolutePath();
      boolean create;
      if (props.hasUserRejectedCreatingLocalDataDir()) {
        create = false;
      } else if (getBoolean("application.showLocalStorageDialogs", true)) {
        create =
            Resources.showConfirmDialog(
                null,
                messageBundle,
                "fontManager.properties.title",
                "manager.properties.createNewDirectory",
                path);
        if (!create) props.setUserRejectedCreatingLocalDataDir();
      } else {
        // Always create local-storage directory if show user prompt dialog setting is false.
        create = true;
      }

      if (!create) {
        dataDir = null;
      } else {
        dataDir.mkdirs();
        if (!dataDir.isDirectory()) {
          // check to make sure that dialog should be shown on the error.
          if (getBoolean("application.showLocalStorageDialogs", true)) {
            Resources.showMessageDialog(
                null,
                JOptionPane.ERROR_MESSAGE,
                messageBundle,
                "fontManager.properties.title",
                "manager.properties.failedCreation",
                dataDir.getAbsolutePath());
          }
          dataDir = null;
        }
      }
    }
  }
コード例 #10
0
ファイル: MainWindow.java プロジェクト: hkaiser/TRiAS
 // reads the configuration (breakpoints, window sizes and positions...) for the current index
 private void restoreConfig() {
   Breakpoints.reset();
   Properties.reset();
   try {
     ObjectInputStream in = new ObjectInputStream(new FileInputStream(idxName + ".config"));
     Breakpoints.restore(in);
     Properties.restore(in);
     in.close();
   } catch (IOException exc) {
     // something went wrong - there probably was no .config file
     // ignore it
   }
 }
コード例 #11
0
ファイル: QueryDB.java プロジェクト: chenyuguxing/utils
  /** 利用属性文件中的信息连接数据库 * */
  public static Connection getConnection() throws SQLException, IOException {
    Properties props = new Properties();
    String fileName = "QueryDB.properties";
    FileInputStream in = new FileInputStream(fileName);
    props.load(in);

    String drivers = props.getProperty("jdbc.drivers");
    if (drivers != null) System.setProperty("jdbc.drivers", drivers);
    String url = props.getProperty("jdbc.url");
    String username = props.getProperty("jdbc.username");
    String password = props.getProperty("jdbc.password");

    return DriverManager.getConnection(url, username, password);
  }
コード例 #12
0
 public Properties getPropertiesValue() {
   Properties props = new Properties();
   for (int i = 0; i < propKeyList.size(); i++) {
     String propName = (String) propKeyList.get(i);
     // Since $Template$Params is being appended (before replacement)in the server side latest code
     // it is removed here using substring(15).
     // If not removed, this results in $Template$Params$Template$ParamsSource as the key to be
     // replaced by the user specified value.
     // Check to be introduced in server side.
     // propName = propName.trim().substring(15);
     XmlUIElement el = (XmlUIElement) propValueList.get(i);
     props.put(propName, el.getValue());
   }
   return props;
 }
コード例 #13
0
ファイル: Installer.java プロジェクト: suever/CTP
  private void updateLinuxServiceInstaller() {
    try {
      File dir = new File(directory, "CTP");
      if (suppressFirstPathElement) dir = dir.getParentFile();
      Properties props = new Properties();
      String ctpHome = dir.getAbsolutePath();
      cp.appendln(Color.black, "...CTP_HOME: " + ctpHome);
      ctpHome = ctpHome.replaceAll("\\\\", "\\\\\\\\");
      props.put("CTP_HOME", ctpHome);
      File javaHome = new File(System.getProperty("java.home"));
      String javaBin = (new File(javaHome, "bin")).getAbsolutePath();
      cp.appendln(Color.black, "...JAVA_BIN: " + javaBin);
      javaBin = javaBin.replaceAll("\\\\", "\\\\\\\\");
      props.put("JAVA_BIN", javaBin);

      File linux = new File(dir, "linux");
      File install = new File(linux, "ctpService-ubuntu.sh");
      cp.appendln(Color.black, "Linux service installer:");
      cp.appendln(Color.black, "...file: " + install.getAbsolutePath());
      String bat = getFileText(install);
      bat = replace(bat, props); // do the substitutions
      bat = bat.replace("\r", "");
      setFileText(install, bat);

      // If this is an ISN installation, put the script in the correct place.
      String osName = System.getProperty("os.name").toLowerCase();
      if (programName.equals("ISN") && !osName.contains("windows")) {
        install = new File(linux, "ctpService-red.sh");
        cp.appendln(Color.black, "ISN service installer:");
        cp.appendln(Color.black, "...file: " + install.getAbsolutePath());
        bat = getFileText(install);
        bat = replace(bat, props); // do the substitutions
        bat = bat.replace("\r", "");
        File initDir = new File("/etc/init.d");
        File initFile = new File(initDir, "ctpService");
        if (initDir.exists()) {
          setOwnership(initDir, "edge", "edge");
          setFileText(initFile, bat);
          initFile.setReadable(true, false); // everybody can read //Java 1.6
          initFile.setWritable(true); // only the owner can write //Java 1.6
          initFile.setExecutable(true, false); // everybody can execute //Java 1.6
        }
      }
    } catch (Exception ex) {
      ex.printStackTrace();
      System.err.println("Unable to update the Linux service ctpService.sh file");
    }
  }
コード例 #14
0
ファイル: WordListScreen.java プロジェクト: blueocci/codes
 public void load(ActionEvent e) {
   int returnVal = fc.showOpenDialog(this);
   if (returnVal != JFileChooser.APPROVE_OPTION) {
     return;
   }
   file = fc.getSelectedFile();
   try {
     InputStream in = new BufferedInputStream(new FileInputStream(file));
     Properties newWl = new Properties();
     newWl.load(in);
     in.close();
     setWordList(newWl);
   } catch (IOException ex) {
     handleException(ex);
   }
 }
コード例 #15
0
 private static String getDefaultSession() {
   String defaultSession = sessions.getProperty("emul.default");
   if (defaultSession != null && !defaultSession.trim().isEmpty()) {
     return defaultSession;
   }
   return null;
 }
コード例 #16
0
 public synchronized void saveProperties() {
   if (ownLock()) {
     try {
       FileOutputStream out = new FileOutputStream(propertyFile);
       try {
         fontProps.store(out, "-- ICEpf Font properties --");
       } finally {
         out.close();
       }
       recordMofifTime();
     } catch (IOException ex) {
       // check to make sure the storage relate dialogs can be shown
       if (getBoolean("application.showLocalStorageDialogs", true)) {
         Resources.showMessageDialog(
             null,
             JOptionPane.ERROR_MESSAGE,
             messageBundle,
             "fontManager.properties.title",
             "manager.properties.saveError",
             ex);
       }
       // log the error
       if (logger.isLoggable(Level.WARNING)) {
         logger.log(Level.WARNING, "Error saving font properties cache", ex);
       }
     }
   }
 }
コード例 #17
0
 // 采用静态初始化块来初始化Connection、Statement对象
 static {
   try {
     Properties props = new Properties();
     props.load(new FileInputStream("mysql.ini"));
     String drivers = props.getProperty("driver");
     String url = props.getProperty("url");
     String username = props.getProperty("user");
     String password = props.getProperty("pass");
     // 加载数据库驱动
     Class.forName(drivers);
     // 取得数据库连接
     conn = DriverManager.getConnection(url, username, password);
     stmt = conn.createStatement();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
コード例 #18
0
 /**
  * Produces a ChartingPropertyInspector which tracks property number index from the given
  * properties list, stored in the provided parent frame, and applied in the given simulation. This
  * constructor will give the user a chance to cancel the construction, in which case
  * validInspector will be set to false, and generator may be set to null. In that case, assume
  * that the inspector will be deleted immediately after.
  */
 public ChartingPropertyInspector(
     Properties properties, int index, Frame parent, final GUIState simulation) {
   super(properties, index, parent, simulation);
   generator = chartToUse(properties.getName(index), parent, simulation);
   globalAttributes =
       findGlobalAttributes(); // so we share timer information.  If null, we're in trouble.
   validInspector = (generator != null);
 }
コード例 #19
0
  public SessionPanel startNewSession() {
    String sel = "";
    if (containsNotOnlyNullValues(sessionArgs) && !sessionArgs[0].startsWith("-")) {
      sel = sessionArgs[0];
    } else {
      sel = getDefaultSession();
    }

    Sessions sess = manager.getSessions();

    if (sel != null && sess.getCount() == 0 && sessions.containsKey(sel)) {
      sessionArgs = new String[TN5250jConstants.NUM_PARMS];
      parseArgs(sessions.getProperty(sel), sessionArgs);
    }

    return newSession(sel, sessionArgs);
  }
コード例 #20
0
  public void setProperties(String actionName) {
    saName.setEnabled(true);
    if (actionName == null) {
      saInt.setText(0 + "");
      saYes.setSelected(true);
      saInt.setEnabled(false);
      saNo.setSelected(false);
      saName.setText("");
      saName.setEnabled(true);
    } else if (NotifierList.notifiers.get(actionName) == null) {

      saInt.setText(0 + "");
      saYes.setSelected(true);
      saInt.setEnabled(false);
      saNo.setSelected(false);
      saName.setText("");
      saName.setEnabled(true);
    } else {

      FilterAction action = (FilterAction) NotifierList.notifiers.get(actionName);
      Properties prop = action.getProperties();

      String saint = prop.getProperty("suppressInt");
      if (saint == null) saint = "0";
      saInt.setText(saint);

      String name = prop.getProperty("name");
      if (name == null) name = "";
      saName.setText(name);

      saName.setEnabled(false);

      String opt = prop.getProperty("suppressAll");
      if (opt != null && opt.equals("true")) {
        saYes.setSelected(true);
        saInt.setEnabled(false);
        saNo.setSelected(false);
      } else {
        saYes.setSelected(false);
        saInt.setEnabled(true);
        saNo.setSelected(true);
      }
    }
  }
コード例 #21
0
  protected void closingDown(TerminalViewInterface view) {

    Sessions sess = manager.getSessions();

    if (log.isDebugEnabled()) {
      log.debug("number of active sessions is " + sess.getCount());
    }

    if (viewNamesForNextStartBuilder == null) {
      // preserve sessions for next boot
      viewNamesForNextStartBuilder = new StringBuilder();
    }
    while (view.getSessionViewCount() > 0) {
      SessionPanel sesspanel = view.getSessionAt(0);
      viewNamesForNextStartBuilder.append("-s ").append(sesspanel.getSessionName()).append(" ");
      closeSessionInternal(sesspanel);
    }

    sessions.setProperty(
        "emul.frame" + view.getFrameSequence(),
        view.getX() + "," + view.getY() + "," + view.getWidth() + "," + view.getHeight());

    frames.remove(view);
    view.dispose();

    log.debug("number of active sessions we have after shutting down " + sess.getCount());

    log.info("view settings " + viewNamesForNextStartBuilder);
    if (sess.getCount() == 0) {

      sessions.setProperty("emul.width", Integer.toString(view.getWidth()));
      sessions.setProperty("emul.height", Integer.toString(view.getHeight()));
      sessions.setProperty("emul.view", viewNamesForNextStartBuilder.toString());

      // save off the session settings before closing down
      ConfigureFactory.getInstance()
          .saveSettings(
              ConfigureFactory.SESSIONS, ConfigureFactory.SESSIONS, "------ Defaults --------");
      if (controller != null) {
        controller.interrupt();
      }
      System.exit(0);
    }
  }
コード例 #22
0
ファイル: MiscUtilities.java プロジェクト: zukov/Jpicedt
 /**
  * Return a integer parsed from the value associated with the given key, or "def" in key wasn't
  * found.
  */
 public static int parseProperty(Properties preferences, String key, int def) {
   String val = preferences.getProperty(key);
   if (val == null) return def;
   try {
     return Integer.parseInt(val);
   } catch (NumberFormatException nfe) {
     nfe.printStackTrace();
     return def;
   }
 }
コード例 #23
0
ファイル: MainWindow.java プロジェクト: hkaiser/TRiAS
 // saves the current configuration (breakpoints, window sizes and positions...)
 private void saveConfig() {
   try {
     ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(idxName + ".config"));
     Breakpoints.save(out);
     Properties.save(out);
     out.close();
   } catch (IOException exc) {
     consoleFrame.echoInfo("Could not save settings: " + exc);
   }
 }
コード例 #24
0
ファイル: Notepad.java プロジェクト: ArcherSys/ArcherSysRuby
 static {
   try {
     properties = new Properties();
     properties.load(Notepad.class.getResourceAsStream("resources/NotepadSystem.properties"));
     resources = ResourceBundle.getBundle("resources.Notepad", Locale.getDefault());
   } catch (MissingResourceException | IOException e) {
     System.err.println(
         "resources/Notepad.properties " + "or resources/NotepadSystem.properties not found");
     System.exit(1);
   }
 }
コード例 #25
0
ファイル: MiscUtilities.java プロジェクト: zukov/Jpicedt
  /** Returns a RenderingHints parsed from the given Properties */
  public static RenderingHints parseRenderingHints(Properties preferences) {

    RenderingHints rh = new RenderingHints(null);
    String str;
    str = preferences.getProperty("rendering.antialiasing");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF);
    }
    str = preferences.getProperty("rendering.text-antialiasing");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
    }
    str = preferences.getProperty("rendering.render");
    if (str != null) {
      if (str.equals("speed"))
        rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_SPEED);
      else if (str.equals("quality"))
        rh.put(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
    }
    str = preferences.getProperty("rendering.dither");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_DISABLE);
    }
    str = preferences.getProperty("rendering.fractional-metrics");
    if (str != null) {
      if (str.equals("on"))
        rh.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON);
      else if (str.equals("off"))
        rh.put(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
    }
    return rh;
  }
コード例 #26
0
 public JPanel getPanelForProperties(Properties propsArg) {
   // clear();
   propKeyList = new ArrayList();
   propValueList = new ArrayList();
   for (Enumeration e = propsArg.propertyNames(); e.hasMoreElements(); ) {
     String name = (String) e.nextElement();
     String value = (String) propsArg.getProperty(name);
     XmlUIElement el = getXmlUIElementFor("textfield");
     if (el != null) {
       propKeyList.add(name);
       el.setValue(value);
       if (name.endsWith("#")) {
         el.setLabelName(name.substring(0, name.length() - 1));
       } else {
         el.setLabelName(name);
       }
       propValueList.add(el);
     }
   }
   return getPanelFor(propValueList);
 }
コード例 #27
0
 public static List<String> loadLastSessionViewNames() {
   List<String> sessionNames = new ArrayList<String>();
   if (sessions.containsKey("emul.startLastView")) {
     String emulview = sessions.getProperty("emul.view", "");
     int idxstart = 0;
     int idxend = emulview.indexOf(PARAM_START_SESSION, idxstart);
     for (; idxend > -1; idxend = emulview.indexOf(PARAM_START_SESSION, idxstart)) {
       String sessname = emulview.substring(idxstart, idxend).trim();
       if (sessname.length() > 0) {
         sessionNames.add(sessname);
       }
       idxstart = idxend + PARAM_START_SESSION.length();
     }
     if (idxstart + PARAM_START_SESSION.length() < emulview.length()) {
       String sessname = emulview.substring(idxstart + PARAM_START_SESSION.length() - 1).trim();
       if (sessname.length() > 0) {
         sessionNames.add(sessname);
       }
     }
   }
   return sessionNames;
 }
コード例 #28
0
ファイル: Installer.java プロジェクト: suever/CTP
  private void updateWindowsServiceInstaller() {
    try {
      File dir = new File(directory, "CTP");
      if (suppressFirstPathElement) dir = dir.getParentFile();
      File windows = new File(dir, "windows");
      File install = new File(windows, "install.bat");
      cp.appendln(Color.black, "Windows service installer:");
      cp.appendln(Color.black, "...file: " + install.getAbsolutePath());
      String bat = getFileText(install);
      Properties props = new Properties();
      String home = dir.getAbsolutePath();
      cp.appendln(Color.black, "...home: " + home);
      home = home.replaceAll("\\\\", "\\\\\\\\");
      props.put("home", home);

      bat = replace(bat, props);
      setFileText(install, bat);
    } catch (Exception ex) {
      ex.printStackTrace();
      System.err.println("Unable to update the windows service install.barfile.");
    }
  }
コード例 #29
0
ファイル: WordListScreen.java プロジェクト: blueocci/codes
 public void save(ActionEvent e) {
   if (file == null) {
     saveAs(e);
   }
   try {
     OutputStream out = new BufferedOutputStream(new FileOutputStream(file));
     wordList.store(out, "Generated by JWordPlay");
     out.flush();
     out.close();
   } catch (IOException ex) {
     handleException(ex);
   }
 }
コード例 #30
0
ファイル: UserSettings.java プロジェクト: OceanAtlas/JOA
 public void load(String filename) {
   FileInputStream f;
   try {
     File propFile = new File(NdEditFormulas.getSupportPath(), filename);
     f = new FileInputStream(propFile);
   } catch (Exception e) {
     System.out.println("Exception: " + e.toString());
     String errmsg = new String("Cannot open input stream (or load properties): " + filename);
     JOptionPane.showMessageDialog(null, errmsg, "ERROR", JOptionPane.ERROR_MESSAGE);
     return;
   }
   Properties props = new Properties();
   try {
     props.load(f);
   } catch (Exception e) {
     System.out.println("Exception: " + e.toString());
     String errmsg = new String("Cannot or load properties from file: " + filename);
     JOptionPane.showMessageDialog(null, errmsg, "ERROR", JOptionPane.ERROR_MESSAGE);
     return;
   }
   propertiesToInternal(props);
 }