예제 #1
0
  private void createSelectFilesComposite(final Composite parent) {
    String saved = LoggingSettings.readProperty(LoggingSettings.PREFERENCE_INPUT_FILE_PROPERTY, "");

    Label label = new Label(parent, SWT.NONE);
    label.setText("LogFile");
    logFileText = new Text(parent, SWT.BORDER | SWT.SINGLE);
    GridDataFactory.fillDefaults()
        .align(SWT.FILL, SWT.FILL)
        .hint(600, 16)
        .grab(false, false)
        .applyTo(logFileText);

    final Button fileDialog = new Button(parent, SWT.PUSH | SWT.LEFT);
    fileDialog.setText("Select File");

    logFileText.setText(saved);

    fileDialog.addSelectionListener(
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            FileDialog fileDialog = new FileDialog(parent.getShell());
            // Set the text
            fileDialog.setText("Select Log. File");
            logFileText.setText(fileDialog.open());
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }
        });
  }
예제 #2
0
  private void createOutputDirComposite(final Composite composite) {

    String savedDir =
        LoggingSettings.readProperty(LoggingSettings.PREFERENCE_OUTPUT_DIR_PROPERTY, "");

    Label logDirLabel = new Label(composite, SWT.NONE);
    logDirLabel.setText("OutputDir");

    outputDirText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    GridDataFactory.fillDefaults()
        .align(SWT.FILL, SWT.FILL)
        .hint(400, 16)
        .grab(false, false)
        .applyTo(outputDirText);

    final Button dirDialogBtn = new Button(composite, SWT.PUSH | SWT.LEFT);
    dirDialogBtn.setText("Select DIR");

    outputDirText.setText(savedDir);

    dirDialogBtn.addSelectionListener(
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dirDialog = new DirectoryDialog(composite.getShell());

            // Set the text
            if (StringUtils.isNotBlank(outputDirText.getText()))
              dirDialog.setFilterPath(outputDirText.getText());

            dirDialog.setText("Select output dir");

            String dir = dirDialog.open();

            if (StringUtils.isNotEmpty(dir)) {
              outputDirText.setText(dir);
              if (server != null) server.setOutputDir(outputDirText.getText());
            }

            LoggingSettings.saveProperty(
                LoggingSettings.PREFERENCE_OUTPUT_DIR_PROPERTY, outputDirText.getText());
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
          }
        });
  }
예제 #3
0
 private void saveInput() {
   LoggingSettings.saveProperty(
       LoggingSettings.PREFERENCE_INPUT_FILE_PROPERTY, logFileText.getText());
 }