protected Composite createMaxOccurComp(Composite parent, FormToolkit toolkit) {
    fMaxLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_maxOccurLabel);
    fMaxLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
    Composite comp = toolkit.createComposite(parent);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    GridLayout layout = new GridLayout(3, false);
    layout.marginHeight = layout.marginWidth = 0;
    comp.setLayout(layout);
    comp.setLayoutData(gd);

    fMaxOccurSpinner = new Spinner(comp, SWT.BORDER);
    fMaxOccurSpinner.setMinimum(1);
    fMaxOccurSpinner.setMaximum(999);
    fMaxOccurSpinner.setIncrement(1);

    fUnboundSelect =
        toolkit.createButton(comp, PDEUIMessages.AbstractSchemaDetails_unboundedButton, SWT.CHECK);
    gd = new GridData();
    gd.horizontalIndent = 10;
    fUnboundSelect.setLayoutData(gd);
    fUnboundSelect.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (blockListeners()) return;
            fMaxOccurSpinner.setEnabled(!fUnboundSelect.getSelection() && isEditableElement());
          }
        });

    return comp;
  }
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 8;
    layout.numColumns = 1;

    layout.makeColumnsEqualWidth = false;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_BOTH);
    container.setLayoutData(gd);
    Label libraryLabel = new Label(container, SWT.NULL);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    libraryLabel.setLayoutData(gd);
    libraryLabel.setText(PDEUIMessages.ManifestEditor_RuntimeLibraryDialog_label);

    libraryText = new Text(container, SWT.SINGLE | SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    libraryText.setLayoutData(gd);
    libraryText.setText(PDEUIMessages.ManifestEditor_RuntimeLibraryDialog_default);
    libraryText.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            updateStatus(validator.validate(libraryText.getText()));
          }
        });
    applyDialogFont(container);
    return container;
  }
  public void createButtonPanel(Shell dialog) {
    Composite buttonPanel = new Composite(dialog, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    buttonPanel.setLayoutData(gridData);
    buttonPanel.setLayout(new GridLayout(4, false));

    String buttonAlign =
        System.getProperty("org.pentaho.di.buttonPosition", "right")
            .toLowerCase(); //$NON-NLS-1$ //$NON-NLS-2$

    if (!"left".equals(buttonAlign)) { // $NON-NLS-1$
      Label emptyLabel = new Label(buttonPanel, SWT.NONE);
      gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
      emptyLabel.setLayoutData(gridData);
    }
    okButton = new Button(buttonPanel, SWT.PUSH);
    okButton.setText(Messages.getString("VfsFileChooserDialog.ok")); // $NON-NLS-1$
    gridData = new GridData(SWT.FILL, SWT.FILL, false, false);
    gridData.widthHint = 90;
    okButton.setLayoutData(gridData);
    okButton.addSelectionListener(this);
    cancelButton = new Button(buttonPanel, SWT.PUSH);
    cancelButton.setText(Messages.getString("VfsFileChooserDialog.cancel")); // $NON-NLS-1$
    cancelButton.addSelectionListener(this);
    gridData = new GridData(SWT.FILL, SWT.FILL, false, false);
    gridData.widthHint = 90;
    cancelButton.setLayoutData(gridData);
    if ("center".equals(buttonAlign)) { // $NON-NLS-1$
      Label emptyLabel = new Label(buttonPanel, SWT.NONE);
      gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
      emptyLabel.setLayoutData(gridData);
    }
  }
  public void createFileNamePanel(Shell dialog, String fileName) {
    Composite fileNamePanel = new Composite(dialog, SWT.NONE);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
    fileNamePanel.setLayoutData(gridData);
    fileNamePanel.setLayout(new GridLayout(2, false));
    Label fileNameLabel = new Label(fileNamePanel, SWT.NONE);
    fileNameLabel.setText(Messages.getString("VfsFileChooserDialog.fileName")); // $NON-NLS-1$
    gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
    fileNameLabel.setLayoutData(gridData);
    fileNameText = new Text(fileNamePanel, SWT.BORDER);
    if (fileName != null) {
      fileNameText.setText(fileName);
    }
    gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    fileNameText.setLayoutData(gridData);
    fileNameText.addKeyListener(
        new KeyListener() {

          public void keyPressed(KeyEvent arg0) {}

          public void keyReleased(KeyEvent event) {
            if (event.keyCode == SWT.CR || event.keyCode == SWT.KEYPAD_CR) {
              okPressed();
            }
          }
        });
  }
Exemplo n.º 5
0
  public static void main(String[] args) {
    final Display display = new Display();
    final Shell shell = new Shell(display);
    shell.setText("SWT and Swing DND Example");
    GridLayout layout = new GridLayout(1, false);
    shell.setLayout(layout);

    Text swtText = new Text(shell, SWT.BORDER);
    swtText.setText("SWT Text");
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    swtText.setLayoutData(data);
    setDragDrop(swtText);

    Composite comp = new Composite(shell, SWT.EMBEDDED);
    java.awt.Frame frame = SWT_AWT.new_Frame(comp);
    JTextField swingText = new JTextField(40);
    swingText.setText("Swing Text");
    swingText.setDragEnabled(true);
    frame.add(swingText);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = swingText.getPreferredSize().height;
    comp.setLayoutData(data);

    shell.setSize(400, 200);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
  /**
   * Creates and returns the contents of the upper part of the dialog (above the button bar).
   *
   * <p>Subclasses should override.
   *
   * @param ancestor the parent composite to contain the dialog area
   * @return the dialog area control
   */
  protected Control createDialogArea(Composite ancestor) {
    Composite composite = (Composite) super.createDialogArea(ancestor);

    Label comment = new Label(composite, SWT.NONE);
    comment.setText(XMLCompareMessages.XMLCompareEditCopyIdMapDialog_comment);
    GridData data = new GridData();
    data.horizontalAlignment = GridData.FILL;
    data.verticalAlignment = GridData.BEGINNING;
    comment.setLayoutData(data);

    Composite inner = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    inner.setLayout(layout);
    inner.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label label = new Label(inner, SWT.NULL);
    label.setText(XMLCompareMessages.XMLCompareEditCopyIdMapDialog_label);
    label.setLayoutData(new GridData());

    fIdMapText = new Text(inner, SWT.BORDER);
    fIdMapText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fIdMapText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            doValidation();
          }
        });

    fIdMapText.setFocus();

    return composite;
  }
  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();
  }
  private Composite createAvailableList(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container.setLayout(layout);
    container.setLayoutData(new GridData());

    Label label = new Label(container, SWT.NONE);
    label.setText(PDEUIMessages.ImportWizard_DetailedPage_availableList);

    Table table = new Table(container, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.heightHint = 200;
    gd.widthHint = 225;
    table.setLayoutData(gd);

    fAvailableListViewer = new TableViewer(table);
    fAvailableListViewer.setLabelProvider(new PluginImportLabelProvider());
    fAvailableListViewer.setContentProvider(new ContentProvider());
    fAvailableListViewer.setInput(PDECore.getDefault().getModelManager());
    fAvailableListViewer.setComparator(ListUtil.PLUGIN_COMPARATOR);

    return container;
  }
  public void createControl(Composite parent) {

    Composite pageContent = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    pageContent.setLayout(layout);
    pageContent.setLayoutData(new GridData(GridData.FILL_BOTH));

    // variable never used ... is pageContent.getLayoutData() needed?
    // GridData outerFrameGridData = (GridData)
    pageContent.getLayoutData();

    //		outerFrameGridData.horizontalAlignment = GridData.HORIZONTAL_ALIGN_FILL;
    //		outerFrameGridData.verticalAlignment = GridData.VERTICAL_ALIGN_FILL;

    //    WorkbenchHelp.setHelp(
    //        pageContent,
    //        B2BGUIContextIds.BTBG_SELECT_MULTI_FILE_PAGE);

    createLabels(pageContent);
    createSourceViewer(pageContent);
    createButtonPanel(pageContent);
    createSelectedListBox(pageContent);
    createImportButton(pageContent);

    setControl(pageContent);
    if (isFileMandatory) setPageComplete(false);
  }
  public void createControl(Composite parent) {
    Composite maincomposite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.numColumns = 1;
    maincomposite.setLayout(layout);

    GridData data = new GridData(GridData.FILL_BOTH);
    maincomposite.setLayoutData(data);

    showAttributes(maincomposite);

    IModelPropertyEditorAdapter a = support.getPropertyEditorAdapterByName("value");
    if (a instanceof JSFKnowledgeBaseAdapter) {
      ISelection s =
          getSpecificWizard().getWizardModel().getDropData().getSelectionProvider().getSelection();
      if (s instanceof TextSelection) {
        int offset = ((TextSelection) s).getOffset();
        context.put("offset", new Integer(offset));
      }
      ((JSFKnowledgeBaseAdapter) a).setContext(context);
    }

    setControl(maincomposite);
    getSpecificWizard()
        .getWizardModel()
        .addPropertyChangeListener(IDropWizardModel.TAG_PROPOSAL, this);
    updateTitle();
    runValidation();
  }
Exemplo n.º 11
0
  private void initFeederArea(Composite feederArea, FeederGUIRegistry feederRegistry) {
    // feederArea is the placeholder for the visible feeder
    this.feederArea = feederArea;
    feederArea.setLayoutData(
        LayoutHelper.formData(new FormAttachment(0), null, new FormAttachment(0), null));

    this.feederRegistry = feederRegistry;
  }
Exemplo n.º 12
0
  public void createControl(final Shell parent) {
    parent.setLayout(new GridLayout());

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setLayout(new GridLayout(2, false));

    Label nameLabel = new Label(composite, SWT.NONE);
    nameLabel.setText("Name:");

    GridData gd = new GridData(GridData.FILL);
    gd.widthHint = 100;
    nameLabel.setLayoutData(gd);

    nameText = new Text(composite, SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    nameText.setLayoutData(gd);

    Composite buttons = new Composite(parent, SWT.NONE);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment = GridData.END;
    buttons.setLayoutData(gd);
    buttons.setLayout(new RowLayout());

    Button saveButton = new Button(buttons, SWT.PUSH);
    saveButton.setText("Save");

    saveButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            name = "".equals(nameText.getText()) ? null : nameText.getText();
            action = OK;

            shell.close();
          }
        });

    Button cancelButton = new Button(buttons, SWT.PUSH);
    cancelButton.setText("Cancel");
    cancelButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            shell.close();
          }
        });
  }
Exemplo n.º 13
0
  public Control createControl(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    comp.setLayout(new GridLayout(3, false));
    comp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fButton = new Button(comp, SWT.CHECK);
    fButton.setText(PDEUIMessages.AdvancedPluginExportPage_signButton);
    GridData gd = new GridData();
    gd.horizontalSpan = 3;
    fButton.setLayoutData(gd);
    fButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            updateGroup(fButton.getSelection());
            fPage.pageChanged();
          }
        });

    fKeystoreLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_keystore);
    fKeystoreText = createText(comp, 1);

    fBrowseButton = new Button(comp, SWT.PUSH);
    fBrowseButton.setText(PDEUIMessages.ExportWizard_browse);
    fBrowseButton.setLayoutData(new GridData());
    SWTUtil.setButtonDimensionHint(fBrowseButton);
    fBrowseButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            FileDialog dialog = new FileDialog(fPage.getShell(), SWT.OPEN);
            String path = fKeystoreText.getText();
            if (path.trim().length() == 0)
              path = PDEPlugin.getWorkspace().getRoot().getLocation().toString();
            dialog.setFileName(path);
            String res = dialog.open();
            if (res != null) {
              fKeystoreText.setText(res);
            }
          }
        });

    fKeypassLabel = createLabel(comp, PDEUIMessages.JARSigningTab_keypass);
    fKeypassText = createText(comp, 2);
    fKeypassText.setEchoChar('*');

    fAliasLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_alias);
    fAliasText = createText(comp, 2);

    fPasswordLabel = createLabel(comp, PDEUIMessages.AdvancedPluginExportPage_password);
    fPasswordText = createText(comp, 2);
    fPasswordText.setEchoChar('*');

    Dialog.applyDialogFont(comp);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(comp, IHelpContextIds.ADVANCED_PLUGIN_EXPORT);
    return comp;
  }
Exemplo n.º 14
0
 @Override
 protected void createButtonsForButtonBar(Composite parent) {
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalAlignment = GridData.CENTER;
   parent.setLayoutData(gd);
   parent.setBackground(JFaceColors.getBannerBackground(parent.getDisplay()));
   Button button = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
   button.setFocus();
 }
  public void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    section.setLayoutData(data);

    section.setText(PDEUIMessages.IntroSection_sectionText);
    section.setDescription(PDEUIMessages.IntroSection_sectionDescription);

    boolean canCreateNew = TargetPlatformHelper.getTargetVersion() >= NEW_INTRO_SUPPORT_VERSION;

    Composite client = toolkit.createComposite(section);
    client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, canCreateNew ? 3 : 2));
    client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label label = toolkit.createLabel(client, PDEUIMessages.IntroSection_introLabel, SWT.WRAP);
    GridData td = new GridData();
    td.horizontalSpan = canCreateNew ? 3 : 2;
    label.setLayoutData(td);

    Label introLabel = toolkit.createLabel(client, PDEUIMessages.IntroSection_introInput);
    introLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));

    fIntroCombo = new ComboPart();
    fIntroCombo.createControl(client, toolkit, SWT.READ_ONLY);
    td = new GridData(GridData.FILL_HORIZONTAL);
    fIntroCombo.getControl().setLayoutData(td);
    loadManifestAndIntroIds(false);
    if (fAvailableIntroIds != null) fIntroCombo.setItems(fAvailableIntroIds);
    fIntroCombo.add(""); // $NON-NLS-1$
    fIntroCombo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleSelection();
          }
        });

    if (canCreateNew) {
      Button button = toolkit.createButton(client, PDEUIMessages.IntroSection_new, SWT.PUSH);
      button.setEnabled(isEditable());
      button.setLayoutData(new GridData(GridData.FILL));
      button.addSelectionListener(
          new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
              handleNewIntro();
            }
          });
    }

    fIntroCombo.getControl().setEnabled(isEditable());

    toolkit.paintBordersFor(client);
    section.setClient(client);
    // Register to be notified when the model changes
    getModel().addModelChangedListener(this);
  }
Exemplo n.º 16
0
  public void init(Shell parentShell) {
    shell = ShellFactory.createShell(parentShell, SWT.BORDER | SWT.TITLE | SWT.CLOSE | SWT.RESIZE);
    Utils.setShellIcon(shell);
    if (Constants.isOSX) monospace = new Font(shell.getDisplay(), "Courier", 12, SWT.NORMAL);
    else monospace = new Font(shell.getDisplay(), "Courier New", 8, SWT.NORMAL);

    shell.setText(
        MessageText.getString("window.welcome.title", new String[] {Constants.AZUREUS_VERSION}));

    display = shell.getDisplay();

    GridLayout layout = new GridLayout();
    shell.setLayout(layout);

    GridData data;

    cWhatsNew = new Composite(shell, SWT.BORDER);
    data = new GridData(GridData.FILL_BOTH);
    cWhatsNew.setLayoutData(data);
    cWhatsNew.setLayout(new FillLayout());

    Button bClose = new Button(shell, SWT.PUSH);
    bClose.setText(MessageText.getString("Button.close"));
    data = new GridData();
    data.widthHint = 70;
    data.horizontalAlignment = Constants.isOSX ? SWT.CENTER : SWT.RIGHT;
    bClose.setLayoutData(data);

    Listener closeListener =
        new Listener() {
          public void handleEvent(Event event) {
            close();
          }
        };

    bClose.addListener(SWT.Selection, closeListener);
    shell.addListener(SWT.Close, closeListener);

    shell.setDefaultButton(bClose);

    shell.addListener(
        SWT.Traverse,
        new Listener() {
          public void handleEvent(Event e) {
            if (e.character == SWT.ESC) {
              close();
            }
          }
        });

    shell.setSize(750, 500);
    Utils.centreWindow(shell);
    shell.layout();
    shell.open();
    pullWhatsNew(cWhatsNew);
  }
  protected Control createContents(Composite parent) {
    initializeValues();
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createControls(composite);

    return getControl();
  }
Exemplo n.º 18
0
  public TermWinUI(Shell parent) {
    self = new Shell(parent, SWT.SHELL_TRIM);
    self.setLayout(new GridLayout());

    mainPane = new Composite(self, SWT.NONE);
    mainPane.setLayout(new GridLayout(3, false));
    mainPane.setLayoutData(new GridData(GridData.FILL_BOTH));

    createContent();
  }
Exemplo n.º 19
0
  /** This method initializes main controls of the main window */
  private void initControlsArea(
      final Composite controlsArea,
      final Combo feederSelectionCombo,
      final Button startStopButton,
      final StartStopScanningAction startStopScanningAction,
      final ToolsActions.Preferences preferencesListener,
      final ToolsActions.ChooseFetchers chooseFetchersListsner) {
    controlsArea.setLayoutData(
        LayoutHelper.formData(
            new FormAttachment(feederArea),
            new FormAttachment(100),
            new FormAttachment(0),
            new FormAttachment(feederArea, 0, SWT.BOTTOM)));
    controlsArea.setLayout(LayoutHelper.formLayout(7, 3, 3));

    // steal the height from the second child of the FeederGUI - this must be the first edit box.
    // this results in better visual alignment with FeederGUIs
    Control secondControl = feederRegistry.current().getChildren()[1];
    // initialize global standard button height
    buttonHeight = secondControl.getSize().y + 2;

    // feeder selection combobox
    this.feederSelectionCombo = feederSelectionCombo;
    feederSelectionCombo.pack();
    IPFeederSelectionListener feederSelectionListener = new IPFeederSelectionListener();
    feederSelectionCombo.addSelectionListener(feederSelectionListener);
    // initialize the selected feeder GUI
    feederSelectionCombo.select(guiConfig.activeFeeder);
    feederSelectionCombo.setToolTipText(Labels.getLabel("combobox.feeder.tooltip"));

    // start/stop button
    this.startStopButton = startStopButton;
    shell.setDefaultButton(startStopButton);
    startStopButton.addSelectionListener(startStopScanningAction);

    // traverse the button before the combo (and don't traverse other buttons at all)
    controlsArea.setTabList(new Control[] {startStopButton, feederSelectionCombo});

    prefsButton = new ToolBar(controlsArea, SWT.FLAT);
    prefsButton.setCursor(prefsButton.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    ToolItem item = new ToolItem(prefsButton, SWT.PUSH);
    item.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.preferences.img")));
    item.setToolTipText(Labels.getLabel("title.preferences"));
    item.addListener(SWT.Selection, preferencesListener);

    fetchersButton = new ToolBar(controlsArea, SWT.FLAT);
    fetchersButton.setCursor(fetchersButton.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    item = new ToolItem(fetchersButton, SWT.PUSH);
    item.setImage(new Image(null, Labels.getInstance().getImageAsStream("button.fetchers.img")));
    item.setToolTipText(Labels.getLabel("title.fetchers.select"));
    item.addListener(SWT.Selection, chooseFetchersListsner);

    feederSelectionListener.widgetSelected(null);
  }
  private Control createImplicitTabContents(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    container.setLayout(layout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    container.setFont(parent.getFont());

    createImpLabel(container);
    createImpTable(container);
    createImpButtons(container);
    return container;
  }
  private void createProgressBarConfig(Composite parent) {
    fAddBarButton = createButton(parent, fToolkit, PDEUIMessages.SplashSection_progressBar);
    fAddBarButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            boolean enable = fAddBarButton.getSelection();
            getSplashInfo().addProgressBar(enable, false);
            updateFieldEnablement();
          }
        });
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalIndent = 5;
    data.horizontalSpan = F_NUM_COLUMNS;
    fAddBarButton.setLayoutData(data);
    fAddBarButton.setEnabled(isEditable());

    Color foreground = fToolkit.getColors().getColor(IFormColors.TITLE);

    fBarControls[0] =
        createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressX);
    fBarControls[1] = fBarSpinners[0] = createSpinner(parent, fToolkit);
    fBarControls[2] =
        createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressY);
    fBarControls[3] = fBarSpinners[1] = createSpinner(parent, fToolkit);
    fBarControls[4] =
        createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressWidth);
    fBarControls[5] = fBarSpinners[2] = createSpinner(parent, fToolkit);
    fBarControls[6] =
        createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressHeight);
    fBarControls[7] = fBarSpinners[3] = createSpinner(parent, fToolkit);
    // Add tooltips to coordinate controls
    addOffsetTooltips(fBarControls);

    for (Spinner spinner : fBarSpinners) {
      spinner.setEnabled(isEditable());
      spinner.addModifyListener(
          new ModifyListener() {
            @Override
            public void modifyText(ModifyEvent e) {
              applySpinners(true);
            }
          });
    }

    Composite filler = fToolkit.createComposite(parent);
    filler.setLayout(new GridLayout());
    GridData gd = new GridData();
    gd.horizontalSpan = 2;
    filler.setLayoutData(gd);
  }
Exemplo n.º 22
0
  @NotNull
  public static Text createOutputFolderChooser(
      final Composite parent, @Nullable String label, @Nullable ModifyListener changeListener) {
    UIUtils.createControlLabel(
        parent, label != null ? label : CoreMessages.data_transfer_wizard_output_label_directory);
    Composite chooserPlaceholder = UIUtils.createPlaceholder(parent, 2);
    chooserPlaceholder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    final Text directoryText = new Text(chooserPlaceholder, SWT.BORDER);
    directoryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (changeListener != null) {
      directoryText.addModifyListener(changeListener);
    }

    final Runnable folderChooser =
        new Runnable() {
          @Override
          public void run() {
            DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.NONE);
            dialog.setMessage(CoreMessages.data_transfer_wizard_output_dialog_directory_message);
            dialog.setText(CoreMessages.data_transfer_wizard_output_dialog_directory_text);
            String directory = directoryText.getText();
            if (!CommonUtils.isEmpty(directory)) {
              dialog.setFilterPath(directory);
            }
            directory = dialog.open();
            if (directory != null) {
              directoryText.setText(directory);
            }
          }
        };
    directoryText.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseUp(MouseEvent e) {
            folderChooser.run();
          }
        });

    Button openFolder = new Button(chooserPlaceholder, SWT.PUSH | SWT.FLAT);
    openFolder.setImage(DBeaverIcons.getImage(DBIcon.TREE_FOLDER));
    openFolder.setLayoutData(
        new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.HORIZONTAL_ALIGN_CENTER));
    openFolder.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            folderChooser.run();
          }
        });
    return directoryText;
  }
Exemplo n.º 23
0
 @Override
 protected void createClient(Section section, FormToolkit toolkit) {
   container = toolkit.createComposite(section);
   GridLayout layout = new GridLayout();
   layout.numColumns = 2;
   container.setLayout(layout);
   section.setClient(container);
   linkContainer = toolkit.createComposite(container);
   linkContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
   GridLayout linkLayout = new GridLayout();
   linkLayout.marginWidth = 0;
   linkLayout.marginHeight = 0;
   linkLayout.verticalSpacing = 0;
   linkContainer.setLayout(linkLayout);
 }
Exemplo n.º 24
0
 private void createButtons() {
   Composite buttonArea = new Composite(shell, SWT.NONE);
   buttonArea.setLayout(new GridLayout(0, true));
   GridData buttonData = new GridData(SWT.CENTER, SWT.CENTER, true, false);
   buttonData.horizontalSpan = 2;
   buttonArea.setLayoutData(buttonData);
   createButton(buttonArea, SWT.getMessage("SWT_Yes"), SWT.YES);
   createButton(buttonArea, SWT.getMessage("SWT_No"), SWT.NO);
   createButton(buttonArea, SWT.getMessage("SWT_OK"), SWT.OK);
   createButton(buttonArea, SWT.getMessage("SWT_Abort"), SWT.ABORT);
   createButton(buttonArea, SWT.getMessage("SWT_Retry"), SWT.RETRY);
   createButton(buttonArea, SWT.getMessage("SWT_Cancel"), SWT.CANCEL);
   createButton(buttonArea, SWT.getMessage("SWT_Ignore"), SWT.IGNORE);
   buttonArea.getChildren()[0].forceFocus();
 }
 protected Composite createMinOccurComp(Composite parent, FormToolkit toolkit) {
   fMinLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_minOccurLabel);
   fMinLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
   Composite comp = toolkit.createComposite(parent);
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalSpan = 2;
   GridLayout layout = new GridLayout();
   layout.marginHeight = layout.marginWidth = 0;
   comp.setLayout(layout);
   comp.setLayoutData(gd);
   fMinOccurSpinner = new Spinner(comp, SWT.BORDER);
   fMinOccurSpinner.setMinimum(0);
   fMinOccurSpinner.setMaximum(999);
   return comp;
 }
 protected Button[] createTrueFalseButtons(Composite parent, FormToolkit toolkit, int colSpan) {
   Composite comp = toolkit.createComposite(parent, SWT.NONE);
   GridLayout gl = new GridLayout(2, false);
   gl.marginHeight = gl.marginWidth = 0;
   comp.setLayout(gl);
   GridData gd = new GridData(GridData.FILL_HORIZONTAL);
   gd.horizontalSpan = colSpan;
   gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT;
   comp.setLayoutData(gd);
   Button tButton = toolkit.createButton(comp, BOOLS[0], SWT.RADIO);
   Button fButton = toolkit.createButton(comp, BOOLS[1], SWT.RADIO);
   gd = new GridData();
   gd.horizontalIndent = 20;
   fButton.setLayoutData(gd);
   return new Button[] {tButton, fButton};
 }
Exemplo n.º 27
0
  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), false));
    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // create UI elements
    fNameGroup = new NameGroup(composite, fInitialName, getShell());
    fPHPLocationGroup = new LocationGroup(composite, fNameGroup, getShell());

    CompositeData data = new CompositeData();
    data.setParetnt(composite);
    data.setSettings(getDialogSettings());
    data.setObserver(fPHPLocationGroup);
    fragment =
        (WizardFragment)
            Platform.getAdapterManager()
                .loadAdapter(data, PHPProjectWizardFirstPage.class.getName());

    fVersionGroup = new VersionGroup(composite);
    fLayoutGroup = new LayoutGroup(composite);
    fJavaScriptSupportGroup = new JavaScriptSupportGroup(composite, this);

    fDetectGroup = new DetectGroup(composite, fPHPLocationGroup, fNameGroup);

    // establish connections
    fNameGroup.addObserver(fPHPLocationGroup);
    fDetectGroup.addObserver(fLayoutGroup);

    fPHPLocationGroup.addObserver(fDetectGroup);
    // initialize all elements
    fNameGroup.notifyObservers();
    // create and connect validator
    fPdtValidator = new Validator();

    fNameGroup.addObserver(fPdtValidator);
    fPHPLocationGroup.addObserver(fPdtValidator);

    setControl(composite);
    Dialog.applyDialogFont(composite);

    // set the focus to the project name
    fNameGroup.postSetFocus();

    setHelpContext(composite);
  }
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit)
   */
  protected void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    GridData sectionData = new GridData(GridData.FILL_BOTH);
    sectionData.verticalSpan = 2;
    section.setLayoutData(sectionData);

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    createOptionalDependenciesButton(container);

    TablePart tablePart = getTablePart();
    fPluginTable = tablePart.getTableViewer();
    fPluginTable.setContentProvider(new ContentProvider());
    fPluginTable.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    fPluginTable.setComparator(
        new ViewerComparator() {
          public int compare(Viewer viewer, Object e1, Object e2) {
            IProductPlugin p1 = (IProductPlugin) e1;
            IProductPlugin p2 = (IProductPlugin) e2;
            return super.compare(viewer, p1.getId(), p2.getId());
          }
        });
    GridData data = (GridData) tablePart.getControl().getLayoutData();
    data.minimumWidth = 200;
    fPluginTable.setInput(getProduct());

    tablePart.setButtonEnabled(0, isEditable());
    tablePart.setButtonEnabled(1, isEditable());
    tablePart.setButtonEnabled(2, isEditable());

    // remove buttons will be updated on refresh

    tablePart.setButtonEnabled(5, isEditable());

    toolkit.paintBordersFor(container);
    section.setClient(container);

    section.setText(PDEUIMessages.Product_PluginSection_title);
    section.setDescription(PDEUIMessages.Product_PluginSection_desc);
    getModel().addModelChangedListener(this);
    createSectionToolbar(section, toolkit);
  }
 public void createFileFilterPanel(Shell dialog) {
   Composite filterPanel = new Composite(dialog, SWT.NONE);
   GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
   filterPanel.setLayoutData(gridData);
   filterPanel.setLayout(new GridLayout(3, false));
   // create filter label
   Label filterLabel = new Label(filterPanel, SWT.NONE);
   filterLabel.setText(Messages.getString("VfsFileChooserDialog.filter")); // $NON-NLS-1$
   gridData = new GridData(SWT.FILL, SWT.CENTER, false, false);
   filterLabel.setLayoutData(gridData);
   // create file filter combo
   fileFilterCombo = new Combo(filterPanel, SWT.READ_ONLY);
   gridData = new GridData(SWT.FILL, SWT.FILL, true, false);
   fileFilterCombo.setLayoutData(gridData);
   fileFilterCombo.setItems(fileFilterNames);
   fileFilterCombo.addSelectionListener(this);
   fileFilterCombo.select(0);
 }
  public void createURLControl(Composite composite) {
    Group group = new Group(composite, SWT.NONE);
    String projectLabel = PHPServerUIMessages.getString("ServerTab.url"); // $NON-NLS-1$
    group.setText(projectLabel);
    group.setLayout(new GridLayout(2, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    autoGeneratedURL = new Button(group, SWT.CHECK);
    autoGeneratedURL.setText(
        PHPServerUIMessages.getString("ServerTab.autoGenerate")); // $NON-NLS-1$
    autoGeneratedURL.setSelection(true);
    autoGeneratedURL.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    autoGeneratedURL.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            initializeURLControl();
            updateLaunchConfigurationDialog();
          }
        });

    fURLLabel = new Label(group, SWT.NONE);
    fURLLabel.setText(PHPServerUIMessages.getString("ServerTab.urlLabel")); // $NON-NLS-1$
    GridData gridData = new GridData();
    gridData.horizontalIndent = 20;
    gridData.horizontalSpan = 1;
    fURLLabel.setLayoutData(gridData);

    Composite urlComposite = new Composite(group, SWT.NONE);
    urlComposite.setLayout(new GridLayout(2, false));
    urlComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fURLHost = new Text(urlComposite, SWT.SINGLE | SWT.BORDER);
    fURLHost.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fURLHost.setEnabled(false);

    fURLPath = new Text(urlComposite, SWT.SINGLE | SWT.BORDER);
    fURLPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fURLPath.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            updateLaunchConfigurationDialog();
          }
        });
  }