Ejemplo n.º 1
0
  private void saveFile() {
    if (sourceFile == null) {
      FileChooser fc = new FileChooser();
      fc.setTitle("Save file as");

      fc.setInitialDirectory(Sandbox.SANDBOX_SOURCE_DIR.toFile());

      sourceFile = fc.showSaveDialog(sandboxStage.getStageForChooser());
    }

    if (sourceFile != null) {
      saveFile(sourceFile);
      setModified(false);
    }
  }
Ejemplo n.º 2
0
  public void loadSource(File filename) {
    sourceFile = filename;

    if (sourceFile != null) {
      lblTitle.setText(sourceFile.getName());

      // add parent folder so source can be loaded in TriView
      sandboxStage.addSourceFolder(sourceFile.getParentFile());

      String source = ResourceLoader.readFile(sourceFile);

      if (source != null) {
        source = source.replace("\t", "    ");

        taSource.setText(source.trim());

        setModified(false);

        setVMLanguage();
      }
    }
  }