public void selectFile() {
    try {
      NamedInputStream in =
          org.interpss.editor.util.Utilities.provideInput(
              Translator.getString("GraphFileExtension"),
              Translator.getString("GraphFileExtensionDescription"));
      if (in != null) {

        setFile(org.interpss.editor.util.Utilities.OpenGraphFile(graphpad, in.getInputStream()));
        this.setSrcFileName(in.getName());
        dirTextField.setText(in.getName());
        if (getFile() == null) {
          showError("Can't open the selected graphic document.");
          return;
        }
      }
    } catch (Exception ex) {
      showError(ex.toString());
      ex.printStackTrace();
    }
  }
  public void updateState() {
    if (nameTextField.getText().equals("")) {
      showError(Translator.getString("GraphDialog.Name.Error"));
      return;
    }
    String filePathName = getFileName();
    try {
      java.io.File myFile = new java.io.File(filePathName);
      if (myFile.exists()) {

        showError(Translator.getString("GraphDialog.File.Exists"));
        return;
      }
      // else myFilePath.mkdir();
    } catch (Exception e) {
      showError("Create graph error:" + e.getMessage());
      return;
    }

    showMessage(Translator.getString("GraphDialog.OK"));
    // showMessage(filePathName);
  }
  /** @see java.awt.event.ActionListener#actionPerformed(ActionEvent) */
  public void actionPerformed(ActionEvent e) {

    IpssProject curproj = graphpad.getCurrentProject();
    String newname =
        JOptionPane.showInputDialog(Translator.getString("ProjectName"), curproj.getProjectName());

    if (newname == null) return;

    if (!newname.equals(curproj.getProjectName())) {
      if (!Utilities.renameFile(
          curproj.getProjectPath(),
          curproj.getParentPath() + System.getProperty("file.separator") + newname)) {
        JOptionPane.showMessageDialog(
            this.getGraphpad().getFrame(),
            "Project already exists",
            "ERROR",
            JOptionPane.ERROR_MESSAGE);
        return;
      }
    }
    curproj.setProjectName(newname);
  }
 public String getFileName() {
   return Utilities.getFilePathName(
       getFilepath(), nameTextField.getText() + "." + Translator.getString("GraphFileExtension"));
 }
Exemple #5
0
  public static boolean loadEditorProperties() {
    boolean ok = true;
    try {
      //			FileChooserConfig.CurrentProjDir = baseDir +
      // Translator.getString("Project.File.Location");
      //			FileChooserConfig.setCustomFileExts(appProps);

      DBManager.SQLMAP_CONFIG_PATH = Translator.getString("Sqlmap.Config.Path");
      DBManager.SQLMAP_SAMPLE_CONFIG_PATH = Translator.getString("Sqlmap.Sample.Config.Path");
      DBManager.DB_SCHEMA_VERSION = Translator.getString("IpssDb.shema.version");
      IpssLogger.getLogger().info("DBManager.SQLMAP_CONFIG_PATH:" + DBManager.SQLMAP_CONFIG_PATH);
      IpssLogger.getLogger()
          .info("DBManager.SQLMAP_SAMPLE_CONFIG_PATH:" + DBManager.SQLMAP_SAMPLE_CONFIG_PATH);
      /*
      			try {
      				DBManager.getSqlMapIpss().getDataSource().getConnection();
      				DBManager.getSqlMapSample().getDataSource().getConnection();
      			} catch (SQLException e) {
      				IpssLogger.logErr(e);
      				ok = false;
      			}
      */
      GEditor.Pty_UserWorkspace = Translator.getString("WorkSpace.Location");
      GEditor.Pty_SampleWorkspace = Translator.getString("WorkSpace.Location.Sample");

      IpssRptViewer.REPORT_DEFAULT_DIR =
          AppConstants.APP_BASE_DIR + Translator.getString("Report.File.Location");
      IpssRptViewer.REPORT_EXT = Translator.getString("ReportFileExtension");
      IpssRptViewer.REPORT_DESC = Translator.getString("Report.File.Desc");

      IpssFileFilter.OUTPUT_DEFAULT_DIR =
          AppConstants.APP_BASE_DIR + AppConstants.OUTPUT_DEFAULT_DIR;

      IpssJavaCompiler.JavaSrcDir = Translator.getString("Java.Compile.JavaSrcDir");
      IpssJavaCompiler.JavaClassDir = Translator.getString("Java.Compile.JavaClassDir");
      IpssJavaCompiler.JavaLibPath = Translator.getString("Java.Compile.JavaLibPath");
      IpssJavaCompiler.ClassnameToken = Translator.getString("Java.Compile.ClassnameToken");
      IpssJavaCompiler.JavaClasspath = Translator.getString("Java.Compile.JavaClasspath");

      CoreScriptUtilFunc.Tag_ControllerDescBegin =
          Translator.getString("Java.Compile.CMLController.Tag.ContDesc.Begin");
      CoreScriptUtilFunc.Tag_ControllerDescEnd =
          Translator.getString("Java.Compile.CMLController.Tag.ContrDesc.End");
      CoreScriptUtilFunc.Tag_ControllerFieldDescBegin =
          Translator.getString("Java.Compile.CMLController.Tag.FieldDesc.Begin");
      CoreScriptUtilFunc.Tag_ControllerFieldDescEnd =
          Translator.getString("Java.Compile.CMLController.Tag.FieldDesc.End");

      CoreScriptUtilFunc.Tag_ControllerDescBegin_Code =
          Translator.getString("Java.Compile.CMLController.Tag.ContDesc.Begin.Code");
      CoreScriptUtilFunc.Tag_ControllerFieldDescEnd_Code =
          Translator.getString("Java.Compile.CMLController.Tag.FieldDesc.End.Code");

      CoreScriptUtilFunc.Tag_AclfScript_Begin_Code =
          Translator.getString("Java.Compile.AclfScripting.Tag.AclfScript_Begin_Code");
      CoreScriptUtilFunc.Tag_AclfScriptBus_Begin =
          Translator.getString("Java.Compile.AclfScripting.Tag.AclfScriptBus_Begin");
      CoreScriptUtilFunc.Tag_AclfScriptBranch_Begin =
          Translator.getString("Java.Compile.AclfScripting.Tag.AclfScriptBranch_Begin");

      CoreScriptUtilFunc.Tag_AcscScript_Begin_Code =
          Translator.getString("Java.Compile.AcscScripting.Tag.AcscScript_Begin_Code");
      CoreScriptUtilFunc.Tag_AcscScriptBus_Begin =
          Translator.getString("Java.Compile.AcscScripting.Tag.AcscScriptBus_Begin");
      CoreScriptUtilFunc.Tag_AcscScriptBranch_Begin =
          Translator.getString("Java.Compile.AcscScripting.Tag.AcscScriptBranch_Begin");
    } catch (Exception e) {
      IpssLogger.logErr(e);
      ok = false;
    }

    return ok;
  }