public void createControl(Composite parent) {
    Font font = parent.getFont();
    initializeDialogUnits(parent);

    // top level group
    Composite topLevel = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    topLevel.setLayout(layout);
    topLevel.setLayoutData(
        new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    topLevel.setFont(font);

    Group optionGroup = new Group(topLevel, SWT.SHADOW_IN);
    GridLayout clientlayout = new GridLayout();
    optionGroup.setLayout(clientlayout);
    optionGroup.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    optionGroup.setText(OPTIONS_STRING);
    optionGroup.setFont(topLevel.getFont());

    Text text = new Text(optionGroup, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    text.setText(DEFAULT_PACKAGE_STRING);
    packageNameText = DEFAULT_PACKAGE_STRING;
    text.addModifyListener(new TextFieldModifyListener());

    setErrorMessage(null);
    setMessage(null);
    setControl(topLevel);
  }
  /**
   * Creates a new button with the given id.
   *
   * <p>The <code>Dialog</code> implementation of this framework method creates a standard push
   * button, registers for selection events including button presses and registers default buttons
   * with its shell. The button id is stored as the buttons client data. Note that the parent's
   * layout is assumed to be a GridLayout and the number of columns in this layout is incremented.
   * Subclasses may override.
   *
   * @param parent the parent composite
   * @param id the id of the button (see <code>IDialogConstants.*_ID</code> constants for standard
   *     dialog button ids)
   * @param label the label from the button
   * @param defaultButton <code>true</code> if the button is to be the default button, and <code>
   *     false</code> otherwise
   */
  private Button createButton(
      final Composite parent, final int id, final String label, final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;

    final Button button = new Button(parent, SWT.PUSH);
    button.setFont(parent.getFont());

    final GridData buttonData = new GridData(GridData.FILL_HORIZONTAL);
    button.setLayoutData(buttonData);

    button.setData(Integer.valueOf(id));
    button.setText(label);
    button.setFont(parent.getFont());

    if (defaultButton) {
      final Shell shell = parent.getShell();
      if (shell != null) {
        shell.setDefaultButton(button);
      }
      button.setFocus();
    }
    button.setFont(parent.getFont());
    setButtonLayoutData(button);
    return button;
  }
  protected void createServerSelectionControl(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setText(PHPServerUIMessages.getString("ServerTab.server")); // $NON-NLS-1$
    GridLayout ly = new GridLayout(1, false);
    ly.marginHeight = 0;
    ly.marginWidth = 0;
    group.setLayout(ly);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite phpServerComp = new Composite(group, SWT.NONE);
    phpServerComp.setLayout(new GridLayout(4, false));
    phpServerComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    phpServerComp.setFont(parent.getFont());

    Label label = new Label(phpServerComp, SWT.WRAP);
    GridData data = new GridData(GridData.BEGINNING);
    data.widthHint = 100;
    label.setLayoutData(data);
    label.setFont(parent.getFont());
    label.setText(PHPServerUIMessages.getString("ServerLaunchConfigurationTab.0")); // $NON-NLS-1$

    serverCombo = new Combo(phpServerComp, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
    serverCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    serverCombo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleServerSelection();
          }
        });

    createNewServer =
        createPushButton(
            phpServerComp, PHPServerUIMessages.getString("ServerTab.new"), null); // $NON-NLS-1$
    createNewServer.addSelectionListener(fListener);

    configureServers =
        createPushButton(
            phpServerComp,
            PHPServerUIMessages.getString("ServerTab.configure"),
            null); //$NON-NLS-1$
    configureServers.addSelectionListener(fListener);

    servers = new ArrayList<Server>();
    populateServerList(servers);

    // initialize the servers list
    if (!servers.isEmpty()) {
      for (int i = 0; i < servers.size(); i++) {
        Server svr = servers.get(i);
        serverCombo.add(svr.getName());
      }
    }

    // select first item in list
    if (serverCombo.getItemCount() > 0) {
      serverCombo.select(0);
    }

    serverCombo.forceFocus();
  }
示例#4
0
  @Override
  protected Control createContents(Composite parent) {
    //	Create the container we return to the property page editor
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    GridLayout compositeLayout = new GridLayout();
    compositeLayout.numColumns = 1;
    compositeLayout.marginHeight = 0;
    compositeLayout.marginWidth = 0;
    composite.setLayout(compositeLayout);

    String s = null;
    if (!checkElement()) {
      s = Messages.AbstractPage_0;
    } else if (!isApplicable()) {
      return null;
    } else if (!isCDTProject(getProject())) {
      s = Messages.AbstractPage_2;
    }

    if (s == null) {
      contentForCDT(composite);
      return composite;
    }

    // no contents
    Label label = new Label(composite, SWT.LEFT);
    label.setText(s);
    label.setFont(composite.getFont());
    noContentOnPage = true;
    noDefaultAndApplyButton();
    return composite;
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IconAndMessageDialog#createMessageArea(org.eclipse.swt.widgets.Composite)
   */
  @Override
  protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    createLinkControl(messageComposite);

    int indent = convertWidthInCharsToPixels(3);

    fNotSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent);

    fSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null), indent);

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    imageLabel1.setImage(image);
    imageLabel1.setLayoutData(
        new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    final Label label = new Label(warningComposite, SWT.WRAP);
    label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(gridData);
    label.setFont(warningComposite.getFont());

    fNotSortAllRadio.setDialogFieldListener(
        new IDialogFieldListener() {
          public void dialogFieldChanged(DialogField field) {
            imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
            label.setEnabled(!fNotSortAllRadio.isSelected());
          }
        });
    imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
    label.setEnabled(!fNotSortAllRadio.isSelected());

    return messageComposite;
  }
  /**
   * Creates the buttons for selecting specific types or selecting all or none of the elements.
   *
   * @param parent the parent control
   */
  protected final void createButtonsGroup(Composite parent) {

    Font font = parent.getFont();

    // top level group
    Composite buttonComposite = new Composite(parent, SWT.NONE);
    buttonComposite.setFont(parent.getFont());

    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.makeColumnsEqualWidth = true;
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(
        new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));

    // types edit button
    Button selectTypesButton =
        createButton(buttonComposite, IDialogConstants.SELECT_TYPES_ID, SELECT_TYPES_TITLE, false);

    SelectionListener listener =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleTypesEditButtonPressed();
          }
        };
    selectTypesButton.addSelectionListener(listener);
    selectTypesButton.setFont(font);
    setButtonLayoutData(selectTypesButton);

    Button selectButton =
        createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, SELECT_ALL_TITLE, false);

    listener =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            resourceGroup.setAllSelections(true);
            updateWidgetEnablements();
          }
        };
    selectButton.addSelectionListener(listener);
    selectButton.setFont(font);
    setButtonLayoutData(selectButton);

    Button deselectButton =
        createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE, false);

    listener =
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            resourceGroup.setAllSelections(false);
            updateWidgetEnablements();
          }
        };
    deselectButton.addSelectionListener(listener);
    deselectButton.setFont(font);
    setButtonLayoutData(deselectButton);
  }
示例#7
0
  private void addFileNameControls(Composite group) {
    // grid layout with 2 columns

    // Line with label, combo and button
    Label label = new Label(group, SWT.LEAD);
    label.setText(SearchMessages.SearchPage_fileNamePatterns_text);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    label.setFont(group.getFont());

    fExtensions = new Combo(group, SWT.SINGLE | SWT.BORDER);
    fExtensions.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            updateOKStatus();
          }
        });
    GridData data = new GridData(GridData.FILL, GridData.FILL, true, false, 1, 1);
    data.widthHint = convertWidthInCharsToPixels(50);
    fExtensions.setLayoutData(data);
    fExtensions.setFont(group.getFont());

    Button button = new Button(group, SWT.PUSH);
    button.setText(SearchMessages.SearchPage_browse);
    GridData gridData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false, 1, 1);
    gridData.widthHint = SWTUtil.getButtonWidthHint(button);
    button.setLayoutData(gridData);
    button.setFont(group.getFont());

    fFileTypeEditor = new FileTypeEditor(fExtensions, button);

    // Text line which explains the special characters
    Label description = new Label(group, SWT.LEAD);
    description.setText(SearchMessages.SearchPage_fileNamePatterns_hint);
    description.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    description.setFont(group.getFont());

    fSearchDerivedCheckbox = new Button(group, SWT.CHECK);
    fSearchDerivedCheckbox.setText(SearchMessages.TextSearchPage_searchDerived_label);

    fSearchDerivedCheckbox.setSelection(fSearchDerived);
    fSearchDerivedCheckbox.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            fSearchDerived = fSearchDerivedCheckbox.getSelection();
            writeConfiguration();
          }
        });
    fSearchDerivedCheckbox.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    fSearchDerivedCheckbox.setFont(group.getFont());
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
   * .Composite)
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    createMessageArea(composite);
    CheckboxTreeViewer treeViewer = createTreeViewer(composite);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = convertWidthInCharsToPixels(60);
    data.heightHint = convertHeightInCharsToPixels(18);

    Tree treeWidget = treeViewer.getTree();
    treeWidget.setLayoutData(data);
    treeWidget.setFont(composite.getFont());

    if (hasNewFolderButton) {
      Button button = new Button(composite, SWT.PUSH);
      button.setText(TernUIMessages.Button_newFolder);
      button.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent event) {
              newFolderButtonPressed();
            }
          });
      button.setFont(composite.getFont());

      fNewFolderButton = button;
    }

    treeViewer.addSelectionChangedListener(this);
    if (fExisting != null) {
      Object[] existing = fExisting.toArray();
      treeViewer.setGrayedElements(existing);
      setInitialSelections(existing);
    }
    if (fFocusElement != null) {
      treeViewer.setSelection(new StructuredSelection(fFocusElement), true);
    }
    treeViewer.addCheckStateListener(
        new ICheckStateListener() {
          public void checkStateChanged(CheckStateChangedEvent event) {
            forceExistingChecked(event);
          }
        });

    applyDialogFont(composite);
    return composite;
  }
  private void createFlagsGroup(Composite parent) {
    Font font = parent.getFont();

    Group group = new Group(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;
    layout.numColumns = 1;
    group.setLayout(layout);
    group.setLayoutData(new GridData(GridData.FILL_BOTH));
    group.setFont(font);
    group.setText("Flags");

    rd_button = new Button(group, SWT.CHECK);
    rd_button.setFont(font);
    rd_button.setText("Data read");
    rd_button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    rd_button.setEnabled(enable_editing);

    wr_button = new Button(group, SWT.CHECK);
    wr_button.setFont(font);
    wr_button.setText("Data write");
    wr_button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    wr_button.setEnabled(enable_editing);

    ex_button = new Button(group, SWT.CHECK);
    ex_button.setFont(font);
    ex_button.setText("Instructions read");
    ex_button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    ex_button.setEnabled(enable_editing);
  }
示例#10
0
  private void createFileListArea(Composite parent) {
    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setFont(font);
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));

    fileTree = new Tree(composite, SWT.VIRTUAL | SWT.BORDER | SWT.SINGLE);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.minimumHeight = 300;
    gd.minimumWidth = 350;
    fileTree.setLayoutData(gd);
    fileTree.setFont(font);
    fileTree.addListener(
        SWT.SetData,
        new Listener() {
          public void handleEvent(Event event) {
            TreeItem item = (TreeItem) event.item;
            FileInfo info = findFileInfo(item);
            if (info == null) {
              updateItems(item.getParentItem(), false);
            } else {
              fillItem(item, info);
            }
          }
        });
  }
示例#11
0
  /**
   * Returns this field editor's text control.
   *
   * <p>The control is created if it does not yet exist
   *
   * @param parent the parent
   * @return the text control
   */
  public Text getTextControl(Composite parent) {
    if (textField == null) {
      textField = new Text(parent, SWT.SINGLE | SWT.BORDER);

      textField.setEchoChar('*');

      textField.setFont(parent.getFont());
      switch (validateStrategy) {
        case VALIDATE_ON_KEY_STROKE:
          textField.addKeyListener(
              new KeyAdapter() {

                /** {@inheritDoc} */
                @Override
                public void keyReleased(KeyEvent e) {
                  valueChanged();
                }
              });

          break;
        case VALIDATE_ON_FOCUS_LOST:
          textField.addKeyListener(
              new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                  clearErrorMessage();
                }
              });
          textField.addFocusListener(
              new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                  refreshValidState();
                }

                @Override
                public void focusLost(FocusEvent e) {
                  valueChanged();
                  clearErrorMessage();
                }
              });
          break;
        default:
          Assert.isTrue(false, "Unknown validate strategy"); // $NON-NLS-1$
      }
      textField.addDisposeListener(
          new DisposeListener() {
            @Override
            public void widgetDisposed(DisposeEvent event) {
              textField = null;
            }
          });
      if (textLimit > 0) { // Only set limits above 0 - see SWT spec
        textField.setTextLimit(textLimit);
      }
    } else {
      checkParent(textField, parent);
    }
    return textField;
  }
示例#12
0
  private TableViewer createPropertiesSection(Composite parent) {
    TableViewer viewer =
        new TableViewer(
            parent, SWT.SINGLE | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);

    Table table = viewer.getTable();
    setLayout(table);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.setFont(parent.getFont());

    TableViewerColumn nameColumn = new TableViewerColumn(viewer, SWT.NONE);
    nameColumn.setLabelProvider(new NameLabelProvider());
    nameColumn.getColumn().setText("Name");
    nameColumn.getColumn().setResizable(true);
    nameColumn.getColumn().setMoveable(true);

    TableViewerColumn valueColumn = new TableViewerColumn(viewer, SWT.NONE);
    valueColumn.setLabelProvider(new ValueLabelProvider());
    valueColumn.getColumn().setText("Value");
    valueColumn.getColumn().setResizable(true);
    valueColumn.getColumn().setMoveable(true);
    valueColumn.setEditingSupport(new RedDeerEditingSupport(viewer));

    viewer.setContentProvider(new ArrayContentProvider());

    return viewer;
  }
 /* (non-Javadoc)
  * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
  */
 @Override
 protected Control createDialogArea(Composite parent) {
   Composite composite = (Composite) super.createDialogArea(parent);
   Label label = new Label(composite, SWT.WRAP);
   label.setText(MessagesForDetailPane.PaneMaxLengthDialog_MaxCharactersToDisplay);
   GridData data =
       new GridData(
           GridData.GRAB_HORIZONTAL
               | GridData.GRAB_VERTICAL
               | GridData.HORIZONTAL_ALIGN_FILL
               | GridData.VERTICAL_ALIGN_CENTER);
   data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
   label.setLayoutData(data);
   label.setFont(parent.getFont());
   fTextWidget = new Text(composite, SWT.SINGLE | SWT.BORDER);
   fTextWidget.setLayoutData(
       new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
   fTextWidget.setText(fValue);
   fTextWidget.addModifyListener(
       new ModifyListener() {
         public void modifyText(ModifyEvent e) {
           validateInput();
           fValue = fTextWidget.getText();
         }
       });
   fErrorTextWidget = new Text(composite, SWT.READ_ONLY);
   fErrorTextWidget.setLayoutData(
       new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
   fErrorTextWidget.setBackground(
       fErrorTextWidget.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
   setErrorMessage(fErrorMessage);
   applyDialogFont(composite);
   return composite;
 }
示例#14
0
 /**
  * Constructs a new filtered list.
  *
  * @param parent the parent composite
  * @param style the widget style
  * @param labelProvider the label renderer
  * @param ignoreCase specifies whether sorting and folding is case sensitive
  * @param allowDuplicates specifies whether folding of duplicates is desired
  * @param matchEmptyString specifies whether empty filter strings should filter everything or
  *     nothing
  */
 public HistoryFilteredList(
     Composite parent,
     int style,
     ILabelProvider labelProvider,
     boolean ignoreCase,
     boolean allowDuplicates,
     boolean matchEmptyString) {
   super(parent, SWT.NONE);
   GridLayout layout = new GridLayout();
   layout.marginHeight = 0;
   layout.marginWidth = 0;
   setLayout(layout);
   fList = new Table(this, style);
   fList.setLayoutData(new GridData(GridData.FILL_BOTH));
   fList.setFont(parent.getFont());
   fList.addDisposeListener(
       new DisposeListener() {
         @Override
         public void widgetDisposed(DisposeEvent e) {
           fLabelProvider.dispose();
           if (fUpdateJob != null) {
             fUpdateJob.cancel();
           }
         }
       });
   fLabelProvider = labelProvider;
   fIgnoreCase = ignoreCase;
   fAllowDuplicates = allowDuplicates;
   fMatchEmptyString = matchEmptyString;
 }
示例#15
0
  private Composite createMarkersTabContent(Composite folder) {
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;

    PixelConverter conv = new PixelConverter(folder);

    Composite markersComposite = new Composite(folder, SWT.NULL);
    markersComposite.setLayout(layout);
    markersComposite.setFont(folder.getFont());

    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = conv.convertWidthInCharsToPixels(50);
    Control listControl = fTodoTasksList.getListControl(markersComposite);
    listControl.setLayoutData(data);

    Control buttonsControl = fTodoTasksList.getButtonBox(markersComposite);
    buttonsControl.setLayoutData(
        new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING));

    fCaseSensitiveCheckBox.doFillIntoGrid(markersComposite, 2);

    return markersComposite;
  }
  /**
   * Create this dialog's drop-down list component.
   *
   * @param parent the parent composite
   */
  protected void createDropDownText(Composite parent) {
    // create the list
    text = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    text.setFont(parent.getFont());

    // print the stacktrace in the text field
    try {
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      PrintStream ps = new PrintStream(baos);
      detail.printStackTrace(ps);
      ps.flush();
      baos.flush();
      text.setText(baos.toString());
    } catch (IOException e) {
    }

    GridData data =
        new GridData(
            GridData.HORIZONTAL_ALIGN_FILL
                | GridData.GRAB_HORIZONTAL
                | GridData.VERTICAL_ALIGN_FILL
                | GridData.GRAB_VERTICAL);
    data.heightHint = text.getLineHeight() * TEXT_LINE_COUNT;
    data.horizontalSpan = 2;
    text.setLayoutData(data);
  }
    @Override
    protected void createDestinationGroup(Composite parent) {
      UIPlugin plugin = UIPlugin.getInstance();
      Group destinationGroup = new Group(parent, SWT.NONE);
      GridLayout layout = new GridLayout();
      destinationGroup.setLayout(layout);
      destinationGroup.setLayoutData(
          new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
      destinationGroup.setText(plugin.getString("_UI_Forge_Credentials_label"));
      destinationGroup.setFont(parent.getFont());

      Font font = destinationGroup.getFont();

      Label loginLabel = new Label(destinationGroup, SWT.NONE);
      loginLabel.setText(plugin.getString("_UI_Login_label"));
      loginLabel.setFont(font);

      loginField = new Text(destinationGroup, SWT.BORDER | SWT.READ_ONLY);
      GridData data = new GridData(GridData.FILL_HORIZONTAL);
      data.widthHint = SIZING_TEXT_FIELD_WIDTH;
      loginField.setLayoutData(data);
      loginField.setFont(font);

      Label passwordLabel = new Label(destinationGroup, SWT.NONE);
      passwordLabel.setText(plugin.getString("_UI_Password_label"));
      passwordLabel.setFont(font);

      passwordField = new Text(destinationGroup, SWT.BORDER | SWT.PASSWORD);
      data = new GridData(GridData.FILL_HORIZONTAL);
      data.widthHint = SIZING_TEXT_FIELD_WIDTH;
      passwordField.setLayoutData(data);
      passwordField.setFont(font);
      passwordField.addListener(SWT.Modify, this);
    }
  /**
   * Creates the control.
   *
   * @param parent The parent composite
   * @return The created control
   */
  public Control createControl(Composite parent) {
    _group = new Group(parent, SWT.NONE);
    _group.setFont(parent.getFont());
    _group.setLayout(_wizardPage.initGridLayout(new GridLayout(2, false), true));
    _group.setText(Messages.NewBlackBerryProjectWizardPageOne_JREGroup_title);

    _useProjectRE.doFillIntoGrid(_group, 1);
    Combo comboControl = _RECombo.getComboControl(_group);
    comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

    Control[] controls = _useDefaultRE.doFillIntoGrid(_group, 1);
    // Fixed IDT 233814, make sure there is enough room to display the label if user change
    // default JRE from java to BB
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.minimumWidth = 260;
    controls[0].setLayoutData(gd);
    _preferenceLink = new Link(_group, SWT.NONE);
    _preferenceLink.setFont(_group.getFont());
    _preferenceLink.setText(Messages.NewBlackBerryProjectWizardPageOne_JREGroup_link_description);
    _preferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
    _preferenceLink.addSelectionListener(this);

    setDefaultButtonState();

    return _group;
  }
  @Override
  public void createControl(Composite parent) {
    initializeDialogUnits(parent);

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setFont(parent.getFont());

    int nColumns = 1;

    GridLayout layout = new GridLayout();
    layout.numColumns = nColumns;
    composite.setLayout(layout);

    final Label applicationStyleLabel = new Label(composite, SWT.NONE);
    applicationStyleLabel.setText(
        JaxrsApplicationCreationMessages.JaxrsApplicationCreationWizardPage_ApplicationStyle);
    GridDataFactory.fillDefaults()
        .align(SWT.FILL, SWT.CENTER)
        .grab(false, false)
        .applyTo(applicationStyleLabel);
    // JAX-RS Application created as a Java class
    createJavaApplicationControls(composite);
    // JAX-RS Application created as a Servlet mapping in web.xml
    createWebxmlApplicationControls(composite);
    // Skip JAX-RS Application creation
    createSkipApplicationControls(composite);

    setControl(composite);
    Dialog.applyDialogFont(composite);
    doStatusUpdate();
    updateApplicationCreationModeControls();
  }
示例#20
0
  @Override
  protected Control createDialogArea(Composite parent) {

    Composite container = (Composite) super.createDialogArea(parent);

    if (this.message != null) {
      Label label = new Label(container, SWT.WRAP);
      label.setText(this.message);
      GridData data =
          new GridData(
              GridData.GRAB_HORIZONTAL
                  | GridData.GRAB_VERTICAL
                  | GridData.HORIZONTAL_ALIGN_FILL
                  | GridData.VERTICAL_ALIGN_CENTER);
      data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
      label.setLayoutData(data);
      label.setFont(parent.getFont());
    }

    createCustomDialogArea(container);

    errorMessageText = new Text(container, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(
        new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(
        errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    setErrorMessage(errorMessage);

    applyDialogFont(container);

    return container;
  }
示例#21
0
 /* (non-Javadoc)
  * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
  */
 public void createControl(Composite parent) {
   Font font = parent.getFont();
   Group group = createGroup(parent, "Working directory:", 2, 1, GridData.FILL_HORIZONTAL);
   setControl(group);
   // PlatformUI.getWorkbench().getHelpSystem().setHelp(group,
   // IJavaDebugHelpContextIds.WORKING_DIRECTORY_BLOCK);
   // default choice
   Composite comp = createComposite(group, font, 2, 2, GridData.FILL_BOTH, 0, 0);
   fUseDefaultDirButton = createRadioButton(comp, "Default:");
   fUseDefaultDirButton.addSelectionListener(fListener);
   fWorkingDirText = createSingleText(comp, 1);
   fWorkingDirText.addModifyListener(fListener);
   fWorkingDirText.setEnabled(false);
   // user enter choice
   fUseOtherDirButton = createRadioButton(comp, "Other:");
   fUseOtherDirButton.addSelectionListener(fListener);
   fOtherWorkingText = createSingleText(comp, 1);
   fOtherWorkingText.addModifyListener(fListener);
   // buttons
   Composite buttonComp = createComposite(comp, font, 3, 2, GridData.HORIZONTAL_ALIGN_END);
   GridLayout ld = (GridLayout) buttonComp.getLayout();
   ld.marginHeight = 1;
   ld.marginWidth = 0;
   fWorkspaceButton = createPushButton(buttonComp, "Workspace...", null);
   fWorkspaceButton.addSelectionListener(fListener);
   fFileSystemButton = createPushButton(buttonComp, "File System...", null);
   fFileSystemButton.addSelectionListener(fListener);
   fVariablesButton = createPushButton(buttonComp, "Variables...", null);
   fVariablesButton.addSelectionListener(fListener);
 }
  @Override
  public void createControl(Composite parent) {
    initializeDialogUnits(parent);

    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(
        new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
    composite.setFont(parent.getFont());

    createResourcesGroup(composite);
    createDestinationGroup(composite);

    restoreWidgetValues();
    if (fInitialSelection != null) {
      setupBasedOnInitialSelections();
    }
    setupDestination();

    updateWidgetEnablements();
    setPageComplete(determinePageCompletion());
    setErrorMessage(null); // should not initially have error message

    setControl(composite);
    giveFocusToDestination();
  }
  /**
   * Creates the project name specification controls.
   *
   * @param parent the parent composite
   */
  private final void createProjectNameGroup(Composite parent) {

    Font dialogFont = parent.getFont();

    // project specification group
    Composite projectGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    projectGroup.setFont(dialogFont);
    projectGroup.setLayout(layout);
    projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // new project label
    Label projectLabel = new Label(projectGroup, SWT.NONE);
    projectLabel.setText(DataTransferMessages.WizardExternalProjectImportPage_nameLabel);
    projectLabel.setFont(dialogFont);

    // new project name entry field
    projectNameField = new Text(projectGroup, SWT.BORDER | SWT.READ_ONLY);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    projectNameField.setLayoutData(data);
    projectNameField.setFont(dialogFont);
    projectNameField.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
  }
  /*
   * (non-Javadoc)
   *
   * @see
   * org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets
   * .Composite)
   */
  public void createControl(Composite parent) {
    initializeDialogUnits(parent);

    final Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(initGridLayout(new GridLayout(1, false), true));
    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    // create UI elements
    Control nameControl = createNameControl(composite);
    nameControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Control rooHomeControl = rooInstallGroup.createControl(composite);
    rooHomeControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    if (DependencyManagementUtils.IS_M2ECLIPSE_PRESENT
        || DependencyManagementUtils.IS_STS_MAVEN_PRESENT) {
      Control dependencyManagementControl = dependencyManagementGroup.createControl(composite);
      dependencyManagementControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    }

    Control providerControl = packagingProviderGroup.createControl(composite);
    providerControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Control locationControl = createLocationControl(composite);
    locationControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Control workingSetControl = createWorkingSetControl(composite);
    workingSetControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    setControl(composite);
  }
  /**
   * Creates the project location specification controls.
   *
   * @param projectGroup the parent composite
   */
  private void createUserSpecifiedProjectLocationGroup(Composite projectGroup) {

    Font dialogFont = projectGroup.getFont();

    // project location entry field
    this.locationPathField = new Text(projectGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    this.locationPathField.setLayoutData(data);
    this.locationPathField.setFont(dialogFont);

    // browse button
    this.browseButton = new Button(projectGroup, SWT.PUSH);
    this.browseButton.setText(DataTransferMessages.DataTransfer_browse);
    this.browseButton.setFont(dialogFont);
    setButtonLayoutData(this.browseButton);

    this.browseButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent event) {
            handleLocationBrowseButtonPressed();
          }
        });

    locationPathField.addListener(SWT.Modify, locationModifyListener);
  }
  private void createExperimentNameGroup(Composite parent) {
    Font font = parent.getFont();
    Composite folderGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    folderGroup.setLayout(layout);
    folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // New experiment label
    Label experimentLabel = new Label(folderGroup, SWT.NONE);
    experimentLabel.setFont(font);
    experimentLabel.setText(Messages.NewExperimentDialog_ExperimentName);

    // New experiment name entry field
    fExperimentName = new Text(folderGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    fExperimentName.setLayoutData(data);
    fExperimentName.setFont(font);
    fExperimentName.addListener(
        SWT.Modify,
        new Listener() {
          @Override
          public void handleEvent(Event event) {
            validateNewExperimentName();
          }
        });
  }
  /* (non-Javadoc)
   * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
   */
  public void createControl(Composite parent) {
    Composite inner = new Composite(parent, SWT.NONE);
    inner.setFont(parent.getFont());

    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    inner.setLayout(layout);
    inner.setLayoutData(new GridData(GridData.FILL_BOTH));

    fInclusionPatternList.doFillIntoGrid(inner, 3);
    LayoutUtil.setHorizontalSpan(fInclusionPatternList.getLabelControl(null), 2);
    LayoutUtil.setHorizontalGrabbing(fInclusionPatternList.getListControl(null));

    fExclusionPatternList.doFillIntoGrid(inner, 3);
    LayoutUtil.setHorizontalSpan(fExclusionPatternList.getLabelControl(null), 2);
    LayoutUtil.setHorizontalGrabbing(fExclusionPatternList.getListControl(null));

    setControl(inner);
    Dialog.applyDialogFont(inner);
    if (DLTKCore.DEBUG) {
      System.err.println("SetFilterWizardOage add help support here"); // $NON-NLS-1$
    }
    // PlatformUI.getWorkbench().getHelpSystem().setHelp(inner,
    // IDLTKHelpContextIds.INCLUSION_EXCLUSION_WIZARD_PAGE);
  }
  @Override
  protected Control createTreeAreaContents(Composite parent) {
    Composite leftArea = new Composite(parent, SWT.NONE);
    leftArea.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    leftArea.setFont(parent.getFont());
    GridLayout leftLayout = new GridLayout();
    leftLayout.numColumns = 1;
    leftLayout.marginHeight = 0;
    leftLayout.marginTop = IDialogConstants.VERTICAL_MARGIN;
    leftLayout.marginWidth = IDialogConstants.HORIZONTAL_MARGIN;
    leftLayout.horizontalSpacing = 0;
    leftLayout.verticalSpacing = 0;
    leftArea.setLayout(leftLayout);

    // Build the tree an put it into the composite.
    TreeViewer viewer = createTreeViewer(leftArea);
    setTreeViewer(viewer);

    updateTreeFont(JFaceResources.getDialogFont());
    GridData viewerData = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
    viewer.getControl().getParent().setLayoutData(viewerData);

    layoutTreeAreaControl(leftArea);

    return leftArea;
  }
 /**
  * Creates and returns a button
  *
  * @param parent parent widget
  * @param label label
  * @return Button
  */
 protected Button createPushButton(Composite parent, String label) {
   Button button = new Button(parent, SWT.PUSH);
   button.setFont(parent.getFont());
   button.setText(label);
   setButtonLayoutData(button);
   return button;
 }
    public Control createControl(Composite composite) {
      Composite nameComposite = new Composite(composite, SWT.NONE);
      nameComposite.setFont(composite.getFont());
      nameComposite.setLayout(initGridLayout(new GridLayout(2, false), false));

      fNameField.doFillIntoGrid(nameComposite, 2);
      LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null));

      fPackageField.doFillIntoGrid(nameComposite, 2);
      LayoutUtil.setHorizontalGrabbing(fPackageField.getTextControl(null));

      fTemplateField.doFillIntoGrid(nameComposite, 2);
      LayoutUtil.setHorizontalGrabbing(fTemplateField.getComboControl(null));
      fTemplateField
          .getComboControl(null)
          .addModifyListener(
              new ModifyListener() {

                public void modifyText(ModifyEvent e) {
                  ProjectType type = getProjectType();
                  fdescriptionField.setEnabled(type != ProjectType.PROJECT);
                  if (packagingProviderGroup != null) {
                    packagingProviderGroup.updateEnablement();
                  }
                }
              });

      fdescriptionField.doFillIntoGrid(nameComposite, 2);
      LayoutUtil.setHorizontalGrabbing(fdescriptionField.getTextControl(null));

      return nameComposite;
    }