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:org.eclipse.jst.j2ee.internal.plugin.ErrorDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite 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);
    composite.setLayout(layout);/*from ww  w.  j  a va  2s. com*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    ((GridLayout) composite.getLayout()).numColumns = 2;
    // create image
    Image image = composite.getDisplay().getSystemImage(SWT.ICON_ERROR);
    if (image != null) {
        Label label = new Label(composite, 0);
        image.setBackground(label.getBackground());
        label.setImage(image);
        label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_BEGINNING));
    }
    // create message
    if (msg != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(msg);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL
                | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    return composite;
}

From source file:org.eclipse.jst.j2ee.internal.ui.preferences.JavaEEPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;//from  w  w w  .ja  v  a2 s .  c om
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    result.setLayout(layout);
    Group buttonComposite = new Group(result, SWT.NONE);
    buttonComposite.setLayout(new GridLayout());
    buttonComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    buttonComposite
            .setText(J2EEUIMessages.getResourceString(J2EEUIMessages.JAVA_EE_PREFERENCE_PAGE_JET_TEMPLATE));

    showReferences = new Button(buttonComposite, SWT.CHECK);
    showReferences.setText(
            J2EEUIMessages.getResourceString(J2EEUIMessages.JAVA_EE_PREFERENCE_PAGE_DYN_TRANSLATION_BTN_NAME));
    showReferences.setSelection(dynamicTranslation);
    showReferences.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            dynamicTranslation = showReferences.getSelection();
        }
    });
    invokeExtensions(result);

    return result;
}

From source file:org.eclipse.jst.server.jetty.ui.internal.editor.WebModuleDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part 
 * of this dialog (above the button bar).
 * <p>//w  ww.j  a va 2 s . c  o  m
 * The <code>Dialog</code> implementation of this framework method
 * creates and returns a new <code>Composite</code> with
 * standard margins and spacing. Subclasses should override.
 * </p>
 *
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea(Composite parent) {
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
    whs.setHelp(composite, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG);
    // add project field if we are adding a project
    if (!isEdit && isProject) {
        Label l = new Label(composite, SWT.NONE);
        l.setText(Messages.configurationEditorWebModuleDialogProjects);
        GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
        l.setLayoutData(data);

        projTable = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
        data = new GridData();
        data.widthHint = 150;
        data.heightHint = 75;
        projTable.setLayoutData(data);
        whs.setHelp(projTable, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG_PROJECT);

        // fill table with web module projects
        ILabelProvider labelProvider = ServerUICore.getLabelProvider();
        IModule[] modules = ServerUtil.getModules(server2.getServerType().getRuntimeType().getModuleTypes());
        if (modules != null) {
            int size = modules.length;
            for (int i = 0; i < size; i++) {
                IModule module3 = modules[i];
                if ("jst.web".equals(module3.getModuleType().getId())) {
                    IStatus status = server2.canModifyModules(new IModule[] { module3 }, null, null);
                    if (status != null && status.isOK()) {
                        TableItem item = new TableItem(projTable, SWT.NONE);
                        item.setText(0, labelProvider.getText(module3));
                        item.setImage(0, labelProvider.getImage(module3));
                        item.setData(module3);
                    }
                }
            }
        }
        labelProvider.dispose();
        new Label(composite, SWT.NONE).setText(" ");
    }

    new Label(composite, SWT.NONE).setText(Messages.configurationEditorWebModuleDialogDocumentBase);
    docBase = new Text(composite, SWT.BORDER);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    docBase.setLayoutData(data);
    docBase.setText(module.getDocumentBase());
    whs.setHelp(docBase, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG_DOCBASE);

    // disable document base for project modules
    if (isProject || (module.getMemento() != null && module.getMemento().length() > 0))
        docBase.setEditable(false);
    else {
        docBase.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                module = new WebModule(module.getPath(), docBase.getText(), module.getMemento(),
                        module.isReloadable());
                validate();
            }
        });
    }

    if (isEdit || isProject)
        new Label(composite, SWT.NONE).setText(" ");
    else {
        Button browse = new Button(composite, SWT.NONE);
        browse.setText(Messages.browse);
        browse.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent se) {
                try {
                    DirectoryDialog dialog = new DirectoryDialog(getShell());
                    dialog.setMessage(Messages.configurationEditorWebModuleDialogSelectDirectory);
                    String selectedDirectory = dialog.open();
                    if (selectedDirectory != null)
                        docBase.setText(selectedDirectory);
                } catch (Exception e) {
                    Trace.trace(Trace.SEVERE, "Error browsing", e);
                }
            }
        });
    }

    // path (context-root)
    new Label(composite, SWT.NONE).setText(Messages.configurationEditorWebModuleDialogPath);
    final Text path = new Text(composite, SWT.BORDER);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = 150;
    path.setLayoutData(data);
    path.setText(module.getPath());
    /*if (module.getMemento() != null && module.getMemento().length() > 0)
       path.setEditable(false);
    else*/
    path.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            module = new WebModule(path.getText(), module.getDocumentBase(), module.getMemento(),
                    module.isReloadable());
        }
    });
    whs.setHelp(path, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG_PATH);

    new Label(composite, SWT.NONE).setText("");

    //      if (!isProject) {
    //         // auto reload
    //         new Label(composite, SWT.NONE).setText("");
    //         final Button reloadable = new Button(composite, SWT.CHECK);
    //         reloadable.setText(Messages.configurationEditorWebModuleDialogReloadEnabled);
    //         data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    //         reloadable.setLayoutData(data);
    //         reloadable.setSelection(module.isReloadable());
    //         reloadable.addSelectionListener(new SelectionAdapter() {
    //            public void widgetSelected(SelectionEvent e) {
    //               module = new WebModule(module.getPath(), module.getDocumentBase(), module.getMemento(), reloadable.getSelection());
    //            }
    //         });
    //         whs.setHelp(reloadable, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG_RELOAD);
    //      }

    if (!isEdit && isProject) {
        projTable.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                try {
                    IModule module3 = (IModule) projTable.getSelection()[0].getData();
                    IWebModule module2 = (IWebModule) module3.loadAdapter(IWebModule.class, null);
                    String contextRoot = module2.getContextRoot();
                    if (contextRoot != null && !contextRoot.startsWith("/") && contextRoot.length() > 0)
                        contextRoot = "/" + contextRoot;
                    module = new WebModule(contextRoot, module3.getName(), module3.getId(),
                            module.isReloadable());
                    docBase.setText(module3.getName());
                    path.setText(contextRoot);
                    module4 = module3;
                } catch (Exception e) {
                    // ignore
                }
                validate();
            }
        });
        new Label(composite, SWT.NONE).setText("");
    }

    Dialog.applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.jst.server.tomcat.ui.internal.editor.MimeMappingDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part 
 * of this dialog (above the button bar).
 * <p>//from  w w  w.  j  a va 2 s  .co m
 * The <code>Dialog</code> implementation of this framework method
 * creates and returns a new <code>Composite</code> with
 * standard margins and spacing. Subclasses should override.
 * </p>
 *
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea(Composite parent) {
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
    whs.setHelp(composite, ContextIds.CONFIGURATION_EDITOR_MAPPING_DIALOG);

    new Label(composite, SWT.NONE).setText(Messages.configurationEditorMimeMapppingDialogMimeType);
    final Text type = new Text(composite, SWT.BORDER);
    GridData data = new GridData();
    data.widthHint = 150;
    type.setLayoutData(data);
    type.setText(map.getMimeType());
    type.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            map = new MimeMapping(map.getExtension(), type.getText());
            validate();
        }
    });
    whs.setHelp(type, ContextIds.CONFIGURATION_EDITOR_MAPPING_DIALOG_TYPE);

    new Label(composite, SWT.NONE).setText(Messages.configurationEditorMimeMapppingDialogMimeExtension);
    final Text extension = new Text(composite, SWT.BORDER);
    data = new GridData();
    data.widthHint = 150;
    extension.setLayoutData(data);
    extension.setText(map.getExtension());
    extension.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            map = new MimeMapping(extension.getText(), map.getMimeType());
            validate();
        }
    });
    whs.setHelp(extension, ContextIds.CONFIGURATION_EDITOR_MAPPING_DIALOG_EXTENSION);

    Dialog.applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.jst.server.tomcat.ui.internal.editor.WebModuleDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part 
 * of this dialog (above the button bar).
 * <p>//from w w w  . j av a 2 s .  co m
 * The <code>Dialog</code> implementation of this framework method
 * creates and returns a new <code>Composite</code> with
 * standard margins and spacing. Subclasses should override.
 * </p>
 *
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control
 */
protected Control createDialogArea(Composite parent) {
    // create a composite with standard margins and spacing
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    IWorkbenchHelpSystem whs = PlatformUI.getWorkbench().getHelpSystem();
    whs.setHelp(composite, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG);
    // add project field if we are adding a project
    if (!isEdit && isProject) {
        Label l = new Label(composite, SWT.NONE);
        l.setText(Messages.configurationEditorWebModuleDialogProjects);
        GridData data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
        l.setLayoutData(data);

        projTable = new Table(composite, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
        data = new GridData();
        data.widthHint = 150;
        data.heightHint = 75;
        projTable.setLayoutData(data);
        whs.setHelp(projTable, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG_PROJECT);

        // fill table with web module projects
        ILabelProvider labelProvider = ServerUICore.getLabelProvider();
        IModule[] modules = ServerUtil.getModules(server2.getServerType().getRuntimeType().getModuleTypes());
        if (modules != null) {
            int size = modules.length;
            for (int i = 0; i < size; i++) {
                IModule module3 = modules[i];
                if ("jst.web".equals(module3.getModuleType().getId())) {
                    IStatus status = server2.canModifyModules(new IModule[] { module3 }, null, null);
                    if (status != null && status.isOK()) {
                        TableItem item = new TableItem(projTable, SWT.NONE);
                        item.setText(0, labelProvider.getText(module3));
                        item.setImage(0, labelProvider.getImage(module3));
                        item.setData(module3);
                    }
                }
            }
        }
        labelProvider.dispose();
        new Label(composite, SWT.NONE).setText(" ");
    }

    new Label(composite, SWT.NONE).setText(Messages.configurationEditorWebModuleDialogDocumentBase);
    docBase = new Text(composite, SWT.BORDER);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    docBase.setLayoutData(data);
    docBase.setText(module.getDocumentBase());
    whs.setHelp(docBase, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG_DOCBASE);

    // disable document base for project modules
    if (isProject || (module.getMemento() != null && module.getMemento().length() > 0))
        docBase.setEditable(false);
    else {
        docBase.addModifyListener(new ModifyListener() {
            public void modifyText(ModifyEvent e) {
                module = new WebModule(module.getPath(), docBase.getText(), module.getMemento(),
                        module.isReloadable());
                validate();
            }
        });
    }

    if (isEdit || isProject)
        new Label(composite, SWT.NONE).setText(" ");
    else {
        Button browse = new Button(composite, SWT.NONE);
        browse.setText(Messages.browse);
        browse.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent se) {
                try {
                    DirectoryDialog dialog = new DirectoryDialog(getShell());
                    dialog.setMessage(Messages.configurationEditorWebModuleDialogSelectDirectory);
                    String selectedDirectory = dialog.open();
                    if (selectedDirectory != null)
                        docBase.setText(selectedDirectory);
                } catch (Exception e) {
                    Trace.trace(Trace.SEVERE, "Error browsing", e);
                }
            }
        });
    }

    // path (context-root)
    new Label(composite, SWT.NONE).setText(Messages.configurationEditorWebModuleDialogPath);
    final Text path = new Text(composite, SWT.BORDER);
    data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    data.widthHint = 150;
    path.setLayoutData(data);
    path.setText(module.getPath());
    /*if (module.getMemento() != null && module.getMemento().length() > 0)
       path.setEditable(false);
    else*/
    path.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            module = new WebModule(path.getText(), module.getDocumentBase(), module.getMemento(),
                    module.isReloadable());
        }
    });
    whs.setHelp(path, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG_PATH);

    new Label(composite, SWT.NONE).setText("");

    if (!isProject) {
        // auto reload
        new Label(composite, SWT.NONE).setText("");
        final Button reloadable = new Button(composite, SWT.CHECK);
        reloadable.setText(Messages.configurationEditorWebModuleDialogReloadEnabled);
        data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
        reloadable.setLayoutData(data);
        reloadable.setSelection(module.isReloadable());
        reloadable.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                module = new WebModule(module.getPath(), module.getDocumentBase(), module.getMemento(),
                        reloadable.getSelection());
            }
        });
        whs.setHelp(reloadable, ContextIds.CONFIGURATION_EDITOR_WEBMODULE_DIALOG_RELOAD);
    }

    if (!isEdit && isProject) {
        projTable.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                try {
                    IModule module3 = (IModule) projTable.getSelection()[0].getData();
                    IWebModule module2 = (IWebModule) module3.loadAdapter(IWebModule.class, null);
                    String contextRoot = module2.getContextRoot();
                    if (contextRoot != null && !contextRoot.startsWith("/") && contextRoot.length() > 0)
                        contextRoot = "/" + contextRoot;
                    module = new WebModule(contextRoot, module3.getName(), module3.getId(),
                            module.isReloadable());
                    docBase.setText(module3.getName());
                    path.setText(contextRoot);
                    module4 = module3;
                } catch (Exception e) {
                    // ignore
                }
                validate();
            }
        });
        new Label(composite, SWT.NONE).setText("");
    }

    Dialog.applyDialogFont(composite);
    return composite;
}

From source file:org.eclipse.jst.server.tomcat.ui.internal.TerminationDialog.java

License:Open Source License

/**
 * Creates and returns the contents of the upper part 
 * of this dialog (above the button bar).
 *
 * @param parent the parent composite to contain the dialog area
 * @return the dialog area control//  www .j av a  2 s.  c om
 */
protected Control createDialogArea(Composite 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);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());
    PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ContextIds.SERVER_CLEAN_WORK_DIR_TERMINATE);

    Label label = new Label(composite, SWT.WRAP);
    label.setText(message);
    GridData data = new GridData();
    data.widthHint = 400;
    label.setLayoutData(data);

    Dialog.applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.jst.servlet.ui.internal.wizard.AddEditFilterMappingDialog.java

License:Open Source License

/**
 * Creates and returns the contents of this dialog's 
 * button bar.//w ww. j  a  va  2s  .  com
 * <p>
 * The <code>Dialog</code> implementation of this framework method
 * lays out a button bar and calls the <code>createButtonsForButtonBar</code>
 * framework method to populate it. Subclasses may override.
 * </p>
 *
 * @param parent the parent composite to contain the button bar
 * @return the button bar control
 */
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();

    layout.numColumns = 2;

    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite composite2 = new Composite(composite, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = convertHorizontalDLUsToPixels(
            org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(
            org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(
            org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(
            org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_SPACING);

    composite2.setLayout(layout);

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite2.setLayoutData(data);

    composite2.setFont(parent.getFont());

    // Add the buttons to the button bar.
    super.createButtonsForButtonBar(composite2);

    return composite;
}

From source file:org.eclipse.jst.servlet.ui.internal.wizard.AddEditFilterMappingDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    GridData gd = new GridData();

    fChild = new Composite(parent, SWT.NONE);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$
    GridLayout gl = new GridLayout();
    gl.numColumns = 2;//from  w  w w. j  av  a  2  s. c om
    gl.marginHeight = 0;
    fChild.setLayout(gl);

    gd.verticalAlignment = GridData.FILL;
    gd.grabExcessVerticalSpace = true;
    fChild.setLayoutData(gd);

    // Create the Web Type radio buttons and text fields.
    fServletButton = new Button(fChild, SWT.RADIO);
    fServletButton.setText(WebAppEditResourceHandler.getString("Servlet_UI_")); //$NON-NLS-1$ = Servlet
    gd = new GridData();
    fServletButton.setLayoutData(gd);
    fServletButton.addSelectionListener(this);

    fURLPatternButton = new Button(fChild, SWT.RADIO);
    fURLPatternButton.setText(WebAppEditResourceHandler.getString("URL_pattern_UI_")); //$NON-NLS-1$
    gd = new GridData();
    fURLPatternButton.setLayoutData(gd);
    fURLPatternButton.addSelectionListener(this);

    //Create URL Pattern page 
    fPageBook = new PageBook(fChild, SWT.NONE);
    gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.verticalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalSpan = 2;
    fPageBook.setLayoutData(gd);

    Composite composite = new Composite(fPageBook, 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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());

    Label messageLabel = new Label(composite, SWT.NONE);
    gd = new GridData();
    messageLabel.setLayoutData(gd);
    messageLabel.setText(URL_PATTERN_LABEL);

    fURLText = new Text(composite, SWT.BORDER);
    GridData spec = new GridData();
    spec.grabExcessVerticalSpace = false;
    spec.grabExcessHorizontalSpace = true;
    spec.horizontalAlignment = GridData.FILL;
    spec.verticalAlignment = GridData.BEGINNING;
    fURLText.setLayoutData(spec);
    Listener l = new Listener() {
        public void handleEvent(Event evt) {
            updateOkState();
        }
    };
    fURLText.addListener(SWT.Modify, l);
    fURLPatternControl = composite;

    //Create Servlet page
    composite = new Composite(fPageBook, SWT.NONE);
    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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());

    messageLabel = new Label(composite, SWT.NONE);
    gd = new GridData();
    messageLabel.setLayoutData(gd);
    messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_servlet__1")); //$NON-NLS-1$

    fUpperList = createUpperList(composite);

    fServletControl = composite;

    //Create Dispatchers control
    Group dispatchers = new Group(fChild, SWT.SHADOW_IN);
    dispatchers.setText(WebAppEditResourceHandler.getString("Select_Dispatchers_UI_")); //$NON-NLS-1$
    dispatchers.setLayout(new CellLayout(2).setMargins(10, 10).setSpacing(5, 5));
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    gridData.horizontalSpan = 2;
    dispatchers.setLayoutData(gridData);
    fRequest = new Button(dispatchers, SWT.CHECK);
    fRequest.setText(REQUEST);
    fForward = new Button(dispatchers, SWT.CHECK);
    fForward.setText(FORWARD);
    fInclude = new Button(dispatchers, SWT.CHECK);
    fInclude.setText(INCLUDE);
    fErorr = new Button(dispatchers, SWT.CHECK);
    fErorr.setText(ERROR);

    if (selectedItem != null) {
        if (selectedItem.isUrlPatternType()) {
            fSelection = URL_PATTERN;
        } else {
            fSelection = SERVLET;
        }
    } else {
        if (fServletNames == null || fServletNames.length == 0) {
            fSelection = URL_PATTERN;
        }
    }
    updateUpperListWidget();

    fServletButton.setEnabled(true);
    if (fSelection == URL_PATTERN) {
        fURLPatternButton.setSelection(true);
        fPageBook.showPage(fURLPatternControl);
        fServletButton.setSelection(false);
        if (fServletNames == null || fServletNames.length == 0) {
            fServletButton.setEnabled(false);
        }
        if (selectedItem != null) {
            fURLText.setText(selectedItem.getName());
            setDispatchers(selectedItem.getDispatchers());
        }
    } else {
        fServletButton.setSelection(true);
        fPageBook.showPage(fServletControl);
        if (selectedItem != null) {
            fUpperList.setSelection(getServletIndex(fUpperList, selectedItem.getName()));
            setDispatchers(selectedItem.getDispatchers());
        }
    }
    updateOkState();
    return parent;
}

From source file:org.eclipse.jst.servlet.ui.internal.wizard.MultiSelectFilteredFileSelectionDialog.java

License:Open Source License

/**
 * Creates and returns the contents of this dialog's 
 * button bar./*from  ww  w .  j a v  a  2s .co  m*/
 * <p>
 * The <code>Dialog</code> implementation of this framework method
 * lays out a button bar and calls the <code>createButtonsForButtonBar</code>
 * framework method to populate it. Subclasses may override.
 * </p>
 *
 * @param parent the parent composite to contain the button bar
 * @return the button bar control
 */
@Override
protected Control createButtonBar(Composite parent) {

    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();

    layout.numColumns = 2;

    layout.marginHeight = 0;
    layout.marginWidth = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite composite2 = new Composite(composite, SWT.NONE);

    // create a layout with spacing and margins appropriate for the font size.
    layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = convertHorizontalDLUsToPixels(
            org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(
            org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(
            org.eclipse.jface.dialogs.IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(
            org.eclipse.jface.dialogs.IDialogConstants.VERTICAL_SPACING);

    composite2.setLayout(layout);

    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite2.setLayoutData(data);

    composite2.setFont(parent.getFont());

    // Add the buttons to the button bar.
    super.createButtonsForButtonBar(composite2);

    return composite;
}

From source file:org.eclipse.jst.servlet.ui.internal.wizard.MultiSelectFilteredFileSelectionDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    GridData gd = new GridData();

    fChild = new Composite(parent, SWT.NONE);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(fChild, "com.ibm.etools.webapplicationedit.webx2010"); //$NON-NLS-1$
    GridLayout gl = new GridLayout();
    gl.numColumns = 2;/*from w w  w . j  a  v  a  2s .  c o m*/
    gl.marginHeight = 0;
    fChild.setLayout(gl);

    gd.verticalAlignment = GridData.FILL;
    gd.grabExcessVerticalSpace = true;
    fChild.setLayoutData(gd);

    // Create the Web Type radio buttons and text fields.
    fServletButton = new Button(fChild, SWT.RADIO);
    fServletButton.setText(WebAppEditResourceHandler.getString("Servlet_UI_")); //$NON-NLS-1$ = Servlet
    gd = new GridData();
    fServletButton.setLayoutData(gd);
    fServletButton.addSelectionListener(this);

    fJSPButton = new Button(fChild, SWT.RADIO);
    fJSPButton.setText(WebAppEditResourceHandler.getString("JSP_UI_")); //$NON-NLS-1$ = JSP
    gd = new GridData();
    fJSPButton.setLayoutData(gd);
    fJSPButton.addSelectionListener(this);

    if (fSelection == JSP)
        fJSPButton.setSelection(true);
    else {
        fServletButton.setSelection(true);
        fSelection = SERVLET;
    }

    fPageBook = new PageBook(fChild, SWT.NONE);
    gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.verticalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = true;
    gd.horizontalSpan = 2;
    fPageBook.setLayoutData(gd);
    fJspControl = super.createDialogArea(fPageBook);

    Composite composite = new Composite(fPageBook, 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);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    composite.setFont(parent.getFont());

    Label messageLabel = new Label(composite, SWT.NONE);
    gd = new GridData();
    messageLabel.setLayoutData(gd);
    messageLabel.setText(WebAppEditResourceHandler.getString("Choose_a_servlet__1")); //$NON-NLS-1$

    fText = createText(composite);

    messageLabel = new Label(composite, SWT.NONE);
    gd = new GridData();
    messageLabel.setLayoutData(gd);
    messageLabel.setText(WebAppEditResourceHandler.getString("Matching_servlets__2")); //$NON-NLS-1$

    fUpperList = createUpperList(composite);

    messageLabel = new Label(composite, SWT.NONE);
    gd = new GridData();
    messageLabel.setLayoutData(gd);
    messageLabel.setText(WebAppEditResourceHandler.getString("Qualifier__3")); //$NON-NLS-1$

    fLowerList = createLowerList(composite);

    fServletControl = composite;

    if (fSelection == JSP)
        fPageBook.showPage(fJspControl);
    else
        fPageBook.showPage(fServletControl);
    return parent;
}