예제 #1
0
  public void rescan() {
    rescanButton.setEnabled(false);

    // get the shared data structure
    WizardData data = this.getWizardData();

    if (data != null) {
      // get the Project
      TProject dummy = (TProject) data.getData();

      // project data
      TProjectData pdat = dummy.getProjectData();

      // base file specified ?
      String base = getBaseFileName();
      if (base != null) {
        if (base.length() > 0) {
          File workFile;

          // !!! working directory and directory of basefile could be not equal !!!!
          if (baseFile != null) {
            workFile = baseFile;
          } else {
            workFile = new File(dummy.getWorkingDirectory(), base);
          }

          pdat.collect(workFile);
          rescanButton.setEnabled(true);
        }
      }
      /*
            else  // no base file -> delete all files in table
            {
              TLanguageList lList = pdat.getAvailableLangs() ;
              lList.clear();
            }
      */
      // update the visible components
      updateProjectData();
    }
  }
예제 #2
0
  private JPanel getContentPanel(WizardData wzd) {

    JPanel contentPanel1 = new JPanel();

    welcomeTitle = new JLabel();

    contentPanel1.setLayout(new java.awt.BorderLayout());

    welcomeTitle.setFont(new java.awt.Font("MS Sans Serif", Font.BOLD, 11));
    welcomeTitle.setText("Please insert already existing language files!");
    contentPanel1.add(welcomeTitle, BorderLayout.NORTH);

    // ------------------------------------------------------------------------
    Container mainPanel = new JPanel();
    SpringLayout layout = new SpringLayout();
    mainPanel.setLayout(layout);

    JTextArea infoText = new JTextArea();
    infoText.setLineWrap(false);
    infoText.setEditable(false);
    infoText.setFocusable(false);
    infoText.setBackground(mainPanel.getBackground());
    infoText.append(TInfoText.runtime.getText("newwizard", "site2"));

    JDialog parent = null;
    if (wzd.getWizard() != null) {
      parent = wzd.getWizard().getDialog();
    }
    table = new LanguageManagerPanel(TGlobal.projects.getCurrentProject(), parent, true);

    rescanButton.addActionListener(this);
    baseButton.addActionListener(this);

    // Create and add the components.
    mainPanel.add(infoText);
    mainPanel.add(baseLabel);
    mainPanel.add(baseField);
    mainPanel.add(baseButton);
    mainPanel.add(rescanButton);
    mainPanel.add(table);

    // infoText
    layout.putConstraint(SpringLayout.WEST, infoText, 5, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.NORTH, infoText, 5, SpringLayout.NORTH, mainPanel);

    // baseLabel -------------------------------------------------------------
    layout.putConstraint(SpringLayout.WEST, baseLabel, 0, SpringLayout.WEST, infoText);
    layout.putConstraint(SpringLayout.NORTH, baseLabel, 12, SpringLayout.SOUTH, infoText);

    // nameField
    layout.putConstraint(SpringLayout.WEST, baseField, 5, SpringLayout.EAST, baseLabel);
    layout.putConstraint(SpringLayout.NORTH, baseField, 10, SpringLayout.SOUTH, infoText);

    // baseButton
    layout.putConstraint(SpringLayout.WEST, baseButton, 5, SpringLayout.EAST, baseField);
    layout.putConstraint(SpringLayout.NORTH, baseButton, 7, SpringLayout.SOUTH, infoText);

    // rescanButton
    layout.putConstraint(SpringLayout.WEST, rescanButton, 5, SpringLayout.EAST, baseButton);
    layout.putConstraint(SpringLayout.NORTH, rescanButton, 7, SpringLayout.SOUTH, infoText);

    // table
    layout.putConstraint(SpringLayout.WEST, table, 5, SpringLayout.WEST, mainPanel);
    layout.putConstraint(SpringLayout.NORTH, table, 15, SpringLayout.SOUTH, baseField);

    // panel edges ------------------------------------------------------
    layout.putConstraint(SpringLayout.EAST, mainPanel, 5, SpringLayout.EAST, infoText);
    layout.putConstraint(SpringLayout.SOUTH, mainPanel, 5, SpringLayout.SOUTH, table);

    layout.layoutContainer(mainPanel);
    contentPanel1.add(mainPanel, BorderLayout.CENTER);

    return contentPanel1;
  }