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

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

Introduction

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

Prototype

int ENTRY_FIELD_WIDTH

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

Click Source Link

Document

Entry field width in dialog units (value 200).

Usage

From source file:org.ganoro.phing.ui.internal.preferences.AddCustomDialog.java

License:Open Source License

/**
 *   Create the group for creating the root directory
 *//*from   ww w . j  a v a2s. c  om*/
private void createRootDirectoryGroup(Composite parent) {
    Label groupLabel = new Label(parent, SWT.NONE);
    groupLabel.setText(AntPreferencesMessages.AddCustomDialog__Location);
    groupLabel.setFont(parent.getFont());

    // source name entry field
    sourceNameField = new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    sourceNameField.setLayoutData(data);
    sourceNameField.setFont(parent.getFont());

    sourceNameField.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            updateFromSourceField();
        }
    });

    Iterator libraries = libraryEntries.iterator();
    while (libraries.hasNext()) {
        ClasspathEntry entry = (ClasspathEntry) libraries.next();
        sourceNameField.add(entry.getLabel());
    }

    sourceNameField.addKeyListener(new KeyAdapter() {
        /*
         * @see KeyListener.keyPressed
         */
        public void keyPressed(KeyEvent e) {
            //If there has been a key pressed then mark as dirty
            entryChanged = true;
        }
    });

    sourceNameField.addFocusListener(new FocusAdapter() {
        /*
         * @see FocusListener.focusLost(FocusEvent)
         */
        public void focusLost(FocusEvent e) {
            //Clear the flag to prevent constant update
            if (entryChanged) {
                entryChanged = false;
                updateFromSourceField();
            }
        }
    });
}

From source file:org.isandlatech.plugins.rest.launch.MakefileTabMain.java

License:Open Source License

/**
 * Creates the controls needed to edit the location attribute of an external
 * tool.//from w  ww.j a v a 2s . c o m
 * 
 * Code from external tools plugin internals.
 * 
 * @param parent
 *            the composite to create the controls in
 */
protected void createLocationComponent(final Composite parent) {

    // "Location" group
    Group group = new Group(parent, SWT.NONE);
    String locationLabel = Messages.getString("runner.main.dir.title");
    group.setText(locationLabel);

    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    // Working directory text field
    pWorkingDirectory = new Text(group, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    pWorkingDirectory.setLayoutData(gridData);
    pWorkingDirectory.addModifyListener(pModificationListener);

    // 3-buttons group
    Composite buttonComposite = new Composite(group, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 3;
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    buttonComposite.setLayout(layout);
    buttonComposite.setLayoutData(gridData);
    buttonComposite.setFont(parent.getFont());

    // Workspace folder selection
    pWorkspaceLocationButton = createPushButton(buttonComposite,
            Messages.getString("runner.main.dir.workspace"), null);
    pWorkspaceLocationButton.addSelectionListener(pModificationListener);

    // File system folder selection
    pFileSystemLocationButton = createPushButton(buttonComposite,
            Messages.getString("runner.main.dir.filesystem"), null);
    pFileSystemLocationButton.addSelectionListener(pModificationListener);

    // Variables injection
    pVariablesLocationButton = createPushButton(buttonComposite,
            Messages.getString("runner.main.dir.variables"), null);
    pVariablesLocationButton.addSelectionListener(pModificationListener);
}

From source file:org.jamon.eclipse.projectprefspage.JamonProjectPropertyPage.java

License:Mozilla Public License

private void setDecoratedTextInputLayout(ControlDecoration decoration) {
    GridData gd = new GridData(IDialogConstants.ENTRY_FIELD_WIDTH
            + FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(), SWT.DEFAULT);
    gd.horizontalIndent = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
    decoration.getControl().setLayoutData(gd);
}

From source file:org.kelvinst.psfimport.ui.importWizards.PsfImportWizardWorkingSetsSelectionPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);

    // GridLayout
    GridLayout layout1 = new GridLayout();
    layout1.numColumns = 1;//from w  w w .  j  ava2  s .  com
    composite.setLayout(layout1);

    // GridData
    GridData data1 = new GridData();
    data1.verticalAlignment = GridData.FILL;
    data1.horizontalAlignment = GridData.FILL;
    composite.setLayoutData(data1);
    initializeDialogUnits(composite);

    GridData comboData1 = new GridData(GridData.FILL_HORIZONTAL);
    comboData1.verticalAlignment = GridData.CENTER;
    comboData1.grabExcessVerticalSpace = false;
    comboData1.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);

    Group workingSetGroup = new Group(composite, SWT.NONE);
    workingSetGroup.setFont(composite.getFont());
    workingSetGroup.setText("Working sets");
    workingSetGroup.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    workingSetGroup.setLayout(new GridLayout(1, false));

    workingSetTypeIds = new String[] { "org.eclipse.ui.resourceWorkingSetPage", //$NON-NLS-1$
            "org.eclipse.jdt.ui.JavaWorkingSetPage" }; //$NON-NLS-1$
    Arrays.sort(workingSetTypeIds); // we'll be performing some searches
    // with these later - presort them
    selectedWorkingSets = EMPTY_WORKING_SET_ARRAY;
    workingSetSelectionHistory = loadSelectionHistory(workingSetTypeIds);
    setSelectedWorkingSets(findApplicableWorkingSets(null));

    createContent(workingSetGroup);

    setControl(composite);
    Dialog.applyDialogFont(parent);
}

From source file:org.python.pydev.ui.dialogs.AbstractKeyValueDialog.java

License:Open Source License

/**
 * Creates the three widgets that represent the password entry area. 
 * @param parent  the parent of the widgets, which has two columns
 *///w w  w .j av  a2  s . co  m
protected void createFields(Composite parent) {
    changesValidator = createChangesValidator();

    new Label(parent, SWT.NONE).setText(getKeyLabelText());

    keyField = new Text(parent, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 3;
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
    keyField.setLayoutData(data);
    keyField.addListener(SWT.SELECTED, changesValidator);
    keyField.addListener(SWT.KeyDown, changesValidator);
    keyField.addListener(SWT.KeyUp, changesValidator);

    new Label(parent, SWT.NONE).setText(getValueLabelText());

    valueField = new Text(parent, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
    valueField.setLayoutData(data);
    valueField.addListener(SWT.SELECTED, changesValidator);
    valueField.addListener(SWT.KeyDown, changesValidator);
    valueField.addListener(SWT.KeyUp, changesValidator);

    browserButton = createButton(parent, BROWSER_ID, BROWSER_LABEL, true);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 1;
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    browserButton.setLayoutData(data);
    browserButton.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent evt) {
            String file = handleBrowseButton();
            if (file != null) {
                file = file.trim();
                setValueField(file);
            }
            changesValidator.handleEvent(null); //Make it update the error message
        }

    });
}

From source file:org.radrails.rails.internal.ui.dialogs.RailsServerDialog.java

License:Open Source License

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

    setTitle(Messages.RailsServerDialog_Title);
    getShell().setText(Messages.RailsServerDialog_Message);

    Composite composite = new Composite(dialogArea, SWT.NONE);
    composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    PixelConverter converter = new PixelConverter(composite);
    composite.setLayout(GridLayoutFactory.swtDefaults()
            .margins(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN))
            .spacing(converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING),
                    converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING))
            .numColumns(3).create());//from   w w  w  .jav  a  2 s . c  om

    /* name of the server */
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.RailsServerDialog_NameLabel));

    nameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    nameText.setLayoutData(GridDataFactory.fillDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1)
            .grab(true, false).create());

    /* Project we're running server for */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.RailsServerDialog_ProjectLabel));

    projectCombo = new Combo(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
    projectCombo.setLayoutData(GridDataFactory.fillDefaults()
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT).span(2, 1)
            .grab(true, false).create());
    // Populate combo with all the rails projects
    for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects()) {
        try {
            if (project.isOpen() && project.hasNature(RailsProjectNature.ID)) {
                projectCombo.add(project.getName());
            }
        } catch (CoreException e) {
            IdeLog.logError(RailsUIPlugin.getDefault(), e);
        }
    }
    if (projectCombo.getItemCount() > 0) {
        projectCombo.setText(projectCombo.getItems()[0]);
    }
    /* host/ip to bind to: 0.0.0.0, 127.0.0.1? */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.RailsServerDialog_BindingLabel));

    hostNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    hostNameText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(hostNameText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .span(2, 1).align(SWT.FILL, SWT.CENTER).grab(true, false).create());
    hostNameText.setText(RailsServer.DEFAULT_BINDING);

    /* Port: default is 3000 */
    label = new Label(composite, SWT.NONE);
    label.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(label).convertHorizontalDLUsToPixels(LABEL_WIDTH), SWT.DEFAULT).create());
    label.setText(StringUtil.makeFormLabel(Messages.RailsServerDialog_PortLabel));

    portText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    portText.setLayoutData(GridDataFactory.swtDefaults()
            .hint(new PixelConverter(portText)
                    .convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH), SWT.DEFAULT)
            .grab(true, false).create());
    portText.setText(Integer.toString(RailsServer.DEFAULT_PORT));

    // Set up values to reflect server we're editing.
    if (source != null) {
        String name = source.getName();
        nameText.setText((name != null) ? name : StringUtil.EMPTY);
        String host = source.getHostname();
        hostNameText.setText((host != null) ? host : RailsServer.DEFAULT_BINDING);
        portText.setText(Integer.toString(source.getPort()));
        IProject project = source.getProject();
        if (project != null) {
            projectCombo.setText(project.getName());
        }
    }

    addListeners();

    return dialogArea;
}

From source file:org.rssowl.ui.internal.dialogs.bookmark.FeedDefinitionPage.java

License:Open Source License

public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(new GridLayout(1, false));

    /* 1) Feed by Link */
    if (!StringUtils.isSet(fInitialLink))
        fInitialLink = loadInitialLinkFromClipboard();

    boolean loadTitleFromFeed = fGlobalScope.getBoolean(DefaultPreferences.BM_LOAD_TITLE_FROM_FEED);

    fFeedByLinkButton = new Button(container, SWT.RADIO);
    fFeedByLinkButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fFeedByLinkButton.setText(loadTitleFromFeed ? Messages.FeedDefinitionPage_CREATE_FEED
            : Messages.FeedDefinitionPage_CREATE_FEED_DIRECT);
    fFeedByLinkButton.setSelection(true);
    fFeedByLinkButton.addSelectionListener(new SelectionAdapter() {
        @Override/* ww w .ja  v a 2 s.c  o  m*/
        public void widgetSelected(SelectionEvent e) {
            fFeedLinkInput.setEnabled(fFeedByLinkButton.getSelection());
            fLoadTitleFromFeedButton.setEnabled(fFeedByLinkButton.getSelection());
            fFeedLinkInput.setFocus();
            getContainer().updateButtons();
        }
    });

    Composite textIndent = new Composite(container, SWT.NONE);
    textIndent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    textIndent.setLayout(new GridLayout(1, false));
    ((GridLayout) textIndent.getLayout()).marginLeft = 10;
    ((GridLayout) textIndent.getLayout()).marginBottom = 10;

    fFeedLinkInput = new Text(textIndent, SWT.BORDER);
    fFeedLinkInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    OwlUI.makeAccessible(fFeedLinkInput, fFeedByLinkButton);

    GC gc = new GC(fFeedLinkInput);
    gc.setFont(JFaceResources.getDialogFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    int entryFieldWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.ENTRY_FIELD_WIDTH);
    gc.dispose();

    ((GridData) fFeedLinkInput.getLayoutData()).widthHint = entryFieldWidth; //Required to avoid large spanning dialog for long Links
    fFeedLinkInput.setFocus();

    if (StringUtils.isSet(fInitialLink) && !fInitialLink.equals(URIUtils.HTTP)) {
        fFeedLinkInput.setText(fInitialLink);
        fFeedLinkInput.selectAll();
        onLinkChange();
    } else {
        fFeedLinkInput.setText(URIUtils.HTTP);
        fFeedLinkInput.setSelection(URIUtils.HTTP.length());
    }

    fFeedLinkInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            getContainer().updateButtons();
            onLinkChange();
        }
    });

    fLoadTitleFromFeedButton = new Button(textIndent, SWT.CHECK);
    fLoadTitleFromFeedButton.setText(Messages.FeedDefinitionPage_USE_TITLE_OF_FEED);
    fLoadTitleFromFeedButton.setSelection(loadTitleFromFeed);
    fLoadTitleFromFeedButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            getContainer().updateButtons();
        }
    });

    /* 2) Feed by Keyword */
    fFeedByKeywordButton = new Button(container, SWT.RADIO);
    fFeedByKeywordButton.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fFeedByKeywordButton.setText(Messages.FeedDefinitionPage_CREATE_KEYWORD_FEED);
    fFeedByKeywordButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fKeywordInput.setEnabled(fFeedByKeywordButton.getSelection());

            if (fKeywordInput.isEnabled())
                hookKeywordAutocomplete();

            fKeywordInput.setFocus();
            getContainer().updateButtons();
        }
    });

    textIndent = new Composite(container, SWT.NONE);
    textIndent.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    textIndent.setLayout(new GridLayout(1, false));
    ((GridLayout) textIndent.getLayout()).marginLeft = 10;

    fKeywordInput = new Text(textIndent, SWT.BORDER);
    OwlUI.makeAccessible(fKeywordInput, fFeedByKeywordButton);
    fKeywordInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fKeywordInput.setEnabled(false);
    fKeywordInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            getContainer().updateButtons();
        }
    });

    /* Info Container */
    Composite infoContainer = new Composite(container, SWT.None);
    infoContainer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    infoContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 5));

    Label infoImg = new Label(infoContainer, SWT.NONE);
    infoImg.setImage(OwlUI.getImage(infoImg, "icons/obj16/info.gif")); //$NON-NLS-1$
    infoImg.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));

    Link infoLink = new Link(infoContainer, SWT.NONE);
    infoLink.setText(Messages.FeedDefinitionPage_IMPORT_WIZARD_TIP);
    infoLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    infoLink.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            new ImportAction().openWizardForKeywordSearch(getShell());
        }
    });

    Dialog.applyDialogFont(container);

    setControl(container);
}

From source file:org.rssowl.ui.internal.dialogs.NewsFilterDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    /* Separator */
    new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL)
            .setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    /* Title */// w ww . java  2s  . c  o m
    setTitle(Messages.NewsFilterDialog_NEWS_FILTER);

    /* Title Image */
    setTitleImage(OwlUI.getImage(fResources, "icons/wizban/filter_wiz.png")); //$NON-NLS-1$

    /* Title Message */
    setMessage(Messages.NewsFilterDialog_DEFINE_SEARCH);

    /* Name Input Filed */
    Composite container = new Composite(parent, SWT.None);
    container.setLayout(LayoutUtils.createGridLayout(2, 10, 5, 0, 5, false));
    container.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));

    Label nameLabel = new Label(container, SWT.NONE);
    nameLabel.setText(Messages.NewsFilterDialog_NAME);

    Composite nameContainer = new Composite(container, SWT.BORDER);
    nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
    nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    fNameInput = new Text(nameContainer, SWT.SINGLE);
    OwlUI.makeAccessible(fNameInput, nameLabel);
    fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
    if (fEditedFilter != null) {
        fNameInput.setText(fEditedFilter.getName());
        fNameInput.selectAll();
    }

    fNameInput.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            setErrorMessage(null);
        }
    });

    GC gc = new GC(fNameInput);
    gc.setFont(JFaceResources.getDialogFont());
    FontMetrics fontMetrics = gc.getFontMetrics();
    int entryFieldWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.ENTRY_FIELD_WIDTH);
    gc.dispose();

    ((GridData) fNameInput.getLayoutData()).widthHint = entryFieldWidth; //Required to avoid large spanning dialog for long Links

    ToolBar generateTitleBar = new ToolBar(nameContainer, SWT.FLAT);
    OwlUI.makeAccessible(generateTitleBar, Messages.NewsFilterDialog_CREATE_NAME_FROM_CONDITIONS);
    generateTitleBar.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

    ToolItem generateTitleItem = new ToolItem(generateTitleBar, SWT.PUSH);
    generateTitleItem.setImage(OwlUI.getImage(fResources, "icons/etool16/info.gif")); //$NON-NLS-1$
    generateTitleItem.setToolTipText(Messages.NewsFilterDialog_CREATE_NAME_FROM_CONDITIONS);
    generateTitleItem.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            onGenerateName();
        }
    });

    /* Sashform dividing search definition from actions */
    SashForm sashForm = new SashForm(parent, SWT.VERTICAL | SWT.SMOOTH);
    sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    /* Top Sash */
    Composite topSash = new Composite(sashForm, SWT.NONE);
    topSash.setLayout(LayoutUtils.createGridLayout(2, 0, 0, 0, 0, false));
    createConditionControls(topSash);

    /* Bottom Sash */
    Composite bottomSash = new Composite(sashForm, SWT.NONE);
    bottomSash.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 0, 0, false));

    /* Label in between */
    Composite labelContainer = new Composite(bottomSash, SWT.NONE);
    labelContainer.setLayout(LayoutUtils.createGridLayout(1, 10, 3, 0, 0, false));
    ((GridLayout) labelContainer.getLayout()).marginBottom = 2;
    labelContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    Label explanationLabel = new Label(labelContainer, SWT.NONE);
    explanationLabel.setText(Messages.NewsFilterDialog_PERFORM_ACTIONS);

    /* Action Controls */
    createActionControls(bottomSash);

    /* Separator */
    new Label(bottomSash, SWT.SEPARATOR | SWT.HORIZONTAL)
            .setLayoutData(new GridData(SWT.FILL, SWT.END, true, false));

    /* Set weights to even */
    sashForm.setWeights(new int[] { 50, 50 });

    applyDialogFont(parent);

    return parent;
}

From source file:org.rssowl.ui.internal.dialogs.properties.GeneralPropertyPage.java

License:Open Source License

public Control createContents(Composite parent) {
    fParent = parent;/*from w  w w . j  a v a  2s  .  c  om*/

    boolean separateFromTop = false;
    Composite container = new Composite(parent, SWT.NONE);
    container.setLayout(LayoutUtils.createGridLayout(2, 10, 10));

    /* Fields for single Selection */
    if (fEntities.size() == 1) {
        IEntity entity = fEntities.get(0);
        separateFromTop = true;

        /* Link */
        if (entity instanceof IBookMark) {
            Label feedLabel = new Label(container, SWT.None);
            feedLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            feedLabel.setText(Messages.GeneralPropertyPage_LINK);

            fFeedInput = fIsSingleSynchronizedBookMark ? new Text(container, SWT.READ_ONLY | SWT.BORDER)
                    : new Text(container, SWT.BORDER);
            fFeedInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
            String feedLink = ((IBookMark) entity).getFeedLinkReference().getLinkAsText();
            fFeedInput.setText(fIsSingleSynchronizedBookMark ? URIUtils.toHTTP(feedLink) : feedLink);
            ((GridData) fFeedInput.getLayoutData()).widthHint = fSite
                    .getHorizontalPixels(IDialogConstants.ENTRY_FIELD_WIDTH);

            /* Name */
            Label nameLabel = new Label(container, SWT.None);
            nameLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            nameLabel.setText(Messages.GeneralPropertyPage_NAME);

            Composite nameContainer = new Composite(container, Application.IS_MAC ? SWT.NONE : SWT.BORDER);
            nameContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
            nameContainer.setLayout(LayoutUtils.createGridLayout(2, 0, 0));
            if (!Application.IS_MAC)
                nameContainer.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

            fNameInput = new Text(nameContainer, Application.IS_MAC ? SWT.BORDER : SWT.NONE);
            OwlUI.makeAccessible(fNameInput, nameLabel);
            fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
            fNameInput.setText(getName(entity));

            ToolBar grabTitleBar = new ToolBar(nameContainer, SWT.FLAT);
            OwlUI.makeAccessible(grabTitleBar, Messages.GeneralPropertyPage_LOAD_NAME);
            if (!Application.IS_MAC)
                grabTitleBar.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));

            ToolItem grabTitleItem = new ToolItem(grabTitleBar, SWT.PUSH);
            grabTitleItem.setImage(OwlUI.getImage(fSite.getResourceManager(), "icons/etool16/info.gif")); //$NON-NLS-1$
            grabTitleItem.setToolTipText(Messages.GeneralPropertyPage_LOAD_NAME);
            grabTitleItem.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    onGrabTitle();
                }
            });
        }

        /* Other */
        else {

            /* Name */
            Label nameLabel = new Label(container, SWT.None);
            nameLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
            nameLabel.setText(Messages.GeneralPropertyPage_NAME);

            fNameInput = new Text(container, SWT.BORDER);
            OwlUI.makeAccessible(fNameInput, nameLabel);
            fNameInput.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
            fNameInput.setText(getName(entity));
        }
    }

    /* Location */
    IFolder sameParent = getSameParent(fEntities);
    if (sameParent != null) {
        separateFromTop = true;

        Label locationLabel = new Label(container, SWT.None);
        locationLabel.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
        locationLabel.setText(Messages.GeneralPropertyPage_LOCATION);

        /* Exclude Folders that are selected from Chooser */
        List<IFolder> excludes = new ArrayList<IFolder>();
        for (IEntity entity : fEntities) {
            if (entity instanceof IFolder)
                excludes.add((IFolder) entity);
        }

        fFolderChooser = new FolderChooser(container, sameParent, excludes, SWT.BORDER, true);
        fFolderChooser.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        fFolderChooser.setLayout(LayoutUtils.createGridLayout(1, 0, 0, 2, 5, false));
        fFolderChooser.setBackground(container.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    }

    /* Other Settings */
    Composite otherSettingsContainer = new Composite(container, SWT.NONE);
    otherSettingsContainer.setLayout(LayoutUtils.createGridLayout(1, 0, 0));
    otherSettingsContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, true, 2, 1));

    if (separateFromTop)
        ((GridLayout) otherSettingsContainer.getLayout()).marginTop = 10;

    /* Auto-Reload */
    if (!containsNewsBin(fEntities)) {
        Composite autoReloadContainer = new Composite(otherSettingsContainer, SWT.NONE);
        autoReloadContainer.setLayout(LayoutUtils.createGridLayout(3, 0, 0));
        autoReloadContainer.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, true));

        fUpdateCheck = new Button(autoReloadContainer, SWT.CHECK);
        if (fIsSingleBookMark)
            fUpdateCheck.setText(Messages.GeneralPropertyPage_UPDATE_FEED);
        else
            fUpdateCheck.setText(Messages.GeneralPropertyPage_UPDATE_FEEDS);
        fUpdateCheck.setSelection(fPrefUpdateIntervalState);
        fUpdateCheck.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                fReloadSpinner.setEnabled(fUpdateCheck.getSelection());
                fReloadCombo.setEnabled(fUpdateCheck.getSelection());
            }
        });

        fReloadSpinner = new Spinner(autoReloadContainer, SWT.BORDER);
        fReloadSpinner.setMinimum(1);
        fReloadSpinner.setMaximum(999);
        fReloadSpinner.setEnabled(fPrefUpdateIntervalState);

        if (fUpdateIntervalScope == SECONDS_SCOPE)
            fReloadSpinner.setSelection((int) (fPrefUpdateInterval));
        else if (fUpdateIntervalScope == MINUTES_SCOPE)
            fReloadSpinner.setSelection((int) (fPrefUpdateInterval / MINUTE_IN_SECONDS));
        else if (fUpdateIntervalScope == HOURS_SCOPE)
            fReloadSpinner.setSelection((int) (fPrefUpdateInterval / HOUR_IN_SECONDS));
        else if (fUpdateIntervalScope == DAYS_SCOPE)
            fReloadSpinner.setSelection((int) (fPrefUpdateInterval / DAY_IN_SECONDS));

        fReloadCombo = new Combo(autoReloadContainer, SWT.READ_ONLY);
        fReloadCombo.add(Messages.GeneralPropertyPage_SECONDS);
        fReloadCombo.add(Messages.GeneralPropertyPage_MINUTES);
        fReloadCombo.add(Messages.GeneralPropertyPage_HOURS);
        fReloadCombo.add(Messages.GeneralPropertyPage_DAYS);
        fReloadCombo.select(fUpdateIntervalScope);
        fReloadCombo.setEnabled(fPrefUpdateIntervalState);

        /* Reload on Startup */
        fReloadOnStartupCheck = new Button(otherSettingsContainer, SWT.CHECK);
        fReloadOnStartupCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
        fReloadOnStartupCheck
                .setText(fEntities.size() == 1 ? Messages.GeneralPropertyPage_AUTO_UPDATE_FEED_STARTUP
                        : Messages.GeneralPropertyPage_AUTO_UPDATE_FEEDS_STARTUP);
        fReloadOnStartupCheck.setSelection(fPrefReloadOnStartup);
    }

    /* Open on Startup */
    fOpenOnStartupCheck = new Button(otherSettingsContainer, SWT.CHECK);
    fOpenOnStartupCheck.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
    fOpenOnStartupCheck.setText(getOpenOnStartupSettingName());
    fOpenOnStartupCheck.setSelection(fPrefOpenOnStartup);

    return container;
}

From source file:org.springsource.ide.eclipse.gradle.ui.launch.GradleLaunchTasksTab.java

License:Open Source License

/**
 * Creates the widgets that display the target order
 *///from  w w w  .j a  v a  2 s.c  o  m
private void createTaskList(Composite parent) {
    Font font = parent.getFont();

    Label label = new Label(parent, SWT.NONE);
    label.setText("Task execution order:");
    label.setFont(font);

    Composite orderComposite = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    orderComposite.setLayoutData(gd);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    orderComposite.setLayout(layout);
    orderComposite.setFont(font);

    taskOrderText = new Text(orderComposite, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL | SWT.READ_ONLY);
    taskOrderText.setFont(font);
    gd = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    gd.heightHint = 40;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    taskOrderText.setLayoutData(gd);

    Composite buttonColumn = new Composite(orderComposite, SWT.NONE);
    layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttonColumn.setLayout(layout);
    buttonColumn.setFont(font);

    orderButton = createPushButton(buttonColumn, "Order...", null);
    gd = (GridData) orderButton.getLayoutData();
    gd.verticalAlignment = GridData.BEGINNING;
    orderButton.setFont(font);
    orderButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            handleOrderPressed();
        }
    });
    clearButton = createPushButton(buttonColumn, "Clear", null);
    gd = (GridData) orderButton.getLayoutData();
    gd.verticalAlignment = GridData.BEGINNING;
    clearButton.setFont(font);
    clearButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            handleClearPressed();
        }
    });
    updateOrderedTargets();
}