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.birt.report.designer.ui.dialogs.InputParameterDialog.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);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*from  ww w  .j a  v a  2  s.  com*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);

    new Label(composite, SWT.NONE).setText(Messages.getString("InputParameterDialog.msg.requiredParam")); //$NON-NLS-1$

    scrollPane = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);
    scrollPane.setExpandHorizontal(true);
    scrollPane.setExpandVertical(true);

    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = 400;
    gd.heightHint = 400;
    scrollPane.setLayoutData(gd);

    createParameters();

    UIUtil.bindHelp(parent, IHelpContextIds.INPUT_PARAMETERS_DIALOG_ID);

    return composite;
}

From source file:org.eclipse.birt.report.designer.ui.ide.wizards.WizardSaveAsPage.java

License:Open Source License

public void createControl(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);/*from  ww  w  . j  a  va  2s.c  o m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());

    Listener listener = new Listener() {

        public void handleEvent(Event event) {
            validatePage();
            try {
                getContainer().updateButtons();
            } catch (Throwable e) {
                // ignore
            }
        }
    };

    resourceGroup = new ResourceAndContainerGroup(composite, listener,
            Messages.getString("WizardSaveAsPage.FileLabel"), //$NON-NLS-1$
            "file", //$NON-NLS-1$
            false, 200);
    resourceGroup.setAllowExistingResources(true);

    setControl(composite);

    initializeControls();

    UIUtil.bindHelp(getControl(), IHelpContextIds.SAVE_AS_WIZARD_ID);
}

From source file:org.eclipse.birt.report.extension.barcode.BarCodeBuilder.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = 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);
    composite.setLayout(layout);// w  w  w. j av  a 2s  .  c om
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTextArea(composite);

    Label lb = new Label(composite, SWT.None);
    lb.setText("Barcode Type:"); //$NON-NLS-1$

    barCodeType = new ComboViewer(composite, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
    //      barCodeType.add("");
    //      for (String bcType : BAR_CODE_TYPES) {
    //         barCodeType.add(bcType);
    //      }
    barCodeType.setContentProvider(ArrayContentProvider.getInstance());
    barCodeType.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            return ((BarCodeGenerator) element).getLabel();
        }
    });
    barCodeType.setInput(BarCodeGenerator.values());
    GridData gd = new GridData();
    gd.widthHint = 100;
    barCodeType.getControl().setLayoutData(gd);

    applyDialogFont(composite);

    try {
        initValues();
    } catch (SemanticException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return composite;
}

From source file:org.eclipse.birt.sample.reportitem.rotatedtext.RotatedTextBuilder.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    Composite composite = 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);
    composite.setLayout(layout);//from   w w  w.  j  a  va2  s  .co m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTextArea(composite);

    Label lb = new Label(composite, SWT.None);
    lb.setText("Rotation Angle:"); //$NON-NLS-1$

    sclAngle = new Scale(composite, SWT.None);
    sclAngle.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    sclAngle.setMinimum(0);
    sclAngle.setMaximum(360);
    sclAngle.setIncrement(10);

    lbAngle = new Label(composite, SWT.None);
    GridData gd = new GridData();
    gd.widthHint = 20;
    lbAngle.setLayoutData(gd);

    sclAngle.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(SelectionEvent e) {
            lbAngle.setText(String.valueOf(sclAngle.getSelection()));
        }

        public void widgetSelected(SelectionEvent e) {
            lbAngle.setText(String.valueOf(sclAngle.getSelection()));
        }
    });

    applyDialogFont(composite);

    initValues();

    return composite;
}

From source file:org.eclipse.cdt.core.testplugin.util.VerifyDialog.java

License:Open Source License

@Override
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);
    composite.setSize(SIZING_WIDTH, SWT.DEFAULT);
    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  w  w. ja v a 2s . com
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    createTestSelectionGroup(composite);
    createCheckListGroup(composite);

    _queryLabel = new Label(composite, SWT.NONE);
    _queryLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    initializeTest();
    return composite;
}

From source file:org.eclipse.cdt.cpp.ui.internal.dialogs.CustomMessageDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from www.j a v  a  2 s  . c  o  m
    composite.setLayout(layout);

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);

    composite.setFont(parent.getFont());
    // create composite for the don't show button
    Composite leftPane = new Composite(composite, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout leftPaneLayout = new GridLayout();
    leftPaneLayout.numColumns = 1;
    leftPaneLayout.makeColumnsEqualWidth = true;
    leftPaneLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    leftPaneLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    leftPaneLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    leftPaneLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    leftPane.setLayout(leftPaneLayout);

    GridData leftPaneData = new GridData(
            GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_CENTER);
    leftPane.setLayoutData(leftPaneData);

    // Add a check box if needed
    if (extraButtonLabels != null)
        createExtraButtonsForButtonBar(leftPane);
    // create composite to hold the butons
    Composite rightPane = new Composite(composite, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    GridLayout rightPaneLayout = new GridLayout();
    rightPaneLayout.numColumns = 0; // this is incremented by createButton
    rightPaneLayout.makeColumnsEqualWidth = true;
    rightPaneLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    rightPaneLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    rightPaneLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    rightPaneLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    rightPane.setLayout(rightPaneLayout);

    GridData rightPanedata = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    rightPane.setLayoutData(rightPanedata);
    // Add the buttons to the button bar.
    createButtonsForButtonBar(rightPane);
    return composite;
}

From source file:org.eclipse.cdt.debug.internal.ui.actions.RegisterGroupDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText(ActionMessages.getString("RegisterGroupDialog.5")); //$NON-NLS-1$
    setTitle(ActionMessages.getString("RegisterGroupDialog.6")); //$NON-NLS-1$
    //   setTitleImage( CDebugImages.get( CDebugImages.IMG_WIZBAN_REGISTER_GROUP ) );
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(), ICDebugHelpContextIds.REGISTER_GROUP);
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = Math.max(fNameField.getNumberOfControls(), fListField.getNumberOfControls());
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    composite.setLayout(layout);//from   w w  w  .j ava  2s  . com
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    Dialog.applyDialogFont(composite);
    PixelConverter converter = new PixelConverter(composite);
    new Separator().doFillIntoGrid(composite, layout.numColumns, converter.convertHeightInCharsToPixels(1));
    fNameField.doFillIntoGrid(composite, layout.numColumns);
    fNameField.getTextControl(null).selectAll();
    new Separator().doFillIntoGrid(composite, layout.numColumns, converter.convertHeightInCharsToPixels(1));
    fListField.doFillIntoGrid(composite, layout.numColumns + 1);
    LayoutUtil.setHorizontalSpan(fListField.getLabelControl(null), layout.numColumns);
    LayoutUtil.setHeigthHint(fListField.getListControl(null), convertWidthInCharsToPixels(30));
    LayoutUtil.setHorizontalGrabbing(fListField.getListControl(null));
    setMessage(null);
    return composite;
}

From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.CompilationDirectorySourceContainerDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Image image = fNewContainer ? CDebugImages.get(IInternalCDebugUIConstants.IMG_ADD_COMP_DIR_WIZ)
            : CDebugImages.get(IInternalCDebugUIConstants.IMG_EDIT_COMP_DIR_WIZ);
    setTitle(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_2);
    setMessage(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_3);
    setTitleImage(image);//w ww  . jav  a2s  . c  o m
    Composite parentComposite = (Composite) super.createDialogArea(parent);
    Font font = parentComposite.getFont();
    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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(font);

    Composite dirComposite = new Composite(composite, SWT.NONE);
    layout = new GridLayout(2, false);
    dirComposite.setLayout(layout);
    dirComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    dirComposite.setFont(font);

    Label label = new Label(dirComposite, SWT.NONE);
    label.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_4);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    label.setLayoutData(data);
    label.setFont(font);

    fDirText = new Text(dirComposite, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 1;
    fDirText.setLayoutData(data);
    fDirText.setFont(font);
    fDirText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validate();
        }
    });

    Button button = new Button(dirComposite, SWT.PUSH);
    button.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_5);
    data = new GridData();
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    data.widthHint = Math.max(widthHint, minSize.x);
    button.setLayoutData(data);
    button.setFont(JFaceResources.getDialogFont());
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            browse();
        }
    });

    fSubfoldersButton = new Button(dirComposite, SWT.CHECK);
    fSubfoldersButton.setText(SourceLookupUIMessages.CompilationDirectorySourceContainerDialog_6);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalIndent = layout.verticalSpacing; // Extra vertical spacing
    fSubfoldersButton.setLayoutData(data);
    fSubfoldersButton.setFont(font);

    return parentComposite;
}

From source file:org.eclipse.cdt.debug.internal.ui.sourcelookup.PathMappingDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    setTitle(SourceLookupUIMessages.PathMappingDialog_11);
    setTitleImage(CDebugImages.get(CDebugImages.IMG_WIZBAN_PATH_MAPPING));

    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/* w ww. j  ava2s .  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);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);
    composite.setFont(font);

    Dialog.applyDialogFont(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getShell(),
            ICDebugHelpContextIds.SOURCE_PATH_MAPPING_DIALOG);

    Composite nameComp = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    nameComp.setLayout(layout);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    nameComp.setLayoutData(data);
    nameComp.setFont(font);

    Label label = new Label(nameComp, SWT.LEFT);
    data = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    label.setLayoutData(data);
    label.setFont(font);
    label.setText(SourceLookupUIMessages.PathMappingDialog_12);
    fNameText = new Text(nameComp, SWT.SINGLE | SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    fNameText.setLayoutData(data);
    fNameText.setFont(font);
    fNameText.setText(getMapping().getName());
    fNameText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
        }
    });

    fViewer = createViewer(composite);
    data = new GridData(GridData.FILL_BOTH);
    fViewer.getControl().setLayoutData(data);
    fViewer.getControl().setFont(font);
    fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            updateButtons();
        }
    });

    Composite buttonComp = new Composite(composite, SWT.NONE);
    GridLayout buttonLayout = new GridLayout();
    buttonLayout.marginHeight = 0;
    buttonLayout.marginWidth = 0;
    buttonComp.setLayout(buttonLayout);
    data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_FILL);
    buttonComp.setLayoutData(data);
    buttonComp.setFont(font);

    GC gc = new GC(parent);
    gc.setFont(parent.getFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    gc.dispose();

    fAddButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_13, fontMetrics);
    fAddButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntryDialog dialog = new MapEntryDialog(getShell());
            if (dialog.open() == Window.OK) {
                getViewer().refresh();
            }
        }
    });

    fEditButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_14, fontMetrics);
    fEditButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntrySourceContainer[] entries = getSelection();
            if (entries.length > 0) {
                MapEntryDialog dialog = new MapEntryDialog(getShell(), entries[0]);
                if (dialog.open() == Window.OK) {
                    getViewer().refresh();
                }
            }
        }
    });

    fRemoveButton = createPushButton(buttonComp, SourceLookupUIMessages.PathMappingDialog_15, fontMetrics);
    fRemoveButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent evt) {
            MapEntrySourceContainer[] entries = getSelection();
            for (int i = 0; i < entries.length; ++i) {
                fMapping.removeMapEntry(entries[i]);
            }
            getViewer().refresh();
        }
    });

    setMessage(null);
    fViewer.setInput(fMapping);

    return composite;
}

From source file:org.eclipse.cdt.internal.ui.dialogs.OptionalMessageDialog.java

License:Open Source License

@Override
protected Control createCustomArea(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.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/* w  ww.  j  a v a  2 s . c  o m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    fHideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT);
    fHideDialogCheckBox.setText(fHideMessage);
    fHideDialogCheckBox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            setDialogEnabled(fId, !((Button) e.widget).getSelection());
        }
    });
    applyDialogFont(fHideDialogCheckBox);
    return fHideDialogCheckBox;
}