コード例 #1
0
 /** Reset the rootPath value after selecting the "Any Location Path" button */
 private void doSelectAnyLocationButton() {
   if (anyLocationButton.getSelection() && (pathList != null && pathList.size() > 1)) {
     selectRadioIndex = 2;
     rootPath = pathList.get(1).toString();
     xmlPathField.setEnabled(false);
     xmlPathField.setText(TextProcessor.process(rootPath, "//"));
   }
 }
コード例 #2
0
  /** Reset the rootPath value after selecting the "Absolute Path" button */
  private void doSelectAbsolutePathButton() {
    if (absolutePathButton.getSelection() && (pathList != null && pathList.size() > 0)) {

      selectRadioIndex = 1;
      rootPath = pathList.get(0).toString();
      xmlPathField.setEnabled(false);
      xmlPathField.setText(TextProcessor.process(rootPath, "//"));
    }
  }
コード例 #3
0
 /*
  * (non-Javadoc) Method declared on Dialog.
  */
 protected void buttonPressed(int buttonId) {
   if (buttonId == IDialogConstants.OK_ID) {
     if (this.absolutePathButton.getSelection()) {
       this.selectStr = this.pathList.get(0).toString();
     } else if (this.anyLocationButton.getSelection()) {
       this.selectStr = this.pathList.get(1).toString();
     } else this.selectStr = xmlPathField.getText();
   }
   super.buttonPressed(buttonId);
 }
コード例 #4
0
  /*
   *
   * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
   */
  protected Control createDialogArea(Composite parent) {
    getShell().setText(title);
    Composite panel = (Composite) super.createDialogArea(parent);
    Label label = new Label(panel, SWT.NONE);
    label.setText(Messages.getString("RowMappingDialog.info")); // $NON-NLS-1$

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = 250;
    Group composite = new Group(panel, SWT.NONE);
    composite.setLayout(layout);
    composite.setLayoutData(data);

    GridData buttonGd = new GridData(GridData.FILL_HORIZONTAL);
    buttonGd.verticalAlignment = SWT.BEGINNING;
    buttonGd.verticalIndent = 5;
    buttonGd.horizontalSpan = 2;

    absolutePathButton = new Button(composite, SWT.RADIO | SWT.WRAP);
    absolutePathButton.setLayoutData(buttonGd);
    anyLocationButton = new Button(composite, SWT.RADIO | SWT.WRAP);
    anyLocationButton.setLayoutData(buttonGd);
    customButton = new Button(composite, SWT.RADIO | SWT.WRAP);
    customButton.setLayoutData(buttonGd);
    customButton.setText(
        Messages.getString("xPathChoosePage.messages.elementSelection.item.custom")); // $NON-NLS-1$

    Label dummy = new Label(composite, SWT.NONE);
    GridData labelGd = new GridData();
    labelGd.verticalIndent = 5;
    labelGd.widthHint = 10;
    dummy.setLayoutData(labelGd);

    GridData txtGridData = new GridData(GridData.FILL_HORIZONTAL);
    xmlPathField = new StyledCCombo(composite, SWT.DROP_DOWN | SWT.BORDER);
    xmlPathField.setLayoutData(txtGridData);
    xmlPathField.setVisible(true);
    for (int i = 0; i < pathList.size(); i++) {
      xmlPathField.setText(TextProcessor.process(pathList.get(i).toString(), "//"));
      xmlPathField.add(TextProcessor.process(pathList.get(i).toString(), "//"));
    }

    if (supportsXMLParameter) {
      createQuickFixMenu(xmlPathField.getStyledText());
      xmlPathField
          .getStyledText()
          .addMenuDetectListener(
              new MenuDetectListener() {

                public void menuDetected(MenuDetectEvent event) {
                  quickFixMenu.setLocation(event.x, event.y);
                  quickFixMenu.setVisible(true);

                  updateMenuItemStatus(xmlPathField.getStyledText());
                }
              });
    }

    setButtonTextAndListeners(composite);

    XMLRelationInfoUtil.setSystemHelp(
        composite, IHelpConstants.CONEXT_ID_DATASET_XML_XPATH_EXPRESSION);
    if (this.selectRadioIndex == 1) {
      absolutePathButton.setSelection(true);
      xmlPathField.setEnabled(false);
      if (pathList.size() > 0) {
        xmlPathField.setText(TextProcessor.process(pathList.get(0).toString(), "//"));
      }
    } else if (this.selectRadioIndex == 2) {
      anyLocationButton.setSelection(true);
      xmlPathField.setEnabled(false);
      if (pathList.size() > 1) {
        xmlPathField.setText(TextProcessor.process(pathList.get(1).toString(), "//"));
      }
    } else {
      customButton.setSelection(true);
      xmlPathField.setText(TextProcessor.process(this.selectStr, "//"));
    }
    return composite;
  }