コード例 #1
0
 /*
  * Creates a help link. This is used when there is no help image
  * available.
  */
 private Link createLocalizationLink(Composite parent) {
   Link link = new Link(parent, SWT.WRAP | SWT.NO_FOCUS);
   ((GridLayout) parent.getLayout()).numColumns++;
   link.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, false, false));
   link.setText("<a>" + IDialogConstants.HELP_LABEL + "</a>"); // $NON-NLS-1$ //$NON-NLS-2$
   link.setToolTipText(IDialogConstants.HELP_LABEL);
   link.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(SelectionEvent e) {
           localizationPressed();
         }
       });
   return link;
 }
コード例 #2
0
  protected void createLinksPanel(Composite composite) {
    final DriverDescriptor driver = getWizard().getDriver();

    // UIUtils.createPlaceholder(composite, 1).setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite linksGroup = UIUtils.createPlaceholder(composite, 2);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.verticalIndent = 10;
    linksGroup.setLayoutData(gd);

    // Vendor site
    if (!CommonUtils.isEmpty(driver.getWebURL())) {
      Link link =
          UIUtils.createLink(
              linksGroup,
              "<a>Vendor's website</a>",
              new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                  RuntimeUtils.openWebBrowser(driver.getWebURL());
                }
              });
      link.setToolTipText(driver.getWebURL());
      link.setLayoutData(
          new GridData(
              GridData.FILL_HORIZONTAL
                  | GridData.VERTICAL_ALIGN_BEGINNING
                  | GridData.HORIZONTAL_ALIGN_BEGINNING));
    } else {
      UIUtils.createPlaceholder(linksGroup, 1)
          .setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    }

    Link link =
        UIUtils.createLink(
            linksGroup,
            "<a>Download configuration</a>",
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                UIUtils.showPreferencesFor(null, null, PrefPageDrivers.PAGE_ID);
              }
            });
    link.setLayoutData(
        new GridData(
            GridData.FILL_HORIZONTAL
                | GridData.VERTICAL_ALIGN_BEGINNING
                | GridData.HORIZONTAL_ALIGN_END));
  }
コード例 #3
0
ファイル: URLControl.java プロジェクト: udomsak/projektarbeit
  public void create() {
    label = new Label(parent, SWT.NULL);
    String labelText = type.getName();
    if (showValidationHint && useValidationGUIHints) {
      refontLabel(true);
    }
    label.setText(type.getName());

    Composite container = new Composite(parent, SWT.NULL);
    GridLayout contLayout = new GridLayout(3, false);
    contLayout.horizontalSpacing = 5;
    contLayout.marginLeft = 0;
    contLayout.marginWidth = 0;
    contLayout.marginHeight = 0;
    container.setLayout(contLayout);

    GridData containerLData = new GridData();
    containerLData.horizontalAlignment = GridData.FILL;
    containerLData.grabExcessHorizontalSpace = true;
    container.setLayoutData(containerLData);

    link = new Link(container, SWT.NONE);
    link.setToolTipText(this.type.getTooltiptext());
    link.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1));
    link.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event event) {
            if (getHref() != null && getHref().length() > 0) Program.launch(getHref());
          }
        });

    Button editBtn = new Button(container, SWT.PUSH);
    editBtn.setText(Messages.getString("URLControl.1")); // $NON-NLS-1$
    editBtn.setToolTipText(this.type.getTooltiptext());
    editBtn.setEnabled(editable);
    editBtn.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent arg0) {
            showLinkEditDialog();
          }

          public void widgetDefaultSelected(SelectionEvent arg0) {
            showLinkEditDialog();
          }
        });

    setLinkText();
  }
コード例 #4
0
  private Link createHelpLink(Composite parent) {
    Link link = new Link(parent, SWT.WRAP | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    link.setText("<a>" + IDialogConstants.HELP_LABEL + "</a>"); // $NON-NLS-1$ //$NON-NLS-2$
    link.setToolTipText(IDialogConstants.HELP_LABEL);
    link.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            helpPressed();
          }
        });
    return link;
  }
コード例 #5
0
ファイル: DialogAbout.java プロジェクト: p2y/arx
 /**
  * Creates a link.
  *
  * @param parent
  * @param text
  * @param tooltip
  * @param url
  */
 private void createLink(Composite parent, String text, String tooltip, final String url) {
   Link link = new Link(parent, SWT.NONE);
   link.setLayoutData(SWTUtil.createFillHorizontallyGridData());
   link.setText(text);
   link.setToolTipText(tooltip);
   link.setBackground(parent.getBackground());
   link.addListener(
       SWT.Selection,
       new Listener() {
         public void handleEvent(Event event) {
           try {
             Program.launch(url);
           } catch (Exception e) {
             /* Ignore*/
           }
         }
       });
 }
コード例 #6
0
ファイル: CommitDialog.java プロジェクト: blizzy78/egit
  @Override
  protected Control createHelpControl(Composite parent) {
    toolkit.adapt(parent, false, false);
    Link link = new Link(parent, SWT.WRAP | SWT.NO_FOCUS);
    ((GridLayout) parent.getLayout()).numColumns++;
    link.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    link.setText(UIText.CommitDialog_OpenStagingViewLink);
    link.setToolTipText(UIText.CommitDialog_OpenStagingViewToolTip);
    link.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            openStagingViewLinkClicked();
          }
        });

    toolkit.adapt(link, false, false);
    return link;
  }
コード例 #7
0
  private Control createLinkControl(Composite composite) {
    Link link = new Link(composite, SWT.WRAP | SWT.RIGHT);
    link.setText(DialogsMessages.SortMembersMessageDialog_description);
    link.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            openMembersSortOrderPage();
          }
        });
    link.setToolTipText(DialogsMessages.SortMembersMessageDialog_link_tooltip);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false);
    gridData.widthHint =
        convertHorizontalDLUsToPixels(
            IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH); // convertWidthInCharsToPixels(60);
    link.setLayoutData(gridData);
    link.setFont(composite.getFont());

    return link;
  }
コード例 #8
0
  private void createMessage(final Composite composite) {
    // TODO create a link with an argument, so the formatter preference page can open the
    // current profile automatically.
    String linkTooltip = PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tooltip;
    String text;
    String indentMode =
        JavaPlugin.getDefault()
            .getCombinedPreferenceStore()
            .getString(DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR);
    if (JavaCore.TAB.equals(indentMode))
      text =
          Messages.format(
              PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_tab_text,
              new String[] {Integer.toString(getTabDisplaySize())});
    else
      text =
          Messages.format(
              PreferencesMessages.SmartTypingConfigurationBlock_tabs_message_others_text,
              new String[] {
                Integer.toString(getTabDisplaySize()),
                Integer.toString(getIndentSize()),
                getIndentMode()
              });

    final Link link = new Link(composite, SWT.NONE);
    link.setText(text);
    link.setToolTipText(linkTooltip);
    GridData gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
    gd.widthHint = 300; // don't get wider initially
    link.setLayoutData(gd);
    link.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(
                link.getShell(),
                "org.eclipse.jdt.ui.preferences.CodeFormatterPreferencePage",
                null,
                null); //$NON-NLS-1$
          }
        });

    final IPreferenceStore combinedStore = JavaPlugin.getDefault().getCombinedPreferenceStore();
    final IPropertyChangeListener propertyChangeListener =
        new IPropertyChangeListener() {
          private boolean fHasRun = false;

          public void propertyChange(PropertyChangeEvent event) {
            if (fHasRun) return;
            if (composite.isDisposed()) return;
            String property = event.getProperty();
            if (DefaultCodeFormatterConstants.FORMATTER_TAB_CHAR.equals(property)
                || DefaultCodeFormatterConstants.FORMATTER_TAB_SIZE.equals(property)) {
              fHasRun = true;
              link.dispose();
              createMessage(composite);
              Dialog.applyDialogFont(composite);
              composite.redraw();
              composite.layout();
            }
          }
        };
    combinedStore.addPropertyChangeListener(propertyChangeListener);
    link.addDisposeListener(
        new DisposeListener() {
          public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
            combinedStore.removePropertyChangeListener(propertyChangeListener);
          }
        });
  }