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

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

Introduction

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

Prototype

int VERTICAL_MARGIN

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

Click Source Link

Document

Vertical margin in dialog units (value 7).

Usage

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

License:Open Source License

protected Control createDialogArea(Composite parent) {
    createMessageArea(parent);//from  w  w  w. j  a v  a  2  s.c om

    // 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());//  w  ww .j a v  a2s.  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;
}

From source file:com.github.lbroudoux.dsl.eip.bridge.core.ui.dialogs.EIPModelAndRouteSelectionDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite base) {
    Composite parent = (Composite) super.createDialogArea(base);
    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);/*w w  w.jav a 2s  .  co m*/
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    // Manage dialog tree content.
    FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true);

    projectTree = tree.getViewer();
    projectTree.setLabelProvider(new EIPModelTreeLabelProvider());
    projectTree.setContentProvider(new EIPModelTreeContentProvider());
    projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot());

    GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree);

    // Manage dialog tree events.
    projectTree.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection() instanceof TreeSelection) {
                TreeSelection tSelection = (TreeSelection) event.getSelection();
                if (tSelection.getFirstElement() instanceof IResource) {
                    eipModel = (IResource) tSelection.getFirstElement();
                }
            }
        }
    });

    setTitle("Choose a target EIP model");
    setMessage("Select the EIP model for designing a new Route from Service");
    applyDialogFont(composite);

    return composite;
}

From source file:com.github.lbroudoux.dsl.eip.parser.core.ui.dialogs.CompareTargetSelectionDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite base) {
    Composite parent = (Composite) super.createDialogArea(base);
    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  .jav a  2  s.  c om
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    // Manage dialog tree content.
    FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true);

    projectTree = tree.getViewer();
    projectTree.setLabelProvider(new RouteTreeLabelProvider());
    projectTree.setContentProvider(new RouteTreeContentProvider());
    projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot());

    GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree);

    // Manage dialog tree events.
    projectTree.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection() instanceof TreeSelection) {
                TreeSelection tSelection = (TreeSelection) event.getSelection();
                if (tSelection.getFirstElement() instanceof Route) {
                    selectedRoute = (Route) tSelection.getFirstElement();
                }
            }
        }
    });

    setTitle("Compare '" + fileName + "' with an EIP Route model");
    setMessage("Select an EIP Route to compare the resource with");
    applyDialogFont(composite);

    return composite;
}

From source file:com.github.lbroudoux.dsl.eip.parser.core.ui.dialogs.PersistTargetSelectionDialog.java

License:Apache License

@Override
protected Control createDialogArea(Composite base) {
    Composite parent = (Composite) super.createDialogArea(base);
    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  . jav a  2 s . c  o  m*/
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    // Manage dialog tree content.
    FilteredTree tree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER, new PatternFilter(), true);

    projectTree = tree.getViewer();
    projectTree.setLabelProvider(new EIPModelTreeLabelProvider());
    projectTree.setContentProvider(new EIPModelTreeContentProvider());
    projectTree.setInput(ResourcesPlugin.getWorkspace().getRoot());

    GridDataFactory.fillDefaults().grab(true, true).hint(500, 300).applyTo(tree);

    // Manage dialog tree events.
    projectTree.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            if (event.getSelection() instanceof TreeSelection) {
                TreeSelection tSelection = (TreeSelection) event.getSelection();
                if (tSelection.getFirstElement() instanceof IResource) {
                    selectedEIPModel = (IResource) tSelection.getFirstElement();
                }
            }
        }
    });

    setTitle("Parse and merge '" + fileName + "' with an EIP Model");
    setMessage("Select an EIP Model to persist the parsed resource within");
    applyDialogFont(composite);

    return composite;
}

From source file:com.google.cloud.tools.eclipse.appengine.deploy.ui.DeployPreferencesDialog.java

License:Apache License

@Override
protected Control createDialogArea(final Composite parent) {
    Composite dialogArea = (Composite) super.createDialogArea(parent);

    Composite container = new Composite(dialogArea, SWT.NONE);
    content = new StandardDeployPreferencesPanel(container, project, loginService, getLayoutChangedHandler(),
            true /* requireValues */);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(content);

    // we pull in Dialog's content margins which are zeroed out by TitleAreaDialog
    GridDataFactory.fillDefaults().grab(true, true).applyTo(container);
    GridLayoutFactory.fillDefaults()/*from  w  w w  .  ja va2  s . com*/
            .margins(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .generateLayout(container);

    TitleAreaDialogSupport.create(this, content.getDataBindingContext())
            .setValidationMessageProvider(new ValidationMessageProvider() {
                @Override
                public int getMessageType(ValidationStatusProvider statusProvider) {
                    int type = super.getMessageType(statusProvider);
                    setValid(type != IMessageProvider.ERROR);
                    return type;
                }
            });
    return dialogArea;
}

From source file:com.google.dart.tools.search.internal.ui.SearchDialog.java

License:Open Source License

@Override
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   www.  java  2 s .c o  m
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // create help control if needed
    if (isHelpAvailable()) {
        createHelpControl(composite);
    }

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

From source file:com.google.dart.tools.ui.feedback.FeedbackDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    //overriding to tweak layout

    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = 0; //convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = 0; //convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    //put some padding at the bottom
    layout.marginBottom = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    composite.setLayout(layout);/*from ww  w .j a  va2s  .  c om*/
    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;
}

From source file:com.google.dart.tools.ui.internal.cleanup.preference.ModifyDialogTabPage.java

License:Open Source License

/**
 * Create the contents of this tab page.
 * <p>/*ww w .  jav  a2  s . c  o  m*/
 * 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
 */
@Override
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() {

        @Override
        public void controlMoved(ControlEvent e) {
        }

        @Override
        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.google.dart.tools.ui.internal.dialogs.OpenFolderDialog.java

License:Open Source License

private void createFolderBrowseRow(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);//from  w  ww.j a v a2  s .  c om
    panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    panel.setFont(parent.getFont());

    Label label = new Label(panel, SWT.NONE);
    label.setText(DialogMessages.OpenFolderDialog_label);

    text = new Text(panel, SWT.BORDER);
    text.setFocus();
    text.setLayoutData(new GridData(400, SWT.DEFAULT));
    text.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            folderLocation = text.getText();
            Button okButton = getButton(Window.OK);
            if (okButton != null && !okButton.isDisposed()) {
                boolean nonWhitespaceFound = false;
                String characters = getFolderLocation();
                for (int i = 0; !nonWhitespaceFound && i < characters.length(); i++) {
                    if (!Character.isWhitespace(characters.charAt(i))) {
                        nonWhitespaceFound = true;
                    }
                }
                okButton.setEnabled(nonWhitespaceFound);
                setCheckBoxState();
            }
        }
    });

    Button browseButton = new Button(panel, SWT.PUSH);
    browseButton.setText(DialogMessages.OpenFolderDialog_browse);
    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(DialogMessages.OpenFolderDialog_title);
            dialog.setMessage(DialogMessages.OpenFolderDialog_dialogMessage);
            dialog.setFilterPath(getInitialBrowsePath());
            String dir = dialog.open();
            dir = TextProcessor.process(dir);
            if (dir != null) {
                text.setText(dir);
            }
        }

    });
}