Example usage for org.eclipse.jface.preference PreferencePage getControl

List of usage examples for org.eclipse.jface.preference PreferencePage getControl

Introduction

In this page you can find the example usage for org.eclipse.jface.preference PreferencePage getControl.

Prototype

@Override
public Control getControl() 

Source Link

Document

Returns the top level control for this dialog page.

Usage

From source file:org.jboss.tools.common.model.ui.preferences.TabbedPreferencesPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    this.noDefaultAndApplyButton();
    TabFolder tabbedComposite = new TabFolder(parent, SWT.NULL);
    tabbedComposite.setBackground(parent.getBackground());

    for (Iterator iter = pageList.iterator(); iter.hasNext();) {
        PreferencePage element = (PreferencePage) iter.next();
        TabItem newTab = new TabItem(tabbedComposite, SWT.NULL);
        element.createControl(tabbedComposite);
        if (element instanceof XMOBasedPreferencesPage)
            ((XMOBasedPreferencesPage) element).initPageProperties();
        newTab.setControl(element.getControl());
        newTab.setText(element.getTitle());
    }/*from   www. j av  a 2  s .  c  om*/

    return tabbedComposite;
}

From source file:org.lamport.tla.toolbox.ui.preference.LibraryPathComposite.java

License:Open Source License

public LibraryPathComposite(final PreferencePage preferencePage) {
    this.preferencePage = preferencePage;

    Composite parent = (Composite) preferencePage.getControl();

    Composite comp = SWTFactory.createComposite(parent, 2, 1, GridData.FILL_HORIZONTAL, 0, 0);

    SWTFactory.createWrapLabel(comp,/*  w ww . jav  a2 s. c  om*/
            "Add, remove or edit TLA+ library path locations. Unchecked locations will not be used, order reflects in the search order (Spec specific library path locations replace the general library path locations).",
            2, 250);
    SWTFactory.createVerticalSpacer(comp, 1);
    SWTFactory.createWrapLabel(comp, "&TLA+ library path locations:", 2);

    Table table = new Table(comp, SWT.FULL_SELECTION | SWT.MULTI | SWT.BORDER | SWT.CHECK | SWT.V_SCROLL);
    table.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridData gd = (GridData) table.getLayoutData();
    gd.widthHint = 250;
    table.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent e) {
            if (e.stateMask == SWT.NONE && e.keyCode == SWT.DEL) {
                removeLocation();
            }
        }
    });
    fTableViewer = new CheckboxTableViewer(table);
    fTableViewer.setLabelProvider(new TableColumnLabelProvider());
    fTableViewer.setContentProvider(new ArrayContentProvider());

    Composite bcomp = SWTFactory.createComposite(comp, 1, 1,
            GridData.FILL_VERTICAL | GridData.VERTICAL_ALIGN_BEGINNING, 0, 0);
    moveUpButton = SWTFactory.createPushButton(bcomp, "&Move up", null);
    moveUpButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            move(true);
        }
    });
    moveDownButton = SWTFactory.createPushButton(bcomp, "Mo&ve down", null);
    moveDownButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            move(false);
        }
    });

    SWTFactory.createHorizontalSpacer(bcomp, 1);

    Button button = SWTFactory.createPushButton(bcomp, "Add Dire&ctory...", null);
    button.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            String loc = getDirectory(null);
            if (loc != null) {
                addLocation(loc);
            }
        }
    });

    final Button editbutton = SWTFactory.createPushButton(bcomp, "&Edit Location...", null);
    editbutton.setEnabled(false);
    editbutton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            edit();
        }
    });
    final Button remove = SWTFactory.createPushButton(bcomp, "&Remove", null);
    remove.setEnabled(false);
    remove.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            removeLocation();
        }
    });

    fTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) fTableViewer.getSelection();
            remove.setEnabled(!selection.isEmpty());
            editbutton.setEnabled(selection.size() == 1);

            updateEnablementMoveButtons(selection);
        }
    });
    fTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            edit();
        }
    });

    performInit();
    Dialog.applyDialogFont(comp);
}