Example #1
0
 private void determineFileType(File file) {
   for (FileType ft : FileType.values()) {
     if (file.getName().toLowerCase().endsWith(ft.name().toLowerCase())) {
       this.fileType = ft;
     }
   }
 }
Example #2
0
  /**
   * Create text panel with the specified title, text, and mode
   *
   * @param container Reference to the container of this panel
   * @param title Title for this panel, to appear in the title field of a frame, or title of a tab
   * @param filename The name of the file to be opened
   * @param type The predefined file type
   * @param project
   */
  public EPlusEditorPanel(
      Container container, String title, String filename, FileType type, JEPlusProject project) {
    initComponents();
    initRSTA(type.getRSTA_Style());
    FC.setFileFilter(type.getFileFilter());
    FC.setMultiSelectionEnabled(false);
    this.ContainerComponent = container;
    this.Title = title;
    this.CurrentFileName = filename;
    if (CurrentFileName != null) {
      this.rsTextArea.setText(getFileContent(CurrentFileName));
    }
    this.ContentType = type;
    this.ContentChanged = false;
    this.Project = project;
    switch (ContentType) {
      case IDF:
        updateSearchStrings((Project == null) ? null : Project.getSearchStrings());
        this.cmdLoad.setEnabled(true);
        this.cmdCheck.setEnabled(false);
        this.cmdSave.setEnabled(true);
        break;
      case EPW:
      case RVI:
        updateSearchStrings(null);
        this.cmdLoad.setEnabled(false);
        this.cmdCheck.setEnabled(false);
        this.cmdSave.setEnabled(true);
        break;
      case RVX:
        updateSearchStrings(RVX.quickIndex());
        this.cmdLoad.setEnabled(false);
        this.cmdCheck.setEnabled(true);
        this.cmdSave.setEnabled(true);
        break;
      case JSON:
        updateSearchStrings(null);
        this.cmdLoad.setEnabled(false);
        this.cmdCheck.setEnabled(true);
        this.cmdSave.setEnabled(false);
        break;
      case PYTHON:
      case CSV:
      case XML:
      case PLAIN:
      default:
        updateSearchStrings(null);
        this.cmdLoad.setEnabled(true);
        this.cmdCheck.setEnabled(false);
        this.cmdSave.setEnabled(true);
    }
    // this.cboSearchStrings.setEditable(true);

    this.Document = rsTextArea.getDocument();
    Document.addDocumentListener(this);
  }
Example #3
0
 private void cmdRefreshActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_cmdRefreshActionPerformed
   if (ContentType.equals(FileType.IDF)) {
     updateSearchStrings((Project == null) ? null : Project.getSearchStrings());
   }
 } // GEN-LAST:event_cmdRefreshActionPerformed