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

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

Introduction

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

Prototype

int VERTICAL_SPACING

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

Click Source Link

Document

Vertical spacing in dialog units (value 4).

Usage

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   w ww  .  j  a  va2  s. 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 .  ja v  a 2s.  c o m*/
    }

    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   www . jav  a2s.  c  om*/
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.
 * /* ww  w  . j  ava2s.c  o 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 .j  a  va2 s .c om
 * @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.ProgressInfoItem.java

License:Open Source License

/**
 * Set the text of the link to the taskString.
 * /*from w w w  .  jav a 2 s .c  o m*/
 * @param taskString
 */
void setLinkText(Job linkJob, String taskString, int index) {

    if (index >= taskEntries.size()) {// Is it new?
        link = new Link(this, SWT.NONE);

        FormData linkData = new FormData();
        if (index == 0 || taskEntries.size() == 0) {
            Control top = progressBar;
            if (top == null) {
                top = progressLabel;
            }
            linkData.top = new FormAttachment(top, IDialogConstants.VERTICAL_SPACING);
            linkData.left = new FormAttachment(top, 0, SWT.LEFT);
            linkData.right = new FormAttachment(top, 0, SWT.RIGHT);
            // Give an initial value so as to constrain the link shortening
            linkData.width = IDialogConstants.INDENT;
        } else {
            Link previous = (Link) taskEntries.get(index - 1);
            linkData.top = new FormAttachment(previous, IDialogConstants.VERTICAL_SPACING);
            linkData.left = new FormAttachment(previous, 0, SWT.LEFT);
            linkData.right = new FormAttachment(previous, 0, SWT.RIGHT);
            // Give an initial value so as to constrain the link shortening
            linkData.width = IDialogConstants.INDENT;
        }

        link.setLayoutData(linkData);

        link.addSelectionListener(new SelectionAdapter() {
            /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
             */
            public void widgetSelected(SelectionEvent e) {
                executeTrigger();
            }
        });

        link.addListener(SWT.Resize, new Listener() {
            /*
             * (non-Javadoc)
             * 
             * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
             */
            public void handleEvent(Event event) {

                Object text = link.getData(TEXT_KEY);
                if (text == null)
                    return;

                updateText((String) text, link);

            }
        });
        taskEntries.add(link);
    } else {
        link = (Link) taskEntries.get(index);
    }

    // check for action property
    Object actionProperty = linkJob.getProperty(IProgressConstants.ACTION_PROPERTY);
    Object commandProperty = linkJob.getProperty(IProgressConstants2.COMMAND_PROPERTY);

    if (actionProperty != null && commandProperty != null) {
        // if both are specified, then use neither
        updateTrigger(null, link);
    } else {
        Object property = actionProperty != null ? actionProperty : commandProperty;
        updateTrigger(property, link);
    }

    if (link.getData(TRIGGER_KEY) == null && (taskString == null || taskString.equals(getMainTitle()))) {
        // workaround for https://bugs.eclipse.org/383570
        taskString = ""; //$NON-NLS-1$
    }
    link.setToolTipText(taskString);
    link.setData(TEXT_KEY, taskString);

    updateText(taskString, link);

}

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.//from  ww w .j  ava 2s.  co 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();/*from  w  w w  .j  a  v  a2s  .  c om*/
    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 .j a  va 2 s  .co  m
    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);/*  w w  w. j  a v a  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;
}