コード例 #1
0
  private void createQuickFixMenu(final StyledText text) {
    quickFixMenu = new Menu(text);
    MenuItem createItem = new MenuItem(quickFixMenu, SWT.PUSH);
    createItem.setText(
        Messages.getString("ColumnMappingDialog.MenuItem.CreateParameter")); // $NON-NLS-1$
    createItem.addSelectionListener(
        new SelectionListener() {

          public void widgetSelected(SelectionEvent event) {
            createXMLParameter(text);
          }

          public void widgetDefaultSelected(SelectionEvent event) {}
        });

    MenuItem deleteItem = new MenuItem(quickFixMenu, SWT.PUSH);
    deleteItem.setText(
        Messages.getString("ColumnMappingDialog.MenuItem.DeleteParameter")); // $NON-NLS-1$
    deleteItem.addSelectionListener(
        new SelectionListener() {

          public void widgetSelected(SelectionEvent event) {
            deleteXMLParameter(text);
          }

          public void widgetDefaultSelected(SelectionEvent event) {}
        });

    updateMenuItemStatus(text);
  }
コード例 #2
0
 private void resetButtonsAndTextValues(boolean visible) {
   if (visible) {
     absolutePathButton.setText(
         Messages.getFormattedString(
             "xPathChoosePage.messages.elementSelection.item.absolutePath", //$NON-NLS-1$
             new String[] {selectedItem.getText()}));
     anyLocationButton.setText(
         Messages.getFormattedString(
             "xPathChoosePage.messages.elementSelection.item.anyLocation", //$NON-NLS-1$
             new String[] {selectedItem.getText()}));
   } else {
     absolutePathButton.setText(
         Messages.getString(
             "xPathChoosePage.messages.elementSelection.disable.absolutePath")); //$NON-NLS-1$
     anyLocationButton.setText(
         Messages.getString(
             "xPathChoosePage.messages.elementSelection.disable.anyLocation")); //$NON-NLS-1$
   }
   absolutePathButton.setEnabled(visible);
   anyLocationButton.setEnabled(visible);
 }
コード例 #3
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;
  }