/*
   * (non-Javadoc)
   *
   * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
   */
  @Override
  protected void createFieldEditors() {

    // Load up the preference store
    super.createFieldEditors();
    // Add a string editor to edit the tool command
    Composite parent = getFieldEditorParent();
    FontMetrics fm = AbstractCPropertyTab.getFontMetrics(parent);
    commandStringField =
        new StringFieldEditor(fTool.getId(), Messages.BuildToolSettingsPage_tool_command, parent);
    commandStringField.setEmptyStringAllowed(false);
    GridData gd = ((GridData) commandStringField.getTextControl(parent).getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 3);
    addField(commandStringField);
    // Add a field editor that displays overall build options
    Composite par = getFieldEditorParent();
    allOptionFieldEditor =
        new MultiLineTextFieldEditor(ToolSettingsPrefStore.ALL_OPTIONS_ID, ALL_OPTIONS, par);
    allOptionFieldEditor.getTextControl(par).setEditable(false);
    //		gd = ((GridData)allOptionFieldEditor.getTextControl().getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
    addField(allOptionFieldEditor);

    addField(createLabelEditor(getFieldEditorParent(), WHITESPACE));
    addField(
        createLabelEditor(
            getFieldEditorParent(), Messages.BuildToolSettingsPage_tool_advancedSettings));

    // Add a string editor to edit the tool command line pattern
    parent = getFieldEditorParent();
    commandLinePatternField =
        new StringFieldEditor(
            fTool.getId() + ToolSettingsPrefStore.COMMAND_LINE_SUFFIX,
            Messages.BuildToolSettingsPage_tool_commandLinePattern,
            parent);
    gd = ((GridData) commandLinePatternField.getTextControl(parent).getLayoutData());
    gd.grabExcessHorizontalSpace = true;
    gd.widthHint = Dialog.convertWidthInCharsToPixels(fm, 30);
    gd.minimumWidth = Dialog.convertWidthInCharsToPixels(fm, 20);
    addField(commandLinePatternField);
  }
  private void createIgnoreRangesControls(Composite top) {

    ignoreRangesList = new List(top, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    FontMetrics fm = MemcheckPlugin.getFontMetrics(ignoreRangesList);
    ignoreRangesList.setLayoutData(
        new GridData(
            Dialog.convertWidthInCharsToPixels(fm, 50),
            Dialog.convertHeightInCharsToPixels(fm, 5)));

    Composite ignoreButtons = new Composite(top, SWT.NONE);
    GridLayout ignoreButtonsLayout = new GridLayout();
    ignoreButtonsLayout.marginWidth = ignoreButtonsLayout.marginHeight = 0;
    ignoreButtons.setLayout(ignoreButtonsLayout);
    ignoreButtons.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));

    Button newButton = new Button(ignoreButtons, SWT.PUSH);
    newButton.setText(Messages.getString("MemcheckToolPage.New")); // $NON-NLS-1$
    newButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    newButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleIgnoreNewButtonPressed();
            updateLaunchConfigurationDialog();
          }
        });

    Button removeButton = new Button(ignoreButtons, SWT.PUSH);
    removeButton.setText(Messages.getString("MemcheckToolPage.Remove")); // $NON-NLS-1$
    removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    removeButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleIgnoreRemoveButtonPressed();
            updateLaunchConfigurationDialog();
          }
        });
  }
Beispiel #3
0
 public int convertWidthInCharsToPixels(int chars) {
   return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
 }
 /**
  * Returns the number of pixels corresponding to the width of the given number of characters.
  *
  * <p>This method may only be called after <code>initializeDialogUnits</code> has been called.
  *
  * <p>Clients may call this framework method, but should not override it.
  *
  * @param chars the number of characters
  * @return the number of pixels
  */
 private int convertWidthInCharsToPixels(int chars) {
   // test for failure to initialize for backward compatibility
   if (fFontMetrics == null) return 0;
   return Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
 }
 public int convertWidthInCharsToPixels(int chars) {
   return org.eclipse.jface.dialogs.Dialog.convertWidthInCharsToPixels(fFontMetrics, chars);
 }