コード例 #1
0
  protected FileChooserPanel getFileChooserPanel() {
    // LoadFileDataSourceQueryChoosers share the same JFileChooser so that the user's
    // work is not lost when he switches data-source types. Also, the JFileChooser options
    // are set once because setting them is slow (freezes the GUI for a few seconds).
    // [Jon Aquino]
    if (blackboard().get(FILE_CHOOSER_PANEL_KEY) == null) {
      final JFileChooser fileChooser = GUIUtil.createJFileChooserWithExistenceChecking();
      fileChooser.setMultiSelectionEnabled(true);
      fileChooser.setControlButtonsAreShown(false);

      blackboard().put(FILE_CHOOSER_KEY, fileChooser);
      blackboard().put(FILE_CHOOSER_PANEL_KEY, new FileChooserPanel(fileChooser, blackboard()));

      if (PersistentBlackboardPlugIn.get(context).get(FILE_CHOOSER_DIRECTORY_KEY) != null) {
        fileChooser.setCurrentDirectory(
            new File(
                (String) PersistentBlackboardPlugIn.get(context).get(FILE_CHOOSER_DIRECTORY_KEY)));
        ((FileChooserPanel) blackboard().get(FILE_CHOOSER_PANEL_KEY))
            .setSelectedCoordinateSystem(
                (String)
                    PersistentBlackboardPlugIn.get(context)
                        .get(FILE_CHOOSER_COORDINATE_SYSTEM_KEY));
      }

      if (CoordinateSystemSupport.isEnabled(blackboard())) {
        ((FileChooserPanel) blackboard().get(FILE_CHOOSER_PANEL_KEY))
            .setCoordinateSystemComboBoxVisible(true);
      }
    }

    return (FileChooserPanel) blackboard().get(FILE_CHOOSER_PANEL_KEY);
  }
コード例 #2
0
  public Collection getDataSourceQueries() {
    // User has pressed OK, so persist the directory. [Jon Aquino]
    PersistentBlackboardPlugIn.get(context)
        .put(
            FILE_CHOOSER_DIRECTORY_KEY,
            getFileChooserPanel().getChooser().getCurrentDirectory().toString());
    PersistentBlackboardPlugIn.get(context)
        .put(
            FILE_CHOOSER_COORDINATE_SYSTEM_KEY,
            getFileChooserPanel().getSelectedCoordinateSystem().getName());

    return super.getDataSourceQueries();
  }