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.summer.sdt.internal.ui.preferences.EditTemplateDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite ancestor) {
    Composite parent = new Composite(ancestor, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from w  ww . j  av a 2s .co  m
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    parent.setLayout(layout);
    parent.setLayoutData(new GridData(GridData.FILL_BOTH));

    ModifyListener listener = new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doTextWidgetChanged(e.widget);
        }
    };

    if (fIsNameModifiable) {
        createLabel(parent, PreferencesMessages.EditTemplateDialog_name);

        Composite composite = new Composite(parent, SWT.NONE);
        composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        layout = new GridLayout();
        layout.numColumns = 4;
        layout.marginWidth = 0;
        layout.marginHeight = 0;
        composite.setLayout(layout);

        fNameText = createText(composite);
        fNameText.addFocusListener(new FocusListener() {

            public void focusGained(FocusEvent e) {
            }

            public void focusLost(FocusEvent e) {
                if (fSuppressError) {
                    fSuppressError = false;
                    updateStatusAndButtons();
                }
            }
        });
        BidiUtils.applyBidiProcessing(fNameText, BidiUtils.BTD_DEFAULT);

        createLabel(composite, PreferencesMessages.EditTemplateDialog_context);
        fContextCombo = new Combo(composite, SWT.READ_ONLY);
        SWTUtil.setDefaultVisibleItemCount(fContextCombo);

        for (int i = 0; i < fContextTypes.length; i++) {
            fContextCombo.add(fContextTypes[i][1]);
        }

        fContextCombo.addModifyListener(listener);

        fAutoInsertCheckbox = createCheckbox(composite, PreferencesMessages.EditTemplateDialog_autoinsert);
        fAutoInsertCheckbox.setSelection(fTemplate.isAutoInsertable());
    }

    createLabel(parent, PreferencesMessages.EditTemplateDialog_description);

    int descFlags = fIsNameModifiable ? SWT.BORDER : SWT.BORDER | SWT.READ_ONLY;
    fDescriptionText = new Text(parent, descFlags);
    fDescriptionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fDescriptionText.addModifyListener(listener);
    BidiUtils.applyBidiProcessing(fDescriptionText, BidiUtils.BTD_DEFAULT);

    Label patternLabel = createLabel(parent, PreferencesMessages.EditTemplateDialog_pattern);
    patternLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    fPatternEditor = createEditor(parent);

    Label filler = new Label(parent, SWT.NONE);
    filler.setLayoutData(new GridData());

    Composite composite = new Composite(parent, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData());

    fInsertVariableButton = new Button(composite, SWT.NONE);
    fInsertVariableButton.setLayoutData(getButtonGridData());
    fInsertVariableButton.setText(PreferencesMessages.EditTemplateDialog_insert_variable);
    fInsertVariableButton.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fPatternEditor.getTextWidget().setFocus();
            fPatternEditor.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS);
        }

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

    fDescriptionText.setText(fTemplate.getDescription());
    if (fIsNameModifiable) {
        fNameText.setText(fTemplate.getName());
        fNameText.addModifyListener(listener);
        fContextCombo.select(getIndex(fTemplate.getContextTypeId()));
    } else {
        fPatternEditor.getControl().setFocus();
    }
    initializeActions();

    applyDialogFont(parent);
    return composite;
}

From source file:org.summer.sdt.internal.ui.text.java.ContentAssistProcessor.java

License:Open Source License

/**
 * Informs the user about the fact that there are no enabled categories in the default content
 * assist set and shows a link to the preferences.
 *
 * @return  <code>true</code> if the default should be restored
 * @since 3.3//w  w w  . j a  v  a2 s  .  co  m
 */
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = JavaPlugin.getActiveWorkbenchShell();
        String title = JavaTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = JavaTextMessages.ContentAssistProcessor_all_disabled_message;
        // see PreferencePage#createControl for the 'defaults' label
        final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$
        final String linkMessage = Messages.format(
                JavaTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final int settingsId = IDialogConstants.CLIENT_ID + 11;
        final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
                shell, title, null /* default image */, message, MessageDialog.WARNING,
                new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
            /*
             * @see org.summer.sdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected Control createCustomArea(Composite composite) {
                // wrap link and checkbox in one composite without space
                Composite parent = new Composite(composite, SWT.NONE);
                GridLayout layout = new GridLayout();
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.verticalSpacing = 0;
                parent.setLayout(layout);

                Composite linkComposite = new Composite(parent, SWT.NONE);
                layout = new GridLayout();
                layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
                layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
                linkComposite.setLayout(layout);

                Link link = new Link(linkComposite, SWT.NONE);
                link.setText(linkMessage);
                link.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(SelectionEvent e) {
                        setReturnCode(settingsId);
                        close();
                    }
                });
                GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
                gridData.widthHint = this.getMinimumMessageWidth();
                link.setLayoutData(gridData);

                // create checkbox and "don't show this message" prompt
                super.createCustomArea(parent);

                return parent;
            }

            /*
             * @see org.eclipse.jface.dialogs.MessageDialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
             */
            @Override
            protected void createButtonsForButtonBar(Composite parent) {
                Button[] buttons = new Button[2];
                buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
                buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
                        true);
                setButtons(buttons);
            }
        };
        int returnValue = dialog.open();
        if (restoreId == returnValue || settingsId == returnValue) {
            if (restoreId == returnValue) {
                IPreferenceStore store = JavaPlugin.getDefault().getPreferenceStore();
                store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
                store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            }
            if (settingsId == returnValue)
                PreferencesUtil
                        .createPreferenceDialogOn(shell,
                                "org.summer.sdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                        .open();
            fComputerRegistry.reload();
            return true;
        }
    }
    return false;
}

From source file:org.talend.core.repository.ui.dialog.DuplicateDialog.java

License:Open Source License

@Override
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);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);//from  w  ww  .ja v a 2 s  .c om
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    super.createMessageWidget(parent, composite);
    super.createInputWidget(composite);
    typeGroup = new Composite(composite, SWT.NONE);
    GridLayout typeLayout = new GridLayout();
    typeLayout.numColumns = 6;
    typeGroup.setLayout(typeLayout);
    typeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    jobTypeCombo = new LabelledCombo(typeGroup, "Job Type:", "job type", JobType.getJobTypeToDispaly(), 2, //$NON-NLS-1$//$NON-NLS-2$
            true);
    frameworkCombo = new LabelledCombo(typeGroup, "Framework:", "framework", new String[0], 2, true); //$NON-NLS-1$//$NON-NLS-2$
    super.createErrorMessageWidget(composite);
    applyDialogFont(composite);
    // add listener
    addListener();
    // init
    init();
    return parent;
}

From source file:org.talend.core.ui.workspace.ChooseWorkspaceDialog.java

License:Open Source License

/**
 * The main area of the dialog is just a row with the current selection information and a drop-down of the most
 * recently used workspaces.//  w w  w. j av  a  2s.  co m
 */
private void createWorkspaceBrowseRow(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(3, 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);
    panel.setLayout(layout);
    panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    panel.setFont(parent.getFont());

    Label label = new Label(panel, SWT.NONE);
    label.setText(Messages.getString("WorkspaceDlg.workspace.label")); //$NON-NLS-1$

    text = new Combo(panel, SWT.BORDER | SWT.LEAD | SWT.DROP_DOWN);
    text.setFocus();
    text.setLayoutData(new GridData(400, SWT.DEFAULT));
    text.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            Button okButton = getButton(Window.OK);
            if (okButton != null && !okButton.isDisposed()) {
                boolean nonWhitespaceFound = false;
                String characters = getWorkspaceLocation();
                for (int i = 0; !nonWhitespaceFound && i < characters.length(); i++) {
                    if (!Character.isWhitespace(characters.charAt(i))) {
                        nonWhitespaceFound = true;
                    }
                }
                okButton.setEnabled(nonWhitespaceFound);
            }
        }
    });
    setInitialTextValues(text);

    Button browseButton = new Button(panel, SWT.PUSH);
    browseButton.setText(Messages.getString("WorkspaceDlg.browse.button")); //$NON-NLS-1$
    setButtonLayoutData(browseButton);
    GridData data = (GridData) browseButton.getLayoutData();
    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
    browseButton.setLayoutData(data);
    browseButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SHEET);
            dialog.setText(Messages.getString("WorkspaceDlg.browse.folder.title"));//$NON-NLS-1$
            dialog.setMessage(Messages.getString("WorkspaceDlg.browse.folder.title"));//$NON-NLS-1$
            dialog.setFilterPath(getInitialBrowsePath());
            String dir = dialog.open();
            if (dir != null) {
                text.setText(TextProcessor.process(dir));
            }
        }
    });
}

From source file:org.talend.core.ui.workspace.ChooseWorkspaceDialog.java

License:Open Source License

/**
 * The show dialog button allows the user to choose to neven be nagged again.
 *///from  w w  w .j av  a2s . c o  m
private void createShowDialogButton(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);
    panel.setFont(parent.getFont());

    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    panel.setLayout(layout);

    GridData data = new GridData(GridData.FILL_BOTH);
    data.verticalAlignment = GridData.END;
    panel.setLayoutData(data);

    Button button = new Button(panel, SWT.CHECK);
    button.setText(Messages.getString("WorkspaceDlg.use.this.as.default.cb.message"));//$NON-NLS-1$
    button.setSelection(!launchData.getShowDialog());
    button.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            launchData.toggleShowDialog();
        }
    });
}

From source file:org.talend.dataprofiler.core.ui.dialog.MatchRuleElementTreeSelectionDialog.java

License:Open Source License

private void createSelectBlockingKeysTable(Composite parent) {
    Composite composite = new Composite(parent, SWT.None);
    GridLayout layout = new GridLayout();
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    composite.setLayout(layout);//from   w w  w  .  ja  v a  2 s  . c o  m

    blockingKeysTable = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = blockingKeysTable.getTable();
    TableColumn c1 = new TableColumn(table, SWT.NULL);
    c1.setText(DefaultMessagesImpl.getString("BlockingKeyTableComposite.BLOCKING_KEY_NAME")); //$NON-NLS-1$
    TableColumn c2 = new TableColumn(table, SWT.NULL);
    c2.setText(DefaultMessagesImpl.getString("BlockingKeyTableComposite.PRECOLUMN")); //$NON-NLS-1$
    TableColumn c3 = new TableColumn(table, SWT.NULL);
    c3.setText(DefaultMessagesImpl.getString("BlockingKeyTableComposite.PRE_ALGO")); //$NON-NLS-1$
    TableColumn c4 = new TableColumn(table, SWT.NULL);
    c4.setText(DefaultMessagesImpl.getString("BlockingKeyTableComposite.PRE_VALUE")); //$NON-NLS-1$
    TableColumn c5 = new TableColumn(table, SWT.NULL);
    c5.setText(DefaultMessagesImpl.getString("BlockingKeyTableComposite.KEY_ALGO")); //$NON-NLS-1$
    TableColumn c6 = new TableColumn(table, SWT.NULL);
    c6.setText(DefaultMessagesImpl.getString("BlockingKeyTableComposite.KEY_VALUE")); //$NON-NLS-1$
    TableColumn c7 = new TableColumn(table, SWT.NULL);
    c7.setText(DefaultMessagesImpl.getString("BlockingKeyTableComposite.POST_ALGO")); //$NON-NLS-1$
    TableColumn c8 = new TableColumn(table, SWT.NULL);
    c8.setText(DefaultMessagesImpl.getString("BlockingKeyTableComposite.POST_VALUE")); //$NON-NLS-1$
    table.setLinesVisible(true);
    table.setHeaderVisible(true);
    TableLayout tableLayout = new TableLayout();
    for (int i = 0; i < 8; i++) {
        tableLayout.addColumnData(new ColumnWeightData(1, 120, true));
    }
    table.setLayout(tableLayout);

    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 0, 0);
    table.setLayoutData(data);

    blockingKeysTable.setContentProvider(new ArrayContentProvider());
    blockingKeysTable.setLabelProvider(new BlockingKeysTableLabelProvider(inputColumnNames));
}

From source file:org.talend.dataprofiler.core.ui.dialog.MatchRuleElementTreeSelectionDialog.java

License:Open Source License

private void createSelectMatchRulesTableVsr(Composite parent) {
    matchRulesTableComposite = new Composite(parent, SWT.None);
    GridLayout layout = new GridLayout();
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    matchRulesTableComposite.setLayout(layout);

    matchingRulesTable = new TableViewer(matchRulesTableComposite, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = matchingRulesTable.getTable();
    TableColumn c1 = new TableColumn(table, SWT.NULL);
    c1.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.MATCH_KEY_NAME")); //$NON-NLS-1$
    TableColumn c2 = new TableColumn(table, SWT.NULL);
    c2.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.INPUT_COLUMN")); //$NON-NLS-1$
    TableColumn c3 = new TableColumn(table, SWT.NULL);
    c3.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.MATCHING_TYPE")); //$NON-NLS-1$
    TableColumn c4 = new TableColumn(table, SWT.NULL);
    c4.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.CUSTOM_MATCHER_CLASS")); //$NON-NLS-1$
    TableColumn c5 = new TableColumn(table, SWT.NULL);
    c5.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.TOKENIZATION_TYPE")); //$NON-NLS-1$
    TableColumn c6 = new TableColumn(table, SWT.NULL);
    c6.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.CONFIDENCE_WEIGHT")); //$NON-NLS-1$
    TableColumn c7 = new TableColumn(table, SWT.NULL);
    c7.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.HANDLE_NULL")); //$NON-NLS-1$
    table.setLinesVisible(true);/* w  w  w. java  2  s.c o m*/
    table.setHeaderVisible(true);
    TableLayout tableLayout = new TableLayout();
    for (int i = 0; i < 7; i++) {
        tableLayout.addColumnData(new ColumnWeightData(1, 150, true));
    }
    table.setLayout(tableLayout);

    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 0, 0);
    table.setLayoutData(data);

    matchingRulesTable.setContentProvider(new ArrayContentProvider());
    matchingRulesTable.setLabelProvider(new MatchRulesTableLabelProvider(inputColumnNames));
}

From source file:org.talend.dataprofiler.core.ui.dialog.MatchRuleElementTreeSelectionDialog.java

License:Open Source License

private void createSelectMatchRulesTableTswoosh(Composite parent) {
    matchRulesTableComposite = new Composite(parent, SWT.None);
    GridLayout layout = new GridLayout();
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    matchRulesTableComposite.setLayout(layout);

    matchingRulesTable = new TableViewer(matchRulesTableComposite, SWT.BORDER | SWT.FULL_SELECTION);
    Table table = matchingRulesTable.getTable();
    TableColumn c1 = new TableColumn(table, SWT.NULL);
    c1.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.MATCH_KEY_NAME")); //$NON-NLS-1$
    TableColumn c2 = new TableColumn(table, SWT.NULL);
    c2.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.INPUT_COLUMN")); //$NON-NLS-1$
    TableColumn c3 = new TableColumn(table, SWT.NULL);
    c3.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.MATCHING_TYPE")); //$NON-NLS-1$
    TableColumn c4 = new TableColumn(table, SWT.NULL);
    c4.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.CUSTOM_MATCHER_CLASS")); //$NON-NLS-1$
    TableColumn c5 = new TableColumn(table, SWT.NULL);
    c5.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.TOKENIZATION_TYPE")); //$NON-NLS-1$
    TableColumn c6 = new TableColumn(table, SWT.NULL);
    c6.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.CONFIDENCE_WEIGHT")); //$NON-NLS-1$
    TableColumn c7 = new TableColumn(table, SWT.NULL);
    c7.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.HANDLE_NULL")); //$NON-NLS-1$
    TableColumn c8 = new TableColumn(table, SWT.NULL);
    c8.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.THRESHOLD")); //$NON-NLS-1$
    TableColumn c9 = new TableColumn(table, SWT.NULL);
    c9.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.SURVIVORSHIP_FUNCTION")); //$NON-NLS-1$
    TableColumn c10 = new TableColumn(table, SWT.NULL);
    c10.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.PARAMETER")); //$NON-NLS-1$
    table.setLinesVisible(true);/*from   w  ww  .java  2  s  .c o m*/
    table.setHeaderVisible(true);
    TableLayout tableLayout = new TableLayout();
    for (int i = 0; i < 10; i++) {
        tableLayout.addColumnData(new ColumnWeightData(1, 150, true));
    }
    table.setLayout(tableLayout);

    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 0, 0);
    table.setLayoutData(data);

    matchingRulesTable.setContentProvider(new ArrayContentProvider());
    matchingRulesTable.setLabelProvider(new MatchRulesTableLabelProvider(inputColumnNames));
}

From source file:org.talend.dataprofiler.core.ui.dialog.MatchRuleElementTreeSelectionDialog.java

License:Open Source License

private void createParticularSurvivorshipRulesTableTswoosh(Composite parent) {
    particularSurvivRulesTableComposite = new Composite(parent, SWT.None);
    GridLayout layout = new GridLayout();
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    particularSurvivRulesTableComposite.setLayout(layout);

    particularSurvivRulesTable = new TableViewer(particularSurvivRulesTableComposite,
            SWT.BORDER | SWT.FULL_SELECTION);
    Table table = particularSurvivRulesTable.getTable();
    TableColumn c1 = new TableColumn(table, SWT.NULL);
    c1.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.INPUT_COLUMN")); //$NON-NLS-1$
    TableColumn c2 = new TableColumn(table, SWT.NULL);
    c2.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.SURVIVORSHIP_FUNCTION")); //$NON-NLS-1$
    TableColumn c3 = new TableColumn(table, SWT.NULL);
    c3.setText(DefaultMessagesImpl.getString("MatchRuleTableComposite.PARAMETER")); //$NON-NLS-1$
    table.setLinesVisible(true);//from   w  w w .j  a v  a2 s  .  c om
    table.setHeaderVisible(true);
    TableLayout tableLayout = new TableLayout();
    for (int i = 0; i < 3; i++) {
        tableLayout.addColumnData(new ColumnWeightData(1, 400, true));
    }
    table.setLayout(tableLayout);

    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true, 0, 0);
    table.setLayoutData(data);

    particularSurvivRulesTable.setContentProvider(new ArrayContentProvider());
    particularSurvivRulesTable
            .setLabelProvider(new ParticularSurvivorshipRulesTableLabelProvider(inputColumnNames));
}

From source file:org.talend.designer.core.ui.dialog.HelpAvailableDialog.java

License:Open Source License

@Override
protected Control createButtonBar(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  . jav a  2  s  .  co  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;
}