コード例 #1
0
  private void createImpButtons(Composite container) {
    Composite buttonContainer =
        SWTFactory.createComposite(container, 1, 1, GridData.FILL_VERTICAL, 0, 0);

    fAddButton = SWTFactory.createPushButton(buttonContainer, PDEUIMessages.SourceBlock_add, null);
    fAddButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleAdd();
          }
        });

    fRemoveButton =
        SWTFactory.createPushButton(buttonContainer, PDEUIMessages.SourceBlock_remove, null);
    fRemoveButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleRemove();
          }
        });

    fRemoveAllButton =
        SWTFactory.createPushButton(
            buttonContainer, PDEUIMessages.TargetImplicitPluginsTab_removeAll3, null);
    fRemoveAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleRemoveAll();
          }
        });

    updateImpButtons();
  }
コード例 #2
0
  /** Creates a text that controls whether a border radius is set on the registered controls. */
  protected void cteateRoundedBorderGroup() {
    Group group = new Group(styleComp, SWT.NONE);
    group.setText("Rounded Border");
    group.setLayout(new GridLayout(2, false));
    new Label(group, SWT.NONE).setText("Width");
    final Text textWidth = new Text(group, SWT.SINGLE | SWT.BORDER);
    textWidth.setLayoutData(new GridData(20, SWT.DEFAULT));
    new Label(group, SWT.NONE).setText("Color");
    final Button buttonColor = new Button(group, SWT.PUSH);
    buttonColor.setLayoutData(new GridData(20, 20));
    buttonColor.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent event) {
            rbIndex = (rbIndex + 1) % bgColors.length;
            if (bgColors[rbIndex] == null) {
              buttonColor.setText("");
            } else {
              buttonColor.setText("\u2588");
            }
            buttonColor.setForeground(bgColors[rbIndex]);
          }
        });
    new Label(group, SWT.NONE).setText("Radius ");
    Composite radiusGroup = new Composite(group, SWT.NONE);
    radiusGroup.setLayout(new GridLayout(4, false));
    new Label(radiusGroup, SWT.NONE).setText("T-L");
    final Text textTopLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER);
    textTopLeft.setLayoutData(new GridData(20, SWT.DEFAULT));
    new Label(radiusGroup, SWT.NONE).setText("T-R");
    final Text textTopRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER);
    textTopRight.setLayoutData(new GridData(20, SWT.DEFAULT));
    new Label(radiusGroup, SWT.NONE).setText("B-L");
    final Text textBottomLeft = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER);
    textBottomLeft.setLayoutData(new GridData(20, SWT.DEFAULT));
    new Label(radiusGroup, SWT.NONE).setText("B-R");
    final Text textBottomRight = new Text(radiusGroup, SWT.SINGLE | SWT.BORDER);
    textBottomRight.setLayoutData(new GridData(20, SWT.DEFAULT));
    Button button = new Button(group, SWT.PUSH);
    button.setText("Set");
    button.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(final SelectionEvent e) {
            int width = parseInt(textWidth.getText());
            Color color = buttonColor.getBackground();
            int topLeft = parseInt(textTopLeft.getText());
            int topRight = parseInt(textTopRight.getText());
            int bottomRight = parseInt(textBottomRight.getText());
            int bottomLeft = parseInt(textBottomLeft.getText());
            updateRoundedBorder(width, color, topLeft, topRight, bottomRight, bottomLeft);
          }
        });
  }
コード例 #3
0
 private void createOptionalDependenciesButton(Composite container) {
   if (isEditable()) {
     fIncludeOptionalButton = new Button(container, SWT.CHECK);
     fIncludeOptionalButton.setText(PDEUIMessages.PluginSection_includeOptional);
     // initialize value
     IEditorInput input = getPage().getEditorInput();
     if (input instanceof IFileEditorInput) {
       IFile file = ((IFileEditorInput) input).getFile();
       try {
         fIncludeOptionalButton.setSelection(
             "true".equals(file.getPersistentProperty(OPTIONAL_PROPERTY))); // $NON-NLS-1$
       } catch (CoreException e) {
       }
     }
     // create listener to save value when the checkbox is changed
     fIncludeOptionalButton.addSelectionListener(
         new SelectionAdapter() {
           public void widgetSelected(SelectionEvent e) {
             IEditorInput input = getPage().getEditorInput();
             if (input instanceof IFileEditorInput) {
               IFile file = ((IFileEditorInput) input).getFile();
               try {
                 file.setPersistentProperty(
                     OPTIONAL_PROPERTY,
                     fIncludeOptionalButton.getSelection() ? "true" : null); // $NON-NLS-1$
               } catch (CoreException e1) {
               }
             }
           }
         });
   }
 }
コード例 #4
0
  /** Experimental. Switching themes at runtime does not yet work properly. */
  protected void createThemeSwitcher(final Composite parent) {
    final Button button = new Button(parent, SWT.PUSH);
    button.setText("Theme Switcher");
    button.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent e) {
            Shell shell = new Shell(parent.getShell(), SWT.DIALOG_TRIM);
            shell.setText("Theme Switcher");
            shell.setLayout(new GridLayout());
            Button themeButton = new Button(shell, SWT.PUSH);
            themeButton.setText("Switch Theme");
            themeButton.addSelectionListener(
                new SelectionAdapter() {
                  String[] availableThemeIds = ThemeUtil.getAvailableThemeIds();

                  public void widgetSelected(final SelectionEvent e) {
                    int index = 0;
                    String currThemeId = ThemeUtil.getCurrentThemeId();
                    for (int i = 0; i < availableThemeIds.length; i++) {
                      if (currThemeId.equals(availableThemeIds[i])) {
                        index = (i + 1) % availableThemeIds.length;
                      }
                    }
                    String newThemeId = availableThemeIds[index];
                    ThemeUtil.setCurrentThemeId(newThemeId);
                  }
                });
            shell.pack();
            shell.open();
          }
        });
  }
コード例 #5
0
 /** Method to create cancel button */
 protected void createCancelButton(GridData gridData) {
   cancelButton.setText("Cancel");
   cancelButton.setLayoutData(gridData);
   cancelButton.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(SelectionEvent arg0) {
           shell.close();
         }
       });
 }
コード例 #6
0
  private void createButtonPanel(Composite pageContent) {
    Composite buttonPanel = new Composite(pageContent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    buttonPanel.setLayout(layout);

    GridData gridData = new GridData();
    gridData.grabExcessHorizontalSpace = false;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.CENTER;
    gridData.horizontalAlignment = GridData.CENTER;
    buttonPanel.setLayoutData(gridData);

    addButton = new Button(buttonPanel, SWT.PUSH);
    addButton.setText(Messages._UI_ADD_BUTTON);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.CENTER;
    addButton.setLayoutData(gridData);
    addButton.addSelectionListener(new ButtonSelectListener());
    addButton.setToolTipText(Messages._UI_ADD_BUTTON_TOOL_TIP);
    addButton.setEnabled(false);

    removeButton = new Button(buttonPanel, SWT.PUSH);
    removeButton.setText(Messages._UI_REMOVE_BUTTON);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.CENTER;
    removeButton.setLayoutData(gridData);
    removeButton.addSelectionListener(new ButtonSelectListener());
    removeButton.setToolTipText(Messages._UI_REMOVE_BUTTON_TOOL_TIP);
    removeButton.setEnabled(false);

    removeAllButton = new Button(buttonPanel, SWT.PUSH);
    removeAllButton.setText(Messages._UI_REMOVE_ALL_BUTTON);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.CENTER;
    removeAllButton.setLayoutData(gridData);
    removeAllButton.addSelectionListener(new ButtonSelectListener());
    removeAllButton.setToolTipText(Messages._UI_REMOVE_ALL_BUTTON_TOOL_TIP);
    removeAllButton.setEnabled(false);
  }
コード例 #7
0
  protected void createLimitTypesGroup() {
    GridData gridData; // Group for lengthLimitButton and shortestPlusKButton

    Group limitTypeGroup = new Group(shell, SWT.NONE);
    limitTypeGroup.setText("Stop distance");
    gridData = new GridData(GridData.FILL, GridData.BEGINNING, false, false);
    gridData.horizontalSpan = 2;
    gridData.verticalSpan = 2;
    limitTypeGroup.setLayoutData(gridData);
    limitTypeGroup.setLayout(new GridLayout(2, true));

    // Length limit radio button

    lengthLimitLabel = new Label(limitTypeGroup, SWT.NONE);
    lengthLimitLabel.setText("Length limit");
    gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false);
    lengthLimitLabel.setLayoutData(gridData);

    // Length limit text

    lengthLimit = new Text(limitTypeGroup, SWT.BORDER);
    lengthLimit.addKeyListener(keyAdapter);
    gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
    lengthLimit.setLayoutData(gridData);

    // Shortest+k radio button

    shortestPlusKButton = new Button(limitTypeGroup, SWT.CHECK);
    shortestPlusKButton.setText("Shortest+k");
    gridData = new GridData(GridData.BEGINNING, GridData.CENTER, false, false);
    shortestPlusKButton.setLayoutData(gridData);
    shortestPlusKButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent arg0) {
            shortestPlusK.setEnabled(shortestPlusKButton.getSelection());
          }
        });

    // Shortest+k text

    shortestPlusK = new Text(limitTypeGroup, SWT.BORDER);
    shortestPlusK.addKeyListener(keyAdapter);
    gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
    shortestPlusK.setLayoutData(gridData);

    // Strict check box

    strictButton = new Button(shell, SWT.CHECK | SWT.WRAP);
    strictButton.setText("Ignore source-source/target-target paths");
    gridData = new GridData(GridData.CENTER, GridData.CENTER, false, false);
    gridData.verticalSpan = 2;
    gridData.horizontalSpan = 4;
    strictButton.setLayoutData(gridData);
  }
コード例 #8
0
 /**
  * Creates a checkbox that controls whether a background image is set on the registered controls.
  *
  * @return the created checkbox
  */
 protected Button createBgImageButton() {
   final Button button = new Button(styleComp, SWT.CHECK);
   button.setText("Background Image");
   button.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(final SelectionEvent event) {
           showBgImage = button.getSelection();
           updateBgImage();
         }
       });
   return button;
 }
コード例 #9
0
 /**
  * Creates a button to change the background color of all registered controls.
  *
  * @return the created button
  */
 protected Button createBgColorButton() {
   bgColorChooser = new ColorChooser();
   final Button button = new Button(styleComp, SWT.PUSH);
   button.setText("Background");
   button.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(final SelectionEvent event) {
           bgIndex = (bgIndex + 1) % fgColors.length;
           updateBgColor();
         }
       });
   return button;
 }
コード例 #10
0
 /**
  * Creates a checkbutton to enable / disabled the registered controls.
  *
  * @return the created checkbutton.
  */
 protected Button createEnablementButton() {
   final Button button = new Button(styleComp, SWT.CHECK);
   button.setText("Enabled");
   button.setSelection(enabled);
   button.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(final SelectionEvent event) {
           enabled = button.getSelection();
           updateEnabled();
         }
       });
   return button;
 }
コード例 #11
0
 /**
  * Creates a checkbutton to show / hide the registered controls.
  *
  * @return the created checkbutton
  */
 protected Button createVisibilityButton() {
   final Button button = new Button(styleComp, SWT.CHECK);
   button.setText("Visible");
   button.setSelection(visible);
   button.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(final SelectionEvent event) {
           visible = button.getSelection();
           updateVisible();
         }
       });
   return button;
 }
コード例 #12
0
 protected Button createStyleButton(final String name, final int style, final boolean checked) {
   Button button = new Button(styleComp, SWT.CHECK);
   button.setText(name);
   button.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(final SelectionEvent event) {
           createNew();
         }
       });
   button.setData("style", new Integer(style));
   button.setSelection(checked);
   return button;
 }
コード例 #13
0
 protected Button createPropertyCheckbox(
     final String text, final String prop, final boolean checked) {
   final Button button = new Button(styleComp, SWT.CHECK);
   button.setText(text);
   button.setSelection(checked);
   button.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(final SelectionEvent e) {
           if (button.getSelection()) {
             properties.add(prop);
           } else {
             properties.remove(prop);
           }
           createNew();
         }
       });
   return button;
 }
コード例 #14
0
 protected Button createFontChooser() {
   final Button button = new Button(styleComp, SWT.PUSH);
   button.setText("Font");
   button.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(final SelectionEvent event) {
           fontChooser = new SimpleFontDialog(getShell());
           Control control = (Control) controls.get(0);
           fontChooser.setFont(control.getFont());
           fontChooser.open(
               new Runnable() {
                 public void run() {
                   font = fontChooser.getFont();
                   updateFont();
                 }
               });
         }
       });
   return button;
 }
コード例 #15
0
  private void createFilterOptions(Composite container) {
    fFilterOldVersionButton =
        SWTFactory.createCheckButton(
            container, PDEUIMessages.ImportWizard_DetailedPage_filterDesc, null, true, 1);

    if (getDialogSettings().get(SETTINGS_SHOW_LATEST) != null)
      fFilterOldVersionButton.setSelection(getDialogSettings().getBoolean(SETTINGS_SHOW_LATEST));
    else fFilterOldVersionButton.setSelection(true);

    fFilterOldVersionButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (fFilterOldVersionButton.getSelection()) {
              fAvailableListViewer.addFilter(fVersionFilter);
            } else {
              fAvailableListViewer.removeFilter(fVersionFilter);
            }
            updateCount();
          }
        });
  }
コード例 #16
0
  void createImportButton(Composite parent) {
    importButton = new Button(parent, SWT.PUSH);
    importButton.setText(Messages._UI_IMPORT_BUTTON);

    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.CENTER;
    importButton.setLayoutData(gridData);
    importButton.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            FileSystemImportWizard importWizard = new FileSystemImportWizard();
            importWizard.init(workbench, selection);
            Shell shell = Display.getCurrent().getActiveShell();
            WizardDialog wizardDialog = new WizardDialog(shell, importWizard);
            wizardDialog.create();
            wizardDialog.open();
            sourceFileViewer.refresh();
          }
        });
    importButton.setToolTipText(Messages._UI_IMPORT_BUTTON_TOOL_TIP);
  }
コード例 #17
0
  private Composite createButtonArea(Composite parent) {
    ScrolledComposite comp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    GridLayout layout = new GridLayout();
    layout.marginWidth = layout.marginHeight = 0;
    comp.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    Composite container = new Composite(comp, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_VERTICAL);
    gd.verticalIndent = 15;
    container.setLayoutData(gd);

    Button button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_existing);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleExistingProjects();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_existingUnshared);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleExistingUnshared();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    fAddButton = new Button(container, SWT.PUSH);
    fAddButton.setText(PDEUIMessages.ImportWizard_DetailedPage_add);
    fAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAdd();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddButton);

    fAddAllButton = new Button(container, SWT.PUSH);
    fAddAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addAll);
    fAddAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddAllButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAddAll();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddAllButton);

    fRemoveButton = new Button(container, SWT.PUSH);
    fRemoveButton.setText(PDEUIMessages.ImportWizard_DetailedPage_remove);
    fRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fRemoveButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleRemove();
          }
        });
    SWTUtil.setButtonDimensionHint(fRemoveButton);

    fRemoveAllButton = new Button(container, SWT.PUSH);
    fRemoveAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_removeAll);
    fRemoveAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fRemoveAllButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleRemoveAll();
          }
        });
    SWTUtil.setButtonDimensionHint(fRemoveAllButton);

    button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_swap);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleSwap();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    fAddRequiredButton = new Button(container, SWT.PUSH);
    fAddRequiredButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addRequired);
    fAddRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddRequiredButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAddRequiredPlugins();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddRequiredButton);

    fCountLabel = new Label(container, SWT.NONE);
    fCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    comp.setContent(container);
    comp.setMinHeight(250);
    comp.setExpandHorizontal(true);
    comp.setExpandVertical(true);
    return container;
  }
コード例 #18
0
  /**
   * Creates the dialog's contents
   *
   * @param shell the dialog window
   */
  private void createContents(final Shell shell) {

    final Config config = controller.getConfig();

    // Create the ScrolledComposite to scroll horizontally and vertically
    ScrolledComposite sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);

    // Create the parent Composite container for the three child containers
    Composite container = new Composite(sc, SWT.NONE);
    GridLayout containerLayout = new GridLayout(1, false);
    container.setLayout(containerLayout);
    shell.setLayout(new FillLayout());

    GridData data;
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = 50;
    data.widthHint = 400;

    // START TOP COMPONENT

    Composite topComp = new Composite(container, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    topComp.setLayout(layout);
    topComp.setLayoutData(data);

    Label blank = new Label(topComp, SWT.NONE);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = 10;
    blank.setLayoutData(data);
    blank.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

    // Show the message
    Label label = new Label(topComp, SWT.NONE);
    label.setText(message);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = 30;
    data.widthHint = 370;

    Font f = label.getFont();
    FontData[] farr = f.getFontData();
    FontData fd = farr[0];
    fd.setStyle(SWT.BOLD);
    label.setFont(new Font(Display.getCurrent(), fd));

    label.setLayoutData(data);
    label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

    Label labelSeparator = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
    data = new GridData(GridData.FILL_HORIZONTAL);
    labelSeparator.setLayoutData(data);

    // END TOP COMPONENT

    // START MIDDLE COMPONENT

    Composite restComp = new Composite(container, SWT.NONE);
    data = new GridData(GridData.FILL_BOTH);
    restComp.setLayoutData(data);
    layout = new GridLayout(2, false);
    layout.verticalSpacing = 10;
    restComp.setLayout(layout);

    // Hide welecome screen
    Label labelHideWelcomeScreen = new Label(restComp, SWT.RIGHT);
    labelHideWelcomeScreen.setText(
        Labels.getString("AdvancedSettingsDialog.hideWelcomeScreen")); // $NON-NLS-1$
    labelHideWelcomeScreen.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    buttonHideWelcomeScreen = new Button(restComp, SWT.CHECK);
    buttonHideWelcomeScreen.setSelection(config.getBoolean(Config.HIDE_WELCOME_SCREEN));

    // batch size
    Label labelBatch = new Label(restComp, SWT.RIGHT);
    labelBatch.setText(Labels.getString("AdvancedSettingsDialog.batchSize")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelBatch.setLayoutData(data);

    textBatch = new Text(restComp, SWT.BORDER);
    textBatch.setText(config.getString(Config.LOAD_BATCH_SIZE));
    textBatch.setTextLimit(8);
    textBatch.addVerifyListener(
        new VerifyListener() {
          @Override
          public void verifyText(VerifyEvent event) {
            event.doit =
                Character.isISOControl(event.character) || Character.isDigit(event.character);
          }
        });
    data = new GridData();
    data.widthHint = 50;
    textBatch.setLayoutData(data);

    // insert Nulls
    Label labelNulls = new Label(restComp, SWT.RIGHT);
    labelNulls.setText(Labels.getString("AdvancedSettingsDialog.insertNulls")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelNulls.setLayoutData(data);
    buttonNulls = new Button(restComp, SWT.CHECK);
    buttonNulls.setSelection(config.getBoolean(Config.INSERT_NULLS));

    // assignment rules
    Label labelRule = new Label(restComp, SWT.RIGHT);
    labelRule.setText(Labels.getString("AdvancedSettingsDialog.assignmentRule")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelRule.setLayoutData(data);

    textRule = new Text(restComp, SWT.BORDER);
    textRule.setTextLimit(18);
    data = new GridData();
    data.widthHint = 115;
    textRule.setLayoutData(data);
    textRule.setText(config.getString(Config.ASSIGNMENT_RULE));

    // endpoint
    Label labelEndpoint = new Label(restComp, SWT.RIGHT);
    labelEndpoint.setText(Labels.getString("AdvancedSettingsDialog.serverURL")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelEndpoint.setLayoutData(data);

    textEndpoint = new Text(restComp, SWT.BORDER);
    data = new GridData();
    data.widthHint = 250;
    textEndpoint.setLayoutData(data);
    String endpoint = config.getString(Config.ENDPOINT);
    if ("".equals(endpoint)) { // $NON-NLS-1$
      endpoint = defaultServer;
    }

    textEndpoint.setText(endpoint);

    // reset url on login
    Label labelResetUrl = new Label(restComp, SWT.RIGHT);
    labelResetUrl.setText(
        Labels.getString("AdvancedSettingsDialog.resetUrlOnLogin")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelResetUrl.setLayoutData(data);
    buttonResetUrl = new Button(restComp, SWT.CHECK);
    buttonResetUrl.setSelection(config.getBoolean(Config.RESET_URL_ON_LOGIN));

    // insert compression
    Label labelCompression = new Label(restComp, SWT.RIGHT);
    labelCompression.setText(Labels.getString("AdvancedSettingsDialog.compression")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelCompression.setLayoutData(data);
    buttonCompression = new Button(restComp, SWT.CHECK);
    buttonCompression.setSelection(config.getBoolean(Config.NO_COMPRESSION));

    // timeout size
    Label labelTimeout = new Label(restComp, SWT.RIGHT);
    labelTimeout.setText(Labels.getString("AdvancedSettingsDialog.timeout")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelTimeout.setLayoutData(data);

    textTimeout = new Text(restComp, SWT.BORDER);
    textTimeout.setTextLimit(4);
    textTimeout.setText(config.getString(Config.TIMEOUT_SECS));
    textTimeout.addVerifyListener(
        new VerifyListener() {
          @Override
          public void verifyText(VerifyEvent event) {
            event.doit =
                Character.isISOControl(event.character) || Character.isDigit(event.character);
          }
        });
    data = new GridData();
    data.widthHint = 30;
    textTimeout.setLayoutData(data);

    // extraction batch size
    Label labelQueryBatch = new Label(restComp, SWT.RIGHT);
    labelQueryBatch.setText(Labels.getString("ExtractionInputDialog.querySize")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelQueryBatch.setLayoutData(data);

    textQueryBatch = new Text(restComp, SWT.BORDER);
    textQueryBatch.setText(config.getString(Config.EXTRACT_REQUEST_SIZE));
    textQueryBatch.setTextLimit(4);
    textQueryBatch.addVerifyListener(
        new VerifyListener() {
          @Override
          public void verifyText(VerifyEvent event) {
            event.doit =
                Character.isISOControl(event.character) || Character.isDigit(event.character);
          }
        });
    data = new GridData();
    data.widthHint = 30;
    textQueryBatch.setLayoutData(data);

    // enable/disable output of success file for extracts
    Label labelOutputExtractStatus = new Label(restComp, SWT.RIGHT);
    labelOutputExtractStatus.setText(
        Labels.getString("AdvancedSettingsDialog.outputExtractStatus")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelOutputExtractStatus.setLayoutData(data);

    buttonOutputExtractStatus = new Button(restComp, SWT.CHECK);
    buttonOutputExtractStatus.setSelection(config.getBoolean(Config.ENABLE_EXTRACT_STATUS_OUTPUT));

    // utf-8 for loading
    Label labelReadUTF8 = new Label(restComp, SWT.RIGHT);
    labelReadUTF8.setText(Labels.getString("AdvancedSettingsDialog.readUTF8")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelReadUTF8.setLayoutData(data);

    buttonReadUtf8 = new Button(restComp, SWT.CHECK);
    buttonReadUtf8.setSelection(config.getBoolean(Config.READ_UTF8));

    // utf-8 for extraction
    Label labelWriteUTF8 = new Label(restComp, SWT.RIGHT);
    labelWriteUTF8.setText(Labels.getString("AdvancedSettingsDialog.writeUTF8")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelWriteUTF8.setLayoutData(data);

    buttonWriteUtf8 = new Button(restComp, SWT.CHECK);
    buttonWriteUtf8.setSelection(config.getBoolean(Config.WRITE_UTF8));

    // European Dates
    Label labelEuropeanDates = new Label(restComp, SWT.RIGHT);
    labelEuropeanDates.setText(
        Labels.getString("AdvancedSettingsDialog.useEuropeanDateFormat")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelEuropeanDates.setLayoutData(data);

    buttonEuroDates = new Button(restComp, SWT.CHECK);
    buttonEuroDates.setSelection(config.getBoolean(Config.EURO_DATES));

    // Field truncation
    Label labelTruncateFields = new Label(restComp, SWT.RIGHT);
    labelTruncateFields.setText(Labels.getString("AdvancedSettingsDialog.allowFieldTruncation"));
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelTruncateFields.setLayoutData(data);

    buttonTruncateFields = new Button(restComp, SWT.CHECK);
    buttonTruncateFields.setSelection(config.getBoolean(Config.TRUNCATE_FIELDS));

    Label labelCsvCommand = new Label(restComp, SWT.RIGHT);
    labelCsvCommand.setText(Labels.getString("AdvancedSettingsDialog.useCommaAsCsvDelimiter"));
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelCsvCommand.setLayoutData(data);
    buttonCsvComma = new Button(restComp, SWT.CHECK);
    buttonCsvComma.setSelection(config.getBoolean(Config.CSV_DELIMETER_COMMA));

    Label labelTabCommand = new Label(restComp, SWT.RIGHT);
    labelTabCommand.setText(Labels.getString("AdvancedSettingsDialog.useTabAsCsvDelimiter"));
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelTabCommand.setLayoutData(data);
    buttonCsvTab = new Button(restComp, SWT.CHECK);
    buttonCsvTab.setSelection(config.getBoolean(Config.CSV_DELIMETER_TAB));

    Label labelOtherCommand = new Label(restComp, SWT.RIGHT);
    labelOtherCommand.setText(Labels.getString("AdvancedSettingsDialog.useOtherAsCsvDelimiter"));
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelOtherCommand.setLayoutData(data);
    buttonCsvOther = new Button(restComp, SWT.CHECK);
    buttonCsvOther.setSelection(config.getBoolean(Config.CSV_DELIMETER_OTHER));

    Label labelOtherDelimiterValue = new Label(restComp, SWT.RIGHT);
    labelOtherDelimiterValue.setText(
        Labels.getString("AdvancedSettingsDialog.csvOtherDelimiterValue"));
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelOtherDelimiterValue.setLayoutData(data);
    textSplitterValue = new Text(restComp, SWT.BORDER);
    textSplitterValue.setText(config.getString(Config.CSV_DELIMETER_OTHER_VALUE));
    data = new GridData();
    data.widthHint = 25;
    textSplitterValue.setLayoutData(data);

    // Enable Bulk API Setting
    Label labelUseBulkApi = new Label(restComp, SWT.RIGHT);
    labelUseBulkApi.setText(Labels.getString("AdvancedSettingsDialog.useBulkApi")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelUseBulkApi.setLayoutData(data);

    boolean useBulkAPI = config.getBoolean(Config.BULK_API_ENABLED);
    buttonUseBulkApi = new Button(restComp, SWT.CHECK);
    buttonUseBulkApi.setSelection(useBulkAPI);
    buttonUseBulkApi.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            super.widgetSelected(e);
            boolean enabled = buttonUseBulkApi.getSelection();
            // update batch size when this setting changes
            int newDefaultBatchSize = controller.getConfig().getDefaultBatchSize(enabled);
            logger.info("Setting batch size to " + newDefaultBatchSize);
            textBatch.setText(String.valueOf(newDefaultBatchSize));
            // make sure the appropriate check boxes are enabled or disabled
            initBulkApiSetting(enabled);
          }
        });

    // Bulk API serial concurrency mode setting
    Label labelBulkApiSerialMode = new Label(restComp, SWT.RIGHT);
    labelBulkApiSerialMode.setText(
        Labels.getString("AdvancedSettingsDialog.bulkApiSerialMode")); // $NON-NLS-1$
    labelBulkApiSerialMode.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    buttonBulkApiSerialMode = new Button(restComp, SWT.CHECK);
    buttonBulkApiSerialMode.setSelection(config.getBoolean(Config.BULK_API_SERIAL_MODE));
    buttonBulkApiSerialMode.setEnabled(useBulkAPI);

    // Bulk API serial concurrency mode setting
    Label labelBulkApiZipContent = new Label(restComp, SWT.RIGHT);
    labelBulkApiZipContent.setText(
        Labels.getString("AdvancedSettingsDialog.bulkApiZipContent")); // $NON-NLS-1$
    labelBulkApiZipContent.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

    buttonBulkApiZipContent = new Button(restComp, SWT.CHECK);
    buttonBulkApiZipContent.setSelection(config.getBoolean(Config.BULK_API_SERIAL_MODE));
    buttonBulkApiZipContent.setEnabled(useBulkAPI);
    // timezone
    textTimezone =
        createTextInput(
            restComp,
            "AdvancedSettingsDialog.timezone",
            Config.TIMEZONE,
            TimeZone.getDefault().getID(),
            200);

    // proxy Host
    Label labelProxyHost = new Label(restComp, SWT.RIGHT);
    labelProxyHost.setText(Labels.getString("AdvancedSettingsDialog.proxyHost")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelProxyHost.setLayoutData(data);

    textProxyHost = new Text(restComp, SWT.BORDER);
    textProxyHost.setText(config.getString(Config.PROXY_HOST));
    data = new GridData();
    data.widthHint = 250;
    textProxyHost.setLayoutData(data);

    // Proxy Port
    Label labelProxyPort = new Label(restComp, SWT.RIGHT);
    labelProxyPort.setText(Labels.getString("AdvancedSettingsDialog.proxyPort")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelProxyPort.setLayoutData(data);

    textProxyPort = new Text(restComp, SWT.BORDER);
    textProxyPort.setText(config.getString(Config.PROXY_PORT));
    textProxyPort.setTextLimit(4);
    textProxyPort.addVerifyListener(
        new VerifyListener() {
          @Override
          public void verifyText(VerifyEvent event) {
            event.doit =
                Character.isISOControl(event.character) || Character.isDigit(event.character);
          }
        });
    data = new GridData();
    data.widthHint = 25;
    textProxyPort.setLayoutData(data);

    // Proxy Username
    Label labelProxyUsername = new Label(restComp, SWT.RIGHT);
    labelProxyUsername.setText(Labels.getString("AdvancedSettingsDialog.proxyUser")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelProxyUsername.setLayoutData(data);

    textProxyUsername = new Text(restComp, SWT.BORDER);
    textProxyUsername.setText(config.getString(Config.PROXY_USERNAME));
    data = new GridData();
    data.widthHint = 120;
    textProxyUsername.setLayoutData(data);

    // Proxy Password
    Label labelProxyPassword = new Label(restComp, SWT.RIGHT);
    labelProxyPassword.setText(
        Labels.getString("AdvancedSettingsDialog.proxyPassword")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelProxyPassword.setLayoutData(data);

    textProxyPassword = new Text(restComp, SWT.BORDER | SWT.PASSWORD);
    textProxyPassword.setText(config.getString(Config.PROXY_PASSWORD));
    data = new GridData();
    data.widthHint = 120;
    textProxyPassword.setLayoutData(data);

    // proxy NTLM domain
    Label labelProxyNtlmDomain = new Label(restComp, SWT.RIGHT);
    labelProxyNtlmDomain.setText(
        Labels.getString("AdvancedSettingsDialog.proxyNtlmDomain")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelProxyNtlmDomain.setLayoutData(data);

    textProxyNtlmDomain = new Text(restComp, SWT.BORDER);
    textProxyNtlmDomain.setText(config.getString(Config.PROXY_NTLM_DOMAIN));
    data = new GridData();
    data.widthHint = 250;
    textProxyNtlmDomain.setLayoutData(data);

    //////////////////////////////////////////////////
    // Row to start At

    Label blankAgain = new Label(restComp, SWT.NONE);
    data = new GridData();
    data.horizontalSpan = 2;
    blankAgain.setLayoutData(data);

    // Row to start AT
    Label labelLastRow = new Label(restComp, SWT.NONE);

    String lastBatch = controller.getConfig().getString(LastRun.LAST_LOAD_BATCH_ROW);
    if (lastBatch.equals("")) { // $NON-NLS-1$
      lastBatch = "0"; // $NON-NLS-1$
    }

    labelLastRow.setText(
        Labels.getFormattedString("AdvancedSettingsDialog.lastBatch", lastBatch)); // $NON-NLS-1$
    data = new GridData();
    data.horizontalSpan = 2;
    labelLastRow.setLayoutData(data);

    Label labelRowToStart = new Label(restComp, SWT.RIGHT);
    labelRowToStart.setText(Labels.getString("AdvancedSettingsDialog.startRow")); // $NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    labelRowToStart.setLayoutData(data);

    textRowToStart = new Text(restComp, SWT.BORDER);
    textRowToStart.setText(config.getString(Config.LOAD_ROW_TO_START_AT));
    data = new GridData();
    data.widthHint = 75;
    textRowToStart.setLayoutData(data);
    textRowToStart.addVerifyListener(
        new VerifyListener() {
          @Override
          public void verifyText(VerifyEvent event) {
            event.doit =
                Character.isISOControl(event.character) || Character.isDigit(event.character);
          }
        });

    // now that we've created all the buttons, make sure that buttons dependent on the bulk api
    // setting are enabled or disabled appropriately
    initBulkApiSetting(useBulkAPI);

    // the bottow separator
    Label labelSeparatorBottom = new Label(restComp, SWT.SEPARATOR | SWT.HORIZONTAL);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    labelSeparatorBottom.setLayoutData(data);

    // ok cancel buttons
    new Label(restComp, SWT.NONE);

    // END MIDDLE COMPONENT

    // START BOTTOM COMPONENT

    Composite buttonComp = new Composite(restComp, SWT.NONE);
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    buttonComp.setLayoutData(data);
    buttonComp.setLayout(new GridLayout(2, false));

    // Create the OK button and add a handler
    // so that pressing it will set input
    // to the entered value
    Button ok = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
    ok.setText(Labels.getString("UI.ok")); // $NON-NLS-1$
    ok.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            Config config = controller.getConfig();

            // set the configValues
            config.setValue(Config.HIDE_WELCOME_SCREEN, buttonHideWelcomeScreen.getSelection());
            config.setValue(Config.INSERT_NULLS, buttonNulls.getSelection());
            config.setValue(Config.LOAD_BATCH_SIZE, textBatch.getText());
            if (!buttonCsvComma.getSelection()
                && !buttonCsvTab.getSelection()
                && (!buttonCsvOther.getSelection()
                    || textSplitterValue.getText() == null
                    || textSplitterValue.getText().length() == 0)) {
              return;
            }
            config.setValue(Config.CSV_DELIMETER_OTHER_VALUE, textSplitterValue.getText());
            config.setValue(Config.CSV_DELIMETER_COMMA, buttonCsvComma.getSelection());
            config.setValue(Config.CSV_DELIMETER_TAB, buttonCsvTab.getSelection());
            config.setValue(Config.CSV_DELIMETER_OTHER, buttonCsvOther.getSelection());

            config.setValue(Config.EXTRACT_REQUEST_SIZE, textQueryBatch.getText());
            config.setValue(Config.ENDPOINT, textEndpoint.getText());
            config.setValue(Config.ASSIGNMENT_RULE, textRule.getText());
            config.setValue(Config.LOAD_ROW_TO_START_AT, textRowToStart.getText());
            config.setValue(Config.RESET_URL_ON_LOGIN, buttonResetUrl.getSelection());
            config.setValue(Config.NO_COMPRESSION, buttonCompression.getSelection());
            config.setValue(Config.TRUNCATE_FIELDS, buttonTruncateFields.getSelection());
            config.setValue(Config.TIMEOUT_SECS, textTimeout.getText());
            config.setValue(
                Config.ENABLE_EXTRACT_STATUS_OUTPUT, buttonOutputExtractStatus.getSelection());
            config.setValue(Config.READ_UTF8, buttonReadUtf8.getSelection());
            config.setValue(Config.WRITE_UTF8, buttonWriteUtf8.getSelection());
            config.setValue(Config.EURO_DATES, buttonEuroDates.getSelection());
            config.setValue(Config.TIMEZONE, textTimezone.getText());
            config.setValue(Config.PROXY_HOST, textProxyHost.getText());
            config.setValue(Config.PROXY_PASSWORD, textProxyPassword.getText());
            config.setValue(Config.PROXY_PORT, textProxyPort.getText());
            config.setValue(Config.PROXY_USERNAME, textProxyUsername.getText());
            config.setValue(Config.PROXY_NTLM_DOMAIN, textProxyNtlmDomain.getText());
            config.setValue(Config.BULK_API_ENABLED, buttonUseBulkApi.getSelection());
            config.setValue(Config.BULK_API_SERIAL_MODE, buttonBulkApiSerialMode.getSelection());
            config.setValue(Config.BULK_API_ZIP_CONTENT, buttonBulkApiZipContent.getSelection());

            controller.saveConfig();
            controller.logout();

            input = Labels.getString("UI.ok"); // $NON-NLS-1$
            shell.close();
          }
        });
    data = new GridData();
    data.widthHint = 75;
    ok.setLayoutData(data);

    // Create the cancel button and add a handler
    // so that pressing it will set input to null
    Button cancel = new Button(buttonComp, SWT.PUSH | SWT.FLAT);
    cancel.setText(Labels.getString("UI.cancel")); // $NON-NLS-1$
    cancel.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            input = null;
            shell.close();
          }
        });

    // END BOTTOM COMPONENT

    data = new GridData();
    data.widthHint = 75;
    cancel.setLayoutData(data);

    // Set the OK button as the default, so
    // user can type input and press Enter
    // to dismiss
    shell.setDefaultButton(ok);

    // Set the child as the scrolled content of the ScrolledComposite
    sc.setContent(container);

    // Set the minimum size
    sc.setMinSize(768, 1024);

    // Expand both horizontally and vertically
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
  }
コード例 #19
0
  private Control createArgumentsGroup(Composite parent) {
    Composite container = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_BOTH);

    SWTFactory.createWrapLabel(container, PDEUIMessages.JavaArgumentsTab_description, 1);

    Group programGroup =
        SWTFactory.createGroup(
            container,
            PDEUIMessages.JavaArgumentsTab_progamArgsGroup,
            1,
            1,
            GridData.FILL_HORIZONTAL);

    fProgramArgs =
        SWTFactory.createText(
            programGroup,
            SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL,
            1,
            200,
            60,
            GridData.FILL_BOTH);
    fProgramArgs.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setProgramArguments(fProgramArgs.getText().trim());
          }
        });

    Composite programButtons =
        SWTFactory.createComposite(programGroup, 1, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0);

    Button programVars =
        SWTFactory.createPushButton(
            programButtons,
            PDEUIMessages.JavaArgumentsTab_programVariables,
            null,
            GridData.HORIZONTAL_ALIGN_END);
    programVars.addSelectionListener(getVariablesListener(fProgramArgs));

    Group vmGroup = new Group(container, SWT.NONE);
    vmGroup.setLayout(new GridLayout(1, false));
    vmGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    vmGroup.setText(PDEUIMessages.JavaArgumentsTab_vmArgsGroup);
    vmGroup.setFont(container.getFont());

    fVMArgs =
        SWTFactory.createText(
            vmGroup,
            SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL,
            1,
            200,
            60,
            GridData.FILL_BOTH);
    fVMArgs.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition().setVMArguments(fVMArgs.getText().trim());
          }
        });

    Composite buttons =
        SWTFactory.createComposite(vmGroup, 2, 1, GridData.HORIZONTAL_ALIGN_END, 0, 0);

    Button vmArgs =
        SWTFactory.createPushButton(
            buttons, PDEUIMessages.JavaArgumentsTab_addVMArgs, null, GridData.HORIZONTAL_ALIGN_END);
    vmArgs.addSelectionListener(getVMArgsListener(fVMArgs));

    Button vmVars =
        SWTFactory.createPushButton(
            buttons,
            PDEUIMessages.JavaArgumentsTab_vmVariables,
            null,
            GridData.HORIZONTAL_ALIGN_END);
    vmVars.addSelectionListener(getVariablesListener(fVMArgs));
    return container;
  }
コード例 #20
0
  private void createJREGroup(Composite container) {
    Group group =
        SWTFactory.createGroup(
            container, PDEUIMessages.EnvironmentBlock_jreTitle, 2, 1, GridData.FILL_HORIZONTAL);

    initializeJREValues();

    SWTFactory.createWrapLabel(group, PDEUIMessages.JRESection_description, 2);

    fDefaultJREButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_defaultJRE, 2);
    fDefaultJREButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateJREWidgets();
            getTargetDefinition().setJREContainer(JavaRuntime.newDefaultJREContainerPath());
          }
        });

    fNamedJREButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_JREName);
    fNamedJREButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateJREWidgets();
            getTargetDefinition()
                .setJREContainer(
                    JavaRuntime.newJREContainerPath(
                        VMUtil.getVMInstall(fNamedJREsCombo.getText())));
          }
        });

    fNamedJREsCombo =
        SWTFactory.createCombo(
            group, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY, 1, VMUtil.getVMInstallNames());
    fNamedJREsCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition()
                .setJREContainer(
                    JavaRuntime.newJREContainerPath(
                        VMUtil.getVMInstall(fNamedJREsCombo.getText())));
          }
        });

    fExecEnvButton = SWTFactory.createRadioButton(group, PDEUIMessages.JRESection_ExecutionEnv);
    fExecEnvButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            updateJREWidgets();
            getTargetDefinition()
                .setJREContainer(
                    JavaRuntime.newJREContainerPath(
                        VMUtil.getExecutionEnvironment(fExecEnvsCombo.getText())));
          }
        });

    fExecEnvsCombo =
        SWTFactory.createCombo(
            group,
            SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY,
            1,
            fExecEnvChoices.toArray(new String[fExecEnvChoices.size()]));
    fExecEnvsCombo.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            getTargetDefinition()
                .setJREContainer(
                    JavaRuntime.newJREContainerPath(
                        VMUtil.getExecutionEnvironment(fExecEnvsCombo.getText())));
          }
        });
  }
コード例 #21
0
  /**
   * This method is called by Spoon when the user opens the settings dialog of the step. It should
   * open the dialog and return only once the dialog has been closed by the user.
   *
   * <p>If the user confirms the dialog, the meta object (passed in the constructor) must be updated
   * to reflect the new step settings. The changed flag of the meta object must reflect whether the
   * step configuration was changed by the dialog.
   *
   * <p>If the user cancels the dialog, the meta object must not be updated, and its changed flag
   * must remain unaltered.
   *
   * <p>The open() method must return the name of the step after the user has confirmed the dialog,
   * or null if the user cancelled the dialog.
   */
  public String open() {

    // store some convenient SWT variables
    Shell parent = getParent();
    Display display = parent.getDisplay();

    // SWT code for preparing the dialog
    shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
    props.setLook(shell);
    setShellImage(shell, meta);

    // Save the value of the changed flag on the meta object. If the user cancels
    // the dialog, it will be restored to this saved value.
    // The "changed" variable is inherited from BaseStepDialog
    changed = meta.hasChanged();

    // The ModifyListener used on all controls. It will update the meta object to
    // indicate that changes are being made.
    ModifyListener lsMod =
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            meta.setChanged();
          }
        };

    // ------------------------------------------------------- //
    // SWT code for building the actual settings dialog        //
    // ------------------------------------------------------- //
    FormLayout formLayout = new FormLayout();
    formLayout.marginWidth = Const.FORM_MARGIN;
    formLayout.marginHeight = Const.FORM_MARGIN;

    shell.setLayout(formLayout);
    shell.setText(BaseMessages.getString(PKG, "UniqueListStep.Shell.Title"));

    int middle = props.getMiddlePct();
    int margin = Const.MARGIN;

    // Stepname line
    wlStepname = new Label(shell, SWT.RIGHT);
    wlStepname.setText(BaseMessages.getString(PKG, "System.Label.StepName"));
    props.setLook(wlStepname);
    fdlStepname = new FormData();
    fdlStepname.left = new FormAttachment(0, 0);
    fdlStepname.right = new FormAttachment(middle, -margin);
    fdlStepname.top = new FormAttachment(0, margin);
    wlStepname.setLayoutData(fdlStepname);

    wStepname = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
    wStepname.setText(stepname);
    props.setLook(wStepname);
    wStepname.addModifyListener(lsMod);
    fdStepname = new FormData();
    fdStepname.left = new FormAttachment(middle, 0);
    fdStepname.top = new FormAttachment(0, margin);
    fdStepname.right = new FormAttachment(100, 0);
    wStepname.setLayoutData(fdStepname);

    // Treat Consecutive Delimiters as One
    //
    wlRemoveBlanks = new Label(shell, SWT.RIGHT);
    wlRemoveBlanks.setText("Treat Consecutive Delims as One");
    wlRemoveBlanks.setToolTipText(
        "Multiple delimiters in a row will be condensed. Essentially removes blank spaces");
    props.setLook(wlRemoveBlanks);
    fdlRemoveBlanks = new FormData();
    fdlRemoveBlanks.left = new FormAttachment(0, 0);
    fdlRemoveBlanks.top = new FormAttachment(wStepname, margin);
    fdlRemoveBlanks.right = new FormAttachment(middle, -margin);
    wlRemoveBlanks.setLayoutData(fdlRemoveBlanks);
    wRemoveBlanks = new Button(shell, SWT.CHECK);
    wRemoveBlanks.setToolTipText(
        "Multiple delimiters in a row will be condensed. Essentially removes blank spaces");
    props.setLook(wRemoveBlanks);
    wRemoveBlanks.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            meta.setChanged();
          }
        });
    fdRemoveBlanks = new FormData();
    fdRemoveBlanks.left = new FormAttachment(middle, 0);
    fdRemoveBlanks.top = new FormAttachment(wStepname, margin);
    fdRemoveBlanks.right = new FormAttachment(100, 0);
    wRemoveBlanks.setLayoutData(fdRemoveBlanks);

    // OK and cancel buttons
    wOK = new Button(shell, SWT.PUSH);
    wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
    wGet = new Button(shell, SWT.PUSH);
    wGet.setText("Get");
    wCancel = new Button(shell, SWT.PUSH);
    wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));

    setButtonPositions(new Button[] {wOK, wGet, wCancel}, margin, null);

    wlGroup = new Label(shell, SWT.NONE);
    wlGroup.setText("Fields");
    props.setLook(wlGroup);
    fdlGroup = new FormData();
    fdlGroup.left = new FormAttachment(0, 0);
    fdlGroup.top = new FormAttachment(wlRemoveBlanks, margin);
    wlGroup.setLayoutData(fdlGroup);

    // Fields
    colinf =
        new ColumnInfo[] {
          new ColumnInfo("Field Name", ColumnInfo.COLUMN_TYPE_CCOMBO, new String[] {""}, false),
          new ColumnInfo("Current Delimiter", ColumnInfo.COLUMN_TYPE_TEXT, false),
          new ColumnInfo("Output Field Name (Optional)", ColumnInfo.COLUMN_TYPE_TEXT, false),
          new ColumnInfo("Output Delimiter (Optional)", ColumnInfo.COLUMN_TYPE_TEXT, false)
        };

    int nrRows = (meta.getSourceFields() != null ? meta.getSourceFields().length : 1);

    wGroup =
        new TableView(
            transMeta,
            shell,
            SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL,
            colinf,
            nrRows,
            lsMod,
            props);

    fdGroup = new FormData();
    fdGroup.left = new FormAttachment(0, 0);
    fdGroup.top = new FormAttachment(wlGroup, margin);
    fdGroup.right = new FormAttachment(100, 0);
    fdGroup.bottom = new FormAttachment(wGet, -margin);
    wGroup.setLayoutData(fdGroup);

    final Runnable runnable =
        new Runnable() {
          public void run() {
            StepMeta stepMeta = transMeta.findStep(stepname);
            if (stepMeta != null) {
              try {
                RowMetaInterface row = transMeta.getPrevStepFields(stepMeta);

                // Remember these fields...
                for (int i = 0; i < row.size(); i++) {
                  inputFields.put(row.getValueMeta(i).getName(), i);
                }
                setComboBoxes();
              } catch (KettleException e) {
                logError(BaseMessages.getString(PKG, "System.Dialog.GetFieldsFailed.Message"));
              }
            }
          }
        };
    new Thread(runnable).start();

    // Add listeners for cancel and OK
    lsCancel =
        new Listener() {
          public void handleEvent(Event e) {
            cancel();
          }
        };
    lsOK =
        new Listener() {
          public void handleEvent(Event e) {
            ok();
          }
        };
    lsGet =
        new Listener() {
          public void handleEvent(Event event) {
            get();
          }
        };

    wCancel.addListener(SWT.Selection, lsCancel);
    wOK.addListener(SWT.Selection, lsOK);
    wGet.addListener(SWT.Selection, lsGet);

    // default listener (for hitting "enter")
    lsDef =
        new SelectionAdapter() {
          public void widgetDefaultSelected(SelectionEvent e) {
            ok();
          }
        };
    wStepname.addSelectionListener(lsDef);

    // Detect X or ALT-F4 or something that kills this window and cancel the dialog properly
    shell.addShellListener(
        new ShellAdapter() {
          public void shellClosed(ShellEvent e) {
            cancel();
          }
        });

    // Set/Restore the dialog size based on last position on screen
    // The setSize() method is inherited from BaseStepDialog
    setSize();

    // populate the dialog with the values from the meta object
    populateDialog();

    // restore the changed flag to original value, as the modify listeners fire during dialog
    // population
    meta.setChanged(changed);

    // open dialog and enter event loop
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }

    // at this point the dialog has closed, so either ok() or cancel() have been executed
    // The "stepname" variable is inherited from BaseStepDialog
    return stepname;
  }
コード例 #22
0
  @Override
  public void createControl(Composite composite) {
    ModifyListener textListener =
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            if (activated) {
              saveAndUpdate();
            }
          }
        };

    settingsGroup = new Composite(composite, SWT.NONE);
    GridLayout gl = new GridLayout(4, false);
    gl.marginHeight = 10;
    gl.marginWidth = 10;
    settingsGroup.setLayout(gl);
    GridData gd = new GridData(GridData.FILL_BOTH);
    settingsGroup.setLayoutData(gd);

    {
      Label urlLabel = new Label(settingsGroup, SWT.NONE);
      urlLabel.setText(GenericMessages.dialog_connection_jdbc_url_);
      gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
      urlLabel.setLayoutData(gd);

      urlText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalSpan = 3;
      gd.grabExcessHorizontalSpace = true;
      // gd.widthHint = 355;
      urlText.setLayoutData(gd);
      urlText.addModifyListener(
          new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent e) {
              site.updateButtons();
            }
          });

      addControlToGroup(GROUP_URL, urlLabel);
      addControlToGroup(GROUP_URL, urlText);
    }
    {
      Label hostLabel = new Label(settingsGroup, SWT.NONE);
      hostLabel.setText(GenericMessages.dialog_connection_host_label);
      hostLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      hostText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      hostText.setLayoutData(gd);
      hostText.addModifyListener(textListener);

      Label portLabel = new Label(settingsGroup, SWT.NONE);
      portLabel.setText(GenericMessages.dialog_connection_port_label);
      portLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      portText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.CENTER);
      gd.widthHint = 60;
      portText.setLayoutData(gd);
      // portText.addVerifyListener(UIUtils.INTEGER_VERIFY_LISTENER);
      portText.addModifyListener(textListener);

      addControlToGroup(GROUP_HOST, hostLabel);
      addControlToGroup(GROUP_HOST, hostText);
      addControlToGroup(GROUP_HOST, portLabel);
      addControlToGroup(GROUP_HOST, portText);
    }

    {
      Label serverLabel = new Label(settingsGroup, SWT.NONE);
      serverLabel.setText(GenericMessages.dialog_connection_server_label);
      serverLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      serverText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      // gd.widthHint = 270;
      serverText.setLayoutData(gd);
      serverText.addModifyListener(textListener);

      Control emptyLabel = createEmptyLabel(settingsGroup, 1);

      addControlToGroup(GROUP_SERVER, serverLabel);
      addControlToGroup(GROUP_SERVER, serverText);
      addControlToGroup(GROUP_SERVER, emptyLabel);
    }

    {
      Label dbLabel = new Label(settingsGroup, SWT.NONE);
      dbLabel.setText(GenericMessages.dialog_connection_database_schema_label);
      dbLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      dbText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      // gd.widthHint = 270;
      // gd.horizontalSpan = 3;
      dbText.setLayoutData(gd);
      dbText.addModifyListener(textListener);

      Control emptyLabel = createEmptyLabel(settingsGroup, 1);

      addControlToGroup(GROUP_DB, dbLabel);
      addControlToGroup(GROUP_DB, dbText);
      addControlToGroup(GROUP_DB, emptyLabel);
    }

    // Path
    {
      Label pathLabel = new Label(settingsGroup, SWT.NONE);
      pathLabel.setText(GenericMessages.dialog_connection_path_label);
      pathLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      pathText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      // gd.grabExcessHorizontalSpace = true;
      // gd.widthHint = 200;
      gd.horizontalSpan = 2;
      pathText.setLayoutData(gd);
      pathText.addModifyListener(textListener);
      pathText.addModifyListener(
          new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent e) {
              updateCreateButton(site.getDriver());
            }
          });

      Composite buttonsPanel = new Composite(settingsGroup, SWT.NONE);
      gl = new GridLayout(2, true);
      gl.marginHeight = 0;
      gl.marginWidth = 0;
      buttonsPanel.setLayout(gl);
      gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
      gd.widthHint = 150;
      buttonsPanel.setLayoutData(gd);

      Button browseButton = new Button(buttonsPanel, SWT.PUSH);
      browseButton.setText(GenericMessages.dialog_connection_browse_button);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      browseButton.setLayoutData(gd);
      browseButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              if (metaURL.getAvailableProperties().contains(DriverDescriptor.PROP_FILE)) {
                FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.SINGLE);
                dialog.setFileName(pathText.getText());
                dialog.setText(GenericMessages.dialog_connection_db_file_chooser_text);
                String file = dialog.open();
                if (file != null) {
                  pathText.setText(file);
                }
              } else {
                DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.NONE);
                final String curPath = pathText.getText();
                File curFolder = new File(curPath);
                if (curFolder.exists()) {
                  if (curFolder.isDirectory()) {
                    dialog.setFilterPath(curFolder.getAbsolutePath());
                  } else {
                    dialog.setFilterPath(curFolder.getParentFile().getAbsolutePath());
                  }
                }
                dialog.setText(GenericMessages.dialog_connection_db_folder_chooser_text);
                dialog.setMessage(GenericMessages.dialog_connection_db_folder_chooser_message);
                String folder = dialog.open();
                if (folder != null) {
                  pathText.setText(folder);
                }
              }
            }
          });

      createButton = new Button(buttonsPanel, SWT.PUSH);
      createButton.setText("Create");
      createButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      createButton.setEnabled(false);
      createButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              createEmbeddedDatabase();
            }
          });

      addControlToGroup(GROUP_PATH, pathLabel);
      addControlToGroup(GROUP_PATH, pathText);
      addControlToGroup(GROUP_PATH, buttonsPanel);
    }

    {
      Label userNameLabel = new Label(settingsGroup, SWT.NONE);
      userNameLabel.setText(GenericMessages.dialog_connection_user_name_label);
      userNameLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      userNameText = new Text(settingsGroup, SWT.BORDER);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      userNameText.setLayoutData(gd);
      userNameText.addModifyListener(textListener);

      Control emptyLabel = createEmptyLabel(settingsGroup, 2);

      Label passwordLabel = new Label(settingsGroup, SWT.NONE);
      passwordLabel.setText(GenericMessages.dialog_connection_password_label);
      passwordLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

      passwordText = new Text(settingsGroup, SWT.BORDER | SWT.PASSWORD);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.grabExcessHorizontalSpace = true;
      passwordText.setLayoutData(gd);
      passwordText.addModifyListener(textListener);

      addControlToGroup(GROUP_LOGIN, userNameLabel);
      addControlToGroup(GROUP_LOGIN, userNameText);
      addControlToGroup(GROUP_LOGIN, emptyLabel);
      addControlToGroup(GROUP_LOGIN, passwordLabel);
      addControlToGroup(GROUP_LOGIN, passwordText);
    }

    createDriverPanel(settingsGroup);
    setControl(settingsGroup);
  }
コード例 #23
0
    public void init() {
      GridLayout lay = new GridLayout();
      lay.numColumns = 2;
      lay.makeColumnsEqualWidth = true;

      this.setLayout(lay);

      addedEntities = new ArrayList<EntityHolder>();

      entityList = new List(this, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.HORIZONTAL);
      GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
      gridData.verticalSpan = 1;
      gridData.horizontalSpan = 2;
      entityList.setLayoutData(gridData);

      // Add Entity Button

      addButton = new Button(this, SWT.NONE);
      addButton.setText("Add...");
      gridData = new GridData(GridData.END, GridData.BEGINNING, true, false);
      gridData.minimumWidth = 50;
      gridData.horizontalIndent = 5;
      addButton.setLayoutData(gridData);
      addButton.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent arg0) {
              // new addEntityDialog
              AddEntityDialog addEntityDialog = new AddEntityDialog(new Shell(), allEntities);

              // open dialog
              boolean addPressed = addEntityDialog.open();

              // if add button is pressed
              if (addPressed) {
                // for each selected entity
                for (EntityHolder entity : addEntityDialog.getSelectedEntities()) {
                  // check if entity has been added before
                  if (!addedEntities.contains(entity)) {
                    // add entity keyName to List
                    entityList.add(entity.getName());

                    // add entity to addedEntities ArrayList
                    addedEntities.add(entity);
                  }
                }
              }
            }
          });

      // Remove Entity Button

      removeButton = new Button(this, SWT.NONE);
      removeButton.setText("Remove");
      gridData = new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false);
      gridData.horizontalIndent = 5;
      gridData.minimumWidth = 50;
      removeButton.setLayoutData(gridData);
      removeButton.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent arg0) {
              String[] selectionResult = entityList.getSelection();

              // for each selected string
              for (String selected : selectionResult) {
                // search among all addedEntities
                for (int j = 0; j < addedEntities.size(); j++) {
                  EntityHolder entity = addedEntities.get(j);

                  // if corresponding entity is found
                  if (selected != null && selected.equals(entity.getName())) {
                    // remove entity from addedEntities ArrayList
                    addedEntities.remove(j);

                    // remove entity keyName from from List
                    entityList.remove(selected);
                  }
                }
              }
            }
          });
    }
コード例 #24
0
  /**
   * Creates the buttons in this group inside a new composite
   *
   * @param parent parent composite
   * @param toolkit toolkit to give form style or <code>null</code> for dialog style
   */
  private void createButtons(Composite parent, FormToolkit toolkit) {
    if (toolkit != null) {
      Composite buttonComp = toolkit.createComposite(parent);
      GridLayout layout = new GridLayout();
      layout.marginWidth = layout.marginHeight = 0;
      buttonComp.setLayout(layout);
      buttonComp.setLayoutData(new GridData(GridData.FILL_VERTICAL));

      fSelectButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_0, SWT.PUSH);
      fSelectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      fDeselectButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_1, SWT.PUSH);
      fDeselectButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      Label emptySpace = new Label(buttonComp, SWT.NONE);
      GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fSelectAllButton = toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_2, SWT.PUSH);
      fSelectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      fDeselectAllButton =
          toolkit.createButton(buttonComp, Messages.IncludedBundlesTree_3, SWT.PUSH);
      fDeselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      emptySpace = new Label(buttonComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fSelectRequiredButton =
          toolkit.createButton(buttonComp, Messages.TargetContentsGroup_4, SWT.PUSH);
      fSelectRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

      Composite filterComp = toolkit.createComposite(buttonComp);
      layout = new GridLayout();
      layout.marginWidth = layout.marginHeight = 0;
      filterComp.setLayout(layout);
      filterComp.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true));

      fModeLabel = toolkit.createLabel(filterComp, Messages.TargetContentsGroup_ManageUsing);

      fPluginModeButton =
          toolkit.createButton(filterComp, Messages.TargetContentsGroup_PluginMode, SWT.RADIO);
      fPluginModeButton.setSelection(true);
      fFeaureModeButton =
          toolkit.createButton(filterComp, Messages.TargetContentsGroup_FeatureMode, SWT.RADIO);
      fFeaureModeButton.setSelection(true);

      emptySpace = new Label(filterComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fShowLabel = toolkit.createLabel(filterComp, Messages.BundleContainerTable_9);

      fShowPluginsButton =
          toolkit.createButton(filterComp, Messages.BundleContainerTable_14, SWT.CHECK);
      fShowPluginsButton.setSelection(true);
      fShowSourceButton =
          toolkit.createButton(filterComp, Messages.BundleContainerTable_15, SWT.CHECK);
      fShowSourceButton.setSelection(true);

      emptySpace = new Label(filterComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fGroupLabel = toolkit.createLabel(filterComp, Messages.TargetContentsGroup_0);

      fGroupComboPart = new ComboPart();
      fGroupComboPart.createControl(filterComp, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalIndent = 10;
      fGroupComboPart.getControl().setLayoutData(gd);
      fGroupComboPart.setItems(
          new String[] {
            Messages.TargetContentsGroup_1,
            Messages.TargetContentsGroup_2,
            Messages.TargetContentsGroup_3
          });
      fGroupComboPart.setVisibleItemCount(30);
      fGroupComboPart.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
              handleGroupChange();
            }
          });
      fGroupComboPart.select(0);

    } else {
      Composite buttonComp = SWTFactory.createComposite(parent, 1, 1, GridData.FILL_VERTICAL, 0, 0);
      fSelectButton = SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_0, null);
      fDeselectButton =
          SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_1, null);

      Label emptySpace = new Label(buttonComp, SWT.NONE);
      GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fSelectAllButton =
          SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_2, null);
      fDeselectAllButton =
          SWTFactory.createPushButton(buttonComp, Messages.IncludedBundlesTree_3, null);

      emptySpace = new Label(buttonComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fSelectRequiredButton =
          SWTFactory.createPushButton(buttonComp, Messages.TargetContentsGroup_4, null);

      Composite filterComp = SWTFactory.createComposite(buttonComp, 1, 1, SWT.NONE, 0, 0);
      filterComp.setLayoutData(new GridData(SWT.LEFT, SWT.BOTTOM, true, true));

      fModeLabel = SWTFactory.createLabel(filterComp, Messages.TargetContentsGroup_ManageUsing, 1);

      fPluginModeButton =
          SWTFactory.createRadioButton(filterComp, Messages.TargetContentsGroup_PluginMode);
      fFeaureModeButton =
          SWTFactory.createRadioButton(filterComp, Messages.TargetContentsGroup_FeatureMode);

      emptySpace = new Label(filterComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fShowLabel = SWTFactory.createLabel(filterComp, Messages.BundleContainerTable_9, 1);

      fShowPluginsButton =
          SWTFactory.createCheckButton(filterComp, Messages.BundleContainerTable_14, null, true, 1);
      fShowSourceButton =
          SWTFactory.createCheckButton(filterComp, Messages.BundleContainerTable_15, null, true, 1);

      emptySpace = new Label(filterComp, SWT.NONE);
      gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      gd.widthHint = gd.heightHint = 5;
      emptySpace.setLayoutData(gd);

      fGroupLabel = SWTFactory.createLabel(filterComp, Messages.TargetContentsGroup_0, 1);
      fGroupCombo =
          SWTFactory.createCombo(
              filterComp,
              SWT.READ_ONLY,
              1,
              new String[] {
                Messages.TargetContentsGroup_1,
                Messages.TargetContentsGroup_2,
                Messages.TargetContentsGroup_3
              });
      gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalIndent = 10;
      fGroupCombo.setLayoutData(gd);
      fGroupCombo.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
              handleGroupChange();
            }
          });
      fGroupCombo.select(0);
    }

    fSelectButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fTree.getSelection().isEmpty()) {
              Object[] selected = ((IStructuredSelection) fTree.getSelection()).toArray();
              for (int i = 0; i < selected.length; i++) {
                fTree.setChecked(selected[i], true);
              }
              saveIncludedBundleState();
              contentChanged();
              updateButtons();
              fTree.update(
                  fTargetDefinition.getBundleContainers(),
                  new String[] {IBasicPropertyConstants.P_TEXT});
            }
          }
        });

    fDeselectButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fTree.getSelection().isEmpty()) {
              Object[] selected = ((IStructuredSelection) fTree.getSelection()).toArray();
              for (int i = 0; i < selected.length; i++) {
                fTree.setChecked(selected[i], false);
              }
              saveIncludedBundleState();
              contentChanged();
              updateButtons();
              fTree.update(
                  fTargetDefinition.getBundleContainers(),
                  new String[] {IBasicPropertyConstants.P_TEXT});
            }
          }
        });

    fSelectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fTree.setAllChecked(true);
            saveIncludedBundleState();
            contentChanged();
            updateButtons();
            fTree.update(
                fTargetDefinition.getBundleContainers(),
                new String[] {IBasicPropertyConstants.P_TEXT});
          }
        });

    fDeselectAllButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            fTree.setAllChecked(false);
            saveIncludedBundleState();
            contentChanged();
            updateButtons();
            fTree.update(
                fTargetDefinition.getBundleContainers(),
                new String[] {IBasicPropertyConstants.P_TEXT});
          }
        });

    fSelectRequiredButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            Object[] allChecked = fTree.getCheckedLeafElements();
            Object[] required = null;
            if (fFeaureModeButton.getSelection()) {
              required = getRequiredFeatures(fTargetDefinition.getAllFeatures(), allChecked);
            } else {
              required = getRequiredPlugins(fAllBundles, allChecked);
            }
            for (int i = 0; i < required.length; i++) {
              fTree.setChecked(required[i], true);
            }
            saveIncludedBundleState();
            contentChanged();
            updateButtons();
            fTree.update(
                fTargetDefinition.getBundleContainers(),
                new String[] {IBasicPropertyConstants.P_TEXT});
          }
        });

    fPluginModeButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            // Moving from feature based filtering to plug-in based, need to update storage
            ((TargetDefinition) fTargetDefinition).setUIMode(TargetDefinition.MODE_PLUGIN);
            contentChanged();
            fTargetDefinition.setIncluded(null);

            fGroupLabel.setEnabled(true);
            if (fGroupCombo != null) {
              fGroupCombo.setEnabled(true);
            } else {
              fGroupComboPart.getControl().setEnabled(true);
            }

            fTree.getControl().setRedraw(false);
            fTree.refresh(false);
            fTree.expandAll();
            updateCheckState();
            updateButtons();
            fTree.getControl().setRedraw(true);
          }
        });
    fPluginModeButton.setSelection(true);
    GridData gd = new GridData();
    gd.horizontalIndent = 10;
    fPluginModeButton.setLayoutData(gd);

    fFeaureModeButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            // Moving from plug-in based filtering to feature based, need to update storage
            ((TargetDefinition) fTargetDefinition).setUIMode(TargetDefinition.MODE_FEATURE);
            contentChanged();
            fTargetDefinition.setIncluded(null);

            fGroupLabel.setEnabled(false);
            if (fGroupCombo != null) {
              fGroupCombo.setEnabled(false);
            } else {
              fGroupComboPart.getControl().setEnabled(false);
            }

            fTree.getControl().setRedraw(false);
            fTree.refresh(false);
            fTree.expandAll();
            updateCheckState();
            updateButtons();
            fTree.getControl().setRedraw(true);
          }
        });
    fFeaureModeButton.setSelection(false);
    gd = new GridData();
    gd.horizontalIndent = 10;
    fFeaureModeButton.setLayoutData(gd);

    fShowPluginsButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fShowPluginsButton.getSelection()) {
              fTree.addFilter(fPluginFilter);
            } else {
              fTree.removeFilter(fPluginFilter);
              fTree.expandAll();
              updateCheckState();
            }
            updateButtons();
          }
        });
    fShowPluginsButton.setSelection(true);
    gd = new GridData();
    gd.horizontalIndent = 10;
    fShowPluginsButton.setLayoutData(gd);

    fShowSourceButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            if (!fShowSourceButton.getSelection()) {
              fTree.addFilter(fSourceFilter);
            } else {
              fTree.removeFilter(fSourceFilter);
              fTree.expandAll();
              updateCheckState();
            }
            updateButtons();
          }
        });
    fShowSourceButton.setSelection(true);
    gd = new GridData();
    gd.horizontalIndent = 10;
    fShowSourceButton.setLayoutData(gd);
  }
コード例 #25
0
  protected void createExeCancDefGroup(final QueryOptionsPack opt, int horizontalSpan) {
    // Group for execute, cancel and default buttons

    exeCancelDefaultGroup = new Group(shell, SWT.NONE);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
    gridData.horizontalSpan = horizontalSpan;
    exeCancelDefaultGroup.setLayoutData(gridData);
    exeCancelDefaultGroup.setLayout(new GridLayout(4, true));

    if (forSIF) {
      sifTypeButton = new Button(exeCancelDefaultGroup, SWT.NONE);
      sifTypeButton.setBackground(new Color(null, 255, 255, 255));
      gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
      sifTypeButton.setLayoutData(gridData);
      sifTypeButton.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent arg0) {
              ArrayList<SIFType> selection = new ArrayList<SIFType>(selectedTypes);
              ExportToSIFL3Dialog dialog =
                  new ExportToSIFL3Dialog(
                      main.getShell(),
                      org.gvt.model.sifl3.SIFGraph.getPossibleRuleTypes(),
                      selection);

              if (dialog.open()) {
                selectedTypes.clear();
                selectedTypes.addAll(selection);
                updateSIFTypeButtonText();
              }
            }
          });
      if (selectedTypes == null) selectedTypes = new ArrayList<SIFType>();
      updateSIFTypeButtonText();
    }

    // Execute Button

    executeButton = new Button(exeCancelDefaultGroup, SWT.NONE);
    executeButton.setText("Execute");
    gridData = new GridData(GridData.END, GridData.CENTER, true, false);
    executeButton.setLayoutData(gridData);
    executeButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent arg0) {
            // if no entity is added, show error
            if ((sourceElg != null && getAddedSourceEntities().isEmpty())
                || (sourceST != null && sourceST.getSymbols().isEmpty())) {
              MessageDialog.openError(main.getShell(), "Error!", "Add Source Molecule!");

              return;
            }
            if ((targetElg != null && getAddedTargetEntities().isEmpty())
                || (targetST != null && targetST.getSymbols().isEmpty())) {
              MessageDialog.openError(main.getShell(), "Error!", "Add Target Molecule!");

              return;
            }

            if (forSIF && selectedTypes.isEmpty()) {
              MessageDialog.openError(
                  main.getShell(), "Error!", "Please select at least one interaction type.");

              return;
            }

            // Check for unknown gene symbols
            java.util.List<String> unkwn = getUnknownSymbols();
            if (!unkwn.isEmpty()) {
              String s = "";
              for (String us : unkwn) s += " " + us;

              MessageDialog.openError(
                  main.getShell(),
                  "Error!",
                  "Unknown symbol" + (unkwn.size() > 1 ? "s" : "") + ": " + s);

              return;
            }

            // store values in dialog to optionsPack
            storeValuesToOptionsPack(opt);

            // execute is selected
            opt.setCancel(false);

            shell.close();
          }
        });

    // Cancel Button

    cancelButton = new Button(exeCancelDefaultGroup, SWT.NONE);
    gridData = new GridData(GridData.CENTER, GridData.CENTER, true, false);
    createCancelButton(gridData);

    // Default Button

    defaultButton = new Button(exeCancelDefaultGroup, SWT.NONE);
    defaultButton.setText("Default");
    gridData = new GridData(GridData.BEGINNING, GridData.CENTER, true, false);
    defaultButton.setLayoutData(gridData);
    defaultButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent arg0) {
            // set default values of dialog
            setDefaultQueryDialogOptions();
          }
        });
  }
コード例 #26
0
  /** @see PreferencePage#createContents(Composite) */
  protected Control createContents(Composite ancestor) {
    Composite parent = new Composite(ancestor, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    parent.setLayout(layout);

    // layout the top table & its buttons
    Label label = new Label(parent, SWT.LEFT);
    label.setText(XMLCompareMessages.XMLComparePreference_topTableLabel);
    GridData data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    fIdMapsTable = new Table(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    fIdMapsTable.setHeaderVisible(true);
    data = new GridData(GridData.FILL_BOTH);
    data.heightHint = fIdMapsTable.getItemHeight() * 4;
    fIdMapsTable.setLayoutData(data);
    fIdMapsTable.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            selectionChanged();
          }
        });

    String column2Text = XMLCompareMessages.XMLComparePreference_topTableColumn2;
    String column3Text = XMLCompareMessages.XMLComparePreference_topTableColumn3;
    ColumnLayoutData columnLayouts[] = {
      new ColumnWeightData(1),
      new ColumnPixelData(convertWidthInCharsToPixels(column2Text.length() + 2), true),
      new ColumnPixelData(convertWidthInCharsToPixels(column3Text.length() + 5), true)
    };
    TableLayout tablelayout = new TableLayout();
    fIdMapsTable.setLayout(tablelayout);
    for (int i = 0; i < 3; i++) tablelayout.addColumnData(columnLayouts[i]);
    TableColumn column = new TableColumn(fIdMapsTable, SWT.NONE);
    column.setText(XMLCompareMessages.XMLComparePreference_topTableColumn1);
    column = new TableColumn(fIdMapsTable, SWT.NONE);
    column.setText(column2Text);
    column = new TableColumn(fIdMapsTable, SWT.NONE);
    column.setText(column3Text);

    fillIdMapsTable();

    Composite buttons = new Composite(parent, SWT.NULL);
    buttons.setLayout(new GridLayout());
    data = new GridData();
    data.verticalAlignment = GridData.FILL;
    data.horizontalAlignment = GridData.FILL;
    buttons.setLayoutData(data);

    fAddIdMapButton = new Button(buttons, SWT.PUSH);
    fAddIdMapButton.setText(XMLCompareMessages.XMLComparePreference_topAdd);
    fAddIdMapButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            addIdMap(fAddIdMapButton.getShell());
          }
        });
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    // data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    data.widthHint =
        Math.max(widthHint, fAddIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    fAddIdMapButton.setLayoutData(data);

    fRenameIdMapButton = new Button(buttons, SWT.PUSH);
    fRenameIdMapButton.setText(XMLCompareMessages.XMLComparePreference_topRename);
    fRenameIdMapButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            renameIdMap(fRenameIdMapButton.getShell());
          }
        });
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    // data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
    widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    data.widthHint =
        Math.max(widthHint, fAddIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    fRenameIdMapButton.setLayoutData(data);

    fRemoveIdMapButton = new Button(buttons, SWT.PUSH);
    fRemoveIdMapButton.setText(XMLCompareMessages.XMLComparePreference_topRemove);
    fRemoveIdMapButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            removeIdMap(fRemoveIdMapButton.getShell());
          }
        });
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    // data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
    widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    data.widthHint =
        Math.max(widthHint, fRemoveIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    fRemoveIdMapButton.setLayoutData(data);

    createSpacer(buttons);

    fEditIdMapButton = new Button(buttons, SWT.PUSH);
    fEditIdMapButton.setText(XMLCompareMessages.XMLComparePreference_topEdit);
    fEditIdMapButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            editIdMap(fEditIdMapButton.getShell());
          }
        });
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    // data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
    widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    data.widthHint =
        Math.max(widthHint, fEditIdMapButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    fEditIdMapButton.setLayoutData(data);

    // Spacer
    label = new Label(parent, SWT.LEFT);
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    // layout the middle table & its buttons
    label = new Label(parent, SWT.LEFT);
    label.setText(XMLCompareMessages.XMLComparePreference_middleTableLabel);
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    fMappingsTable = new Table(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    fMappingsTable.setHeaderVisible(true);
    data = new GridData(GridData.FILL_BOTH);
    data.heightHint = fMappingsTable.getItemHeight() * 4;
    data.widthHint = convertWidthInCharsToPixels(70);
    fMappingsTable.setLayoutData(data);

    column3Text = XMLCompareMessages.XMLComparePreference_middleTableColumn3;
    String column4Text = XMLCompareMessages.XMLComparePreference_middleTableColumn4;
    columnLayouts =
        new ColumnLayoutData[] {
          new ColumnWeightData(10),
          new ColumnWeightData(18),
          new ColumnPixelData(convertWidthInCharsToPixels(column3Text.length() + 1), true),
          new ColumnPixelData(convertWidthInCharsToPixels(column4Text.length() + 3), true)
        };
    tablelayout = new TableLayout();
    fMappingsTable.setLayout(tablelayout);
    for (int i = 0; i < 4; i++) tablelayout.addColumnData(columnLayouts[i]);
    column = new TableColumn(fMappingsTable, SWT.NONE);
    column.setText(XMLCompareMessages.XMLComparePreference_middleTableColumn1);
    column = new TableColumn(fMappingsTable, SWT.NONE);
    column.setText(XMLCompareMessages.XMLComparePreference_middleTableColumn2);
    column = new TableColumn(fMappingsTable, SWT.NONE);
    column.setText(column3Text);
    column = new TableColumn(fMappingsTable, SWT.NONE);
    column.setText(column4Text);

    buttons = new Composite(parent, SWT.NULL);
    buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttons.setLayout(layout);

    fNewMappingsButton = new Button(buttons, SWT.PUSH);
    fNewMappingsButton.setLayoutData(getButtonGridData(fNewMappingsButton));
    fNewMappingsButton.setText(XMLCompareMessages.XMLComparePreference_middleNew);
    fNewMappingsButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            addMapping(fAddIdMapButton.getShell());
          }
        });

    fEditMappingsButton = new Button(buttons, SWT.PUSH);
    fEditMappingsButton.setLayoutData(getButtonGridData(fEditMappingsButton));
    fEditMappingsButton.setText(XMLCompareMessages.XMLComparePreference_middleEdit);
    fEditMappingsButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            editMapping(fEditMappingsButton.getShell());
          }
        });

    fRemoveMappingsButton = new Button(buttons, SWT.PUSH);
    fRemoveMappingsButton.setLayoutData(getButtonGridData(fRemoveMappingsButton));
    fRemoveMappingsButton.setText(XMLCompareMessages.XMLComparePreference_middleRemove);
    fRemoveMappingsButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            removeMapping(fRemoveMappingsButton.getShell());
          }
        });

    createSpacer(buttons);

    // layout the botton table & its buttons
    label = new Label(parent, SWT.LEFT);
    label.setText(XMLCompareMessages.XMLComparePreference_bottomTableLabel);
    data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    fOrderedTable = new Table(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
    fOrderedTable.setHeaderVisible(true);
    data = new GridData(GridData.FILL_BOTH);
    data.heightHint = fOrderedTable.getItemHeight() * 2;
    data.widthHint = convertWidthInCharsToPixels(70);
    fOrderedTable.setLayoutData(data);

    columnLayouts = new ColumnLayoutData[] {new ColumnWeightData(1), new ColumnWeightData(1)};
    tablelayout = new TableLayout();
    fOrderedTable.setLayout(tablelayout);
    for (int i = 0; i < 2; i++) tablelayout.addColumnData(columnLayouts[i]);
    column = new TableColumn(fOrderedTable, SWT.NONE);
    column.setText(XMLCompareMessages.XMLComparePreference_bottomTableColumn1);
    column = new TableColumn(fOrderedTable, SWT.NONE);
    column.setText(XMLCompareMessages.XMLComparePreference_bottomTableColumn2);

    buttons = new Composite(parent, SWT.NULL);
    buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttons.setLayout(layout);

    fNewOrderedButton = new Button(buttons, SWT.PUSH);
    fNewOrderedButton.setLayoutData(getButtonGridData(fNewOrderedButton));
    fNewOrderedButton.setText(XMLCompareMessages.XMLComparePreference_bottomNew);
    fNewOrderedButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            addOrdered(fNewOrderedButton.getShell());
          }
        });

    fEditOrderedButton = new Button(buttons, SWT.PUSH);
    fEditOrderedButton.setLayoutData(getButtonGridData(fEditOrderedButton));
    fEditOrderedButton.setText(XMLCompareMessages.XMLComparePreference_bottomEdit);
    fEditOrderedButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            editOrdered(fEditOrderedButton.getShell());
          }
        });

    fRemoveOrderedButton = new Button(buttons, SWT.PUSH);
    fRemoveOrderedButton.setLayoutData(getButtonGridData(fRemoveOrderedButton));
    fRemoveOrderedButton.setText(XMLCompareMessages.XMLComparePreference_bottomRemove);
    fRemoveOrderedButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            removeOrdered(fRemoveOrderedButton.getShell());
          }
        });

    createSpacer(buttons);

    fIdMapsTable.setSelection(0);
    fIdMapsTable.setFocus();
    selectionChanged();

    return parent;
  }