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

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

Introduction

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

Prototype

int HORIZONTAL_SPACING

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

Click Source Link

Document

Horizontal spacing in dialog units (value 4).

Usage

From source file:org.eclipse.php.internal.ui.dialogs.saveFiles.SaveAsDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // top level composite
    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);// ww  w. j a  va  2  s.  c  o  m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    Listener listener = new Listener() {
        public void handleEvent(Event event) {
            setDialogComplete(validatePage());
        }
    };

    resourceGroup = new ResourceAndContainerGroup(composite, listener, "", ""); //$NON-NLS-1$ //$NON-NLS-2$
    resourceGroup.setAllowExistingResources(true);

    return parentComposite;
}

From source file:org.eclipse.php.internal.ui.preferences.EditTemplateDialog.java

License:Open Source License

protected Control createDialogArea(Composite ancestor) {
    Composite parent = new Composite(ancestor, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*ww  w. j  av a2  s .  c om*/
    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();
                }
            }
        });

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

        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);

    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.eclipse.php.internal.ui.preferences.PHPBasePreferencePage.java

License:Open Source License

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

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    result.setLayout(layout);

    Group doubleClickGroup = new Group(result, SWT.NONE);
    doubleClickGroup.setLayout(new GridLayout());
    doubleClickGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    doubleClickGroup.setText(PHPUIMessages.PHPBasePreferencePage_doubleclick_action);
    addRadioButton(doubleClickGroup, PHPUIMessages.PHPBasePreferencePage_doubleclick_gointo, DOUBLE_CLICK,
            DOUBLE_CLICK_GOES_INTO);
    addRadioButton(doubleClickGroup, PHPUIMessages.PHPBasePreferencePage_doubleclick_expand, DOUBLE_CLICK,
            DOUBLE_CLICK_EXPANDS);
    Dialog.applyDialogFont(result);
    return result;
}

From source file:org.eclipse.php.internal.ui.preferences.PHPProjectLayoutPreferencePage.java

License:Open Source License

protected Control createPreferenceContent(Composite parent) {
    initializeDialogUnits(parent);/* www. ja v a 2  s.co m*/

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    result.setLayout(layout);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;

    Group sourceFolderGroup = new Group(result, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    sourceFolderGroup.setLayout(layout);
    sourceFolderGroup.setLayoutData(gd);
    sourceFolderGroup.setText(PreferencesMessages.NewPHPProjectPreferencePage_sourcefolder_label);

    int indent = 0;

    fProjectAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewPHPProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.FALSE, indent);
    fProjectAsSourceFolder.addSelectionListener(fSelectionListener);

    fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewPHPProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.TRUE, indent);
    fFoldersAsSourceFolder.addSelectionListener(fSelectionListener);

    indent = convertWidthInCharsToPixels(4);

    fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fSrcFolderNameLabel.setText(PreferencesMessages.NewPHPProjectPreferencePage_folders_src);
    fSrcFolderNameText = addTextControl(sourceFolderGroup, fSrcFolderNameLabel, SRCBIN_SRCNAME, indent);
    fSrcFolderNameText.addModifyListener(fModifyListener);

    fBinFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fBinFolderNameLabel.setText(PreferencesMessages.NewPHPProjectPreferencePage_folders_public);
    fBinFolderNameText = addTextControl(sourceFolderGroup, fBinFolderNameLabel, SRCBIN_BINNAME, indent);
    fBinFolderNameText.addModifyListener(fModifyListener);

    validateFolders();

    return result;
}

From source file:org.eclipse.php.internal.ui.wizards.PHPProjectWizardFirstPage.java

License:Open Source License

/**
 * Initialize a grid layout with the default Dialog settings.
 *///  ww  w  .  jav  a2  s  .co  m
public GridLayout initGridLayout(GridLayout layout, boolean margins) {
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    if (margins) {
        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    } else {
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }
    return layout;
}

From source file:org.eclipse.php.refactoring.ui.prefereces.PHPCodeRefactorPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {

    initializeDialogUnits(parent);//from   w  ww  .ja v  a2 s.co  m

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    result.setLayout(layout);

    Group refactoringGroup = new Group(result, SWT.NONE);
    refactoringGroup.setLayout(new GridLayout());
    refactoringGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    refactoringGroup.setText(Messages.PHPCodeRefactorPreferencePage_2);

    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);

    renameBtn = new Button(refactoringGroup, SWT.CHECK);
    renameBtn.setText(Messages.PHPCodeRefactorPreferencePage_3);
    renameBtn.setLayoutData(gd);

    renameBtn.setSelection(getPreferenceStore().getBoolean(PreferenceConstants.REFACTOR_LIGHTWEIGHT));

    Dialog.applyDialogFont(result);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IPHPHelpContextIds.CODE_REFACTOR_PREFERENCES);
    return result;
}

From source file:org.eclipse.ptp.etfw.tau.papiselect.papic.PapiListSelectionDialog.java

License:Open Source License

/**
 * Add the selection, deselection and help buttons to the dialog.
 * //from   w  ww . j  av  a  2 s  .c  om
 * @param composite
 *            org.eclipse.swt.widgets.Composite
 */
private void addSelectionButtons(Composite composite) {
    final Composite buttonComposite = new Composite(composite, SWT.NONE);
    final GridLayout layout = new GridLayout();
    layout.numColumns = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(new GridData(SWT.END, SWT.TOP, true, false));

    final Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID,
            Messages.PapiListSelectionDialog_SelectAll, false);

    SelectionListener listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            final Object[] masterlist = contentProvider.getElements(inputElement);
            for (final Object element : masterlist) {
                // System.out.println(masterlist[i]);
                listViewer.setChecked(element, true);
                updateGrey(element);
            }
        }
    };
    selectButton.addSelectionListener(listener);

    final Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID,
            Messages.PapiListSelectionDialog_DeselectAll, false);

    listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            listViewer.setAllChecked(false);
            listViewer.setAllGrayed(false);
        }
    };
    deselectButton.addSelectionListener(listener);

    final Button helpButton = createButton(buttonComposite, IDialogConstants.HELP_ID,
            Messages.PapiListSelectionDialog_CounterDescs, false);
    listener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            displayPapiDescs();
        }
    };
    helpButton.addSelectionListener(listener);
}

From source file:org.eclipse.ptp.internal.rdt.sync.ui.properties.SyncPropertyPage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite controls = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, 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);
    controls.setLayout(layout);// w  ww . ja  v  a  2s.c om
    controls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    fWidget = new ManageConfigurationWidget(controls, SWT.NONE);
    fWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    fWidget.setProject(getProject());

    return controls;
}

From source file:org.eclipse.qvt.declarative.editor.ui.paged.PagedSaveAsDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite contents = (Composite) super.createDialogArea(parent);
    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 inner = new Composite(contents, SWT.NULL);
    inner.setLayout(layout);//w  w  w.  ja va  2  s  .co m
    //      inner.setFont(parent.getFont());
    inner.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    createSaveTypeCombo(inner);
    return contents;
}

From source file:org.eclipse.search.internal.ui.SearchDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // create
    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  .  java2 s . c  o m*/
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // create help control if needed
    if (isHelpAvailable()) {
        createHelpControl(composite);
    }
    fCustomizeButton = createButton(composite, CUSTOMIZE_ID, SearchMessages.SearchDialog_customize, true);

    Label filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    layout.numColumns++;

    fReplaceButton = createActionButton(composite, REPLACE_ID, SearchMessages.SearchDialog_replaceAction, true);
    fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
    Button searchButton = createActionButton(composite, SEARCH_ID, SearchMessages.SearchDialog_searchAction,
            true);
    searchButton.setEnabled(fDescriptors.size() > 0);
    super.createButtonsForButtonBar(composite); // cancel button

    return composite;
}