Esempio n. 1
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);
  }
Esempio n. 2
0
  private void create(Shell parent, boolean readOnly) {
    shell.setText(Res.getString("EditorCaption"));
    if (parent != null) shell.setImage(parent.getImage());
    GridLayout layTmp = new GridLayout();
    layTmp.marginBottom = 0;
    layTmp.verticalSpacing = 0;
    shell.setLayout(layTmp);

    TabFolder tfTmp = new TabFolder(shell, SWT.NONE);
    GridData gdTmp = new GridData(GridData.FILL_BOTH);
    tfTmp.setLayoutData(gdTmp);

    // --- Options tab

    Composite cmpTmp = new Composite(tfTmp, SWT.NONE);
    layTmp = new GridLayout();
    cmpTmp.setLayout(layTmp);

    Group grpTmp = new Group(cmpTmp, SWT.NONE);
    layTmp = new GridLayout();
    grpTmp.setLayout(layTmp);
    grpTmp.setText(Res.getString("grpStandaloneStrings"));
    gdTmp = new GridData(GridData.FILL_HORIZONTAL);
    grpTmp.setLayoutData(gdTmp);

    chkExtractStandalone = new Button(grpTmp, SWT.CHECK);
    chkExtractStandalone.setText(Res.getString("chkExtractStandalone"));

    grpTmp = new Group(cmpTmp, SWT.NONE);
    grpTmp.setLayout(new GridLayout());
    grpTmp.setText(Res.getString("grpKeyValuePairs"));
    gdTmp = new GridData(GridData.FILL_HORIZONTAL);
    grpTmp.setLayoutData(gdTmp);

    rdExtractAllPairs = new Button(grpTmp, SWT.RADIO);
    rdExtractAllPairs.setText(Res.getString("rdExtractAllPairs"));
    rdDontExtractPairs = new Button(grpTmp, SWT.RADIO);
    rdDontExtractPairs.setText(Res.getString("rdDontExtractPairs"));

    Label label = new Label(grpTmp, SWT.NONE);
    label.setText(Res.getString("stExceptions"));

    edExceptions = new Text(grpTmp, SWT.BORDER);
    gdTmp = new GridData(GridData.FILL_HORIZONTAL);
    edExceptions.setLayoutData(gdTmp);

    TabItem tiTmp = new TabItem(tfTmp, SWT.NONE);
    tiTmp.setText(Res.getString("tabOptions"));
    tiTmp.setControl(cmpTmp);

    // --- Inline tab

    cmpTmp = new Composite(tfTmp, SWT.NONE);
    layTmp = new GridLayout();
    cmpTmp.setLayout(layTmp);

    chkUseCodeFinder = new Button(cmpTmp, SWT.CHECK);
    chkUseCodeFinder.setText("Has inline codes as defined below:");
    chkUseCodeFinder.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateInlineCodes();
          };
        });

    pnlCodeFinder = new InlineCodeFinderPanel(cmpTmp, SWT.NONE);
    pnlCodeFinder.setLayoutData(new GridData(GridData.FILL_BOTH));

    tiTmp = new TabItem(tfTmp, SWT.NONE);
    tiTmp.setText("Inline Codes");
    tiTmp.setControl(cmpTmp);

    // --- Output tab

    /*cmpTmp = new Composite(tfTmp, SWT.NONE);
    layTmp = new GridLayout();
    cmpTmp.setLayout(layTmp);

    grpTmp = new Group(cmpTmp, SWT.NONE);
    layTmp = new GridLayout();
    grpTmp.setLayout(layTmp);
    grpTmp.setText(Res.getString("grpExtendedChars"));
    gdTmp = new GridData(GridData.FILL_HORIZONTAL);
    grpTmp.setLayoutData(gdTmp);

    chkEscapeExtendedChars = new Button(grpTmp, SWT.CHECK);
    chkEscapeExtendedChars.setText(Res.getString("chkEscapeExtendedChars"));

    tiTmp = new TabItem(tfTmp, SWT.NONE);
    tiTmp.setText(Res.getString("tabOutput"));
    tiTmp.setControl(cmpTmp);*/

    // --- 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("JSON Filter");
              return;
            }
            if (e.widget.getData().equals("o")) {
              if (!saveData()) return;
              result = true;
            }
            shell.close();
          };
        };
    pnlActions = new OKCancelPanel(shell, SWT.NONE, OKCancelActions, true);
    gdTmp = new GridData(GridData.FILL_HORIZONTAL);
    pnlActions.setLayoutData(gdTmp);
    pnlActions.btOK.setEnabled(!readOnly);
    if (!readOnly) {
      shell.setDefaultButton(pnlActions.btOK);
    }

    shell.pack();
    Rectangle Rect = shell.getBounds();
    shell.setMinimumSize(Rect.width, Rect.height);
    Dialogs.centerWindow(shell, parent);
    setData();
  }