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.drools.eclipse.rulebuilder.ui.RuleDialog.java

License:Apache License

protected Control createDialogArea(Composite parent) {

    Composite finalComposite = new Composite(parent, SWT.NONE);
    finalComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout finalLayout = new GridLayout();
    finalComposite.setLayout(finalLayout);

    Composite titleComposite = new Composite(finalComposite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = 8;//from   w w  w. j  a  va  2  s. c o m
    layout.horizontalSpacing = 8;
    titleComposite.setLayout(layout);
    titleComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    applyDialogFont(titleComposite);

    Label l = new Label(titleComposite, SWT.CENTER);
    l.setToolTipText(hint);
    l.setText(title);

    Font exFont = l.getFont();

    FontData[] exfds = l.getFont().getFontData();
    if (exfds.length > 0) {
        FontData fd = exfds[0];
        fd.setHeight(fd.getHeight() + 4);
        Font f = new Font(exFont.getDevice(), fd);
        l.setFont(f);
    }

    Composite contentComposite = (Composite) super.createDialogArea(finalComposite);

    return contentComposite;
}

From source file:org.ebayopensource.turmeric.eclipse.services.ui.dialogs.ChangeServiceVersionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    Composite control = (Composite) super.createDialogArea(parent);
    setTitle(SOAMessages.CHANGE_SERVICE_VERSION_DIALOG_TITLE);
    setMessage(SOAMessages.CHANGE_SERVICE_VERSION_DIALOG_TITLE);
    Composite parentComposite = new Composite(control, 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);
    parentComposite.setLayout(layout);/*w w w  . j av a2 s.c  o m*/
    parentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    parentComposite.setFont(parentComposite.getFont());

    Group group = new Group(parentComposite, SWT.SHADOW_ETCHED_IN);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    group.setLayoutData(data);
    layout = new GridLayout(1, true);
    group.setLayout(layout);
    layout.marginLeft = 3;
    maintenanceBtn = new Button(group, SWT.RADIO);
    maintenanceBtn.setText(SOAMessages.CHANGE_MAINTENANCE_VERSION_LABEL);
    ControlDecoration controlDecoration = new ControlDecoration(maintenanceBtn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(SOAMessages.CHANGE_MAINTENANCE_VERSION_DECORATION);
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    controlDecoration.setImage(fieldDecoration.getImage());
    maintenanceBtn.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            maintenanceButtonSelected();
        }
    });

    minorBtn = new Button(group, SWT.RADIO);
    minorBtn.setText(SOAMessages.CHANGE_MINOR_VERSION_LABEL);
    controlDecoration = new ControlDecoration(minorBtn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(SOAMessages.CHANGE_MINOR_VERSION_DECORATION);
    controlDecoration.setImage(fieldDecoration.getImage());
    minorBtn.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            minorButtonSelected();
        }
    });

    majorBtn = new Button(group, SWT.RADIO);
    majorBtn.setText(SOAMessages.CHANGE_MAJOR_VERSION_LABEL);
    controlDecoration = new ControlDecoration(majorBtn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(SOAMessages.CHANGE_MAJOR_VERSION_DECORATION);
    controlDecoration.setImage(fieldDecoration.getImage());
    majorBtn.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            majorButtonSelected();
        }
    });

    Label label = new Label(parentComposite, SWT.LEFT);
    label.setText(SOAMessages.EXISTING_SERVICE_VERSION);
    oldVersionText = new Text(parentComposite, SWT.BORDER | SWT.READ_ONLY);
    oldVersionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    oldVersionText.setText(oldVersionStr);

    label = new Label(parentComposite, SWT.LEFT);
    label.setText(SOAMessages.NEW_SERVICE_VERSION);
    newVersionText = new Text(parentComposite, SWT.BORDER);
    newVersionText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    newVersionText.setText("1.2.0");
    newVersionText.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            validateNewVersionText();
        }

    });
    newVersionText.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            // only when newVersionText is editable, remember this string.
            // it means this is a manual input.
            if (newVersionText.getEditable() == true) {
                String newVersionStr = newVersionText.getText();
                newVersionText.setData(newVersionStr);
            }
        }
    });
    newVersionText.setData(oldVersionStr);
    Dialog.applyDialogFont(control);
    return control;
}

From source file:org.ebayopensource.turmeric.eclipse.services.ui.properties.SOAServiceDependenciesPage.java

License:Open Source License

private GridLayout initGridLayout(GridLayout layout, boolean margins) {
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    if (margins) {
        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    } else {//from ww w  .  j  a v  a 2s. c o m
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }

    return layout;
}

From source file:org.ebayopensource.turmeric.eclipse.utils.ui.SOAErrorDialog.java

License:Open Source License

/**
 * create the main part of the dialog.//from ww w . j  a v a 2s. c o  m
 *
 * @param parent the parent
 * @return the control
 */
@Override
protected Control createDialogArea(Composite parent) {
    createMessageArea(parent);
    // create content area
    Composite composite = new Composite(parent, SWT.NONE);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

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

    return composite;
}

From source file:org.ebayopensource.turmeric.frameworkjars.ui.ChangeServiceVersionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    Composite control = (Composite) super.createDialogArea(parent);
    setTitle("Change Service Version");
    setMessage("change the service version and submit to the Asset Repository.");
    Composite parentComposite = new Composite(control, 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);
    parentComposite.setLayout(layout);/*from   ww w.ja v  a 2 s . c om*/
    parentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    parentComposite.setFont(parentComposite.getFont());

    Group group = new Group(parentComposite, SWT.SHADOW_ETCHED_IN);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;
    group.setLayoutData(data);
    layout = new GridLayout(1, true);
    group.setLayout(layout);
    Button btn = new Button(group, SWT.RADIO);
    btn.setText("Change Maintenance Version");
    btn.setToolTipText(
            "Used for changes that do not affect the interface at all, such as logic bug fixes. \nThis will change your existing service in place to update \nits maintenance version. The same asset record in AR will be kept and modified to record the version change.");
    ControlDecoration controlDecoration = new ControlDecoration(btn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(
            "Used for changes that do not affect the interface at all, such as logic bug fixes. \nThis will change your existing service in place to update \nits maintenance version. The same asset record in AR will be kept and modified to record the version change.");
    FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
            .getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION);
    controlDecoration.setImage(fieldDecoration.getImage());
    //new Label(group, SWT.NONE | SWT.WRAP).setText("Used for backward incompatible changes to the interface. \nThis will take you to the new service wizard for creating a new service with major version bumped up.");
    //new Label(group, SWT.NONE);
    btn = new Button(group, SWT.RADIO);
    btn.setText("Change Minor Version");
    controlDecoration = new ControlDecoration(btn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(
            "Used for backward compatible changes to the interface. \nThis will change your existing service in place to update its minor version. \nA new asset record will be created in AR to track the new minor version.");
    controlDecoration.setImage(fieldDecoration.getImage());
    //new Label(group, SWT.NONE | SWT.WRAP).setText("Used for backward compatible changes to the interface. \nThis will change your existing service in place to update its minor version (for). A new asset record \nwill be created in AR to track the new minor version");
    //new Label(group, SWT.NONE);
    btn = new Button(group, SWT.RADIO);
    btn.setText("Change Major Version");
    //new Label(group, SWT.NONE).setText("Change service maintenance version");
    controlDecoration = new ControlDecoration(btn, SWT.LEFT | SWT.TOP);
    controlDecoration.setShowOnlyOnFocus(false);
    controlDecoration.setDescriptionText(
            "Used for backward incompatible service changes. Treated the same as \nsubmitting a new service version - creates new projects, jars, namespace, etc. \nConsult architecture to consider all the compatibility implications.");
    controlDecoration.setImage(fieldDecoration.getImage());

    Label label = new Label(parentComposite, SWT.LEFT);
    label.setText("Existing Service Version");
    Text text = new Text(parentComposite, SWT.BORDER | SWT.READ_ONLY);
    text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text.setText("1.1.0");

    label = new Label(parentComposite, SWT.LEFT);
    label.setText("New Service Version");
    text = new Text(parentComposite, SWT.BORDER);
    text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text.setText("1.2.0");
    Dialog.applyDialogFont(control);
    return control;
}

From source file:org.ebayopensource.turmeric.frameworkjars.ui.CopyLibraryDialog.java

License:Open Source License

/**
 * Adds the library chooser./*from ww w .  ja v a 2 s.co  m*/
 *
 * @param parentComposite the parent composite
 * @return the composite
 */
protected Composite addLibraryChooser(Composite parentComposite) {
    parentComposite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout(4, 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);
    parentComposite.setLayout(layout);
    parentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    parentComposite.setFont(parentComposite.getFont());

    new Label(parentComposite, SWT.LEFT).setText("&Maven Library:");
    libraryText = new Text(parentComposite, SWT.BORDER);
    libraryText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    libraryText.setEditable(false);

    Button browseBtn = new Button(parentComposite, SWT.PUSH);
    browseBtn.setAlignment(SWT.RIGHT);
    browseBtn.setText("&Search...");

    final SelectionListener workspaceBrowseListener = new SelectionListener() {
        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            final MavenRepositorySearchDialog dialog = new MavenRepositorySearchDialog(getShell(),
                    "Select Library to copy:", IIndex.SEARCH_ARTIFACT, null);
            if (dialog.open() == Window.OK) {
                final Object obj = dialog.getFirstResult();
                if (obj instanceof IndexedArtifactFile) {
                    final IndexedArtifactFile artifactFile = (IndexedArtifactFile) obj;
                    final ArtifactKey artifactKey = artifactFile.getArtifactKey();

                    metadata = new EclipseArtifactMetadata(artifactKey.getGroupId(),
                            artifactKey.getArtifactId(), artifactKey.getVersion(), "jar",
                            ArtifactScopeEnum.DEFAULT_SCOPE);
                    libraryText.setText(metadata.toString());
                }
            }
            dialogChanged();
        }
    };
    browseBtn.addSelectionListener(workspaceBrowseListener);

    return parentComposite;
}

From source file:org.ebayopensource.turmeric.frameworkjars.ui.CopyLibraryDialog.java

License:Open Source License

/**
 * Adds the destination chooser.//  ww  w  .j a va 2 s  .c  o  m
 *
 * @param parentComposite the parent composite
 * @return the composite
 */
protected Composite addDestinationChooser(Composite parentComposite) {
    parentComposite = new Composite(parentComposite, SWT.NONE);
    GridLayout layout = new GridLayout(4, 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);
    parentComposite.setLayout(layout);
    parentComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    parentComposite.setFont(parentComposite.getFont());

    new Label(parentComposite, SWT.LEFT).setText("&Destination:");
    destinationText = new Text(parentComposite, SWT.BORDER);
    destinationText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    //libraryText.addModifyListener(modifyListener);
    destinationText.setEditable(false);

    Button browseBtn = new Button(parentComposite, SWT.PUSH);
    browseBtn.setAlignment(SWT.RIGHT);
    browseBtn.setText("&Browse...");
    final String filterPath = null;
    final SelectionListener workspaceBrowseListener = new SelectionListener() {
        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {
            widgetSelected(e);
        }

        @Override
        public void widgetSelected(final SelectionEvent e) {
            final DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.PUSH);
            dialog.setText("Select Destination");
            if (StringUtils.isNotBlank(filterPath))
                dialog.setFilterPath(filterPath);
            final String dirName = dialog.open();
            if (StringUtils.isNotBlank(dirName)) {
                destinationText.setText(dirName);
            }
            dialogChanged();
        }
    };
    browseBtn.addSelectionListener(workspaceBrowseListener);

    return parentComposite;
}

From source file:org.eclipse.acceleo.internal.ide.ui.wizards.project.AcceleoProjectPage.java

License:Open Source License

/**
 * Initialize the grid layout./*from  www . j  a  va 2 s .co m*/
 * 
 * @param layout
 *            The grid layout.
 * @param margins
 *            Indicates if we should use margins.
 * @return The configured grid layout.
 */
private GridLayout initGridLayout(GridLayout layout, boolean margins) {
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    if (margins) {
        layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    } else {
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }
    return layout;
}

From source file:org.eclipse.ajdt.internal.ui.refactoring.RenameFileExtensionsDialog.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);//ww  w.  j  a  v  a  2  s.co m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    convertAspectsToAJButton = new Button(composite, SWT.RADIO);
    convertAspectsToAJButton.setText(UIMessages.Refactoring_ConvertAspectsToAJAndClassesToJava);
    convertAspectsToAJButton.setSelection(true);

    convertAllToAJButton = new Button(composite, SWT.RADIO);
    convertAllToAJButton.setText(UIMessages.Refactoring_ConvertAllToAJ);

    convertAllToJavaButton = new Button(composite, SWT.RADIO);
    convertAllToJavaButton.setText(UIMessages.Refactoring_ConvertAllToJava);

    new Label(composite, SWT.NONE);

    includeFilesNotInBuildButton = new Button(composite, SWT.CHECK);
    includeFilesNotInBuildButton.setText(UIMessages.Refactoring_IncludeFilesNotInBuild);
    includeFilesNotInBuildButton.setSelection(true);
    updateBuildConfigsButton = new Button(composite, SWT.CHECK);
    updateBuildConfigsButton.setText(UIMessages.Refactoring_UpdateBuildConfigs);
    updateBuildConfigsButton.setSelection(true);
    applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.ant.internal.ui.datatransfer.AntNewJavaProjectPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    initializeDialogUnits(parent);//from   w  w w .j  a v  a  2 s. c o  m
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = IDialogConstants.VERTICAL_MARGIN;
    layout.marginWidth = IDialogConstants.HORIZONTAL_MARGIN;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 3;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());

    createProjectNameGroup(composite);
    createProjectLocationGroup(composite);
    createTargetsTable(composite);

    fLinkButton = new Button(composite, SWT.CHECK);
    fLinkButton.setText(DataTransferMessages.AntNewJavaProjectPage_24);
    fLinkButton.setFont(parent.getFont());
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = false;
    gd.horizontalSpan = 2;
    fLinkButton.setLayoutData(gd);

    validatePage();
    // Show description on opening
    setErrorMessage(null);
    setMessage(null);
    setControl(composite);
}