Example usage for org.eclipse.jface.preference JFacePreferences ERROR_COLOR

List of usage examples for org.eclipse.jface.preference JFacePreferences ERROR_COLOR

Introduction

In this page you can find the example usage for org.eclipse.jface.preference JFacePreferences ERROR_COLOR.

Prototype

String ERROR_COLOR

To view the source code for org.eclipse.jface.preference JFacePreferences ERROR_COLOR.

Click Source Link

Document

Identifier for the Error Color

Usage

From source file:com.agynamix.platform.frontend.gui.ApplicationStatusLineManager.java

License:Open Source License

public ApplicationStatusLineManager() {
    ColorRegistry cr = JFaceResources.getColorRegistry();
    cr.put(JFacePreferences.ERROR_COLOR, new RGB(205, 2, 4)); // schoen rot
}

From source file:com.intel.sgx.dialogs.EnclaveConfigDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    Composite container = (Composite) super.createDialogArea(parent);
    final GridLayout gridLayout = new GridLayout(3, false);
    container.setLayout(gridLayout);/* w ww.  j  a v  a2 s.c om*/

    final Group groupLabel1 = new Group(container, SWT.None);
    groupLabel1.setLayout(new GridLayout(3, false));
    GridData innergrid1 = new GridData(GridData.FILL_HORIZONTAL);
    innergrid1.horizontalSpan = 3;
    groupLabel1.setLayoutData(innergrid1);

    Label warningLabel = new Label(groupLabel1, SWT.BEGINNING | SWT.WRAP);
    warningLabel.setText("Note: Use this Menu to change the Enclave settings.");

    statusLabel = new Label(container, SWT.BEGINNING | SWT.WRAP);
    GridData statusGrid = new GridData(GridData.FILL_HORIZONTAL);
    statusGrid.horizontalSpan = 3;
    statusLabel.setLayoutData(statusGrid);
    statusLabel.setText("");
    statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));

    final Group groupLabel2 = new Group(container, SWT.None);
    groupLabel2.setLayout(new GridLayout(3, false));
    groupLabel2.setText("Modify the Enclave Settings here...");
    GridData innergrid = new GridData(GridData.FILL_HORIZONTAL);
    innergrid.horizontalSpan = 3;
    groupLabel2.setLayoutData(innergrid);

    final Label messageLabel0 = new Label(groupLabel2, SWT.NONE);
    messageLabel0.setText("Product ID:");
    messageLabel0.setLayoutData(new GridData(GridData.BEGINNING));

    prodID = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gridData.widthHint = 400;
    prodID.setLayoutData(gridData);
    prodID.setText(enclaveConfig.prodId);
    prodID.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent modifyEvent) {
            statusLabel.setText("");
            enclaveConfig.prodId = prodID.getText();
        }
    });

    final Label messageLabel1 = new Label(groupLabel2, SWT.NONE);
    messageLabel1.setText("ISV SVN:");
    messageLabel1.setLayoutData(new GridData(GridData.BEGINNING));

    isvSvn = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
    isvSvn.setLayoutData(gridData);
    isvSvn.setText(enclaveConfig.isvSvn);
    isvSvn.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent modifyEvent) {
            statusLabel.setText("");
            enclaveConfig.isvSvn = isvSvn.getText();
        }
    });

    final Label messageLabel2 = new Label(groupLabel2, SWT.NONE);
    messageLabel2.setText("Thread Stack Size:");
    messageLabel2.setLayoutData(new GridData(GridData.BEGINNING));

    threadStackSize = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
    threadStackSize.setLayoutData(gridData);
    threadStackSize.setText(enclaveConfig.threadStackSize);
    threadStackSize.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent modifyEvent) {
            enclaveConfig.threadStackSize = threadStackSize.getText();
            if (!(threadStackSize.getText().matches("0x[0-9a-fA-F]{1,}000"))) {
                statusLabel.setText("Error: The Thread Stack Size value must be Page Aligned.");
            } else {
                if (!(enclaveConfig.globalHeapSize.matches("0x[0-9a-fA-F]{1,}000")))
                    statusLabel.setText("Error: The Global Heap Size value must be Page Aligned.");
                else
                    statusLabel.setText("");
            }
        }
    });

    final Label messageLabel3 = new Label(groupLabel2, SWT.NONE);
    messageLabel3.setText("Global Heap Size:");
    messageLabel3.setLayoutData(new GridData(GridData.BEGINNING));

    globalHeapSize = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
    globalHeapSize.setLayoutData(gridData);
    globalHeapSize.setText(enclaveConfig.globalHeapSize);
    globalHeapSize.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent modifyEvent) {
            enclaveConfig.globalHeapSize = globalHeapSize.getText();
            if (!(globalHeapSize.getText().matches("0x[0-9a-fA-F]{1,}000"))) {
                statusLabel.setText("Error: The Global Heap Size value must be Page Aligned.");
            } else {
                if (!(enclaveConfig.threadStackSize.matches("0x[0-9a-fA-F]{1,}000")))
                    statusLabel.setText("Error: The Thread Stack Size value must be Page Aligned.");
                else
                    statusLabel.setText("");

            }
        }
    });

    final Label messageLabel4 = new Label(groupLabel2, SWT.NONE);
    messageLabel4.setText("TCS Number:");
    messageLabel4.setLayoutData(new GridData(GridData.BEGINNING));

    tcsNum = new Text(groupLabel2, SWT.SINGLE | SWT.BORDER);
    tcsNum.setLayoutData(gridData);
    tcsNum.setText(enclaveConfig.tcsNum);
    tcsNum.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent modifyEvent) {
            statusLabel.setText("");
            enclaveConfig.tcsNum = tcsNum.getText();
        }
    });

    final Label messageLabel5 = new Label(groupLabel2, SWT.NONE);
    messageLabel5.setText("TCS Policy:");
    messageLabel5.setLayoutData(new GridData(GridData.BEGINNING));

    final String[] items = { "Unbound", "Bound" };
    tcsPolicy = new Combo(groupLabel2, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    tcsPolicy.setItems(items);
    String item = items[Integer.parseInt(enclaveConfig.tcsPolicy)];
    int index = tcsPolicy.indexOf(item);
    tcsPolicy.select(index < 0 ? 0 : index);
    tcsPolicy.setLayoutData(gridData);
    tcsPolicy.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            statusLabel.setText("");
            enclaveConfig.tcsPolicy = (tcsPolicy.getSelectionIndex() == 0 ? "0" : "1");
        }
    });

    final Label messageLabel6 = new Label(groupLabel2, SWT.NONE);
    messageLabel6.setText("Disable Debug:");
    messageLabel6.setLayoutData(new GridData(GridData.BEGINNING));

    disableDebug = new Button(groupLabel2, SWT.CHECK);
    GridData gridData1 = new GridData(GridData.FILL_HORIZONTAL);
    disableDebug.setLayoutData(gridData1);
    disableDebug.setSelection(enclaveConfig.disableDebug.equals("1") ? true : false);
    disableDebug.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            statusLabel.setText("");
            enclaveConfig.disableDebug = disableDebug.getSelection() ? "1" : "0";
        }
    });

    if (statusLabel.getText() != null) {
        statusLabel.setVisible(true);
    } else {
        statusLabel.setVisible(false);
    }

    return container;
}

From source file:gov.redhawk.ide.codegen.ui.internal.GeneratorConsole.java

License:Open Source License

/**
 * @param name/*www. j  a va2  s .  com*/
 * @param consoleType
 * @param imageDescriptor
 * @param encoding
 * @param autoLifecycle
 */
public GeneratorConsole(final ICodeGeneratorDescriptor desc) {
    super(desc.getName(), desc.getId(), GeneratorConsole.getConsoleImageDesc(desc));
    final IOConsoleOutputStream outIOStream = this.newOutputStream();
    outIOStream.setActivateOnWrite(false);
    this.outStream = new PrintStream(outIOStream);

    final IOConsoleOutputStream errIOStream = this.newOutputStream();
    errIOStream.setActivateOnWrite(true);
    errIOStream.setColor(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));

    this.errStream = new PrintStream(errIOStream);

    try {
        this.getInputStream().close();
    } catch (final IOException e) {
        RedhawkCodegenUiActivator.getDefault().getLog().log(new Status(IStatus.ERROR,
                RedhawkCodegenUiActivator.PLUGIN_ID, "Error in generator console.", e));
    }
}

From source file:no.resheim.elibrarium.epub.ui.reader.EpubReader.java

License:Open Source License

@Override
public void createPartControl(Composite parent) {
    Composite c = new Composite(parent, SWT.NONE);
    c.setBackground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;//from   w  ww .  j  av a 2 s. co  m
    layout.marginTop = 0;
    c.setLayout(layout);
    c.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    GridData gdHeader = new GridData(SWT.CENTER, SWT.TOP, true, false);
    gdHeader.minimumWidth = 500;
    headerLabel = new Label(c, SWT.CENTER);
    headerLabel.setLayoutData(gdHeader);
    headerLabel.setText(" ");
    headerLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR));

    GridData gdBookmark = new GridData(SWT.CENTER, SWT.BEGINNING, false, false);
    gdBookmark.minimumWidth = 32;
    gdBookmark.widthHint = 32;
    gdBookmark.verticalSpan = 3;
    bookmarkLabel = new Label(c, SWT.CENTER);
    bookmarkLabel
            .setImage(EpubUiPlugin.getDefault().getImageRegistry().get(EpubUiPlugin.IMG_BOOKMARK_INACTIVE));
    bookmarkLabel.setLayoutData(gdBookmark);
    bookmarkLabel.addMouseListener(new MouseListener() {

        @Override
        public void mouseUp(MouseEvent e) {
        }

        @Override
        public void mouseDown(MouseEvent e) {
            toggleBookmark();
        }

        @Override
        public void mouseDoubleClick(MouseEvent e) {
        }
    });

    // We rely on having a WebKit based browser
    GridData gdBrowser = new GridData(SWT.FILL, SWT.FILL, true, true);
    browser = new Browser(c, SWT.WEBKIT);
    browser.setLayoutData(gdBrowser);
    browser.setBackground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));

    GridData gdFooter = new GridData(SWT.CENTER, SWT.BOTTOM, true, false);
    gdFooter.minimumWidth = 500;
    footerLabel = new Label(c, SWT.CENTER);
    gdFooter.horizontalSpan = 2;
    footerLabel.setLayoutData(gdFooter);
    footerLabel.setText(" ");
    footerLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR));

    // Install listener to figure out when we need to re-paginate
    resizeListener = new ResizeListener();
    browser.addControlListener(resizeListener);
    browser.getDisplay().addFilter(SWT.MouseDown, resizeListener);
    browser.getDisplay().addFilter(SWT.MouseUp, resizeListener);

    // Various javascript
    installInjector();

    // Handle key-presses
    installKeyListener();

    // These events are triggered when the location of the browser has
    // changed, that is when the URL has changed. It may or may not be
    // within the document currently open. It does normally not change when
    // browsing between pages unless the chapter has been changed.
    // browser.addLocationListener(new LocationListener() {
    //
    // @Override
    // public void changed(LocationEvent event) {
    // updateLocation();
    // }
    //
    // @Override
    // public void changing(LocationEvent event) {
    // }
    // });

    browser.setCapture(false);
    if (browser != null) {
        if (initialURL != null) {
            browser.setUrl(initialURL);
        }
    }

    new MarkTextHandler(browser);

    // Create a new menu for the browser. We want this dynamically populated
    // so all items are removed when the menu is shown and it will be
    // re-populated.
    menu = new Menu(browser);
    browser.setMenu(menu);
    menu.addListener(SWT.Show, new Listener() {
        public void handleEvent(Event event) {
            MenuItem[] menuItems = menu.getItems();
            for (MenuItem menuItem : menuItems) {
                menuItem.dispose();
            }
            populateMenu();
        }
    });

}

From source file:org.eclipse.cdt.dsf.debug.ui.viewmodel.ErrorLabelForeground.java

License:Open Source License

@Override
public RGB getForeground() {
    IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
    ITheme currentTheme = themeManager.getCurrentTheme();

    ColorRegistry colorRegistry = currentTheme.getColorRegistry();

    Color color = colorRegistry.get(JFacePreferences.ERROR_COLOR);

    if (color != null) {
        return color.getRGB();
    }/*from  w  w  w.  j a v a2 s.  com*/
    return super.getForeground();
}

From source file:org.eclipse.cdt.managedbuilder.ui.properties.CPropertyVarsTab.java

License:Open Source License

@Override
public void createControls(Composite parent) {
    super.createControls(parent);
    initButtons(new String[] { ADD_STR, EDIT_STR, DEL_STR });
    usercomp.setLayout(new GridLayout(2, true));
    createTableControl();/*from ww  w  . j a va2s.  co  m*/

    // Create a "show parent levels" button
    final Button b = new Button(usercomp, SWT.CHECK);
    b.setFont(usercomp.getFont());
    b.setText(Messages.CPropertyVarsTab_0);
    b.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    b.setSelection(fShowSysMacros);
    b.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            fShowSysMacros = b.getSelection();
            updateData(getResDesc());
        }
    });

    stringListModeControl = new StringListModeControl(page, usercomp, 1);
    stringListModeControl.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            updateData();
        }
    });

    fStatusLabel = new Label(usercomp, SWT.LEFT);
    fStatusLabel.setFont(usercomp.getFont());
    fStatusLabel.setText(EMPTY_STR);
    fStatusLabel.setLayoutData(new GridData(GridData.BEGINNING));
    fStatusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
}

From source file:org.eclipse.cdt.managedbuilder.ui.properties.NewBuildConfigurationDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create a group for the name & description

    final Group group1 = new Group(composite, SWT.NONE);
    group1.setFont(composite.getFont());
    GridLayout layout1 = new GridLayout(3, false);
    group1.setLayout(layout1);// w w w  .j ava2 s  .  co m
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    group1.setLayoutData(gd);

    // Add a label and a text widget for Configuration's name
    final Label nameLabel = new Label(group1, SWT.LEFT);
    nameLabel.setFont(parent.getFont());
    nameLabel.setText(Messages.NewConfiguration_label_name);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    nameLabel.setLayoutData(gd);

    configName = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configName.setFont(group1.getFont());
    configName.setText(getNewName());
    configName.setFocus();
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configName.setLayoutData(gd);
    configName.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateState();
        }
    });

    //       Add a label and a text widget for Configuration's description
    final Label descriptionLabel = new Label(group1, SWT.LEFT);
    descriptionLabel.setFont(parent.getFont());
    descriptionLabel.setText(Messages.NewConfiguration_label_description);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    descriptionLabel.setLayoutData(gd);
    configDescription = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configDescription.setFont(group1.getFont());
    configDescription.setText(getNewDescription());
    configDescription.setFocus();

    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configDescription.setLayoutData(gd);

    // Create a group for the radio buttons

    final Group group = new Group(composite, SWT.NONE);
    group.setFont(composite.getFont());
    group.setText(Messages.NewConfiguration_label_group);
    GridLayout layout = new GridLayout(3, false);
    group.setLayout(layout);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    group.setLayoutData(gd);

    SelectionListener radioListener = new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            clone = btnClone.getSelection();
            updateComboState();
        }
    };
    // Add a radio button and combo box to copy from default config
    btnCopy = new Button(group, SWT.RADIO);
    btnCopy.setFont(group.getFont());
    btnCopy.setText(Messages.NewConfiguration_label_copy);
    setButtonLayoutData(btnCopy);
    btnCopy.addSelectionListener(radioListener);

    copyConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    copyConfigSelector.setFont(group.getFont());
    int index = copyConfigSelector.indexOf(newName);
    copyConfigSelector.select(index < 0 ? 0 : index);
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    copyConfigSelector.setLayoutData(gd);
    copyConfigSelector.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            validateState();
        }
    });
    copyConfigSelector.setEnabled(false);

    // Create a radio button and combo for clonable configs
    btnClone = new Button(group, SWT.RADIO);
    btnClone.setFont(group.getFont());
    btnClone.setText(Messages.NewConfiguration_label_clone);
    setButtonLayoutData(btnClone);
    btnClone.addSelectionListener(radioListener);
    btnClone.setSelection(true);

    cloneConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    cloneConfigSelector.setFont(group.getFont());
    cloneConfigSelector.setItems(getDefinedConfigNamesAndDescriptions());
    index = cloneConfigSelector.indexOf(newName);
    cloneConfigSelector.select(index < 0 ? 0 : index);
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    cloneConfigSelector.setLayoutData(gd);
    cloneConfigSelector.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            validateState();
        }
    });

    updateComboState();
    updateDefaultConfigs();

    statusLabel = new Label(composite, SWT.CENTER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    statusLabel.setLayoutData(gd);
    statusLabel.setFont(composite.getFont());
    statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));

    return composite;
}

From source file:org.eclipse.cdt.ui.newui.NewConfigurationDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create a group for the name & description

    final Group group1 = new Group(composite, SWT.NONE);
    group1.setFont(composite.getFont());
    GridLayout layout1 = new GridLayout(3, false);
    group1.setLayout(layout1);//from w w w  . ja  v  a 2s.  c o  m
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    group1.setLayoutData(gd);

    // bug 187634: Add a label to warn user that configuration name will be used directly
    // as a directory name in the filesystem.
    Label warningLabel = new Label(group1, SWT.BEGINNING | SWT.WRAP);
    warningLabel.setFont(parent.getFont());
    warningLabel.setText(Messages.NewConfiguration_label_warning);
    gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 3, 1);
    gd.widthHint = 300;
    warningLabel.setLayoutData(gd);

    // Add a label and a text widget for Configuration's name
    final Label nameLabel = new Label(group1, SWT.LEFT);
    nameLabel.setFont(parent.getFont());
    nameLabel.setText(Messages.NewConfiguration_label_name);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    nameLabel.setLayoutData(gd);

    configName = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configName.setFont(group1.getFont());
    configName.setText(getNewName());
    configName.setFocus();
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configName.setLayoutData(gd);
    configName.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateState();
        }
    });

    //       Add a label and a text widget for Configuration's description
    final Label descriptionLabel = new Label(group1, SWT.LEFT);
    descriptionLabel.setFont(parent.getFont());
    descriptionLabel.setText(Messages.NewConfiguration_label_description);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    descriptionLabel.setLayoutData(gd);
    configDescription = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configDescription.setFont(group1.getFont());
    configDescription.setText(getNewDescription());
    configDescription.setFocus();

    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configDescription.setLayoutData(gd);

    final Group group = new Group(composite, SWT.NONE);
    group.setFont(composite.getFont());
    group.setText(Messages.NewConfiguration_label_group);
    GridLayout layout = new GridLayout(1, false);
    group.setLayout(layout);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    group.setLayoutData(gd);

    cloneConfigSelector = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
    cloneConfigSelector.setFont(group.getFont());
    cloneConfigSelector.setItems(getDefinedConfigNamesAndDescriptions());
    int index = cloneConfigSelector.indexOf(newName);
    cloneConfigSelector.select(index < 0 ? 0 : index);
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    cloneConfigSelector.setLayoutData(gd);
    cloneConfigSelector.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            validateState();
        }
    });

    statusLabel = new Label(composite, SWT.CENTER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    statusLabel.setLayoutData(gd);
    statusLabel.setFont(composite.getFont());
    statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));

    return composite;
}

From source file:org.eclipse.cdt.ui.newui.RenameConfigurationDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(new GridLayout(3, false));
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create a group for the name & description

    final Group group1 = new Group(composite, SWT.NONE);
    group1.setFont(composite.getFont());
    GridLayout layout1 = new GridLayout(3, false);
    group1.setLayout(layout1);/*  w w  w .  jav a  2  s  . c o  m*/
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    group1.setLayoutData(gd);

    // bug 187634: Add a label to warn user that configuration name will be used directly
    // as a directory name in the filesystem.
    Label warningLabel = new Label(group1, SWT.BEGINNING | SWT.WRAP);
    warningLabel.setFont(parent.getFont());
    warningLabel.setText(Messages.RenameConfiguration_label_warning);
    gd = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 3, 1);
    gd.widthHint = 300;
    warningLabel.setLayoutData(gd);

    // Add a label and a text widget for Configuration's name
    final Label nameLabel = new Label(group1, SWT.LEFT);
    nameLabel.setFont(parent.getFont());
    nameLabel.setText(Messages.RenameConfiguration_label_name);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    nameLabel.setLayoutData(gd);

    configName = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configName.setFont(group1.getFont());
    configName.setText(getNewName());
    configName.setFocus();
    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configName.setLayoutData(gd);
    configName.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateState();
        }
    });

    //       Add a label and a text widget for Configuration's description
    final Label descriptionLabel = new Label(group1, SWT.LEFT);
    descriptionLabel.setFont(parent.getFont());
    descriptionLabel.setText(Messages.RenameConfiguration_label_description);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 1;
    gd.grabExcessHorizontalSpace = false;
    descriptionLabel.setLayoutData(gd);
    configDescription = new Text(group1, SWT.SINGLE | SWT.BORDER);
    configDescription.setFont(group1.getFont());
    configDescription.setText(getNewDescription());
    configDescription.setFocus();

    gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
    gd.horizontalSpan = 2;
    gd.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    configDescription.setLayoutData(gd);

    statusLabel = new Label(parent, SWT.CENTER);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    statusLabel.setLayoutData(gd);
    statusLabel.setFont(composite.getFont());
    statusLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.ERROR_COLOR));
    return composite;
}