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.eclipse.ant.internal.ui.preferences.AddCustomDialog.java

License:Open Source License

/**
 * Create the group for creating the root directory
 *//*from ww w .ja  v  a 2s  .com*/
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() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            updateFromSourceField();
        }
    });

    for (IAntClasspathEntry entry : libraryEntries) {
        sourceNameField.add(entry.getLabel());
    }
    sourceNameField.addKeyListener(new KeyAdapter() {
        /*
         * @see KeyListener.keyPressed
         */
        @Override
        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)
         */
        @Override
        public void focusLost(FocusEvent e) {
            // Clear the flag to prevent constant update
            if (entryChanged) {
                entryChanged = false;
                updateFromSourceField();
            }
        }
    });
}

From source file:org.eclipse.ant.internal.ui.preferences.AntClasspathBlock.java

License:Open Source License

private void createClasspathTree(Composite parent) {
    Tree tree = new Tree(parent, SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = tree.getItemHeight();
    tree.setLayoutData(data);// w ww  .  j av a  2  s .co  m
    tree.setFont(parent.getFont());

    tree.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent event) {
            if (event.character == SWT.DEL && event.stateMask == 0) {
                remove();
            }
        }
    });

    antContentProvider = new AntClasspathContentProvider();
    treeViewer = new TreeViewer(tree);
    treeViewer.setContentProvider(antContentProvider);
    treeViewer.setLabelProvider(labelProvider);
    treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            tableSelectionChanged((IStructuredSelection) event.getSelection(),
                    (AntClasspathContentProvider) treeViewer.getContentProvider());
        }
    });
}

From source file:org.eclipse.buckminster.jnlp.p2.ui.UserValidationDialog.java

License:Open Source License

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

    Composite fieldContainer = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*  w  w  w .  ja  v  a  2s.c o  m*/
    layout.marginHeight = layout.marginWidth = 10;
    fieldContainer.setLayout(layout);
    GridData layoutData = new GridData();
    fieldContainer.setLayoutData(layoutData);

    Label label = new Label(fieldContainer, SWT.NONE);
    label.setText("Username:");
    m_username = new Text(fieldContainer, SWT.BORDER);
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
    layoutData.horizontalAlignment = SWT.END;
    m_username.setLayoutData(layoutData);
    m_username.setText(getUserName());

    label = new Label(fieldContainer, SWT.NONE);
    label.setText("Password:");
    m_password = new Text(fieldContainer, SWT.PASSWORD | SWT.BORDER);
    layoutData = new GridData(GridData.FILL_HORIZONTAL);
    layoutData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
    layoutData.horizontalAlignment = SWT.END;
    m_password.setLayoutData(layoutData);
    m_password.setText(getPassword());

    Composite checkboxContainer = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.marginHeight = layout.marginWidth = 10;
    checkboxContainer.setLayout(layout);
    layoutData = new GridData();
    layoutData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
    checkboxContainer.setLayoutData(layoutData);
    m_saveButton = new Button(checkboxContainer, SWT.CHECK);
    m_saveButton.setText("Save password");
    m_saveButton.setSelection(saveResult());

    m_username.setFocus();

    return composite;
}

From source file:org.eclipse.cdt.internal.autotools.ui.wizards.CProjectPlatformPage.java

License:Open Source License

private void createTypeSelectGroup(Composite parent) {
    // Create the group composite
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(new GridLayout(2, false));
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create the platform selection label and combo widgets
    final Label platformLabel = new Label(composite, SWT.LEFT);
    platformLabel.setFont(composite.getFont());
    platformLabel.setText(AutotoolsWizardMessages.getResourceString(TARGET_LABEL));

    platformSelection = new Text(composite, SWT.READ_ONLY);
    //      platformSelection = new Combo(composite, SWT.READ_ONLY | SWT.BORDER);   
    platformSelection.setFont(composite.getFont());
    platformSelection.setToolTipText(AutotoolsWizardMessages.getResourceString(TARGET_TIP));
    platformSelection.setText("GNU Autotools"); //$NON-NLS-1$
    platformSelection.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            platformSelection = null;//from   www .  ja  va  2  s .c  o  m
        }
    });

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    // Make this the same as NewCProjectWizardPage.SIZING_TEXT_FIELD_WIDTH
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH + 50;
    platformSelection.setLayoutData(gd);
}

From source file:org.eclipse.cdt.internal.ui.wizards.dialogfields.LinkToFileGroup.java

License:Open Source License

public static GridData gridDataForText(int span) {
    GridData data = new GridData();
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.horizontalAlignment = GridData.FILL;
    data.grabExcessHorizontalSpace = false;
    data.horizontalSpan = span;//w w w  .  ja v a 2 s. co m
    return data;
}

From source file:org.eclipse.cdt.launch.ui.corebuild.GenericMainTab.java

License:Open Source License

/**
 * Creates the controls needed to edit the location attribute of an external
 * tool//from w  w w  . j a  va 2  s .com
 *
 * @param parent
 *            the composite to create the controls in
 */
protected void createLocationComponent(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String locationLabel = getLocationLabel();
    group.setText(locationLabel);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    locationField = new Text(group, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    locationField.setLayoutData(gridData);
    locationField.addModifyListener(fListener);
    addControlAccessibleListener(locationField, group.getText());

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

    workspaceLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseWorkspace, null);
    workspaceLocationButton.addSelectionListener(fListener);
    addControlAccessibleListener(workspaceLocationButton,
            group.getText() + " " + workspaceLocationButton.getText()); //$NON-NLS-1$

    fileLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseFileSystem, null);
    fileLocationButton.addSelectionListener(fListener);
    addControlAccessibleListener(fileLocationButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$

    variablesLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_Variables, null);
    variablesLocationButton.addSelectionListener(fListener);
    addControlAccessibleListener(variablesLocationButton,
            group.getText() + " " + variablesLocationButton.getText()); //$NON-NLS-1$
}

From source file:org.eclipse.cdt.launch.ui.corebuild.GenericMainTab.java

License:Open Source License

/**
 * Creates the controls needed to edit the working directory attribute of an
 * external tool/*from   ww w. jav  a2s .co m*/
 *
 * @param parent
 *            the composite to create the controls in
 */
protected void createWorkDirectoryComponent(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String groupName = getWorkingDirectoryLabel();
    group.setText(groupName);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    workDirectoryField = new Text(group, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    workDirectoryField.setLayoutData(data);
    workDirectoryField.addModifyListener(fListener);
    addControlAccessibleListener(workDirectoryField, group.getText());

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

    workspaceWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseWorkspace,
            null);
    workspaceWorkingDirectoryButton.addSelectionListener(fListener);
    addControlAccessibleListener(workspaceWorkingDirectoryButton,
            group.getText() + " " + workspaceWorkingDirectoryButton.getText()); //$NON-NLS-1$

    fileWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseFileSystem,
            null);
    fileWorkingDirectoryButton.addSelectionListener(fListener);
    addControlAccessibleListener(fileWorkingDirectoryButton,
            group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$

    variablesWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_Variables,
            null);
    variablesWorkingDirectoryButton.addSelectionListener(fListener);
    addControlAccessibleListener(variablesWorkingDirectoryButton,
            group.getText() + " " + variablesWorkingDirectoryButton.getText()); //$NON-NLS-1$
}

From source file:org.eclipse.cdt.launch.ui.corebuild.GenericMainTab.java

License:Open Source License

/**
 * Creates the controls needed to edit the argument and prompt for argument
 * attributes of an external tool//from w w  w .  j av a2s .  c  o  m
 *
 * @param parent
 *            the composite to create the controls in
 */
protected void createArgumentComponent(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String groupName = Messages.GenericMainTab_Arguments;
    group.setText(groupName);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_BOTH);
    group.setLayout(layout);
    group.setLayoutData(gridData);
    group.setFont(parent.getFont());

    argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
    argumentField.addTraverseListener(new TraverseListener() {
        @Override
        public void keyTraversed(TraverseEvent event) {
            if (event.detail == SWT.TRAVERSE_RETURN && (event.stateMask & SWT.MODIFIER_MASK) != 0) {
                event.doit = true;
            }
        }
    });

    gridData = new GridData(GridData.FILL_BOTH);
    gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    gridData.heightHint = 30;
    argumentField.setLayoutData(gridData);
    argumentField.addModifyListener(fListener);
    addControlAccessibleListener(argumentField, group.getText());

    Composite composite = new Composite(group, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    composite.setLayout(layout);
    composite.setLayoutData(gridData);
    composite.setFont(parent.getFont());

    argumentVariablesButton = createPushButton(composite, Messages.GenericMainTab_Variables, null);
    argumentVariablesButton.addSelectionListener(fListener);
    addControlAccessibleListener(argumentVariablesButton, argumentVariablesButton.getText()); // need to strip the
    // mnemonic from
    // buttons

    Label instruction = new Label(group, SWT.NONE);
    instruction.setText(Messages.GenericMainTab_Quotes);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    instruction.setLayoutData(gridData);
}

From source file:org.eclipse.cdt.managedbuilder.internal.ui.actions.CleanAndBuildDialog.java

License:Open Source License

private void createProjectSelectionTable(Composite area) {
    cfgCheckboxViewer = new ContainerCheckedTreeViewer(area, SWT.BORDER);
    cfgCheckboxViewer.setContentProvider(new ConfigurationContentProvider());
    cfgCheckboxViewer.setLabelProvider(new ConfigurationLabelProvider());
    cfgCheckboxViewer.setInput(projects);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;//w  w w.  j  av  a 2  s  .co  m
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    cfgCheckboxViewer.getControl().setLayoutData(data);

    ArrayList<ICConfigurationDescription> initialSelection = new ArrayList<ICConfigurationDescription>(
            projects.length);
    for (IProject prj : projects) {
        ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(prj, false);
        if (prjd == null)
            continue;
        cfgCheckboxViewer.setChecked(prjd.getActiveConfiguration(), true);
        initialSelection.add(prjd.getActiveConfiguration());
    }
    cfgCheckboxViewer.expandAll();
    cfgCheckboxViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateEnablement();
            selected = cfgCheckboxViewer.getCheckedElements();
        }
    });
    selected = cfgCheckboxViewer.getCheckedElements();
    selected = initialSelection.toArray(new ICConfigurationDescription[initialSelection.size()]);
}

From source file:org.eclipse.cdt.managedbuilder.internal.ui.commands.RebuildConfigurationsDialog.java

License:Open Source License

private void createProjectSelectionTable(Composite area) {
    cfgCheckboxViewer = new ContainerCheckedTreeViewer(area, SWT.BORDER);
    cfgCheckboxViewer.setContentProvider(new ConfigurationContentProvider());
    cfgCheckboxViewer.setLabelProvider(new ConfigurationLabelProvider());
    cfgCheckboxViewer.setInput(projects);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 2;//  ww w  . jav  a  2s. c o  m
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    data.heightHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    cfgCheckboxViewer.getControl().setLayoutData(data);

    List<ICConfigurationDescription> initialSelection = new ArrayList<>(projects.length);
    for (IProject prj : projects) {
        ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(prj, false);
        if (prjd == null)
            continue;
        cfgCheckboxViewer.setChecked(prjd.getActiveConfiguration(), true);
        initialSelection.add(prjd.getActiveConfiguration());
    }
    cfgCheckboxViewer.expandAll();
    cfgCheckboxViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateEnablement();
            selected = cfgCheckboxViewer.getCheckedElements();
        }
    });
    selected = cfgCheckboxViewer.getCheckedElements();
    selected = initialSelection.toArray(new ICConfigurationDescription[initialSelection.size()]);
}