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.mylyn.internal.tasks.ui.workingsets.TaskWorkingSetPage.java

License:Open Source License

public void createControl(Composite parent) {
    initializeDialogUnits(parent);//from   ww w  . j  a  v  a2 s .  c o m

    Composite composite = new Composite(parent, SWT.NULL);

    GridLayout layout = new GridLayout();
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    setControl(composite);

    // PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IIDEHelpContextIds.WORKING_SET_RESOURCE_PAGE);
    Label label = new Label(composite, SWT.WRAP);
    label.setText(Messages.TaskWorkingSetPage_Working_set_name);
    label.setLayoutData(new GridData(
            GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));

    text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    // text.setBackground(FieldAssistColors.getRequiredFieldBackgroundColor(text));

    label = new Label(composite, SWT.WRAP);
    label.setText(Messages.TaskWorkingSetPage_Working_set_contents);
    label.setLayoutData(new GridData(
            GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));

    treeViewer = new CheckboxTreeViewer(composite);
    treeViewer.setUseHashlookup(true);
    treeViewer.setContentProvider(workingSetPageContentProvider);

    treeViewer.setLabelProvider(new DecoratingLabelProvider(new AggregateLabelProvider(),
            PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator()));
    treeViewer.setSorter(new CustomSorter());

    ArrayList<Object> containers = new ArrayList<Object>();
    for (TaskRepository repository : TasksUi.getRepositoryManager().getAllRepositories()) {
        containers.add(repository);
    }

    containers.addAll(Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects()));

    treeViewer.setInput(containers);

    // tree.setComparator(new ResourceComparator(ResourceComparator.NAME));

    GridData data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
    data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
    data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
    treeViewer.getControl().setLayoutData(data);

    treeViewer.addCheckStateListener(new ICheckStateListener() {
        public void checkStateChanged(CheckStateChangedEvent event) {
            handleCheckStateChange(event);
        }
    });

    // Add select / deselect all buttons for bug 46669
    Composite buttonComposite = new Composite(composite, SWT.NONE);
    layout = new GridLayout(2, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    Button selectAllButton = new Button(buttonComposite, SWT.PUSH);
    selectAllButton.setText(Messages.TaskWorkingSetPage_Select_All);
    selectAllButton.setToolTipText(""); //$NON-NLS-1$
    selectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            treeViewer.setCheckedElements(workingSetPageContentProvider.getElements(treeViewer.getInput()));
            validateInput();
        }
    });
    setButtonLayoutData(selectAllButton);

    Button deselectAllButton = new Button(buttonComposite, SWT.PUSH);
    deselectAllButton.setText(Messages.TaskWorkingSetPage_Deselect_All);
    deselectAllButton.setToolTipText(""); //$NON-NLS-1$
    deselectAllButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent selectionEvent) {
            treeViewer.setCheckedElements(new Object[0]);
            validateInput();
        }
    });
    setButtonLayoutData(deselectAllButton);

    if (workingSet != null) {
        for (Object object : workingSet.getElements()) {
            treeViewer.expandToLevel(object, 1);
        }
    } else {
        treeViewer.expandToLevel(2);
    }
    initializeCheckedState();

    if (workingSet != null) {
        text.setText(workingSet.getName());
        treeViewer.getControl().setFocus();
    } else {
        text.setFocus();
    }

    setPageComplete(false);
    Dialog.applyDialogFont(composite);
}

From source file:org.eclipse.osee.ote.ui.define.importer.OutfileImportPage.java

License:Open Source License

private void createFileSelectArea(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    group.setLayout(layout);// w  w  w.ja  v  a2 s. co  m
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    group.setText("Select Files");
    group.setToolTipText("Select files to import");

    Composite composite = new Composite(group, SWT.NULL);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    composite.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    composite.setFont(parent.getFont());

    if (treeSelectionMode) {
        treeViewer = new ContainerCheckedTreeViewer(composite, SWT.BORDER);
    } else {
        treeViewer = new CheckboxTreeViewer(composite, SWT.BORDER);
    }

    treeViewer.setContentProvider(contentProvider);
    treeViewer.setLabelProvider(labelProvider);
    treeViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            setPageComplete(determinePageCompletion());
        }
    });
    if (filters != null) {
        for (int i = 0; i != filters.size(); i++) {
            treeViewer.addFilter(filters.get(i));
        }
    }
    treeViewer.setInput(treeInput);

    Tree treeWidget = treeViewer.getTree();
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.widthHint = convertWidthInCharsToPixels(80);
    data.heightHint = convertHeightInCharsToPixels(16);
    treeWidget.setLayout(new GridLayout());
    treeWidget.setLayoutData(data);
    treeWidget.setFont(composite.getFont());
    treeWidget.setEnabled(true);

    createSelectionButtons(composite);
}

From source file:org.eclipse.papyrus.extensionpoints.editors.ui.ExtendedDirectEditionDialog.java

License:Open Source License

/**
 * {@inheritDoc}//from   www  . j av  a 2 s  .c  om
 */
@Override
protected Control createDialogArea(Composite parent) {
    Group composite = new Group(parent, SWT.RESIZE);
    composite.setText("Specification");
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite viewerGroup = new Composite(composite, SWT.RESIZE);
    FillLayout viewerLayout = new FillLayout();
    viewerGroup.setLayout(viewerLayout);
    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
            | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    viewerGroup.setLayoutData(data);
    viewer = new SourceViewer(viewerGroup, null, SWT.BORDER | SWT.FILL_EVEN_ODD);

    // configure source viewer
    document = new Document();
    document.set(value);

    // add completion processor key listener (ctrl+space keys)
    viewer.appendVerifyKeyListener(new LabelKeyListener(viewer));

    document.addDocumentListener(new DocumentListener());
    viewer.configure(configuration.getSourceViewerConfiguration());
    viewer.setDocument(document);

    Selection selection = configuration.getTextSelection(value, editedObject);
    viewer.setSelectedRange(selection.getStart(), selection.getLentgh());

    Composite extendedArea = configuration.createExtendedDialogArea(viewerGroup);
    if (extendedArea != null) {
        extendedArea.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    }

    errorMessageText = new CLabel(composite, SWT.READ_ONLY | SWT.SHADOW_NONE);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.papyrus.profile.ui.dialogs.DefinitionHistoryDialog.java

License:Open Source License

/**
 * {@inheritDoc}//w w  w .  ja v a2 s .  com
 */
@Override
protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle("Profile definition history");
    setTitleImage(ImageManager.getImage(PROFILE_ANNOTATION_IMG));

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout(1, true);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    composite.setFont(parentComposite.getFont());

    // fill composite with information about definitions:
    GridData gd;

    Composite tableArea = createTableArea(composite);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    tableArea.setLayoutData(gd);

    applyDialogFont(parentComposite);
    return parentComposite;
}

From source file:org.eclipse.papyrus.profile.ui.dialogs.ProfileDefinitionDialog.java

License:Open Source License

/**
 * {@inheritDoc}//ww w. j av  a 2 s. com
 */
@Override
protected Control createDialogArea(Composite parent) {
    // top level composite
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    setTitle("Information about new definition");
    setTitleImage(ImageManager.getImage(PROFILE_DEFINITION));

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout(2, true);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    composite.setFont(parentComposite.getFont());

    // compute initial values
    computeVersionValues();

    // fill composite with information about new definition:
    // 1. version
    // 2. author
    // 3. comment
    // 4. date
    // 5. copyright
    GridData gd;

    Composite versionArea = createVersionArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    versionArea.setLayoutData(gd);

    Composite infoArea = createInfoArea(composite);
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    infoArea.setLayoutData(gd);

    Composite commentArea = createCommentArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1);
    commentArea.setLayoutData(gd);

    Composite copyrightArea = createCopyrightArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1);
    copyrightArea.setLayoutData(gd);

    Composite advancedArea = createAdvancedArea(composite);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, true, 2, 1);
    advancedArea.setLayoutData(gd);

    applyDialogFont(parentComposite);
    return parentComposite;
}

From source file:org.eclipse.papyrus.properties.tabbed.customization.dialog.CustomizeContentWizardPage.java

License:Open Source License

/**
 * {@inheritDoc}/*w ww . j  av a2s. co  m*/
 */
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    SashForm sashForm = new SashForm(composite, SWT.HORIZONTAL);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    createContentExplorer(sashForm);
    createConfigurationArea(sashForm);

    sashForm.setWeights(new int[] { 40, 60 });

    setControl(composite);
}

From source file:org.eclipse.pde.internal.ua.ui.wizards.cheatsheet.NewCategoryNameDialog.java

License:Open Source License

/**
 * @param parent//from w  w  w  .  j a va2  s .  co m
 * @return
 */
private Composite createUIContainer(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    return composite;
}

From source file:org.eclipse.php.formatter.ui.preferences.CreateProfileDialog.java

License:Open Source License

public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    GridData gd;/*w w  w  .j a  v a  2  s.c o  m*/

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(layout);

    // Create "Profile name:" label
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    gd.widthHint = convertWidthInCharsToPixels(60);
    final Label nameLabel = new Label(composite, SWT.WRAP);
    nameLabel.setText(FormatterMessages.CreateProfileDialog_profile_name_label_text);
    nameLabel.setLayoutData(gd);

    // Create text field to enter name
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fNameText.setLayoutData(gd);
    fNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doValidation();
        }
    });

    // Create "Initialize settings ..." label
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    Label profileLabel = new Label(composite, SWT.WRAP);
    profileLabel.setText(FormatterMessages.CreateProfileDialog_base_profile_label_text);
    profileLabel.setLayoutData(gd);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    fProfileCombo.setLayoutData(gd);

    // "Open the edit dialog now" checkbox
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    fEditCheckbox = new Button(composite, SWT.CHECK);
    fEditCheckbox.setText(FormatterMessages.CreateProfileDialog_open_edit_dialog_checkbox_text);
    fEditCheckbox.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fOpenEditDialog = ((Button) e.widget).getSelection();
        }

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

    final IDialogSettings dialogSettings = FormatterUIPlugin.getDefault().getDialogSettings();// .get(PREF_OPEN_EDIT_DIALOG);
    if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) {
        fOpenEditDialog = dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG);
    } else {
        fOpenEditDialog = true;
    }
    fEditCheckbox.setSelection(fOpenEditDialog);

    fProfileCombo.setItems(fSortedNames);
    fProfileCombo.setText(fProfileManager.getProfile(ProfileManager.DEFAULT_PROFILE).getName());
    updateStatus(fEmpty);

    applyDialogFont(composite);

    fNameText.setFocus();

    return composite;
}

From source file:org.eclipse.php.formatter.ui.preferences.ModifyDialogTabPage.java

License:Open Source License

protected Group createGroup(int numColumns, Composite parent, String text) {
    final Group group = new Group(parent, SWT.NONE);
    group.setFont(parent.getFont());/*from ww  w .  jav  a  2 s .  co m*/
    group.setLayoutData(createGridData(numColumns, GridData.FILL_HORIZONTAL, SWT.DEFAULT));

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    group.setLayout(layout);
    group.setText(text);
    return group;
}

From source file:org.eclipse.php.formatter.ui.preferences.RenameProfileDialog.java

License:Open Source License

public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = numColumns;/* w w w.  jav  a2s  .  co m*/

    final Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(layout);

    // Create "Please enter a new name:" label
    GridData gd = new GridData();
    gd.horizontalSpan = numColumns;
    gd.widthHint = convertWidthInCharsToPixels(60);
    fNameLabel = new Label(composite, SWT.NONE);
    fNameLabel.setText(FormatterMessages.RenameProfileDialog_dialog_label_enter_a_new_name);
    fNameLabel.setLayoutData(gd);

    // Create text field to enter name
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fNameText.setSelection(0, fProfile.getName().length());
    fNameText.setLayoutData(gd);
    fNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doValidation();
        }
    });
    fNameText.setText(fProfile.getName());
    fNameText.selectAll();

    applyDialogFont(composite);

    return composite;
}