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

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

Introduction

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

Prototype

int HORIZONTAL_MARGIN

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

Click Source Link

Document

Horizontal margin in dialog units (value 7).

Usage

From source file:org.eclipse.team.internal.ccvs.ui.repo.RepositoriesFilterDialog.java

License:Open Source License

protected Control createDialogArea(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);
    composite.setLayout(layout);/*from ww w  . j av a2 s. c o  m*/

    fShowModules = new Button(composite, SWT.CHECK);
    fShowModules.setText(CVSUIMessages.RepositoryFilterDialog_showModules);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    fShowModules.setLayoutData(data);
    fShowModules.setSelection(true);

    initializeValues();

    // set F1 help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContextIds.REPOSITORY_FILTER_DIALOG);
    Dialog.applyDialogFont(parent);
    return composite;
}

From source file:org.eclipse.team.internal.ccvs.ui.subscriber.CommitSetDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite parentComposite = (Composite) super.createDialogArea(parent);

    // create a composite with standard margins and spacing
    Composite composite = new Composite(parentComposite, 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);/*from   www .j  a v  a2s.c om*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    if (hasCommitTemplate()) {
        if (set.hasComment()) {
            // Only set the comment if the set has a custom comment.
            // Otherwise, the template should be used
            comment = set.getComment();
            commitCommentArea.setProposedComment(comment);
        }
    } else {
        comment = set.getComment();
        commitCommentArea.setProposedComment(comment);
    }

    commitCommentArea.createArea(composite);
    commitCommentArea.addPropertyChangeListener(new IPropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent event) {
            if (event.getProperty() == CommitCommentArea.OK_REQUESTED) {
                okPressed();
            } else if (event.getProperty() == CommitCommentArea.COMMENT_MODIFIED) {
                comment = (String) event.getNewValue();
                if (!customTitleButton.getSelection()) {
                    nameText.setText(commitCommentArea.getFirstLineOfComment());
                }
                updateEnablements();
            }
        }
    });

    createOptionsArea(composite);
    createNameArea(composite);

    initializeValues();
    updateEnablements();

    Dialog.applyDialogFont(parent);
    return composite;
}

From source file:org.eclipse.team.internal.ccvs.ui.tags.TagConfigurationDialog.java

License:Open Source License

/**
 * @see Dialog#createDialogArea(Composite)
 */// w  ww  .ja  v  a2 s.  c om
protected Control createDialogArea(Composite parent) {
    Composite shell = new Composite(parent, SWT.NONE);
    GridData data = new GridData(GridData.FILL_BOTH);
    shell.setLayoutData(data);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.makeColumnsEqualWidth = true;
    gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    shell.setLayout(gridLayout);

    Composite comp = new Composite(shell, SWT.NULL);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    comp.setLayout(gridLayout);
    comp.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label cvsResourceTreeLabel = new Label(comp, SWT.NONE);
    cvsResourceTreeLabel.setText(CVSUIMessages.TagConfigurationDialog_5);
    data = new GridData();
    data.horizontalSpan = 1;
    cvsResourceTreeLabel.setLayoutData(data);

    Tree tree = new Tree(comp, SWT.BORDER | SWT.MULTI);
    cvsResourceTree = new TreeViewer(tree);
    cvsResourceTree.setContentProvider(new RemoteContentProvider());
    cvsResourceTree.setLabelProvider(new WorkbenchLabelProvider());
    data = new GridData(GridData.FILL_BOTH);
    data.heightHint = 150;
    data.horizontalSpan = 1;
    cvsResourceTree.getTree().setLayoutData(data);
    cvsResourceTree.setComparator(new FileComparator());
    cvsResourceTree.setInput(TagSourceResourceAdapter.getViewerInput(tagSource));
    cvsResourceTree.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            updateShownTags();
            updateEnablements();
        }
    });

    comp = new Composite(shell, SWT.NULL);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    comp.setLayout(gridLayout);
    comp.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label cvsTagTreeLabel = new Label(comp, SWT.NONE);
    cvsTagTreeLabel.setText(CVSUIMessages.TagConfigurationDialog_6);
    data = new GridData();
    data.horizontalSpan = 1;
    cvsTagTreeLabel.setLayoutData(data);

    final Table table = new Table(comp,
            SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.CHECK);
    data = new GridData(GridData.FILL_BOTH);
    data.heightHint = 150;
    data.horizontalSpan = 1;
    table.setLayoutData(data);
    cvsTagTree = new CheckboxTableViewer(table);
    cvsTagTree.setContentProvider(new WorkbenchContentProvider());
    cvsTagTree.setLabelProvider(new WorkbenchLabelProvider());
    cvsTagTree.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            updateEnablements();
        }
    });

    Composite selectComp = new Composite(comp, SWT.NONE);
    GridLayout selectLayout = new GridLayout(2, true);
    selectLayout.marginHeight = selectLayout.marginWidth = 0;
    selectComp.setLayout(selectLayout);
    selectComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    Button selectAllButton = new Button(selectComp, SWT.PUSH);
    selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    selectAllButton.setText(CVSUIMessages.ReleaseCommentDialog_selectAll);
    selectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            int nItems = table.getItemCount();
            for (int j = 0; j < nItems; j++)
                table.getItem(j).setChecked(true);
        }
    });
    Button deselectAllButton = new Button(selectComp, SWT.PUSH);
    deselectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    deselectAllButton.setText(CVSUIMessages.ReleaseCommentDialog_deselectAll);
    deselectAllButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            int nItems = table.getItemCount();
            for (int j = 0; j < nItems; j++)
                table.getItem(j).setChecked(false);
        }
    });

    cvsTagTree.setComparator(new ViewerComparator() {
        public int compare(Viewer viewer, Object e1, Object e2) {
            if (!(e1 instanceof TagElement) || !(e2 instanceof TagElement))
                return super.compare(viewer, e1, e2);
            CVSTag tag1 = ((TagElement) e1).getTag();
            CVSTag tag2 = ((TagElement) e2).getTag();
            int type1 = tag1.getType();
            int type2 = tag2.getType();
            if (type1 != type2) {
                return type1 - type2;
            }
            // Sort in reverse order so larger numbered versions are at the top
            return -tag1.compareTo(tag2);
        }
    });

    Composite rememberedTags = new Composite(shell, SWT.NONE);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    rememberedTags.setLayoutData(data);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    rememberedTags.setLayout(gridLayout);

    Label rememberedTagsLabel = new Label(rememberedTags, SWT.NONE);
    rememberedTagsLabel.setText(CVSUIMessages.TagConfigurationDialog_7);
    data = new GridData();
    data.horizontalSpan = 2;
    rememberedTagsLabel.setLayoutData(data);

    tree = new Tree(rememberedTags, SWT.BORDER | SWT.MULTI);
    cvsDefinedTagsTree = new TreeViewer(tree);
    cvsDefinedTagsTree.setContentProvider(new WorkbenchContentProvider());
    cvsDefinedTagsTree.setLabelProvider(new WorkbenchLabelProvider());
    data = new GridData(GridData.FILL_BOTH);
    data.heightHint = 100;
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = true;
    cvsDefinedTagsTree.getTree().setLayoutData(data);
    cvsDefinedTagsRootElement = new TagSourceWorkbenchAdapter(wrappedTagSource,
            TagSourceWorkbenchAdapter.INCLUDE_BRANCHES | TagSourceWorkbenchAdapter.INCLUDE_VERSIONS
                    | TagSourceWorkbenchAdapter.INCLUDE_DATES);
    cvsDefinedTagsTree.setInput(cvsDefinedTagsRootElement);
    cvsDefinedTagsTree.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            updateEnablements();
        }
    });
    cvsDefinedTagsTree.setComparator(new ProjectElementComparator());

    Composite buttonComposite = new Composite(rememberedTags, SWT.NONE);
    data = new GridData();
    data.verticalAlignment = GridData.BEGINNING;
    buttonComposite.setLayoutData(data);
    gridLayout = new GridLayout();
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    buttonComposite.setLayout(gridLayout);

    addSelectedTagsButton = new Button(buttonComposite, SWT.PUSH);
    addSelectedTagsButton.setText(CVSUIMessages.TagConfigurationDialog_8);
    data = getStandardButtonData(addSelectedTagsButton);
    data.horizontalAlignment = GridData.FILL;
    addSelectedTagsButton.setLayoutData(data);
    addSelectedTagsButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            rememberCheckedTags();
            updateShownTags();
            updateEnablements();
        }
    });
    Button addDatesButton = new Button(buttonComposite, SWT.PUSH);
    addDatesButton.setText(CVSUIMessages.TagConfigurationDialog_0);
    data = getStandardButtonData(addDatesButton);
    data.horizontalAlignment = GridData.FILL;
    addDatesButton.setLayoutData(data);
    addDatesButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            CVSTag dateTag = NewDateTagAction.getDateTag(getShell(), tagSource.getLocation());
            addDateTagsSelected(dateTag);
            updateShownTags();
            updateEnablements();
        }
    });
    removeTagButton = new Button(buttonComposite, SWT.PUSH);
    removeTagButton.setText(CVSUIMessages.TagConfigurationDialog_9);
    data = getStandardButtonData(removeTagButton);
    data.horizontalAlignment = GridData.FILL;
    removeTagButton.setLayoutData(data);
    removeTagButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            deleteSelected();
            updateShownTags();
            updateEnablements();
        }
    });

    Button removeAllTags = new Button(buttonComposite, SWT.PUSH);
    removeAllTags.setText(CVSUIMessages.TagConfigurationDialog_10);
    data = getStandardButtonData(removeAllTags);
    data.horizontalAlignment = GridData.FILL;
    removeAllTags.setLayoutData(data);
    removeAllTags.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            removeAllKnownTags();
            updateShownTags();
            updateEnablements();
        }
    });

    if (allowSettingAutoRefreshFiles) {
        Label explanation = new Label(rememberedTags, SWT.WRAP);
        explanation.setText(CVSUIMessages.TagConfigurationDialog_11);
        data = new GridData();
        data.horizontalSpan = 2;
        //data.widthHint = 300;
        explanation.setLayoutData(data);

        autoRefreshFileList = new org.eclipse.swt.widgets.List(rememberedTags, SWT.BORDER | SWT.MULTI);
        data = new GridData();
        data.heightHint = 45;
        data.horizontalAlignment = GridData.FILL;
        data.grabExcessHorizontalSpace = true;
        autoRefreshFileList.setLayoutData(data);
        try {
            autoRefreshFileList.setItems(CVSUIPlugin.getPlugin().getRepositoryManager()
                    .getAutoRefreshFiles(getSingleFolder(tagSource, false)));
        } catch (CVSException e) {
            autoRefreshFileList.setItems(new String[0]);
            CVSUIPlugin.log(e);
        }
        autoRefreshFileList.addSelectionListener(new SelectionListener() {
            public void widgetSelected(SelectionEvent e) {
                updateEnablements();
            }

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

        Composite buttonComposite2 = new Composite(rememberedTags, SWT.NONE);
        data = new GridData();
        data.verticalAlignment = GridData.BEGINNING;
        buttonComposite2.setLayoutData(data);
        gridLayout = new GridLayout();
        gridLayout.marginHeight = 0;
        gridLayout.marginWidth = 0;
        buttonComposite2.setLayout(gridLayout);

        addSelectedFilesButton = new Button(buttonComposite2, SWT.PUSH);
        addSelectedFilesButton.setText(CVSUIMessages.TagConfigurationDialog_12);
        data = getStandardButtonData(addSelectedFilesButton);
        data.horizontalAlignment = GridData.FILL;
        addSelectedFilesButton.setLayoutData(data);
        addSelectedFilesButton.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {
                addSelectionToAutoRefreshList();
            }
        });

        removeFileButton = new Button(buttonComposite2, SWT.PUSH);
        removeFileButton.setText(CVSUIMessages.TagConfigurationDialog_13);
        data = getStandardButtonData(removeFileButton);
        data.horizontalAlignment = GridData.FILL;
        removeFileButton.setLayoutData(data);
        removeFileButton.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {
                String[] selected = autoRefreshFileList.getSelection();
                for (int i = 0; i < selected.length; i++) {
                    autoRefreshFileList.remove(selected[i]);
                    autoRefreshFileList.setFocus();
                }
            }
        });
        PlatformUI.getWorkbench().getHelpSystem().setHelp(autoRefreshFileList,
                IHelpContextIds.TAG_CONFIGURATION_REFRESHLIST);
    }

    Label seperator = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
    data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    seperator.setLayoutData(data);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IHelpContextIds.TAG_CONFIGURATION_OVERVIEW);

    updateEnablements();
    Dialog.applyDialogFont(parent);
    return shell;
}

From source file:org.eclipse.team.internal.ccvs.ui.wizards.ModeWizardSelectionPage.java

License:Open Source License

public void createControl(final Composite parent) {

    final PixelConverter converter = SWTUtils.createDialogPixelConverter(parent);

    final int horizontalSpace = converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    final int verticalSpace = converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);

    /**//w w w  .  j a v  a 2 s  . c  o m
     * The main composite with the vertical sash
     */
    final Composite mainComposite = SWTUtils.createHVFillComposite(parent, SWTUtils.MARGINS_DEFAULT);
    // set F1 help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(mainComposite, IHelpContextIds.KEYWORD_SUBSTITUTION_PAGE);

    final SashForm mainSash = new SashForm(mainComposite, SWT.VERTICAL);
    mainSash.setLayoutData(SWTUtils.createHVFillGridData());

    /**
     * The composite with the filter box, the table and the selection and filter controls.
     */
    final Composite topComposite = SWTUtils.createHVFillComposite(mainSash, SWTUtils.MARGINS_NONE);
    ((GridLayout) topComposite.getLayout()).marginBottom = verticalSpace;

    final Composite topGroup = SWTUtils.createHVFillGroup(topComposite,
            CVSUIMessages.ModeWizardSelectionPage_21, SWTUtils.MARGINS_DIALOG);

    final Composite filterComposite = SWTUtils.createHFillComposite(topGroup, SWTUtils.MARGINS_NONE, 2);
    final FilterTextBox filterBox = new FilterTextBox(ModeWizardSelectionPage.this, filterComposite, converter);

    fTable = new ModeChangeTable(topGroup, converter, fChanges);

    final Composite selectionComposite = SWTUtils.createHFillComposite(topGroup, SWTUtils.MARGINS_NONE, 2);

    new ChangeCounterLabel(selectionComposite, fTable);
    new SelectionCounterLabel(selectionComposite, fTable);

    new ShowChangesOnlyCheckbox(ModeWizardSelectionPage.this, selectionComposite);

    final Composite buttonComposite = SWTUtils.createHFillComposite(selectionComposite, SWTUtils.MARGINS_NONE,
            2);
    buttonComposite.setLayoutData(new GridData());
    new SelectAllButton(ModeWizardSelectionPage.this, buttonComposite, converter);
    new SelectNoneButton(ModeWizardSelectionPage.this, buttonComposite, converter);

    /**
     * The bottom sash which separates the mode controls from the commit comment area
     */
    final SashForm bottomSash = new SashForm(mainSash, SWT.NONE);
    bottomSash.setLayoutData(SWTUtils.createHFillGridData());

    /**
     * The left composite with the mode controls.
     */
    final Composite leftComposite = SWTUtils.createHVFillComposite(bottomSash, SWTUtils.MARGINS_NONE, 1);
    ((GridLayout) leftComposite.getLayout()).marginRight = horizontalSpace;
    ((GridLayout) leftComposite.getLayout()).marginTop = verticalSpace;

    final Group leftGroup = SWTUtils.createHVFillGroup(leftComposite, CVSUIMessages.ModeWizardSelectionPage_22,
            SWTUtils.MARGINS_DIALOG, 3);

    new ModeCombo(fTable, leftGroup);
    new GuessButton(fTable, leftGroup, converter);
    new ResetButton(fTable, leftGroup, converter);
    SWTUtils.createPlaceholder(leftGroup, 1);
    final Label infoLabel = SWTUtils.createLabel(leftGroup, CVSUIMessages.ModeWizardSelectionPage_23, 3);

    fTable.addObserver(new Observer() {
        public void update(Observable o, Object arg) {
            final boolean enabled = !fTable.getSelection().isEmpty();
            leftGroup.setEnabled(enabled);
            infoLabel.setEnabled(enabled);
        }
    });

    /**
     * The right composite with the commit comment area.
     */
    final Composite rightComposite = SWTUtils.createHVFillComposite(bottomSash, SWTUtils.MARGINS_NONE);
    ((GridLayout) rightComposite.getLayout()).marginLeft = horizontalSpace;
    ((GridLayout) rightComposite.getLayout()).marginTop = verticalSpace;

    final Group rightGroup = SWTUtils.createHVFillGroup(rightComposite,
            CVSUIMessages.ModeWizardSelectionPage_24, SWTUtils.MARGINS_DIALOG);
    (fCommentArea = new CommitCommentArea()).createArea(rightGroup);

    /**
     * Set up the page
     */
    mainSash.setWeights(new int[] { 5, 2 });
    bottomSash.setWeights(new int[] { 3, 2 });
    fTable.modelChanged(true);
    fTable.selectAll();
    filterBox.setFocus();
    setupListeners();
    setControl(mainComposite);
    validatePage();
}

From source file:org.eclipse.team.internal.ui.dialogs.DetailsDialogWithProjects.java

License:Open Source License

/**
 * @see DetailsDialog#createDropDownDialogArea(Composite)
 *//*w ww  . j  a v a  2 s .c o  m*/
protected Composite createDropDownDialogArea(Composite parent) {
    // create a composite with standard margins and spacing
    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));

    if (detailsTitle != null) {
        Label title = new Label(composite, SWT.WRAP);
        title.setText(detailsTitle);
        title.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    }

    detailsList = new org.eclipse.swt.widgets.List(composite,
            SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.heightHint = convertHeightInCharsToPixels(5);
    detailsList.setLayoutData(data);

    for (int i = 0; i < projects.length; i++) {
        detailsList.add(projects[i].getName());
    }
    return composite;
}

From source file:org.eclipse.team.internal.ui.dialogs.NoChangesDialog.java

License:Open Source License

protected Composite createDropDownDialogArea(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);/*from   ww w  . ja  va  2 s.  c o  m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    selectedMappingsArea = ResourceMappingHierarchyArea.create(scope, null /* no context */);
    selectedMappingsArea.setDescription(description);
    selectedMappingsArea.createArea(composite);
    return composite;
}

From source file:org.eclipse.team.internal.ui.mapping.FuzzFactorDialog.java

License:Open Source License

protected Control createDialogArea(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);/*from w  w w  .  j ava2s.c  om*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(TeamUIMessages.FuzzFactorDialog_message);
    GridData data = new GridData();
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    label.setFont(parent.getFont());

    valueText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    valueText.setLayoutData(data);
    valueText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    fuzzFactor = patcher.getFuzz();
    if (fuzzFactor >= 0)
        valueText.setText(new Integer(fuzzFactor).toString());

    Button guessButton = new Button(composite, SWT.NONE);
    guessButton.setText(TeamUIMessages.FuzzFactorDialog_guess);
    data = new GridData();
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    Point minSize = guessButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    data.widthHint = Math.max(widthHint, minSize.x);
    guessButton.setLayoutData(data);
    guessButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            patcher.setFuzz(-1);
            int fuzz = guessFuzzFactor();
            if (fuzz >= 0) {
                String value = new Integer(fuzz).toString();
                valueText.setText(value);
            }
        }
    });

    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

    validateInput();

    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.team.internal.ui.wizards.WorkingSetsDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    setTitle(TeamUIMessages.WorkingSetsDialog_Title);
    setMessage(TeamUIMessages.WorkingSetsDialog_Message);
    Composite workingSetsComposite = (Composite) super.createDialogArea(parent);
    workingSetsComposite = new Composite(workingSetsComposite, SWT.NONE);
    getShell().setText(TeamUIMessages.WorkingSetsDialog_TitleBar);

    final Composite group = new Composite(workingSetsComposite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginWidth = 0;// w  ww .  jav  a  2 s  .  c  o  m
    group.setLayout(layout);
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));

    final Label label = new Label(group, SWT.NONE);
    label.setLayoutData(new GridData());
    label.setText(TeamUIMessages.WorkingSetsDialog_Label);

    wsNameText = new Text(group, SWT.BORDER);
    wsNameText.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));

    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    workingSetsComposite.setLayout(layout);
    final GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    workingSetsComposite.setLayoutData(data);

    wsTableViewer = new TableViewer(workingSetsComposite, SWT.BORDER);
    final GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.widthHint = 450;
    gd.heightHint = 250;
    wsTableViewer.getTable().setLayoutData(gd);

    wsTableViewer.setContentProvider(new ArrayContentProvider());
    wsTableViewer.setLabelProvider(new WorkingSetLabelProvider());
    wsTableViewer.setInput(TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager().getWorkingSets());

    setupListeners();

    return parent;
}

From source file:org.eclipse.ui.dialogs.SelectionStatusDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    if (!fStatusLineAboveButtons) {
        layout.numColumns = 2;/* ww  w .j a v a2s  . c o m*/
    }
    layout.marginHeight = 0;
    layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setFont(font);

    if (!fStatusLineAboveButtons && isHelpAvailable()) {
        createHelpControl(composite);
    }
    fStatusLine = new MessageLine(composite);
    fStatusLine.setAlignment(SWT.LEFT);
    GridData statusData = new GridData(GridData.FILL_HORIZONTAL);
    fStatusLine.setErrorStatus(null);
    fStatusLine.setFont(font);
    if (fStatusLineAboveButtons && isHelpAvailable()) {
        statusData.horizontalSpan = 2;
        createHelpControl(composite);
    }
    fStatusLine.setLayoutData(statusData);

    /*
     * Create the rest of the button bar, but tell it not to
     * create a help button (we've already created it).
     */
    boolean helpAvailable = isHelpAvailable();
    setHelpAvailable(false);
    super.createButtonBar(composite);
    setHelpAvailable(helpAvailable);
    return composite;
}

From source file:org.eclipse.ui.examples.fieldassist.FieldAssistTestDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {

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

    initializeDialogUnits(outer);//from  www.  jav a2s  . co m
    createSecurityGroup(outer);

    // Create a simple field to show how field assist can be used for
    // autocomplete.
    Group autoComplete = new Group(outer, SWT.NONE);
    autoComplete.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    autoComplete.setLayout(layout);
    autoComplete.setText(TaskAssistExampleMessages.ExampleDialog_AutoCompleteGroup);

    Label label = new Label(autoComplete, SWT.LEFT);
    label.setText(TaskAssistExampleMessages.ExampleDialog_UserName);

    // Create an auto-complete field representing a user name
    Text text = new Text(autoComplete, SWT.BORDER);
    text.setLayoutData(getFieldGridData());
    new AutoCompleteField(text, new TextContentAdapter(), validUsers);

    // Another one to test combos
    label = new Label(autoComplete, SWT.LEFT);
    label.setText(TaskAssistExampleMessages.ExampleDialog_ComboUserName);

    Combo combo = new Combo(autoComplete, SWT.BORDER | SWT.DROP_DOWN);
    combo.setText(username);
    combo.setItems(validUsers);
    combo.setLayoutData(getFieldGridData());
    new AutoCompleteField(combo, new ComboContentAdapter(), validUsers);

    Dialog.applyDialogFont(outer);

    return outer;
}