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:com.drgarbage.bytecode.jdi.dialogs.ProjectBuildPathDialog.java

License:Apache License

protected Control createDialogArea(Composite parent) {
    /* create a composite with standard margins and spacing */
    getShell().setText(BytecodeVisualizerMessages.Buildpath_Dialog_Abr);

    setTitle(BytecodeVisualizerMessages.Buildpath_Dialog_Title);
    setMessage(BytecodeVisualizerMessages.Buildpath_Dialog_Message);
    setTitleImage(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportdir_wiz.png").createImage());

    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  w  w  . j av  a 2 s  . c o  m*/
    GridData data = new GridData(GridData.FILL_BOTH);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    /* create a tree viewer*/
    fPathViewer = new ProjectBuildPathViewer(composite, fJavaProject);
    fPathViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
    fPathViewer.getControl().setFont(parent.getFont());
    fPathViewer.setInput(fJavaProject.getResource().getWorkspace().getRoot());
    fPathViewer.expandAll();

    /*create a new folder button */
    Button button = new Button(composite, SWT.PUSH);
    button.setText(NewWizardMessages.FolderSelectionDialog_button);
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            newFolderButtonPressed();
        }
    });
    button.setFont(parent.getFont());

    /*set help ID */
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, null);

    return composite;
}

From source file:com.drgarbage.bytecodevisualizer.actions.DebugFunctionalityInfoDialog.java

License:Apache License

@Override
protected Control createMessageArea(Composite composite) {
    Composite result = (Composite) super.createMessageArea(composite);

    Composite area = new Composite(result, SWT.NONE);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .applyTo(area);// ww  w . j  av  a 2s .c o  m

    GridLayout layout = new GridLayout();
    layout.marginWidth = layout.marginHeight = 0;
    layout.numColumns = 1;
    area.setLayout(layout);

    Label lbl = null;
    Link link = null;

    lbl = new Label(area, SWT.NONE);
    lbl.setText(
            BytecodeVisualizerMessages.ToggleBreakpointAction_tooltipText_Debug_functionality_is_unavailable_in_this_context_);
    lbl.setLayoutData(new GridData(GridData.FILL_BOTH));
    JFaceUtils.toBold(lbl);

    lbl = new Label(area, SWT.NONE);
    lbl.setText(BytecodeVisualizerMessages.DebugFunctionalityInfoDialog_lbl_Your_class_or_jar_file_needs_);
    lbl.setLayoutData(new GridData(GridData.FILL_BOTH));

    ListPanel lp = new ListPanel(area, SWT.NONE, SWT.WRAP);
    lp.setNumbered(true);
    GridData gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.BEGINNING;
    gd.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN * 2;

    lp.getControl().setLayoutData(gd);
    //lp.getControl().setBackground(infoBg);

    lp.addText(
            BytecodeVisualizerMessages.DebugFunctionalityInfoDialog_lbl_i_included_in_some_java_projects_build_path_and);

    String msg = MessageFormat.format(
            BytecodeVisualizerMessages.DebugFunctionalityInfoDialog_lbl_ii_opened_using_0_1_or_similar_feature_of_2_,
            new Object[] { CoreMessages.lbl_Package_Explorer, CoreMessages.lbl_Open_Declaration,
                    CoreMessages.lbl_Java_Development_Tools_JDT_Plugin });
    lp.addText(msg);

    msg = MessageFormat.format(
            BytecodeVisualizerMessages.DebugFunctionalityInfoDialog_link_Please_read_0_this_tutorial_for_more_details_,
            new Object[] { Links.HOW_TO_DEBUG_BYTECODE_WITH_BYTECODE_VISUALIZER });
    link = LinkFactory.createHttpPathLink(area, SWT.NONE);
    link.setText(msg);
    gd = new GridData();
    gd.horizontalAlignment = SWT.FILL;
    gd.verticalAlignment = SWT.BEGINNING;
    gd.verticalIndent = IDialogConstants.VERTICAL_SPACING;
    link.setLayoutData(gd);

    return result;
}

From source file:com.drgarbage.controlflowgraphfactory.dialogs.ExportGraphFileFolderSelectionDialog.java

License:Apache License

protected Control createButtonBar(Composite parent) {

    /* create options */
    Group optGroup = new Group(parent, SWT.NONE);
    GridLayout layout0 = new GridLayout();
    layout0.numColumns = 1;//w  ww .  j a  v a  2s.co m
    optGroup.setLayout(layout0);
    GridData data0 = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_CENTER);

    data0.horizontalIndent = 16;
    optGroup.setLayoutData(data0);

    final Combo exportFormatCombo = new Combo(optGroup, SWT.READ_ONLY);
    exportFormatCombo.setItems(GraphConstants.SUPPORTED_EXPORT_FORMAT_LABELS);
    exportFormatCombo.select(getGraphSpecification().getExportFormat());
    exportFormatCombo.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            int format = exportFormatCombo.getSelectionIndex();
            getGraphSpecification().setExportFormat(format);

            switch (format) {
            case GraphConstants.EXPORT_FORMAT_DRGARBAGE_GRAPH:

                /* disable properties */
                checkButton1.setEnabled(false);
                checkButton2.setEnabled(false);
                checkButton3.setEnabled(false);

                break;
            case GraphConstants.EXPORT_FORMAT_DOT:
            case GraphConstants.EXPORT_FORMAT_GRAPHXML:
            case GraphConstants.EXPORT_FORMAT_GRAPHML:

                /* enable properties */
                checkButton1.setEnabled(true);
                checkButton2.setEnabled(true);
                checkButton3.setEnabled(true);

                break;
            default:
                throw new IllegalStateException(
                        "Unexpected export format '" + getGraphSpecification().getExportFormat() + "'");
            }
        }
    });

    checkButton1 = new Button(optGroup, SWT.CHECK);
    checkButton1.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            getGraphSpecification().setExportDecorations(checkButton1.getSelection());
        }
    });
    checkButton1.setText(ControlFlowFactoryMessages.ExportGraphAction_checkBox1Text);

    checkButton2 = new Button(optGroup, SWT.CHECK);
    checkButton2.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            getGraphSpecification().setExportGeometry(checkButton2.getSelection());
        }
    });
    checkButton2.setText(ControlFlowFactoryMessages.ExportGraphAction_checkBox2Text);

    checkButton3 = new Button(optGroup, SWT.CHECK);
    checkButton3.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            getGraphSpecification().setExportComments(checkButton3.getSelection());
        }
    });
    checkButton3.setText(ControlFlowFactoryMessages.ExportGraphAction_checkBox3Text);

    /* disable properties */
    checkButton1.setEnabled(false);
    checkButton2.setEnabled(false);
    checkButton3.setEnabled(false);

    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 = 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.
    return super.createButtonBar(parent);
}

From source file:com.drgarbage.core.jface.ListPanel.java

License:Apache License

protected Label createBullet() {
    Label lbl = createTextItem();

    if (numbered) {
        lbl.setText(String.valueOf(index++) + ".");
    } else {/*w w w  . jav  a 2  s  . com*/
        lbl.setText(BULL);
    }

    GridData gd = new GridData();
    gd.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;
    gd.verticalAlignment = SWT.BEGINNING;
    gd.verticalIndent = IDialogConstants.VERTICAL_SPACING;
    lbl.setLayoutData(gd);
    return lbl;
}

From source file:com.dubture.composer.ui.wizard.AbstractWizardFirstPage.java

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 {// ww w.j  av a 2 s  .  c o m
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }
    return layout;
}

From source file:com.dubture.pdt.formatter.internal.ui.preferences.formatter.ModifyDialogTabPage.java

License:Open Source License

/**
 * Create the contents of this tab page.
 * <p>//from   w w  w  . j av  a  2 s  . c  om
 * Subclasses should implement <code>doCreatePreferences</code> and <code>doCreatePreview</code>
 * may also be overridden as necessary.
 * </p>
 * 
 * @param parent The parent composite
 * @return Created content control
 */
public Composite createContents(Composite parent) {
    final int numColumns = 4;

    if (fPixelConverter == null) {
        fPixelConverter = new PixelConverter(parent);
    }

    final SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
    sashForm.setFont(parent.getFont());

    Composite scrollContainer = new Composite(sashForm, SWT.NONE);

    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    scrollContainer.setLayoutData(gridData);

    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    scrollContainer.setLayout(layout);

    ScrolledComposite scroll = new ScrolledComposite(scrollContainer, SWT.V_SCROLL | SWT.H_SCROLL);
    scroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scroll.setExpandHorizontal(true);
    scroll.setExpandVertical(true);

    final Composite settingsContainer = new Composite(scroll, SWT.NONE);
    settingsContainer.setFont(sashForm.getFont());

    scroll.setContent(settingsContainer);

    settingsContainer.setLayout(new PageLayout(scroll, 400, 400));
    settingsContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    Composite settingsPane = new Composite(settingsContainer, SWT.NONE);
    settingsPane.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = (int) (1.5
            * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING));
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    settingsPane.setLayout(layout);
    doCreatePreferences(settingsPane, numColumns);

    settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    scroll.addControlListener(new ControlListener() {

        public void controlMoved(ControlEvent e) {
        }

        public void controlResized(ControlEvent e) {
            settingsContainer.setSize(settingsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
        }
    });

    Label sashHandle = new Label(scrollContainer, SWT.SEPARATOR | SWT.VERTICAL);
    gridData = new GridData(SWT.RIGHT, SWT.FILL, false, true);
    sashHandle.setLayoutData(gridData);

    final Composite previewPane = new Composite(sashForm, SWT.NONE);
    previewPane.setLayout(createGridLayout(numColumns, true));
    previewPane.setFont(sashForm.getFont());
    doCreatePreviewPane(previewPane, numColumns);

    initializePage();

    sashForm.setWeights(new int[] { 3, 3 });
    return sashForm;
}

From source file:com.dubture.pdt.formatter.internal.ui.preferences.formatter.OffOnTagsTabPage.java

License:Open Source License

public final Composite createContents(Composite parent) {
    if (fPixelConverter == null)
        fPixelConverter = new PixelConverter(parent);

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData());

    final int numColumns = 2;
    GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = (int) (1.5
            * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING));
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    composite.setLayout(layout);//from  ww  w  . j ava2  s .  co  m
    doCreatePreferences(composite, numColumns);

    return composite;
}

From source file:com.dubture.symfony.ui.wizards.project.SymfonyProjectWizardSecondPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {

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

    GridLayout layout = new GridLayout(1, false);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);

    composite.setLayout(layout);/* w ww  . java 2  s  . c  o  m*/
    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    overrideComposer = new SelectionButtonDialogField(SWT.CHECK);
    overrideComposer.setLabelText("Override composer.json values");
    overrideComposer.doFillIntoGrid(composite, 3);
    overrideComposer.setDialogFieldListener(new IDialogFieldListener() {
        @Override
        public void dialogFieldChanged(DialogField field) {
            settingsGroup.setEnabled(overrideComposer.isSelected());
        }
    });

    settingsGroup = new BasicSettingsGroup(composite, getShell());
    settingsGroup.addObserver(this);
    settingsGroup.setEnabled(false);

    setControl(composite);

    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite,
            SymfonyUiPlugin.PLUGIN_ID + "." + "newproject_secondpage");
}

From source file:com.elphel.vdt.ui.dialogs.VDTErrorDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    createMessageArea(parent);/*  www  .j  a  va 2s  .  co  m*/

    // 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);
    layout.numColumns = 2;

    composite.setLayout(layout);

    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;

    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

    return composite;
}

From source file:com.foglyn.ui.DateTimeDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite content = new Composite(parent, SWT.NONE);
    content.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label dateLabel = new Label(content, SWT.NONE);
    dateLabel.setText("&Date:");

    date = new DateTime(content, SWT.CALENDAR | SWT.BORDER);

    Label timeLabel = new Label(content, SWT.NONE);
    timeLabel.setText("&Time:");

    time = new ListViewer(content, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
    time.setContentProvider(new ArrayContentProvider());
    time.setLabelProvider(new TimeLabelProvider());
    time.setInput(getTimeValues());//from  www.  jav  a  2  s  .  c o m

    Link gotoToday = new Link(content, SWT.NONE);
    gotoToday.setText("<a>&Go to Today</a>");
    gotoToday.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            gotoToday();
        }
    });

    Link workdayStart = new Link(content, SWT.NONE);
    workdayStart.setText("<a>&Start of Workday</a>");
    workdayStart.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            gotoStartOfWorkday();
        }
    });

    if (selectedDate == null) {
        gotoToday();
        gotoStartOfWorkday();

        recomputeSelectedDate();
    } else {
        gotoSelectedDate();
    }

    date.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            recomputeSelectedDate();
        }
    });

    time.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            recomputeSelectedDate();
        }
    });

    // Layout stuff
    FormLayout layout = new FormLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);

    content.setLayout(layout);

    FormData dateLabelData = new FormData();
    dateLabelData.top = new FormAttachment(0);
    dateLabelData.left = new FormAttachment(date, 0, SWT.LEFT);

    dateLabel.setLayoutData(dateLabelData);

    FormData calData = new FormData();
    calData.top = new FormAttachment(dateLabel, convertVerticalDLUsToPixels(2), SWT.BOTTOM);
    calData.left = new FormAttachment();
    //        calData.bottom = new FormAttachment(100);

    date.setLayoutData(calData);

    FormData timeLabelData = new FormData();
    timeLabelData.top = new FormAttachment(0);
    timeLabelData.left = new FormAttachment(time.getControl(), 0, SWT.LEFT);

    timeLabel.setLayoutData(timeLabelData);

    FormData listData = new FormData();
    listData.top = new FormAttachment(date, 0, SWT.TOP);
    listData.bottom = new FormAttachment(date, 0, SWT.BOTTOM);
    listData.left = new FormAttachment(date, convertHorizontalDLUsToPixels(4), SWT.RIGHT);
    listData.right = new FormAttachment(100);

    time.getControl().setLayoutData(listData);

    FormData todayData = new FormData();
    todayData.top = new FormAttachment(date, convertVerticalDLUsToPixels(2), SWT.BOTTOM);
    todayData.left = new FormAttachment(0);
    todayData.bottom = new FormAttachment(100);

    gotoToday.setLayoutData(todayData);

    FormData workdayStartData = new FormData();
    workdayStartData.top = new FormAttachment(time.getControl(), convertVerticalDLUsToPixels(2), SWT.BOTTOM);
    workdayStartData.right = new FormAttachment(100);
    workdayStartData.bottom = new FormAttachment(100);

    workdayStart.setLayoutData(workdayStartData);

    return content;
}