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:com.vectrace.MercurialEclipse.ui.SWTWidgetHelper.java

License:Open Source License

/**
 * Utility method that creates a combo box
 *
 * @param parent/*from w  w  w .  j a  v a2s.co  m*/
 *            the parent for the new label
 * @return the new widget
 */
public static Combo createCombo(Composite parent) {
    Combo combo = new Combo(parent, SWT.READ_ONLY);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    combo.setLayoutData(data);
    return combo;
}

From source file:com.vectrace.MercurialEclipse.ui.SWTWidgetHelper.java

License:Open Source License

/**
 * Utility method that creates an editable combo box
 *
 * @param parent/* w  w w.jav a 2  s .  c  o  m*/
 *            the parent for the new label
 * @return the new widget
 */
public static Combo createEditableCombo(Composite parent) {
    Combo combo = new Combo(parent, SWT.NULL);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    combo.setLayoutData(data);
    return combo;
}

From source file:com.vectrace.MercurialEclipse.ui.SWTWidgetHelper.java

License:Open Source License

/**
 * Create a text field specific for this application
 *
 * @param parent//from  w  w  w .j  a va  2  s .  co m
 *            the parent of the new text field
 * @return the new text field
 */
public static 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:com.vectrace.MercurialEclipse.ui.SWTWidgetHelper.java

License:Open Source License

/**
 * Create a password entry field specific for this application
 *
 * @param parent/*ww  w  . ja  v a2s  .  com*/
 *            the parent of the new text field
 * @return the new password field
 */
public static Text createPasswordField(Composite parent) {
    Text text = new Text(parent, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD);
    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:com.vectrace.MercurialEclipse.wizards.ConfigurationWizardMainPage.java

License:Open Source License

/**
 * Utility method to create an editable combo box
 *
 * @param parent/*from   w ww . j a va  2 s .  co m*/
 *            the parent of the combo box
 * @return the created combo
 */
protected static Combo createEditableCombo(Composite parent) {
    Combo combo = new Combo(parent, SWT.NULL);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    combo.setLayoutData(data);
    return combo;
}

From source file:es.cv.gvcase.emf.ui.common.composites.SelectResourceComposite.java

License:Open Source License

protected Text createTextField(Composite parent) {
    Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalAlignment = SWT.CENTER;
    data.grabExcessVerticalSpace = false;
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    text.setLayoutData(data);/*from   w  ww .j a va2 s .  c  o  m*/
    return text;
}

From source file:es.cv.gvcase.trmanager.internal.ui.composites.SelectTransfResourceComposite.java

License:Open Source License

protected Text createTextField(Composite parent) {
    Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.verticalAlignment = SWT.CENTER;// GridData.CENTER;
    data.grabExcessVerticalSpace = false;
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    text.setLayoutData(data);/* w ww  . ja v a2s  .  c  o  m*/
    return text;
}

From source file:es.cv.gvcase.trmanager.internal.ui.pages.RequestConfigurationPage.java

License:Open Source License

private void updateActionsGroup() {
    // dispose decorations
    disposeDecorations();/*from   ww  w.  jav  a2s .  c o m*/
    // dispose the rest of widgets
    for (int i = 0; i < actionsGroup.getChildren().length; i++) {
        actionsGroup.getChildren()[i].dispose();
    }

    Composite actionComposite = new Composite(actionsGroup, SWT.FILL);
    GridData actionCompositeData = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
    actionComposite.setLayoutData(actionCompositeData);

    GridLayout actionCompositeLayout = new GridLayout();
    actionCompositeLayout.numColumns = 3;
    actionCompositeLayout.makeColumnsEqualWidth = false;
    actionCompositeLayout.horizontalSpacing = 10;
    actionComposite.setLayout(actionCompositeLayout);

    if (selectConfigButton.getSelection()) {

        Label selectModelLabel = new Label(actionComposite, SWT.NONE);
        selectModelLabel.setText(Messages.getString("RequestConfigurationPage.ConfigurationFile") + ":"); //$NON-NLS-1$
        selectModelLabel.setLayoutData(new GridData());

        final Text selectModelText = new Text(actionComposite, SWT.SINGLE | SWT.BORDER);
        selectModelText.setEditable(false);
        GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
        data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
        selectModelText.setLayoutData(data);
        if (getConfigurationModel() != null) {
            selectModelText.setText(getConfigurationModel());
        }

        // Decoration to validate the configuration model resource
        selectFileDecoration = new ControlDecoration(selectModelText, SWT.LEFT);
        selectFileDecoration.setMarginWidth(3);
        updateFieldDecorators(selectModelText);

        // Listener to validate the configuration model resource
        selectModelText.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                updateFieldDecorators(selectModelText);
            }
        });

        Button selectModelButton = new Button(actionComposite, SWT.PUSH);
        selectModelButton.setText(Messages.getString("RequestConfigurationPage.Select") + "..."); //$NON-NLS-1$
        selectModelButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));

        selectModelButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
            }

            public void widgetSelected(SelectionEvent e) {

                LoadEMFModelDialog dialog = new LoadEMFModelDialog(getShell(),
                        "http:///es.cv.gvcase.transformationConfiguration.ecore", sourceResource);

                dialog.open();
                String configModel = dialog.getURIText() == null ? "" : dialog.getURIText();
                setConfigurationModel(configModel);
                selectModelText.setText(configModel);
                setPageComplete(canFlipToNextPage());
            }
        });

        Button editConfigButton = new Button(actionComposite, SWT.PUSH);
        editConfigButton.setText(Messages.getString("RequestConfigurationPage.EditConfiguration")); //$NON-NLS-1$
        GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_END);
        gd.horizontalSpan = 3;
        editConfigButton.setLayoutData(gd);

        editConfigButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
            }

            public void widgetSelected(SelectionEvent e) {
                if (getConfigurationModel() != null) {
                    // open transformation configuration editor
                    editConfiguration();
                }
            }
        });

    } else if (newConfigButton.getSelection()) {

        Label folderSelectionLabel = new Label(actionComposite, SWT.LEFT);
        folderSelectionLabel.setText(Messages.getString("RequestConfigurationPage.Folder") + " :"); //$NON-NLS-1$

        final Text folderValueText = new Text(actionComposite, SWT.SINGLE | SWT.BORDER);
        GridData folderValueTextData = new GridData(GridData.FILL_HORIZONTAL);
        folderValueTextData.verticalAlignment = SWT.CENTER;// GridData.CENTER;
        folderValueTextData.grabExcessVerticalSpace = false;
        folderValueTextData.grabExcessHorizontalSpace = true;
        folderValueText.setLayoutData(folderValueTextData);
        folderValueText.setEditable(false);

        // Decoration to validate the configuration folder
        selectFolderDecoration = new ControlDecoration(folderValueText, SWT.LEFT);
        selectFolderDecoration.setMarginWidth(3);
        updateFieldDecorators(folderValueText);

        Button browseButton = new Button(actionComposite, SWT.PUSH);
        GridData browseButtonData = new GridData();
        browseButtonData.horizontalAlignment = SWT.RIGHT;
        browseButton.setLayoutData(browseButtonData);
        browseButton.setText(Messages.getString("RequestConfigurationPage.SelectFolder") + "..."); //$NON-NLS-1$

        Label fileNameLabel = new Label(actionComposite, SWT.LEFT);
        fileNameLabel.setText(Messages.getString("RequestConfigurationPage.FileName") + " :"); //$NON-NLS-1$

        final Text fileNameText = new Text(actionComposite, SWT.SINGLE | SWT.BORDER);
        GridData data = new GridData(GridData.FILL_HORIZONTAL);
        data.verticalAlignment = SWT.CENTER;// GridData.CENTER;
        data.grabExcessVerticalSpace = false;
        data.grabExcessHorizontalSpace = true;
        data.horizontalSpan = 2;
        fileNameText.setLayoutData(data);

        // Decoration to validate the configuration file name
        newFileDecoration = new ControlDecoration(fileNameText, SWT.LEFT);
        newFileDecoration.setMarginWidth(3);
        updateFieldDecorators(fileNameText);

        fileNameText.addModifyListener(new ModifyListener() {

            public void modifyText(ModifyEvent e) {
                String folder = folderValueText.getText();
                String fileName = fileNameText.getText();

                if ("".equals(folder) || "".equals(fileName)) {
                    setConfigurationModel(null);
                } else {
                    setConfigurationModel(folder + "/" + fileName);
                }
                updateFieldDecorators(fileNameText);
                setPageComplete(canFlipToNextPage());
            }

        });

        browseButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
            }

            public void widgetSelected(SelectionEvent e) {
                LoadFolderDialog dialog = new LoadFolderDialog(getShell(), sourceResource, false);
                dialog.open();
                String folder = dialog.getURIText() == null ? "" : dialog.getURIText();
                folderValueText.setText(folder);
                String fileName = fileNameText.getText();

                if ("".equals(folder) || "".equals(fileName)) {
                    setConfigurationModel(null);
                } else {
                    setConfigurationModel(folder + "/" + fileName);
                }
                updateFieldDecorators(folderValueText);
                setPageComplete(canFlipToNextPage());
            }

        });

    }

    actionsGroup.layout(true);
    Composite c = actionsGroup;
    while (c.getParent() != null) {
        // this redraw is necessary because decoration is shown twice in the
        // page
        c.getParent().redraw();
        c = c.getParent();
    }
    setPageComplete(canFlipToNextPage());
}

From source file:fr.inria.linuxtools.tmf.ui.project.wizards.CopyExperimentDialog.java

License:Open Source License

private void createNewExperimentNameGroup(Composite parent) {
    Font font = parent.getFont();
    Composite folderGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from ww w .  jav a 2 s  . c o  m
    folderGroup.setLayout(layout);
    folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Old experiment name label
    Label oldExperimentLabel = new Label(folderGroup, SWT.NONE);
    oldExperimentLabel.setFont(font);
    oldExperimentLabel.setText(Messages.CopyExperimentDialog_ExperimentName);

    // Old experiment name field
    Text oldExperimentName = new Text(folderGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    oldExperimentName.setLayoutData(data);
    oldExperimentName.setFont(font);
    oldExperimentName.setText(fExperiment.getName());
    oldExperimentName.setEnabled(false);

    // New experiment name label
    Label newExperimentLabel = new Label(folderGroup, SWT.NONE);
    newExperimentLabel.setFont(font);
    newExperimentLabel.setText(Messages.CopyExperimentDialog_ExperimentNewName);

    // New experiment name entry field
    fNewExperimentName = new Text(folderGroup, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    fNewExperimentName.setLayoutData(data);
    fNewExperimentName.setFont(font);
    fNewExperimentName.addListener(SWT.Modify, new Listener() {
        @Override
        public void handleEvent(Event event) {
            validateNewExperimentName();
        }
    });
}

From source file:fr.inria.linuxtools.tmf.ui.project.wizards.CopyTraceDialog.java

License:Open Source License

private void createNewTraceNameGroup(Composite parent) {
    Font font = parent.getFont();
    Composite folderGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from w ww. j  a  va  2s .  com
    folderGroup.setLayout(layout);
    folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Old trace name label
    Label oldTraceLabel = new Label(folderGroup, SWT.NONE);
    oldTraceLabel.setFont(font);
    oldTraceLabel.setText(Messages.CopyTraceDialog_TraceName);

    // Old trace name field
    Text oldTraceName = new Text(folderGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    oldTraceName.setLayoutData(data);
    oldTraceName.setFont(font);
    oldTraceName.setText(fTrace.getName());
    oldTraceName.setEnabled(false);

    // New trace name label
    Label newTraceLabel = new Label(folderGroup, SWT.NONE);
    newTraceLabel.setFont(font);
    newTraceLabel.setText(Messages.CopyTraceDialog_TraceNewName);

    // New trace name entry field
    fNewTraceName = new Text(folderGroup, SWT.BORDER);
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    fNewTraceName.setLayoutData(data);
    fNewTraceName.setFont(font);
    fNewTraceName.addListener(SWT.Modify, new Listener() {
        @Override
        public void handleEvent(Event event) {
            validateNewTraceName();
        }
    });
}