Example #1
0
 private void getSRXFile(Text edTextField) {
   String caption;
   if (edTextField == edSourceSRX) caption = "Select SRX for Source";
   else caption = "Select SRX for Target";
   String[] paths =
       Dialogs.browseFilenames(
           shell, caption, false, null, "SRX Documents (*.srx)\tAll Files (*.*)", "*.srx\t*.*");
   if (paths == null) return;
   UIUtil.checkProjectFolderAfterPick(paths[0], edTextField, projectDir);
 }
Example #2
0
 private void editSRXFile(Text edTextField) {
   try {
     SRXEditor editor = new SRXEditor(shell, true, help);
     String oriPath = edTextField.getText();
     if (projectDir != null) {
       oriPath = oriPath.replace("${ProjDir}", projectDir);
     }
     if (oriPath.length() == 0) oriPath = null;
     editor.showDialog(oriPath);
     String newPath = editor.getPath();
     UIUtil.checkProjectFolderAfterPick(newPath, edTextField, projectDir);
   } catch (Throwable e) {
     Dialogs.showError(shell, e.getMessage(), null);
   }
 }
Example #3
0
  private void create(Shell parent, boolean readOnly) {
    shell.setText("Segmentation");
    if (parent != null) UIUtil.inheritIcon(shell, parent);
    GridLayout layTmp = new GridLayout();
    layTmp.marginBottom = 0;
    layTmp.verticalSpacing = 0;
    shell.setLayout(layTmp);

    createComposite(shell);

    // --- Dialog-level buttons

    SelectionAdapter OKCancelActions =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            result = false;
            if (e.widget.getData().equals("h")) {
              if (help != null) help.showWiki("Segmentation Step");
              return;
            }
            if (e.widget.getData().equals("o")) saveData();
            shell.close();
          };
        };
    pnlActions = new OKCancelPanel(shell, SWT.NONE, OKCancelActions, true);
    pnlActions.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    pnlActions.btOK.setEnabled(!readOnly);
    if (!readOnly) {
      shell.setDefaultButton(pnlActions.btOK);
    }

    shell.pack();
    shell.setMinimumSize(shell.getSize());
    Point startSize = shell.getMinimumSize();
    if (startSize.x < 600) startSize.x = 600;
    shell.setSize(startSize);
    setData();
    Dialogs.centerWindow(shell, parent);
  }