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.tigris.subversion.subclipse.ui.wizards.generatediff.PatchFileSelectionPage.java

License:Open Source License

/**
 * Allow the user to chose to save the patch to the workspace or outside
 * of the workspace.//from  w w w.  j  av  a2s .  c o  m
 */
public void createControl(Composite parent) {

    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    composite.setLayout(layout);
    composite.setLayoutData(new GridData());
    setControl(composite);
    initializeDialogUnits(composite);

    // set F1 help
    PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.PATCH_SELECTION_PAGE);

    // Clipboard
    saveToClipboard = new Button(composite, SWT.RADIO);
    saveToClipboard.setText(Policy.bind("GenerateSVNDiff.SaveToClipboard")); //$NON-NLS-1$
    saveToClipboard.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            validatePage();
            updateEnablements();
        }
    });

    // File System
    saveInFilesystem = new Button(composite, SWT.RADIO);
    saveInFilesystem.setText(Policy.bind("GenerateSVNDiff.SaveInFileSystem")); //$NON-NLS-1$
    saveInFilesystem.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            validatePage();
            updateEnablements();
        }
    });

    Composite nameGroup = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    nameGroup.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    nameGroup.setLayoutData(data);

    filenameCombo = new Text(nameGroup, SWT.BORDER);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    filenameCombo.setLayoutData(gd);
    filenameCombo.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            setPageComplete(validatePage());
        }
    });

    FocusListener focusListener = new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            ((Text) e.getSource()).selectAll();
        }

        public void focusLost(FocusEvent e) {
            ((Text) e.getSource()).setText(((Text) e.getSource()).getText());
        }
    };
    filenameCombo.addFocusListener(focusListener);

    browseButton = new Button(nameGroup, SWT.NULL);
    browseButton.setText(Policy.bind("GenerateSVNDiff.Browse")); //$NON-NLS-1$
    data = new GridData(GridData.HORIZONTAL_ALIGN_END);
    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    browseButton.setLayoutData(data);
    browseButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            FileDialog d = new FileDialog(getShell(), SWT.PRIMARY_MODAL | SWT.SAVE);
            d.setText(Policy.bind("GenerateSVNDiff.SavePatchAs")); //$NON-NLS-1$
            d.setFileName(Policy.bind("GenerateSVNDiff.patchTxt")); //$NON-NLS-1$
            String file = d.open();
            if (file != null) {
                IPath path = new Path(file);
                setFilesystemFilename(path.toOSString());
            }
        }
    });

    // Workspace
    saveInWorkspace = new Button(composite, SWT.RADIO);
    saveInWorkspace.setText(Policy.bind("GenerateSVNDiff.SaveInWorkspace")); //$NON-NLS-1$
    saveInWorkspace.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            validatePage();
            updateEnablements();
        }
    });

    final Composite pathGroup = new Composite(composite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    pathGroup.setLayout(layout);
    data = new GridData(SWT.FILL, SWT.FILL, true, false);
    pathGroup.setLayoutData(data);

    wsPathText = new Text(pathGroup, SWT.BORDER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.verticalAlignment = GridData.CENTER;
    gd.grabExcessVerticalSpace = false;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    wsPathText.setLayoutData(gd);
    wsPathText.setEditable(false);

    wsBrowseButton = new Button(pathGroup, SWT.NULL);
    gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
    gd.widthHint = Math.max(widthHint, wsBrowseButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
    wsBrowseButton.setLayoutData(gd);
    wsBrowseButton.setText(Policy.bind("GenerateSVNDiff.Browse")); //$NON-NLS-1$   
    wsBrowseButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            final WorkspaceDialog dialog = new WorkspaceDialog(getShell(),
                    Policy.bind("GenerateSVNDiff.workspaceDialogTitle"), //$NON-NLS-1$
                    Policy.bind("GenerateSVNDiff.workspaceDialogMessage"),
                    SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_WIZBAN_DIFF), wsPathText);
            wsBrowsed = true;
            dialog.open();
            validatePage();
        }
    });

    resourceSelectionTree = new ResourceSelectionTree(composite, SWT.NONE,
            Policy.bind("GenerateSVNDiff.Changes"), ResourceSelectionTree.dedupeResources(resources), statusMap, //$NON-NLS-1$
            null, true, null, null);
    ((CheckboxTreeViewer) resourceSelectionTree.getTreeViewer()).setAllChecked(true);

    resourceSelectionTree.getTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            validatePage();
        }
    });

    saveToClipboard.setSelection(true);
    validatePage();
    updateEnablements();
}

From source file:org.tigris.subversion.subclipse.ui.wizards.SVNWizardPage.java

License:Open Source License

/**
 * Create a text field specific for this application
 *
 * @param parent  the parent of the new text field
 * @return the new text field/*from   w  ww  .ja va 2 s. c o m*/
 */
static public Text createTextField(Composite parent) {
    Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalAlignment = GridData.CENTER;
    data.grabExcessVerticalSpace = false;
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    text.setLayoutData(data);
    return text;
}

From source file:sc.ndt.ui.externaltools.internal.launchConfigurations.ExternalToolsMainTab.java

License:Open Source License

/**
 * Creates the controls needed to edit the working directory attribute of an
 * external tool/*from  ww  w  .  j  a va  2  s.  c o 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,
            ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Browse_Wor_kspace____6, null);
    workspaceWorkingDirectoryButton.addSelectionListener(fListener);
    addControlAccessibleListener(workspaceWorkingDirectoryButton,
            group.getText() + " " + workspaceWorkingDirectoryButton.getText()); //$NON-NLS-1$

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

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

From source file:sc.ndt.ui.externaltools.internal.launchConfigurations.ExternalToolsMainTab.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. java  2s  . 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 = ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab__Arguments___1;
    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() {
        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,
            ExternalToolsLaunchConfigurationMessages.ExternalToolsMainTab_Varia_bles____2, null);
    argumentVariablesButton.addSelectionListener(fListener);
    addControlAccessibleListener(argumentVariablesButton, argumentVariablesButton.getText()); // need to strip the
    // mnemonic from buttons

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

From source file:tern.eclipse.ide.server.nodejs.ui.debugger.launchConfigurations.AbstractNodejsCliFileLaunchConfigurationTab.java

License:Open Source License

private void createCliFileComponent(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String cliFileLabel = getCliFileLabel();
    group.setText(cliFileLabel);//from   w  ww.  j a  v  a2 s .  c  o m
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    cliFileField = new Text(group, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    cliFileField.setLayoutData(gridData);
    cliFileField.addModifyListener(fListener);
    addControlAccessibleListener(cliFileField, 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, TernNodejsUIMessages.Button_browse_workspace,
            null);
    workspaceLocationButton.addSelectionListener(fListener);
    addControlAccessibleListener(workspaceLocationButton,
            group.getText() + " " + workspaceLocationButton.getText()); //$NON-NLS-1$

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

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

}

From source file:ts.eclipse.ide.angular2.internal.cli.launch.ui.MainTab.java

License:Open Source License

private void createNgCommandComponent(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String groupName = AngularCLIMessages.AngularCLILaunchTabGroup_MainTab_command;
    group.setText(groupName);/* ww w . ja v  a 2  s.c o m*/
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    commandsCommbo = new Combo(group, SWT.BORDER | SWT.H_SCROLL);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    commandsCommbo.setLayoutData(data);
    String[] items = new String[NgCommand.values().length];
    for (int i = 0; i < items.length; i++) {
        items[i] = NgCommand.values()[i].getAliases()[0];
    }
    commandsCommbo.setItems(items);
    commandsCommbo.addModifyListener(fListener);
}

From source file:ts.eclipse.ide.angular2.internal.cli.launch.ui.MainTab.java

License:Open Source License

private void createArguments(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String groupName = AngularCLIMessages.AngularCLILaunchTabGroup_MainTab_arguments;
    group.setText(groupName);/* w w  w .jav  a  2 s  .  c  o  m*/
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    group.setLayout(layout);
    group.setLayoutData(gridData);

    argumentsField = new Text(group, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    argumentsField.setLayoutData(data);
    argumentsField.addModifyListener(fListener);
}

From source file:ts.eclipse.ide.ui.launch.AbstractMainTab.java

License:Open Source License

/**
 * Creates the controls needed to edit the working directory attribute of an
 * external tool// w  w  w.  j  av  a2  s.  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 = TypeScriptUIMessages.Launch_MainTab_workingDir;
    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,
            TypeScriptUIMessages.Browse_Workspace_button, null);
    workspaceWorkingDirectoryButton.addSelectionListener(fListener);
    addControlAccessibleListener(workspaceWorkingDirectoryButton,
            group.getText() + " " + workspaceWorkingDirectoryButton.getText()); //$NON-NLS-1$

    fileWorkingDirectoryButton = createPushButton(buttonComposite,
            TypeScriptUIMessages.Browse_FileSystem_button, null);
    fileWorkingDirectoryButton.addSelectionListener(fListener);
    addControlAccessibleListener(fileWorkingDirectoryButton, group.getText()); // $NON-NLS-1$

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