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:de.babe.eclipse.plugins.quickREx.dialogs.SimpleTextDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    getShell().setText(title);/*  www . j  ava2  s .c o m*/
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE | SWT.RESIZE);
    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 = 1;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(composite);
    textField = new Text(composite,
            SWT.READ_ONLY | SWT.LEAD | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.RESIZE);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.heightHint = 250;
    gd.widthHint = 400;
    textField.setLayoutData(gd);
    textField.setBackground(new Color(getShell().getDisplay(), new RGB(255, 255, 255)));
    textField.setText(contents);

    return composite;
}

From source file:de.bht.fpa.mail.s000000.common.rcp.exception.ExceptionDetailsErrorDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates and
 * lays out a composite and calls <code>createMessageArea</code> and
 * <code>createCustomArea</code> to populate it. Subclasses should override
 * <code>createCustomArea</code> to add contents below the message.
 *//*from  www  .java2s.c o m*/
@Override
protected Control createDialogArea(Composite parent) {
    createMessageArea(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);
    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:de.femodeling.e4.ui.progress.internal.DetailedProgressViewer.java

License:Open Source License

protected void internalRefresh(Object element) {
    if (element == null) {
        return;//from ww w  .j  a v  a  2s .  c  om
    }

    if (element.equals(getRoot())) {
        refreshAll();
        return;
    }
    Widget widget = findItem(element);
    if (widget == null) {
        add(new Object[] { element });
        return;
    }
    ((ProgressInfoItem) widget).refresh();

    // Update the minimum size
    Point size = control.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    size.x += IDialogConstants.HORIZONTAL_SPACING;
    size.y += IDialogConstants.VERTICAL_SPACING;

    scrolled.setMinSize(size);
}

From source file:de.femodeling.e4.ui.progress.internal.ProgressInfoItem.java

License:Open Source License

/**
 * Create the child widgets of the receiver.
 *//*from   w  w w  . ja va  2s .c o m*/
protected void createChildren() {

    FormLayout layout = new FormLayout();
    setLayout(layout);

    jobImageLabel = new Label(this, SWT.NONE);
    Image infoImage = getInfoImage();
    jobImageLabel.setImage(infoImage);
    FormData imageData = new FormData();
    if (infoImage != null) {
        // position it in the center
        imageData.top = new FormAttachment(50, -infoImage.getBounds().height / 2);
    } else {
        imageData.top = new FormAttachment(0, IDialogConstants.VERTICAL_SPACING);
    }
    imageData.left = new FormAttachment(0, IDialogConstants.HORIZONTAL_SPACING / 2);
    jobImageLabel.setLayoutData(imageData);

    progressLabel = new Label(this, SWT.NONE);
    setMainText();

    actionBar = new ToolBar(this, SWT.FLAT);
    actionBar.setCursor(getDisplay().getSystemCursor(SWT.CURSOR_ARROW));

    // set cursor to overwrite any busy cursor we might have

    actionButton = new ToolItem(actionBar, SWT.NONE);
    actionButton.setToolTipText(ProgressMessages.NewProgressView_CancelJobToolTip);
    actionButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            actionButton.setEnabled(false);
            cancelOrRemove();
        }
    });
    actionBar.addListener(SWT.Traverse, new Listener() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
         */
        public void handleEvent(Event event) {
            if (indexListener == null) {
                return;
            }
            int detail = event.detail;
            if (detail == SWT.TRAVERSE_ARROW_NEXT) {
                indexListener.selectNext();
            }
            if (detail == SWT.TRAVERSE_ARROW_PREVIOUS) {
                indexListener.selectPrevious();
            }

        }
    });
    updateToolBarValues();

    FormData progressData = new FormData();
    progressData.top = new FormAttachment(0, IDialogConstants.VERTICAL_SPACING);
    progressData.left = new FormAttachment(jobImageLabel, IDialogConstants.HORIZONTAL_SPACING / 2);
    progressData.right = new FormAttachment(actionBar, IDialogConstants.HORIZONTAL_SPACING * -1);
    progressLabel.setLayoutData(progressData);

    mouseListener = new MouseAdapter() {
        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.swt.events.MouseListener#mouseDown(org.eclipse.swt.events.MouseEvent)
         */
        public void mouseDown(MouseEvent e) {
            if (indexListener != null) {
                indexListener.select();
            }
        }
    };
    addMouseListener(mouseListener);
    jobImageLabel.addMouseListener(mouseListener);
    progressLabel.addMouseListener(mouseListener);

    setLayoutsForNoProgress();

    refresh();
}

From source file:de.femodeling.e4.ui.progress.internal.ProgressInfoItem.java

License:Open Source License

/**
 * Set the layout of the widgets for the no progress case.
 * //from  w  w  w  .  j  a v  a2 s . co  m
 */
private void setLayoutsForNoProgress() {

    FormData buttonData = new FormData();
    buttonData.top = new FormAttachment(progressLabel, 0, SWT.TOP);
    buttonData.right = new FormAttachment(100, IDialogConstants.HORIZONTAL_SPACING * -1);

    actionBar.setLayoutData(buttonData);
    if (taskEntries.size() > 0) {
        FormData linkData = new FormData();
        linkData.top = new FormAttachment(progressLabel, IDialogConstants.VERTICAL_SPACING);
        linkData.left = new FormAttachment(progressLabel, 0, SWT.LEFT);
        linkData.right = new FormAttachment(actionBar, 0, SWT.LEFT);
        ((Link) taskEntries.get(0)).setLayoutData(linkData);

    }
}

From source file:de.femodeling.e4.ui.progress.internal.ProgressInfoItem.java

License:Open Source License

/**
 * Create the progress bar and apply any style bits from style.
 * /*from w w  w  .  ja  v a2s.  co m*/
 * @param style
 */
void createProgressBar(int style) {

    FormData buttonData = new FormData();
    buttonData.top = new FormAttachment(progressLabel, 0);
    buttonData.right = new FormAttachment(100, IDialogConstants.HORIZONTAL_SPACING * -1);

    actionBar.setLayoutData(buttonData);

    progressBar = new ProgressBar(this, SWT.HORIZONTAL | style);
    FormData barData = new FormData();
    barData.top = new FormAttachment(actionBar, IDialogConstants.VERTICAL_SPACING, SWT.TOP);
    barData.left = new FormAttachment(progressLabel, 0, SWT.LEFT);
    barData.right = new FormAttachment(actionBar, IDialogConstants.HORIZONTAL_SPACING * -1);
    barData.height = MAX_PROGRESS_HEIGHT;
    barData.width = 0;// default is too large
    progressBar.setLayoutData(barData);

    if (taskEntries.size() > 0) {
        // Reattach the link label if there is one
        FormData linkData = new FormData();
        linkData.top = new FormAttachment(progressBar, IDialogConstants.VERTICAL_SPACING);
        linkData.left = new FormAttachment(progressBar, 0, SWT.LEFT);
        linkData.right = new FormAttachment(progressBar, 0, SWT.RIGHT);
        // Give an initial value so as to constrain the link shortening
        linkData.width = IDialogConstants.INDENT;

        ((Link) taskEntries.get(0)).setLayoutData(linkData);
    }
}

From source file:de.femodeling.e4.ui.progress.internal.ProgressMonitorJobsDialog.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.//  w ww .  j a  v a  2  s . c o  m
    GridLayout layout = new GridLayout();
    layout.numColumns = 1; // this is incremented by createButton
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    data.horizontalAlignment = GridData.END;
    data.grabExcessHorizontalSpace = true;
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());
    // Add the buttons to the button bar.
    if (arrowCursor == null) {
        arrowCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_ARROW);
    }
    createButtonsForButtonBar(composite);
    return composite;
}

From source file:de.hoesel.dav.buv.twitter.preferences.TwitterPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    noDefaultAndApplyButton();//ww  w. j a  v a2s .  com
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);

    try {
        user = twitter.verifyCredentials();
        invalidateTwitterAuthentication(composite, user);
    } catch (TwitterException e) {
        if (401 == e.getStatusCode()) {
            // (noch) kein oauth token
        } else {
            Activator.getDefault().getLog()
                    .log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getErrorMessage()));
        }

        createNewTwitterAuthentication(composite);

    } catch (Exception e2) {
        createNewTwitterAuthentication(composite);
    }

    return composite;
}

From source file:de.topicmapslab.tmcledit.diagram.preferences.ColorSchemeEditor.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite comp = new Composite(parent, SWT.NONE);
    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);
    comp.setLayout(layout);// w w  w .  jav  a  2s. c  om
    comp.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(comp);

    Label l = new Label(comp, SWT.NONE);
    l.setText("Name:");

    nameText = new Text(comp, SWT.BORDER);
    nameText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    nameText.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            validateName();
            validateColors();

        }
    });

    l = new Label(comp, SWT.NONE);
    l.setText("Topic Color:");
    topicColor = new ColorSelector(comp);

    l = new Label(comp, SWT.NONE);
    l.setText("Comment Color:");
    commentColor = new ColorSelector(comp);

    l = new Label(comp, SWT.NONE);
    l.setText("Topic Font Color:");
    topicFontColor = new ColorSelector(comp);

    l = new Label(comp, SWT.NONE);
    l.setText("Comment Font Color:");
    commentFontColor = new ColorSelector(comp);

    useGradient = new Button(comp, SWT.CHECK);
    useGradient.setText("Use Gradient");
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    useGradient.setLayoutData(gd);

    l = new Label(comp, SWT.NONE);
    l.setText("Secondary Topic Color:");
    secTopicColor = new ColorSelector(comp);
    secTopicColor.addListener(new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            validateColors();
            validateName();
        }
    });

    l = new Label(comp, SWT.NONE);
    l.setText("Secondary Comment Color:");
    secCommentColor = new ColorSelector(comp);
    secCommentColor.addListener(new IPropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            validateColors();
            validateName();
        }
    });

    useGradient.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            secTopicColor.setEnabled(useGradient.getSelection());
            secCommentColor.setEnabled(useGradient.getSelection());
            validateColors();
            validateName();
        }
    });

    initFields();

    return comp;
}

From source file:de.tub.tfs.henshin.editor.ui.dialog.resources.ResourcesDialog.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);
    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;// 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  va 2s.  c om*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parentComposite.getFont());

    Listener listener = new Listener() {
        @Override
        public void handleEvent(Event event) {
            setDialogComplete(validate());
        }
    };

    resourceGroup = new FileSelectionGroup(composite, listener, type == SWT.SAVE, "File name:");

    return parentComposite;
}