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

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

Introduction

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

Prototype

int VERTICAL_SPACING

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

Click Source Link

Document

Vertical spacing in dialog units (value 4).

Usage

From source file:org.eclipse.ui.internal.cheatsheets.dialogs.CheatSheetCategoryBasedSelectionDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);/* w ww.  ja v  a  2  s  . c o m*/

    IDialogSettings workbenchSettings = CheatSheetPlugin.getPlugin().getDialogSettings();
    IDialogSettings dialogSettings = workbenchSettings.getSection(DIALOG_SETTINGS_SECTION);
    if (dialogSettings == null)
        dialogSettings = workbenchSettings.addNewSection(DIALOG_SETTINGS_SECTION);

    setDialogSettings(dialogSettings);

    // top level group
    Composite outerContainer = (Composite) super.createDialogArea(parent);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, CHEAT_SHEET_SELECTION_HELP_ID);
    GridLayout gridLayout = new GridLayout();
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    outerContainer.setLayout(gridLayout);
    outerContainer.setLayoutData(new GridData(GridData.FILL_BOTH));

    // Create label
    createMessageArea(outerContainer);

    // Create radio button
    selectRegisteredRadio = new Button(outerContainer, SWT.RADIO);
    selectRegisteredRadio.setText(Messages.get().SELECTION_DIALOG_OPEN_REGISTERED);

    SashForm sform = new SashForm(outerContainer, SWT.VERTICAL);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = 300;
    sform.setLayoutData(data);

    // category tree pane
    treeViewer = new TreeViewer(sform, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    treeViewer.getTree().setLayoutData(data);
    treeViewer.setContentProvider(getCheatSheetProvider());
    treeViewer.setLabelProvider(new CheatsheetLabelProvider());
    treeViewer.setComparator(CheatSheetCollectionSorter.INSTANCE);
    treeViewer.addFilter(activityViewerFilter);
    treeViewer.addSelectionChangedListener(this);
    treeViewer.setInput(cheatsheetCategories);

    desc = new Text(sform, SWT.MULTI | SWT.WRAP);
    desc.setEditable(false);

    sform.setWeights(new int[] { 10, 2 });

    if (activityViewerFilter.getHasEncounteredFilteredItem())
        createShowAllButton(outerContainer);

    // Add double-click listener
    treeViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            Object obj = selection.getFirstElement();
            if (obj instanceof CheatSheetCollectionElement) {
                boolean state = treeViewer.getExpandedState(obj);
                treeViewer.setExpandedState(obj, !state);
            } else {
                okPressed();
            }
        }
    });

    // RAP [if] Selecting the file from the local machine is not supported
    //        // Create radio button for select from file
    //      selectFileRadio = new Button(outerContainer, SWT.RADIO);
    //      selectFileRadio.setText(Messages.get().SELECTION_DIALOG_OPEN_FROM_FILE);
    //
    //      Composite selectFileComposite = new Composite(outerContainer, SWT.NULL);
    //      GridLayout selectFileLayout = new GridLayout();
    //      selectFileLayout.marginWidth = 0;
    //      selectFileLayout.marginHeight = 0;
    //      selectFileLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    //      selectFileLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    //      selectFileLayout.numColumns = 2;
    //      selectFileComposite.setLayout(selectFileLayout);
    //      GridData sfCompositeData = new GridData(GridData.FILL_HORIZONTAL);
    //      sfCompositeData.widthHint = 300;
    //      selectFileComposite.setLayoutData(sfCompositeData);
    //      selectFileCombo = new Combo(selectFileComposite, SWT.BORDER);
    //      GridData sfTextData = new GridData(GridData.FILL_HORIZONTAL);
    //      selectFileCombo.setLayoutData(sfTextData);
    //      browseFileButton = new Button(selectFileComposite, SWT.NULL);
    //      browseFileButton.setText(Messages.get().SELECTION_DIALOG_FILEPICKER_BROWSE);
    //      setButtonLayoutData(browseFileButton);

    // Create radio button for select from URL
    selectUrlRadio = new Button(outerContainer, SWT.RADIO);
    selectUrlRadio.setText(Messages.get().SELECTION_DIALOG_OPEN_FROM_URL);
    selectUrlCombo = new Combo(outerContainer, SWT.BORDER);
    GridData suTextData = new GridData(GridData.FILL_HORIZONTAL);
    selectUrlCombo.setLayoutData(suTextData);

    restoreWidgetValues();
    restoreFileSettings();

    if (!treeViewer.getSelection().isEmpty())
        // we only set focus if a selection was restored
        treeViewer.getTree().setFocus();

    Dialog.applyDialogFont(outerContainer);
    // RAP [if] Selecting the file from the local machine is not supported
    //      selectFileCombo.addModifyListener(new FileAndUrlListener());
    //      browseFileButton.addSelectionListener(new BrowseListener());
    selectRegisteredRadio.addSelectionListener(new RadioSelectionListener());
    selectUrlRadio.addSelectionListener(new RadioSelectionListener());
    selectUrlCombo.addModifyListener(new FileAndUrlListener());
    checkRadioButtons();
    return outerContainer;
}

From source file:org.eclipse.ui.internal.dialogs.AbstractWorkingSetDialog.java

License:Open Source License

/**
 * Adds the modify buttons to the dialog.
 * /*www  .j a v  a 2 s . com*/
 * @param composite
 *            Composite to add the buttons to
 */
protected void addModifyButtons(Composite composite) {
    Composite buttonComposite = new Composite(composite, SWT.RIGHT);
    GridLayout layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    buttonComposite.setLayout(layout);
    GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_VERTICAL);
    buttonComposite.setLayoutData(data);

    newButton = createButton(buttonComposite, ID_NEW,
            WorkbenchMessages.WorkingSetSelectionDialog_newButton_label, false);
    newButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            createWorkingSet();
        }
    });

    if (canEdit) {
        detailsButton = createButton(buttonComposite, ID_DETAILS,
                WorkbenchMessages.WorkingSetSelectionDialog_detailsButton_label, false);
        detailsButton.setEnabled(false);
        detailsButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                editSelectedWorkingSet();
            }
        });

        removeButton = createButton(buttonComposite, ID_REMOVE,
                WorkbenchMessages.WorkingSetSelectionDialog_removeButton_label, false);
        removeButton.setEnabled(false);
        removeButton.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                removeSelectedWorkingSets();
            }
        });
    }

    layout.numColumns = 1; // must manually reset the number of columns because createButton increments it - we want these buttons to be laid out vertically.
}

From source file:org.eclipse.ui.internal.dialogs.PerspectivesPreferencePage.java

License:Open Source License

/**
 * Creates and returns the vertical button bar.
 * //from   ww  w  .  ja va2s .com
 * @param parent
 *            the parent composite to contain the button bar
 * @return the button bar control
 */
protected Control createVerticalButtonBar(Composite parent) {
    // Create composite.
    Composite composite = new Composite(parent, SWT.NULL);

    // create a layout with spacing and margins appropriate for the font
    // size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = 5;
    layout.marginHeight = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    composite.setFont(parent.getFont());

    // Add the buttons to the button bar.
    setDefaultButton = createVerticalButton(composite, WorkbenchMessages.PerspectivesPreference_MakeDefault,
            false);
    setDefaultButton.setToolTipText(WorkbenchMessages.PerspectivesPreference_MakeDefaultTip);

    revertButton = createVerticalButton(composite, WorkbenchMessages.PerspectivesPreference_Reset, false);
    revertButton.setToolTipText(WorkbenchMessages.PerspectivesPreference_ResetTip);

    deleteButton = createVerticalButton(composite, WorkbenchMessages.PerspectivesPreference_Delete, false);
    deleteButton.setToolTipText(WorkbenchMessages.PerspectivesPreference_DeleteTip);
    updateButtons();

    return composite;
}

From source file:org.eclipse.ui.internal.dialogs.SimpleWorkingSetSelectionDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);/*  ww w .  j  a  va 2s  . c  o m*/

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

    Composite viewerComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    viewerComposite.setLayout(layout);
    viewerComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

    viewer = CheckboxTableViewer.newCheckList(viewerComposite, SWT.BORDER);
    viewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    viewer.setLabelProvider(new WorkingSetLabelProvider());
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.addFilter(new WorkingSetFilter(null));
    IWorkingSet[] workingSets = PlatformUI.getWorkbench().getWorkingSetManager().getWorkingSets();
    viewer.setInput(workingSets);
    viewer.setFilters(new ViewerFilter[] { new Filter() });

    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            handleSelectionChanged();
        }
    });
    viewer.setCheckedElements(initialSelection);

    GridData viewerData = new GridData(GridData.FILL_BOTH);
    viewerData.widthHint = convertWidthInCharsToPixels(50);
    viewer.getControl().setLayoutData(viewerData);

    addModifyButtons(viewerComposite);

    addSelectionButtons(composite);

    availableWorkingSetsChanged();

    Dialog.applyDialogFont(composite);

    viewerData.heightHint = viewer.getTable().getItemHeight() * Math.min(30, Math.max(10, workingSets.length));

    return composite;
}

From source file:org.eclipse.ui.internal.dialogs.WorkbenchEditorsDialog.java

License:Open Source License

/**
 * Creates the contents of this dialog, initializes the
 * listener and the update thread./*w  w  w. ja  v a2  s  .c o m*/
 */
protected Control createDialogArea(Composite parent) {

    initializeDialogUnits(parent);

    Font font = parent.getFont();

    Composite dialogArea = new Composite(parent, SWT.NONE);
    CellLayout dialogAreaLayout = new CellLayout(1)
            .setMargins(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .setSpacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .setRow(1, Row.growing());
    dialogArea.setLayout(dialogAreaLayout);
    dialogArea.setLayoutData(new GridData(GridData.FILL_BOTH));

    //Label over the table
    Label l = new Label(dialogArea, SWT.NONE);
    l.setText(WorkbenchMessages.WorkbenchEditorsDialog_label);
    l.setFont(font);
    l.setLayoutData(new CellData().align(SWT.FILL, SWT.CENTER));
    //Table showing the editors name, full path and perspective
    editorsTable = new Table(dialogArea,
            SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    editorsTable.setLinesVisible(true);
    editorsTable.setHeaderVisible(true);
    editorsTable.setFont(font);

    final int height = 16 * editorsTable.getItemHeight();
    final int width = (int) (2.5 * height);

    CellData tableData = new CellData().align(SWT.FILL, SWT.FILL).setHint(CellData.OVERRIDE, width, height);

    editorsTable.setLayoutData(tableData);
    editorsTable.setLayout(new Layout() {
        protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache) {
            return new Point(width, height);
        }

        protected void layout(Composite composite, boolean flushCache) {
            TableColumn c[] = editorsTable.getColumns();
            if (columnsWidth == null) {
                int w = editorsTable.getClientArea().width;
                c[0].setWidth(w * 1 / 3);
                c[1].setWidth(w - c[0].getWidth());
            } else {
                c[0].setWidth(columnsWidth[0]);
                c[1].setWidth(columnsWidth[1]);
            }
            editorsTable.setLayout(null);
        }
    });
    //Name column
    TableColumn tc = new TableColumn(editorsTable, SWT.NONE);
    tc.setResizable(true);
    tc.setText(WorkbenchMessages.WorkbenchEditorsDialog_name);
    tc.addSelectionListener(headerListener);
    //Full path column
    tc = new TableColumn(editorsTable, SWT.NONE);
    tc.setResizable(true);
    tc.setText(WorkbenchMessages.WorkbenchEditorsDialog_path);
    tc.addSelectionListener(headerListener);

    // A composite for selection option buttons
    Composite selectionButtons = new Composite(dialogArea, SWT.NULL);
    Label compLabel = new Label(selectionButtons, SWT.NULL);
    compLabel.setFont(font);
    GridLayout layout = new GridLayout();
    layout.numColumns = 4;
    selectionButtons.setLayout(layout);

    //Select clean editors button
    selectClean = new Button(selectionButtons, SWT.PUSH);
    selectClean.setText(WorkbenchMessages.WorkbenchEditorsDialog_selectClean);
    selectClean.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            editorsTable.setSelection(selectClean(editorsTable.getItems()));
            updateButtons();
        }
    });
    selectClean.setFont(font);
    setButtonLayoutData(selectClean);

    //Invert selection button
    invertSelection = new Button(selectionButtons, SWT.PUSH);
    invertSelection.setText(WorkbenchMessages.WorkbenchEditorsDialog_invertSelection);
    invertSelection.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            editorsTable.setSelection(invertedSelection(editorsTable.getItems(), editorsTable.getSelection()));
            updateButtons();
        }
    });
    invertSelection.setFont(font);
    setButtonLayoutData(invertSelection);

    //Select all button
    allSelection = new Button(selectionButtons, SWT.PUSH);
    allSelection.setText(WorkbenchMessages.WorkbenchEditorsDialog_allSelection);
    allSelection.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            editorsTable.setSelection(editorsTable.getItems());
            updateButtons();
        }
    });
    allSelection.setFont(font);
    setButtonLayoutData(allSelection);

    // A composite for selected editor action buttons
    Composite actionButtons = new Composite(dialogArea, SWT.NULL);
    Label actLabel = new Label(actionButtons, SWT.NULL);
    actLabel.setFont(font);
    GridLayout actLayout = new GridLayout();
    actLayout.numColumns = 4;
    actionButtons.setLayout(actLayout);

    // Activate selected editor button
    createButton(actionButtons, IDialogConstants.OK_ID, WorkbenchMessages.WorkbenchEditorsDialog_activate,
            true);

    //Close selected editors button
    closeSelected = new Button(actionButtons, SWT.PUSH);
    closeSelected.setText(WorkbenchMessages.WorkbenchEditorsDialog_closeSelected);
    closeSelected.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            closeItems(editorsTable.getSelection());
        }
    });
    closeSelected.setFont(font);
    setButtonLayoutData(closeSelected);

    //Save selected editors button
    saveSelected = new Button(actionButtons, SWT.PUSH);
    saveSelected.setText(WorkbenchMessages.WorkbenchEditorsDialog_saveSelected);
    saveSelected.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            saveItems(editorsTable.getSelection());
        }
    });
    saveSelected.setFont(font);
    setButtonLayoutData(saveSelected);

    //Show only active perspective button
    final Button showAllPerspButton = new Button(dialogArea, SWT.CHECK);
    showAllPerspButton.setText(WorkbenchMessages.WorkbenchEditorsDialog_showAllPersp);
    showAllPerspButton.setSelection(showAllPersp);
    showAllPerspButton.setFont(font);
    setButtonLayoutData(showAllPerspButton);
    showAllPerspButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            showAllPersp = showAllPerspButton.getSelection();
            updateItems();
        }
    });
    //Create the items and update buttons state
    updateItems();
    updateButtons();

    editorsTable.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            updateButtons();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            okPressed();
        }
    });
    editorsTable.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            for (Iterator images = imageCache.values().iterator(); images.hasNext();) {
                Image i = (Image) images.next();
                i.dispose();
            }
            for (Iterator images = disabledImageCache.values().iterator(); images.hasNext();) {
                Image i = (Image) images.next();
                i.dispose();
            }
        }
    });
    editorsTable.setFocus();
    applyDialogFont(dialogArea);
    return dialogArea;
}

From source file:org.eclipse.ui.internal.dialogs.WorkingSetSelectionDialog.java

License:Open Source License

/**
 * Overrides method from Dialog./*from   w  w w . j  av a 2  s  . c om*/
 * Create the dialog widgets.
 * 
 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
 */
protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);

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

    createMessageArea(composite);

    SelectionListener listener = new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            updateButtonAvailability();
        }
    };

    buttonWindowSet = new Button(composite, SWT.RADIO);
    buttonWindowSet.setText(WorkbenchMessages.WindowWorkingSets);
    buttonWindowSet.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    buttonWindowSet.addSelectionListener(listener);

    buttonNoSet = new Button(composite, SWT.RADIO);
    buttonNoSet.setText(WorkbenchMessages.NoWorkingSet);
    buttonNoSet.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    buttonNoSet.addSelectionListener(listener);

    buttonSelectedSets = new Button(composite, SWT.RADIO);
    buttonSelectedSets.setText(WorkbenchMessages.SelectedWorkingSets);
    buttonSelectedSets.addSelectionListener(listener);

    switch (getInitialRadioSelection()) {
    case 0:
        buttonWindowSet.setSelection(true);
        break;
    case 1:
        buttonNoSet.setSelection(true);
        break;
    case 2:
        buttonSelectedSets.setSelection(true);
        break;
    }
    buttonSelectedSets.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite viewerComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    viewerComposite.setLayout(layout);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
    data.widthHint = SIZING_SELECTION_WIDGET_WIDTH + 300; // fudge?  I like fudge.
    viewerComposite.setLayoutData(data);

    listViewer = CheckboxTableViewer.newCheckList(viewerComposite, SWT.BORDER | SWT.MULTI);
    data = new GridData(GridData.FILL_BOTH);
    data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
    data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
    listViewer.getTable().setLayoutData(data);

    listViewer.setLabelProvider(labelProvider);
    listViewer.setContentProvider(contentProvider);
    listViewer.setComparator(new WorkbenchViewerComparator());

    listViewer.addFilter(new WorkingSetFilter(getSupportedWorkingSetIds()));

    listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            handleSelectionChanged();
        }
    });
    listViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent event) {
            Object obj = ((IStructuredSelection) listViewer.getSelection()).getFirstElement();
            listViewer.setCheckedElements(new Object[] { obj });
            buttonWindowSet.setSelection(false);
            buttonNoSet.setSelection(false);
            buttonSelectedSets.setSelection(true);
            okPressed();
        }
    });
    listViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            // implicitly select the third radio button
            buttonWindowSet.setSelection(false);
            buttonNoSet.setSelection(false);
            buttonSelectedSets.setSelection(true);
        }
    });

    addModifyButtons(viewerComposite);

    addSelectionButtons(composite);

    listViewer.setInput(Arrays.asList(WorkbenchPlugin.getDefault().getWorkingSetManager().getWorkingSets()));
    List initialElementSelections = getInitialElementSelections();
    if (multiSelect) {
        listViewer.setCheckedElements(initialElementSelections.toArray());
    } else if (!initialElementSelections.isEmpty()) {
        IWorkingSet set = (IWorkingSet) initialElementSelections.get(0);
        if (set instanceof AggregateWorkingSet) {
            AggregateWorkingSet aggregate = (AggregateWorkingSet) set;
            listViewer.setCheckedElements(aggregate.getComponents());
        } else {
            listViewer.setCheckedElements(initialElementSelections.toArray());
        }
    }

    availableWorkingSetsChanged();
    Dialog.applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    parent.setLayoutData(data);//w w  w .java  2 s  .c  o  m

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

    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
            IIDEHelpContextIds.EDIT_RESOURCE_FILTER_PROPERTY_PAGE);

    if (!filter.isUnderAGroupFilter()) {
        Composite topComposite = new Composite(composite, SWT.NONE);
        layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
        layout.marginWidth = 0;
        layout.marginBottom = 0;
        layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
        layout.horizontalSpacing = 0; // convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
        topComposite.setLayout(layout);
        data = new GridData(SWT.FILL, SWT.FILL, true, false);
        topComposite.setLayoutData(data);
        topComposite.setFont(font);

        createModeArea(font, topComposite);

        createTargetArea(font, topComposite);

        createIdArea(font, topComposite);
    } else {
        layout.marginHeight = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
        createIdArea(font, composite);
    }
    return composite;
}

From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java

License:Open Source License

private Control dialogCreateButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.//from w w  w . j a va2  s .  c o  m
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Add the buttons to the button bar.
    createButtonsForButtonBar(composite);
    return composite;
}

From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java

License:Open Source License

public void create(Composite argumentComposite, Font font) {
    shell = argumentComposite.getShell();
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;//from www . j av a 2  s .c o m
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    argumentComposite.setLayout(layout);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    argumentComposite.setLayoutData(data);
    argumentComposite.setFont(font);

    conditionComposite = new Composite(argumentComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    conditionComposite.setLayout(layout);
    conditionComposite.setFont(font);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    conditionComposite.setLayoutData(data);

    createCustomArgumentsArea(font, conditionComposite);

    descriptionComposite = new Composite(argumentComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginWidth = dialog.getHorizontalDLUsToPixel(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = dialog.getVerticalDLUsToPixel(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = 0;
    descriptionComposite.setLayout(layout);
    descriptionComposite.setFont(font);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    descriptionComposite.setLayoutData(data);

    createDescriptionArea(font, descriptionComposite);
    initializationComplete = true;
}

From source file:org.eclipse.ui.internal.ide.dialogs.ResourceFilterGroup.java

License:Open Source License

private void createCustomArgumentsArea(Font font, Composite composite) {
    GridData data;//from  w  ww. ja  v  a  2 s  .  c om

    multiArgumentComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginWidth = dialog.getHorizontalDLUsToPixel(IDialogConstants.HORIZONTAL_MARGIN);
    layout.horizontalSpacing = dialog.getHorizontalDLUsToPixel(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginTop = dialog.getVerticalDLUsToPixel(IDialogConstants.VERTICAL_SPACING);
    layout.marginHeight = 0;
    multiArgumentComposite.setLayout(layout);
    multiArgumentComposite.setFont(font);
    data = new GridData(SWT.FILL, SWT.FILL, true, true);
    multiArgumentComposite.setLayoutData(data);

    multiKey = new Combo(multiArgumentComposite, SWT.READ_ONLY);
    multiKey.setItems(getMultiMatcherKeys());
    data = new GridData(SWT.LEFT, SWT.TOP, false, false);
    multiKey.setLayoutData(data);
    multiKey.setFont(font);
    multiKey.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setupMultiOperatorAndField(true);
            storeMultiSelection();
        }
    });

    // calculate max combo width
    ArrayList allOperators = new ArrayList();
    String[] keys = getMultiMatcherKeys();
    for (int i = 0; i < keys.length; i++) {
        allOperators.addAll(
                Arrays.asList(getLocalOperatorsForKey(MultiMatcherLocalization.getMultiMatcherKey(keys[i]))));
    }
    Combo tmp = new Combo(multiArgumentComposite, SWT.READ_ONLY);
    tmp.setItems((String[]) allOperators.toArray(new String[0]));
    int maxWidth = tmp.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
    tmp.dispose();

    multiOperator = new Combo(multiArgumentComposite, SWT.READ_ONLY);
    data = new GridData(SWT.LEFT, SWT.TOP, false, false);
    data.widthHint = maxWidth;
    multiOperator.setLayoutData(data);
    multiOperator.setFont(font);
    multiOperator.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setupMultiOperatorAndField(false);
            storeMultiSelection();
        }
    });

    FileInfoAttributesMatcher.Argument argument = FileInfoAttributesMatcher
            .decodeArguments((String) filter.getArguments());
    String local = MultiMatcherLocalization.getLocalMultiMatcherKey(argument.key);
    int index = multiKey.indexOf(local);
    if (index != -1)
        multiKey.select(index);
    else
        multiKey.select(0);

    setupMultiOperatorAndField(true);
}