Example usage for org.eclipse.jface.dialogs IDialogConstants SMALL_INDENT

List of usage examples for org.eclipse.jface.dialogs IDialogConstants SMALL_INDENT

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants SMALL_INDENT.

Prototype

int SMALL_INDENT

To view the source code for org.eclipse.jface.dialogs IDialogConstants SMALL_INDENT.

Click Source Link

Document

Small indent in dialog units (value 7).

Usage

From source file:org.eclipse.epp.internal.mpc.ui.wizards.NewsViewer.java

License:Open Source License

protected Control createNoBrowserPart(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    GridLayoutFactory.fillDefaults().numColumns(1).equalWidth(false).margins(20, 0).applyTo(container);

    Label noEmbedBrowserLabel = new Label(container, SWT.WRAP);
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.END).grab(true, true).hint(450, SWT.DEFAULT)
            .applyTo(noEmbedBrowserLabel);
    noEmbedBrowserLabel.setText(Messages.NewsViewer_No_embeddable_browser);

    final Link link = new Link(container, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.BEGINNING).indent(IDialogConstants.SMALL_INDENT, 0)
            .grab(true, true).hint(450 - IDialogConstants.SMALL_INDENT, SWT.DEFAULT).applyTo(link);
    link.setText(Messages.NewsViewer_No_news);
    link.setEnabled(false);//from  w w w . java2 s  . c  o  m
    link.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            WorkbenchUtil.openUrl(e.text, IWorkbenchBrowserSupport.AS_EXTERNAL);
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });

    Menu popup = new Menu(parent.getShell(), SWT.POP_UP);
    MenuItem copyMenuItem = new MenuItem(popup, SWT.PUSH);
    copyMenuItem.setText(Messages.NewsViewer_Copy_Link_Address);
    copyMenuItem.addSelectionListener(new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
            Clipboard clipboard = new Clipboard(link.getDisplay());
            String data = (String) link.getData("href"); //$NON-NLS-1$
            clipboard.setContents(new Object[] { data }, new Transfer[] { TextTransfer.getInstance() });
            clipboard.dispose();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
    link.setMenu(popup);

    browser = link;
    return container;
}